bug-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Text drawing bug - gaps after 16th character in scaled view


From: Pete French
Subject: Text drawing bug - gaps after 16th character in scaled view
Date: Fri, 27 Jun 2003 11:36:45 +0100

I am trying to draw some text into a scaled view. The view has been scaled
so that the same co-ordinates can always be used for drawing the diagram,
no matter what the actual size of the view is.

I find that if I render text of more than 16 characters then I get a gap
between the 16th and subsequent character. e.g. the text "Isotropic antenna"
appears on the screen as "Isotropic antenn a". This is under back-art. using
the xlib backend the pproblem is far worse and the text appears something
like "Istotropic antenn     a".

The following code fragment will reproduce this. the varibales 'rows'
and 'cols' hold the size of the space to be drawn into. 'theTransform'
is an affine tranfrom and 'attrDict' is an empty mutable dictionary.

        /* scale according to aspect ratio */
        theTransform = [NSAffineTransform transform];
        if ((cols / rows) > (170.0 / 190.0)) {
                float surplus = cols - ((170.0 / 190.0) * rows);
                [theTransform translateXBy:surplus/2.0 yBy:0];
                [theTransform scaleBy:rows/190.0];
        } else {
                float surplus = rows - ((190.0 / 170.0) * cols);
                [theTransform translateXBy:0 yBy:surplus/2.0];
                [theTransform scaleBy:cols/170.0];
        }
        [theTransform concat];

        /* draw the string */
        [[NSColor blackColor] set];
        [attrDict setObject:[NSFont systemFontOfSize:10.0]
                        forKey:NSFontAttributeName];
        [@"Isotropic antenna" drawAtPoint:NSMakePoint(10,30)
                                withAttributes:attrDict];

The bug appears to be related to the font size - if I make the
drawing area twice as big the the text doubles in size but the bug remains.
If I keep the drawing area the same but change the font size from '10'
to '20' however then the text becomes twice as big but the problem goes away!
The expected result would be for the text to be identical in both cases.

-bat. [seems to be my week for finding bugs in the text system]




reply via email to

[Prev in Thread] Current Thread [Next in Thread]