Re: NSTextView Font Substitution
Re: NSTextView Font Substitution
- Subject: Re: NSTextView Font Substitution
- From: Jens Alfke <email@hidden>
- Date: Sun, 18 May 2008 09:49:26 -0700
On 17 May '08, at 6:36 AM, Gerriet M. Denkmann wrote:
I have an NSTextView with no "Multiple fonts allowed" (isRichText =
NO).
The font is the userFixedPitchFontOfSize: 0 (Monaco 10 pt).
But when I insert a THAI CHARACTER SARA E (Unicode 0E40), which has
no glyph in Monaco, a replacement font is used.
Yup. Technically this is glyph substitution, not a change of font, so
it's considered correct behavior even with multiple-fonts disallowed.
This is Lucida Grande, which is not a FixedPitchFont.
So things meant to be in nice columns get all messed up.
But if one has the "Additional Asian Fonts" installed, there is also
Ayuthaya, which, being a FixedPitchFont, would be a much better
replacement.
So: is there a way in Tiger to tell the text system to prefer
FixedPitchFonts?
Not that I know of. But even if there were, there's no reason the
character width in Ayuthaya has to match that of Monaco (or Courier or
Andale Mono or...) so the column layout would probably still get
messed up.
The only real solution would be to customize the layout manager to
force it to use a single width for all glyphs, regardless of font. I
think this could probably be done by subclassing NSLayoutManager, but
I don't know the details.
(Of existing programmers' editors, I know that Xcode uses NSTextView
but supports multiple fonts and so doesn't assume that text will
always be fixed-pitch; while TextMate uses a custom text editing
engine that always uses fixed character spacing.)
—Jens
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden