metanorma / metanorma-itu

Metanorma for ITU-T Recommendations
BSD 2-Clause "Simplified" License
4 stars 4 forks source link

Service publication: Issues on cover page for Arabic and Chinese: PDF #419

Closed opoudjis closed 1 year ago

opoudjis commented 1 year ago

Follow-on from https://github.com/metanorma/metanorma-itu/issues/414

The header of the cover page in Arabic, for {{ labels["annex_to_itu_ob"]}}, {{ labels["number_abbrev"] }} {{ docnumeric }} – {{ pubdate_ddMMMyyyy }}, is rendering as ###. That's probably because italics are not supported in our Arabic font. (They aren't in Word.)

The header of the cover page in Chinese was so different, I ended up hardcoding it:

国际电联{{ pubdate_ddMMMyyyy }}第{{ docnumeric }}期
《操作公报》附件
Intelligent2013 commented 1 year ago

On Windows7 I can't repeat this issue, PDF renders ok: image

Apache FOP config contains normal and bold Traditional Arabic fonts, and simulate styles for italic:

<font embed-url="file:/C:/Windows/FONTS/trado.ttf" kerning="yes" mn_default="false">
    <font-triplet name="Traditional Arabic" style="normal" weight="normal"/>
</font>
<font embed-url="file:/C:/Windows/FONTS/tradbdo.ttf" kerning="yes" mn_default="false">
    <font-triplet name="Traditional Arabic" style="normal" weight="bold"/>
</font>
<font embed-url="file:/C:/Windows/FONTS/trado.ttf" kerning="yes" mn_default="false" simulate-style="true">
    <font-triplet name="Traditional Arabic" style="italic" weight="normal"/>
</font>
<font embed-url="file:/C:/Windows/FONTS/tradbdo.ttf" kerning="yes" mn_default="false" simulate-style="true">
    <font-triplet name="Traditional Arabic" style="italic" weight="bold"/>
</font>

From https://github.com/metanorma/metanorma-itu/issues/414, the font looks as sans-serif: image

My PDF (serif font): image

I'll check on Ubuntu and MacOS, may be fontist installs the wrong font...

Intelligent2013 commented 1 year ago

Hmm, in the processor.rb there isn't any Arabic font:

      def fonts_manifest
        {
          "Arial" => nil,
          "Courier New" => nil,
          "Times New Roman" => nil,
          "Source Han Sans" => nil,
          "Source Han Sans Normal" => nil,
          "STIX Two Math" => nil,
        }
      end
Intelligent2013 commented 1 year ago

Noto Sans fonts are using instead of Traditional Arabic:

WARNING: Font file '/Users/runner/.metanorma/fonts/trado.ttf' (font name 'Traditional Arabic', font style 'normal', font weight 'normal') doesn't exist. Replaced by '/Users/runner/.metanorma/fonts/NotoSans-Regular.ttf'.
WARNING: Font file '/Users/runner/.metanorma/fonts/tradbdo.ttf' (font name 'Traditional Arabic', font style 'normal', font weight 'bold') doesn't exist. Replaced by '/Users/runner/.metanorma/fonts/NotoSans-Bold.ttf'.
WARNING: Font file '/Users/runner/.metanorma/fonts/trado.ttf' (font name 'Traditional Arabic', font style 'italic', font weight 'normal') doesn't exist. Replaced by '/Users/runner/.metanorma/fonts/NotoSans-Italic.ttf'.
WARNING: Font file '/Users/runner/.metanorma/fonts/tradbdo.ttf' (font name 'Traditional Arabic', font style 'italic', font weight 'bold') doesn't exist. Replaced by '/Users/runner/.metanorma/fonts/NotoSans-BoldItalic.ttf'.

BUT Arabic glyphs are missing in the Noto Sans font, therefore Apache FOP uses next font in the font-family list Traditional Arabic, Times New Roman, STIX Two Math, i.e. Times New Roman (Font Selection Strategies https://xmlgraphics.apache.org/fop/2.5/fonts.html#selection). Arabic glyphs are available in the Times New Roman font in the Regular and Bold only. No italic (and bold+italic) Arabic glyphs, therefore we see # instead of char.

I see three methods to fix this issue:

opoudjis commented 1 year ago

Got it.

Italics are an innovation specific to Latin script; scripts closely influenced by Western Europe in their typography have equivalents drawn from their cursive tradition (Greek, Cyrillic), but scripts elsewhere do not (what is Italic Devanagari?); and there isn't apparently a strong tradition in Arabic of typographically emphasising text, that corresponds to Italics: https://typedrawers.com/discussion/2147/where-is-arabic-italic-originating-from

... and what that means is, you could do (2), but I think (3) is fine as a solution. Italics in Arabic is kind of artificial. If that means that we are missing things, OK, but I'd rather be given a real solution by an Arabic SME (or SDO), than add to the Westernisation of Arabic script.

Intelligent2013 commented 1 year ago

ITU XSLT updated: font-style italic changed to normal for ar language document.