Inconsistent Behavior of Height Multiplier in Skia

28 views
Skip to first unread message

stephane

unread,
Feb 9, 2024, 9:17:19 AMFeb 9
to skia-discuss
Hello

Here's what I've observed:

Setting a Very Low Multiplier: When I set the height multiplier to a very low value (e.g., 0.01), I expect the line height to be significantly smaller than the default (like 100 times smaller). However, this doesn't seem to be the case. For instance, with a font size of 12px, changing the height multiplier to 0.01 doesn't make any noticeable difference.

Large Font Size Behavior: Conversely, with a font size of 90px, the same height multiplier setting (0.01) dramatically reduces the line height, almost equating it to the line height of a 12px font size. This implies there might be a concept of a minimum line height in play.

Different Methods, Different Behaviors: The behavior also differs between strutstyle::setheightmultiplier and textstyle::setheightmultiplier. With a small font size (like 3px), the line height remains around 12px regardless. But, setting 0.01 in sk4d_textstyle_set_height_multiplier has no effect, whereas the same setting in sk4d_strutstyle_set_height_multiplier reduces the line height to approximately the height of the font.

Given these observations, I'm led to believe that the height_multiplier feature in Skia might not be fully mature or behaves differently than expected, especially when compared to CSS.

Has anyone else experienced this? Is there a known reason for this behavior or any documentation that clarifies these discrepancies? Any insights or workarounds would be greatly appreciated.

jlav...@google.com

unread,
Feb 9, 2024, 9:24:50 AMFeb 9
to skia-discuss
SkParagraph is designed for Flutter,  it was never intended to match CSS.
Most of discrepancies come from that, I think.
You can read Flutter documentation for more clarity.
...
Reply all
Reply to author
Forward
0 new messages