• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
[Q] FMDeactivateFonts
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Q] FMDeactivateFonts


  • Subject: [Q] FMDeactivateFonts
  • From: Mark de Jong <email@hidden>
  • Date: Sat, 18 May 2002 23:52:54 -0700

Hi!

I've written a Cocoa application that allows previewing of fonts. I'd like to be able to display fonts regardless of whether they've been activated by the system or not, so I use FMActivateFonts() to activate them and then use FMDeactivateFonts() when I'm done with them.

What I've noticed is that the fonts display fine as long as I never call FMDeactivateFonts(). Once I call FMDeactivateFonts(), and then try to re-activate them and view them, I get an error like this:

----------
Failed to set font ("CGS Helvetica-Bold 15.98 pt. P [] (0x0190fca0) fobj=0x01911840, spc=0.00") ATSUStyle 0x14BF850
----------

When I use gdb to view an NSFont, I notice the following. If FMDeactivateFonts() has not been called, then:

(gdb) po aFont
"CGS Helvetica-Bold 16.00 pt. P [] (0x019528c0) fobj=0x01952440, spc=4.45"

However, as soon as FMDeactivateFonts() has been called on the font and a subsequent FMActivateFonts() is called, I get:

(gdb) po aFont
"CGS Helvetica-Bold 16.00 pt. P [] (0x0193ff90) fobj=0x01951e70, spc=0.00"

and the font displays incorrectly, or sometimes doesn't display at all. It seems to be due to the "spc=0.00" rather than "spc=4.45".

Is there some trick to using FMActivateFonts() and FMDeactivateFonts() correctly? Here's a snippet of code that I use:

...
if( activate ) {
err = FMActivateFonts( &myFontFSSpec, NULL, NULL, globalScope ? kFMUseGlobalScopeOption : kFMDefaultOptions );
}
else {
err = FMDeactivateFonts( &myFontFSSpec, NULL, NULL, kFMDefaultOptions );
}
...

where "activate" and "globalScope" are booleans passed into the method. I have tried the different constant variations for local and global scope without any change in symptom. I have also used "NULL" as the last parameter to FMDeactivateFonts() with no change. Depending on the documentation I have found, the constants passed in these functions have different names.

Thanks, in advance, for any insight you can offer into this dilemma.

-- Mark
_______________________________________________
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.

  • Follow-Ups:
    • Re: [Q] FMDeactivateFonts
      • From: Mark de Jong <email@hidden>
  • Prev by Date: Re: can PB boilerplate text be changed?
  • Next by Date: Re: didEndShouldCloseSheet
  • Previous by thread: Re: Checkbox as title for NSBox
  • Next by thread: Re: [Q] FMDeactivateFonts
  • Index(es):
    • Date
    • Thread