One of our developers ran into an issue where Paint.breakText() (which says it counts "chars") is actually counting glyphs.
Imagine that you are wrapping just the one word "fit". It will fit on the line, so you expect breakText() to return 3. On some devices, it does; on others, the "fi" form a ligature, and breakText() returns 2. This cause you to draw
fi
t
... which is not what you want!
Is there either
- A flag to make
breakText()count Java chars, not glyphs? Or - A way to detect that
"fi"will be treated as a single glyph?
This seems sort of sub-optimal, but the way we're dealing with it is to use
paint.breakText("fit", true, 1000, null) == 2as abugExistsflag, and then usemeasureText()to check the results.