summaryrefslogtreecommitdiffstats
path: root/src/gui/text/qfontengine_ft.cpp
diff options
context:
space:
mode:
authorSamuel Rødal <samuel.rodal@nokia.com>2011-05-11 12:39:09 +0200
committerSamuel Rødal <samuel.rodal@nokia.com>2011-05-11 12:39:09 +0200
commit5e2b0aa1b344bc93af29d7977aa7e497bfc7a9cf (patch)
treec478b00d1c04166f3c1c163971edb4575b065b13 /src/gui/text/qfontengine_ft.cpp
parentd1622207ba501b93bd83b88d61a5631d3d0da0cc (diff)
parentfda40e37df1152b5a8c572fe4bc53620bfcbcc45 (diff)
Merge remote branch 'staging/master' into refactor
Conflicts: src/gui/painting/qdrawhelper_p.h src/gui/painting/qgraphicssystemfactory.cpp src/gui/painting/qpainter.cpp src/gui/painting/qunifiedtoolbarsurface_mac.cpp src/gui/painting/qunifiedtoolbarsurface_mac_p.h src/openvg/openvg.pro src/openvg/qpaintengine_vg.cpp src/openvg/qwindowsurface_vg.cpp src/openvg/qwindowsurface_vgegl.cpp src/plugins/platforms/wayland/qwaylanddisplay.cpp src/widgets/graphicsview/qgraphicsscene.cpp
Diffstat (limited to 'src/gui/text/qfontengine_ft.cpp')
-rw-r--r--src/gui/text/qfontengine_ft.cpp102
1 files changed, 1 insertions, 101 deletions
diff --git a/src/gui/text/qfontengine_ft.cpp b/src/gui/text/qfontengine_ft.cpp
index 58bcca87b7..4dae2a3784 100644
--- a/src/gui/text/qfontengine_ft.cpp
+++ b/src/gui/text/qfontengine_ft.cpp
@@ -803,106 +803,6 @@ int QFontEngineFT::loadFlags(QGlyphSet *set, GlyphFormat format, int flags,
return load_flags;
}
-QFontEngineFT::Glyph *QFontEngineFT::loadGlyphMetrics(QGlyphSet *set, uint glyph, GlyphFormat format) const
-{
- Glyph *g = set->getGlyph(glyph);
- if (g && g->format == format)
- return g;
-
- bool hsubpixel = false;
- int vfactor = 1;
- int load_flags = loadFlags(set, format, 0, hsubpixel, vfactor);
-
- // apply our matrix to this, but note that the metrics will not be affected by this.
- FT_Face face = lockFace();
- FT_Matrix matrix = this->matrix;
- FT_Matrix_Multiply(&set->transformationMatrix, &matrix);
- FT_Set_Transform(face, &matrix, 0);
- freetype->matrix = matrix;
-
- bool transform = matrix.xx != 0x10000 || matrix.yy != 0x10000 || matrix.xy != 0 || matrix.yx != 0;
- if (transform)
- load_flags |= FT_LOAD_NO_BITMAP;
-
- FT_Error err = FT_Load_Glyph(face, glyph, load_flags);
- if (err && (load_flags & FT_LOAD_NO_BITMAP)) {
- load_flags &= ~FT_LOAD_NO_BITMAP;
- err = FT_Load_Glyph(face, glyph, load_flags);
- }
- if (err == FT_Err_Too_Few_Arguments) {
- // this is an error in the bytecode interpreter, just try to run without it
- load_flags |= FT_LOAD_FORCE_AUTOHINT;
- err = FT_Load_Glyph(face, glyph, load_flags);
- }
- if (err != FT_Err_Ok)
- qWarning("load glyph failed err=%x face=%p, glyph=%d", err, face, glyph);
-
- unlockFace();
- if (set->outline_drawing)
- return 0;
-
- if (!g) {
- g = new Glyph;
- g->uploadedToServer = false;
- g->data = 0;
- }
-
- FT_GlyphSlot slot = face->glyph;
- 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;
- int bottom = slot->metrics.horiBearingY - slot->metrics.height;
- if (transform && slot->format != FT_GLYPH_FORMAT_BITMAP) { // freetype doesn't apply the transformation on the metrics
- int l, r, t, b;
- FT_Vector vector;
- vector.x = left;
- vector.y = top;
- FT_Vector_Transform(&vector, &matrix);
- l = r = vector.x;
- t = b = vector.y;
- vector.x = right;
- vector.y = top;
- FT_Vector_Transform(&vector, &matrix);
- if (l > vector.x) l = vector.x;
- if (r < vector.x) r = vector.x;
- if (t < vector.y) t = vector.y;
- if (b > vector.y) b = vector.y;
- vector.x = right;
- vector.y = bottom;
- FT_Vector_Transform(&vector, &matrix);
- if (l > vector.x) l = vector.x;
- if (r < vector.x) r = vector.x;
- if (t < vector.y) t = vector.y;
- if (b > vector.y) b = vector.y;
- vector.x = left;
- vector.y = bottom;
- FT_Vector_Transform(&vector, &matrix);
- if (l > vector.x) l = vector.x;
- if (r < vector.x) r = vector.x;
- if (t < vector.y) t = vector.y;
- if (b > vector.y) b = vector.y;
- left = l;
- right = r;
- top = t;
- bottom = b;
- }
- left = FLOOR(left);
- right = CEIL(right);
- bottom = FLOOR(bottom);
- top = CEIL(top);
-
- g->linearAdvance = face->glyph->linearHoriAdvance >> 10;
- g->width = TRUNC(right-left);
- g->height = TRUNC(top-bottom);
- g->x = TRUNC(left);
- g->y = TRUNC(top);
- g->advance = TRUNC(ROUND(face->glyph->advance.x));
- g->format = Format_None;
-
- return g;
-}
-
QFontEngineFT::Glyph *QFontEngineFT::loadGlyph(QGlyphSet *set, uint glyph,
QFixed subPixelPosition,
GlyphFormat format,
@@ -1697,7 +1597,7 @@ void QFontEngineFT::recalcAdvances(QGlyphLayout *glyphs, QTextEngine::ShaperFlag
FT_Face face = 0;
bool design = (default_hint_style == HintNone ||
default_hint_style == HintLight ||
- (flags & HB_ShaperFlag_UseDesignMetrics));
+ (flags & HB_ShaperFlag_UseDesignMetrics)) && FT_IS_SCALABLE(freetype->face);
for (int i = 0; i < glyphs->numGlyphs; i++) {
Glyph *g = defaultGlyphSet.getGlyph(glyphs->glyphs[i]);
if (g) {