getLongestLine() on SkParagraph

42 views
Skip to first unread message

Данил Буланов

unread,
Jul 4, 2024, 5:53:26 PMJul 4
to skia-discuss
Hello, I have noticed weird behaviour of skParagraph::getLongestLine(), it returns something line -inf for empty text, which I suupose happens because of this line
https://skia.googlesource.com/skia/+/refs/heads/main/modules/skparagraph/src/ParagraphImpl.cpp#188

Can someone clarify the reason of that code existence?

jlav...@google.com

unread,
Jul 8, 2024, 9:29:14 AM (14 days ago) Jul 8
to skia-discuss
You are right, it's weird but SkParagraph was designed to replace another text renderer and it had to mimic the existing behavior.
Whenever you see the comment "// That is what flutter has" it's what we had to do.
Notice, that this code serves the case when the text cannot be shaped properly at all (not a single codepoint can be shown with any given font).
I assume that Flutter wants to detect this case and treat it differently from the normal empty text.

Reply all
Reply to author
Forward
0 new messages