dopt to the fact that NSAffineTransform now uses a matrix of CGFloats.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@29688 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Fred Kiefer 2010-02-20 16:30:27 +00:00
parent 4b1472cf8a
commit 3a81ad3b3b
7 changed files with 186 additions and 153 deletions

View file

@ -1,3 +1,13 @@
2010-02-20 Fred Kiefer <FredKiefer@gmx.de>
* Headers/AppKit/NSFont.h,
* Headers/Additions/GNUstepGUI/GSFontInfo.h,
* Source/GSFontInfo.m,
* Source/NSAffineTransform.m,
* Source/externs.m,
* Source/NSFont.m: Adopt to the fact that NSAffineTransform now
uses a matrix of CGFloats.
2010-02-20 Fred Kiefer <FredKiefer@gmx.de>
* Headers/AppKit/NSAttributedString.h,

View file

@ -30,8 +30,8 @@
#ifndef __GSFontInfo_h_INCLUDE_
#define __GSFontInfo_h_INCLUDE_
#include <AppKit/NSFont.h>
#include <AppKit/NSFontManager.h>
#import <AppKit/NSFont.h>
#import <AppKit/NSFontManager.h>
@class NSMutableDictionary;
@class NSArray;
@ -69,14 +69,14 @@ values. Backends may override these. */
// metrics of the font
NSString *fontName;
NSString *familyName;
float matrix[6];
float italicAngle;
float underlinePosition;
float underlineThickness;
float capHeight;
float xHeight;
float descender;
float ascender;
CGFloat matrix[6];
CGFloat italicAngle;
CGFloat underlinePosition;
CGFloat underlineThickness;
CGFloat capHeight;
CGFloat xHeight;
CGFloat descender;
CGFloat ascender;
NSSize maximumAdvancement;
NSSize minimumAdvancement;
NSString *encodingScheme;
@ -92,25 +92,25 @@ values. Backends may override these. */
}
+ (GSFontInfo*) fontInfoForFontName: (NSString*)fontName
matrix: (const float *)fmatrix
matrix: (const CGFloat*)fmatrix
screenFont: (BOOL)screenFont;
+ (void) setDefaultClass: (Class)defaultClass;
+ (NSString *) stringForWeight: (int)weight;
+ (int) weightForString: (NSString *)weightString;
+ (NSString*) stringForWeight: (int)weight;
+ (int) weightForString: (NSString*)weightString;
- (NSSize) advancementForGlyph: (NSGlyph)aGlyph;
- (NSDictionary *) afmDictionary;
- (NSString *) afmFileContents;
- (void) appendBezierPathWithGlyphs: (NSGlyph *)glyphs
- (NSDictionary*) afmDictionary;
- (NSString*) afmFileContents;
- (void) appendBezierPathWithGlyphs: (NSGlyph*)glyphs
count: (int)count
toBezierPath: (NSBezierPath *)path;
- (float) ascender;
toBezierPath: (NSBezierPath*)path;
- (CGFloat) ascender;
- (NSRect) boundingRectForGlyph: (NSGlyph)aGlyph;
- (NSRect) boundingRectForFont;
- (float) capHeight;
- (CGFloat) capHeight;
- (NSCharacterSet*) coveredCharacterSet;
- (float) defaultLineHeightForFont;
- (float) descender;
- (CGFloat) defaultLineHeightForFont;
- (CGFloat) descender;
- (NSString *) displayName;
- (NSString *) encodingScheme;
- (NSString *) familyName;
@ -120,12 +120,12 @@ values. Backends may override these. */
- (NSGlyph) glyphWithName: (NSString*)glyphName;
- (BOOL) isFixedPitch;
- (BOOL) isBaseFont;
- (float) italicAngle;
- (const float*) matrix;
- (CGFloat) italicAngle;
- (const CGFloat*) matrix;
- (NSSize) maximumAdvancement;
- (NSSize) minimumAdvancement;
- (NSStringEncoding) mostCompatibleStringEncoding;
- (unsigned) numberOfGlyphs;
- (NSUInteger) numberOfGlyphs;
- (NSPoint) positionOfGlyph: (NSGlyph)aGlyph
forCharacter: (unichar)aChar
struckOverRect: (NSRect)aRect;
@ -144,11 +144,11 @@ values. Backends may override these. */
totalAdvancement: (NSSize *)offset
metricsExist: (BOOL *)flag;
- (NSFontTraitMask) traits;
- (float) underlinePosition;
- (float) underlineThickness;
- (CGFloat) underlinePosition;
- (CGFloat) underlineThickness;
- (int) weight;
- (float) widthOfString: (NSString*)string;
- (float) xHeight;
- (CGFloat) widthOfString: (NSString*)string;
- (CGFloat) xHeight;
- (NSGlyph) glyphForCharacter: (unichar)theChar;
- (NSFontDescriptor*) fontDescriptor;

