Skip to content

Commit

Permalink
[attributedlabel] Ignored typographic-leading to evaluate _rectForRan…
Browse files Browse the repository at this point in the history
…ge:inLine:lineOrigin: for Japanese-character link.
  • Loading branch information
inamiy committed Aug 31, 2012
1 parent 74f37b3 commit c777729
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Expand Up @@ -83,7 +83,7 @@ - (void)viewDidLoad {
@"\nSigned beneath the image: tenach.deviantart.com"

// Japanese
@"\n\n\nこんにちは、ニンバス!これはBugテストです";
@"\n\n\nこんにちは、ニンバス!これはテストです";

NSRange linkRange = [label.text rangeOfString:@"an artist's rendition of the planet"];

Expand Down
4 changes: 3 additions & 1 deletion src/attributedlabel/src/NIAttributedLabel.m
Expand Up @@ -727,11 +727,13 @@ - (CGRect)_rectForRange:(NSRange)range inLine:(CTLineRef)line lineOrigin:(CGPoin
CGFloat ascent = 0.0f;
CGFloat descent = 0.0f;
CGFloat leading = 0.0f;

// Use of 'leading' doesn't properly highlight Japanese-character link.
CGFloat width = (CGFloat)CTRunGetTypographicBounds(run,
CFRangeMake(0, 0),
&ascent,
&descent,
&leading);
NULL); //&leading);
CGFloat height = ascent + descent;

CGFloat xOffset = CTLineGetOffsetForStringIndex(line, CTRunGetStringRange(run).location, nil);
Expand Down

0 comments on commit c777729

Please sign in to comment.