Telegram-iOS/submodules/InstantPageUI
isaac 0a92dbddc3 InstantPage V2: fix inline emoji/image/formula x-offset on RTL lines
Inline attachments anchored their left edge at
CTLineGetOffsetForStringIndex(line, range.location), which is the glyph's
LEFT edge for LTR runs but its RIGHT edge for RTL runs (string index
increases leftward). On an RTL line (e.g. an Arabic thinking block) this
shoved emoji/images/formulas ~one advance (~24pt) too far right while the
CoreText-drawn text stayed correct.

Add v2LeadingOffsetForRange(_:range:), which returns
min(offset(start), offset(end)) with directional-boundary secondary-offset
handling — the true leading edge in both directions. Mirrors
Display.TextNode.addEmbeddedItem and the strikethrough/underline/spoiler
decorations already in this file (which used the min/abs form; the inline
attachments had regressed to a single offset). Applied at all 5 sites:
the emoji/image/formula display frames and the emoji/image characterRect
(reveal mask). Widths unchanged; only x corrected. LTR is byte-identical.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-04 20:39:13 +02:00
..
Sources InstantPage V2: fix inline emoji/image/formula x-offset on RTL lines 2026-06-04 20:39:13 +02:00
BUILD InstantPage V2: audio/music rendering, playback, and file-bubble styling 2026-06-02 17:44:45 +02:00