From: Stefan Csomor Date: Sat, 11 May 2002 06:49:29 +0000 (+0000) Subject: changed initialization of TXN in order to avoid crashes on OSX X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/564bf1eab1658512c450f57fc338a5b0c7d1d4cf changed initialization of TXN in order to avoid crashes on OSX git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@15499 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/mac/carbon/uma.cpp b/src/mac/carbon/uma.cpp index a8f29cbbfd..219a067bb3 100644 --- a/src/mac/carbon/uma.cpp +++ b/src/mac/carbon/uma.cpp @@ -106,12 +106,23 @@ void UMAInitToolbox( UInt16 inMoreMastersCalls ) if ( TXNInitTextension != (void*) kUnresolvedCFragSymbolAddress ) { - TXNMacOSPreferredFontDescription defaults; - defaults.fontID = kFontIDGeneva ; - defaults.pointSize = (10 << 16) ; - defaults.fontStyle = kTXNDefaultFontStyle; - defaults.encoding = kTXNSystemDefaultEncoding; - TXNInitTextension(&defaults, 1, (kTXNAlwaysUseQuickDrawTextMask | kTXNWantMoviesMask | kTXNWantSoundMask | kTXNWantGraphicsMask)); + FontFamilyID fontId ; + Str255 fontName ; + SInt16 fontSize ; + Style fontStyle ; + GetThemeFont(kThemeSmallSystemFont , GetApplicationScript() , fontName , &fontSize , &fontStyle ) ; + GetFNum( fontName, &fontId ); + + TXNMacOSPreferredFontDescription fontDescriptions[] = + { + { fontId , (fontSize << 16) ,kTXNDefaultFontStyle, kTXNSystemDefaultEncoding } , + } ; + int noOfFontDescriptions = sizeof( fontDescriptions ) / sizeof(TXNMacOSPreferredFontDescription) ; +#if TARGET_CARBON + --noOfFontDescriptions ; +#endif + // kTXNAlwaysUseQuickDrawTextMask might be desirable because of speed increases but it crashes the app under OS X upon key stroke + TXNInitTextension(fontDescriptions, noOfFontDescriptions, ( kTXNWantMoviesMask | kTXNWantSoundMask | kTXNWantGraphicsMask)); } long menuMgrAttr ; diff --git a/src/mac/uma.cpp b/src/mac/uma.cpp index a8f29cbbfd..219a067bb3 100644 --- a/src/mac/uma.cpp +++ b/src/mac/uma.cpp @@ -106,12 +106,23 @@ void UMAInitToolbox( UInt16 inMoreMastersCalls ) if ( TXNInitTextension != (void*) kUnresolvedCFragSymbolAddress ) { - TXNMacOSPreferredFontDescription defaults; - defaults.fontID = kFontIDGeneva ; - defaults.pointSize = (10 << 16) ; - defaults.fontStyle = kTXNDefaultFontStyle; - defaults.encoding = kTXNSystemDefaultEncoding; - TXNInitTextension(&defaults, 1, (kTXNAlwaysUseQuickDrawTextMask | kTXNWantMoviesMask | kTXNWantSoundMask | kTXNWantGraphicsMask)); + FontFamilyID fontId ; + Str255 fontName ; + SInt16 fontSize ; + Style fontStyle ; + GetThemeFont(kThemeSmallSystemFont , GetApplicationScript() , fontName , &fontSize , &fontStyle ) ; + GetFNum( fontName, &fontId ); + + TXNMacOSPreferredFontDescription fontDescriptions[] = + { + { fontId , (fontSize << 16) ,kTXNDefaultFontStyle, kTXNSystemDefaultEncoding } , + } ; + int noOfFontDescriptions = sizeof( fontDescriptions ) / sizeof(TXNMacOSPreferredFontDescription) ; +#if TARGET_CARBON + --noOfFontDescriptions ; +#endif + // kTXNAlwaysUseQuickDrawTextMask might be desirable because of speed increases but it crashes the app under OS X upon key stroke + TXNInitTextension(fontDescriptions, noOfFontDescriptions, ( kTXNWantMoviesMask | kTXNWantSoundMask | kTXNWantGraphicsMask)); } long menuMgrAttr ;