There are no forum posts on this topic! Why don't you write one?
I’m using the HTML → DOCX REST API and I have a question about how fonts are handled in the generated Word document.
In HTML and CSS, it is easy to specify custom web fonts. After conversion, the resulting DOCX contains a mix of what look like “system” fonts (e.g., Arial, Times New Roman, Courier, Aptos/Calibri), but I’m also seeing fonts like Roboto and Open Sans come through.
- Where are these non-system fonts coming from? Does the conversion engine download and use web fonts during the browser-render step (e.g., via @font-face or Google Fonts), and then write those font family names into the DOCX?
- I am assuming that fonts are allowed or not based on the available fonts on the computer they are being generated on, is this correct?
- Is there a way to know which fonts are allowed vs not allowed?
- Does the behaviour change depending on whether I am using the HTML->DOCX file via URL vs sending in the HTML as a string (with embedded CSS)
If helpful, I can provide examples of:
- the HTML + CSS being converted (including any @import/@font-face)
- the resulting document.xml, styles.xml, and fontTable.xml
- screenshots showing the fonts Word reports vs. what’s referenced in XML
Mainly I’m trying to understand how and when non-system fonts are allowed, and, if there are a certain subset that are supported, which ones those would be.
Hi Paul,
Because CSS has a fall back list and DOCX does't we essentially use our list of font-families to find the first one we recognise in the font-family fallback list and use this. This should mean that the font that is selected that is more likely to be on a users computer. Because we don't embedd any fonts in the document just tag the text with the appropriate font name.
We maintain a specific list of that you can check: recognized font families.