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

[subset] Make it easier to keep evereything #3998

Closed
behdad opened this issue Jan 1, 2023 · 6 comments
Closed

[subset] Make it easier to keep evereything #3998

behdad opened this issue Jan 1, 2023 · 6 comments

Comments

@behdad
Copy link
Member

behdad commented Jan 1, 2023

Maybe add API on subset-input to keep everything. Basically this code:

const hb_subset_sets_t indices[] = {HB_SUBSET_SETS_UNICODE,
HB_SUBSET_SETS_GLYPH_INDEX,
HB_SUBSET_SETS_NAME_ID,
HB_SUBSET_SETS_NAME_LANG_ID,
HB_SUBSET_SETS_LAYOUT_FEATURE_TAG,
HB_SUBSET_SETS_LAYOUT_SCRIPT_TAG};
for (auto idx : hb_iter (indices))
{
hb_set_t *set = hb_subset_input_set (input, idx);
hb_set_clear (set);
hb_set_invert (set);
}
hb_subset_input_set_flags(input,
HB_SUBSET_FLAGS_NOTDEF_OUTLINE |
HB_SUBSET_FLAGS_GLYPH_NAMES |
HB_SUBSET_FLAGS_RETAIN_GIDS |
HB_SUBSET_FLAGS_NO_PRUNE_UNICODE_RANGES);

User can call this, then modify the input.

@behdad
Copy link
Member Author

behdad commented Jan 1, 2023

Would be a bit tricky to hook it up in hb-subset though, to let user override aspects after requesting to keep everything. Though maybe that works?

@behdad behdad closed this as completed in 4a5bd7a Jan 1, 2023
@behdad
Copy link
Member Author

behdad commented Jan 1, 2023

It works with hb-subset if one first adds --keep-everything then modifies glyphs / unicodes etc by subtracting from them for example.

@madig
Copy link
Contributor

madig commented Jan 5, 2023

So if I keep_everything and then empty out the GID list, would it subset the font such that everything is kept, except glyphs that cannot be reached via cmap, composites or layout?

Edit: looking for the equivalent of

        # The subsetter configuration preserves all OT feature support.
        # It will remove unused, unencoded glyphs.
        subset_args_expert = [
            str(local_filepath),
            "--unicodes=*",
            "--no-ignore-missing-glyphs",
            "--notdef-outline",
            "--layout-features=*",
            "--name-IDs=*",
            "--name-languages=*",
            "--glyph-names",
            "--no-prune-unicode-ranges",
            "--recalc-bounds",
            f"--output-file={local_filepath_subset}",
        ]

@behdad
Copy link
Member Author

behdad commented Jan 5, 2023

So if I keep_everything and then empty out the GID list, would it subset the font such that everything is kept, except glyphs that cannot be reached via cmap, composites or layout?

Correct.

@yisibl
Copy link
Contributor

yisibl commented Apr 1, 2024

@behdad For the --keep-everything option, the documentation does not specify its usage scenario.

If I just want to turn variable fonts into static fonts, should I use this option right?

e.g.

hb-subset VF.ttf -o subset.ttf --variations="wght=200" --keep-everything

@behdad
Copy link
Member Author

behdad commented Apr 1, 2024

If I just want to turn variable fonts into static fonts, should I use this option right?

Sounds about right, yes.

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

3 participants