As one of my first Cocoa programs, I've made an application to draw maps in a View. To add some labels in the drawing (made using the NSBezierPath class), I used NSGlyph to draw them, using the code below. It works, but the rendered characters look ugly, they look like a bad photocopy, and have inconsistent sizes (even with the same character, some seem thinner then others).
I would very much appreciate some tips to get this right...
I would very much appreciate some tips to get this right...
Code:
NSFont *font = [NSFont fontWithName:@"Times New Roman" size: (int)(0.007 * fontsize_items * bounds.size.width)];
textPoint.x = 0.05 * bounds.size.width + 0.3 * bounds.size.width;
textPoint.y = legend_itemPoint.y - 0.18 * bound.size.height;
for (l = 0; l < strlen(legend_text); l++)
{
NSGlyph text = [font _defaultGlyphForChar: legend_text[l]];
[text_path moveToPoint:textPoint];
[text_path appendBezierPathWithGlyph:text inFont:font];
[ltext_path setLineWidth:(0.0001 * fontsize_items * bounds.size.width)];
[[NSColor blackColor] set];
[text_path fill];
textPoint.x += (0.0035 * fontsize_items * bounds.size.width);
}