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

Tab ('\t') doesn't match ClusterInfo #49

Open
s0l0ist opened this issue Mar 21, 2024 · 0 comments
Open

Tab ('\t') doesn't match ClusterInfo #49

s0l0ist opened this issue Mar 21, 2024 · 0 comments

Comments

@s0l0ist
Copy link

s0l0ist commented Mar 21, 2024

I am trying to match on the whitespace enum, but it appears that parsing any kind of tab (unicode, control, etc) doesn't appear to match the Whitespace::Tab variant.

Code to reproduce:

let font_size = 16.;
let mut shape_context = ShapeContext::new();
let mut shaper = shape_context
    .builder(*font_ref)
    .script(Script::Latin)
    .size(font_size)
    .direction(Direction::LeftToRight)
    .build();

// 4 variants of how to input a `tab`
shaper.add_str("\t\u{0009}	\u{2B7E}");

shaper.shape_with(|glyph_cluster| {
    let info = glyph_cluster.info;
    println!("got INFO: '{:?}'", info.0);
    println!("got whitespace: '{:?}'", info.whitespace());
});

What it does:

got INFO: '0'
got whitespace: 'None'
got INFO: '0'
got whitespace: 'None'
got INFO: '0'
got whitespace: 'None'
got INFO: '0'
got whitespace: 'None'

What I expect it to do:

got INFO: '7'
got whitespace: 'Tab'
got INFO: '7'
got whitespace: 'Tab'
got INFO: '7'
got whitespace: 'Tab'
got INFO: '7'
got whitespace: 'Tab'

I am using the Roboto-Regular.ttf font.

@s0l0ist s0l0ist changed the title Tab ('\t') doesn't seem to render? Tab ('\t') doesn't match ClusterInfo Mar 21, 2024
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

1 participant