Skip to content

Commit

Permalink
moved image vertical alignment through used font to DTHTMLElement bec…
Browse files Browse the repository at this point in the history
…ause we know the font at string building time.
  • Loading branch information
odrobnik committed Feb 6, 2012
1 parent a437c7a commit 56e688a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 17 deletions.
17 changes: 0 additions & 17 deletions Core/Source/DTHTMLAttributedStringBuilder.m
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -281,23 +281,6 @@ - (BOOL)buildString
dispatch_group_wait(_stringParsingGroup, DISPATCH_TIME_FOREVER); dispatch_group_wait(_stringParsingGroup, DISPATCH_TIME_FOREVER);
dispatch_group_wait(_stringAssemblyGroup, DISPATCH_TIME_FOREVER); dispatch_group_wait(_stringAssemblyGroup, DISPATCH_TIME_FOREVER);




// walk through attachments and tell them about their surrounding font
[tmpString enumerateAttribute:NSAttachmentAttributeName inRange:NSMakeRange(0, [tmpString length])
options:0
usingBlock:^(DTTextAttachment *attachment, NSRange range, BOOL *stop) {
if (attachment)
{
CTFontRef usedFont = (__bridge CTFontRef)[tmpString attribute:(id)kCTFontAttributeName atIndex:range.location effectiveRange:NULL];

if (usedFont)
{
[attachment adjustVerticalAlignmentForFont:usedFont];
}
}
}];

return result; return result;
} }


Expand Down
3 changes: 3 additions & 0 deletions Core/Source/DTHTMLElement.m
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -152,6 +152,9 @@ - (NSDictionary *)attributesDictionary
{ {
// __bridge since its already retained elsewhere // __bridge since its already retained elsewhere
[tmpDict setObject:(__bridge id)(font) forKey:(id)kCTFontAttributeName]; [tmpDict setObject:(__bridge id)(font) forKey:(id)kCTFontAttributeName];

// use this font to adjust the values needed for the run delegate during layout time
[_textAttachment adjustVerticalAlignmentForFont:font];
} }
} }


Expand Down

0 comments on commit 56e688a

Please sign in to comment.