Remove QFontEngineFT::loadGlyphMetrics
authorJiang Jiang <jiang.jiang@nokia.com>
Tue, 3 May 2011 11:50:10 +0000 (13:50 +0200)
committerJiang Jiang <jiang.jiang@nokia.com>
Wed, 4 May 2011 12:34:31 +0000 (14:34 +0200)
It is no longer used and was accidentally merged back in.

Reviewed-by: Eskil
(cherry picked from commit 782535ac548c582542bd1c17207e288e816870a8)

src/gui/text/qfontengine_ft.cpp
src/gui/text/qfontengine_ft_p.h

index 58bcca8..237cde4 100644 (file)
@@ -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,
index 2c335f3..4106471 100644 (file)
@@ -343,7 +343,6 @@ protected:
 private:
     friend class QFontEngineFTRawFont;
 
-    QFontEngineFT::Glyph *loadGlyphMetrics(QGlyphSet *set, uint glyph, GlyphFormat format) const;
     int loadFlags(QGlyphSet *set, GlyphFormat format, int flags, bool &hsubpixel, int &vfactor) const;
 
     GlyphFormat defaultFormat;