Skip to content

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

@s0l0ist

Description

@s0l0ist

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions