From 2c4725b1b4d926c8b8f73e5f5ee693802db92522 Mon Sep 17 00:00:00 2001 From: Daniel Ferreira Date: Sun, 6 Aug 2017 07:05:36 +1000 Subject: [PATCH 01/13] CGContext: correctly export CGContextDrawShading() stub In CGContext.m we had CGContextDrawShading()'s definition repeated from the header; we did not, however, have an actual stub for this function, which caused linking errors with Opal clients. This turns this still unimplemented function into an actual stub. --- Source/OpalGraphics/CGContext.m | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Source/OpalGraphics/CGContext.m b/Source/OpalGraphics/CGContext.m index 7ae42ed..cfdb807 100644 --- a/Source/OpalGraphics/CGContext.m +++ b/Source/OpalGraphics/CGContext.m @@ -1526,8 +1526,11 @@ void CGContextDrawRadialGradient( void CGContextDrawShading( CGContextRef ctx, - CGShadingRef shading -); + CGShadingRef shading) +{ + // FIXME: unimplemented + return; +} void CGContextSetFont(CGContextRef ctx, CGFontRef font) { From dca7c1188b54076cbcc012f2d9558491a4ce9228 Mon Sep 17 00:00:00 2001 From: Daniel Ferreira Date: Sun, 6 Aug 2017 07:15:08 +1000 Subject: [PATCH 02/13] CGContext: properly implement ellipse-related functions Add an actual implementation for CGContextAddEllipseInRect() which makes use of CGPath APIs. Implement CGContextFillEllipseInRect() and CGContextStrokeEllipseInRect() as well. --- Source/OpalGraphics/CGContext.m | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/Source/OpalGraphics/CGContext.m b/Source/OpalGraphics/CGContext.m index cfdb807..65af125 100644 --- a/Source/OpalGraphics/CGContext.m +++ b/Source/OpalGraphics/CGContext.m @@ -772,7 +772,11 @@ void CGContextAddPath(CGContextRef ctx, CGPathRef path) void CGContextAddEllipseInRect(CGContextRef ctx, CGRect rect) { OPLOGCALL("ctx /*%p*/, CGRectMake(%g, %g, %g, %g)", ctx, rect.origin.x, rect.origin.y, - rect.size.width, rect.size.height) + rect.size.width, rect.size.height); + CGPathRef path = CGPathCreateMutable(); + CGPathAddEllipseInRect(path, NULL, rect); + CGContextAddPath(ctx, path); + CGPathRelease(path); OPRESTORELOGGING() } @@ -953,6 +957,20 @@ void CGContextClearRect(CGContextRef ctx, CGRect rect) OPRESTORELOGGING() } +void CGContextFillEllipseInRect(CGContextRef ctx, CGRect rect) +{ + CGContextBeginPath(ctx); + CGContextAddEllipseInRect(ctx, rect); + CGContextFillPath(ctx); +} + +void CGContextStrokeEllipseInRect(CGContextRef ctx, CGRect rect) +{ + CGContextBeginPath(ctx); + CGContextAddEllipseInRect(ctx, rect); + CGContextStrokePath(ctx); +} + void CGContextStrokeLineSegments( CGContextRef ctx, const CGPoint points[], From e8271a98a99e234698fa8975563d492822829780 Mon Sep 17 00:00:00 2001 From: Daniel Ferreira Date: Sun, 6 Aug 2017 07:23:51 +1000 Subject: [PATCH 03/13] CGContext: define some private getter functions CoreGraphics posesses the private getter counterparts for some setter functions, such as antialiasing and font smoothing. This implements those getters. --- Headers/CoreGraphics/CGContext.h | 12 +++++++++--- Source/OpalGraphics/CGContext.m | 10 ++++++++++ 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/Headers/CoreGraphics/CGContext.h b/Headers/CoreGraphics/CGContext.h index 131445e..f9b8e2c 100644 --- a/Headers/CoreGraphics/CGContext.h +++ b/Headers/CoreGraphics/CGContext.h @@ -562,6 +562,15 @@ CGRect CGContextConvertRectToDeviceSpace(CGContextRef ctx, CGRect rect); CGRect CGContextConvertRectToUserSpace(CGContextRef ctx, CGRect rect); +bool CGContextPathContainsPoint(CGContextRef c, + CGPoint point, CGPathDrawingMode mode); + +/* CoreGraphics Private APIs */ + +bool CGContextGetShouldSmoothFonts(CGContextRef ctx); + +bool CGContextGetShouldAntialias(CGContextRef ctx); + /* Opal Extensions */ // FIXME: Move extensions to a separate header? @@ -583,9 +592,6 @@ OPGStateRef OPContextCopyGState(CGContextRef ctx); void OPContextSetGState(CGContextRef ctx, OPGStateRef gstate); -bool CGContextPathContainsPoint(CGContextRef c, - CGPoint point, CGPathDrawingMode mode); - #ifdef __cplusplus } #endif diff --git a/Source/OpalGraphics/CGContext.m b/Source/OpalGraphics/CGContext.m index 65af125..aee5d5d 100644 --- a/Source/OpalGraphics/CGContext.m +++ b/Source/OpalGraphics/CGContext.m @@ -377,6 +377,11 @@ void CGContextSetShouldAntialias(CGContextRef ctx, int shouldAntialias) OPRESTORELOGGING() } +bool CGContextGetShouldAntialias(CGContextRef ctx) +{ + return cairo_get_antialias(ctx->ct) != CAIRO_ANTIALIAS_NONE; +} + void CGContextSetLineWidth(CGContextRef ctx, CGFloat width) { OPLOGCALL("ctx /*%p*/, %g", ctx, width) @@ -480,6 +485,11 @@ void CGContextSetShouldSmoothFonts(CGContextRef ctx, int shouldSmoothFonts) OPRESTORELOGGING() } +bool CGContextGetShouldSmoothFonts(CGContextRef ctx) +{ + return false; +} + void CGContextSetAllowsFontSmoothing(CGContextRef ctx, bool allowsFontSmoothing) { OPLOGCALL("ctx /*%p*/, %s", ctx, allowsFontSmoothing ? "true" : "false") From 879e4f36c6a67d04a6fe86d88015afbbc457fcf5 Mon Sep 17 00:00:00 2001 From: Daniel Ferreira Date: Sun, 6 Aug 2017 07:31:12 +1000 Subject: [PATCH 04/13] CGContext: define CGContextGetType() Define the private CoreGraphics CGContextGetType() API, which determines the type of a CGContextRef (a bitmap context, PostScript context, PDF context etc.). --- Headers/CoreGraphics/CGContext.h | 18 ++++++++++++++++++ Source/OpalGraphics/CGContext.m | 7 +++++++ 2 files changed, 25 insertions(+) diff --git a/Headers/CoreGraphics/CGContext.h b/Headers/CoreGraphics/CGContext.h index f9b8e2c..da2e8bf 100644 --- a/Headers/CoreGraphics/CGContext.h +++ b/Headers/CoreGraphics/CGContext.h @@ -138,6 +138,22 @@ enum { }; typedef int CGTextEncoding; +// NOTE: This `typedef enum` in opposition to defining enum constants and +// their types as integers is here to maintain compatibility with the original +// CoreGraphics API, although this is *NOT* an ideal way to define these types. +typedef enum { + kCGContextTypeUnknown, + kCGContextTypePDF, + kCGContextTypePostScript, + kCGContextTypeWindow, + kCGContextTypeBitmap, + kCGContextTypeGL, + kCGContextTypeDisplayList, + kCGContextTypeKSeparation, + kCGContextTypeIOSurface, + kCGContextTypeCount +} CGContextType; + /* Functions */ /* Managing Graphics Contexts */ @@ -571,6 +587,8 @@ bool CGContextGetShouldSmoothFonts(CGContextRef ctx); bool CGContextGetShouldAntialias(CGContextRef ctx); +CGContextType CGContextGetType(CGContextRef ctx); + /* Opal Extensions */ // FIXME: Move extensions to a separate header? diff --git a/Source/OpalGraphics/CGContext.m b/Source/OpalGraphics/CGContext.m index aee5d5d..e7fc2bf 100644 --- a/Source/OpalGraphics/CGContext.m +++ b/Source/OpalGraphics/CGContext.m @@ -1987,6 +1987,13 @@ CGRect CGContextConvertRectToUserSpace(CGContextRef ctx, CGRect rect) CGAffineTransformInvert(CGContextGetUserSpaceToDeviceSpaceTransform(ctx))); } +CGContextType CGContextGetType(CGContextRef ctx) +{ + // NOTE: This is not wrong, since Opal does not currently seem to support + // any other context type. + return kCGContextTypeBitmap; +} + void OpalContextSetScaleFactor(CGContextRef ctx, CGFloat scale) { if (scale == 0) From ffa5d7f65435d8474a1c1ac0938d0a6aa2aa69ee Mon Sep 17 00:00:00 2001 From: Daniel Ferreira Date: Sun, 6 Aug 2017 07:41:38 +1000 Subject: [PATCH 05/13] CGContext: implement CGContextSetCTM() Implement the private function CGContextSetCTM(), which allows clients to set the current transformation matrix of a context. --- Headers/CoreGraphics/CGContext.h | 2 ++ Source/OpalGraphics/CGContext.m | 10 ++++++++++ 2 files changed, 12 insertions(+) diff --git a/Headers/CoreGraphics/CGContext.h b/Headers/CoreGraphics/CGContext.h index da2e8bf..5fd2934 100644 --- a/Headers/CoreGraphics/CGContext.h +++ b/Headers/CoreGraphics/CGContext.h @@ -589,6 +589,8 @@ bool CGContextGetShouldAntialias(CGContextRef ctx); CGContextType CGContextGetType(CGContextRef ctx); +void CGContextSetCTM(CGContextRef ctx, CGAffineTransform m); + /* Opal Extensions */ // FIXME: Move extensions to a separate header? diff --git a/Source/OpalGraphics/CGContext.m b/Source/OpalGraphics/CGContext.m index e7fc2bf..7e795ce 100644 --- a/Source/OpalGraphics/CGContext.m +++ b/Source/OpalGraphics/CGContext.m @@ -290,6 +290,16 @@ CGAffineTransform CGContextGetCTM(CGContextRef ctx) return CGAffineTransformMake(result.xx, result.yx, result.xy, result.yy, result.x0, result.y0); } +void CGContextSetCTM(CGContextRef ctx, CGAffineTransform m) +{ + // FIXME: it looks like we do not need to do anything related to the + // flip transformation here like in GetCTM() above, but we may be wrong + // here. + cairo_matrix_t cairoMatrix; + cairo_matrix_init(&cairoMatrix, m.a, m.b, m.c, m.d, m.tx, m.ty); + cairo_set_matrix(ctx->ct, &cairoMatrix); +} + void OPContextSetCairoDeviceOffset(CGContextRef ctx, CGFloat x, CGFloat y) { OPLOGCALL("ctx /*%p*/, %g, %g", ctx, x, y) From 8454a24bc4cd82190e277bb1139eb3b79614b3be Mon Sep 17 00:00:00 2001 From: Daniel Ferreira Date: Thu, 10 Aug 2017 13:37:38 +1000 Subject: [PATCH 06/13] CGContext: create CGContext private function stubs Create stubs for yet unimplemented private CoreGraphics functions, for increased compatibility with CG. --- Headers/CoreGraphics/CGContext.h | 12 +++++++++++ Source/OpalGraphics/CGContext.m | 34 ++++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+) diff --git a/Headers/CoreGraphics/CGContext.h b/Headers/CoreGraphics/CGContext.h index 5fd2934..b30b382 100644 --- a/Headers/CoreGraphics/CGContext.h +++ b/Headers/CoreGraphics/CGContext.h @@ -591,6 +591,18 @@ CGContextType CGContextGetType(CGContextRef ctx); void CGContextSetCTM(CGContextRef ctx, CGAffineTransform m); +CGAffineTransform CGContextGetBaseCTM(CGContextRef); + +void CGContextSetBaseCTM(CGContextRef, CGAffineTransform); + +CGColorSpaceRef CGContextCopyDeviceColorSpace(CGContextRef); + +void CGContextSetShouldAntialiasFonts(CGContextRef, bool shouldAntialiasFonts); + +bool CGDisplayUsesInvertedPolarity(void); + +bool CGDisplayUsesForceToGray(void); + /* Opal Extensions */ // FIXME: Move extensions to a separate header? diff --git a/Source/OpalGraphics/CGContext.m b/Source/OpalGraphics/CGContext.m index 7e795ce..97955f5 100644 --- a/Source/OpalGraphics/CGContext.m +++ b/Source/OpalGraphics/CGContext.m @@ -2004,6 +2004,40 @@ CGContextType CGContextGetType(CGContextRef ctx) return kCGContextTypeBitmap; } +CGAffineTransform CGContextGetBaseCTM(CGContextRef ctx) +{ + // FIXME: unimplemented + return (CGAffineTransform){0, 0, 0, 0, 0, 0}; +} + +void CGContextSetBaseCTM(CGContextRef ctx, CGAffineTransform m) +{ + // FIXME: unimplemented +} + +CGColorSpaceRef CGContextCopyDeviceColorSpace(CGContextRef ctx) +{ + // FIXME: unimplemented + return NULL; +} + +void CGContextSetShouldAntialiasFonts(CGContextRef ctx, bool shouldAntialiasFonts) +{ + // FIXME: unimplemented +} + +bool CGDisplayUsesInvertedPolarity(void) +{ + // FIXME: unimplemented + return false; +} + +bool CGDisplayUsesForceToGray(void) +{ + // FIXME: unimplemented + return false; +} + void OpalContextSetScaleFactor(CGContextRef ctx, CGFloat scale) { if (scale == 0) From f8677b0d3b57890870094c65518e7792f947844e Mon Sep 17 00:00:00 2001 From: Daniel Ferreira Date: Thu, 10 Aug 2017 13:39:50 +1000 Subject: [PATCH 07/13] CGFont: implement stub for CGFontGetGlyphAdvancesForStyle Create a stub for the private function CGFontGetGlyphAdvancesForStyle for increased compatibility. --- Headers/CoreGraphics/CGFont.h | 11 +++++++++++ Source/OpalGraphics/CGFont.m | 12 ++++++++++++ 2 files changed, 23 insertions(+) diff --git a/Headers/CoreGraphics/CGFont.h b/Headers/CoreGraphics/CGFont.h index 7824a58..7677bbb 100644 --- a/Headers/CoreGraphics/CGFont.h +++ b/Headers/CoreGraphics/CGFont.h @@ -35,6 +35,7 @@ typedef struct CGFont* CGFontRef; #endif #include +#include #include #include @@ -154,6 +155,16 @@ CGFontRef CGFontRetain(CGFontRef font); void CGFontRelease(CGFontRef font); +/* Private Functions */ + +bool CGFontGetGlyphAdvancesForStyle( + CGFontRef, + const CGAffineTransform*, + int, + const CGGlyph[], + size_t count, + CGSize advances[]); + /* Extensions */ #ifndef __MINGW__ // FIXME: proper check for fontconfig diff --git a/Source/OpalGraphics/CGFont.m b/Source/OpalGraphics/CGFont.m index ac67927..59d6aa7 100644 --- a/Source/OpalGraphics/CGFont.m +++ b/Source/OpalGraphics/CGFont.m @@ -351,3 +351,15 @@ CGGlyph OPFontGetGlyphWithCharacter(CGFontRef font, unichar character) { return [font glyphWithCharacter: character]; } + +bool CGFontGetGlyphAdvancesForStyle( + CGFontRef font, + const CGAffineTransform *m, + int renderingStyle, + const CGGlyph glyphs[], + size_t count, + CGSize advances[]) +{ + // FIXME: unimplemented + return false; +} From 627b030edac811675f9a2f653b9949325a97eca4 Mon Sep 17 00:00:00 2001 From: Daniel Ferreira Date: Thu, 10 Aug 2017 13:47:36 +1000 Subject: [PATCH 08/13] CGImageSource: add private stubs Add private constant and function stubs for CGImageSource for increased compatibility. --- Headers/CoreGraphics/CGImageSource.h | 9 +++++++++ Source/OpalGraphics/CGImageSource.m | 18 ++++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/Headers/CoreGraphics/CGImageSource.h b/Headers/CoreGraphics/CGImageSource.h index 9a4ad24..3937a1e 100644 --- a/Headers/CoreGraphics/CGImageSource.h +++ b/Headers/CoreGraphics/CGImageSource.h @@ -50,6 +50,11 @@ const extern CFStringRef kCGImageSourceCreateThumbnailFromImageAlways; const extern CFStringRef kCGImageSourceThumbnailMaxPixelSize; const extern CFStringRef kCGImageSourceCreateThumbnailWithTransform; +const extern CFStringRef kCGImageSourceShouldPreferRGB32; +const extern CFStringRef kCGImageSourceSkipMetadata; +const extern CFStringRef kCGImageSourceSubsampleFactor; +const extern CFStringRef kCGImageSourceShouldCacheImmediately; + /* Data Types */ #ifdef INTERNAL_BUILD_OBJC @@ -139,6 +144,10 @@ void CGImageSourceUpdateDataProvider( CFTypeID CGImageSourceGetTypeID(); +/* Private APIs */ + +CFStringRef CGImageSourceGetTypeWithData(CFDataRef, CFStringRef, bool*); + #ifdef __cplusplus } #endif diff --git a/Source/OpalGraphics/CGImageSource.m b/Source/OpalGraphics/CGImageSource.m index 10849ee..839ceff 100644 --- a/Source/OpalGraphics/CGImageSource.m +++ b/Source/OpalGraphics/CGImageSource.m @@ -38,6 +38,15 @@ const CFStringRef kCGImageSourceThumbnailMaxPixelSize = @"kCGImageSourceThumbnailMaxPixelSize"; const CFStringRef kCGImageSourceCreateThumbnailWithTransform = @"kCGImageSourceCreateThumbnailWithTransform"; +const CFStringRef kCGImageSourceShouldPreferRGB32 = + @"kCGImageSourceShouldPreferRGB32"; +const CFStringRef kCGImageSourceSkipMetadata = + @"kCGImageSourceSkipMetadata"; +const CFStringRef kCGImageSourceSubsampleFactor = + @"kCGImageSourceSubsampleFactor"; +const CFStringRef kCGImageSourceShouldCacheImmediately = + @"kCGImageSourceShouldCacheImmediately"; + static NSMutableArray *sourceClasses = nil; @@ -354,6 +363,15 @@ CFStringRef CGImageSourceGetType(CGImageSourceRef source) return [source type]; } +CFStringRef CGImageSourceGetTypeWithData( + CFDataRef data, + CFStringRef string, + bool* result) +{ + // FIXME: unimplemented + return NULL; +} + void CGImageSourceUpdateData( CGImageSourceRef source, CFDataRef data, From 477c1a4c6924f51169b1edac4688ccb98096fae0 Mon Sep 17 00:00:00 2001 From: Daniel Ferreira Date: Thu, 10 Aug 2017 13:55:24 +1000 Subject: [PATCH 09/13] CTFont: add private function stubs Add stubs for some private functions and constants in CTFont for compatibility purposes. --- Headers/CoreText/CTFont.h | 31 +++++++++++++++++++++++++ Source/OpalText/CTFont.m | 49 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 80 insertions(+) diff --git a/Headers/CoreText/CTFont.h b/Headers/CoreText/CTFont.h index 9725176..8d8f837 100644 --- a/Headers/CoreText/CTFont.h +++ b/Headers/CoreText/CTFont.h @@ -486,6 +486,37 @@ CFTypeID CTFontGetTypeID(); CTFontDescriptorRef CTFontManagerCreateFontDescriptorFromData( CFDataRef data); +/* Private APIs */ + +bool CTFontGetVerticalGlyphsForCharacters( + CTFontRef, + const UniChar characters[], + CGGlyph glyphs[], + CFIndex count); + +bool CTFontTransformGlyphs( + CTFontRef, + CGGlyph glyphs[], + CGSize advances[], + CFIndex count, + int); + +CTFontRef CTFontCreateForCSS( + CFStringRef name, + uint16_t weight, + CTFontSymbolicTraits, + CGFloat size); + +CTFontRef CTFontCreateForCharactersWithLanguage( + CTFontRef currentFont, + const UTF16Char *characters, + CFIndex length, + CFStringRef language, CFIndex *coveredLength); + +extern const CFStringRef kCTFontReferenceURLAttribute; +extern const CFStringRef kCTFontOpticalSizeAttribute; +extern const CFStringRef kCTFontPostScriptNameAttribute; + #ifdef __cplusplus } #endif diff --git a/Source/OpalText/CTFont.m b/Source/OpalText/CTFont.m index 9905d82..e718c73 100644 --- a/Source/OpalText/CTFont.m +++ b/Source/OpalText/CTFont.m @@ -66,6 +66,13 @@ const CFStringRef kCTFontOpenTypeFeatureTag = (CFStringRef)@"kCTFontOpenTypeFeatureTag"; const CFStringRef kCTFontOpenTypeFeatureValue = (CFStringRef)@"kCTFontOpenTypeFeatureValue"; +const CFStringRef kCTFontReferenceURLAttribute = + @"kCTFontReferenceURLAttribute"; +const CFStringRef kCTFontOpticalSizeAttribute = + @"kCTFontOpticalSizeAttribute"; +const CFStringRef kCTFontPostScriptNameAttribute = + @"kCTFontPostScriptNameAttribute"; + /* Classes */ @@ -552,3 +559,45 @@ CTFontDescriptorRef CTFontManagerCreateFontDescriptorFromData( // FIXME: unimplemented return NULL; } + +bool CTFontGetVerticalGlyphsForCharacters( + CTFontRef font, + const UniChar characters[], + CGGlyph glyphs[], + CFIndex count) +{ + // FIXME: unimplemented + return false; +} + +bool CTFontTransformGlyphs( + CTFontRef font, + CGGlyph glyphs[], + CGSize advances[], + CFIndex count, + int options) +{ + // FIXME: unimplemented + return false; +} + +CTFontRef CTFontCreateForCSS( + CFStringRef name, + uint16_t weight, + CTFontSymbolicTraits traits, + CGFloat size) +{ + // FIXME: unimplemented + return NULL; +} + +CTFontRef CTFontCreateForCharactersWithLanguage( + CTFontRef currentFont, + const UTF16Char *characters, + CFIndex length, + CFStringRef language, + CFIndex *coveredLength) +{ + // FIXME: unimplemented + return NULL; +} From dc4592fcaea4b1cda7731c345a3992b3620912c7 Mon Sep 17 00:00:00 2001 From: Daniel Ferreira Date: Thu, 10 Aug 2017 13:56:38 +1000 Subject: [PATCH 10/13] CTFontDescriptor: add stub for CTFontDescriptorIsSystemUIFont() Create a stub for the CTFontDescriptorIsSystemUIFont() private function for increased compatibility. --- Headers/CoreText/CTFontDescriptor.h | 2 ++ Source/OpalText/CTFontDescriptor.m | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/Headers/CoreText/CTFontDescriptor.h b/Headers/CoreText/CTFontDescriptor.h index 95d65f3..859d161 100644 --- a/Headers/CoreText/CTFontDescriptor.h +++ b/Headers/CoreText/CTFontDescriptor.h @@ -152,6 +152,8 @@ CFTypeRef CTFontDescriptorCopyLocalizedAttribute( CFTypeID CTFontDescriptorGetTypeID(); +bool CTFontDescriptorIsSystemUIFont(CTFontDescriptorRef); + #ifdef __cplusplus } #endif diff --git a/Source/OpalText/CTFontDescriptor.m b/Source/OpalText/CTFontDescriptor.m index 983265c..55b23a2 100644 --- a/Source/OpalText/CTFontDescriptor.m +++ b/Source/OpalText/CTFontDescriptor.m @@ -177,3 +177,8 @@ CFTypeID CTFontDescriptorGetTypeID() return (CFTypeID)[OPFontDescriptor class]; } +bool CTFontDescriptorIsSystemUIFont(CTFontDescriptorRef desc) +{ + // FIXME: unimplemented + return false; +} From dac2a33409e84927c183dff259d84db79cd0ee6b Mon Sep 17 00:00:00 2001 From: Daniel Ferreira Date: Thu, 10 Aug 2017 13:58:45 +1000 Subject: [PATCH 11/13] CTLine: add stub for CTLineCreateWithUniCharProvider() Add a stub for the CTLineCreateWithUniCharProvider() private function for increased compatibility purposes. --- Headers/CoreText/CTLine.h | 14 ++++++++++++++ Source/OpalText/CTLine.m | 8 ++++++++ 2 files changed, 22 insertions(+) diff --git a/Headers/CoreText/CTLine.h b/Headers/CoreText/CTLine.h index ea9c6dc..51f4b65 100644 --- a/Headers/CoreText/CTLine.h +++ b/Headers/CoreText/CTLine.h @@ -125,6 +125,20 @@ CGRect CTLineGetBoundsWithOptions( CTLineRef line, CTLineBoundsOptions options); +/* Private APIs */ + +typedef const UniChar* (*CTUniCharProviderCallback)( + CFIndex stringIndex, + CFIndex* charCount, + CFDictionaryRef* attributes, + void* refCon); +typedef void (*CTUniCharDisposeCallback)(const UniChar* chars, void* refCon); + +CTLineRef CTLineCreateWithUniCharProvider( + CTUniCharProviderCallback provide, + CTUniCharDisposeCallback dispose, + void* refCon); + #ifdef __cplusplus } #endif diff --git a/Source/OpalText/CTLine.m b/Source/OpalText/CTLine.m index 0e8b051..7c9e6c9 100644 --- a/Source/OpalText/CTLine.m +++ b/Source/OpalText/CTLine.m @@ -191,3 +191,11 @@ CGRect CTLineGetBoundsWithOptions( { return CGRectZero; } + +CTLineRef CTLineCreateWithUniCharProvider( + CTUniCharProviderCallback provide, + CTUniCharDisposeCallback dispose, + void* refCon) +{ + return NULL; +} From 8faeac45415faf04a4fd8279e1fb80be145d20ee Mon Sep 17 00:00:00 2001 From: Daniel Ferreira Date: Thu, 10 Aug 2017 14:00:32 +1000 Subject: [PATCH 12/13] CTRun: add private function stubs Add stubs for private functions in CTRun for increased compatibility. --- Headers/CoreText/CTRun.h | 10 ++++++++++ Source/OpalText/CTRun.m | 14 ++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/Headers/CoreText/CTRun.h b/Headers/CoreText/CTRun.h index 27cf886..647e530 100644 --- a/Headers/CoreText/CTRun.h +++ b/Headers/CoreText/CTRun.h @@ -119,6 +119,16 @@ void CTRunDraw( CFTypeID CTRunGetTypeID(); +/* Private APIs */ + +CGSize CTRunGetInitialAdvance(CTRunRef run); + +void CTRunGetBaseAdvancesAndOrigins( + CTRunRef, + CFRange, + CGSize baseAdvances[], + CGPoint origins[]); + #ifdef __cplusplus } #endif diff --git a/Source/OpalText/CTRun.m b/Source/OpalText/CTRun.m index 2f30170..67624d5 100644 --- a/Source/OpalText/CTRun.m +++ b/Source/OpalText/CTRun.m @@ -223,3 +223,17 @@ CFTypeID CTRunGetTypeID() return (CFTypeID)[CTRun class]; } +CGSize CTRunGetInitialAdvance(CTRunRef run) +{ + // FIXME: unimplemented + return CGSizeZero; +} + +void CTRunGetBaseAdvancesAndOrigins( + CTRunRef run, + CFRange range, + CGSize baseAdvances[], + CGPoint origins[]) +{ + // FIXME: unimplemented +} From 0593b06b4c1367b023034b7e73ba93ea548aef68 Mon Sep 17 00:00:00 2001 From: Daniel Ferreira Date: Thu, 10 Aug 2017 14:02:25 +1000 Subject: [PATCH 13/13] CTTypesetter: add stub for CTTypesetterCreateWithUniCharProviderAndOptions() Add stub for CTTypesetterCreateWithUniCharProviderAndOptions(), a private function, for increased compatibility. --- Headers/CoreText/CTTypesetter.h | 6 ++++++ Source/OpalText/CTTypesetter.m | 9 +++++++++ 2 files changed, 15 insertions(+) diff --git a/Headers/CoreText/CTTypesetter.h b/Headers/CoreText/CTTypesetter.h index 72044a0..6aec39b 100644 --- a/Headers/CoreText/CTTypesetter.h +++ b/Headers/CoreText/CTTypesetter.h @@ -74,6 +74,12 @@ CFIndex CTTypesetterSuggestLineBreak( CFTypeID CTTypesetterGetTypeID(); +CTTypesetterRef CTTypesetterCreateWithUniCharProviderAndOptions( + CTUniCharProviderCallback provide, + CTUniCharDisposeCallback dispose, + void* refCon, + CFDictionaryRef options); + #ifdef __cplusplus } #endif diff --git a/Source/OpalText/CTTypesetter.m b/Source/OpalText/CTTypesetter.m index eb9d047..fa39d10 100644 --- a/Source/OpalText/CTTypesetter.m +++ b/Source/OpalText/CTTypesetter.m @@ -143,3 +143,12 @@ CFTypeID CTTypesetterGetTypeID() return (CFTypeID)[CTTypesetter class]; } +CTTypesetterRef CTTypesetterCreateWithUniCharProviderAndOptions( + CTUniCharProviderCallback provide, + CTUniCharDisposeCallback dispose, + void* refCon, + CFDictionaryRef options) +{ + // FIXME: unimplemented + return NULL; +}