[Q] Activating and deactivating fonts
[Q] Activating and deactivating fonts
- Subject: [Q] Activating and deactivating fonts
- From: Mark de Jong <email@hidden>
- Date: Sun, 29 Sep 2002 21:53:53 -0700
Hi,
I'm having some strange crashes and I think it's because of the way I'm
trying to use fonts.
Currently, if I want to display a font that is not available from the
font manager, I try to enable the font with:
err = FMActivateFonts( &myFontFSSpec, NULL, NULL,
globalScope ? kFMGlobalActivationContext : kFMLocalActivationContext);
where "globalScope" is a boolean I pass in to my routine and
"myFontFSSpec" is an FSSpec pointing to the font I want to use.
I'm trying to display a list of font names in an NSOutlineView. I'd
like each name to be displayed in its font.
From what I understand, it seems like I should use
"kFMLocalActivationContext" when calling "FMActivateFonts()" so that
the font does not get enabled for the entire system. However,
regardless of whether I use "kFMLocalActivationContext" or
"kFMGlobalActivationContext", I get the crash shown below.
The crash seems to occur if I enable many fonts. The specific font does
not seem to matter (but I guess it could; I have a mix of Type1,
TrueType, Windows TTF, and OpenType fonts that I'm working with).
My question is: do fonts have to be enabled with FMActivateFonts()
before they can be used? Or is there a different way to enable fonts
that just need to be used within an application?
Along similar lines, is there a way to accurately determine the set of
activated fonts? I've tried using the NSFontManager message
"availableFonts". However, "availableFonts" does not seem to reflect
any changes made by calling either "FMActivateFonts()" or
"FMDeactivateFonts()".
Thanks, in advance, for any suggestions,
-- Mark
Exception: EXC_BAD_ACCESS (0x0001)
Codes: KERN_INVALID_ADDRESS (0x0001) at 0x03b6c04c
Thread 0 Crashed:
#0 0x919404c8 in ProcessKerningPairsList
#1 0x91937384 in ApplyKerning
#2 0x91933698 in _eLLCLayoutText
#3 0x91939364 in LLCLayoutText
#4 0x933d3c50 in -[NSATSTypesetter
layoutGlyphsInLayoutManager:startingAtGlyphIndex:maxNumberOfLineFragment
s:nextGlyphIndex:]
#5 0x931e86e8 in -[NSLayoutManager(NSPrivate)
_fillLayoutHoleAtIndex:desiredNumberOfLines:]
#6 0x931f7990 in
_NSFastFillAllLayoutHolesUpToEndOfContainerForGlyphIndex
#7 0x931e07ac in -[NSLayoutManager
textContainerForGlyphAtIndex:effectiveRange:]
#8 0x931e1bf0 in -[NSLayoutManager glyphRangeForTextContainer:]
#9 0x93112d18 in textContainerForTextCell
#10 0x93112f20 in _NXDrawTextCell
#11 0x932f0d4c in -[NSTextFieldCell drawInteriorWithFrame:inView:]
#12 0x932d14e0 in -[NSTableView drawRow:clipRect:]
#13 0x9323f11c in -[NSOutlineView drawRow:clipRect:]
#14 0x932d4b2c in -[NSTableView drawRect:]
#15 0x9335b6c4 in -[NSView _drawRect:clip:]
#16 0x9335bee8 in -[NSView
_recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisible
RectForView:topView:]
#17 0x9335c108 in -[NSView
_recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisible
RectForView:topView:]
#18 0x9335c108 in -[NSView
_recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisible
RectForView:topView:]
#19 0x9335c108 in -[NSView
_recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisible
RectForView:topView:]
#20 0x9335c108 in -[NSView
_recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisible
RectForView:topView:]
#21 0x9335c108 in -[NSView
_recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisible
RectForView:topView:]
#22 0x9335c108 in -[NSView
_recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisible
RectForView:topView:]
#23 0x9335c108 in -[NSView
_recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisible
RectForView:topView:]
#24 0x9335c108 in -[NSView
_recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisible
RectForView:topView:]
#25 0x931a3640 in -[NSFrameView
_recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisible
RectForView:topView:]
#26 0x93321a14 in -[NSThemeFrame
_recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisible
RectForView:topView:]
#27 0x9335c314 in -[NSView
_displayRectIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:]
#28 0x9335cef8 in -[NSView displayIfNeeded]
#29 0x9336a188 in -[NSWindow displayIfNeeded]
#30 0x93369e8c in _handleWindowNeedsDisplay
#31 0x90148b1c in __CFRunLoopDoObservers
#32 0x90148e8c in __CFRunLoopRun
#33 0x9018157c in CFRunLoopRunSpecific
#34 0x92ba34cc in RunCurrentEventLoopInMode
#35 0x92bb326c in ReceiveNextEventCommon
#36 0x92bda280 in BlockUntilNextEventMatchingListInMode
#37 0x93082184 in _DPSNextEvent
#38 0x930ccf84 in -[NSApplication
nextEventMatchingMask:untilDate:inMode:dequeue:]
#39 0x930ca500 in -[NSApplication run]
#40 0x930d2598 in NSApplicationMain
#41 0x000046a4 in main (main.m:18)
#42 0x000043b8 in _start (crt.c:267)
#43 0x00004228 in start
PPC Thread State:
srr0: 0x919404c8 srr1: 0x0200f030 vrsave: 0x00000000
xer: 0x20000000 lr: 0x10000000 ctr: 0x900741a0 mq: 0x00000000
r0: 0x00000000 r1: 0xbfffce60 r2: 0x28002242 r3: 0x00000023
r4: 0x0391c02b r5: 0x00000000 r6: 0x00000010 r7: 0x00000010
r8: 0x00000008 r9: 0x00000001 r10: 0x00000000 r11: 0x00250025
r12: 0x900741a0 r13: 0x00000000 r14: 0x036d5890 r15: 0x00000000
r16: 0x00000800 r17: 0x00000000 r18: 0xbfffd020 r19: 0x036c6550
r20: 0x00000000 r21: 0x00000001 r22: 0x03b6c048 r23: 0x00000000
r24: 0x00000014 r25: 0x00000025 r26: 0x00000000 r27: 0xbfffd020
r28: 0x036ce834 r29: 0x038430d0 r30: 0x00000000 r31: 0x919403b4
_______________________________________________
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.