CSS HTML5 PDF - can't import google font

Post here questions and problems related to editing and publishing DITA content.
mdslup
Posts: 167
Joined: Tue Mar 06, 2018 1:34 am

CSS HTML5 PDF - can't import google font

Post by mdslup »

According to this site on fonts,

https://www.oxygenxml.com/doc/versions/ ... asic_fonts

I should be able to put

@import url('https://fonts.googleapis.com/css?family ... 0,500,700i');

at the top of my css file. However, doing this causes my entire CSS file to be ignored...none of the rules apply. When I remove the import statement, then everything works normally.

Am I missing something? Feels like this should be simple.
Costin
Posts: 828
Joined: Mon Dec 05, 2011 6:04 pm

Re: CSS HTML5 PDF - can't import google font

Post by Costin »

Hello,

When using remote fonts (like the Google fonts from https://fonts.googleapis.com), in case there is any connectivity issue (you have an incorrect proxy configuration in oXygen or system, any other incorrect network settings configuration in oXygen, or if the server that oXygen tries to reach is down), such issues may occur.
When the connection fails, it breaks further parsing of the document, hence the styles are no longer applied.

As a workaround, you should:
- remove the font import at the top of the CSS file
- if you specifically need that font from Google, just download it locally (Montserat font is available at https://fonts.google.com/specimen/Montserrat - select this font > Download), save it in the same folder with the CSS and define a font-face for it (https://www.oxygenxml.com/doc/versions/ ... aid-title6)

Regards,
Costin
Costin Sandoi
oXygen XML Editor and Author Support
mdslup
Posts: 167
Joined: Tue Mar 06, 2018 1:34 am

Re: CSS HTML5 PDF - can't import google font

Post by mdslup »

I was able to solve this by going to Options > Preferences > Proxy and changing to "Direct Connection".
Post Reply