summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJiang Jiang <jiang.jiang@nokia.com>2010-08-30 12:03:37 (GMT)
committerJason McDonald <jason.mcdonald@nokia.com>2010-09-03 03:21:13 (GMT)
commit6268e104ba84761ab8e8fb633ff61a27a9524844 (patch)
tree9072d0117cf791929a7e20d32a795461112549a6
parentf52b6b047a1cb0e4d1209a80f35229a6f4b1c43c (diff)
downloadQt-6268e104ba84761ab8e8fb633ff61a27a9524844.zip
Qt-6268e104ba84761ab8e8fb633ff61a27a9524844.tar.gz
Qt-6268e104ba84761ab8e8fb633ff61a27a9524844.tar.bz2
Fix compiling issue for FreeType version earlier than 2.1.10
FT_GlyphSlot_Embolden was introduced since FreeType 2.1.10 and we started using it since 4.7. Some systems (including RHEL/CentOS 4) only provide earlier versions will get a compiling error if they use -system-freetype to build Qt. This patch fix it by providing a graceful degradation when the function is not available. Task-number: QTBUG-13274 Reviewed-by: Eskil (cherry picked from commit 25622198904580c6eb93996f74c2e7b62afa77c7)
-rw-r--r--src/gui/text/qfontengine_ft.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/gui/text/qfontengine_ft.cpp b/src/gui/text/qfontengine_ft.cpp
index 2c4fbab..60db8b6 100644
--- a/src/gui/text/qfontengine_ft.cpp
+++ b/src/gui/text/qfontengine_ft.cpp
@@ -94,6 +94,13 @@ QT_BEGIN_NAMESPACE
#define Y_SIZE(face,i) ((face)->available_sizes[i].height << 6)
#endif
+/* FreeType 2.1.10 starts to provide FT_GlyphSlot_Embolden */
+#if (FREETYPE_MAJOR*10000+FREETYPE_MINOR*100+FREETYPE_PATCH) >= 20110
+#define Q_FT_GLYPHSLOT_EMBOLDEN(slot) FT_GlyphSlot_Embolden(slot)
+#else
+#define Q_FT_GLYPHSLOT_EMBOLDEN(slot)
+#endif
+
#define FLOOR(x) ((x) & -64)
#define CEIL(x) (((x)+63) & -64)
#define TRUNC(x) ((x) >> 6)
@@ -794,7 +801,7 @@ QFontEngineFT::Glyph *QFontEngineFT::loadGlyphMetrics(QGlyphSet *set, uint glyph
}
FT_GlyphSlot slot = face->glyph;
- if (embolden) FT_GlyphSlot_Embolden(slot);
+ if (embolden) Q_FT_GLYPHSLOT_EMBOLDEN(slot);
int left = slot->metrics.horiBearingX;
int right = slot->metrics.horiBearingX + slot->metrics.width;
int top = slot->metrics.horiBearingY;
@@ -940,7 +947,7 @@ QFontEngineFT::Glyph *QFontEngineFT::loadGlyph(QGlyphSet *set, uint glyph, Glyph
return 0;
FT_GlyphSlot slot = face->glyph;
- if (embolden) FT_GlyphSlot_Embolden(slot);
+ if (embolden) Q_FT_GLYPHSLOT_EMBOLDEN(slot);
FT_Library library = qt_getFreetype();
info.xOff = TRUNC(ROUND(slot->advance.x));