glyphs in Cocoa
Arthur Cater <[email protected]>
| Newsgroups | gmane.lisp.openmcl.devel |
|---|---|
| Message-ID | <[email protected]> |
Kindly indulge any rambling. I’m frustrated by glyphs on mac os x. So many Objective-C methods are deprecated. And I’m so ignorant.
NSGlyphs seem to be integers, in my experience with a Menlo-Regular font the glyph is 29 less than the ascii character code.
So I wondered (but this isn’t the main thrust of this message) when I came across this in cocoa-editor.lisp whether the use of (char-code #\space) was going to give the appropriate result.
(defun size-of-char-in-font (f)
(let* ((sf (#/screenFont f))
(screen-p *use-screen-fonts*))
(if (%null-ptr-p sf) (setq sf f screen-p nil))
(let* ((layout (#/autorelease (#/init (#/alloc ns:ns-layout-manager)))))
(#/setUsesScreenFonts: layout screen-p)
(values (fround (#/defaultLineHeightForFont: layout sf))
(fround (ns:ns-size-width (#/advancementForGlyph: sf (char-code #\space))))))))
Also, like so many, #/advancementForGlyph is a deprecated method.
So is #/appendBezierPathWithGlyph:inFont: which is what I’ve found to almost-work for what I want to do. I say almost-work because whenever I’ve used it, and then I quit ccl with cmd-Q, I get the distinctly odd dialog telling me that CCL has unexpectedly quit.
From Apple docs I have the feeling I should be using appendBezierPathWithCGGlyph:inFont: (note the CG). but #/appendBezierPathWithCGGlyph:inFont: doesn’t seem to name a function. Is there something special about CG?
Any help appreciated.
Arthur