I have a checkbox (CreateCheckBoxControl) that I want to have bold text:

   CTFontUIFontType UIFontType = 
HIThemeGetUIFontType(kThemeEmphasizedSystemFont);
   CTFontRef font = CTFontCreateUIFontForLanguage(UIFontType, 0.0, NULL);
   HIViewSetTextFont(mButtonControl, kHIViewEntireView, font);

If I for checking call
   HIViewGetThemeTextInfo(mButtonControl, kHIViewEntireView, 
kHIThemeTextInfoVersionOne, &TextInfo);
before and after the above code, then I see
   before: TextInfo.fontID = kThemeSystemFont
   before: TextInfo.font = NULL
   after: TextInfo.fontID = kThemeSpecifiedFont
   after: TextInfo.font = <the font from CTFontCreateUIFontForLanguage above>


The problem arises when I want to align the checkbox and ask for its size:

0   com.apple.CoreFoundation            0x944e307d CFRetain + 125
1   com.apple.HIToolbox                 0x93cf7b45 
TThemeSpecifiedFont::CopyCTFontRef(__CTFont const**) const + 25
2   com.apple.HIToolbox                 0x93ca9da9 
TThemeFont::GetFontMetricsForThemeFont(FontInfo*) const + 33
3   com.apple.HIToolbox                 0x93cf50c4 
DataEngine::GetQDFontInfo(HIThemeTextInfo*, unsigned long, FontInfo*, Rect*, 
unsigned char*) + 84
4   com.apple.HIToolbox                 0x93ca9d74 GetThemeFontInfo + 126
5   com.apple.HIToolbox                 0x93d20573 
HICheckBox::GetOptimalSizeSelf(CGSize*, float*) + 275
6   com.apple.HIToolbox                 0x93caa9c3 
HIView::SendGetOptimalBounds(CGRect*, float*, CGSize*) + 371
7   com.apple.HIToolbox                 0x93caa827 
HIView::GetOptimalSize(CGSize*, float*, CGSize*) + 39
8   com.apple.HIToolbox                 0x93d0f3d8 HIViewGetOptimalBounds + 75
9   com.mycomp.myproduct                0x001e9502 
MyButtonC::GetPreferredSize(int, int*, int*) + 898 (MyButton.C:1538)

It has worked well until macOS Sierra.
/Lars
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Carbon-dev mailing list      (Carbon-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/carbon-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to