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

Underline & Strikethrough handling not documented well #142

Open
spirali opened this issue Oct 21, 2024 · 5 comments
Open

Underline & Strikethrough handling not documented well #142

spirali opened this issue Oct 21, 2024 · 5 comments

Comments

@spirali
Copy link
Contributor

spirali commented Oct 21, 2024

Underline and strikethrough does not draw any line.

I have tried enable it just by:

    builder.push_default(StyleProperty::Underline(true));

or setting all properties:

    builder.push_default(StyleProperty::Underline(true));
    builder.push_default(StyleProperty::UnderlineBrush(Some(text_color)));
    builder.push_default(StyleProperty::UnderlineSize(Some(5.0)));
    builder.push_default(StyleProperty::UnderlineOffset(Some(1.0)));

in both cases, the text is drawn but without the decoration. I have both tested main branch and version 0.2.0.

@DJMcNab
Copy link
Member

DJMcNab commented Oct 21, 2024

Parley won't emulate underline drawing for you; you need to wire it up yourself using the offset provided by GlyphRun::style.

See for example the relevant code in Masonry: https://github.com/linebender/xilem/blob/771eb2f02f3d6629b78fe233fdec76a563ddbbb2/masonry/src/text/render_text.rs#L86-L119

Note that this code is for Parley 0.1.0, although I don't believe that this part has changed.

Our documentation of an expected integration isn't very thorough.

@spirali
Copy link
Contributor Author

spirali commented Oct 21, 2024

Thank you for your explanation!

@spirali spirali closed this as completed Oct 21, 2024
@waywardmonkeys
Copy link
Contributor

@spirali I think it is reasonable to keep this open and change it to indicate that we need to improve the documentation.

@waywardmonkeys waywardmonkeys changed the title Underline & Strikethrough not working Underline & Strikethrough handling not documented well Oct 23, 2024
@spirali
Copy link
Contributor Author

spirali commented Oct 23, 2024

Ok. Btw: I think that it would be nice to put a simple implementation into examples swash_render and tiny_skia_renderer or at least to put there a comment that the user needs to implement this part manually.

@nicoburns
Copy link
Contributor

Btw: I think that it would be nice to put a simple implementation into examples swash_render and tiny_skia_renderer or at least to put there a comment that the user needs to implement this part manually.

Totally agree. I made those examples, and the only reason that this code is not included as part of them is because I also missed the fact that it was necessary!

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

4 participants