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

Characters getting mangled during subset #18

Open
tobys-at-canva opened this issue Dec 28, 2018 · 4 comments
Open

Characters getting mangled during subset #18

tobys-at-canva opened this issue Dec 28, 2018 · 4 comments

Comments

@tobys-at-canva
Copy link

I am attempting to subset a font and finding that the resulting characters are completely mangled.

The font I am subsetting is Noto Sans CJK SC Bold from https://www.google.com/get/noto/help/cjk/.

My exact code is this:

var Font = require('fonteditor-core').Font;
var fs = require('fs');
var buffer = fs.readFileSync('fonts/NotoSansCJKsc-Bold.otf');

// read font data
var font = Font.create(buffer, {
  type: 'otf', 
  subset: [0, 0x5b99, 0x6d2a], 
  hinting: false, 
  compound2simple: false, 
  inflate: null, 
  combinePath: false,
});

var buffer = font.write({
  type: 'woff', 
  hinting: true,
  deflate: null,
});

fs.writeFileSync('build/output.woff', buffer);

And while I can perform other operations without issue (eg, convert the full file to ttf), this code results in mangled characters in the output file.

screen shot 2018-12-28 at 11 00 44 am

Any ideas on what I may be able to try to get these subsets to look correct?

@Qix-
Copy link

Qix- commented Apr 27, 2019

I'm seeing this as well. Will try a manual approach as a workaround.

@zapalagrzegorz
Copy link

zapalagrzegorz commented Jul 16, 2021

Also experiencing problems with font Poppins after subsetting. Not an issue on v.1.0.5

@gongpeione
Copy link

same here

@varlinux
Copy link

varlinux commented Mar 22, 2023

subset is a Decimal array:

var font = Font.create(buffer, {
  type: 'otf', 
  // subset: [0, 0x5b99, 0x6d2a], // false
  subset: [0, 23449, 27946], // true, 0x5b99 -> 23449, 0x6d2a => 27946
  hinting: false, 
  compound2simple: false, 
  inflate: null, 
  combinePath: false,
});

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

5 participants