summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>2016-08-16 14:12:58 +0200
committerEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>2016-08-16 12:47:06 +0000
commit365a65da708226bd5d832c48ce55d45786abc825 (patch)
tree15d8d5d0bfb57cb477681373aa8b6ca8990de1f2 /src/gui
parent5def42f7832b599d5359d7d31218f0488673d4b9 (diff)
Remove special case for color fonts from Freetype font engine
When adding color font support to the Freetype engine, we added a special case to some functions based on the assumption that color fonts do not contain the latin alphabet. The reason for the assumption is that color fonts are currently most popular for emojis and the most popular ones on Linux did not contain the latin alphabet. But there is nothing special about color fonts making them less likely to contain latin characters than other fonts especially made for non-latin writing systems. If we want an additional fallback when the x character is not available, this should be implemented for all font engines and font types. Change-Id: I1c4aa28d49c38ba7a416c1cae50a1d1c09cbda41 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io> Reviewed-by: jian liang <jianliang79@gmail.com>
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/text/qfontengine_ft.cpp34
1 files changed, 13 insertions, 21 deletions
diff --git a/src/gui/text/qfontengine_ft.cpp b/src/gui/text/qfontengine_ft.cpp
index db2f88f79a..ca6d33c7aa 100644
--- a/src/gui/text/qfontengine_ft.cpp
+++ b/src/gui/text/qfontengine_ft.cpp
@@ -1328,33 +1328,25 @@ QFixed QFontEngineFT::leading() const
QFixed QFontEngineFT::xHeight() const
{
- if (!isScalableBitmap()) {
- TT_OS2 *os2 = (TT_OS2 *)FT_Get_Sfnt_Table(freetype->face, ft_sfnt_os2);
- if (os2 && os2->sxHeight) {
- lockFace();
- QFixed answer = QFixed(os2->sxHeight * freetype->face->size->metrics.y_ppem) / emSquareSize();
- unlockFace();
- return answer;
- }
- } else {
- return QFixed(freetype->face->size->metrics.y_ppem) * scalableBitmapScaleFactor;
+ TT_OS2 *os2 = (TT_OS2 *)FT_Get_Sfnt_Table(freetype->face, ft_sfnt_os2);
+ if (os2 && os2->sxHeight) {
+ lockFace();
+ QFixed answer = QFixed(os2->sxHeight * freetype->face->size->metrics.y_ppem) / emSquareSize();
+ unlockFace();
+ return answer;
}
+
return QFontEngine::xHeight();
}
QFixed QFontEngineFT::averageCharWidth() const
{
- if (!isScalableBitmap()) {
- TT_OS2 *os2 = (TT_OS2 *)FT_Get_Sfnt_Table(freetype->face, ft_sfnt_os2);
- if (os2 && os2->xAvgCharWidth) {
- lockFace();
- QFixed answer = QFixed(os2->xAvgCharWidth * freetype->face->size->metrics.x_ppem) / emSquareSize();
- unlockFace();
- return answer;
- }
- } else {
- const qreal aspectRatio = (qreal)xsize / ysize;
- return QFixed::fromReal(fontDef.pixelSize * aspectRatio);
+ TT_OS2 *os2 = (TT_OS2 *)FT_Get_Sfnt_Table(freetype->face, ft_sfnt_os2);
+ if (os2 && os2->xAvgCharWidth) {
+ lockFace();
+ QFixed answer = QFixed(os2->xAvgCharWidth * freetype->face->size->metrics.x_ppem) / emSquareSize();
+ unlockFace();
+ return answer;
}
return QFontEngine::averageCharWidth();