daps icon indicating copy to clipboard operation
daps copied to clipboard

Extend FOP config for ja, ko, zh_CN & zh_TW

Open tomschr opened this issue 2 years ago • 1 comments

Problem description

Our current PDFs contain some layout issues regarding for CJK languages. However, adding a font is not enough. FOP doesn't detect them correctly. We need to register all fonts manually.

Expected behavior

Our PDFs contains the correct fonts for CJK languages

Solution

  • Adapt the DAPS requirement and recommend the following packages:

    • google-noto-sans-jp-regular-fonts / google-noto-sans-jp-bold-fonts: Japanese
    • google-noto-sans-kr-regular-fonts / google-noto-sans-kr-bold-fonts: Korean
    • google-noto-sans-sc-regular-fonts / google-noto-sans-sc-bold-fonts : Simplified Chinese
    • google-noto-sans-tc-regular-fonts / google-noto-sans-tc-bold-fonts: Traditional Chinese
  • Add the following XML fragment to the FOP configuration fop-daps.xml (@fsundermeyer)

    Addition to FOP configuration for DAPS (click me)
       <!-- ja, ko -->
       <font kerning="no" embed-url="/usr/share/fonts/truetype/NotoSansCJKjp-Regular.otf" embedding-mode="subset">
        <font-triplet name="NotoSansJP" style="normal" weight="normal"/>
       </font>
       <font kerning="no" embed-url="/usr/share/fonts/truetype/NotoSansCJKjp-Bold.otf" embedding-mode="subset">
        <font-triplet name="NotoSansJP" style="normal" weight="700"/>
       </font>
       <!-- ko -->
       <font kerning="no" embed-url="/usr/share/fonts/truetype/NotoSansCJKkr-Regular.otf" embedding-mode="subset">
        <font-triplet name="NotoSansKO" style="normal" weight="normal"/>
       </font>
       <font kerning="no" embed-url="/usr/share/fonts/truetype/NotoSansCJKkr-Bold.otf" embedding-mode="subset">
        <font-triplet name="NotoSansKO" style="normal" weight="700"/>
       </font>
       <!-- zh-CN -->
       <font kerning="no" embed-url="/usr/share/fonts/truetype/NotoSansCJKsc-Regular.otf" embedding-mode="subset">
        <font-triplet name="NotoSansZH_CN" style="normal" weight="normal"/>
       </font>
       <font kerning="no" embed-url="/usr/share/fonts/truetype/NotoSansCJKsc-Bold.otf" embedding-mode="subset">
        <font-triplet name="NotoSansZH_CN" style="normal" weight="700"/>
       </font>
       <!-- zh-TW -->
       <font kerning="no" embed-url="/usr/share/fonts/truetype/NotoSansCJKtc-Regular.otf" embedding-mode="subset">
        <font-triplet name="NotoSansZH_TW" style="normal" weight="normal"/>
       </font>
       <font kerning="no" embed-url="/usr/share/fonts/truetype/NotoSansCJKtc-Bold.otf" embedding-mode="subset">
        <font-triplet name="NotoSansZH_TW" style="normal" weight="700"/>
       </font>
       </fonts>
    
  • Insert the defined names (NotoSansJP, NotoSansKO, NotoSansZH_CN, and NotoSansZH_TW) into the stylesheets, file fo/l10n.properties.xml. (@tomschr)

Related information

DOCTEAM-750

tomschr avatar Oct 07 '22 14:10 tomschr

@tomschr I suggest to add the fonts as recommended packages to the suse-xsl-stylesheets package spec-file rather than to DAPS.

fsundermeyer avatar Oct 20 '22 15:10 fsundermeyer

I think, for DAPS this issue can be closed. For the SUSE stylesheets parts, this is covered in issue opensuse/suse-xsl#505

tomschr avatar Nov 03 '22 08:11 tomschr