Changeset View
Changeset View
Standalone View
Standalone View
kcms/fonts/fonts.cpp
Show First 20 Lines • Show All 255 Lines • ▼ Show 20 Line(s) | 254 | { | |||
---|---|---|---|---|---|
256 | KFontChooser::FontDiffFlags fontDiffFlags; | 256 | KFontChooser::FontDiffFlags fontDiffFlags; | ||
257 | int ret = KFontChooserDialog::getFontDiff(font, fontDiffFlags, KFontChooser::NoDisplayFlags); | 257 | int ret = KFontChooserDialog::getFontDiff(font, fontDiffFlags, KFontChooser::NoDisplayFlags); | ||
258 | 258 | | |||
259 | if (ret == QDialog::Accepted && fontDiffFlags) { | 259 | if (ret == QDialog::Accepted && fontDiffFlags) { | ||
260 | m_settings->setFont(applyFontDiff(m_settings->font(), font, fontDiffFlags)); | 260 | m_settings->setFont(applyFontDiff(m_settings->font(), font, fontDiffFlags)); | ||
261 | m_settings->setMenuFont(applyFontDiff(m_settings->menuFont(), font, fontDiffFlags)); | 261 | m_settings->setMenuFont(applyFontDiff(m_settings->menuFont(), font, fontDiffFlags)); | ||
262 | m_settings->setToolBarFont(applyFontDiff(m_settings->toolBarFont(), font, fontDiffFlags)); | 262 | m_settings->setToolBarFont(applyFontDiff(m_settings->toolBarFont(), font, fontDiffFlags)); | ||
263 | m_settings->setActiveFont(applyFontDiff(m_settings->activeFont(), font, fontDiffFlags)); | 263 | m_settings->setActiveFont(applyFontDiff(m_settings->activeFont(), font, fontDiffFlags)); | ||
264 | m_settings->setSmallestReadableFont(applyFontDiff(m_settings->smallestReadableFont(), font, fontDiffFlags)); | 264 | | ||
265 | QFont smallestFont = font; | ||||
266 | // 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… | |||||
267 | // if the general font is 9pt or higher or else the small font would be | ||||
268 | // borderline unreadable. Assume that if the user is making the font | ||||
269 | // tiny, they want a tiny font everywhere. | ||||
270 | 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… | |||||
271 | 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 | |||||
272 | smallestFont.setPointSize(generalFontPointSize - 2); | ||||
273 | } | ||||
274 | m_settings->setSmallestReadableFont(applyFontDiff(m_settings->smallestReadableFont(), smallestFont, fontDiffFlags)); | ||||
265 | 275 | | |||
266 | const QFont adjustedFont = applyFontDiff(m_settings->fixed(), font, fontDiffFlags); | 276 | const QFont adjustedFont = applyFontDiff(m_settings->fixed(), font, fontDiffFlags); | ||
267 | if (QFontInfo(adjustedFont).fixedPitch()) { | 277 | if (QFontInfo(adjustedFont).fixedPitch()) { | ||
268 | m_settings->setFixed(adjustedFont); | 278 | m_settings->setFixed(adjustedFont); | ||
269 | } | 279 | } | ||
270 | } | 280 | } | ||
271 | } | 281 | } | ||
272 | 282 | | |||
▲ 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?