Fix PDF when embedding fonts with large internal leading

Setting lfHeight to a positive value in LOGFONT requests the font
with the given cell height, which is em square size + internal
leading. When setting this to the em square size, it means we
will get glyphs that are actually sized for an em square with
sides that are (emSquareSize - internalLeading). For most fonts,
this was not noticeable, but for some fonts with large internal
leading, the resulting glyphs would be very small.

When setting lfHeight to something < 0 instead, we are selecting
the font with the given character height instead, which is not
including the internal leading.

[ChangeLog][PDF] Fix embedding glyphs from fonts with large
internal leading.

Task-number: QTBUG-43082
Change-Id: Id74cf2279df2062804e9431fe305d803cb0b19d2
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
This commit is contained in:
Eskil Abrahamsen Blomfeldt 2014-12-16 14:51:21 +01:00
parent bfbb985ed5
commit 9f63e2dc0e

View File

@ -1017,7 +1017,7 @@ QFontEngine::Properties QWindowsFontEngine::properties() const
void QWindowsFontEngine::getUnscaledGlyph(glyph_t glyph, QPainterPath *path, glyph_metrics_t *metrics)
{
LOGFONT lf = m_logfont;
lf.lfHeight = unitsPerEm;
lf.lfHeight = -unitsPerEm;
int flags = synthesized();
if(flags & SynthesizedItalic)
lf.lfItalic = false;