diff --git a/src/gui/text/qfontengine_win.cpp b/src/gui/text/qfontengine_win.cpp index 7e0a337..93f61c2 100644 --- a/src/gui/text/qfontengine_win.cpp +++ b/src/gui/text/qfontengine_win.cpp @@ -190,6 +190,43 @@ static OUTLINETEXTMETRIC *getOutlineTextMetric(HDC hdc) return otm; } +QDebug operator<<(QDebug d, const glyph_metrics_t &gm) +{ + if (!gm.isValid()) { + d << "glyph_metrics_t INVALID"; + return d; + } + d << "glyph_metrics_t origin: " << gm.x << ',' << gm.y << " size: " + << gm.width << 'x' << gm.height << " offset: " << gm.xoff << ',' << gm.yoff; + return d; +} + +QDebug operator<<(QDebug d, const ABCFLOAT &gm) +{ + d << "ABCFLOAT " << gm.abcfA << ' ' << gm.abcfB << ' ' << gm.abcfC; + return d; +} + +QDebug operator<<(QDebug d, const FIXED &f) +{ + d.nospace() << f.value << '.' << f.fract; + return d; +} + +QDebug operator<<(QDebug d, const MAT2 &m) +{ + d << "MAT2 {" << m.eM11 << ',' << m.eM12 << ',' << m.eM21 << ',' << m.eM22 << '}'; + return d; +} + +QDebug operator<<(QDebug d, const GLYPHMETRICS &gm) +{ + d.nospace() << "GLYPHMETRICS blackbox: " << gm.gmBlackBoxX << 'x' << gm.gmBlackBoxY + << " origin " << gm.gmptGlyphOrigin.x << ',' < QTransform::TxTranslate) { XFORM xform; @@ -550,16 +592,22 @@ glyph_metrics_t QFontEngineWin::boundingBox(glyph_t glyph, const QTransform &t) SelectObject(hdc, hfont); glyph_metrics_t glyphMetrics; + qDebug() << __FUNCTION__ << '1' << _name << glyph << t; bool success = getOutlineMetrics(glyph, t, &glyphMetrics); + qDebug() << __FUNCTION__ << '2' << _name << "SUC=" << success << "TTF" << ttf + << glyphMetrics; if (!ttf && !success) { // Bitmap fonts wchar_t ch = glyph; ABCFLOAT abc; - GetCharABCWidthsFloat(hdc, ch, ch, &abc); + if (!GetCharABCWidthsFloat(hdc, ch, ch, &abc)) + qErrnoWarning("GetCharABCWidthsFloat() failed"); int width = qRound(abc.abcfB); - - return glyph_metrics_t(QFixed::fromReal(abc.abcfA), -tm.tmAscent, width, tm.tmHeight, width, 0).transformed(t); + const glyph_metrics_t ro = glyph_metrics_t(QFixed::fromReal(abc.abcfA), -tm.tmAscent, width, tm.tmHeight, width, 0); + const glyph_metrics_t r =ro.transformed(t); + qDebug() << __FUNCTION__ << '3' << _name << abc << "width=" << width << ro << r; + return r; } return glyphMetrics; @@ -1090,9 +1138,10 @@ extern bool qt_cleartype_enabled; QNativeImage *QFontEngineWin::drawGDIGlyph(HFONT font, glyph_t glyph, int margin, const QTransform &t, QImage::Format mask_format) { + qDebug() << __FUNCTION__ << QT_VERSION_STR << _name << glyph << t; Q_UNUSED(mask_format) glyph_metrics_t gm = boundingBox(glyph); - + qDebug() << __FUNCTION__ << _name << gm; // printf(" -> for glyph %4x\n", glyph); int gx = gm.x.toInt(); @@ -1100,8 +1149,10 @@ QNativeImage *QFontEngineWin::drawGDIGlyph(HFONT font, glyph_t glyph, int margin int iw = gm.width.toInt(); int ih = gm.height.toInt(); - if (iw <= 0 || iw <= 0) + if (iw <= 0 || iw <= 0) { + qDebug() << __FUNCTION__ << _name << "bailing out " << iw; return 0; + } bool has_transformation = t.type() > QTransform::TxTranslate; @@ -1109,6 +1160,7 @@ QNativeImage *QFontEngineWin::drawGDIGlyph(HFONT font, glyph_t glyph, int margin unsigned int options = ttf ? ETO_GLYPH_INDEX : 0; XFORM xform; + qDebug() << "hastransform" << has_transformation << t; if (has_transformation) { xform.eM11 = t.m11(); xform.eM12 = t.m12(); @@ -1129,9 +1181,10 @@ QNativeImage *QFontEngineWin::drawGDIGlyph(HFONT font, glyph_t glyph, int margin MAT2 mat; memset(&mat, 0, sizeof(mat)); mat.eM11.value = mat.eM22.value = 1; - + qDebug() << __FUNCTION__ << _name + << glyph << "op" << ggo_options << mat << "ttf=" << ttf; if (GetGlyphOutline(hdc, glyph, ggo_options, &tgm, 0, 0, &mat) == GDI_ERROR) { - qWarning("QWinFontEngine: unable to query transformed glyph metrics..."); + qErrnoWarning("QWinFontEngine: unable to query transformed glyph metrics..."); return 0; }