Skip to content
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

optional CFF / CFF2 parsing? #48

Open
Pomax opened this issue Nov 21, 2019 · 7 comments
Open

optional CFF / CFF2 parsing? #48

Pomax opened this issue Nov 21, 2019 · 7 comments

Comments

@Pomax
Copy link
Owner

Pomax commented Nov 21, 2019

While this lib may not be intended to be a text shaper, it might be useful to offer a separate CFF/CFF2 parser that can be loaded alongside Font.js, to allow Font.js to dig into the CFF/CFF2 blocks (without doing charstring interpretation), to add additional "raw data" inspection of the font.

@Pomax
Copy link
Owner Author

Pomax commented Nov 22, 2019

(note: font.js should still offer built in high-level deconstruction, but not operator/operand unpacking)

@hyvyys
Copy link

hyvyys commented Sep 25, 2021

+1. Right now I could use being able to tell whether a glyph contains any outlines at all.

@Pomax
Copy link
Owner Author

Pomax commented Sep 26, 2021

Can you sketch a use-case? Are you trying to determine if a glyph is printable from font, rather than from charset spec?

@hyvyys
Copy link

hyvyys commented Sep 26, 2021

Oh, it’s nothing really. I’m making a string generator to use with pattern fonts. Some of them will use a subset of the basic Latin alphabet for their pattern modules and have the remaining glyph slots empty instead of just leaving them out of the font. So being able to tell a glyph is empty would help automate the glyph selection process. Maybe there’s another way to do so, without having to parse CFF/CFF2?

@Pomax
Copy link
Owner Author

Pomax commented Sep 26, 2021

That seems like solving the symptom rather than the problem: don't include empty glyphs in your subset fonts, and you're done? Rather than parsing glyph outline strings, now it's back to a simple matter of "does font support codepoint X".

@hyvyys
Copy link

hyvyys commented Sep 26, 2021

Obviously. But sometimes curing the symptoms is all the doctor can do. I’m not working with my own fonts, and as the goal is to use a still smaller selection of the existing functional glyphs at any given time, manual glyph selection is still involved. I just thought I would detect and pre-select the filled glyphs after loading the font so that the users that come with their own custom-made, ad-hoc, imperfect fonts have a few clicks less.

@Pomax
Copy link
Owner Author

Pomax commented Sep 26, 2021

I see. In that case, you're probably better off loading a full-fat font library like OpenType.js, and then checking each glyph's metrics. I've implemented several TTF and CFF parsers in the past, and it's enough of an absolute nonsense job that unless someone's willing to fund the effort, I'm unlikely to get to it until I personally need it again.

(Mind you, if you need this because you work for a company and this helps you achieve a task set by your team/manager/company etc, please do talk to whoever has the power to fund third party work, because I'm more than happy to work on this library in exchange for monetary compensation =)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants