Changeset 561 for trunk/src/gui/text/qfontdatabase_mac.cpp
- Timestamp:
- Feb 11, 2010, 11:19:06 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
-
Property svn:mergeinfo
set to (toggle deleted branches)
/branches/vendor/nokia/qt/4.6.1 merged eligible /branches/vendor/nokia/qt/current merged eligible /branches/vendor/trolltech/qt/current 3-149
-
Property svn:mergeinfo
set to (toggle deleted branches)
-
trunk/src/gui/text/qfontdatabase_mac.cpp
r2 r561 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information (qt-info@nokia.com) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation (qt-info@nokia.com) 5 6 ** 6 7 ** This file is part of the QtGui module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 23 ** In addition, as a special exception, Nokia gives you certain 24 ** additional rights. These rights are described in the Nokia Qt LGPL 25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 26 ** package. 24 ** In addition, as a special exception, Nokia gives you certain additional 25 ** rights. These rights are described in the Nokia Qt LGPL Exception 26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you have questions regarding the use of this file, please contact 37 ** Nokia at qt-info@nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** … … 52 52 int qt_mac_pointsize(const QFontDef &def, int dpi); //qfont_mac.cpp 53 53 54 #ifndef QT_MAC_USE_COCOA 54 55 static void initWritingSystems(QtFontFamily *family, ATSFontRef atsFont) 55 56 { … … 82 83 family->writingSystems[systems.at(i)] = QtFontFamily::Supported; 83 84 } 85 #endif 84 86 85 87 static void initializeDb() … … 151 153 #endif 152 154 { 153 #ifndef Q _WS_MAC64155 #ifndef QT_MAC_USE_COCOA 154 156 FMFontIterator it; 155 157 if (!FMCreateFontIterator(0, 0, kFMUseGlobalScopeOption, &it)) { … … 282 284 283 285 //find the font 284 QStringList family_list = req.family.split(QLatin1Char(',')); 285 // append the substitute list for each family in family_list 286 { 287 QStringList subs_list; 288 for(QStringList::ConstIterator it = family_list.constBegin(); it != family_list.constEnd(); ++it) 289 subs_list += QFont::substitutes(*it); 290 family_list += subs_list; 291 } 286 QStringList family_list = familyList(req); 292 287 293 288 const char *stylehint = styleHint(req); … … 314 309 fontRef = ATSFontFindFromName(QCFString(db->families[k]->name), kATSOptionFlagsDefault); 315 310 goto FamilyFound; 311 } else { 312 #if defined(QT_MAC_USE_COCOA) 313 // ATS and CT disagrees on what the family name should be, 314 // use CT to look up the font if ATS fails. 315 QCFString familyName = QString::fromAscii(family_name); 316 QCFType<CTFontRef> CTfontRef = CTFontCreateWithName(familyName, 12, NULL); 317 QCFType<CTFontDescriptorRef> fontDescriptor = CTFontCopyFontDescriptor(CTfontRef); 318 QCFString displayName = (CFStringRef)CTFontDescriptorCopyAttribute(fontDescriptor, kCTFontDisplayNameAttribute); 319 320 familyRef = ATSFontFamilyFindFromName(displayName, kATSOptionFlagsDefault); 321 if (familyRef) { 322 fontRef = ATSFontFindFromName(displayName, kATSOptionFlagsDefault); 323 goto FamilyFound; 324 } 325 #endif 316 326 } 317 327 } … … 462 472 463 473 fnt->families.clear(); 474 #if defined(QT_MAC_USE_COCOA) 475 // Make sure that the family name set on the font matches what 476 // kCTFontFamilyNameAttribute returns in initializeDb(). 477 // So far the best solution seems find the installed font 478 // using CoreText and get the family name from it. 479 // (ATSFontFamilyGetName appears to be the correct API, but also 480 // returns the font display name.) 481 for(int i = 0; i < containedFonts.size(); ++i) { 482 QCFString fontPostScriptName; 483 ATSFontGetPostScriptName(containedFonts[i], kATSOptionFlagsDefault, &fontPostScriptName); 484 QCFType<CTFontDescriptorRef> font = CTFontDescriptorCreateWithNameAndSize(fontPostScriptName, 14); 485 QCFString familyName = (CFStringRef)CTFontDescriptorCopyAttribute(font, kCTFontFamilyNameAttribute); 486 fnt->families.append(familyName); 487 } 488 #else 464 489 for(int i = 0; i < containedFonts.size(); ++i) { 465 490 QCFString family; … … 467 492 fnt->families.append(family); 468 493 } 494 #endif 469 495 470 496 fnt->handle = handle;
Note:
See TracChangeset
for help on using the changeset viewer.