Given a parsed CFF struct, how to use it in whole_font? #124
-
|
When parsing a PDF, some fonts are embedded as CFF fonts (Type1C). I can successfully parse the The Any advice would be appreciated. |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 5 replies
-
|
CFF fonts are embedded in PDF directly (I.e. without the OpenType wrapper). The CFF table is the whole font in that context. |
Beta Was this translation helpful? Give feedback.
-
|
Thank you for your insight @wezm. So that basically means I would need to add the OpenType wrapper and then run the result through: // add OT wrapper
let font_bytes = ...
let scope = ReadScope::new(font_bytes);
let font_file = scope.read::<FontData<'_>>().unwrap();I am pretty sure I tried that before, and it didn't quite work. Currently, after reading the font data as shown above, it gets a With the returned |
Beta Was this translation helpful? Give feedback.
-
|
@ronnybremer FontForge can open |
Beta Was this translation helpful? Give feedback.
-
|
I would like to close this discussion as the following has been established. A full font cannot be constructed from the CFF data embedded in a PDF. We have to find a way in Thank you both for your assistance! |
Beta Was this translation helpful? Give feedback.
Oh I see. By OpenType wrapper I mean the rest of the tables to make it usable as an OpenType font. You have a
CFFtable, the following would need to be created to make it usable as an OpenType font:cmap,head,hhea,hmtx,maxp,OS/2, maybename&post. I think it will be somewhat non-trivial to construct aFontmanually. The API in not really designed for 'interactive' construction of the structs, since many of them borrow data from an underlying slice of data.If the goal is to render the PDF the…