mirror of
https://github.com/SpartanJ/eepp.git
synced 2026-10-17 11:03:16 +03:00
Text sized its per-vertex color array with getTotalVertices(), which assumed one quad per non-space character. Shaped text does not follow that rule (clusters, ligatures, marks, zero-sized glyphs and fallback fonts change the glyph count), so the color array could be shorter than the geometry. The draw then read past the end of the array for the last, visually rightmost glyphs: they disappeared or showed up as stray glyphs in mixed Latin/Hebrew/Arabic strings. - Size fill and outline colors from the generated geometry and rebuild them whenever the vertex counts change. Remove getTotalVertices(). - Never read past the color array in draw(), and draw the outline pass with its own vertex count instead of the fill count. - Share one shaped glyph walker (forEachShapedGlyphQuad) between both setFillColor() overloads and keep it in sync with ensureGeometryUpdate(): same layout parameters and the same fill visibility test. The per-character overload advanced its vertex index only when a color was present, which misaligned the remaining colors. TextLayout snapped complex-script glyph positions to whole pixels, but simple-script glyphs used the pen position as-is. After a Hebrew or Arabic run the pen is fractional (HarfBuzz 26.6 advances), so the Latin glyphs that followed were drawn at sub-pixel positions and blurred. Round simple-script positions as well. Pure Latin text is unchanged. Caret mapping: - Text::findCharacterPos() and findCharacterFromPos() now use the text's own base direction instead of TextDirection::Unspecified, so caret positions and hit testing agree with rendering. - In a right-to-left paragraph, place the end-of-text caret at the left end of the last line instead of after the rightmost glyph. Add TextLayout::getFirstStrongDirection(), which returns the direction of the first strong bidi character (UAX #9 P2/P3), for upcoming right-to-left layout support. Update the textedit Arabic and Hebrew reference images: only punctuation that follows RTL runs moves, now aligned to whole pixels.