-
-
Notifications
You must be signed in to change notification settings - Fork 486
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Embedding font #239
Comments
need to look into what work that would entail seems possible, now need to replicate this in code https://www.howtogeek.com/106681/how-to-embed-fonts-in-a-microsoft-word-document/ |
I did some research and in ECMA-376-1 there's a description on how to embed a font. |
This document is 5039 pages long, can you direct me to the specific page? |
You're right, sorry! :) It's page 669 (chapter 17.8) |
Seems doable actually! Thanks! I'll most likely prepare it for the v5 release |
Great! I'll wait for it, then! |
From what i've been reading, the font needs to be coverted to a special type of format, im not sure of anywhere which does this do you know? |
I wonder if you could include a font engine such as fontkit to embed the font in the document. |
Never heard of it, but I'll take a look |
So I don't think fontkit creates ODTTF, which is the format Word documents need: https://github.com/foliojs/fontkit/issues?utf8=%E2%9C%93&q=ODTTF |
On a side note, I found this though: https://gist.github.com/dungsaga/ab8d2379bb566c9925b27df3bc82ca8b But it's in reverse, it converts ODTTF to TTF Would welcome a PR which creates the reverse of that gist above |
any update? |
I am stuck on the conversion of TTF to ODTTF, need to figure out how to do this. Word only accepts the ODTTF file format for fonts |
Hi @dolanmiu thanks for your great work. My developing product highly depends on docx. Recently, I'm trying to embed a custom font into the document but couldn't find out how. Any update on this feature? Is there any documentation about the structure of ODTTF file format? From the discussion above, it seems we could solve this problem if we find out a way to convert TTF to ODTTF? |
I would also be very interested in this. |
Are there any free TTF to ODTTF converters online? |
This is the closest thing I could find: https://social.msdn.microsoft.com/Forums/vstudio/en-US/edbee9a4-866b-44fd-bbaa-d835b183831e/how-to-create-an-odttf-file-from-a-given-font-name?forum=windowsxps example code that creates an obfuscated stream but it's not in TypeScript or JavaScript.. I tried to be clever and took the "fonts" folder from another document and put it into my generated document using 7zip but it just broke the document and didn't work, so there must be more to this |
If you can figure it out and make a PR, that would be much appreciated! |
I found a paper that might be helpful to you @dolanmiu
|
@Hunderhan Thank you so much for this! |
Not sure if it works, but I asked Chat GPT 4 to reverse the Gist posted above and got https://gist.github.com/jacwright/40c50faa29257c8b76666c1e077352f1. 😄 |
dolanmiu#239 Embedded fonts
@Hunderhan Can you explain a bit more your algorithm? I tried to use it, but I was not successful. DOCX files use a key in the form But where do you use this GUID in your algorithm? In your algorithm, it seems you are using a key of 16 characters, that you use twice, for the first 16 bytes, then again for the last 16 bytes:
|
* #239 Embedded fonts * Add boilerplate for font table * Fix linting * Fix linting * Fix odttf naming * Correct writing of fonts to relationships and font table new uuid function * Add font to run * Add demo Fix tests * Add character set support * Add tests * Write tests
Hi!
I was wondering if it could be possible to embed fonts into the document. Is it something that maybe you planned to do?
Thanks!
Filippo
The text was updated successfully, but these errors were encountered: