yeslogic / allsorts

Font parser, shaping engine, and subsetter implemented in Rust
https://yeslogic.com/blog/allsorts-rust-font-shaping-engine/
Apache License 2.0
721 stars 21 forks source link

Does the subsetting feature support non-roman characters? #26

Closed thezjy closed 1 year ago

thezjy commented 4 years ago

The demo in allsorts-tools seems not to support non-roman chars. How to use the subsetting feature with character set like Chinese?

wezm commented 4 years ago

The short answer is no, not at the moment. Read on for a more detailed explanation.

The subsetting feature is currently tailored for the needs of subsetting fonts for embedding in PDFs, since that was our primary use case when developing Allsorts. The subsetting function supports including any of the glyphs in the subset font, no matter whether they are part of the macroman character set or not. The issue is that in this case we don't include a cmap table in the subset font, which makes it invalid for use outside PDF. The reason for this is that when a subset font is embedded in a PDF the cmap info is contained in the PDF directly, so we don't need to include it in the font.

I order to support more general subsetting we would need to extend the functionality a little so that it generates a cmap table in the subset font when desired.

thezjy commented 4 years ago

@wezm Thanks for your reply, I did some search and kind of understand the issue.

I want to use allsorts' subsetting function as a replacement of fonteditor-core Node library because I really want to Rust.

Is it possible that I read through both library and submit a PR to extend the subsetting to support any glyphs? Any general advice on doing that?

wezm commented 4 years ago

Later today I’ll add a new issue for better support for subsetting outside our PDF use case. I’ll include as much relevant info as I can on what’s needed in that issue and link it here.

wezm commented 4 years ago

Here's what we came up with: https://github.com/yeslogic/allsorts/issues/27 happy to answer any questions you may have.