Variable shaper - #41
Conversation
jdm
left a comment
There was a problem hiding this comment.
Thanks! These changes look useful.
| if !font.location.is_empty() { | ||
| hb_font_set_variations( | ||
| hb_font, | ||
| get_variation_data(font).as_ptr(), |
There was a problem hiding this comment.
Even though this is technically safe according to my experiments on the rust playground, I get very nervous passing a pointer to a temporary value as an argument here. Can we add a let variations = get_variation_data(font); before calling hb_font_set_variations to make the lifetime more clear?
This is really bad and should not be happen in production code. |
|
(I wish HarfBuzz never made |
| direction: Option<Direction>, | ||
| script: Option<hb_script_t>, | ||
| language: Option<String>, |
There was a problem hiding this comment.
Sounds like these should all be non-Optional.
| b.set_direction(Direction::LTR); | ||
| b.set_script(script); | ||
| b.set_language(Language::from_string("en_US")); | ||
| b.guess_segment_properties(); |
|
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 |
So a lot of the changes here are just rustfmt doing its thing, but this PR also:
locationfield 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_propertiesfor a decent default fallback.