« Return to Thread: Drawing strings on a line

Drawing strings on a line

by Andreas Höschler :: Rate this Message:

Reply to Author | View in Thread

Hello all,

I am developing a mapping application where I need to draw labels in a
view. Currently I am using (as a first approach)

              [_name drawAtPoint:labelPoint withAttributes:nil];

This works: However, it does not exactly has the desired effect, since
the labels are always drawn horizontally. The labels are actually
street names and the streets are drawn with NSBezierPath stroke.
Ideally I would like the street label to be exactly drawn on the
NSBezierPath which is a connected list of points, but at least to be
drawn with the same angle as the NSBezierPath segment. There is this
NSBezierPath

- (void)appendBezierPathWithGlyphs:(NSGlyph *)glyphs count:(int)count
inFont:(NSFont *)fontObj

method that might be of interest in conjunction with

NSBezierPath *bezierPath = [NSBezierPath bezierPath];
NSAffineTransform *transform = [NSAffineTransform transform];

[bezierPath moveToPoint: NSMakePoint(0.0, 0.0)];
[bezierPath lineToPoint: NSMakePoint(100.0, 100.0)];

[transform translateXBy: 10.0 yBy: 10.0];
[bezierPath transformUsingAffineTransform: transform];

but this means to manually find the glyphs for each character in the
label ([NSFont glyphWithName:]). This probably works on MacOSX, but
does it also work under GNUstep? I am wondering if there is even an
easier approach for accomplishing this!?

Hints are greatly appreciated!

Thanks,

   Andreas







_______________________________________________
Discuss-gnustep mailing list
Discuss-gnustep@...
http://lists.gnu.org/mailman/listinfo/discuss-gnustep

 « Return to Thread: Drawing strings on a line