Draw invisible chars only for control characters (fix #962)

This commit is contained in:
1024jp 2019-05-29 19:11:17 +09:00
parent 8e4e9ab694
commit 898ec66d40
3 changed files with 12 additions and 1 deletions

View File

@ -2,6 +2,16 @@
Change Log
==========================
3.7.6 (unreleased)
--------------------------
### Fixes
- Fix an issue where an unwanted whitespace was added for variation selector `U+FE0E` when control characters are visible.
3.7.5 (353)
--------------------------

View File

@ -55,7 +55,8 @@ final class ATSTypesetter: NSATSTypesetter {
if action.contains(.zeroAdvancementAction),
let character = (self.attributedString?.string as NSString?)?.character(at: charIndex),
!UTF16.isTrailSurrogate(character) // ignore one of surrogate
let unicode = Unicode.Scalar(character),
unicode.properties.generalCategory == .control
{
return .whitespaceAction // -> Then, the glyph width can be modified on `boundingBox(forControlGlyphAt:...)`.
}

Binary file not shown.