[Q] Using fonts in NSTextView
[Q] Using fonts in NSTextView
- Subject: [Q] Using fonts in NSTextView
- From: Mark de Jong <email@hidden>
- Date: Mon, 21 Oct 2002 08:26:19 -0700
Hi!
Sorry about the cross-post. The question has to do with both carbon and
cocoa.
Any font manipulation experts out there? I need some help managing
fonts.
I'm getting a crash in NSTextView that is due to fonts being activated
and deactivated (using either the FontManager calls
(FMActivateFonts()/FMDeactivateFonts()) or the ATS calls
(ATSFontActivateFromFileSpecification()/
ATSFontDeactivateFromFileSpecification)).
When calling the activate and deactivate functions, one parameter
specifies whether the font is to be activated/deactivated locally (only
for this application) or globally (for all applications).
So, the following sequence of calls will cause NSTextView to crash:
[1] User selects a font and clicks a button to make it available to
his other apps. I call FMActivateFonts() with the "global
activate" option.
[2] User displays some sample text of this font in an NSTextView. In
order to make this font available to the NSTextView,
I call FMActivateFonts() with a "local activate" option.
[3] User then clicks the button to deactivate this font globally
(calling FMDeactivateFonts() with the "global deactivate"
option) and when NSTextView next updates itself, it crashes
apparently because the font has been deactivated out from
underneath itself.
In step 2, I've tried not activating locally if the font is already
activated globally with the same results.
My question is: what's the correct way to be able to use a font within
an application and not have the user's global activation/deactivation
affect the font within the app?
Thanks, in advance,
-- Mark
An aside regarding step 3: the docs say the third parameter (iOptions)
should be NULL. However, if I pass in NULL, fonts never get deactivated
globally. If I pass in either kFMGlobalActivationContext, global fonts
do get deactivated. kFMLocalActivationContext is defined as
kFMDefaultActivationContext which is defined as NULL. So, passing null
only deactivates fonts locally.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.