mirror of
https://github.com/coteditor/CotEditor.git
synced 2024-09-11 11:25:57 +03:00
Display vertical tab (U+000B) (#377)
This commit is contained in:
parent
959de42d5b
commit
4fca3369e5
@ -8,6 +8,7 @@ develop
|
||||
### Additions/Changes
|
||||
|
||||
- Support displaying skin tone variations of Unicode 8.0 on the character inspector.
|
||||
- Display invisible vertical tab (`U+000B`) with `␋` symbol if “Show other invisible characters” turns on.
|
||||
|
||||
|
||||
### Fixes
|
||||
|
@ -205,12 +205,14 @@ static BOOL usesTextFontForInvisibles;
|
||||
CGPathRef tabGlyphPath = glyphPathWithCharacter([self tabChar], font, false);
|
||||
CGPathRef newLineGlyphPath = glyphPathWithCharacter([self newLineChar], font, false);
|
||||
CGPathRef fullWidthSpaceGlyphPath = glyphPathWithCharacter([self fullwidthSpaceChar], font, true);
|
||||
CGPathRef verticalTabGlyphPath = glyphPathWithCharacter(kVerticalTabChar, font, true);
|
||||
|
||||
// store value to avoid accessing properties each time (2014-07 by 1024jp)
|
||||
BOOL showsSpace = [self showsSpace];
|
||||
BOOL showsTab = [self showsTab];
|
||||
BOOL showsNewLine = [self showsNewLine];
|
||||
BOOL showsFullwidthSpace = [self showsFullwidthSpace];
|
||||
BOOL showsVerticalTab = [self showsOtherInvisibles]; // Vertical tab belongs to other invisibles.
|
||||
BOOL showsOtherInvisibles = [self showsOtherInvisibles];
|
||||
|
||||
// draw invisibles glyph by glyph
|
||||
@ -233,10 +235,15 @@ static BOOL usesTextFontForInvisibles;
|
||||
CGAffineTransform translate = CGAffineTransformMakeTranslation(point.x, point.y);
|
||||
CGPathAddPath(paths, &translate, newLineGlyphPath);
|
||||
|
||||
} else if (showsFullwidthSpace && (character == 0x3000)) { // Fullwidth-space (JP)
|
||||
} else if (showsFullwidthSpace && (character == 0x3000)) { // fullwidth-space (JP)
|
||||
NSPoint point = [self pointToDrawGlyphAtIndex:glyphIndex];
|
||||
CGAffineTransform translate = CGAffineTransformMakeTranslation(point.x, point.y);
|
||||
CGPathAddPath(paths, &translate, fullWidthSpaceGlyphPath);
|
||||
|
||||
} else if (showsVerticalTab && (character == '\v')) {
|
||||
NSPoint point = [self pointToDrawGlyphAtIndex:glyphIndex];
|
||||
CGAffineTransform translate = CGAffineTransformMakeTranslation(point.x, point.y);
|
||||
CGPathAddPath(paths, &translate, verticalTabGlyphPath);
|
||||
|
||||
} else if (showsOtherInvisibles && ([self glyphAtIndex:glyphIndex isValidIndex:NULL] == NSControlGlyph)) {
|
||||
if (!replaceFont) { // delay creating font/glyph till they are really needed
|
||||
@ -398,8 +405,9 @@ CGPathRef glyphPathWithCharacter(unichar character, CTFontRef font, bool prefers
|
||||
|
||||
// try fallback fonts in cases where user font doesn't support the input charactor
|
||||
// - All invisible characters of choices can be covered with the following two fonts.
|
||||
// - Monaco for vertical tab
|
||||
CGPathRef path = NULL;
|
||||
NSArray *fallbackFontNames = prefersFullWidth ? @[@"HiraKakuProN-W3", @"LucidaGrande"] : @[@"LucidaGrande", @"HiraKakuProN-W3"];
|
||||
NSArray *fallbackFontNames = prefersFullWidth ? @[@"HiraKakuProN-W3", @"LucidaGrande", @"Monaco"] : @[@"LucidaGrande", @"HiraKakuProN-W3", @"Monaco"];
|
||||
|
||||
for (NSString *fontName in fallbackFontNames) {
|
||||
CTFontRef fallbackFont = CTFontCreateWithName((CFStringRef)fontName, fontSize, 0);
|
||||
|
@ -488,6 +488,8 @@ extern NSUInteger const kSizeOfInvisibleNewLineCharList;
|
||||
extern unichar const kInvisibleFullwidthSpaceCharList[];
|
||||
extern NSUInteger const kSizeOfInvisibleFullwidthSpaceCharList;
|
||||
|
||||
extern unichar const kVerticalTabChar;
|
||||
|
||||
|
||||
|
||||
// ------------------------------------------------------
|
||||
|
@ -524,6 +524,8 @@ NSUInteger const kSizeOfInvisibleNewLineCharList = sizeof(kInvisibleNewLineChar
|
||||
unichar const kInvisibleFullwidthSpaceCharList[] = {0x25A1, 0x22A0, 0x25A0, 0x25B3};
|
||||
NSUInteger const kSizeOfInvisibleFullwidthSpaceCharList = sizeof(kInvisibleFullwidthSpaceCharList) / sizeof(unichar);
|
||||
|
||||
unichar const kVerticalTabChar = 0x240B; // symbol for vertical tablation
|
||||
|
||||
|
||||
|
||||
// ------------------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user