mirror of
https://github.com/darlinghq/darling-cocotron.git
synced 2024-11-23 12:09:51 +00:00
Move the *_FT classes out of AppKit
This effectively removes the last bits of Linux.subproj This means we can create an O2Context_builtin_FT as a default bitmap context type. This way, font rendering works when Onyx2D is used directly.
This commit is contained in:
parent
69f1ddab15
commit
1e29c3f77d
@ -55,7 +55,6 @@ include_directories(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/NSToolbar.subproj
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/NSDrawer.subproj
|
||||
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/Linux.subproj
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/X11.backend
|
||||
|
||||
${X11_INCLUDE_DIRS}
|
||||
@ -300,9 +299,6 @@ set(AppKit_sources
|
||||
NSInterfacePart/NSGraphicsStyle.m
|
||||
NSInterfacePart/NSInterfacePart.m
|
||||
|
||||
Linux.subproj/KTFont_FT.m
|
||||
Linux.subproj/O2Context_builtin_FT.m
|
||||
|
||||
NSImageView.m
|
||||
NSActionCell.m
|
||||
NSAttributedString.m
|
||||
|
@ -1 +0,0 @@
|
||||
Linux.subproj/KTFont_FT.h
|
@ -20,7 +20,6 @@
|
||||
|
||||
#import <AppKit/NSColor.h>
|
||||
#import <AppKit/NSImage.h>
|
||||
#import <AppKit/KTFont_FT.h>
|
||||
#import <AppKit/NSRaise.h>
|
||||
#import <AppKit/NSFontManager.h>
|
||||
#import <AppKit/NSFontTypeface.h>
|
||||
|
@ -1 +0,0 @@
|
||||
../../../CoreText/include/CoreText/KTFont.h
|
@ -10,13 +10,17 @@ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} \
|
||||
-mmacosx-version-min=10.10"
|
||||
)
|
||||
|
||||
find_package(Freetype REQUIRED)
|
||||
|
||||
include_directories(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}
|
||||
${FREETYPE_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
set(CoreText_sources
|
||||
CTFont.m
|
||||
KTFont.m
|
||||
KTFont_FT.m
|
||||
)
|
||||
|
||||
set_source_files_properties(${CoreText_sources} LANGUAGE C)
|
||||
@ -36,4 +40,7 @@ add_framework(CoreText
|
||||
CoreFoundation
|
||||
Foundation
|
||||
CoreGraphics
|
||||
Onyx2D
|
||||
# native
|
||||
FreeType
|
||||
)
|
||||
|
@ -6,11 +6,8 @@
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
|
||||
#import "KTFont_FT.h"
|
||||
#import <AppKit/KTFont.h>
|
||||
#import <AppKit/NSRaise.h>
|
||||
#import <CoreText/KTFont_FT.h>
|
||||
#import <Onyx2D/O2Font_freetype.h>
|
||||
#import <AppKit/NSFontTypeface.h>
|
||||
|
||||
@implementation KTFont(KTFont_FT)
|
||||
+(id)allocWithZone:(NSZone*)zone
|
@ -6,7 +6,7 @@
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
|
||||
#import <AppKit/KTFont.h>
|
||||
#import <CoreText/KTFont.h>
|
||||
|
||||
#ifdef DARLING
|
||||
#define __linux__
|
@ -64,6 +64,7 @@ set(Onyx2D_sources
|
||||
O2ColorSpace.m
|
||||
O2ColorSpace+PDF.m
|
||||
O2Context_builtin.m
|
||||
O2Context_builtin_FT.m
|
||||
O2Context_distill.m
|
||||
O2Context.m
|
||||
O2DataConsumer.m
|
||||
|
@ -27,45 +27,20 @@
|
||||
#import <Onyx2D/O2Surface.h>
|
||||
#import <Onyx2D/O2Exceptions.h>
|
||||
#import <Onyx2D/O2GraphicsState.h>
|
||||
#import "VGPath.h"
|
||||
#import <Onyx2D/VGPath.h>
|
||||
#import <Onyx2D/O2Paint_image.h>
|
||||
#import <Onyx2D/O2Paint_color.h>
|
||||
#import <Onyx2D/O2Paint_axialGradient.h>
|
||||
#import <Onyx2D/O2Paint_radialGradient.h>
|
||||
#import <Onyx2D/O2Paint_pattern.h>
|
||||
#import "O2ClipState.h"
|
||||
#import "O2ClipPhase.h"
|
||||
#import <Onyx2D/O2ClipState.h>
|
||||
#import <Onyx2D/O2ClipPhase.h>
|
||||
#import <Onyx2D/O2Shading.h>
|
||||
|
||||
#define MAX_SAMPLES COVERAGE_MULTIPLIER
|
||||
|
||||
void O2DContextClipAndFillEdges(O2Context_builtin *self,int fillRuleMask);
|
||||
|
||||
@implementation O2Context (O2BitmapContext)
|
||||
|
||||
+ (O2Context *) createWithBytes: (void *) bytes
|
||||
width: (size_t) width
|
||||
height: (size_t) height
|
||||
bitsPerComponent: (size_t) bitsPerComponent
|
||||
bytesPerRow: (size_t) bytesPerRow
|
||||
colorSpace: (O2ColorSpaceRef) colorSpace
|
||||
bitmapInfo: (O2BitmapInfo) bitmapInfo
|
||||
releaseCallback: (O2BitmapContextReleaseDataCallback) releaseCallback
|
||||
releaseInfo: (void *) releaseInfo {
|
||||
|
||||
return [[O2Context_builtin alloc] initWithBytes: bytes
|
||||
width: width
|
||||
height: height
|
||||
bitsPerComponent: bitsPerComponent
|
||||
bytesPerRow: bytesPerRow
|
||||
colorSpace: colorSpace
|
||||
bitmapInfo: bitmapInfo
|
||||
releaseCallback: releaseCallback
|
||||
releaseInfo: releaseInfo];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation O2Context_builtin
|
||||
|
||||
+(BOOL)canInitBitmap {
|
||||
|
@ -1,8 +1,34 @@
|
||||
#import "O2Context_builtin_FT.h"
|
||||
#import <Onyx2D/O2Context_builtin_FT.h>
|
||||
#import <Onyx2D/O2GraphicsState.h>
|
||||
#import <Onyx2D/O2Font_freetype.h>
|
||||
#import <Onyx2D/O2Paint_color.h>
|
||||
|
||||
@implementation O2Context (O2BitmapContext)
|
||||
|
||||
+ (O2Context *) createWithBytes: (void *) bytes
|
||||
width: (size_t) width
|
||||
height: (size_t) height
|
||||
bitsPerComponent: (size_t) bitsPerComponent
|
||||
bytesPerRow: (size_t) bytesPerRow
|
||||
colorSpace: (O2ColorSpaceRef) colorSpace
|
||||
bitmapInfo: (O2BitmapInfo) bitmapInfo
|
||||
releaseCallback: (O2BitmapContextReleaseDataCallback) releaseCallback
|
||||
releaseInfo: (void *) releaseInfo {
|
||||
|
||||
return [[O2Context_builtin_FT alloc] initWithBytes: bytes
|
||||
width: width
|
||||
height: height
|
||||
bitsPerComponent: bitsPerComponent
|
||||
bytesPerRow: bytesPerRow
|
||||
colorSpace: colorSpace
|
||||
bitmapInfo: bitmapInfo
|
||||
releaseCallback: releaseCallback
|
||||
releaseInfo: releaseInfo];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@implementation O2Context_builtin_FT
|
||||
|
||||
-initWithSurface:(O2Surface *)surface flipped:(BOOL)flipped {
|
||||
@ -147,8 +173,8 @@ static void renderFreeTypeBitmap(
|
||||
|
||||
[self establishFontStateInDeviceIfDirty];
|
||||
|
||||
O2Font_freetype *font = (O2Font_freetype *)gState->_font;
|
||||
FT_Face face=[font face];
|
||||
O2Font_freetype *font = (O2Font_freetype *) gState->_font;
|
||||
FT_Face face = [font face];
|
||||
|
||||
int i;
|
||||
FT_Error ftError;
|
Loading…
Reference in New Issue
Block a user