[Drawkit] changing font
James Maxwell
jbmaxwell at rubato-music.com
Thu Jun 26 18:28:15 PDT 2008
On 26-Jun-08, at 6:04 PM, Graham Cox wrote:
>
> On 27 Jun 2008, at 7:19 am, James Maxwell wrote:
>
>> Okay, false alarm... I found the problem. Kind of strange, though.
>> I had set the font variable in my init code using a simple
>> assignment. When I changed this to using the actual accessor -
>> setGlyphFont: it worked properly. Does anybody understand why that
>> would be? I'm glad I solved the problem, but it's a little
>> disconcerting that I don't actually know *why* my solution
>> worked. :-\
>
>
> I assume this is a method you wrote, since it's not part of Cocoa
> nor DrawKit. So without seeing that code, I have no idea.
Yes, I wrote that method. I had a setFont method, but it came up with
the blue font in xCode, so I figured it was being found in some super
class somewhere... Anyway, it's working, so I'm not going to worry
about it.
>
>
>> My best guess is that some super class uses Helvetica as a default
>> (maybe NSObject holds a reference to some system font, somewhere?).
>> Anyway, problem solved, for now.
>
> No, NSObject doesn't. But certainly some styles in DK do have text
> and font attributes that use Helvetica as a default (though usually
> at 18pt). However unless you are using these on purpose I'm not sure
> why they would interfere with the normal process of creating shapes
> and so on.
Well, I thought maybe it was from a style, but I'm really not sure how
it could have got there. I'll worry about it if it comes up again, but
it's fine for now.
>
>
>>
>> On another note, I'm trying to refine this process of using glyphs
>> for objects - these are all music notation objects, taken from a
>> free music font - and I have one big question. Does anyone know if
>> there's a simple way to have a DKDrawableShape adopt the bounds of
>> a glyph? I'm finding I'm tweaking around a lot with these glyphs,
>> trying to get them to draw properly, and to fit within the
>> selection bounds of my DKDrawableShape, but it seems like there
>> must be an easier way.
>
>
> Once you have a glyph as a bezier path, it is simply a path, with no
> special properties that link it to a font or other textual
> information. If you create the shape with that path (there are
> convenience constructors to do this, for example
> +drawableShapeWithBezierPath:) the bounds of the shape will be set
> up as needed. Normally you don't have to fiddle about to get this to
> work, so it sounds like you're doing too much or perhaps not
> constructing the shape in the most straightforward manner. Again
> it's hard to advise without seeing the code in question.
Okay, I don't see +drawableShapeWithBezierPath: but there is
+drawableShapeWithPath:, which I'm assuming is what you mean. I'll
give that a try later. I was basically hand-building my path from the
glyph, using -appendBezierPathWithGlyph:, then using -setPath: from
DK, but as I say, that leaves me to mess around with the bounds...
I'll try the convenience method a little later.
Thanks,
J.
>
>
> cheers, Graham
> _______________________________________________
> Drawkit mailing list
> Drawkit at lists.apptree.net
> http://lists.apptree.net/listinfo.cgi/drawkit-apptree.net
More information about the Drawkit
mailing list