Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: DrawThemeTextBox mis-renders Symbol, Wingding fonts




On Aug 30, 2007, at 2:22 PM, Jim Prouty wrote:

Laurence Harris <email@hidden> replied:

I'm confused. Your example uses ASCII text, but you say the problem
is with drawing Symbol and Wingdings. It sounds like you're trying to
do a direct conversion of the old technique you were using in your
QuickDraw code. The best thing to do in Mac OS X is to use Unicode
for your text and let DrawThemeTextBox use whatever font it needs for
each character.

Larry

Yes, it's a "direct conversion" attempt. Sorry :-)

A complete rewrite is in the works, but in the short term I'm pressing
DrawThemeTextBox(cfstr, kThemeCurrentPortFont, etc) into service to render
antialiased text (simple strings) in a user-selected (QD) font.


(I'm no Unicode expert, but I'm pretty sure Unicode doesn't specify the
exact font to render Unicode text, otherwise we'd be re-encoding the text
every time a user chose Times New Roman instead of another Roman font like
Bodoni or Futura. I do know that Symbol, etc contain glyphs that Unicode
uses to render standard "unusual" characters such as the mathematical
summation symbol "sigma", etc. But I'll bet there's no Unicode character
defined for most of the glyphs in a Wingdings font.)


However, it's clear from experimentation that changing the string
formulation from:

	CFStringAppendCString(cfstr, "Hello World!",
GetApplicationTextEncoding());

to

	CFStringAppendCString(cfstr, "Hello World!",
GetThemeFontTextEncoding ());

produces different results when that cfstr is passed to DrawThemeTextBox(),
a successful change in the case of Apple's Trutype Symbol font, but not in
the case of any in the Wingding family.


DrawThemeTextBox works well for nearly every other QuickDraw font I set for
the current port.


So I'm hoping there's something obvious to a font/theme expert that's wrong
in my use of DrawThemeTextBox or the CFStringAppendCString encoding (thus
my CC to Deborah Goldsmith).

I think the problem is that you're trying to use characters that rely on an encoding (the old way) instead of using the Unicode values for the characters (the new, true way). If you'll do the latter, then DrawThemeTextBox will automatically use an appropriate font when rendering the text.


Larry
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Carbon-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/carbon-dev/email@hidden

This email sent to email@hidden
References: 
 >DrawThemeTextBox mis-renders Symbol, Wingding fonts (From: Jim Prouty <email@hidden>)
 >Re: DrawThemeTextBox mis-renders Symbol, Wingding fonts (From: Laurence Harris <email@hidden>)
 >Re: DrawThemeTextBox mis-renders Symbol, Wingding fonts (From: Jim Prouty <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.