mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-25 13:50:57 +00:00
* Source/NSFont.m (-setInContext:): Remove usage of
matrixExplicitlySet. Patch by Derek Fawcus <dfawcus@cisco.com>. * Source/NSFont.m: Remove all other usages of matrixExplicitlySet. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@35926 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
a838afda58
commit
5b4985096a
3 changed files with 19 additions and 41 deletions
|
@ -1,3 +1,10 @@
|
||||||
|
2012-12-31 Fred Kiefer <FredKiefer@gmx.de>
|
||||||
|
|
||||||
|
* Source/NSFont.m (-setInContext:): Remove usage of
|
||||||
|
matrixExplicitlySet.
|
||||||
|
Patch by Derek Fawcus <dfawcus@cisco.com>.
|
||||||
|
* Source/NSFont.m: Remove all other usages of matrixExplicitlySet.
|
||||||
|
|
||||||
2012-12-30 Fred Kiefer <FredKiefer@gmx.de>
|
2012-12-30 Fred Kiefer <FredKiefer@gmx.de>
|
||||||
|
|
||||||
* Headers/Additions/GNUstepGUI/GSLayoutManager_internal.h: Make
|
* Headers/Additions/GNUstepGUI/GSLayoutManager_internal.h: Make
|
||||||
|
|
|
@ -81,7 +81,7 @@ APPKIT_EXPORT const CGFloat *NSFontIdentityMatrix;
|
||||||
{
|
{
|
||||||
NSString *fontName;
|
NSString *fontName;
|
||||||
CGFloat matrix[6];
|
CGFloat matrix[6];
|
||||||
BOOL matrixExplicitlySet;
|
BOOL matrixExplicitlySet; // unused
|
||||||
BOOL screenFont;
|
BOOL screenFont;
|
||||||
|
|
||||||
id fontInfo;
|
id fontInfo;
|
||||||
|
|
|
@ -50,7 +50,6 @@
|
||||||
@interface NSFont (Private)
|
@interface NSFont (Private)
|
||||||
- (id) initWithName: (NSString*)name
|
- (id) initWithName: (NSString*)name
|
||||||
matrix: (const CGFloat*)fontMatrix
|
matrix: (const CGFloat*)fontMatrix
|
||||||
fix: (BOOL)explicitlySet
|
|
||||||
screenFont: (BOOL)screenFont
|
screenFont: (BOOL)screenFont
|
||||||
role: (int)role;
|
role: (int)role;
|
||||||
+ (NSFont*) _fontWithName: (NSString*)aFontName
|
+ (NSFont*) _fontWithName: (NSString*)aFontName
|
||||||
|
@ -71,7 +70,6 @@ globalFontMap.
|
||||||
NSString *name;
|
NSString *name;
|
||||||
BOOL screenFont;
|
BOOL screenFont;
|
||||||
int role;
|
int role;
|
||||||
int fix;
|
|
||||||
int matrix[6];
|
int matrix[6];
|
||||||
|
|
||||||
unsigned int hash;
|
unsigned int hash;
|
||||||
|
@ -88,8 +86,7 @@ globalFontMap.
|
||||||
if (![other isKindOfClass: object_getClass(self)])
|
if (![other isKindOfClass: object_getClass(self)])
|
||||||
return NO;
|
return NO;
|
||||||
o = other;
|
o = other;
|
||||||
if (hash != o->hash || screenFont != o->screenFont || role != o->role
|
if (hash != o->hash || screenFont != o->screenFont || role != o->role)
|
||||||
|| fix != o->fix)
|
|
||||||
return NO;
|
return NO;
|
||||||
if (![name isEqualToString: o->name])
|
if (![name isEqualToString: o->name])
|
||||||
return NO;
|
return NO;
|
||||||
|
@ -110,7 +107,7 @@ globalFontMap.
|
||||||
@end
|
@end
|
||||||
|
|
||||||
static GSFontMapKey *
|
static GSFontMapKey *
|
||||||
keyForFont(NSString *name, const CGFloat *matrix, BOOL fix,
|
keyForFont(NSString *name, const CGFloat *matrix,
|
||||||
BOOL screenFont, int role)
|
BOOL screenFont, int role)
|
||||||
{
|
{
|
||||||
GSFontMapKey *d;
|
GSFontMapKey *d;
|
||||||
|
@ -118,14 +115,13 @@ keyForFont(NSString *name, const CGFloat *matrix, BOOL fix,
|
||||||
d->name = [name copy];
|
d->name = [name copy];
|
||||||
d->screenFont = screenFont;
|
d->screenFont = screenFont;
|
||||||
d->role = role;
|
d->role = role;
|
||||||
d->fix = fix;
|
|
||||||
d->matrix[0] = matrix[0] * 1000;
|
d->matrix[0] = matrix[0] * 1000;
|
||||||
d->matrix[1] = matrix[1] * 1000;
|
d->matrix[1] = matrix[1] * 1000;
|
||||||
d->matrix[2] = matrix[2] * 1000;
|
d->matrix[2] = matrix[2] * 1000;
|
||||||
d->matrix[3] = matrix[3] * 1000;
|
d->matrix[3] = matrix[3] * 1000;
|
||||||
d->matrix[4] = matrix[4] * 1000;
|
d->matrix[4] = matrix[4] * 1000;
|
||||||
d->matrix[5] = matrix[5] * 1000;
|
d->matrix[5] = matrix[5] * 1000;
|
||||||
d->hash = [d->name hash] + screenFont + role * 4 + fix * 2
|
d->hash = [d->name hash] + screenFont + role * 4
|
||||||
+ d->matrix[0] + d->matrix[1] + d->matrix[2] + d->matrix[3];
|
+ d->matrix[0] + d->matrix[1] + d->matrix[2] + d->matrix[3];
|
||||||
return d;
|
return d;
|
||||||
}
|
}
|
||||||
|
@ -713,16 +709,9 @@ static void setNSFont(NSString *key, NSFont *font)
|
||||||
matrix: (const CGFloat*)fontMatrix
|
matrix: (const CGFloat*)fontMatrix
|
||||||
{
|
{
|
||||||
NSFont *font;
|
NSFont *font;
|
||||||
BOOL fix;
|
|
||||||
|
|
||||||
if (fontMatrix == NSFontIdentityMatrix)
|
|
||||||
fix = NO;
|
|
||||||
else
|
|
||||||
fix = YES;
|
|
||||||
|
|
||||||
font = [placeHolder initWithName: aFontName
|
font = [placeHolder initWithName: aFontName
|
||||||
matrix: fontMatrix
|
matrix: fontMatrix
|
||||||
fix: fix
|
|
||||||
screenFont: NO
|
screenFont: NO
|
||||||
role: RoleExplicit];
|
role: RoleExplicit];
|
||||||
|
|
||||||
|
@ -761,7 +750,6 @@ static void setNSFont(NSString *key, NSFont *font)
|
||||||
|
|
||||||
font = [placeHolder initWithName: aFontName
|
font = [placeHolder initWithName: aFontName
|
||||||
matrix: fontMatrix
|
matrix: fontMatrix
|
||||||
fix: NO
|
|
||||||
screenFont: NO
|
screenFont: NO
|
||||||
role: aRole];
|
role: aRole];
|
||||||
return AUTORELEASE(font);
|
return AUTORELEASE(font);
|
||||||
|
@ -828,7 +816,6 @@ static void setNSFont(NSString *key, NSFont *font)
|
||||||
*/
|
*/
|
||||||
- (id) initWithName: (NSString*)name
|
- (id) initWithName: (NSString*)name
|
||||||
matrix: (const CGFloat*)fontMatrix
|
matrix: (const CGFloat*)fontMatrix
|
||||||
fix: (BOOL)explicitlySet
|
|
||||||
screenFont: (BOOL)screen
|
screenFont: (BOOL)screen
|
||||||
role: (int)aRole
|
role: (int)aRole
|
||||||
{
|
{
|
||||||
|
@ -839,7 +826,7 @@ static void setNSFont(NSString *key, NSFont *font)
|
||||||
NSAssert(fontName == nil, NSInternalInconsistencyException);
|
NSAssert(fontName == nil, NSInternalInconsistencyException);
|
||||||
|
|
||||||
/* Check whether the font is cached */
|
/* Check whether the font is cached */
|
||||||
key = keyForFont(name, fontMatrix, explicitlySet,
|
key = keyForFont(name, fontMatrix,
|
||||||
screen, aRole);
|
screen, aRole);
|
||||||
font = (id)NSMapGet(globalFontMap, (void *)key);
|
font = (id)NSMapGet(globalFontMap, (void *)key);
|
||||||
if (font == nil)
|
if (font == nil)
|
||||||
|
@ -855,7 +842,6 @@ static void setNSFont(NSString *key, NSFont *font)
|
||||||
}
|
}
|
||||||
fontName = [name copy];
|
fontName = [name copy];
|
||||||
memcpy(matrix, fontMatrix, sizeof(matrix));
|
memcpy(matrix, fontMatrix, sizeof(matrix));
|
||||||
matrixExplicitlySet = explicitlySet;
|
|
||||||
screenFont = screen;
|
screenFont = screen;
|
||||||
role = aRole;
|
role = aRole;
|
||||||
fontInfo = RETAIN([GSFontInfo fontInfoForFontName: fontName
|
fontInfo = RETAIN([GSFontInfo fontInfoForFontName: fontName
|
||||||
|
@ -903,8 +889,7 @@ static void setNSFont(NSString *key, NSFont *font)
|
||||||
GSFontMapKey *key;
|
GSFontMapKey *key;
|
||||||
|
|
||||||
key = keyForFont(fontName, matrix,
|
key = keyForFont(fontName, matrix,
|
||||||
matrixExplicitlySet, screenFont,
|
screenFont, role);
|
||||||
role);
|
|
||||||
NSMapRemove(globalFontMap, (void *)key);
|
NSMapRemove(globalFontMap, (void *)key);
|
||||||
RELEASE(key);
|
RELEASE(key);
|
||||||
RELEASE(fontName);
|
RELEASE(fontName);
|
||||||
|
@ -921,9 +906,8 @@ static void setNSFont(NSString *key, NSFont *font)
|
||||||
NSString *description;
|
NSString *description;
|
||||||
|
|
||||||
nameWithMatrix = [[NSString alloc] initWithFormat:
|
nameWithMatrix = [[NSString alloc] initWithFormat:
|
||||||
@"%@ %.3f %.3f %.3f %.3f %.3f %.3f %c %c %i", fontName,
|
@"%@ %.3f %.3f %.3f %.3f %.3f %.3f %c %i", fontName,
|
||||||
matrix[0], matrix[1], matrix[2], matrix[3], matrix[4], matrix[5],
|
matrix[0], matrix[1], matrix[2], matrix[3], matrix[4], matrix[5],
|
||||||
(matrixExplicitlySet == NO) ? 'N' : 'Y',
|
|
||||||
screenFont ? 'S' : 'P',
|
screenFont ? 'S' : 'P',
|
||||||
role];
|
role];
|
||||||
description = [[super description] stringByAppendingFormat: @" %@",
|
description = [[super description] stringByAppendingFormat: @" %@",
|
||||||
|
@ -973,7 +957,6 @@ static void setNSFont(NSString *key, NSFont *font)
|
||||||
fontMatrix[3] *= -1;
|
fontMatrix[3] *= -1;
|
||||||
cachedFlippedFont = [placeHolder initWithName: fontName
|
cachedFlippedFont = [placeHolder initWithName: fontName
|
||||||
matrix: fontMatrix
|
matrix: fontMatrix
|
||||||
fix: YES
|
|
||||||
screenFont: screenFont
|
screenFont: screenFont
|
||||||
role: role];
|
role: role];
|
||||||
}
|
}
|
||||||
|
@ -991,8 +974,7 @@ static BOOL flip_hack;
|
||||||
//
|
//
|
||||||
/** Sets the receiver as the font used for text drawing operations. If the
|
/** Sets the receiver as the font used for text drawing operations. If the
|
||||||
current view is a flipped view, the reciever automatically flips itself
|
current view is a flipped view, the reciever automatically flips itself
|
||||||
to display correctly in the flipped view, as long as the font was created
|
to display correctly in the flipped view */
|
||||||
without explicitly setting the font matrix */
|
|
||||||
- (void) set
|
- (void) set
|
||||||
{
|
{
|
||||||
[self setInContext: GSCurrentContext()];
|
[self setInContext: GSCurrentContext()];
|
||||||
|
@ -1000,8 +982,7 @@ static BOOL flip_hack;
|
||||||
|
|
||||||
- (void) setInContext: (NSGraphicsContext*)context
|
- (void) setInContext: (NSGraphicsContext*)context
|
||||||
{
|
{
|
||||||
if (matrixExplicitlySet == NO
|
if ([[NSView focusView] isFlipped] || flip_hack)
|
||||||
&& ([[NSView focusView] isFlipped] || flip_hack))
|
|
||||||
[context GSSetFont: [[self _flippedViewFont] fontRef]];
|
[context GSSetFont: [[self _flippedViewFont] fontRef]];
|
||||||
else
|
else
|
||||||
[context GSSetFont: [self fontRef]];
|
[context GSSetFont: [self fontRef]];
|
||||||
|
@ -1093,7 +1074,6 @@ static BOOL flip_hack;
|
||||||
return self;
|
return self;
|
||||||
return AUTORELEASE([placeHolder initWithName: fontName
|
return AUTORELEASE([placeHolder initWithName: fontName
|
||||||
matrix: matrix
|
matrix: matrix
|
||||||
fix: matrixExplicitlySet
|
|
||||||
screenFont: NO
|
screenFont: NO
|
||||||
role: role]);
|
role: role]);
|
||||||
}
|
}
|
||||||
|
@ -1110,7 +1090,6 @@ static BOOL flip_hack;
|
||||||
if (cachedScreenFont == nil)
|
if (cachedScreenFont == nil)
|
||||||
cachedScreenFont = [placeHolder initWithName: fontName
|
cachedScreenFont = [placeHolder initWithName: fontName
|
||||||
matrix: matrix
|
matrix: matrix
|
||||||
fix: matrixExplicitlySet
|
|
||||||
screenFont: YES
|
screenFont: YES
|
||||||
role: role];
|
role: role];
|
||||||
return AUTORELEASE(RETAIN(cachedScreenFont));
|
return AUTORELEASE(RETAIN(cachedScreenFont));
|
||||||
|
@ -1305,6 +1284,7 @@ static BOOL flip_hack;
|
||||||
if (role == 0)
|
if (role == 0)
|
||||||
{
|
{
|
||||||
float fontMatrix[6];
|
float fontMatrix[6];
|
||||||
|
BOOL fix = NO;
|
||||||
|
|
||||||
fontMatrix[0] = matrix[0];
|
fontMatrix[0] = matrix[0];
|
||||||
fontMatrix[1] = matrix[1];
|
fontMatrix[1] = matrix[1];
|
||||||
|
@ -1314,7 +1294,7 @@ static BOOL flip_hack;
|
||||||
fontMatrix[5] = matrix[5];
|
fontMatrix[5] = matrix[5];
|
||||||
[aCoder encodeObject: fontName];
|
[aCoder encodeObject: fontName];
|
||||||
[aCoder encodeArrayOfObjCType: @encode(float) count: 6 at: fontMatrix];
|
[aCoder encodeArrayOfObjCType: @encode(float) count: 6 at: fontMatrix];
|
||||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &matrixExplicitlySet];
|
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &fix];
|
||||||
}
|
}
|
||||||
else if (role & 1)
|
else if (role & 1)
|
||||||
{
|
{
|
||||||
|
@ -1363,7 +1343,6 @@ static BOOL flip_hack;
|
||||||
id name;
|
id name;
|
||||||
float fontMatrix[6];
|
float fontMatrix[6];
|
||||||
CGFloat cgMatrix[6];
|
CGFloat cgMatrix[6];
|
||||||
BOOL fix;
|
|
||||||
int the_role;
|
int the_role;
|
||||||
|
|
||||||
if (version == 3)
|
if (version == 3)
|
||||||
|
@ -1387,17 +1366,10 @@ static BOOL flip_hack;
|
||||||
|
|
||||||
if (version >= 2)
|
if (version >= 2)
|
||||||
{
|
{
|
||||||
|
BOOL fix;
|
||||||
[aDecoder decodeValueOfObjCType: @encode(BOOL)
|
[aDecoder decodeValueOfObjCType: @encode(BOOL)
|
||||||
at: &fix];
|
at: &fix];
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
if (fontMatrix[0] == fontMatrix[3]
|
|
||||||
&& fontMatrix[1] == 0.0 && fontMatrix[2] == 0.0)
|
|
||||||
fix = NO;
|
|
||||||
else
|
|
||||||
fix = YES;
|
|
||||||
}
|
|
||||||
|
|
||||||
cgMatrix[0] = fontMatrix[0];
|
cgMatrix[0] = fontMatrix[0];
|
||||||
cgMatrix[1] = fontMatrix[1];
|
cgMatrix[1] = fontMatrix[1];
|
||||||
|
@ -1407,7 +1379,6 @@ static BOOL flip_hack;
|
||||||
cgMatrix[5] = fontMatrix[5];
|
cgMatrix[5] = fontMatrix[5];
|
||||||
self = [self initWithName: name
|
self = [self initWithName: name
|
||||||
matrix: cgMatrix
|
matrix: cgMatrix
|
||||||
fix: fix
|
|
||||||
screenFont: NO
|
screenFont: NO
|
||||||
role: RoleExplicit];
|
role: RoleExplicit];
|
||||||
if (self)
|
if (self)
|
||||||
|
|
Loading…
Reference in a new issue