Hi, Here are a few patches to podofo revision 1678 regarding embedding of True Type font subsets. Now, TTF tables are rewritten without gaps and resulting PDF is even smaller. If CreateFontSubset is called instead of CreateFont, only used chars are embedded into PDF.
Resulting PDF file sizes are similar to the sizes if cairo PDF engine is used as producer (http://cairographics.org/). I do not know, how to get the same with CreateFont function along with PdfFontCache::eFontCreationFlags_Type1Subsetting flag, but maybe somebody knows. What is a bit confusing, is that PdfFontCache maintains two list of cached fonts. First is standard, but second list is used for subset fonts only. If there is a need to have two lists, then if font is marked for subsetting (eFontCreationFlags::Type1Subsetting), it should be created just like the CreateFontSubset function is directly invoked, and stored on corresponding list. Now, the creation paths are different (impossible to embed font subset later), as they are stored on wrong list too. Maybe I got something wrong, but I believe this is the only way to get subsetting out of podofo? if (embeedFont) { pdfFont = pdfDoc->CreateFontSubset(trueTypeFontName, fBold, fItalic, false, new PdfIdentityEncoding(0, 0xffff, true)); } ... pdfDoc->EmbedSubsetFonts(); This code will not embed a font subset if true type font is selected: pdfFont = pdfDoc->CreateFont(trueTypeFontName, fBold, fItalic, false, new PdfIdentityEncoding(0, 0xffff, true), /eFontCreationFlags_Type1Subsetting, true/); I have compiled changes with mingw compiler on (win32) with and without PODOFO_NO_FONTMANAGER defined. Font subsetting works in both cases (font selection with win32 native font manager, and with fontconfig on windows platform). It means that it should work on other platforms too, which are fontconfig based. Regards, Nenad
podofo-subsetting.diff.gz
Description: GNU Zip compressed data
------------------------------------------------------------------------------
_______________________________________________ Podofo-users mailing list Podofo-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/podofo-users