bugGNUstep - Bugs: bug #30493, -[NSFont fontWithName:matrix:]...

 
 

You are not allowed to post comments on this tracker with your current authentification level.

bug #30493: -[NSFont fontWithName:matrix:] does not match OSX when in a flipped view

Submitted by:  Derek Fawcus <dfawcus>
Submitted on:  Mon 19 Jul 2010 11:20:25 PM UTC  
 
Category: Gui/AppKitSeverity: 3 - Normal
Item Group: BugStatus: In Progress
Privacy: PublicAssigned to: Fred Kiefer <FredKiefer>
Open/Closed: Open

(Jump to the original submission Jump to the original submission)

Mon 31 Dec 2012 05:40:57 PM UTC, comment #6:

I made the change you originally suggested and also tried to fix the slanting direction in cairo. The later change may not be complete, maybe we also need to invert matrix[1]?

I will keep this bug report open, to look into the other issues as well.

Fred Kiefer <FredKiefer>
Project MemberIn charge of this item.
Sat 31 Jul 2010 01:32:24 AM UTC, comment #5:

I also made a version of the test app that uses the new (since OSX 10.4) Font affine transform method. It produces identical results to the matrix method. Suggesting both have the same underlying code.

An interesting point is that there is no note against the affine transform method cautioning use in flipped views, so I'd guess that now means the caution on matrix method can be considered to have be obsolete.

Sadly, the OSX behaviour on laying out vertically rotated glyphs is not particularly useful. This may simply be a limitation of the default horizontal typesetter. I don't know if things would get any better if I tried applying a transform to the view itself. But anyway, it does manage to rotate the glyph.

One can note that OSX pays no attention to the translation part of the matrix. Also that it always keeps the text horizontal, whereas GNUstep seems to adjust the text baseline. So probably a couple of other things to fix.

Derek Fawcus <dfawcus>
Sat 31 Jul 2010 01:11:44 AM UTC, comment #4:

Attached are the images that result from the Cairo and Art backend after applying my change, these can be compared to the before image.

So Fred, what do you see when executing the test app?

(file #21112)

Derek Fawcus <dfawcus>
Sat 31 Jul 2010 12:55:04 AM UTC, comment #3:

Attached is the test application I cobbled together, together with the output generated under OSX, OPENSTEP and GNUstep.

For OPENSTEP the image window was made slightly larger.

There are image captures for the GNUstep art and cairo backends, I didn't bother with the xlib backend (all it can do is scale).

There are two images for art, the initial image is before-art-1.xwd, which changes to before-art-2.xwd when the window is selected.

The OSX file is a png, the OPENSTEP one a tiff, and the GNUstep files output from the xwd program (use xwud to display). The ImageMagic 'display' program can cope with all of these formats.

The upper (red) view is flipped, the lower (blue) view is not.

(file #21110, file #21111)

Derek Fawcus <dfawcus>
Tue 27 Jul 2010 08:58:19 AM UTC, comment #2:

I've been meaning to create an isolated test app for this.

I'm think a window with two sub-views, one flipped, the other not. Then have the same set of strings/fonts displayed in each so as to see how they act.

So, let me do that and update again.

Derek Fawcus <dfawcus>
Mon 26 Jul 2010 08:33:49 PM UTC, comment #1:

Sory for taking so long to reply to this item. The whole font issue is something that would require more attention in GNUstep. And with your change in place it would seem as if we only ever instantiate flipped fonts. (most views are flipped or the strange flip_hack is used)
As for cairo slanting in the wrong direction, here a short example would be helpful.

Fred Kiefer <FredKiefer>
Project MemberIn charge of this item.
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.

Derek Fawcus <dfawcus>

 

Attached Files
file #21112:  Images-after.tar.gz added by dfawcus (116kB - application/x-gzip - Cairo and Art generated images after my change to gui.)
file #21110:  matrix.tar.gz added by dfawcus (6kB - application/x-gzip - Test application and images from OSX, OPENSTEP, GNUstep)
file #21111:  Images.tar.gz added by dfawcus (201kB - application/x-gzip - Test application and images from OSX, OPENSTEP, GNUstep)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by FredKiefer (Posted a comment)
  • -unavailable- added by dfawcus (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 5 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Mon 31 Dec 2012 05:40:57 PM UTCFredKieferStatusNone=>In Progress
      Assigned toNone=>FredKiefer
    Sat 31 Jul 2010 01:11:44 AM UTCdfawcusAttached File-=>Added Images-after.tar.gz, #21112
    Sat 31 Jul 2010 12:55:04 AM UTCdfawcusAttached File-=>Added matrix.tar.gz, #21110
      Attached File-=>Added Images.tar.gz, #21111

    Back to the top


    Powered by Savane 3.1-cleanup