Webhelp Fonts for different languages

steinbacherGE
Posts: 55
Joined: Tue Mar 13, 2018 6:07 pm

Webhelp Fonts for different languages

Post by steinbacherGE » Wed Jul 21, 2021 6:09 pm

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: 205
Joined: Thu Dec 24, 2009 11:21 am

Re: Webhelp Fonts for different languages

Post by alin » Sat Jul 24, 2021 11:02 am

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