CalConnect / csd-transcription-systems

CC/ISO 24229 Codes for transcription systems
1 stars 1 forks source link

mdash glyphs rendering issues in PDF #94

Closed ribose-jeffreylau closed 2 years ago

ribose-jeffreylau commented 2 years ago

Broken

screenshot

Screenshot 2021-10-07 at 4 49 50 PM

versions

bundle exec metanorma --version
Metanorma 1.3.11
Metanorma::Cli 1.4.17pre
Metanorma::Standoc 1.10.7/IsoDoc 1.7.6.1
Metanorma::ISO 1.9.5
Metanorma::Iec 1.3.12
Metanorma::Ietf 2.4.2
Metanorma::Generic 1.10.4
Metanorma::BIPM 1.1.10
Metanorma::CC 1.7.12
Metanorma::Csa 1.8.12
Metanorma::IHO 0.3.12
Metanorma::M3AAWG 1.7.12
Metanorma::UN 0.6.12
Metanorma::Ogc 1.4.3
Metanorma::ITU 1.3.12

Expected

screenshot

Screenshot 2021-10-07 at 4 48 54 PM

versions

bundle exec metanorma --version
Metanorma 1.3.6
Metanorma::Cli 1.4.11
Metanorma::Standoc 1.10.0/IsoDoc 1.7.0
Metanorma::ISO 1.8.6
Metanorma::Iec 1.3.6
Metanorma::Ietf 2.3.5
Metanorma::Generic 1.10.2
Metanorma::BIPM 1.1.4
Metanorma::CC 1.7.6
Metanorma::Csa 1.8.6
Metanorma::IHO 0.3.6
Metanorma::M3AAWG 1.7.6
Metanorma::UN 0.6.6
Metanorma::Ogc 1.3.6
Metanorma::ITU 1.3.6
ronaldtse commented 2 years ago

@ribose-jeffreylau just confirming this is from PDF, right?

ribose-jeffreylau commented 2 years ago

Forgot to mention, yes, PDF.

ronaldtse commented 2 years ago

I believe this is a font issue: where the non-breaking space is not present in the font used. Ping @intelligent2013.

ribose-jeffreylau commented 2 years ago

Update: it definitely does not seem like an issue with metanorma versions. I tested building locally with the latest gems and got the "correct" render.

Intelligent2013 commented 2 years ago

I've generated PDF locally for iso-24229.presentation.xml, and everything is correct. The visual difference between PDF from gh-pages and locally rendered in # around em-dash glyph in Normative References and Bibliography: image

xml:

Information and documentation — Foundation and vocabulary

The character   is U+2009 - Thin Space.

ISO xslt uses these fonts: <fo:root font-family="Cambria, Times New Roman, Cambria Math, Source Han Sans".

The font CAMBRIA.TTC on github

Downloading font "cleartype" from https://gitlab.com/fontmirror/archive/-/raw/master/PowerPointViewer.exe

...
- /config/fonts/CAMBRIA.TTC

doesn't contain the glyph for thin space: image (font version is 1.02, 2016 vs. 5.97 2009 locally installed)

Usually, Apache FOP tries to find glyph in the next font in the specified list Cambria -> Times New Roman -> Cambria Math -> Source Han Sans. But, because there isn't space in char sequence, and regarding 'Font Selection Strategies' https://xmlgraphics.apache.org/fop/2.5/fonts.html#selection, Apache FOP uses Cambria font and put # for non-existing glyph.

For some another xslt I've added translation from thin-space to simple space (20), and looks like I should similar in ISO xslt too.

ronaldtse commented 2 years ago

I wonder if we can find an open Cambria that contains a thin space for Fontist -- U+2009 seems very common.

Intelligent2013 commented 2 years ago

5.97 2009 from Windows 7 (C:\Windows\Fonts\cambria.ttc): image Please note, that there isn't X mark across glyph box in this version.

ronaldtse commented 2 years ago

We have since updated Cambria and this is no longer an issue.