[poppler] Support for CJK fonts in postscript / on Windows platforms

Thomas Freitag Thomas.Freitag at kabelmail.de
Sat Mar 3 09:51:00 PST 2012


Am 03.03.2012 17:40, schrieb suzuki toshiya:
> Hi,
>
> I'm quite sorry for that no CJK helpers involves this issue...
> The required help is a rewrite of your patch to fit the poppler
> coding convention, and for the maintainers working with Unix
> systems? If it is possible to do without Visual Studio, I will
> try.
Hopefully done now. As far as I rmember it was  Your patch (bug 11413) I 
just applied to PSOutputDev.cc
>
> BTW, yet I've not checked your patch in detail, your patch is
> trying to convert all missing (non-embedded) CID-keyed CJK fonts
> by MS Mincho? I think it is not good idea for the users of
> Adobe-GB1 (PRC, Singapore), Adobe-CNS1 (Taiwan, HongKong),
> Adobe-Korea1 (ROK). I'm not sure if Ghostscript does so, but
> even if Ghostscript does so, poppler should not follow it.
> In fact, the coverage of CJK Ideographs are differently
> designed to fit to each markets.
No, it was not my goal to substitute all CID keyed fonts by MS Mincho. 
The problem under Windows is just, that if there is no font with the 
used name installed, poppler tried to replace it with Helvetica, but 
because this is not a CID font no characters at all will be shown. So I 
thought that MS Mincho is at least for this case a better idea as a 
default CID font.
But if You copy the cidfmap produced by mkcidfm.ps from ghostscript in 
the poppler data dir, that substitute font table will be used if (and 
only if) the font is not embedded and not installed under windows. Hope 
that fits for CJK users, I thought it was better to use an existing 
substitution algorithm than do nothing. And as far as I understand 
mkcidfm.ps it will also try to find suitable fonts for GB1, CNS1 and the 
others, but I'm no expert for CJK fonts. The cidfmap I produced on my 
system would use arialuni.ttf for all CJK fonts, but I have just the 
Microsoft default fonts.

