Mon 19 Jul 2010 11:20:25 PM UTC, original submission:
The text in the description of the above method that "Fonts created with a matrix other than NSFontIdentityMatrix don't automatically flip themselves in flipped views." is incorrect.
At least for the case of using a matrix like [X 0 S Y 0 0], where S allows for obliqing a roman font.
For OSX (10.6 anyway, I'll check 10.4/10.5 later), the font is automatically flipped. Similarly for OS4.2 the font is automatically flipped if one prevents the use of screen fonts.
The fix is simple and obvious - removing the test on matrixExplicitlySet within -[NSFont setInContext:].
@@ -990,8 +989,7 @@ static BOOL flip_hack;
- (void) setInContext: (NSGraphicsContext*)context
{
- if (matrixExplicitlySet == NO
- && ([[NSView focusView] isFlipped] || flip_hack))
+ if ([[NSView focusView] isFlipped] || flip_hack)
[context GSSetFont: [[self _flippedViewFont] fontRef]];
else
[context GSSetFont: [self fontRef]];
However doing so renders that field more or less useless, so it can probably be eliminated. It then also looks like this would also allow the third argument of
- (id) initWithName: (NSString*)name
matrix: (const CGFloat*)fontMatrix
fix: (BOOL)explicitlySet
screenFont: (BOOL)screenFont
role: (int)role;
to be eliminated.
The above change allows the art backend to operate in the same fashion as OSX.
However for the cairo backend, while it now displays text upright, the effect of manually obliquing text is wrong - text that should lean to the right ends up leaning to the left.
|