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

Albert Astals Cid aacid at kde.org
Sun Mar 4 06:24:06 PST 2012


El Dissabte, 3 de març de 2012, a les 16:56:05, Thomas Freitag va escriure:
> 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.

I've commited the patch.

Sorry if I made you "hand fix" the patch, that was not my intention, I can do 
that myself. What i was trying to achieve is you getting the "correct" 
indentation set in your editor so neither of us has to hand edit the patch :-)

But don't worry, it is better if you invest your time in doing code than 
battling your editor.

Albert

> 
> 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


More information about the poppler mailing list