Page 1 of 1

Webhelp Fonts for different languages

Posted: Wed Jul 21, 2021 6:09 pm
by steinbacherGE
When publishing translated bookmaps to Webhelp, what is the best way to deliver different fonts for different languages? Is there a way to specify a font in the CSS based on the xml:lang attribute? Do these fonts need to be embedded with the webhelp package, or can we reference a Google font like Noto?

https://www.google.com/get/noto/

Thanks,

Leroy Steinbacher

Re: Webhelp Fonts for different languages

Posted: Sat Jul 24, 2021 11:02 am
by alin
Hello,

There is no requirement to embed the fonts in the WebHelp output. You can reference Google Fonts in you CSS files. We have several built-in Publishing Templates that also use Google Fonts (Aquamarine, Ashes, Blue, etc).
If your HTML pages contain the language information as an xml:lang attribute you can specify a different font depending on the current language as follows:

Code: Select all

@import url('https://fonts.googleapis.com/css?family=Lato:300,300italic,400,400italic,700,700italic');
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans:ital,wght@0,400;0,700;1,400;1,700&display=swap');

html[xml\:lang^="de"] body {
  font-family: Lato, sans-serif;
}

html[xml\:lang^="fr"] body {
  font-family: 'Noto Sans', sans-serif;
}
Regards,
Alin