[poppler] [PATCH] per-collection fallback for missing CID-keyed fonts on Win32

mpsuzuki at hiroshima-u.ac.jp mpsuzuki at hiroshima-u.ac.jp
Fri Apr 6 06:59:17 PDT 2012


Dear Albert,

On Fri, 06 Apr 2012 15:14:47 +0200
Albert Astals Cid <aacid at kde.org> wrote:

>El Dilluns, 2 d'abril de 2012, a les 18:50:16, mpsuzuki at hiroshima-u.ac.jp va 
>escriure:
>> I think, pdffonts should notice how the fonts are fallbacked
>> in the rasterization (or the conversion to vector output
>> device), primarily. 
>
>Are you speaking of pdffonts -subst here? Seems to work fine for me. Or are 
>you saying it doesn't work in Windows?

Thank you very much for clarification that this is Windows
issue. I'm quite sorry for unclear mention about this.

Yes, I'm speaking of "pdffonts -subst". On Windows, the result
by "pdffonts -subst" for a sample PDF of base14 fonts
( https://bugs.freedesktop.org/show_bug.cgi?id=48040 ),
is inconsistent with the rasterization result of pdftoppm.

The "pdffonts -subst" on Windows is like following.

name                                 object ID substitute font                      substitute font file
------------------------------------ --------- ------------------------------------ ------------------------------------
Courier-BoldOblique                      14  0 C:\WINDOWS\Fonts\arial.ttf           C:\WINDOWS\Fonts\arial.ttf
Helvetica                                15  0 C:\WINDOWS\Fonts\arial.ttf           C:\WINDOWS\Fonts\arial.ttf
Helvetica-Oblique                        16  0 C:\WINDOWS\Fonts\arial.ttf           C:\WINDOWS\Fonts\arial.ttf
Helvetica-Bold                           17  0 C:\WINDOWS\Fonts\arial.ttf           C:\WINDOWS\Fonts\arial.ttf
Helvetica-BoldOblique                    18  0 C:\WINDOWS\Fonts\arial.ttf           C:\WINDOWS\Fonts\arial.ttf
Times-Roman                              19  0 C:\WINDOWS\Fonts\arial.ttf           C:\WINDOWS\Fonts\arial.ttf
Times-Italic                             20  0 C:\WINDOWS\Fonts\arial.ttf           C:\WINDOWS\Fonts\arial.ttf
Times-Bold                               21  0 C:\WINDOWS\Fonts\arial.ttf           C:\WINDOWS\Fonts\arial.ttf
Times-BoldItalic                         22  0 C:\WINDOWS\Fonts\arial.ttf           C:\WINDOWS\Fonts\arial.ttf
Symbol                                   24  0 [none]                               C:\WINDOWS\Fonts\SYMBOL.TTF
ZapfDingbats                             26  0 C:\WINDOWS\Fonts\arial.ttf           C:\WINDOWS\Fonts\arial.ttf
CourierNew                               27  0 C:\WINDOWS\Fonts\arial.ttf           C:\WINDOWS\Fonts\arial.ttf
CourierNew,Italic                        28  0 [none]                               C:\WINDOWS\Fonts\COUR.TTF
CourierNew,Bold                          29  0 [none]                               C:\WINDOWS\Fonts\COUR.TTF
CourierNew,BoldItalic                    30  0 [none]                               C:\WINDOWS\Fonts\COURI.TTF
Arial                                    31  0 [none]                               C:\WINDOWS\Fonts\ARIAL.TTF
Arial,Italic                             32  0 [none]                               C:\WINDOWS\Fonts\ARIALI.TTF
Arial,Bold                               33  0 [none]                               C:\WINDOWS\Fonts\ARIALBD.TTF
Arial,BoldItalic                         34  0 [none]                               C:\WINDOWS\Fonts\ARIALBI.TTF
TimesNewRoman                            35  0 [none]                               C:\WINDOWS\Fonts\TIMES.TTF
TimesNewRoman,Italic                     36  0 [none]                               C:\WINDOWS\Fonts\TIMESI.TTF
TimesNewRoman,Bold                       37  0 [none]                               C:\WINDOWS\Fonts\TIMESBD.TTF
TimesNewRoman,BoldItalic                 38  0 [none]                               C:\WINDOWS\Fonts\TIMESBI.TTF
Courier                                  39  0 C:\WINDOWS\Fonts\arial.ttf           C:\WINDOWS\Fonts\arial.ttf
Courier-Oblique                          40  0 C:\WINDOWS\Fonts\arial.ttf           C:\WINDOWS\Fonts\arial.ttf
Courier-Bold                             41  0 C:\WINDOWS\Fonts\arial.ttf           C:\WINDOWS\Fonts\arial.ttf

It looks like as if Courier and Times-Roman will be substituted
by Arial. It is unwanted result. But, as you can find by the pictures
(pdftoppm) on https://bugs.freedesktop.org/show_bug.cgi?id=48040 ,
Courier is substituted by Courier New, Times-Roman is substituted
by Timew New Roman (it is wanted result). I think pdffonts is
expected to return the font substititions that pdftoppm will do.
If the consistency between pdftoppm and "pdffonts -subst" is
agreed, I will post a patch. However, the change by my patch for
this issue will modifies non-Windows part too. So I don't want to
do it for 0.20 because insufficient time to testing.

>> As the extra features, the indication of
>> the last rule choosing the final result would be helpful,
>> when poppler have external configuration file to control the
>> font substition (it's since 0.20!).
>
>External configuration file to control font substitution is something we do 
>*not* want.

Oh, thank you again for the clarification. I remember your
attitude about external configuration file when we discussed
about the hint control - I know you don't want it, and I will
follow your decision. But, the patch by Thomas for GlobalParamsWin.cc
includes a feature to use external font substitution mapping
table "cidfmap". It should be removed, or should be kept?

commit dae29c6c201cd69cbf4f008de865cc19a36f29b3
Author: Thomas Freitag <Thomas.Freitag at alfa.de>
Date:   Sun Mar 4 15:22:02 2012 +0100

    CJK substitute implementation on WIndows platforms.
    
    When You install ghostscript on WIndows You're able to switch on CJK
    support. This will create a  cidfmap file in the gs-lib directory. The
    ps file which creates it (mkcidfm.ps) runs over the windows font
    directory and tries to create a suitable substitution table for missing
    CJK fonts. The cidfmap file is more or less PDF like, so it's quite easy
    to parse it with our parser and create a substitution table in
    GlobalParamsWin and use that table. But I expect it in the poppler data
    dir instead of searching for ghostscript installation. If it is not
    there, it always returns the default CID font of point 2.
    You can either copy it from the gs lib directory or create it with the
    ghostscript tool calling
    
    gswin32c -q -dBATCH -sFONTDIR=<windows font directory>
    -sCIDFMAP=<popper data dir>/cidfmap mkcidfm.ps

In my personal opinion, I'm questionable about the requirement
of this feature. There might be some people who want to make the
font substitutions by Ghostscript and poppler-related softwares
aligned, and "cidfmap" support may be useful for their purpose.

But, at present, cidfmap support is only implemented for Windows
(to serve for the people expecting same font substitution, non-
Windows platforms should support cidfmap, I think), and, Ghostscript
is not good tool to generate & maintain cidfmap automatically.

What should we do for "cidfmap" feature?

Regards,
mpsuzuki


More information about the poppler mailing list