Page 1 of 1

Embedding Frutiger fonts in my converted docx file

PostPosted: Thu Mar 31, 2022 1:54 am
by mithilesh.jha
I have .ttf files for Frutiger fonts . I want to embed the Frutiger fonts in the converted docx(converting xhtml to docx) file.
Please advise.

Re: Embedding Frutiger fonts in my converted docx file

PostPosted: Fri Apr 08, 2022 5:12 pm
by jason
You'll need to create a TrueTypeFontPart or an ObfuscatedFontPart. Use setBinaryData to specify the ttf content.

Then add this to your docx: if you look at how Word does it, this will be a rel of your FontTablePart. So fontTablePart.addTargetPart

Typically you would also add a w:font entry in your font table part which describes the font. To work out what to put there, use Frutiger in a docx in Word then look at the resulting part.

Of course, to see any results you'll need to specify Frutiger on one or more runs (or use it as doc default or in a style).