mirror of
https://github.com/darlinghq/darling-cocotron.git
synced 2024-10-07 17:43:28 +00:00
some cleanup with CG/CT
This commit is contained in:
parent
8ec7d3224b
commit
441c0e929b
@ -61,7 +61,7 @@ static inline CGGlyphMetrics *glyphInfoForGlyph(KTFont_gdi *self,CGGlyph glyph){
|
||||
|
||||
-(Win32Font *)createGDIFontSelectedInDC:(HDC)dc {
|
||||
int height=([self pointSize]*GetDeviceCaps(dc,LOGPIXELSY))/72.0;
|
||||
Win32Font *result=[[Win32Font alloc] initWithName:[self name] size:NSMakeSize(0,height) antialias:NO];
|
||||
Win32Font *result=[[Win32Font alloc] initWithName:[self name] height:height antialias:NO];
|
||||
|
||||
SelectObject(dc,[result fontHandle]);
|
||||
return result;
|
||||
|
@ -15,7 +15,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
||||
HFONT _handle;
|
||||
}
|
||||
|
||||
-initWithName:(NSString *)name size:(NSSize)size antialias:(BOOL)antialias;
|
||||
-initWithName:(NSString *)name height:(int)height antialias:(BOOL)antialias;
|
||||
|
||||
-(HFONT)fontHandle;
|
||||
|
||||
|
@ -10,8 +10,8 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
||||
|
||||
@implementation Win32Font
|
||||
|
||||
-initWithName:(NSString *)name size:(NSSize)size antialias:(BOOL)antialias {
|
||||
_handle=CreateFont(size.height,size.width,0,0,FW_NORMAL,
|
||||
-initWithName:(NSString *)name height:(int)height antialias:(BOOL)antialias {
|
||||
_handle=CreateFont(height,0,0,0,FW_NORMAL,
|
||||
FALSE,FALSE,FALSE,
|
||||
DEFAULT_CHARSET,OUT_DEFAULT_PRECIS,CLIP_DEFAULT_PRECIS,
|
||||
antialias?ANTIALIASED_QUALITY:DEFAULT_QUALITY,DEFAULT_PITCH|FF_DONTCARE,[name cString]);
|
||||
|
@ -8,6 +8,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <CoreGraphics/CoreGraphicsExport.h>
|
||||
#import <CoreGraphics/CGGeometry.h>
|
||||
|
||||
@class KGFont;
|
||||
|
||||
@ -20,5 +21,24 @@ typedef unsigned short CGGlyph;
|
||||
#endif
|
||||
|
||||
COREGRAPHICS_EXPORT CGFontRef CGFontCreateWithFontName(NSString *name);
|
||||
COREGRAPHICS_EXPORT CGFontRef CGFontRetain(CGFontRef self);
|
||||
COREGRAPHICS_EXPORT void CGFontRelease(CGFontRef self);
|
||||
|
||||
COREGRAPHICS_EXPORT void CGFontRelease(CGFontRef self);
|
||||
COREGRAPHICS_EXPORT NSString *CGFontCopyFullName(CGFontRef self);
|
||||
COREGRAPHICS_EXPORT int CGFontGetUnitsPerEm(CGFontRef self);
|
||||
COREGRAPHICS_EXPORT int CGFontGetAscent(CGFontRef self);
|
||||
COREGRAPHICS_EXPORT int CGFontGetDescent(CGFontRef self);
|
||||
COREGRAPHICS_EXPORT int CGFontGetLeading(CGFontRef self);
|
||||
COREGRAPHICS_EXPORT int CGFontGetCapHeight(CGFontRef self);
|
||||
COREGRAPHICS_EXPORT int CGFontGetXHeight(CGFontRef self);
|
||||
COREGRAPHICS_EXPORT CGFloat CGFontGetItalicAngle(CGFontRef self);
|
||||
COREGRAPHICS_EXPORT CGFloat CGFontGetStemV(CGFontRef self);
|
||||
COREGRAPHICS_EXPORT CGRect CGFontGetFontBBox(CGFontRef self);
|
||||
|
||||
COREGRAPHICS_EXPORT size_t CGFontGetNumberOfGlyphs(CGFontRef self);
|
||||
COREGRAPHICS_EXPORT BOOL CGFontGetGlyphAdvances(CGFontRef self,const CGGlyph *glyphs,size_t count,int *advances);
|
||||
|
||||
COREGRAPHICS_EXPORT CGGlyph CGFontGetGlyphWithGlyphName(CGFontRef self,NSString *name);
|
||||
COREGRAPHICS_EXPORT NSString *CGFontCopyGlyphNameForGlyph(CGFontRef self,CGGlyph glyph);
|
||||
|
||||
COREGRAPHICS_EXPORT NSData *CGFontCopyTableForTag(CGFontRef self,uint32_t tag);
|
||||
|
@ -90,7 +90,6 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
||||
-(void)setCharacterSpacing:(float)spacing;
|
||||
-(void)setTextDrawingMode:(int)textMode;
|
||||
-(KGFont *)font;
|
||||
-(NSString *)fontName;
|
||||
-(CGFloat)pointSize;
|
||||
-(id)fontState;
|
||||
-(void)setFontState:(id)fontState;
|
||||
|
@ -225,10 +225,6 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
||||
return _font;
|
||||
}
|
||||
|
||||
-(NSString *)fontName {
|
||||
return [_font fontName];
|
||||
}
|
||||
|
||||
-(CGFloat)pointSize {
|
||||
return _pointSize;
|
||||
}
|
||||
|
9
CoreText/CoreText.h
Normal file
9
CoreText/CoreText.h
Normal file
@ -0,0 +1,9 @@
|
||||
/* Copyright (c) 2008 Christopher J. W. Lloyd
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
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 <CoreText/CTFont.h>
|
34
CoreText/CoreTextExport.h
Executable file
34
CoreText/CoreTextExport.h
Executable file
@ -0,0 +1,34 @@
|
||||
/* Copyright (c) 2006-2007 Christopher J. W. Lloyd
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
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. */
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
#if defined(__WIN32__)
|
||||
#if defined(CORETEXT_INSIDE_BUILD)
|
||||
#define CORETEXT_EXPORT extern "C" __declspec(dllexport)
|
||||
#else
|
||||
#define CORETEXT_EXPORT extern "C" __declspec(dllimport)
|
||||
#endif
|
||||
#else
|
||||
#define CORETEXT_EXPORT extern "C"
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
#if defined(__WIN32__)
|
||||
#if defined(CORETEXT_INSIDE_BUILD)
|
||||
#define CORETEXT_EXPORT __declspec(dllexport) extern
|
||||
#else
|
||||
#define CORETEXT_EXPORT __declspec(dllimport) extern
|
||||
#endif
|
||||
#else
|
||||
#define CORETEXT_EXPORT extern
|
||||
#endif
|
||||
|
||||
|
||||
#endif // __cplusplus
|
Loading…
Reference in New Issue
Block a user