Skip to content

Commit

Permalink
move it
Browse files Browse the repository at this point in the history
  • Loading branch information
msft-Jeyaram committed Apr 7, 2017
1 parent ab2a4f4 commit 43ef1aa
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 12 deletions.
6 changes: 3 additions & 3 deletions Frameworks/CoreText/CTFramesetter.mm
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ CTFrameRef CTFramesetterCreateFrame(CTFramesetterRef framesetter, CFRange range,
CGRect frameRect = CGPathGetBoundingBox(path);

// Call _DWriteWrapper to get _CTLine object list that makes up this frame
CFAttributedStringRef attributedString = __CTTypesetterGetAttributedString(framesetter->Typesetter());
CFAttributedStringRef attributedString = _CTTypesetterGetAttributedString(framesetter->Typesetter());
if (range.length == 0L) {
range.length = CFStringGetLength(CFAttributedStringGetString(attributedString)) - range.location;
range.length = CFAttributedStringGetLength(attributedString) - range.location;
}

StrongId<_CTFrame> ret = _DWriteGetFrame(attributedString, range, frameRect);
Expand Down Expand Up @@ -127,7 +127,7 @@ CTTypesetterRef CTFramesetterGetTypesetter(CTFramesetterRef framesetter) {
CGSize CTFramesetterSuggestFrameSizeWithConstraints(
CTFramesetterRef framesetter, CFRange stringRange, CFDictionaryRef frameAttributes, CGSize constraints, CFRange* fitRange) {
RETURN_RESULT_IF_NULL(framesetter, CGSizeZero);
return _DWriteGetFrameSize(__CTTypesetterGetAttributedString(framesetter->Typesetter()), stringRange, constraints, fitRange);
return _DWriteGetFrameSize(_CTTypesetterGetAttributedString(framesetter->Typesetter()), stringRange, constraints, fitRange);
}

/**
Expand Down
14 changes: 6 additions & 8 deletions Frameworks/CoreText/CTTypesetter.mm
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ inline CFAttributedStringRef AttributedString() const {
woc::StrongCF<CFAttributedStringRef> _attributedString;
};

CFAttributedStringRef __CTTypesetterGetAttributedString(CTTypesetterRef typesetter) {
CFAttributedStringRef _CTTypesetterGetAttributedString(CTTypesetterRef typesetter) {
RETURN_NULL_IF(!typesetter);
return typesetter->AttributedString();
}
Expand Down Expand Up @@ -73,7 +73,7 @@ CTLineRef CTTypesetterCreateLine(CTTypesetterRef typesetter, CFRange stringRange
@Status Interoperable
*/
CTLineRef CTTypesetterCreateLineWithOffset(CTTypesetterRef ts, CFRange range, double offset) {
_CTFrame* frame = _DWriteGetFrame(__CTTypesetterGetAttributedString(ts), range, CGRectMake(offset, 0, FLT_MAX, FLT_MAX));
_CTFrame* frame = _DWriteGetFrame(ts->AttributedString(), range, CGRectMake(offset, 0, FLT_MAX, FLT_MAX));

RETURN_NULL_IF(!frame);
if ([frame->_lines count] != 1) {
Expand All @@ -98,12 +98,10 @@ CFIndex CTTypesetterSuggestLineBreak(CTTypesetterRef typesetter, CFIndex startIn
/**
@Status Interoperable
*/
CFIndex CTTypesetterSuggestLineBreakWithOffset(CTTypesetterRef ts, CFIndex index, double width, double offset) {
__CTTypesetter* typesetter = const_cast<__CTTypesetter*>(ts);
_CTFrame* frame =
_DWriteGetFrame(__CTTypesetterGetAttributedString(typesetter),
CFRangeMake(index, CFStringGetLength(CFAttributedStringGetString(typesetter->AttributedString())) - index),
CGRectMake(offset, 0, width, FLT_MAX));
CFIndex CTTypesetterSuggestLineBreakWithOffset(CTTypesetterRef typesetter, CFIndex index, double width, double offset) {
_CTFrame* frame = _DWriteGetFrame(typesetter->AttributedString(),
CFRangeMake(index, CFAttributedStringGetLength(typesetter->AttributedString()) - index),
CGRectMake(offset, 0, width, FLT_MAX));
if ([frame->_lines count] > 0) {
return static_cast<_CTLine*>([frame->_lines firstObject])->_strRange.length;
}
Expand Down
2 changes: 1 addition & 1 deletion Frameworks/include/CoreTextInternal.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ inline void _SafeRelease(T** p) {
}
}

CFAttributedStringRef __CTTypesetterGetAttributedString(CTTypesetterRef typesetter);
CFAttributedStringRef _CTTypesetterGetAttributedString(CTTypesetterRef typesetter);

@interface _CTRun : NSObject {
@public
Expand Down

0 comments on commit 43ef1aa

Please sign in to comment.