SwiftTerm icon indicating copy to clipboard operation
SwiftTerm copied to clipboard

Combing characters are broken in the Unicode example in the README.

Open 7ombie opened this issue 1 year ago • 1 comments

In the project README, it says "Solid UTF-8 support, excellent rendering". This is followed by a screenshot of SwiftTerm failing the first test (pretty badly):

80055786-95e43580-84f0-11ea-86dd-8dfb7f062b39

The two-column text should be aligned with the bar characters in the ruler above, but it's not even close.

P.S. I commented about this on a different closed issue (#67), but have since deleted that comment and opened this issue instead.

7ombie avatar Jun 22 '23 18:06 7ombie

Notes on the source of the problem:

This seems to be an issue with the handling of combining characters, the issue is characters like:

สิ

Are made up of "ส" and " ิ" (the latter being U+0E34) and should be considered in terms of the cell usage as part of the first cell.

The issue is that Swift is reporting that U+0E34 as a .notReordered value and prevents the combining code in handlePrint from running:

                if firstScalar.properties.canonicalCombiningClass != .notReordered {

The letter rendering is correct, as CoreText sees both characters, but the cell positioning is wrong due to the wrong combining value being returned.

migueldeicaza avatar Jul 06 '23 10:07 migueldeicaza