Re: Why are Monaco, Courier not showing up as fixed pitch?
Re: Why are Monaco, Courier not showing up as fixed pitch?
- Subject: Re: Why are Monaco, Courier not showing up as fixed pitch?
- From: John DeSoi <email@hidden>
- Date: Sun, 19 Dec 2004 13:04:38 -0500
On Dec 16, 2004, at 12:39 PM, Dan Wood - Discussion Lists wrote:
Not fixed pitch? What's going on? I'm pretty sure this call used to
work, maybe pre-Panther. Maybe it's the mysterious "NSCGSFont" that
is the actual runtime class of the NSFont created. Any explanations?
I ran into this in working with the Macintosh version of LispWorks
(explanation from LispWorks tech support below). Apparently, not all
glyphs are the same size in Courier. And there does seem to be a bug in
10.3 that some fonts don't return the correct value for isFixedPitch
(Monaco).
Best,
John DeSoi, Ph.D.
http://pgedit.com/
Power Tools for PostgreSQL
====
It looks like there are a number of non-standard width glyphs in
Courier (on a 10.2 system here). You can check this by:
(defun print-not-fixed (name size &optional (char #\l))
(loop with nsfont = (objc:invoke "NSFont"
"fontWithName:size:"
name
(coerce size 'single-float))
with base-width = (objc:invoke nsfont "widthOfString:"
(string char))
initially (format t "base width is ~D~%" base-width)
for code from 32 below char-code-limit
for width = (objc:invoke nsfont "widthOfString:"
(string (code-char code)))
unless (eql base-width width)
do (format t "~D is ~D~%" code width base-width)))
In contrast, Courier New is fixed pitch according to this test and
CAPI:PROMPT-FOR-FONT agrees.
Just for completeness, let me mention that on Mac OS X 10.3, the Cocoa
API "isFixedPitch" returns null for some fixed pitch fonts and so
LispWorks has the variable GP::*COCOA-FONT-FIXED-PITCH-FAMILIES* and a
heuristic algorithm to detect fixed-pitchness as a workaround for that
problem. GP::*COCOA-FONT-FIXED-PITCH-FAMILIES* can be altered to
affect the GP:FONT object returned by CAPI:PROMPT-FOR-FONT, and so
force Courier to appear to be fixed pitch to the CAPI. But given what
we've just learned about Courier I don't think that's a good idea.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden