Skip to content

Virama conjunct+Mc width fix#223

Closed
jquast wants to merge 2 commits into
masterfrom
jq/virama-conjunct-fix2
Closed

Virama conjunct+Mc width fix#223
jquast wants to merge 2 commits into
masterfrom
jq/virama-conjunct-fix2

Conversation

@jquast

@jquast jquast commented Jun 4, 2026

Copy link
Copy Markdown
Owner

bugfix Virama conjunct: Mc following a conjunct adds no independent width

Mc following a virama conjunct (C+V+C) was adding width +1. The Mc
closes the conjunct and accounts for its 1-cell contribution, it should
not add its own. I'm not sure this is directly spelled by any
specification, following uucode/ghostty measurements, here.

jquast added 2 commits June 4, 2026 16:05
After careful review of Virama width calculation and study of uucode, two related changes:

- Bugfix Invisible_Stacker viramas now form conjuncts (Burmese, Khmer, etc.)

   Discovered while analyzing Burmese, found in ``IndicSyllabicCategory.txt``, "causes conjunct
   formation", added in Unicode 14.0:

       # Indic_Syllabic_Category=Invisible_Stacker
       #
       # Invisible stacker (usually kills inherent vowel of consonant; is not visible
       #                    by itself; causes conjunct formation or consonant
       #                    stacking)

   So this logically belongs with the others in ``_ISC_VIRAMA_SET``. Use code generation instead of
   the copy and paste done before, this set would have changed in several past unicode releases and
   so may change again in the future.

- Change Virama+consonant width calculation to match @jacobsandlund's uucode (ghostty)

  Our previous implementation was perhaps too complex, but more "giving" for width compared to
  uucode's implementation, and neither of ours really has any basis in standards, seems to be of
  taste.  contour's libunicode does not make concern for virama, and uucode's does, measurement
  is simpler to implement and will probably improve performance, see code comment::

        # Virama codepoints (Indic_Syllabic_Category=Virama|Invisible_Stacker)
        # are treated as zero-width combining marks, matching Ghostty's uucode
        # library.  Whether a virama+consonant sequence should collapse to 1 or
        # 2 cells is undefined by Unicode; we follow uucode's (1).
…idth

Mc following a virama conjunct (C+V+C) was adding width +1. The Mc
closes the conjunct and accounts for its 1-cell contribution, it should
not add its own. I'm not sure this is directly spelled by any
specification, following uucode/ghostty measurements, here.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant