You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Yes I started working on it last night. I think I've got the messaging between the Dom side and renderer, but I need the IDL for TextMetrics and the Rust implementation. It is very simple with just a lot of double fields, but I'm new to Rust and Servo so I have to learn a lot here. Is there a way to generate the Rust code from the IDL? Also I didn't see many other pieces of canvas that work like this so I don't have much to base this on.
Lastly I think for this initial implementation I will skip the "text preparation algorithm", since it looks like a beast. Unless there is already code for it somewhere else.
I think starting with a stub of the text preparation algorithm would be preferable to skipping it entirely. That would entail filling in the steps that are simple (ie. whitespace replacement), using sensible defaults for the steps that are more complicated and produce values, and leaving TODO comments for everything that is not spec-compliant.
Yeah, that makes sense. Certainly the whitespace replacement is pretty easy. But the part that says "Form a hypothetical infinitely-wide CSS line box containing a single inline box containing the text text" seems a bit more tricky. I'll need to look around servo and maybe at other browsers to see how that is supposed to work.
I like fonts and text rendering stuff so this might be an area of Servo where I could make a good contribution. For example the other text related canvas methods fillText and strokeText. And maybe even a beast like #4901.
Lastly I'm applying for the Staff Research Engineer position to work on Servo full-time, so if I get that I'll be able to do a lot more, obviously. 😄
Heh, I hadn't looked at that step. That is certainly... interesting. It suggests that we may want to extract some of the layout operations related to layout out text into somewhere outside of the layout/ crate. Definitely will require talking with some of the experts, but let's try to proceed without it for now.
Activity
leavengood commentedon Mar 27, 2015
I'd like to work on this.
jdm commentedon Mar 28, 2015
Ok! There are a bunch of different pieces involved, so let me know if you've got any questions :)
leavengood commentedon Mar 28, 2015
Yes I started working on it last night. I think I've got the messaging between the Dom side and renderer, but I need the IDL for TextMetrics and the Rust implementation. It is very simple with just a lot of double fields, but I'm new to Rust and Servo so I have to learn a lot here. Is there a way to generate the Rust code from the IDL? Also I didn't see many other pieces of canvas that work like this so I don't have much to base this on.
Lastly I think for this initial implementation I will skip the "text preparation algorithm", since it looks like a beast. Unless there is already code for it somewhere else.
jdm commentedon Mar 28, 2015
Yes, you should add a new TextMetrics.webidl file in components/script/dom/webidls, and create the corresponding textmetrics.rs for it too: http://doc.servo.org/script/dom/index.html#adding-a-new-dom-interface
jdm commentedon Mar 28, 2015
I think starting with a stub of the text preparation algorithm would be preferable to skipping it entirely. That would entail filling in the steps that are simple (ie. whitespace replacement), using sensible defaults for the steps that are more complicated and produce values, and leaving TODO comments for everything that is not spec-compliant.
leavengood commentedon Mar 28, 2015
Yeah, that makes sense. Certainly the whitespace replacement is pretty easy. But the part that says "Form a hypothetical infinitely-wide CSS line box containing a single inline box containing the text text" seems a bit more tricky. I'll need to look around servo and maybe at other browsers to see how that is supposed to work.
I like fonts and text rendering stuff so this might be an area of Servo where I could make a good contribution. For example the other text related canvas methods fillText and strokeText. And maybe even a beast like #4901.
Lastly I'm applying for the Staff Research Engineer position to work on Servo full-time, so if I get that I'll be able to do a lot more, obviously. 😄
jdm commentedon Mar 28, 2015
Heh, I hadn't looked at that step. That is certainly... interesting. It suggests that we may want to extract some of the layout operations related to layout out text into somewhere outside of the layout/ crate. Definitely will require talking with some of the experts, but let's try to proceed without it for now.
leavengood commentedon Apr 3, 2015
Over the past week I've had some other things keeping me busy, so I have not made much progress on this. I may have some time tonight or tomorrow.
paulrouget commentedon Sep 10, 2019
https://github.com/BabylonJS/Babylon.js/tree/master/gui needs this.
paulrouget commentedon Sep 21, 2019
I'm thinking of implementing a non operational version of MeasureText, behind a pref. It would just return 0 for now.
paulrouget commentedon Sep 21, 2019
#24261