NSFont text matrix fix for unflipped contexts

This commit is contained in:
Christopher Lloyd 2010-10-28 21:48:39 -04:00
parent b0738796ac
commit a283871c99
2 changed files with 27 additions and 9 deletions

View File

@ -80,8 +80,7 @@ static NSFont **_fontCache=NULL;
}
+(float)smallSystemFontSize {
NSUnimplementedMethod();
return 0;
return 10.0;
}
+(float)labelFontSize {
@ -89,8 +88,17 @@ static NSFont **_fontCache=NULL;
}
+(float)systemFontSizeForControlSize:(NSControlSize)size {
NSUnimplementedMethod();
return 0;
switch(size){
default:
case NSRegularControlSize:
return 13.0;
case NSSmallControlSize:
return 11.0;
case NSMiniControlSize:
return 9.0;
}
}
+(NSFont *)boldSystemFontOfSize:(float)size {
@ -512,12 +520,15 @@ arrayWithArray:[_name componentsSeparatedByString:blank]];
CGContextSetFont(cgContext,_cgFont);
CGContextSetFontSize(cgContext,_pointSize);
CGAffineTransform textMatrix;
// FIX, should check the focusView in the context instead of NSView's
if([[NSGraphicsContext currentContext] isFlipped]){
CGAffineTransform flip={1,0,0,-1,0,0};
CGContextSetTextMatrix(cgContext,flip);
}
if([[NSGraphicsContext currentContext] isFlipped])
textMatrix=(CGAffineTransform){1,0,0,-1,0,0};
else
textMatrix=CGAffineTransformIdentity;
CGContextSetTextMatrix(cgContext,textMatrix);
}
-(void)set {

View File

@ -138,7 +138,14 @@
isa = PBXProject;
buildConfigurationList = FE1FBFF511E7804C00A9A87A /* Build configuration list for PBXProject "Cocotron" */;
compatibilityVersion = "Xcode 2.4";
developmentRegion = English;
hasScannedForEncodings = 0;
knownRegions = (
English,
Japanese,
French,
German,
);
mainGroup = FE1FBFF011E7804C00A9A87A;
projectDirPath = "";
projectReferences = (