metanorma / metanorma-standoc

Metanorma for Standoc documents
BSD 2-Clause "Simplified" License
5 stars 2 forks source link

Align font requirements with HTML (plain and Word) and PDF expectations #383

Closed ronaldtse closed 3 years ago

ronaldtse commented 3 years ago

Each Metanorma flavor + output format has a specific set of fonts to be used.

In HTML/browsers, the fonts specified need to use a browser understandable name for font-face and font-family.

In CSS 4, these two messages indicate: https://github.com/w3c/csswg-drafts/issues/3177#issuecomment-431773808 https://github.com/w3c/csswg-drafts/issues/3177#issuecomment-432131599

That for HTML CSS fonts we should only use "full font name" (i.e. without style) and "postscript name"

And in Chrome: https://stackoverflow.com/questions/24849224/css-font-family-which-name-does-css-font-use

So say for "Overpass" (https://github.com/fontist/formulas/blob/master/Formulas/overpass.yml)

- name: Overpass
  styles:
  - family_name: Overpass
    type: Bold Italic
    full_name: Overpass Bold Italic
    post_script_name: Overpass-BoldItalic

The HTML CSS font name is "Overpass" (family name) or the postscript name "Overpass-BoldItalic"

ronaldtse commented 3 years ago

This is relevant to the ongoing PRs:

Thanks @CAMOBAP !

ronaldtse commented 3 years ago

@Intelligent2013 could you also help verify the font names needed for mn2pdf so @CAMOBAP can help align them here? Thanks!

CAMOBAP commented 3 years ago

@ronaldtse to be on the same page where should we list those postscript font names? in fonts_manifest.yaml?

ronaldtse commented 3 years ago

I think Fontist only accepts the family name right now? (Ping @alexeymorozov)

I wonder in the future we could use fontist as a dependency where you can get the appropriate names of fonts in order to pass the names to the output formats.

Intelligent2013 commented 3 years ago

The font names needed for mn2pdf:

bipm:

csa:

cc:

gb:

iec:

iho:

iso:

itu:

m3d:

mpfd:

nist:

ogc:

rsd:

un:

Note: Source Han Sans font in most cases needs for char replacement when old windows font version is using. For example, in old windows Times New Roman font there aren't some white-spaces glyphs, and if we don't specify 'Source Han Sans' font, then we see '#' char in PDF.

CAMOBAP commented 3 years ago

@ronaldtse those fonts above should be added to fonts_manifest.yaml too, right?

ronaldtse commented 3 years ago

@CAMOBAP yes, that's correct.

ronaldtse commented 3 years ago

We have some problems with the fonts here:

@Intelligent2013 anything we can change here?

ronaldtse commented 3 years ago

@Intelligent2013 actually I don't see where IHO uses SF Mono or Helvetica Neue. Let's change to Fira Code and Neue Haas Grotesk instead.

In addition, Azo Sans is available on macOS by default, but not freely licensed. We will have to find an alternative.

Intelligent2013 commented 3 years ago

@Intelligent2013 actually I don't see where IHO uses SF Mono or Helvetica Neue. Let's change to Fira Code and Neue Haas Grotesk instead.

@ronaldtse ok. FYI, IHO xslt was developed for source doc templates in gh-pages branch (for example, https://raw.githubusercontent.com/metanorma/mn-samples-iho/gh-pages/documents/b12.doc). The main font in docs is "Helvetica Neue":

p.MsoNormal, li.MsoNormal, div.MsoNormal {
  mso-style-unhide: no;
  mso-style-qformat: yes;
  mso-style-parent: "";
  margin: 0cm;
  margin-bottom: 12.0pt;
  mso-pagination: widow-orphan;
  font-size: 12.0pt;
  font-family: "Helvetica Neue",Arial,sans-serif;
  mso-fareast-font-family: "Times New Roman";
  mso-ansi-language: EN-US;
  mso-fareast-language: EN-US; }

For source code:

p.Sourcecode, li.Sourcecode, div.Sourcecode, pre.Sourcecode, pre {
  mso-style-unhide: no;
  mso-style-qformat: yes;
  mso-style-parent: "";
  margin-top: 6.0pt;
  margin-right: 0cm;
  margin-bottom: 6.0pt;
  margin-left: 0cm;
  text-align: left;
  mso-pagination: widow-orphan;
  tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;
  font-size: 10.0pt;
  font-family: SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;
  mso-fareast-font-family: Calibri;
  mso-bidi-font-family: "Courier New";
  mso-ansi-language: EN-GB; }

In case if font didn't install on system, then MS Word uses next first available font. In this case - Arial: изображение

Intelligent2013 commented 3 years ago

@CAMOBAP font list above was modified for iho.

Intelligent2013 commented 3 years ago

@CAMOBAP

Font list for bipm updated - added TeXGyreChorus font:

bipm:

CAMOBAP commented 3 years ago

PRs ready for review

CAMOBAP commented 3 years ago

The issue for missing fonts reported https://github.com/fontist/fontist/issues/188

ronaldtse commented 3 years ago

@CAMOBAP so this is now ready to go?

CAMOBAP commented 3 years ago

@ronaldtse yep I think os

CAMOBAP commented 3 years ago

Done