dolanmiu / docx

Easily generate and modify .docx files with JS/TS with a nice declarative API. Works for Node and on the Browser.

Home Page:https://docx.js.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Couple issues with embedded fonts

mattidupre opened this issue · comments

I might be jumping the gun but I wanted to play with embedded fonts. I've noticed two issues.

Using Word 365 / MacOS:

1: Font names with spaces corrupt the docx file.
2. Every font I tried aside from Pacifico (which I had already installed) is failing to render. The document loads fine but the font disappears from the Word UI selection once it gets changed. I do see those fonts showing up in fontTable.xml file. Confirmed the fonts have no embedding restrictions. Repo using demo 91 and swapping for Rubik or Salsa.

(I did notice that Word will retain a previously-installed font after it has been removed from the system.)

I have the same trouble using "docx": "^8.5.0",
Scenario: I embed fonts on the code, fonts: [{ name: "Pacifico Bold" data: font, characterSet: CharacterSet.ANSI }], but when I try to open the Word file, the Word app shows an alert that the file is corrupted.

The workaround is to embed the fonts, for example, "Pacifico-Bold," and put a name without spaces; that works for me.

Have you confirmed Word isn't just loading Pacifico locally on your system? That's what was happening to me after I thought I had it fixed.

You are right. The fonts are not loading on the document. It is an issue with the docx library because I followed the example in the repository, but it doesn't work.

i have same issue.... embedded fonts only works for Pacifico....