summaryrefslogtreecommitdiffstats
path: root/src/gui/dialogs/images/page-setup-24.png
diff options
context:
space:
mode:
authorEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>2024-05-27 11:58:11 +0200
committerEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>2024-05-31 19:30:53 +0200
commit1bc78f7739ca4319323de5e7e07f88ef5cbd52bc (patch)
treefa08133248197e5251736752f3c9380a5cc500bc /src/gui/dialogs/images/page-setup-24.png
parentd41ae1a9a8cd15619e9c47120390ad27144abdeb (diff)
Introduce flag to use typographical line metrics for fontsHEADdev
For backwards compatibility reasons, font files have multiple different ways to specify vertical metrics (ascent, descent, etc.). For OpenType, the main two are the usWin* and sTypo* metrics in the OS/2 font table. The usWin* metrics are typically used as the clipping bounds of the font (so no character will ever draw outside these bounds). The sTypo* metrics thus make it possible to specify a different set of metrics for use in text layouts which is smaller than the clipping bounds (or bigger), so that you can have fonts where some characters overlap with preceding or subsequent lines. However, GDI (and thus many applications) use usWin* also for line spacing, which lead to the sTypo* metrics being untrustworthy in some fonts and later to the introduction of the USE_TYPO_METRICS in the OS/2 table version 4. The idea of this flag is to tell the font system that the sTypo* metrics can be trusted and should be preferred over the usWin* metrics. But the OpenType specification states that sTypo* metrics should *always* be preferred and modern font systems such as FreeType and DirectWrite will respect this. This in turn has lead to fonts where the USE_TYPO_METRICS flag is untrustworthy instead, i.e. the sTypo* metrics are preferable, but the USE_TYPO_METRICS has accidentally not been set. Qt trusts the USE_TYPO_METRICS flag and uses the usWin* metrics whenever this is unset. Since QFontMetricsF::height() (ascent+descent) in this case includes the line gap metric, a lot of components have been written to use it for size without adding any margins over the text. So changing the default now would break a large amount of components, including the ones in our own Windows style. Most fonts should work correctly, by setting the USE_TYPO_METRICS flag if the typo metrics are intended to be used. For those that do not, we introduce a PreferTypoLineMetrics style strategy. [ChangeLog][QtGui][Fonts] Added QFont::PreferTypoLineMetrics for using the recommended line spacing metrics of the font, even if the font has not explicitly set its USE_TYPO_METRICS flag. Fixes: QTBUG-125585 Change-Id: Ib2f7df404fe719186d78733bda26da712f1ab85a Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Diffstat (limited to 'src/gui/dialogs/images/page-setup-24.png')
0 files changed, 0 insertions, 0 deletions