Skip to content

[subset] code points after 0 in --unicodes argument ignored #1361

@blueshade7

Description

@blueshade7

It appears as if 0 is treated as a string null terminator.

% hb-subset --unicodes=41,42,0,43,44 --output-file=output.ttf Roboto-Regular.ttf
% spot -tcmap=5 output.ttf
--- encoding[0]
platformId=0
scriptId  =3
languageId=0
--- [code]=glyphId
[0041]=1 
[0042]=2 

--- encoding[1]
platformId=3
scriptId  =1
languageId=0
--- [code]=glyphId
[0041]=1 
[0042]=2 

--- encoding[2]
platformId=3
scriptId  =10
languageId=0
--- [code]=glyphId
[00000041]=1 
[00000042]=2 

In comparison, fontTools respects code points after 0.

% pyftsubset --unicodes=41,42,0,43,44 --output-file=output.ttf Roboto-Regular.ttf
% spot -tcmap=5 output.ttf
--- encoding[0]
platformId=0
scriptId  =3
languageId=0
--- [code]=glyphId
[0000]=1 
[0041]=2 
[0042]=3 
[0043]=4 
[0044]=5 

SNIP

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions