- {
- // we try to get as much styles as possible into ATSU
-
- OSStatus status = ::ATSUCreateStyle(&m_macATSUStyle);
- wxASSERT_MSG( status == noErr , wxT("couldn't create ATSU style") );
-
- ATSUAttributeTag atsuTags[] =
- {
- kATSUFontTag ,
- kATSUSizeTag ,
- kATSUVerticalCharacterTag,
- kATSUQDBoldfaceTag ,
- kATSUQDItalicTag ,
- kATSUQDUnderlineTag ,
- kATSUQDCondensedTag ,
- kATSUQDExtendedTag ,
- };
- ByteCount atsuSizes[sizeof(atsuTags) / sizeof(ATSUAttributeTag)] =
- {
- sizeof( ATSUFontID ) ,
- sizeof( Fixed ) ,
- sizeof( ATSUVerticalCharacterType),
- sizeof( Boolean ) ,
- sizeof( Boolean ) ,
- sizeof( Boolean ) ,
- sizeof( Boolean ) ,
- sizeof( Boolean ) ,
- };
-
- Boolean kTrue = true ;
- Boolean kFalse = false ;
-
- Fixed atsuSize = IntToFixed( m_info.m_pointSize );
- ATSUVerticalCharacterType kHorizontal = kATSUStronglyHorizontal;
- FMFontStyle addQDStyle = m_info.m_atsuAdditionalQDStyles;
- ATSUAttributeValuePtr atsuValues[sizeof(atsuTags) / sizeof(ATSUAttributeTag)] =
- {
- &m_info.m_atsuFontID ,
- &atsuSize ,
- &kHorizontal,
- (addQDStyle & bold) ? &kTrue : &kFalse ,
- (addQDStyle & italic) ? &kTrue : &kFalse ,
- (addQDStyle & underline) ? &kTrue : &kFalse ,
- (addQDStyle & condense) ? &kTrue : &kFalse ,
- (addQDStyle & extend) ? &kTrue : &kFalse ,
- };
-
- status = ::ATSUSetAttributes(
- (ATSUStyle)m_macATSUStyle,
- sizeof(atsuTags) / sizeof(ATSUAttributeTag) ,
- atsuTags, atsuSizes, atsuValues);
-
- wxASSERT_MSG( status == noErr , wxT("couldn't modify ATSU style") );
- if ( m_cgFont.get() == NULL )
- {
- ATSFontRef fontRef = FMGetATSFontRefFromFont(m_info.m_atsuFontID);
- m_cgFont.reset( CGFontCreateWithPlatformFont( &fontRef ) );
- }
- }