CJK character wrapping in lovrFontGetLines and lovrFontGetVertices - #1000
CJK character wrapping in lovrFontGetLines and lovrFontGetVertices#1000jamesthomasgriffin wants to merge 11 commits into
Conversation
|
I'm a little worried about implementing more advanced line breaking by hand because it creates a precedent for implementing more and more of UAX14. In a way, it's nice that the line wrapping algorithm is extremely bad right now, because LÖVR isn't making a promise about its text layout capabilities that it can't keep. For example, now it seems reasonable to request that LÖVR handle line breaking around hyphens and emdashes properly, whereas before this change it felt somewhat out of scope. But if that gets added, then it would probably make sense to handle all the funny kinds of dashes, spaces, punctuation marks, currency, etc. At some point, it just makes sense to switch to the text shaping library, since it can do a better job. However, maybe there is a way to explicitly draw the line and say that LÖVR handles some subset X of the full text shaping features, but nothing more than that. Maybe that line can be drawn somewhere beyond where it is today, but not in a place that creates extra expectations? I'm not too familiar with the landscape here. |
Resolves #989
Summary
Adds CJK-aware line wrapping (break at character boundaries for CJK text, suppressed at certain punctuation) without requiring a full shaping library.
Changes
previouswas being set to 0 to avoid kerning across linebreaks. This was interfering with the CJK logic so a new variablesuppressKerningnow does the job instead.suppressKerninglogic also ported tolovrFontGetVertices, because it was not easy to see that they were logically the same.wrap > 0and the otherwrap >= 0; I changed both towrap > 0.