135 #if defined(QT_MAC_USE_COCOA) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5 143 QString foundry_name =
"CoreText";
144 const int numFonts = CFArrayGetCount(fonts);
145 for(
int i = 0; i < numFonts; ++i) {
146 CTFontDescriptorRef font = (CTFontDescriptorRef)CFArrayGetValueAtIndex(fonts, i);
147 QCFString family_name = (
CFStringRef)CTFontDescriptorCopyLocalizedAttribute(font, kCTFontFamilyNameAttribute, NULL);
148 QCFString style_name = (
CFStringRef)CTFontDescriptorCopyLocalizedAttribute(font, kCTFontStyleNameAttribute, NULL);
152 CFIndex length = CFArrayGetCount(languages);
157 if (CFArrayContainsValue(languages, CFRangeMake(0, length), lang))
165 QString styleName = style_name;
166 if(
QCFType<CFDictionaryRef> styles = (CFDictionaryRef)CTFontDescriptorCopyAttribute(font, kCTFontTraitsAttribute)) {
167 if(CFNumberRef weight = (CFNumberRef)CFDictionaryGetValue(styles, kCTFontWeightTrait)) {
168 Q_ASSERT(CFNumberIsFloatType(weight));
170 if(CFNumberGetValue(weight, kCFNumberDoubleType, &d)) {
175 if(CFNumberRef italic = (CFNumberRef)CFDictionaryGetValue(styles, kCTFontSlantTrait)) {
176 Q_ASSERT(CFNumberIsFloatType(italic));
178 if(CFNumberGetValue(italic, kCFNumberDoubleType, &d)) {
188 if(
QCFType<CFNumberRef> size = (CFNumberRef)CTFontDescriptorCopyAttribute(font, kCTFontSizeAttribute)) {
191 if(CFNumberIsFloatType(size)) {
193 CFNumberGetValue(size, kCFNumberDoubleType, &d);
196 CFNumberGetValue(size, kCFNumberIntType, &pixel_size);
208 #ifndef QT_MAC_USE_COCOA 210 if (!FMCreateFontIterator(0, 0, kFMUseGlobalScopeOption, &it)) {
213 if (FMGetNextFont(&it, &fmFont) != noErr)
216 FMFontFamily fmFamily;
222 ATSFontRef atsFont = FMGetATSFontRefFromFont(fmFont);
224 if (!FMGetFontFamilyInstanceFromFont(fmFont, &fmFamily, &fmStyle)) {
227 if(ATSUFONDtoFontID(fmFamily, 0, &fontID) != noErr)
231 if (fmStyle & ::italic)
233 if (fmStyle & ::bold)
236 ATSFontFamilyRef familyRef = FMGetATSFontFamilyRefFromFontFamily(fmFamily);
238 ATSFontFamilyGetName(familyRef, kATSOptionFlagsDefault, &cfFamilyName);
239 familyName = cfFamilyName;
242 ATSFontGetName(atsFont, kATSOptionFlagsDefault, &cfFontName);
243 familyName = cfFontName;
248 if (ATSFontGetTable(atsFont,
MAKE_TAG(
'h',
'e',
'a',
'd'), 44, 4, &data, &len) == noErr)
265 FMDisposeFontIterator(&it);
const struct __CFString * CFStringRef
QtFontStyle * style(const QtFontStyle::Key &, const QString &=QString(), bool=false)
#define it(className, varName)
The QString class provides a Unicode character string.
static const char * languageForWritingSystem[]
#define MAKE_TAG(ch1, ch2, ch3, ch4)
static void initWritingSystems(QtFontFamily *family, ATSFontRef atsFont)
static const char * data(const QByteArray &arr)
QtFontFamily * family(const QString &f, bool=false)
quint16 qFromBigEndian< quint16 >(const uchar *src)
unsigned char writingSystems[QFontDatabase::WritingSystemsCount]
QtFontSize * pixelSize(unsigned short size, bool=false)
static const MacVersion MacintoshVersion
the version of the Macintosh operating system on which the application is run (Mac only)...
QtFontFoundry * foundry(const QString &f, bool=false)
const struct __CFArray * CFArrayRef