Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
moved image vertical alignment through used font to DTHTMLElement bec…
…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
Expand Up @@ -281,23 +281,6 @@ - (BOOL)buildString
dispatch_group_wait(_stringParsingGroup, 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;
}

Expand Down
3 changes: 3 additions & 0 deletions Core/Source/DTHTMLElement.m
Expand Up @@ -152,6 +152,9 @@ - (NSDictionary *)attributesDictionary
{
// __bridge since its already retained elsewhere
[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.