font: Consider lang attribute when shaping#43447
Conversation
|
8332aea to
da0893e
Compare
Signed-off-by: Richard Tjokroutomo <richard.tjokro2@gmail.com>
da0893e to
a72859d
Compare
|
Please update the testing field to with your analysis of the WPT differences. Manual testing is not enough for these kind of changes typically. |
Updated. I've also pushed the updated WPT expectations. PTAL! |
| url = { workspace = true } | ||
| uuid = { workspace = true, features = ["v4"] } | ||
| webrender_api = { workspace = true } | ||
| icu_locid.workspace = true |
There was a problem hiding this comment.
This should be inserted into the list in alphabetical order and also follow the pattern of other entries:
| icu_locid.workspace = true | |
| icu_locid = { workspace = true } |
There was a problem hiding this comment.
my bad; I ran cargo add without actually checking...
| /// The Unicode script property of the characters in this run. | ||
| pub script: Script, | ||
|
|
||
| pub language: Language, |
| let lang = parent_style.get_font()._x_lang.clone(); | ||
| let lang_identifier = match lang.0.parse() { | ||
| Ok(parsed_language) => parsed_language, | ||
| Err(_) => Language::UND, | ||
| }; |
There was a problem hiding this comment.
| let lang = parent_style.get_font()._x_lang.clone(); | |
| let lang_identifier = match lang.0.parse() { | |
| Ok(parsed_language) => parsed_language, | |
| Err(_) => Language::UND, | |
| }; | |
| let language = parent_style.get_font()._x_lang.0.parse().unwrap_or(Langauge::UND); |
| fonts_traits = { workspace = true } | ||
| html5ever = { workspace = true } | ||
| icu_locid = { workspace = true } | ||
| icu_locid.workspace = true |
There was a problem hiding this comment.
Please keep this consistent with the other entries. There's no reason to make one different.
| let mut current_text_run = UnshapedTextRun::default(); | ||
| current_text_run.set_language(language.clone()); |
There was a problem hiding this comment.
Instead of doing this, add a new() method that takes the Language and remove the implementation of Default on UnshapedTextRun.
| x25519-dalek = { workspace = true } | ||
| xml5ever = { workspace = true } | ||
| xpath = { workspace = true } | ||
| icu_locid.workspace = true |
| gstreamer-base = "0.25" | ||
| gstreamer-gl = "0.25" | ||
| gstreamer-gl-egl = "0.25" | ||
| gstreamer-gl-sys = "0.25" |
There was a problem hiding this comment.
hmm, maybe it's a leftover from earlier commits? I originally used icu_locale, but switched to icu_locid because icu_locale is based off newer icu version.
There was a problem hiding this comment.
I think you should probably revert this particular change as it is unrelated. Cargo.toml isn't automatically generated, so this change comes from some change that you made or was made locally in your working directory.
There was a problem hiding this comment.
ah? I thought I've re-added it in previous commit.
My bad; should be good now.
3e10dab to
395d7a3
Compare
|
Thanks for the review! I've addressed them all, PTAL again. |
5644efa to
98aa949
Compare
mrobinson
left a comment
There was a problem hiding this comment.
Looks good with two changes before landing.
| pub word_spacing: Au, | ||
| /// The Unicode script property of the characters in this run. | ||
| pub script: Script, | ||
|
|
| gstreamer-base = "0.25" | ||
| gstreamer-gl = "0.25" | ||
| gstreamer-gl-egl = "0.25" | ||
| gstreamer-gl-sys = "0.25" |
There was a problem hiding this comment.
I think you should probably revert this particular change as it is unrelated. Cargo.toml isn't automatically generated, so this change comes from some change that you made or was made locally in your working directory.
lang attribute when shaping
Signed-off-by: Richard Tjokroutomo <richard.tjokro2@gmail.com>
| script, | ||
| ..Default::default() | ||
| string: Default::default(), | ||
| language, |
There was a problem hiding this comment.
I think this is the cause of new failing tests.
Previously, I leave it to default (Language::UND), but after @mrobinson suggested to add new method for UnshapedTextRun, I set the value to language.
I think setting it to language should be the way to go, so I'll need to investigate the new failing tests, sorry about this...
|
@mrobinson regarding the 3 new failing tests, here's what's known:
I still think that setting the I'm thinking that for now, I can either set the language to unknown & add a TODO, or update the WPT expectations and open a new issue, because it seems the problem only exists with |
|
@RichardTjokroutomo It's probably fine to leave the language set to undefined there and look at it later, but maybe it's worth at least looking at how the results differ first, in case they point to some unexpected behavior:
|
Thanks, I didn't know we can do this! I've created an issue and update it once this PR lands (since the code in question doesnt exist in main branch yet) |
|
newest try run (just to be certain). |
|
@RichardTjokroutomo Were you able to understand the reason that the tests are failing or at least upload a couple of the screenshots here? |
|
@mrobinson hmm, no. For example, for I plan to upload all screenshots in this issue, but I can upload it here. Gimme a while. |
a71b737 to
bf5a046
Compare
|
screenshots from test results:
|
|
I think the issue here is that there is also an experimental |
In that case, let me update the TODO desc |
|
@RichardTjokroutomo Okay. Please update the PR with the results and also update the |
bf5a046 to
c022292
Compare
…experimental `lang` attribute Signed-off-by: Richard Tjokroutomo <richard.tjokro2@gmail.com>
c022292 to
bbdd4a5
Compare
|
@mrobinson newest try run succeeded. Is there anything else you want to change? |






Fonts: Added
languagefield in the structShapingOptionsso Harfbuzz can also consider language when shaping glyphs.Testing: Existing WPT. Most recent try run: link
2 new passes, 5 new fails.
Failures:
/css/css-text-decor/text-emphasis-punctuation-2.htmlshould be a false positive sincetext-emphasisshorthand hasn't been supported on stylo yet./css/css-text/text-spacing-trim/text-spacing-trim-quote-001.html?class=halt,htb&lang=jateststext-spacing-trimdefault behavior onJAtexts. Since this property is not defined in Stylo, I believe that this property's behavior (including default) hasn't been considered in Servo. So Servo previously passing the test should be a false positive. As a side note, this test also fails on Firefox./html/canvas/element/manual/text/canvas.2d.lang.dynamic.html,/html/canvas/element/manual/text/canvas.2d.lang.html,/html/canvas/element/manual/text/canvas.2d.lang.inherit.disconnected.canvas.htmlfail because canvas' experimentallangattribute hasn't been supported yet.credits to @mrobinson for figuring out the reason for last 3 failing WPT tests!
Fixes: #41825