summaryrefslogtreecommitdiffstats
path: root/src/gui/text/qfontengine_ft.cpp
diff options
context:
space:
mode:
authorKonstantin Ritt <ritt.ks@gmail.com>2013-03-09 21:39:21 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-03-13 14:46:26 +0100
commitcfa663d62b147c4050359e036f17a6b1b6a8b4fe (patch)
tree1ae4bbde87ccee0f00878c29f292c99ab2eb32d5 /src/gui/text/qfontengine_ft.cpp
parent74494ea29ebc6e152348ed6a6c1e2c9399ddb204 (diff)
Avoid using HB types in QFontEngine API
This affects HB_Font and HB_Face. As of now, the Hurfbuzz API usage is concentrated in qfontengine(|_ft).cpp and qtextengine.cpp, thus it is a lot easier to switch to Hurfbuzz-NG. Change-Id: Ie06959efd5d6080fe44c407d9f5de0a07dd1c210 Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Josh Faust <jfaust@suitabletech.com>
Diffstat (limited to 'src/gui/text/qfontengine_ft.cpp')
-rw-r--r--src/gui/text/qfontengine_ft.cpp32
1 files changed, 21 insertions, 11 deletions
diff --git a/src/gui/text/qfontengine_ft.cpp b/src/gui/text/qfontengine_ft.cpp
index 6cac4b9205..8486810299 100644
--- a/src/gui/text/qfontengine_ft.cpp
+++ b/src/gui/text/qfontengine_ft.cpp
@@ -46,6 +46,8 @@
#include "qfontengine_ft_p.h"
#include "private/qimage_p.h"
+#include <private/qharfbuzz_p.h>
+
#ifndef QT_NO_FREETYPE
#include "qfile.h"
@@ -258,8 +260,12 @@ QFreetypeFace *QFreetypeFace::getFace(const QFontEngine::FaceId &face_id,
}
newFreetype->face = face;
- newFreetype->hbFace = qHBNewFace(face, hb_getSFntTable);
- Q_CHECK_PTR(newFreetype->hbFace);
+ HB_Face hbFace = qHBNewFace(face, hb_getSFntTable);
+ Q_CHECK_PTR(hbFace);
+ if (hbFace->font_for_init != 0)
+ hbFace = qHBLoadFace(hbFace);
+ newFreetype->hbFace = (void *)hbFace;
+
newFreetype->ref.store(1);
newFreetype->xsize = 0;
newFreetype->ysize = 0;
@@ -313,7 +319,7 @@ void QFreetypeFace::release(const QFontEngine::FaceId &face_id)
{
QtFreetypeData *freetypeData = qt_getFreetypeData();
if (!ref.deref()) {
- qHBFreeFace(hbFace);
+ qHBFreeFace((HB_Face)hbFace);
FT_Done_Face(face);
if(freetypeData->faces.contains(face_id))
freetypeData->faces.take(face_id);
@@ -654,7 +660,6 @@ QFontEngineFT::~QFontEngineFT()
{
if (freetype)
freetype->release(face_id);
- hbFace = 0; // we share the face in QFreeTypeFace, don't let ~QFontEngine delete it
}
bool QFontEngineFT::init(FaceId faceId, bool antialias, GlyphFormat format,
@@ -691,7 +696,7 @@ bool QFontEngineFT::init(FaceId faceId, bool antialias, GlyphFormat format,
symbol = bool(fontDef.family.contains(QLatin1String("symbol"), Qt::CaseInsensitive));
}
// #####
- freetype->hbFace->isSymbolFont = symbol;
+ ((HB_Face)freetype->hbFace)->isSymbolFont = symbol;
lbearing = rbearing = SHRT_MIN;
freetype->computeSize(fontDef, &xsize, &ysize, &defaultGlyphSet.outline_drawing);
@@ -729,12 +734,17 @@ bool QFontEngineFT::init(FaceId faceId, bool antialias, GlyphFormat format,
if (line_thickness < 1)
line_thickness = 1;
- hbFont.x_ppem = face->size->metrics.x_ppem;
- hbFont.y_ppem = face->size->metrics.y_ppem;
- hbFont.x_scale = face->size->metrics.x_scale;
- hbFont.y_scale = face->size->metrics.y_scale;
-
- hbFace = freetype->hbFace;
+ HB_FontRec *hbFont = (HB_FontRec *)font_;
+ hbFont->x_ppem = face->size->metrics.x_ppem;
+ hbFont->y_ppem = face->size->metrics.y_ppem;
+ hbFont->x_scale = face->size->metrics.x_scale;
+ hbFont->y_scale = face->size->metrics.y_scale;
+
+ // ###
+ if (face_ && face_destroy_func)
+ face_destroy_func(face_);
+ face_ = freetype->hbFace;
+ face_destroy_func = 0; // we share the face in QFreeTypeFace, don't let ~QFontEngine delete it
metrics = face->size->metrics;