Regards,
Thomas
>
> Regards,
> mpsuzuki
>
> Thomas Freitag wrote:
>> Am 03.03.2012 11:08, schrieb Thomas Freitag:
>>> Am 03.03.2012 10:43, schrieb Thomas Freitag:
>>>> Am 02.03.2012 20:14, schrieb Albert Astals Cid:
>>>>> El Dilluns, 27 de febrer de 2012, a les 09:25:03, Thomas Freitag va
>>>>> escriure:
>>>>>> Am 26.02.2012 23:04, schrieb Albert Astals Cid:
>>>>>>> El Diumenge, 26 de febrer de 2012, a les 08:44:09, Thomas Freitag va
>>>>> escriure:
>>>>>>>> Hi,
>>>>>>> Hi, it would be you really cool if you configured your Visual
>>>>>>> Studio with
>>>>>>> the poppler [crazy] indentation settings, it's getting harder and
>>>>>>> harder
>>>>>>> to read/diff/apply your patches :-/
>>>>>> Sorry, I'll try. Should be only GlobalParamsWin.cc, which I edited in
>>>>>> Visual Studio, isn't it?
>>>>> No, the other was wrong too, poppler has a very weird indenting
>>>>> pattern and is
>>>>> difficult to get right, it's basically 2 spaces for each indentation
>>>>> but when
>>>>> you have 8 spaces it gets replaced with a tab character
>>>> I hope the attached patch is better. At least it fits to the head
>>>> revision.
>>> Sorry once again. Just saw that it seems to my PSPad editior, which
>>> inserted tabs. I try to repair it just in the diff, hopefully looks
>>> better!
>>> So try this patch.
>> Grrrr. It was not a good idea to manipulate a diff file. It looks nice
>> but it no more applyable. This is now made on unix.
>>
>> Thomas
>>> Thomas
>>>>>>>> I implemented a patch which supports CJK fonts in the postscript
>>>>>>>> output
>>>>>>>> device and on Windows platforms in general. It consists mainly of
>>>>>>>> three
>>>>>>>> parts:
>>>>>>>>
>>>>>>>> 1. Adapt bug fix for bug 11413 to the postscript device
>>>>>>>> 2. A small bug fix when locateFont doesn't find a suitable font and
>>>>>>>> returns a null pointer
>>>>>>>> 3. CJK substitute implementation on WIndows platforms.
>>>>>>>>
>>>>>>>> to 1.:
>>>>>>>> Adapting the implementation of the bug fix for splash and cairo
>>>>>>>> to the
>>>>>>>> postscript device was quite easy. But my first proofs of the
>>>>>>>> output with
>>>>>>>> ghostscript 8.71 shows some regressions where the CJK chars have a
>>>>>>>> smaller height than the default square of the font. But the "48"
>>>>>>>> in the
>>>>>>>> output of bug-poppler11413.pdf which is set in a "normal" font but
>>>>>>>> rotated was at the right position. Then I stepped to ghostscript
>>>>>>>> 9.04,
>>>>>>>> and now the CJK chars were shown correctly, but the 48 was
>>>>>>>> positioned
>>>>>>>> wrong. But because of these different tests I think that it is
>>>>>>>> still a
>>>>>>>> problem in ghostscript when using a mix of CJK fonts and "normal"
>>>>>>>> fonts.
>>>>>>>> BTW, also Acrobat X distiller has problems with the position of
>>>>>>>> the "48"!
>>>>>>> I understand this applies to non-windows too, right?
>>>>>> Yes, point 1 and 2 applies to all platforms (even if 2 probably only
>>>>>> happens if don't using fonfconfig, so just under Windows)
>>>>> So what's the difference i should see when running in linux? The
>>>>> outputted ps
>>>>> file having a different rendering for CJK files?
>>>> Yes. Do You haven't seen it or haven't tried it with
>>>> bug-poppler11413.pdf? I attach sreenshots before and after. If You
>>>> haven't seen any differences, is it possible that You haven't
>>>> installed "our" language pack, i.e. the poppler data dir isn't at the
>>>> correct place? Under windows I normally patch the allocation of
>>>> GlobalParms, i.e.
>>>>
>>>>    globalParams = new
>>>> GlobalParams("E:\\Downloads\\poppler\\poppler-data-0.4.5");
>>>>
>>>> under unix I link it to /usr/local/share/poppler
>>>>
>>>> Thomas
>>>>> Albert
>>>>>
>>>>>> Thomas
>>>>>>
>>>>>>> Albert
>>>>>>>
>>>>>>>> to 2.:
>>>>>>>> On my first tests with PDF which uses non embedded CJK fonts on
>>>>>>>> Windows
>>>>>>>> I got crashes. Reason for it was that GlobalParamWin returns
>>>>>>>> Helvetica,
>>>>>>>> which is not a CID font, but locateFont accepts here only CID
>>>>>>>> fonts and
>>>>>>>> therefore returns a NULL pointer. I first fixed that and then
>>>>>>>> decided to
>>>>>>>> return as default MS Mincho if a CID font is expected.
>>>>>>>>
>>>>>>>> to 3.:
>>>>>>>> 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
>>>>>>>>
>>>>>>>> To clearify the format of cidfmap I attach the file produced on my
>>>>>>>> installation. Keep care: I have not a default windows
>>>>>>>> installation with
>>>>>>>> windows on c:/windows, my windows installation is on drive f!
>>>>>>>>
>>>>>>>> Cheers,
>>>>>>>> Thomas
>>>>>>> _______________________________________________
>>>>>>> poppler mailing list
>>>>>>> poppler at lists.freedesktop.org
>>>>>>> http://lists.freedesktop.org/mailman/listinfo/poppler
>>>>>>>
>>>>>>> .
>>>>>> _______________________________________________
>>>>>> poppler mailing list
>>>>>> poppler at lists.freedesktop.org
>>>>>> http://lists.freedesktop.org/mailman/listinfo/poppler
>>>>> _______________________________________________
>>>>> poppler mailing list
>>>>> poppler at lists.freedesktop.org
>>>>> http://lists.freedesktop.org/mailman/listinfo/poppler
>>>>>
>>>>> .
>>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> poppler mailing list
>>>> poppler at lists.freedesktop.org
>>>> http://lists.freedesktop.org/mailman/listinfo/poppler
>>>
>>>
>>> _______________________________________________
>>> poppler mailing list
>>> poppler at lists.freedesktop.org
>>> http://lists.freedesktop.org/mailman/listinfo/poppler
>>
>>
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> poppler mailing list
>> poppler at lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/poppler
> _______________________________________________
> poppler mailing list
> poppler at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/poppler
>
> .
>




More information about the poppler mailing list