View file

@ -75,12 +75,12 @@ typedef enum _NSFontRenderingMode
} NSFontRenderingMode;
#endif
APPKIT_EXPORT const float *NSFontIdentityMatrix;
APPKIT_EXPORT const CGFloat *NSFontIdentityMatrix;
@interface NSFont : NSObject <NSCoding, NSCopying>
{
NSString *fontName;
float matrix[6];
CGFloat matrix[6];
BOOL matrixExplicitlySet;
BOOL screenFont;
@ -113,24 +113,24 @@ APPKIT_EXPORT const float *NSFontIdentityMatrix;
//
// Creating a Font Object
//
+ (NSFont*) boldSystemFontOfSize: (float)fontSize;
+ (NSFont*) boldSystemFontOfSize: (CGFloat)fontSize;
+ (NSFont*) fontWithName: (NSString*)aFontName
matrix: (const float*)fontMatrix;
matrix: (const CGFloat*)fontMatrix;
+ (NSFont*) fontWithName: (NSString*)aFontName
size: (float)fontSize;
+ (NSFont*) systemFontOfSize: (float)fontSize;
+ (NSFont*) userFixedPitchFontOfSize: (float)fontSize;
+ (NSFont*) userFontOfSize: (float)fontSize;
size: (CGFloat)fontSize;
+ (NSFont*) systemFontOfSize: (CGFloat)fontSize;
+ (NSFont*) userFixedPitchFontOfSize: (CGFloat)fontSize;
+ (NSFont*) userFontOfSize: (CGFloat)fontSize;
#if OS_API_VERSION(GS_API_MACOSX, GS_API_LATEST)
+ (NSFont*) titleBarFontOfSize: (float)fontSize;
+ (NSFont*) menuFontOfSize: (float)fontSize;
+ (NSFont*) messageFontOfSize: (float)fontSize;
+ (NSFont*) paletteFontOfSize: (float)fontSize;
+ (NSFont*) toolTipsFontOfSize: (float)fontSize;
+ (NSFont*) controlContentFontOfSize: (float)fontSize;
+ (NSFont*) labelFontOfSize: (float)fontSize;
+ (NSFont*) menuBarFontOfSize: (float)fontSize;
+ (NSFont*) titleBarFontOfSize: (CGFloat)fontSize;
+ (NSFont*) menuFontOfSize: (CGFloat)fontSize;
+ (NSFont*) messageFontOfSize: (CGFloat)fontSize;
+ (NSFont*) paletteFontOfSize: (CGFloat)fontSize;
+ (NSFont*) toolTipsFontOfSize: (CGFloat)fontSize;
+ (NSFont*) controlContentFontOfSize: (CGFloat)fontSize;
+ (NSFont*) labelFontOfSize: (CGFloat)fontSize;
+ (NSFont*) menuBarFontOfSize: (CGFloat)fontSize;
#endif
#if OS_API_VERSION(MAC_OS_X_VERSION_10_4, GS_API_LATEST)
+ (NSFont*) fontWithDescriptor: (NSFontDescriptor*)descriptor size: (CGFloat)size;
@ -146,10 +146,10 @@ APPKIT_EXPORT const float *NSFontIdentityMatrix;
// Font Sizes
//
#if OS_API_VERSION(GS_API_MACOSX, GS_API_LATEST)
+ (float) labelFontSize;
+ (float) smallSystemFontSize;
+ (float) systemFontSize;
+ (float) systemFontSizeForControlSize: (NSControlSize)controlSize;
+ (CGFloat) labelFontSize;
+ (CGFloat) smallSystemFontSize;
+ (CGFloat) systemFontSize;
+ (CGFloat) systemFontSizeForControlSize: (NSControlSize)controlSize;
#endif
//
@ -182,24 +182,24 @@ APPKIT_EXPORT const float *NSFontIdentityMatrix;
- (NSString*) encodingScheme;
- (BOOL) isFixedPitch;
- (BOOL) isBaseFont;
- (const float*) matrix;
- (float) pointSize;
- (const CGFloat*) matrix;
- (CGFloat) pointSize;
- (NSFont*) printerFont;
- (NSFont*) screenFont;
- (float) ascender;
- (float) descender;
- (float) capHeight;
- (float) italicAngle;
- (CGFloat) ascender;
- (CGFloat) descender;
- (CGFloat) capHeight;
- (CGFloat) italicAngle;
- (NSSize) maximumAdvancement;
- (NSSize) minimumAdvancement;
- (float) underlinePosition;
- (float) underlineThickness;
- (float) xHeight;
- (float) widthOfString: (NSString*)string;
- (float) defaultLineHeightForFont;
- (CGFloat) underlinePosition;
- (CGFloat) underlineThickness;
- (CGFloat) xHeight;
- (CGFloat) widthOfString: (NSString*)string;
- (CGFloat) defaultLineHeightForFont;
#if OS_API_VERSION(GS_API_MACOSX, GS_API_LATEST)
- (unsigned) numberOfGlyphs;
- (NSUInteger) numberOfGlyphs;
- (NSCharacterSet*) coveredCharacterSet;
#endif
#if OS_API_VERSION(MAC_OS_X_VERSION_10_4, GS_API_LATEST)

View file

@ -29,19 +29,19 @@
#include <math.h>
#include "Foundation/NSAffineTransform.h"
#include <Foundation/NSArray.h>
#include <Foundation/NSCharacterSet.h>
#include <Foundation/NSDictionary.h>
#include <Foundation/NSEnumerator.h>
#include <Foundation/NSException.h>
#include <Foundation/NSSet.h>
#include <Foundation/NSString.h>
#include <Foundation/NSValue.h>
#import <Foundation/NSAffineTransform.h>
#import <Foundation/NSArray.h>
#import <Foundation/NSCharacterSet.h>
#import <Foundation/NSDictionary.h>
#import <Foundation/NSEnumerator.h>
#import <Foundation/NSException.h>
#import <Foundation/NSSet.h>
#import <Foundation/NSString.h>
#import <Foundation/NSValue.h>
#include "AppKit/NSFontDescriptor.h"
#import "AppKit/NSFontDescriptor.h"
#include "GNUstepGUI/GSFontInfo.h"
#import "GNUstepGUI/GSFontInfo.h"
static Class fontEnumeratorClass = Nil;
static Class fontInfoClass = Nil;
@ -268,7 +268,7 @@ static GSFontEnumerator *sharedEnumerator = nil;
@interface GSFontInfo (Backend)
-initWithFontName: (NSString *)fontName
matrix: (const float *)fmatrix
matrix: (const CGFloat *)fmatrix
screenFont: (BOOL)screenFont;
@end
@ -280,7 +280,7 @@ static GSFontEnumerator *sharedEnumerator = nil;
}
+ (GSFontInfo*) fontInfoForFontName: (NSString*)nfontName
matrix: (const float *)fmatrix
matrix: (const CGFloat *)fmatrix
screenFont: (BOOL)screenFont;
{
NSAssert(fontInfoClass,
@ -514,17 +514,17 @@ static GSFontEnumerator *sharedEnumerator = nil;
return familyName;
}
- (const float*) matrix
- (const CGFloat*) matrix
{
return matrix;
}
- (unsigned) numberOfGlyphs
- (NSUInteger) numberOfGlyphs
{
return numberOfGlyphs;
}
- (float) pointSize
- (CGFloat) pointSize
{
return matrix[0];
}
@ -544,22 +544,22 @@ static GSFontEnumerator *sharedEnumerator = nil;
return isFixedPitch;
}
- (float) ascender
- (CGFloat) ascender
{
return ascender;
}
- (float) descender
- (CGFloat) descender
{
return descender;
}
- (float) capHeight
- (CGFloat) capHeight
{
return capHeight;
}
- (float) italicAngle
- (CGFloat) italicAngle
{
return italicAngle;
}
@ -574,22 +574,22 @@ static GSFontEnumerator *sharedEnumerator = nil;
return minimumAdvancement;
}
- (float) underlinePosition
- (CGFloat) underlinePosition
{
return underlinePosition;
}
- (float) underlineThickness
- (CGFloat) underlineThickness
{
return underlineThickness;
}
- (float) xHeight
- (CGFloat) xHeight
{
return xHeight;
}
- (float) defaultLineHeightForFont
- (CGFloat) defaultLineHeightForFont
{
/*
In the absence of a more accurate line height from the font itself, we
@ -723,7 +723,7 @@ static GSFontEnumerator *sharedEnumerator = nil;
return mostCompatibleStringEncoding;
}
- (float) widthOfString: (NSString*)string
- (CGFloat) widthOfString: (NSString*)string
{
return 0;
}

View file

@ -67,9 +67,16 @@ static const float pi = 3.1415926535897932384626434;
*/
- (void) concat
{
NSAffineTransformStruct matrix = [self transformStruct];
NSAffineTransformStruct ats = [self transformStruct];
float floatMatrix[6];
PSconcat((float*)&matrix);
floatMatrix[0] = ats.m11;
floatMatrix[1] = ats.m12;
floatMatrix[2] = ats.m21;
floatMatrix[3] = ats.m22;
floatMatrix[4] = ats.tX;
floatMatrix[5] = ats.tY;
PSconcat(floatMatrix);
}

View file

@ -28,34 +28,34 @@
*/
#include "config.h"
#include <Foundation/NSAffineTransform.h>
#include <Foundation/NSCoder.h>
#include <Foundation/NSDictionary.h>
#include <Foundation/NSString.h>
#include <Foundation/NSUserDefaults.h>
#include <Foundation/NSSet.h>
#include <Foundation/NSMapTable.h>
#include <Foundation/NSException.h>
#include <Foundation/NSDebug.h>
#include <Foundation/NSValue.h>
#import <Foundation/NSAffineTransform.h>
#import <Foundation/NSCoder.h>
#import <Foundation/NSDictionary.h>
#import <Foundation/NSString.h>
#import <Foundation/NSUserDefaults.h>
#import <Foundation/NSSet.h>
#import <Foundation/NSMapTable.h>
#import <Foundation/NSException.h>
#import <Foundation/NSDebug.h>
#import <Foundation/NSValue.h>
#include "AppKit/NSGraphicsContext.h"
#include "AppKit/NSFont.h"
#include <AppKit/NSFontDescriptor.h>
#include "AppKit/NSFontManager.h"
#include "AppKit/NSView.h"
#include "GNUstepGUI/GSFontInfo.h"
#include "GSFusedSilicaContext.h"
#import "AppKit/NSGraphicsContext.h"
#import "AppKit/NSFont.h"
#import "AppKit/NSFontDescriptor.h"
#import "AppKit/NSFontManager.h"
#import "AppKit/NSView.h"
#import "GNUstepGUI/GSFontInfo.h"
#import "GSFusedSilicaContext.h"
@interface NSFont (Private)
- (id) initWithName: (NSString*)name
matrix: (const float*)fontMatrix
matrix: (const CGFloat*)fontMatrix
fix: (BOOL)explicitlySet
screenFont: (BOOL)screenFont
role: (int)role;
+ (NSFont*) _fontWithName: (NSString*)aFontName
size: (float)fontSize
size: (CGFloat)fontSize
role: (int)role;
@end
@ -111,7 +111,7 @@ globalFontMap.
@end
static GSFontMapKey *
keyForFont(NSString *name, const float *matrix, BOOL fix,
keyForFont(NSString *name, const CGFloat *matrix, BOOL fix,
BOOL screenFont, int role)
{
GSFontMapKey *d;
@ -197,12 +197,12 @@ static NSFont *placeHolder = nil;
static NSArray *_preferredFonts;
/* Class for fonts */
static Class NSFontClass = 0;
static Class NSFontClass = 0;
/* Cache all created fonts for reuse. */
static NSMapTable* globalFontMap = 0;
static NSUserDefaults *defaults = nil;
static NSUserDefaults *defaults = nil;
/*
@ -321,7 +321,7 @@ static NSString *fontNameForRole(int role, int *actual_entry)
return fontName;
}
static NSFont *getNSFont(float fontSize, int role)
static NSFont *getNSFont(CGFloat fontSize, int role)
{
NSString *fontName;
NSFont *font;
@ -467,7 +467,7 @@ static void setNSFont(NSString *key, NSFont *font)
gui components. If fontSize is &lt;= 0, the default
size is used.</p><p>See Also: +fontWithName:size:</p>
*/
+ (NSFont*) boldSystemFontOfSize: (float)fontSize
+ (NSFont*) boldSystemFontOfSize: (CGFloat)fontSize
{
return getNSFont(fontSize, RoleBoldSystemFont);
}
@ -477,7 +477,7 @@ static void setNSFont(NSString *key, NSFont *font)
size is used.</p><p>See Also: +boldSystemFontOfSize: userFontOfSize:
userFixedPitchFontOfSize: +fontWithName:size:</p>
*/
+ (NSFont*) systemFontOfSize: (float)fontSize
+ (NSFont*) systemFontOfSize: (CGFloat)fontSize
{
return getNSFont(fontSize, RoleSystemFont);
}
@ -487,7 +487,7 @@ static void setNSFont(NSString *key, NSFont *font)
size is used.</p><p>See Also: +setUserFixedPitchFont: +userFontOfSize:
+boldSystemFontOfSize: +systemFontOfSize: +fontWithName:size:</p>
*/
+ (NSFont*) userFixedPitchFontOfSize: (float)fontSize
+ (NSFont*) userFixedPitchFontOfSize: (CGFloat)fontSize
{
return getNSFont(fontSize, RoleUserFixedPitchFont);
}
@ -497,7 +497,7 @@ static void setNSFont(NSString *key, NSFont *font)
size is used.</p><p>See Also: +setUserFont: +boldSystemFontOfSize:
systemFontOfSize: userFixedPitchFontOfSize: +fontWithName:size:</p>
*/
+ (NSFont*) userFontOfSize: (float)fontSize
+ (NSFont*) userFontOfSize: (CGFloat)fontSize
{
return getNSFont(fontSize, RoleUserFont);
}
@ -526,7 +526,7 @@ static void setNSFont(NSString *key, NSFont *font)
textTransform: (NSAffineTransform*)transform
{
NSArray *a;
float fontMatrix[6];
CGFloat fontMatrix[6];
NSAffineTransformStruct ats;
descriptor = [descriptor matchingFontDescriptorWithMandatoryKeys:
@ -600,42 +600,42 @@ static void setNSFont(NSString *key, NSFont *font)
/* Getting various fonts*/
+ (NSFont*) controlContentFontOfSize: (float)fontSize
+ (NSFont*) controlContentFontOfSize: (CGFloat)fontSize
{
return getNSFont(fontSize, RoleControlContentFont);
}
+ (NSFont*) labelFontOfSize: (float)fontSize
+ (NSFont*) labelFontOfSize: (CGFloat)fontSize
{
return getNSFont(fontSize, RoleLabelFont);
}
+ (NSFont*) menuFontOfSize: (float)fontSize
+ (NSFont*) menuFontOfSize: (CGFloat)fontSize
{
return getNSFont(fontSize, RoleMenuFont);
}
+ (NSFont*) menuBarFontOfSize: (float)fontSize
+ (NSFont*) menuBarFontOfSize: (CGFloat)fontSize
{
return getNSFont(fontSize, RoleMenuBarFont);
}
+ (NSFont*) titleBarFontOfSize: (float)fontSize
+ (NSFont*) titleBarFontOfSize: (CGFloat)fontSize
{
return getNSFont(fontSize, RoleTitleBarFont);
}
+ (NSFont*) messageFontOfSize: (float)fontSize
+ (NSFont*) messageFontOfSize: (CGFloat)fontSize
{
return getNSFont(fontSize, RoleMessageFont);
}
+ (NSFont*) paletteFontOfSize: (float)fontSize
+ (NSFont*) paletteFontOfSize: (CGFloat)fontSize
{
return getNSFont(fontSize, RolePaletteFont);
}
+ (NSFont*) toolTipsFontOfSize: (float)fontSize
+ (NSFont*) toolTipsFontOfSize: (CGFloat)fontSize
{
return getNSFont(fontSize, RoleToolTipsFont);
}
@ -643,9 +643,9 @@ static void setNSFont(NSString *key, NSFont *font)
//
// Font Sizes
//
+ (float) labelFontSize
+ (CGFloat) labelFontSize
{
float fontSize = [defaults floatForKey: @"NSLabelFontSize"];
CGFloat fontSize = [defaults floatForKey: @"NSLabelFontSize"];
if (fontSize == 0)
{
@ -655,9 +655,9 @@ static void setNSFont(NSString *key, NSFont *font)
return fontSize;
}
+ (float) smallSystemFontSize
+ (CGFloat) smallSystemFontSize
{
float fontSize = [defaults floatForKey: @"NSSmallFontSize"];
CGFloat fontSize = [defaults floatForKey: @"NSSmallFontSize"];
if (fontSize == 0)
{
@ -667,9 +667,9 @@ static void setNSFont(NSString *key, NSFont *font)
return fontSize;
}
+ (float) systemFontSize
+ (CGFloat) systemFontSize
{
float fontSize = [defaults floatForKey: @"NSFontSize"];
CGFloat fontSize = [defaults floatForKey: @"NSFontSize"];
if (fontSize == 0)
{
@ -679,13 +679,13 @@ static void setNSFont(NSString *key, NSFont *font)
return fontSize;
}
+ (float) systemFontSizeForControlSize: (NSControlSize)controlSize
+ (CGFloat) systemFontSizeForControlSize: (NSControlSize)controlSize
{
switch (controlSize)
{
case NSMiniControlSize:
{
float fontSize = [defaults floatForKey: @"NSMiniFontSize"];
CGFloat fontSize = [defaults floatForKey: @"NSMiniFontSize"];
if (fontSize == 0)
{
@ -711,7 +711,7 @@ static void setNSFont(NSString *key, NSFont *font)
</p>
*/
+ (NSFont*) fontWithName: (NSString*)aFontName
matrix: (const float*)fontMatrix
matrix: (const CGFloat*)fontMatrix
{
NSFont *font;
BOOL fix;
@ -735,7 +735,7 @@ static void setNSFont(NSString *key, NSFont *font)
* when set in a flipped view.</p>
*/
+ (NSFont*) fontWithName: (NSString*)aFontName
size: (float)fontSize
size: (CGFloat)fontSize
{
return [self _fontWithName: aFontName
size: fontSize
@ -743,11 +743,11 @@ static void setNSFont(NSString *key, NSFont *font)
}
+ (NSFont*) _fontWithName: (NSString*)aFontName
size: (float)fontSize
size: (CGFloat)fontSize
role: (int)aRole
{
NSFont *font;
float fontMatrix[6] = { 0, 0, 0, 0, 0, 0 };
CGFloat fontMatrix[6] = { 0, 0, 0, 0, 0, 0 };
if (fontSize == 0)
{
@ -794,7 +794,7 @@ static void setNSFont(NSString *key, NSFont *font)
* This method may destroy the receiver and return a cached instance.
*/
- (id) initWithName: (NSString*)name
matrix: (const float*)fontMatrix
matrix: (const CGFloat*)fontMatrix
fix: (BOOL)explicitlySet
screenFont: (BOOL)screen
role: (int)aRole
@ -958,7 +958,7 @@ static void setNSFont(NSString *key, NSFont *font)
{
if (cachedFlippedFont == nil)
{
float fontMatrix[6];
CGFloat fontMatrix[6];
memcpy(fontMatrix, matrix, sizeof(matrix));
fontMatrix[3] *= -1;
cachedFlippedFont = [placeHolder initWithName: fontName
@ -1002,7 +1002,7 @@ static BOOL flip_hack;
//
// Querying the Font
//
- (float) pointSize
- (CGFloat) pointSize
{
return [fontInfo pointSize];
}
@ -1012,7 +1012,7 @@ static BOOL flip_hack;
return fontName;
}
- (const float*) matrix
- (const CGFloat*) matrix
{
return matrix;
}
@ -1118,24 +1118,24 @@ static BOOL flip_hack;
return NSFontDefaultRenderingMode;
}
- (float) ascender { return [fontInfo ascender]; }
- (float) descender { return [fontInfo descender]; }
- (float) capHeight { return [fontInfo capHeight]; }
- (float) italicAngle { return [fontInfo italicAngle]; }
- (CGFloat) ascender { return [fontInfo ascender]; }
- (CGFloat) descender { return [fontInfo descender]; }
- (CGFloat) capHeight { return [fontInfo capHeight]; }
- (CGFloat) italicAngle { return [fontInfo italicAngle]; }
- (NSSize) maximumAdvancement { return [fontInfo maximumAdvancement]; }
- (NSSize) minimumAdvancement { return [fontInfo minimumAdvancement]; }
- (float) underlinePosition { return [fontInfo underlinePosition]; }
- (float) underlineThickness { return [fontInfo underlineThickness]; }
- (float) xHeight { return [fontInfo xHeight]; }
- (float) defaultLineHeightForFont { return [fontInfo defaultLineHeightForFont]; }
- (CGFloat) underlinePosition { return [fontInfo underlinePosition]; }
- (CGFloat) underlineThickness { return [fontInfo underlineThickness]; }
- (CGFloat) xHeight { return [fontInfo xHeight]; }
- (CGFloat) defaultLineHeightForFont { return [fontInfo defaultLineHeightForFont]; }
/* Computing font metrics attributes*/
- (float) widthOfString: (NSString*)string
- (CGFloat) widthOfString: (NSString*)string
{
return [fontInfo widthOfString: string];
}
- (unsigned) numberOfGlyphs
- (NSUInteger) numberOfGlyphs
{
return [fontInfo numberOfGlyphs];
}
@ -1294,13 +1294,22 @@ static BOOL flip_hack;
if (role == 0)
{
float fontMatrix[6];
fontMatrix[0] = matrix[0];
fontMatrix[1] = matrix[1];
fontMatrix[2] = matrix[2];
fontMatrix[3] = matrix[3];
fontMatrix[4] = matrix[4];
fontMatrix[5] = matrix[5];
[aCoder encodeObject: fontName];
[aCoder encodeArrayOfObjCType: @encode(float) count: 6 at: matrix];
[aCoder encodeArrayOfObjCType: @encode(float) count: 6 at: fontMatrix];
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &matrixExplicitlySet];
}
else if (role & 1)
{
[aCoder encodeValueOfObjCType: @encode(float) at: &matrix[0]];
float size = matrix[0];
[aCoder encodeValueOfObjCType: @encode(float) at: &size];
}
}
}
@ -1344,6 +1353,7 @@ static BOOL flip_hack;
int version = [aDecoder versionForClassName: @"NSFont"];
id name;
float fontMatrix[6];
CGFloat cgMatrix[6];
BOOL fix;
int the_role;
@ -1380,8 +1390,14 @@ static BOOL flip_hack;
fix = YES;
}
cgMatrix[0] = fontMatrix[0];
cgMatrix[1] = fontMatrix[1];
cgMatrix[2] = fontMatrix[2];
cgMatrix[3] = fontMatrix[3];
cgMatrix[4] = fontMatrix[4];
cgMatrix[5] = fontMatrix[5];
self = [self initWithName: name
matrix: fontMatrix
matrix: cgMatrix
fix: fix
screenFont: NO
role: RoleExplicit];

View file

@ -583,7 +583,7 @@ NSString *NSToolbarPrintItemIdentifier = @"NSToolbarPrintItemIdentifier";
NSString *NSOldSelectedCharacterRange = @"NSOldSelectedCharacterRange";
/* NSFont matrix */
const float NSFontIdentityMatrix[] = {1, 0, 0, 1, 0, 0};
const CGFloat NSFontIdentityMatrix[] = {1, 0, 0, 1, 0, 0};
/* Drawing engine externs */
NSString *NSBackendContext = @"NSBackendContext";