From ccd8c204e1c85799fd846233517c10c928362f99 Mon Sep 17 00:00:00 2001 From: Daniel Gretarsson Date: Fri, 17 Mar 2023 11:17:39 +0000 Subject: [PATCH] Add some stubs for missing symbols in CoreText --- CoreText/CMakeLists.txt | 8 ++ CoreText/CTFont.m | 43 +++++++- CoreText/CTFontCollection.m | 14 +++ CoreText/CTFontDescriptor.m | 7 ++ CoreText/CTFontManager.m | 25 +++++ CoreText/CTFrame.m | 41 +++++++ CoreText/CTFrameSetter.m | 44 ++++++++ CoreText/CTLine.m | 93 ++++++++++++++++ CoreText/CTRun.m | 103 ++++++++++++++++++ CoreText/CTStringATtributes.m | 4 + CoreText/include/CoreText/CTFont.h | 12 ++ CoreText/include/CoreText/CTFontCollection.h | 8 ++ CoreText/include/CoreText/CTFontDescriptor.h | 10 ++ CoreText/include/CoreText/CTFontManager.h | 24 ++++ CoreText/include/CoreText/CTFrame.h | 40 +++++++ CoreText/include/CoreText/CTFrameSetter.h | 25 +++++ CoreText/include/CoreText/CTLine.h | 52 +++++++++ CoreText/include/CoreText/CTRun.h | 48 ++++++++ .../include/CoreText/CTStringAttributes.h | 5 + CoreText/include/CoreText/CTTypesetter.h | 5 + CoreText/include/CoreText/CoreText.h | 2 + CoreText/stubs.c | 25 ----- 22 files changed, 612 insertions(+), 26 deletions(-) create mode 100644 CoreText/CTFontCollection.m create mode 100644 CoreText/CTFontDescriptor.m create mode 100644 CoreText/CTFontManager.m create mode 100644 CoreText/CTFrame.m create mode 100644 CoreText/CTFrameSetter.m create mode 100644 CoreText/CTLine.m create mode 100644 CoreText/CTRun.m create mode 100644 CoreText/CTStringATtributes.m create mode 100644 CoreText/include/CoreText/CTFontCollection.h create mode 100644 CoreText/include/CoreText/CTFontDescriptor.h create mode 100644 CoreText/include/CoreText/CTFontManager.h create mode 100644 CoreText/include/CoreText/CTFrame.h create mode 100644 CoreText/include/CoreText/CTFrameSetter.h create mode 100644 CoreText/include/CoreText/CTLine.h create mode 100644 CoreText/include/CoreText/CTRun.h create mode 100644 CoreText/include/CoreText/CTStringAttributes.h create mode 100644 CoreText/include/CoreText/CTTypesetter.h diff --git a/CoreText/CMakeLists.txt b/CoreText/CMakeLists.txt index a0eedf5b..1ec11620 100644 --- a/CoreText/CMakeLists.txt +++ b/CoreText/CMakeLists.txt @@ -17,6 +17,14 @@ include_directories( set(CoreText_sources CTFont.m CTParagraphStyle.m + CTStringATtributes.m + CTFontCollection.m + CTFontDescriptor.m + CTFontManager.m + CTFrame.m + CTFrameSetter.m + CTLine.m + CTRun.m KTFont.m KTFont_FT.m constants.c diff --git a/CoreText/CTFont.m b/CoreText/CTFont.m index 007163e1..4ad15a02 100644 --- a/CoreText/CTFont.m +++ b/CoreText/CTFont.m @@ -19,6 +19,9 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #import #import +#import + +const CFStringRef kCTFontStyleNameKey = "CTFontSubFamilyName"; CTFontRef CTFontCreateWithGraphicsFont(CGFontRef cgFont, CGFloat size, @@ -105,7 +108,45 @@ CGPathRef CTFontCreatePathForGlyph(CTFontRef self, CGGlyph glyph, return (CGPathRef) [self createPathForGlyph: glyph transform: xform]; } -CFArrayRef CTFontCopyAvailableTables(CTFontRef font, CTFontTableOptions options) { +CFArrayRef CTFontCopyAvailableTables(CTFontRef font, CTFontTableOptions options) +{ printf("STUB %s\n", __PRETTY_FUNCTION__); return nil; } + +CFTypeRef CTFontCopyAttribute(CTFontRef font, CFStringRef attribute) +{ + printf("STUB %s\n", __PRETTY_FUNCTION__); + return nil; +} + +CGFontRef CTFontCopyGraphicsFont(CTFontRef font, CTFontDescriptorRef _Nullable *attributes) +{ + printf("STUB %s\n", __PRETTY_FUNCTION__); + return nil; +} + +CFStringRef CTFontCopyPostScriptName(CTFontRef font) +{ + printf("STUB %s\n", __PRETTY_FUNCTION__); + return nil; +} + +CTFontRef CTFontCreateCopyWithAttributes(CTFontRef font, CGFloat size, const CGAffineTransform *matrix, CTFontDescriptorRef attributes) +{ + printf("STUB %s\n", __PRETTY_FUNCTION__); + return nil; +} + +CTFontRef CTFontCreateWithName(CFStringRef name, CGFloat size, const CGAffineTransform *matrix) +{ + printf("STUB %s\n", __PRETTY_FUNCTION__); + return nil; +} + +CFStringRef _Nullable CTFontCopyName(CTFontRef font, CFStringRef nameKey) +{ + printf("STUB %s\n", __PRETTY_FUNCTION__); + return nil; +} + diff --git a/CoreText/CTFontCollection.m b/CoreText/CTFontCollection.m new file mode 100644 index 00000000..8c7e34c8 --- /dev/null +++ b/CoreText/CTFontCollection.m @@ -0,0 +1,14 @@ +#import + +CFArrayRef _Nullable CTFontCollectionCreateMatchingFontDescriptors(CTFontCollectionRef collection) +{ + printf("STUB %s\n", __PRETTY_FUNCTION__); + return nil; +} + +CTFontCollectionRef CTFontCollectionCreateWithFontDescriptors(CFArrayRef _Nullable queryDescriptors, + CFDictionaryRef _Nullable options) +{ + printf("STUB %s\n", __PRETTY_FUNCTION__); + return nil; +} diff --git a/CoreText/CTFontDescriptor.m b/CoreText/CTFontDescriptor.m new file mode 100644 index 00000000..cf68d33b --- /dev/null +++ b/CoreText/CTFontDescriptor.m @@ -0,0 +1,7 @@ +#import + +CFTypeRef CTFontDescriptorCopyAttribute(CTFontDescriptorRef descriptor, CFStringRef attribute) +{ + printf("STUB %s\n", __PRETTY_FUNCTION__); + return nil; +} diff --git a/CoreText/CTFontManager.m b/CoreText/CTFontManager.m new file mode 100644 index 00000000..192c36f0 --- /dev/null +++ b/CoreText/CTFontManager.m @@ -0,0 +1,25 @@ +#import + +bool CTFontManagerRegisterGraphicsFont(CGFontRef font, CFErrorRef* error) +{ + printf("STUB %s\n", __PRETTY_FUNCTION__); + return nil; +} + +bool CTFontManagerUnregisterGraphicsFont(CGFontRef font, CFErrorRef *error) +{ + printf("STUB %s\n", __PRETTY_FUNCTION__); + return nil; +} + +CFArrayRef CTFontManagerCopyAvailableFontFamilyNames(void) +{ + printf("STUB %s\n", __PRETTY_FUNCTION__); + return nil; +} + +bool CTFontManagerRegisterFontsForURL(CFURLRef fontURL, CTFontManagerScope scope, CFErrorRef * error) +{ + printf("STUB %s\n", __PRETTY_FUNCTION__); + return false; +} diff --git a/CoreText/CTFrame.m b/CoreText/CTFrame.m new file mode 100644 index 00000000..36e73a38 --- /dev/null +++ b/CoreText/CTFrame.m @@ -0,0 +1,41 @@ +#import + +CFRange CTFrameGetStringRange(CTFrameRef frame) +{ + printf("STUB %s\n", __PRETTY_FUNCTION__); + return CFRangeMake(0, 0); +} + +CFRange CTFrameGetVisibleStringRange(CTFrameRef frame) +{ + printf("STUB %s\n", __PRETTY_FUNCTION__); + return CFRangeMake(0, 0); +} + +CGPathRef CTFrameGetPath(CTFrameRef frame) +{ + printf("STUB %s\n", __PRETTY_FUNCTION__); + return nil; +} + +CFDictionaryRef _Nullable CTFrameGetFrameAttributes(CTFrameRef frame) +{ + printf("STUB %s\n", __PRETTY_FUNCTION__); + return nil; +} + +CFArrayRef CTFrameGetLines(CTFrameRef frame) +{ + printf("STUB %s\n", __PRETTY_FUNCTION__); + return nil; +} + +void CTFrameGetLineOrigins(CTFrameRef frame, CFRange range, CGPoint origins[_Nonnull]) +{ + printf("STUB %s\n", __PRETTY_FUNCTION__); +} + +void CTFrameDraw(CTFrameRef frame, CGContextRef context) +{ + printf("STUB %s\n", __PRETTY_FUNCTION__); +} diff --git a/CoreText/CTFrameSetter.m b/CoreText/CTFrameSetter.m new file mode 100644 index 00000000..e801890d --- /dev/null +++ b/CoreText/CTFrameSetter.m @@ -0,0 +1,44 @@ +#import + +CFTypeID CTFramesetterGetTypeID(void) +{ + printf("STUB %s\n", __PRETTY_FUNCTION__); + return 0; +} + +CTFramesetterRef CTFramesetterCreateWithTypesetter(CTTypesetterRef typesetter) +{ + printf("STUB %s\n", __PRETTY_FUNCTION__); + return nil; +} + +CTFramesetterRef CTFramesetterCreateWithAttributedString(CFAttributedStringRef attrString) +{ + printf("STUB %s\n", __PRETTY_FUNCTION__); + return nil; +} + +CTFrameRef CTFramesetterCreateFrame(CTFramesetterRef framesetter, + CFRange stringRange, + CGPathRef path, + CFDictionaryRef frameAttributes) +{ + printf("STUB %s\n", __PRETTY_FUNCTION__); + return nil; +} + +CTTypesetterRef CTFramesetterGetTypesetter(CTFramesetterRef framesetter) +{ + printf("STUB %s\n", __PRETTY_FUNCTION__); + return nil; +} + +CGSize CTFramesetterSuggestFrameSizeWithConstraints(CTFramesetterRef framesetter, + CFRange stringRange, + CFDictionaryRef frameAttributes, + CGSize constraints, + CFRange *fitRange) +{ + printf("STUB %s\n", __PRETTY_FUNCTION__); + return CGSizeZero; +} diff --git a/CoreText/CTLine.m b/CoreText/CTLine.m new file mode 100644 index 00000000..25873ff7 --- /dev/null +++ b/CoreText/CTLine.m @@ -0,0 +1,93 @@ +#import + +CFTypeID CTLineGetTypeID(void) +{ + printf("STUB %s\n", __PRETTY_FUNCTION__); + return 0; +} + +CTLineRef CTLineCreateWithAttributedString(CFAttributedStringRef attrString) +{ + printf("STUB %s\n", __PRETTY_FUNCTION__); + return nil; +} + +CTLineRef CTLineCreateTruncatedLine(CTLineRef line, double width, + CTLineTruncationType truncationType, + CTLineRef truncationToken) +{ + printf("STUB %s\n", __PRETTY_FUNCTION__); + return nil; +} + +CTLineRef CTLineCreateJustifiedLine(CTLineRef line, CGFloat justificationFactor, double justificationWidth) +{ + printf("STUB %s\n", __PRETTY_FUNCTION__); + return nil; +} + +CFIndex CTLineGetGlyphCount(CTLineRef line) +{ + printf("STUB %s\n", __PRETTY_FUNCTION__); + return -1; +} + +CFArrayRef CTLineGetGlyphRuns(CTLineRef line) +{ + printf("STUB %s\n", __PRETTY_FUNCTION__); + return nil; +} + +CFRange CTLineGetStringRange(CTLineRef line) +{ + printf("STUB %s\n", __PRETTY_FUNCTION__); + return CFRangeMake(0, 0); +} + +double CTLineGetPenOffsetForFlush(CTLineRef line, CGFloat flushFactor, double flushWidth) +{ + printf("STUB %s\n", __PRETTY_FUNCTION__); + return -1.0; +} + +void CTLineDraw(CTLineRef line, CGContextRef context) +{ + printf("STUB %s\n", __PRETTY_FUNCTION__); +} + +double CTLineGetTypographicBounds(CTLineRef line, CGFloat *ascent, CGFloat *descent, CGFloat *leading) +{ + printf("STUB %s\n", __PRETTY_FUNCTION__); + return -1.0; +} + +CGRect CTLineGetBoundsWithOptions(CTLineRef line, CTLineBoundsOptions options) +{ + printf("STUB %s\n", __PRETTY_FUNCTION__); + return CGRectMake(0, 0, 0, 0); +} + +double CTLineGetTrailingWhitespaceWidth(CTLineRef line) +{ + printf("STUB %s\n", __PRETTY_FUNCTION__); + return -1.0; +} + +CGRect CTLineGetImageBounds(CTLineRef line, CGContextRef context) +{ + printf("STUB %s\n", __PRETTY_FUNCTION__); + return CGRectMake(0, 0, 0, 0); +} + +CFIndex CTLineGetStringIndexForPosition(CTLineRef line, CGPoint position) +{ + printf("STUB %s\n", __PRETTY_FUNCTION__); + return -1; +} + +CGFloat CTLineGetOffsetForStringIndex(CTLineRef line, CFIndex charIndex, CGFloat *secondaryOffset) +{ + printf("STUB %s\n", __PRETTY_FUNCTION__); + return -1.0f; +} + diff --git a/CoreText/CTRun.m b/CoreText/CTRun.m new file mode 100644 index 00000000..51b812e0 --- /dev/null +++ b/CoreText/CTRun.m @@ -0,0 +1,103 @@ +#import + +CFTypeID CTRunGetTypeID(void) +{ + printf("STUB %s\n", __PRETTY_FUNCTION__); + return 0; +} + +CFIndex CTRunGetGlyphCount(CTRunRef run) +{ + printf("STUB %s\n", __PRETTY_FUNCTION__); + return -1; +} + +CFDictionaryRef CTRunGetAttributes(CTRunRef run) +{ + printf("STUB %s\n", __PRETTY_FUNCTION__); + return nil; +} + +CTRunStatus CTRunGetStatus(CTRunRef run) +{ + printf("STUB %s\n", __PRETTY_FUNCTION__); + return 0; +} + +const CGGlyph * CTRunGetGlyphsPtr(CTRunRef run) +{ + printf("STUB %s\n", __PRETTY_FUNCTION__); + return nil; +} + +void CTRunGetGlyphs(CTRunRef run, CFRange range, CGGlyph *buffer) +{ + printf("STUB %s\n", __PRETTY_FUNCTION__); +} + +const CGPoint * CTRunGetPositionsPtr(CTRunRef run) +{ + printf("STUB %s\n", __PRETTY_FUNCTION__); + return nil; +} + +void CTRunGetPositions(CTRunRef run, CFRange range, CGPoint *buffer) +{ + printf("STUB %s\n", __PRETTY_FUNCTION__); +} + +const CGSize * CTRunGetAdvancesPtr(CTRunRef run) +{ + printf("STUB %s\n", __PRETTY_FUNCTION__); + return nil; +} + +void CTRunGetAdvances(CTRunRef run, CFRange range, CGSize *buffer) +{ + printf("STUB %s\n", __PRETTY_FUNCTION__); +} + +const CFIndex * CTRunGetStringIndicesPtr(CTRunRef run) +{ + printf("STUB %s\n", __PRETTY_FUNCTION__); + return nil; +} + +void CTRunGetStringIndices(CTRunRef run, CFRange range, CFIndex *buffer) +{ + printf("STUB %s\n", __PRETTY_FUNCTION__); +} + +CFRange CTRunGetStringRange(CTRunRef run) +{ + printf("STUB %s\n", __PRETTY_FUNCTION__); + return CFRangeMake(0, 0); +} + +double CTRunGetTypographicBounds(CTRunRef run, CFRange range, CGFloat *ascent, CGFloat *descent, CGFloat *leading) +{ + printf("STUB %s\n", __PRETTY_FUNCTION__); + return -1.0; +} + +CGRect CTRunGetImageBounds(CTRunRef run, CGContextRef context, CFRange range) +{ + printf("STUB %s\n", __PRETTY_FUNCTION__); + return CGRectMake(0, 0, 0, 0); +} + +CGAffineTransform CTRunGetTextMatrix(CTRunRef run) +{ + printf("STUB %s\n", __PRETTY_FUNCTION__); + return CGAffineTransformIdentity; +} + +void CTRunGetBaseAdvancesAndOrigins(CTRunRef runRef, CFRange range, CGSize *advancesBuffer, CGPoint *originsBuffer) +{ + printf("STUB %s\n", __PRETTY_FUNCTION__); +} + +void CTRunDraw(CTRunRef run, CGContextRef context, CFRange range) +{ + printf("STUB %s\n", __PRETTY_FUNCTION__); +} diff --git a/CoreText/CTStringATtributes.m b/CoreText/CTStringATtributes.m new file mode 100644 index 00000000..8c937145 --- /dev/null +++ b/CoreText/CTStringATtributes.m @@ -0,0 +1,4 @@ +#import + +const CFStringRef kCTLigatureAttributeName = "NSLigature"; +const CFStringRef kCTUnderlineStyleAttributeName = "NSUnderline"; diff --git a/CoreText/include/CoreText/CTFont.h b/CoreText/include/CoreText/CTFont.h index 63d62389..4fa5ca56 100644 --- a/CoreText/include/CoreText/CTFont.h +++ b/CoreText/include/CoreText/CTFont.h @@ -20,6 +20,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #import #import #import +#import #import typedef struct CF_BRIDGED_TYPE(id) KTFont *CTFontRef; @@ -91,4 +92,15 @@ CORETEXT_EXPORT CGPathRef CTFontCreatePathForGlyph(CTFontRef self, CORETEXT_EXPORT CFArrayRef CTFontCopyAvailableTables(CTFontRef font, CTFontTableOptions options); +CORETEXT_EXPORT CFTypeRef CTFontCopyAttribute(CTFontRef font, CFStringRef attribute ); +CORETEXT_EXPORT CGFontRef CTFontCopyGraphicsFont(CTFontRef font, CTFontDescriptorRef _Nullable *attributes); +CORETEXT_EXPORT CFStringRef CTFontCopyPostScriptName(CTFontRef font); +CORETEXT_EXPORT CTFontRef CTFontCreateCopyWithAttributes(CTFontRef font, CGFloat size, + const CGAffineTransform *matrix, + CTFontDescriptorRef attributes); +CORETEXT_EXPORT CTFontRef CTFontCreateWithName(CFStringRef name, CGFloat size, + const CGAffineTransform *matrix); + +CORETEXT_EXPORT CFStringRef CTFontCopyName(CTFontRef font, CFStringRef nameKey); + CF_IMPLICIT_BRIDGING_DISABLED diff --git a/CoreText/include/CoreText/CTFontCollection.h b/CoreText/include/CoreText/CTFontCollection.h new file mode 100644 index 00000000..38d8f4e4 --- /dev/null +++ b/CoreText/include/CoreText/CTFontCollection.h @@ -0,0 +1,8 @@ +#import +#import + +typedef struct __CTFontCollection* CTFontCollectionRef; + +CORETEXT_EXPORT CFArrayRef CTFontCollectionCreateMatchingFontDescriptors(CTFontCollectionRef collection); +CORETEXT_EXPORT CTFontCollectionRef CTFontCollectionCreateWithFontDescriptors(CFArrayRef queryDescriptors, CFDictionaryRef options); + diff --git a/CoreText/include/CoreText/CTFontDescriptor.h b/CoreText/include/CoreText/CTFontDescriptor.h new file mode 100644 index 00000000..9bd244ac --- /dev/null +++ b/CoreText/include/CoreText/CTFontDescriptor.h @@ -0,0 +1,10 @@ +#import +#import + +CF_IMPLICIT_BRIDGING_ENABLED + +typedef struct __CTFontDescriptor* CTFontDescriptorRef; + +CORETEXT_EXPORT CFTypeRef CTFontDescriptorCopyAttribute(CTFontDescriptorRef descriptor, CFStringRef attribute); + +CF_IMPLICIT_BRIDGING_DISABLED diff --git a/CoreText/include/CoreText/CTFontManager.h b/CoreText/include/CoreText/CTFontManager.h new file mode 100644 index 00000000..2b8a2397 --- /dev/null +++ b/CoreText/include/CoreText/CTFontManager.h @@ -0,0 +1,24 @@ +#import +#import + +CF_IMPLICIT_BRIDGING_ENABLED + +enum +{ + kCTFontManagerScopeNone = 0, + kCTFontManagerScopeProcess = 1, + kCTFontManagerScopePersistent = 2, + kCTFontManagerScopeSession = 3, + kCTFontManagerScopeUser = 2, +}; + +typedef uint32_t CTFontManagerScope; + +CORETEXT_EXPORT bool CTFontManagerRegisterGraphicsFont(CGFontRef font, CFErrorRef* error); +CORETEXT_EXPORT bool CTFontManagerUnregisterGraphicsFont(CGFontRef font, CFErrorRef *error); + +CORETEXT_EXPORT CFArrayRef CTFontManagerCopyAvailableFontFamilyNames(void); + +CORETEXT_EXPORT bool CTFontManagerRegisterFontsForURL(CFURLRef fontURL, CTFontManagerScope scope, CFErrorRef * error); + +CF_IMPLICIT_BRIDGING_DISABLED diff --git a/CoreText/include/CoreText/CTFrame.h b/CoreText/include/CoreText/CTFrame.h new file mode 100644 index 00000000..dbaf569a --- /dev/null +++ b/CoreText/include/CoreText/CTFrame.h @@ -0,0 +1,40 @@ +#import +#import +#import + +CF_IMPLICIT_BRIDGING_ENABLED + +typedef struct __CTFrame* CTFrameRef; + +CFTypeID CTFrameGetTypeID(void); + +typedef uint32_t CTFrameProgression; + +enum { + kCTFrameProgressionTopToBottom = 0, + kCTFrameProgressionRightToLeft = 1, + kCTFrameProgressionLeftToRight = 2 +}; + +typedef uint32_t CTFramePathFillRule; + +enum { + kCTFramePathFillEvenOdd = 0, + kCTFramePathFillWindingNumber = 1 +}; + +CORETEXT_EXPORT const CFStringRef kCTFrameProgressionAttributeName; +CORETEXT_EXPORT const CFStringRef kCTFramePathFillRuleAttributeName; +CORETEXT_EXPORT const CFStringRef kCTFramePathWidthAttributeName; +CORETEXT_EXPORT const CFStringRef kCTFrameClippingPathsAttributeName; +CORETEXT_EXPORT const CFStringRef kCTFramePathClippingPathAttributeName; + +CORETEXT_EXPORT CFRange CTFrameGetStringRange(CTFrameRef frame); +CORETEXT_EXPORT CFRange CTFrameGetVisibleStringRange(CTFrameRef frame); +CORETEXT_EXPORT CGPathRef CTFrameGetPath(CTFrameRef frame); +CORETEXT_EXPORT CFDictionaryRef CTFrameGetFrameAttributes(CTFrameRef frame); +CORETEXT_EXPORT CFArrayRef CTFrameGetLines(CTFrameRef frame); +CORETEXT_EXPORT void CTFrameGetLineOrigins(CTFrameRef frame, CFRange range, CGPoint *origins); +CORETEXT_EXPORT void CTFrameDraw(CTFrameRef frame, CGContextRef context); + +CF_IMPLICIT_BRIDGING_DISABLED diff --git a/CoreText/include/CoreText/CTFrameSetter.h b/CoreText/include/CoreText/CTFrameSetter.h new file mode 100644 index 00000000..61f42516 --- /dev/null +++ b/CoreText/include/CoreText/CTFrameSetter.h @@ -0,0 +1,25 @@ +#import +#import + +CF_IMPLICIT_BRIDGING_ENABLED + +typedef struct __CTFramesetter* CTFramesetterRef; + +CORETEXT_EXPORT CFTypeID CTFramesetterGetTypeID(void); +CORETEXT_EXPORT CTFramesetterRef CTFramesetterCreateWithTypesetter(CTTypesetterRef typesetter); +CORETEXT_EXPORT CTFramesetterRef CTFramesetterCreateWithAttributedString(CFAttributedStringRef attrString); + +CORETEXT_EXPORT CTFrameRef CTFramesetterCreateFrame(CTFramesetterRef framesetter, + CFRange stringRange, + CGPathRef path, + CFDictionaryRef frameAttributes); + +CORETEXT_EXPORT CTTypesetterRef CTFramesetterGetTypesetter(CTFramesetterRef framesetter); + +CORETEXT_EXPORT CGSize CTFramesetterSuggestFrameSizeWithConstraints(CTFramesetterRef framesetter, + CFRange stringRange, + CFDictionaryRef frameAttributes, + CGSize constraints, + CFRange *fitRange); + +CF_IMPLICIT_BRIDGING_DISABLED diff --git a/CoreText/include/CoreText/CTLine.h b/CoreText/include/CoreText/CTLine.h new file mode 100644 index 00000000..6f6e0013 --- /dev/null +++ b/CoreText/include/CoreText/CTLine.h @@ -0,0 +1,52 @@ +#import +#import + +CF_IMPLICIT_BRIDGING_ENABLED + +typedef struct __CTLine* CTLineRef; + +typedef CFOptionFlags CTLineBoundsOptions; + +enum { + kCTLineBoundsExcludeTypographicLeading = 1 << 0, + kCTLineBoundsExcludeTypographicShifts = 1 << 1, + kCTLineBoundsUseHangingPunctuation = 1 << 2, + kCTLineBoundsUseGlyphPathBounds = 1 << 3, + kCTLineBoundsUseOpticalBounds = 1 << 4, + kCTLineBoundsIncludeLanguageExtents = 1 << 5, +}; + +typedef uint32_t CTLineTruncationType; + +enum { + kCTLineTruncationStart = 0, + kCTLineTruncationEnd = 1, + kCTLineTruncationMiddle = 2 +}; + +CORETEXT_EXPORT CFTypeID CTLineGetTypeID(void); +CORETEXT_EXPORT CTLineRef CTLineCreateWithAttributedString(CFAttributedStringRef attrString); + +CORETEXT_EXPORT CTLineRef CTLineCreateTruncatedLine(CTLineRef line, double width, + CTLineTruncationType truncationType, + CTLineRef truncationToken); + +CORETEXT_EXPORT CTLineRef _Nullable CTLineCreateJustifiedLine(CTLineRef line, CGFloat justificationFactor, double justificationWidth); + +CORETEXT_EXPORT CFIndex CTLineGetGlyphCount(CTLineRef line); +CORETEXT_EXPORT CFArrayRef CTLineGetGlyphRuns(CTLineRef line); +CORETEXT_EXPORT CFRange CTLineGetStringRange(CTLineRef line); +CORETEXT_EXPORT double CTLineGetPenOffsetForFlush(CTLineRef line, CGFloat flushFactor, double flushWidth); + +CORETEXT_EXPORT void CTLineDraw(CTLineRef line, CGContextRef context); + +CORETEXT_EXPORT double CTLineGetTypographicBounds(CTLineRef line, CGFloat * ascent, CGFloat * descent, CGFloat * leading); + +CORETEXT_EXPORT CGRect CTLineGetBoundsWithOptions(CTLineRef line, CTLineBoundsOptions options); +CORETEXT_EXPORT double CTLineGetTrailingWhitespaceWidth(CTLineRef line); +CORETEXT_EXPORT CGRect CTLineGetImageBounds(CTLineRef line, CGContextRef context); + +CORETEXT_EXPORT CFIndex CTLineGetStringIndexForPosition(CTLineRef line, CGPoint position); +CORETEXT_EXPORT CGFloat CTLineGetOffsetForStringIndex(CTLineRef line, CFIndex charIndex, CGFloat *secondaryOffset); + +CF_IMPLICIT_BRIDGING_DISABLED diff --git a/CoreText/include/CoreText/CTRun.h b/CoreText/include/CoreText/CTRun.h new file mode 100644 index 00000000..9ddd3ce3 --- /dev/null +++ b/CoreText/include/CoreText/CTRun.h @@ -0,0 +1,48 @@ +#import +#import + +CF_IMPLICIT_BRIDGING_ENABLED + +typedef struct __CTRun* CTRunRef; + +typedef uint32_t CTRunStatus; + +enum { + kCTRunStatusNoStatus = 0, + kCTRunStatusRightToLeft = (1 << 0), + kCTRunStatusNonMonotonic = (1 << 1), + kCTRunStatusHasNonIdentityMatrix = (1 << 2) +}; + +CORETEXT_EXPORT CFTypeID CTRunGetTypeID(void); +CORETEXT_EXPORT CFIndex CTRunGetGlyphCount(CTRunRef run); +CORETEXT_EXPORT CFDictionaryRef CTRunGetAttributes(CTRunRef run); +CORETEXT_EXPORT CTRunStatus CTRunGetStatus(CTRunRef run); + +CORETEXT_EXPORT const CGGlyph * CTRunGetGlyphsPtr(CTRunRef run); +CORETEXT_EXPORT void CTRunGetGlyphs(CTRunRef run, CFRange range, CGGlyph *buffer); + +CORETEXT_EXPORT const CGPoint * CTRunGetPositionsPtr(CTRunRef run); +CORETEXT_EXPORT void CTRunGetPositions(CTRunRef run, CFRange range, CGPoint *buffer); + +CORETEXT_EXPORT const CGSize * CTRunGetAdvancesPtr(CTRunRef run); + +CORETEXT_EXPORT void CTRunGetAdvances(CTRunRef run, CFRange range, CGSize *buffer); + +CORETEXT_EXPORT const CFIndex * CTRunGetStringIndicesPtr(CTRunRef run); + +CORETEXT_EXPORT void CTRunGetStringIndices(CTRunRef run, CFRange range, CFIndex *buffer); + +CORETEXT_EXPORT CFRange CTRunGetStringRange(CTRunRef run); + +CORETEXT_EXPORT double CTRunGetTypographicBounds(CTRunRef run, CFRange range, CGFloat *ascent, CGFloat *descent, CGFloat *leading); + +CORETEXT_EXPORT CGRect CTRunGetImageBounds(CTRunRef run, CGContextRef context, CFRange range); + +CORETEXT_EXPORT CGAffineTransform CTRunGetTextMatrix(CTRunRef run); + +CORETEXT_EXPORT void CTRunGetBaseAdvancesAndOrigins(CTRunRef runRef, CFRange range, CGSize *advancesBuffer, CGPoint *originsBuffer); + +CORETEXT_EXPORT void CTRunDraw(CTRunRef run, CGContextRef context, CFRange range); + +CF_IMPLICIT_BRIDGING_DISABLED diff --git a/CoreText/include/CoreText/CTStringAttributes.h b/CoreText/include/CoreText/CTStringAttributes.h new file mode 100644 index 00000000..47f9ee1d --- /dev/null +++ b/CoreText/include/CoreText/CTStringAttributes.h @@ -0,0 +1,5 @@ +#import + +CORETEXT_EXPORT const CFStringRef kCTLigatureAttributeName; +CORETEXT_EXPORT const CFStringRef kCTUnderlineStyleAttributeName; + diff --git a/CoreText/include/CoreText/CTTypesetter.h b/CoreText/include/CoreText/CTTypesetter.h new file mode 100644 index 00000000..89f5afee --- /dev/null +++ b/CoreText/include/CoreText/CTTypesetter.h @@ -0,0 +1,5 @@ +CF_IMPLICIT_BRIDGING_ENABLED + +typedef struct __CTTypesetter* CTTypesetterRef; + +CF_IMPLICIT_BRIDGING_DISABLED diff --git a/CoreText/include/CoreText/CoreText.h b/CoreText/include/CoreText/CoreText.h index e62424f9..ecce7226 100644 --- a/CoreText/include/CoreText/CoreText.h +++ b/CoreText/include/CoreText/CoreText.h @@ -8,3 +8,5 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI #import #import +#import +#import diff --git a/CoreText/stubs.c b/CoreText/stubs.c index 62ba66df..82bd2808 100644 --- a/CoreText/stubs.c +++ b/CoreText/stubs.c @@ -9,28 +9,3 @@ void *CTFontDescriptorCreateWithAttributes(void) { printf("STUB %s\n", __PRETTY_FUNCTION__); return NULL; } - -void *CTFrameDraw(void) { - printf("STUB %s\n", __PRETTY_FUNCTION__); - return NULL; -} - -void *CTFrameGetLines(void) { - printf("STUB %s\n", __PRETTY_FUNCTION__); - return NULL; -} - -void *CTFramesetterCreateFrame(void) { - printf("STUB %s\n", __PRETTY_FUNCTION__); - return NULL; -} - -void *CTFramesetterCreateWithAttributedString(void) { - printf("STUB %s\n", __PRETTY_FUNCTION__); - return NULL; -} - -void *CTLineGetTypographicBounds(void) { - printf("STUB %s\n", __PRETTY_FUNCTION__); - return NULL; -}