Open simoncozens opened 2 years ago
- Makes the direction/script/language optional in
layout_fragment
, allowing the user to set explicit values if they want them but using Harfbuzz'sguess_segment_properties
for a decent default fallback.
This is really bad and should not be happen in production code. hb_buffer_guess_segment_properties()
can easily be wrong and the user will be none the wiser. For example it guesses the direction from the script, so an sequence of digits from an RTL script will be set to RTL even though it should almost always be LTR.
(I wish HarfBuzz never made hb_buffer_guess_segment_properties()
public and kept it only for the command line test utilities).
Thanks, I'll work on these. I think an architectural question to resolve is whether we see the variation location as an attribute of the FontRef
or of the TextStyle
. I can see arguments for each. I put them in the FontRef
so that they would be available to access when you have a Vec<LayoutFragment>
(i.e. when you're breaking the text into lines after shaping). But there's also an argument that a LayoutFragment
should know its TextStyle
, and if we add that property, it would be much neater to put the variation location into TextStyle
too.
So a lot of the changes here are just rustfmt doing its thing, but this PR also:
location
field to the FontRef struct, to allow for shaping variable fonts.layout_fragment
, allowing the user to set explicit values if they want them but using Harfbuzz'sguess_segment_properties
for a decent default fallback.