Webhelp Fonts for different languages

Post here questions and problems related to editing and publishing DITA content.
steinbacherGE
Posts: 55
Joined: Tue Mar 13, 2018 6:07 pm

Webhelp Fonts for different languages

Post 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
alin
Site Admin
Posts: 268
Joined: Thu Dec 24, 2009 11:21 am

Re: Webhelp Fonts for different languages

Post 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
Alin Balasa
Software Developer
<oXygen/> XML Editor
http://www.oxygenxml.com
Post Reply