r21730 by jghali - #14550: PDF font embedding doesn't work with Arabic
scribus-commit
scribus-commit at lists.scribus.net
Tue Jan 17 00:08:44 UTC 2017
Author: jghali
Date: Tue Jan 17 00:08:44 2017
New Revision: 21730
URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=21730
Log:
#14550: PDF font embedding doesn't work with Arabic
Modified:
trunk/Scribus/scribus/pdflib_core.cpp
Modified: trunk/Scribus/scribus/pdflib_core.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=21730&path=/trunk/Scribus/scribus/pdflib_core.cpp
==============================================================================
--- trunk/Scribus/scribus/pdflib_core.cpp (original)
+++ trunk/Scribus/scribus/pdflib_core.cpp Tue Jan 17 00:08:44 2017
@@ -2284,10 +2284,28 @@
ScFace::FaceEncoding gl;
face.glyphNames(gl);
+
+ // #14550 : for TTF fonts, we already avoid using the Postscript glyph name table
+ // as it is notoriously unreliable. We hence retrieve glyph names using unicode cmap
+ // and adobe glyph names uniXXXX convention. Unfortunately we may still not get all
+ // required glyph names and some glyphs may not have a name anyway. So check we have
+ // ps names for all glyphs we need and if not, then use CID encoding
+ bool hasNeededGlyphNames = face.hasNames() && (gl.count() >= usedGlyphs.count());
+ if ((fformat == ScFace::SFNT || fformat == ScFace::TTCF))
+ {
+ QMap<uint, FPointArray>::const_iterator it;
+ for (it = usedGlyphs.begin(); it != usedGlyphs.end(); ++it)
+ {
+ int glyphIndex = it.key();
+ hasNeededGlyphNames &= gl.contains(glyphIndex);
+ if (!hasNeededGlyphNames)
+ break;
+ }
+ }
QByteArray baseFont = Pdf::toName(sanitizeFontName(face.psName()));
- if ((face.isSymbolic() || !face.hasNames() || Options.Version == PDFOptions::PDFVersion_X4 || face.type() == ScFace::OTF) &&
+ if ((face.isSymbolic() || !hasNeededGlyphNames || Options.Version == PDFOptions::PDFVersion_X4 || face.type() == ScFace::OTF) &&
(fformat == ScFace::SFNT || fformat == ScFace::TTCF))
{
pdfFont = PDF_EncodeCidFont(fontName, face, baseFont, fontDescriptor, gl, QMap<uint,uint>());
More information about the scribus-commit
mailing list