[poppler] Vertical or horizontal writing?

mpsuzuki at hiroshima-u.ac.jp mpsuzuki at hiroshima-u.ac.jp
Mon Jul 26 02:57:14 PDT 2010


Hi,

Attached is a draft patch to do:

1) extend poppler's FontInfo object to hold writing mode info.

2) extend poppler-qt4's FontInfo object to provide an API to
   return writing mode info copied from poppler's FontInfo.

3) extend qt4/tests/poppler-fonts to show writing mode info.

Also I attached a sample PDF including vertical/horizontal
Japanese text, generated by MS Word + Adobe Acrobat.
poppler-fonts detects the writing mode aslike:

$ ./qt4/tests/poppler-fonts vert-horiz-ipa-std.pdf 
name                                 type         emb sub font file wmode
------------------------------------ ------------ --- --- --------- -----
LDGIFP+IPAMincho                     CID TrueType      yes yes  Vert
LDGIFP+IPAMincho                     CID TrueType      yes yes  Hori

I think the diff for poppler-fonts.cpp shows how to use the
extended API. Cobra, please check if the extended API can help
your application.

The extention for poppler-glib is work in progress.

Regards,
mpsuzuki

On Mon, 26 Jul 2010 16:31:04 +0800 (CST)
"cobra.yu" <cobra.yu at hyweb.com.tw> wrote:

>Hi,
>
>Hmm, it seems that... 
>1) I'm only familiar with the poppler-qt4 binding for the present time. But, for my application, I really needs some CJK-related information through poppler.
>2) I can't exactly figure out all the necessary steps to accomplish what you said. But, I think, I could try, of course, by your help.
>3) So, let's work it out. :-)
>
>       Cobra
>-----Original message-----
>From:mpsuzuki at hiroshima-u.ac.jp
>To:cobra.yu at hyweb.com.tw
>Cc:poppler at lists.freedesktop.org
>Date:Mon, 26 Jul 2010 17:07:30 +0900
>Subject:Re: [poppler] Vertical or horizontal writing?
>
>Hi,
>
>Hmm, it seems that...
>
>1) poppler-qt4 can access FontInfo object for a font used in PDF,
>but cannot access GfxFont object that poppler creates before FontInfo
>object internally.
>
>2) either poppler-glib can access FontInfo object for a font used
>in PDF, but cannot access GfxFont object that poppler creates before
>FontInfo object internally.
>
>3) according to FontInfo.h (and FontInfo.cc), FontInfo object does
>not have a method to obtain the writing mode of its source GfxFont
>object.
>
>Thus, glib binding does not help your work. If we are forced to use
>current poppler without modification, we will have to use both of
>poppler-qt4 and raw poppler library. I'm afraid it makes your software
>difficult to maintain. If we have sufficient time, I think, making
>a proposal patch to add writing mode info to FontInfo object, and
>extend poppler-{qt4,glib} to access the info is better.
>
>I think adding writing mode to FontInfo is not difficult (I can
>draft), but making poppler-qt4 to access it is not so easy for
>me because I have no experience in Qt4 development. If you have
>sufficient time, I will ask you to draft the patch for poppler-qt4.
>How do you think of?
>
>Regards,
>mpsuzuki
>
>On Mon, 26 Jul 2010 15:46:43 +0800 (CST)
>"cobra.yu" <cobra.yu at hyweb.com.tw> wrote:
>
>>Hi,
>>
>>   Thanks a lot! I think it would be a great help to me. I'm only using poppler-qt4 binding for my application now. So, I guess, I would have to use both Qt4 and cpp/glib bindings in my application, right?
>>
>>         Cobra
>>-----Original message-----
>>From:mpsuzuki at hiroshima-u.ac.jp
>>To:cobra.yu at hyweb.com.tw
>>Cc:poppler at lists.freedesktop.org
>>Date:Mon, 26 Jul 2010 16:24:40 +0900
>>Subject:Re: [poppler] Vertical or horizontal writing?
>>
>>Hi,
>>
>>Yet I'm not sure how you use poppler in your application,
>>but GfxFont class has a method to obtain "writing mode"
>>in PDF terminology. Please see GfxFont.h, you can find:
>>
>>   /* this is default */
>>
>>   106  class GfxFont {
>>   107  public:
>>   108  
>>...
>>   206    // Return the writing mode (0=horizontal, 1=vertical).
>>   207    virtual int getWMode() { return 0; }
>>
>>   /* this is for CID-keyed font */
>>   321  class GfxCIDFont: public GfxFont {
>>   322  public:
>>...
>>   333    // Return the writing mode (0=horizontal, 1=vertical).
>>   334    virtual int getWMode();
>>
>>And, you can find how poppler identify the writing mode
>>in GfxFont.cc:
>>
>>  1763  int GfxCIDFont::getWMode() {
>>  1764    return cMap ? cMap->getWMode() : 0;
>>  1765  }
>>
>>Is this what you want?
>>
>>Regards,
>>mpsuzuki
>>
>>On Mon, 26 Jul 2010 14:49:38 +0800 (CST)
>>"cobra.yu" <cobra.yu at hyweb.com.tw> wrote:
>>
>>>Hi,
>>>
>>>     Is there any way by poppler to acquire the correct writing mode for any Document/Page/Paragraph? I'm writing some code for the vertical Chinese writing mode text search, but finding that it seems no way to know the exact mode by poppler.
>>>     Any suggestions are welcome! Thx.
>>>
>>>         Cobra
>>>_______________________________________________
>>>poppler mailing list
>>>poppler at lists.freedesktop.org
>>>http://lists.freedesktop.org/mailman/listinfo/poppler
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fontinfo-wmode_20100726a.diff
Type: text/x-diff
Size: 4024 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/poppler/attachments/20100726/116d4c41/attachment-0001.diff>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: vert-horiz-ipa-std.pdf
Type: application/pdf
Size: 31975 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/poppler/attachments/20100726/116d4c41/attachment-0001.pdf>


More information about the poppler mailing list