discuss-gnustep
[Top][All Lists]
Advanced

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

Drawing strings on a line


From: Andreas Höschler
Subject: Drawing strings on a line
Date: Wed, 3 Jun 2009 20:19:47 +0200

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







reply via email to

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