summaryrefslogtreecommitdiffstats
path: root/src/gui/text/qfontengine_x11.cpp
diff options
context:
space:
mode:
authorEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>2009-10-09 16:59:43 +0200
committerEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>2009-10-09 17:00:59 +0200
commit30bd59a1dec78e3b8bb9bbbc4f129663efa169a6 (patch)
tree967ef1c2b3416477d25b7a256490c271ab5259fc /src/gui/text/qfontengine_x11.cpp
parent45b8fa65b82bcdb82ddb2f515e551d2948baf36d (diff)
Fix printing bitmap fonts on X11 with FontConfig enabled
When FontConfig was enabled, bitmap fonts would often get a different pixel size than the one we requested. Usually the size would only be a pixel off, but this was especially visible when printing in highres with bitmap fonts, because in those cases we would request a pixel size which was computed based on the printer's high dpi. The result was that all printed text with bitmap fonts would be really really tiny. The fix falls back to using the XLFD font engine when using bitmap fonts (when the returned pixel size is different from the requested), because this engine scales the fonts for us. This will cause bitmap fonts to be rendered without antialiasing. Task-number: QTBUG-3620 Reviewed-by: Simon Hausmann
Diffstat (limited to 'src/gui/text/qfontengine_x11.cpp')
-rw-r--r--src/gui/text/qfontengine_x11.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/gui/text/qfontengine_x11.cpp b/src/gui/text/qfontengine_x11.cpp
index 5ea45549ed..ffc0eb4029 100644
--- a/src/gui/text/qfontengine_x11.cpp
+++ b/src/gui/text/qfontengine_x11.cpp
@@ -488,6 +488,7 @@ glyph_metrics_t QFontEngineXLFD::boundingBox(const QGlyphLayout &glyphs)
QFixed y = overall.yoff + glyphs.offsets[i].y - xcs->ascent;
overall.x = qMin(overall.x, x);
overall.y = qMin(overall.y, y);
+ // XCharStruct::rbearing is defined as distance from left edge to rightmost pixel
xmax = qMax(xmax, overall.xoff + glyphs.offsets[i].x + xcs->rbearing);
ymax = qMax(ymax, y + xcs->ascent + xcs->descent);
overall.xoff += glyphs.advances_x[i];
@@ -511,6 +512,8 @@ glyph_metrics_t QFontEngineXLFD::boundingBox(glyph_t glyph)
glyph_metrics_t gm;
XCharStruct *xcs = charStruct(_fs, glyph);
if (xcs) {
+ // XCharStruct::rbearing is defined as distance from left edge to rightmost pixel
+ // XCharStruct::width is defined as the advance
gm = glyph_metrics_t(xcs->lbearing, -xcs->ascent, xcs->rbearing- xcs->lbearing, xcs->ascent + xcs->descent,
xcs->width, 0);
} else {