Changeset View
Changeset View
Standalone View
Standalone View
kcms/fonts/fonts.cpp
Show First 20 Lines • Show All 256 Lines • ▼ Show 20 Line(s) | 255 | { | |||
---|---|---|---|---|---|
257 | KFontChooser::FontDiffFlags fontDiffFlags; | 257 | KFontChooser::FontDiffFlags fontDiffFlags; | ||
258 | int ret = KFontChooserDialog::getFontDiff(font, fontDiffFlags, KFontChooser::NoDisplayFlags); | 258 | int ret = KFontChooserDialog::getFontDiff(font, fontDiffFlags, KFontChooser::NoDisplayFlags); | ||
259 | 259 | | |||
260 | if (ret == QDialog::Accepted && fontDiffFlags) { | 260 | if (ret == QDialog::Accepted && fontDiffFlags) { | ||
261 | m_settings->setFont(applyFontDiff(m_settings->font(), font, fontDiffFlags)); | 261 | m_settings->setFont(applyFontDiff(m_settings->font(), font, fontDiffFlags)); | ||
262 | m_settings->setMenuFont(applyFontDiff(m_settings->menuFont(), font, fontDiffFlags)); | 262 | m_settings->setMenuFont(applyFontDiff(m_settings->menuFont(), font, fontDiffFlags)); | ||
263 | m_settings->setToolBarFont(applyFontDiff(m_settings->toolBarFont(), font, fontDiffFlags)); | 263 | m_settings->setToolBarFont(applyFontDiff(m_settings->toolBarFont(), font, fontDiffFlags)); | ||
264 | m_settings->setActiveFont(applyFontDiff(m_settings->activeFont(), font, fontDiffFlags)); | 264 | m_settings->setActiveFont(applyFontDiff(m_settings->activeFont(), font, fontDiffFlags)); | ||
265 | m_settings->setSmallestReadableFont(applyFontDiff(m_settings->smallestReadableFont(), font, fontDiffFlags)); | 265 | | ||
266 | QFont smallestFont = font; | ||||
267 | // Make the small font 2 points smaller than the general font, but only | ||||
ahmadsamir: But if the user selects a very small size, then size - 2 will be even tinier. Maybe make it… | |||||
268 | // if the general font is 9pt or higher or else the small font would be | ||||
269 | // borderline unreadable. Assume that if the user is making the font | ||||
270 | // tiny, they want a tiny font everywhere. | ||||
271 | const int generalFontPointSize = font.pointSize(); | ||||
Nit-pick: I'd store font.pointSize() in a const int, and use that instead of calling pointSize() more than once. ahmadsamir: Nit-pick: I'd store font.pointSize() in a const int, and use that instead of calling pointSize… | |||||
272 | if (generalFontPointSize >= 9) { | ||||
Nit-pick can we align comment and code either higher than 8pt (comment) or >= 9 on the code bport: Nit-pick can we align comment and code either higher than 8pt (comment) or >= 9 on the code | |||||
273 | smallestFont.setPointSize(generalFontPointSize - 2); | ||||
274 | } | ||||
275 | m_settings->setSmallestReadableFont(applyFontDiff(m_settings->smallestReadableFont(), smallestFont, fontDiffFlags)); | ||||
266 | 276 | | |||
267 | const QFont adjustedFont = applyFontDiff(m_settings->fixed(), font, fontDiffFlags); | 277 | const QFont adjustedFont = applyFontDiff(m_settings->fixed(), font, fontDiffFlags); | ||
268 | if (QFontInfo(adjustedFont).fixedPitch()) { | 278 | if (QFontInfo(adjustedFont).fixedPitch()) { | ||
269 | m_settings->setFixed(adjustedFont); | 279 | m_settings->setFixed(adjustedFont); | ||
270 | } | 280 | } | ||
271 | } | 281 | } | ||
272 | } | 282 | } | ||
273 | 283 | | |||
▲ Show 20 Lines • Show All 42 Lines • Show Last 20 Lines |
But if the user selects a very small size, then size - 2 will be even tinier. Maybe make it conditional for size >= 6 or 8?