Page 1 of 1

Web Fonts in HTML Docs

Posted: Sun Jun 14, 2020 5:00 pm
by kkirkfield
How can I use web fonts from Google Fonts and other services in HTML docs?

I've tried following the documentation from PrinceXML and haven't been able to get it to work in SoftPro Select.

I've tried doing the import in the CSS file and in the HTML file, I've tried including the file in HTML using a link element, and I've tried adding the font files to the Resources of the document and creating the font face in the CSS. None of those methods seem to work.

The only method I've gotten to work is by installing the fonts on the machines, which isn't a solution since there are a bunch of different clients and the number is always growing.

Is there some way to get the web fonts to work? PrinceXML says it should be supported. I'm on SoftPro Select 4.3.60210.48.

Any help is much appreciated. Thank you.

Re: Web Fonts in HTML Docs

Posted: Mon Jun 15, 2020 11:59 am
by brandon.ritchie
You can add the font as a resource and include the css for it. See example below.

example:
In this example I used the Google "MetalMania-Regular.ttf" font as it was not loaded on my computer.

1) add the font file (ttf) as a resource in the spdoc. (FontAddedAsResource.jpg)
FontAddedAsResource.jpg
FontAddedAsResource.jpg (21.69 KiB) Viewed 882 times
Note: It does not have to be in a "Fonts" folder, just added as a resource.

2) add a CSS class for the font to the top of the HTML in the spdoc (in the <head> tag). You can now use that class to change the font of the text in the rest of the document. (ExampleCSSHTML.jpg)
ExampleCSSHTML.jpg
ExampleCSSHTML.jpg (189.89 KiB) Viewed 882 times
Note: The style for the font has to be in the main document not added in a resource style sheet (.css) to work.

Google example of the font for comparison.
GoogleFontExampleText.jpg
GoogleFontExampleText.jpg (13.73 KiB) Viewed 882 times