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

DirectWrite doesn't count tabs as trailing whitespace in single-line layout? #414

Open
cmyr opened this issue Mar 10, 2021 · 0 comments
Open
Labels
piet-direct2d issue in the direct2d backend text

Comments

@cmyr
Copy link
Member

cmyr commented Mar 10, 2021

This is very much related to #411, but slightly more specific.

In #409 I added the following test:

fn line_test_tabs() {
    let line_text = "a\t\t\t\t\n";
    let mut factory = make_factory();
    let layout = factory.new_text_layout(line_text).build().unwrap();
    assert_eq!(layout.line_count(), 2);
    assert_eq!(layout.line_text(0), Some(line_text));
    let metrics = layout.line_metric(0).unwrap();
    assert_eq!(metrics.trailing_whitespace, line_text.len() - 1);
}

and this is now passing in coretext; previously it was running out of layout space and dropping some of the text.

DirectWrite currently fails this test, reporting its trailing whitespace length as '1'.

I think this is a matter of different expectations around trailing whitespace for these two APIs, but I can't investigate this week, since I don't have access to a windows machine.

@cmyr cmyr added text piet-direct2d issue in the direct2d backend labels Mar 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
piet-direct2d issue in the direct2d backend text
Projects
None yet
Development

No branches or pull requests

1 participant