Commit 4698f8b7 authored by Oliver Sander's avatar Oliver Sander

Use glyph widths from FreeType rather than what the file says

pdf files contain lists of glyph widths even for fonts that are
not embedded.  This can lead to problems when the exact font does
not exist on the system, and FreeType substitutes another similar
one.  In that case poppler currently uses the glyph widths from
the pdf file, which however may not match the font that is
actually used.
parent d3a2b93c
Pipeline #85043 failed with stage
in 9 minutes and 11 seconds
......@@ -1392,6 +1392,18 @@ Gfx8BitFont::Gfx8BitFont(XRef *xref, const char *tagA, Ref idA, GooString *nameA
}
}
// Overwrite glyph widths with the values obtained from FreeType
// TODO: The code right in front of this is partially obsolete,
// because the 'width' values are overwritten anyway.
initFreeTypeFontFace(xref);
if (freeTypeFontFace) {
auto freeTypeWidths = freeTypeFontFace->getFontMetrics();
std::copy(freeTypeWidths.begin(), freeTypeWidths.end(), widths);
ok = true;
return;
}
// use widths from built-in font
} else if (builtinFont) {
// this is a kludge for broken PDF files that encode char 32
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment