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

Add the ability to disable layout-closure #22

Closed
HussainTaj-arbisoft opened this issue Oct 13, 2023 · 1 comment
Closed

Add the ability to disable layout-closure #22

HussainTaj-arbisoft opened this issue Oct 13, 2023 · 1 comment

Comments

@HussainTaj-arbisoft
Copy link

Description

I'd like to be able to disable layout closure when subsetting fonts.

I attempted to subset Material icons font using subset-font. The output did provide a subset, however, the subset was larger in size than what I would have expected. I found out that this is because of layout closure.

The output of subset-font right now is equivalent to

hb-subset MaterialIcons-Regular.ttf <icons> -o out.ttf

What I would like to see instead can be produced with

hb-subset MaterialIcons-Regular.ttf <icons> -o out.ttf --no-layout-closure

Steps to Reproduce

  1. Download the MaterialIcon font.
  2. Set up a node project.
  3. Install subset-font.
  4. Create a test.js file with the following content:
    const subsetFont = require("subset-font");
    const fs = require('fs');
    
    const str = "_abcdefghijklmnopqrstuvwxyz0123456789" + String.fromCodePoint(0xe5c5, 0xe5c8);
    const fontBuffer = fs.readFileSync('MaterialIcons-Regular.ttf');
    
    subsetFont(fontBuffer, str).then((subsetBuffer) => {
        fs.writeFileSync('out.ttf', subsetBuffer);
    });
  5. Run with node test.js.
  6. Open out.ttf with a viewer like fontdrop.info.

Behavior

You see a lot more glyphs than what was defined in str variable.

Feature Request

Add an option "disableLayoutClosure". This should be equivalent to --no-layout-closure in hb-subset.

@papandreou
Copy link
Owner

That sounds reasonable! PR welcome 🤗

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