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: Detecting ATS fonts





On Mar 11, 2007, at 11:30 AM, P McIlroy wrote:

I have an application for which I would like to display only ATS (not QD bitmap)
fonts in the Font Panel. Is there a correct way to do this? It appears that routine
calls to ATSFontDeactivate() may not the right thing to do, because it deactivates
fonts globally.

You have no control over what is displayed by the Font Panel. Do you mean your own Font list? If so, you can iterate all fonts in the system using ATSFontIterator calls. This iterator will skip over bitmap fonts.


Which routine is calling ATSFontDeactivate? There are no ATS/QD APIs making use of this call.





Additionally, the return values for ATSUGetIndFontName for a QuickDraw(?) font are very strange.

OSStatus ATSUGetIndFontName(
   ATSUFontID iFontID,
   ItemCount iFontNameIndex,
   ByteCount iMaximumNameLength,
   Ptr oName,
   ByteCount *oActualNameLength,
   FontNameCode *oFontNameCode,
   FontPlatformCode *oFontNamePlatform,
   FontScriptCode *oFontNameScript,
   FontLanguageCode *oFontNameLanguage);


-- function return value is 0 noErr. -- oActualNameLength is some strange number (eg 28 for Courier New) -- Ptr oName contains the empty string. (I think.)

This API takes an index into the name table. You need to know which index to use. You are likely getting a unicode string. Check the value returned in oFontNamePlatform.





I am using the empty string value to detect (bad) QD fonts, but it seems like an inconsistent
set of return values.

I'm not sure why you want to do this but ATSUGetIndFontName is the wrong API to use. Use ATSFontGetPostScriptName. In general, if the font doesn't have a valid postscript name, MacOS X will be unhappy with the font.





_______________________________________________
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

_______________________________________________
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: 
 >Detecting ATS fonts (From: P McIlroy <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.