rhbz#1177022: vcl: fix PDF embedding of Type 1 fonts

Desktop / LibreOffice - Michael Stahl [redhat.com] - 27 January 2015 07:42 UTC

Problem is that for the "CM Typewriter" font the Width for "space" (32) is exported as 0 instead of 525, which is the correct value in the AFM.

The reason is that PDFWriterImpl::emitEmbeddedFont() has various arrays to map from font code points to Unicode code points, and there are duplicate mappings, so the 160->32 mapping overrides 32->32.

The PrintFontManager::PrintFont::readAfmMetrics() actually creates a Unicode to font code mapping (which may legitimately be n:1) that is then inverted; add an additional hack to store a set of "preferred" Unicodes so that PDFWriterImpl can pick the right Unicode.

Presumably the code that is stored explicitly via "C" or "CH" in the AFM should take priority over more generic mappings.

5183910 rhbz#1177022: vcl: fix PDF embedding of Type 1 fonts
vcl/generic/fontmanager/fontmanager.cxx | 25 ++++++++++++++++++++++-
vcl/generic/print/genpspgraphics.cxx | 8 ++++----
vcl/headless/svptext.cxx | 4 ++--
vcl/inc/cairotextrender.hxx | 2 +-
vcl/inc/fontmanager.hxx | 7 ++++++-
vcl/inc/generic/genpspgraphics.h | 6 ++++--
vcl/inc/headless/svpgdi.hxx | 2 +-
vcl/inc/quartz/salgdi.h | 2 +-
vcl/inc/salgdi.hxx | 4 +++-
vcl/inc/textrender.hxx | 2 +-
vcl/inc/unx/salgdi.h | 2 +-
vcl/inc/win/salgdi.h | 2 +-
vcl/quartz/salgdi.cxx | 2 +-
vcl/source/gdi/pdfwriter_impl.cxx | 33 +++++++++++++++++++++++++++----
vcl/unx/generic/gdi/cairotextrender.cxx | 4 ++--
vcl/unx/generic/gdi/salgdi3.cxx | 4 ++--
vcl/win/source/gdi/salgdi3.cxx | 2 +-
17 files changed, 84 insertions(+), 27 deletions(-)

Upstream: cgit.freedesktop.org


  • Share