Skip to content

Commit

Permalink
Optimize Emoji alignment in vertical mode
Browse files Browse the repository at this point in the history
  • Loading branch information
LEOYoon-Tsaw committed Aug 17, 2020
1 parent dd572d8 commit 19bc95a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions SquirrelPanel.m
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,8 @@ - (void)convertToVerticalGlyph:(NSMutableAttributedString *)originalText inRange
NSRect charRect = [[originalText attributedSubstringFromRange:range] boundingRectWithSize:NSMakeSize(0, 0) options:NULL];
if ((charRect.size.width >= cjkRect.size.width) || (charRect.size.width >= hangulSize.width)) {
[originalText addAttribute:NSVerticalGlyphFormAttributeName value:@(1) range:range];
charRect = [[originalText attributedSubstringFromRange:range] boundingRectWithSize:NSMakeSize(0, 0) options:NULL];
[originalText addAttribute:NSBaselineOffsetAttributeName value:@((cjkRect.size.height-charRect.size.height)/2+(cjkRect.origin.y-charRect.origin.y)+_view.baseOffset) range:range];
NSRect uprightCharRect = [[originalText attributedSubstringFromRange:range] boundingRectWithSize:NSMakeSize(0, 0) options:NULL];
[originalText addAttribute:NSBaselineOffsetAttributeName value:@((cjkRect.size.height - uprightCharRect.size.height)/2+(cjkRect.origin.y-uprightCharRect.origin.y)-(charRect.size.width-cjkChar.size.width)/2+_view.baseOffset) range:range];
} else {
[originalText addAttribute:NSBaselineOffsetAttributeName value:@(_view.baseOffset) range:range];
}
Expand Down

0 comments on commit 19bc95a

Please sign in to comment.