Changeset 31620 in webkit
- Timestamp:
- Apr 3, 2008 8:46:59 PM (16 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 29 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r31619 r31620 1 2008-04-03 Nicholas Shanks <webkit@nickshanks.com> 2 3 Updated by Dan Bernstein. Reviewed by Dave Hyatt. 4 5 - WebCore part of fixing http://bugs.webkit.org/show_bug.cgi?id=6484 6 font-weight does not properly support graded weights 7 8 Tests to come: <http://bugs.webkit.org/show_bug.cgi?id=18306> 9 10 Build fixes for platforms other than Mac and Windows to come. 11 12 * WebCore.vcproj/WebCore.vcproj: Added FontDescription.cpp. 13 14 * WebCore.xcodeproj/project.pbxproj: Ditto. 15 16 * css/CSSComputedStyleDeclaration.cpp: 17 (WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue): Changed to 18 return additional weight value keywords 100, 200, 300, 500, 600, 800 19 and 900. 20 21 * css/CSSFontSelector.cpp: 22 (WebCore::hashForFont): Changed the bold parameter into a weight 23 parameter and added the weight to the string to be hashed. 24 (WebCore::CSSFontSelector::addFontFaceRule): Changed to apply all CSS 25 weight values to the font description. 26 (WebCore::CSSFontSelector::getFontData): Updated the fallback logic to 27 go through all weights equal or lighter from the desired weight. For 28 SVG, to also consider heavier weights. 29 30 * css/CSSParser.cpp: 31 (WebCore::CSSParser::parseValue): Cleaned up parsing of the font-weight 32 property. 33 34 * css/CSSStyleSelector.cpp: 35 (WebCore::CSSStyleSelector::applyProperty): Changed to apply all CSS 36 weight values to the font description. 37 38 * platform/graphics/Font.h: 39 (WebCore::Font::weight): Updated for the change to 40 FontDescription::weight(). 41 42 * platform/graphics/FontCache.cpp: 43 (WebCore::FontPlatformDataCacheKey::FontPlatformDataCacheKey): Replaced 44 the bold component of the key with a weight component. 45 (WebCore::FontPlatformDataCacheKey::operator==): Updated for the above. 46 (WebCore::computeHash): Ditto. 47 (WebCore::FontPlatformDataCacheKeyTraits::deletedValue): Removed 48 unnecessary parameters. 49 (WebCore::FontPlatformDataCacheKeyTraits::emptyValue): Ditto. 50 (WebCore::FontCache::getCachedFontPlatformData): Updated for the change 51 in FontPlatformDataCacheKey. 52 53 * platform/graphics/FontDescription.cpp: Added. 54 (WebCore::FontDescription::lighterWeight): Added. Returns a lighter CSS 55 font-weight value if there is one, or the lightest value. 56 (WebCore::FontDescription::bolderWeight): Added. Returns a heavier CSS 57 font-weight value if there is one, or the heaviest value. 58 59 * platform/graphics/FontDescription.h: 60 (WebCore::FontWeight): Added this enumeration. 61 (WebCore::FontDescription::FontDescription): 62 (WebCore::FontDescription::bold): Removed. 63 (WebCore::FontDescription::weight): Changed to return a FontWeight. 64 (WebCore::FontDescription::setBold): Removed. 65 (WebCore::FontDescription::setWeight): Changed to take a FontWeight. 66 67 * platform/graphics/mac/FontCacheMac.mm: 68 (WebCore::toAppKitFontWeight): Added. Maps a FontWeight to the AppKit 69 font weight scale of 0-15. 70 (WebCore::isAppKitFontWeightBold): Added. 71 (WebCore::FontCache::getFontDataForCharacters): Changed to use a weight 72 instead of the bold trait for custom fonts, and to decide whether to 73 synthesize bold based on the weights rather than the bold trait. 74 (WebCore::FontCache::fontExists): Updated for the change in 75 WebFontCache . 76 (WebCore::FontCache::createFontPlatformData): Ditto. Also changed to 77 decide whether to synthesize bold based on the weights rather than on 78 the bold trait. 79 80 * platform/graphics/win/FontCacheWin.cpp: 81 (WebCore::toGDIFontWeight): Added. Maps a FontWeight to a GDI font 82 weight constant. 83 (WebCore::isGDIFontWeightBold): Added. 84 (WebCore::adjustedGDIFontWeight): Added. 85 (WebCore::MatchImprovingProcData::MatchImprovingProcData): Added this 86 data structure for use by the following callback. 87 (WebCore::matchImprovingEnumProc): Added. The logic of this method is a 88 simplification of the betterChoice() predicate in WebFontCache.mm, which 89 considers only the italic trait and the weight. 90 (WebCore::createGDIFont): Added. Similarly to 91 +[WebFontCache fontWithFamily:traits:weight:size:], this function 92 finds the closest match in the family for the desired italic bit and 93 weight. 94 (WebCore::FontCache::fontExists): Changed to call createGDIFont(). 95 (WebCore::FontCache::createFontPlatformData): Ditto. Also changed to 96 compute the synthetic bold and synthetic italic flags based on weights 97 and italic bits and pass them to the FontPlatformData constructor. 98 99 * platform/graphics/win/FontPlatformDataWin.cpp: 100 (WebCore::FontPlatformData::FontPlatformData): Changed the bold and 101 oblique parameters to mean whether these should be synthesized and 102 removed the font enumeration code that used to decide that. 103 104 * platform/graphics/win/SimpleFontDataWin.cpp: 105 (WebCore::SimpleFontData::smallCapsFontData): Changed to pass the 106 synthetic bold and oblique flags from the full-size FontPlatformData to 107 the FontPlatformData constructor for the small caps font. 108 109 * platform/mac/WebCoreTextRenderer.h: 110 * platform/mac/WebCoreTextRenderer.mm: 111 (WebCoreFindFont): Added a weight parameter, which is passed to 112 +[WebFontCache fontWithFamily:traits:weight:size:]. 113 114 * platform/mac/WebFontCache.h: 115 * platform/mac/WebFontCache.mm: 116 (acceptableChoice): 117 (betterChoice): Changed to ignore the bold trait. Changed the logic for 118 deciding based on weights to prefer the font whose weight is closer to 119 the desired one, or, if both candidates' weights are the same distance 120 from the desired weight, the one that is more "off-center". 121 (+[WebFontCache internalFontWithFamily:traits:weight:size:]): Changed to 122 check for weight when matching by full name. Changed to pass 123 the actual desired weight instead of the constant 5 to 124 acceptableChoice() and betterChoice(). Changed to use weights to decide 125 whether to synthesize bold. 126 (+[WebFontCache fontWithFamily:traits:weight:size:]): Added a weight 127 parameter, which is passed to the internal method. 128 129 * platform/win/PopupMenuWin.cpp: 130 (WebCore::PopupMenu::paint): Updated for the change to FontDescription. 131 132 * rendering/RenderListBox.cpp: 133 (WebCore::RenderListBox::updateFromElement): Ditto. 134 (WebCore::RenderListBox::paintItemForeground): Ditto. 135 136 * rendering/RenderThemeMac.mm: 137 (WebCore::toFontWeight): Added. Maps the AppKit font weight range of 138 0-15 to the FontWeight range. 139 (WebCore::RenderThemeMac::systemFont): Updated for the change to 140 FontDescription. 141 142 * rendering/RenderThemeSafari.cpp: 143 (WebCore::RenderThemeSafari::systemFont): Ditto. 144 1 145 2008-04-03 Dan Bernstein <mitz@apple.com> 2 146 -
trunk/WebCore/WebCore.vcproj/WebCore.vcproj
r31609 r31620 4656 4656 </File> 4657 4657 <File 4658 RelativePath="..\platform\graphics\FontDescription.cpp" 4659 > 4660 </File> 4661 <File 4658 4662 RelativePath="..\platform\graphics\FontDescription.h" 4659 4663 > -
trunk/WebCore/WebCore.xcodeproj/project.pbxproj
r31608 r31620 366 366 37919C240B7D188600A56998 /* PositionIterator.h in Headers */ = {isa = PBXBuildFile; fileRef = 37919C220B7D188600A56998 /* PositionIterator.h */; settings = {ATTRIBUTES = (); }; }; 367 367 37ACCE420DA2980F0089E602 /* FontRenderingMode.h in Headers */ = {isa = PBXBuildFile; fileRef = 37ACCE410DA2980F0089E602 /* FontRenderingMode.h */; settings = {ATTRIBUTES = (Private, ); }; }; 368 37ACCF690DA414E70089E602 /* FontDescription.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 37ACCE620DA2AA960089E602 /* FontDescription.cpp */; }; 368 369 37F818FD0D657606005E1F05 /* WebCoreURLResponse.h in Headers */ = {isa = PBXBuildFile; fileRef = 37F818FB0D657606005E1F05 /* WebCoreURLResponse.h */; settings = {ATTRIBUTES = (Private, ); }; }; 369 370 37F818FE0D657606005E1F05 /* WebCoreURLResponse.mm in Sources */ = {isa = PBXBuildFile; fileRef = 37F818FC0D657606005E1F05 /* WebCoreURLResponse.mm */; }; … … 4750 4751 37919C220B7D188600A56998 /* PositionIterator.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = PositionIterator.h; sourceTree = "<group>"; }; 4751 4752 37ACCE410DA2980F0089E602 /* FontRenderingMode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FontRenderingMode.h; sourceTree = "<group>"; }; 4753 37ACCE620DA2AA960089E602 /* FontDescription.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FontDescription.cpp; sourceTree = "<group>"; }; 4752 4754 37F818FB0D657606005E1F05 /* WebCoreURLResponse.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebCoreURLResponse.h; sourceTree = "<group>"; }; 4753 4755 37F818FC0D657606005E1F05 /* WebCoreURLResponse.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebCoreURLResponse.mm; sourceTree = "<group>"; }; … … 11658 11660 371F4F3F0D25B9AF00ECE0D5 /* FontData.cpp */, 11659 11661 371F4F3E0D25B9AF00ECE0D5 /* FontData.h */, 11662 37ACCE620DA2AA960089E602 /* FontDescription.cpp */, 11660 11663 B2C3DA550D006CD600EF6F26 /* FontDescription.h */, 11661 11664 B2C3DA560D006CD600EF6F26 /* FontFallbackList.cpp */, … … 16345 16348 BCE1C43B0D9830D3003B02F2 /* JSLocation.cpp in Sources */, 16346 16349 BCE1C4400D9830F4003B02F2 /* JSLocationCustom.cpp in Sources */, 16350 37ACCF690DA414E70089E602 /* FontDescription.cpp in Sources */, 16347 16351 BC53C6080DA56C570021EB5D /* Gradient.cpp in Sources */, 16348 16352 BC53C60B0DA56CF10021EB5D /* GradientCG.cpp in Sources */, -
trunk/WebCore/css/CSSComputedStyleDeclaration.cpp
r31160 r31620 4 4 * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved. 5 5 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> 6 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com> 6 7 * 7 8 * This library is free software; you can redistribute it and/or … … 520 521 return new CSSPrimitiveValue(CSSValueNormal); 521 522 case CSSPropertyFontWeight: 522 // FIXME: this does not reflect the full range of weights 523 // that can be expressed with CSS 524 if (style->fontDescription().weight() == cBoldWeight) 525 return new CSSPrimitiveValue(CSSValueBold); 523 switch (style->fontDescription().weight()) { 524 case FontWeight100: 525 return new CSSPrimitiveValue(CSSValue100); 526 case FontWeight200: 527 return new CSSPrimitiveValue(CSSValue200); 528 case FontWeight300: 529 return new CSSPrimitiveValue(CSSValue300); 530 case FontWeightNormal: 531 return new CSSPrimitiveValue(CSSValueNormal); 532 case FontWeight500: 533 return new CSSPrimitiveValue(CSSValue500); 534 case FontWeight600: 535 return new CSSPrimitiveValue(CSSValue600); 536 case FontWeightBold: 537 return new CSSPrimitiveValue(CSSValueBold); 538 case FontWeight800: 539 return new CSSPrimitiveValue(CSSValue800); 540 case FontWeight900: 541 return new CSSPrimitiveValue(CSSValue900); 542 } 543 ASSERT_NOT_REACHED(); 526 544 return new CSSPrimitiveValue(CSSValueNormal); 527 545 case CSSPropertyHeight: -
trunk/WebCore/css/CSSFontSelector.cpp
r31309 r31620 77 77 } 78 78 79 static String hashForFont(const String& familyName, bool bold, bool italic)79 static String hashForFont(const String& familyName, FontWeight weight, bool italic) 80 80 { 81 81 String familyHash(familyName); 82 if (bold)83 familyHash += "-webkit-bold";82 familyHash += "-webkit-weight-"; 83 familyHash += String::number(weight); 84 84 if (italic) 85 85 familyHash += "-webkit-italic"; … … 114 114 115 115 if (RefPtr<CSSValue> fontWeight = style->getPropertyCSSValue(CSSPropertyFontWeight)) { 116 // FIXME: Need to support weights for real, since we're effectively limiting the number of supported weights to two.117 // This behavior could also result in the "last kinda bold variant" described winning even if it isn't the best match for bold.118 116 switch (static_cast<CSSPrimitiveValue*>(fontWeight.get())->getIdent()) { 117 case CSSValueBolder: 119 118 case CSSValueBold: 120 case CSSValueBolder: 119 case CSSValue700: 120 fontDescription.setWeight(FontWeightBold); 121 break; 122 case CSSValueNormal: 123 case CSSValue400: 124 fontDescription.setWeight(FontWeightNormal); 125 break; 126 case CSSValue900: 127 fontDescription.setWeight(FontWeight900); 128 break; 129 case CSSValue800: 130 fontDescription.setWeight(FontWeight800); 131 break; 121 132 case CSSValue600: 122 case CSSValue700: 123 case CSSValue800: 124 case CSSValue900: 125 fontDescription.setWeight(cBoldWeight); 133 fontDescription.setWeight(FontWeight600); 134 break; 135 case CSSValue500: 136 fontDescription.setWeight(FontWeight500); 137 break; 138 case CSSValue300: 139 fontDescription.setWeight(FontWeight300); 140 break; 141 case CSSValueLighter: 142 case CSSValue200: 143 fontDescription.setWeight(FontWeight200); 144 break; 145 case CSSValue100: 146 fontDescription.setWeight(FontWeight100); 147 break; 126 148 default: 127 149 break; … … 243 265 #endif 244 266 245 String hash = hashForFont(familyName.lower(), fontDescription. bold(), fontDescription.italic());267 String hash = hashForFont(familyName.lower(), fontDescription.weight(), fontDescription.italic()); 246 268 CSSSegmentedFontFace* segmentedFontFace = m_fonts.get(hash).get(); 247 269 if (!segmentedFontFace) { … … 282 304 return 0; 283 305 284 bool bold = fontDescription.bold();306 FontWeight weight = fontDescription.weight(); 285 307 bool italic = fontDescription.italic(); 286 308 … … 290 312 String family = familyName.string().lower(); 291 313 292 #if ENABLE(SVG_FONTS)293 314 RefPtr<CSSSegmentedFontFace> face; 294 315 295 if (fontDescription.smallCaps()) { 296 String testFamily = family + "-webkit-svg-small-caps"; 297 face = m_fonts.get(hashForFont(testFamily, bold, italic)); 298 } else 299 face = m_fonts.get(hashForFont(family, bold, italic)); 300 #else 301 RefPtr<CSSSegmentedFontFace> face = m_fonts.get(hashForFont(family, bold, italic)); 302 #endif 303 304 // If we don't find a face, and if bold/italic are set, we should try other variants. 305 // Bold/italic should try bold first, then italic, then normal (on the assumption that we are better at synthesizing italic than we are 306 // at synthesizing bold). 307 if (!face) { 308 if (bold && italic) { 309 syntheticItalic = true; 310 face = m_fonts.get(hashForFont(family, bold, false)); 311 if (!face) { 312 syntheticBold = true; 313 face = m_fonts.get(hashForFont(family, false, italic)); 314 } 315 } 316 317 // Bold should try normal. 318 // Italic should try normal. 319 if (!face && (bold || italic)) { 320 syntheticBold = bold; 321 syntheticItalic = italic; 322 face = m_fonts.get(hashForFont(family, false, false)); 323 } 316 #if ENABLE(SVG_FONTS) 317 if (fontDescription.smallCaps()) 318 family += "-webkit-svg-small-caps"; 319 #endif 320 321 // If we don't find a face, we should try synthesizing it from another variant. We are presumably better at synthesizing italic than 322 // synthesizing bold, and we cannot synthesize a lighter face at all. 323 int attemptedWeight = weight; 324 while (!face) { 325 face = m_fonts.get(hashForFont(family, static_cast<FontWeight>(attemptedWeight), italic)); 326 if (face) 327 break; 328 if (italic) { 329 face = m_fonts.get(hashForFont(family, static_cast<FontWeight>(attemptedWeight), false)); 330 if (face) { 331 syntheticItalic = true; 332 break; 333 } 334 } 335 if (attemptedWeight == FontWeight100) 336 break; 337 attemptedWeight--; 338 syntheticBold = true; 324 339 } 325 340 … … 329 344 // And the font-family requested is non-bold & non-italic. For SVG Fonts we still 330 345 // have to return the defined font, and not fallback to the system default. 331 if (!face && !bold) 332 face = m_fonts.get(hashForFont(family, true, italic)); 333 334 if (!face && !italic) 335 face = m_fonts.get(hashForFont(family, bold, true)); 336 337 if (!face && !bold && !italic) 338 face = m_fonts.get(hashForFont(family, true, true)); 346 if (!face) { 347 syntheticBold = false; 348 // Try all heavier weights 349 for (attemptedWeight = weight + 1; !face && attemptedWeight <= FontWeight900; ++attemptedWeight) 350 face = m_fonts.get(hashForFont(family, static_cast<FontWeight>(attemptedWeight), italic)); 351 352 // Try italics with all weights 353 if (!face && !italic) { 354 for (attemptedWeight = weight; !face && attemptedWeight >= FontWeight100; --attemptedWeight) 355 face = m_fonts.get(hashForFont(family, static_cast<FontWeight>(attemptedWeight), true)); 356 357 for (attemptedWeight = weight + 1; !face && attemptedWeight <= FontWeight900; ++attemptedWeight) 358 face = m_fonts.get(hashForFont(family, static_cast<FontWeight>(attemptedWeight), true)); 359 } 360 } 339 361 #endif 340 362 -
trunk/WebCore/css/CSSParser.cpp
r31453 r31620 3 3 * Copyright (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com) 4 4 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. 5 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com> 5 6 * 6 7 * This library is free software; you can redistribute it and/or … … 729 730 break; 730 731 731 case CSSPropertyFontWeight: // normal | bold | bolder | lighter | 100 | 200 | 300 | 400 | 732 // 500 | 600 | 700 | 800 | 900 | inherit 732 case CSSPropertyFontWeight: // normal | bold | bolder | lighter | 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900 | inherit 733 733 if (id >= CSSValueNormal && id <= CSSValue900) { 734 // Allready correct id735 valid_primitive = true; 736 } else if (validUnit(value, FInteger |FNonNeg, false)) {737 int weight = (int)value->fValue;738 if ( (weight % 100))734 // Valid weight keyword 735 valid_primitive = true; 736 } else if (validUnit(value, FInteger | FNonNeg, false)) { 737 int weight = static_cast<int>(value->fValue); 738 if (weight % 100) 739 739 break; 740 740 weight /= 100; -
trunk/WebCore/css/CSSStyleSelector.cpp
r31530 r31620 2 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 3 3 * (C) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com) 4 * (C) 2006Nicholas Shanks (webkit@nickshanks.com)4 * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com) 5 5 * Copyright (C) 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. 6 6 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> … … 2429 2429 fontDescription.setWeight(m_parentStyle->fontDescription().weight()); 2430 2430 else if (isInitial) 2431 fontDescription.setWeight( cNormalWeight);2431 fontDescription.setWeight(FontWeightNormal); 2432 2432 else { 2433 2433 if (!primitiveValue) … … 2435 2435 if (primitiveValue->getIdent()) { 2436 2436 switch (primitiveValue->getIdent()) { 2437 // FIXME: We aren't genuinely supporting specific weight values. 2437 case CSSValueBolder: 2438 fontDescription.setWeight(fontDescription.bolderWeight()); 2439 break; 2440 case CSSValueLighter: 2441 fontDescription.setWeight(fontDescription.lighterWeight()); 2442 break; 2438 2443 case CSSValueBold: 2439 case CSSValueBolder:2440 case CSSValue600:2441 2444 case CSSValue700: 2442 case CSSValue800: 2443 case CSSValue900: 2444 fontDescription.setWeight(cBoldWeight); 2445 fontDescription.setWeight(FontWeightBold); 2445 2446 break; 2446 2447 case CSSValueNormal: 2447 case CSSValueLighter: 2448 case CSSValue400: 2449 fontDescription.setWeight(FontWeightNormal); 2450 break; 2451 case CSSValue900: 2452 fontDescription.setWeight(FontWeight900); 2453 break; 2454 case CSSValue800: 2455 fontDescription.setWeight(FontWeight800); 2456 break; 2457 case CSSValue600: 2458 fontDescription.setWeight(FontWeight600); 2459 break; 2460 case CSSValue500: 2461 fontDescription.setWeight(FontWeight500); 2462 break; 2463 case CSSValue300: 2464 fontDescription.setWeight(FontWeight300); 2465 break; 2466 case CSSValue200: 2467 fontDescription.setWeight(FontWeight200); 2468 break; 2448 2469 case CSSValue100: 2449 case CSSValue200: 2450 case CSSValue300: 2451 case CSSValue400: 2452 case CSSValue500: 2453 fontDescription.setWeight(cNormalWeight); 2470 fontDescription.setWeight(FontWeight100); 2454 2471 break; 2455 2472 default: 2456 2473 return; 2457 2474 } 2458 } 2459 else 2460 { 2461 // ### fix parsing of 100-900 values in parser, apply them here 2462 } 2475 } else 2476 ASSERT_NOT_REACHED(); 2463 2477 } 2464 2478 if (m_style->setFontDescription(fontDescription)) -
trunk/WebCore/platform/graphics/Font.h
r31342 r31620 197 197 198 198 bool italic() const { return m_fontDescription.italic(); } 199 unsigned weight() const { return m_fontDescription.weight(); } 200 bool bold() const { return m_fontDescription.bold(); } 199 FontWeight weight() const { return m_fontDescription.weight(); } 201 200 202 201 #if !PLATFORM(QT) -
trunk/WebCore/platform/graphics/FontCache.cpp
r29663 r31620 1 1 /* 2 * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. 2 * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. 3 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com> 3 4 * 4 5 * Redistribution and use in source and binary forms, with or without … … 40 41 41 42 struct FontPlatformDataCacheKey { 42 FontPlatformDataCacheKey(const AtomicString& family = AtomicString(), unsigned size = 0, bool bold = false, bool italic = false,43 FontPlatformDataCacheKey(const AtomicString& family = AtomicString(), unsigned size = 0, unsigned weight = 0, bool italic = false, 43 44 bool isPrinterFont = false, FontRenderingMode renderingMode = NormalRenderingMode) 44 45 : m_family(family) 45 46 , m_size(size) 46 , m_ bold(bold)47 , m_weight(weight) 47 48 , m_italic(italic) 48 49 , m_printerFont(isPrinterFont) … … 54 55 { 55 56 return equalIgnoringCase(m_family, other.m_family) && m_size == other.m_size && 56 m_ bold == other.m_bold&& m_italic == other.m_italic && m_printerFont == other.m_printerFont &&57 m_weight == other.m_weight && m_italic == other.m_italic && m_printerFont == other.m_printerFont && 57 58 m_renderingMode == other.m_renderingMode; 58 59 } … … 60 61 AtomicString m_family; 61 62 unsigned m_size; 62 bool m_bold;63 unsigned m_weight; 63 64 bool m_italic; 64 65 bool m_printerFont; … … 71 72 CaseFoldingHash::hash(fontKey.m_family), 72 73 fontKey.m_size, 73 static_cast<unsigned>(fontKey.m_bold) << 3 | static_cast<unsigned>(fontKey.m_italic) << 2 | static_cast<unsigned>(fontKey.m_printerFont) << 1 |74 static_cast<unsigned>(fontKey.m_ renderingMode)74 fontKey.m_weight, 75 static_cast<unsigned>(fontKey.m_italic) << 2 | static_cast<unsigned>(fontKey.m_printerFont) << 1 | static_cast<unsigned>(fontKey.m_renderingMode) 75 76 }; 76 return StringImpl::computeHash(reinterpret_cast<UChar*>(hashCodes), 4 * sizeof(unsigned) / sizeof(UChar));77 return StringImpl::computeHash(reinterpret_cast<UChar*>(hashCodes), sizeof(hashCodes) / sizeof(UChar)); 77 78 } 78 79 … … 96 97 static const FontPlatformDataCacheKey& deletedValue() 97 98 { 98 static FontPlatformDataCacheKey key(nullAtom, 0xFFFFFFFFU , false, false);99 static FontPlatformDataCacheKey key(nullAtom, 0xFFFFFFFFU); 99 100 return key; 100 101 } 101 102 static const FontPlatformDataCacheKey& emptyValue() 102 103 { 103 static FontPlatformDataCacheKey key(nullAtom , 0, false, false);104 static FontPlatformDataCacheKey key(nullAtom); 104 105 return key; 105 106 } … … 145 146 } 146 147 147 FontPlatformDataCacheKey key(familyName, fontDescription.computedPixelSize(), fontDescription. bold(), fontDescription.italic(),148 FontPlatformDataCacheKey key(familyName, fontDescription.computedPixelSize(), fontDescription.weight(), fontDescription.italic(), 148 149 fontDescription.usePrinterFont(), fontDescription.renderingMode()); 149 150 FontPlatformData* result = 0; -
trunk/WebCore/platform/graphics/FontDescription.h
r31531 r31620 4 4 * (C) 2000 Dirk Mueller (mueller@kde.org) 5 5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. 6 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com> 6 7 * 7 8 * This library is free software; you can redistribute it and/or … … 30 31 namespace WebCore { 31 32 32 const unsigned cNormalWeight = 50; 33 const unsigned cBoldWeight = 63; 33 enum FontWeight { 34 FontWeight100, 35 FontWeight200, 36 FontWeight300, 37 FontWeight400, 38 FontWeight500, 39 FontWeight600, 40 FontWeight700, 41 FontWeight800, 42 FontWeight900, 43 FontWeightNormal = FontWeight400, 44 FontWeightBold = FontWeight700 45 }; 34 46 35 47 class FontDescription { … … 39 51 40 52 FontDescription() 41 : m_specifiedSize(0), m_computedSize(0), 42 m_italic(false), m_smallCaps(false), m_isAbsoluteSize(false), m_weight(cNormalWeight), 43 m_genericFamily(NoFamily), m_usePrinterFont(false), m_renderingMode(NormalRenderingMode), m_keywordSize(0) 44 {} 45 53 : m_specifiedSize(0) 54 , m_computedSize(0) 55 , m_italic(false) 56 , m_smallCaps(false) 57 , m_isAbsoluteSize(false) 58 , m_weight(FontWeightNormal) 59 , m_genericFamily(NoFamily) 60 , m_usePrinterFont(false) 61 , m_renderingMode(NormalRenderingMode) 62 , m_keywordSize(0) 63 { 64 } 65 46 66 bool operator==(const FontDescription&) const; 47 67 bool operator!=(const FontDescription& other) const { return !(*this == other); } … … 52 72 float computedSize() const { return m_computedSize; } 53 73 bool italic() const { return m_italic; } 54 bool bold() const { return weight() == cBoldWeight; }55 74 int computedPixelSize() const { return int(m_computedSize + 0.5f); } 56 75 bool smallCaps() const { return m_smallCaps; } 57 76 bool isAbsoluteSize() const { return m_isAbsoluteSize; } 58 unsigned weight() const { return m_weight; } 77 FontWeight weight() const { return static_cast<FontWeight>(m_weight); } 78 FontWeight lighterWeight() const; 79 FontWeight bolderWeight() const; 59 80 GenericFamilyType genericFamily() const { return static_cast<GenericFamilyType>(m_genericFamily); } 60 81 bool usePrinterFont() const { return m_usePrinterFont; } … … 66 87 void setSpecifiedSize(float s) { m_specifiedSize = s; } 67 88 void setItalic(bool i) { m_italic = i; } 68 void setBold(bool b) { m_weight = (b ? cBoldWeight : cNormalWeight); }69 89 void setSmallCaps(bool c) { m_smallCaps = c; } 70 90 void setIsAbsoluteSize(bool s) { m_isAbsoluteSize = s; } 71 void setWeight( unsignedw) { m_weight = w; }91 void setWeight(FontWeight w) { m_weight = w; } 72 92 void setGenericFamily(GenericFamilyType genericFamily) { m_genericFamily = genericFamily; } 73 93 void setUsePrinterFont(bool p) { m_usePrinterFont = p; } … … 86 106 bool m_isAbsoluteSize : 1; // Whether or not CSS specified an explicit size 87 107 // (logical sizes like "medium" don't count). 88 unsigned m_weight : 8; 108 unsigned m_weight : 8; // FontWeight 89 109 unsigned m_genericFamily : 3; // GenericFamilyType 90 110 bool m_usePrinterFont : 1; -
trunk/WebCore/platform/graphics/mac/FontCacheMac.mm
r29663 r31620 1 1 /* 2 2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. 3 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com> 3 4 * 4 5 * Redistribution and use in source and binary forms, with or without … … 122 123 } 123 124 125 static int toAppKitFontWeight(FontWeight fontWeight) 126 { 127 static int appKitFontWeights[] = { 128 1, // FontWeight100 129 2, // FontWeight200 130 3, // FontWeight300 131 5, // FontWeight400 132 6, // FontWeight500 133 7, // FontWeight600 134 9, // FontWeight700 135 10, // FontWeight800 136 12, // FontWeight900 137 }; 138 return appKitFontWeights[fontWeight]; 139 } 140 141 static inline bool isAppKitFontWeightBold(NSInteger appKitFontWeight) 142 { 143 return appKitFontWeight >= 7; 144 } 145 124 146 const SimpleFontData* FontCache::getFontDataForCharacters(const Font& font, const UChar* characters, int length) 125 147 { … … 127 149 NSFont *nsFont = platformData.font(); 128 150 129 NSString *string = [[NSString alloc] initWithCharactersNoCopy:const_cast<UChar*>(characters) 130 length:length freeWhenDone:NO]; 151 NSString *string = [[NSString alloc] initWithCharactersNoCopy:const_cast<UChar*>(characters) length:length freeWhenDone:NO]; 131 152 NSFont *substituteFont = wkGetFontInLanguageForRange(nsFont, string, NSMakeRange(0, length)); 132 153 [string release]; … … 136 157 if (!substituteFont) 137 158 return 0; 138 159 139 160 // Use the family name from the AppKit-supplied substitute font, requesting the 140 161 // traits, weight, and size we want. One way this does better than the original … … 143 164 // doesn't actually cover the characters we need. 144 165 145 NSFontManager * manager = [NSFontManager sharedFontManager];166 NSFontManager *fontManager = [NSFontManager sharedFontManager]; 146 167 147 168 NSFontTraitMask traits; … … 150 171 151 172 if (nsFont) { 152 traits = [ manager traitsOfFont:nsFont];173 traits = [fontManager traitsOfFont:nsFont]; 153 174 if (platformData.m_syntheticBold) 154 175 traits |= NSBoldFontMask; 155 176 if (platformData.m_syntheticOblique) 156 traits |= NS ItalicFontMask;157 weight = [ manager weightOfFont:nsFont];177 traits |= NSFontItalicTrait; 178 weight = [fontManager weightOfFont:nsFont]; 158 179 size = [nsFont pointSize]; 159 180 } else { 160 181 // For custom fonts nsFont is nil. 161 traits = (font.bold() ? NSBoldFontMask : 0) | (font.italic() ? NSItalicFontMask : 0);162 weight = 5;182 traits = font.italic() ? NSFontItalicTrait : 0; 183 weight = toAppKitFontWeight(font.weight()); 163 184 size = font.pixelSize(); 164 185 } 165 186 166 NSFont *bestVariation = [manager fontWithFamily:[substituteFont familyName] 167 traits:traits 168 weight:weight 169 size:size]; 170 if (bestVariation) 187 if (NSFont *bestVariation = [fontManager fontWithFamily:[substituteFont familyName] traits:traits weight:weight size:size]) 171 188 substituteFont = bestVariation; 172 189 173 substituteFont = font.fontDescription().usePrinterFont() 174 ? [substituteFont printerFont] : [substituteFont screenFont]; 175 176 NS FontTraitMask substituteFontTraits = [manager traitsOfFont:substituteFont];190 substituteFont = font.fontDescription().usePrinterFont() ? [substituteFont printerFont] : [substituteFont screenFont]; 191 192 NSFontTraitMask substituteFontTraits = [fontManager traitsOfFont:substituteFont]; 193 NSInteger substituteFontWeight = [fontManager weightOfFont:substituteFont]; 177 194 178 195 FontPlatformData alternateFont(substituteFont, 179 !font.isPlatformFont() && (traits & NSBoldFontMask) && !(substituteFontTraits & NSBoldFontMask),180 !font.isPlatformFont() && (traits & NS ItalicFontMask) && !(substituteFontTraits & NSItalicFontMask));196 !font.isPlatformFont() && isAppKitFontWeightBold(weight) && !isAppKitFontWeightBold(substituteFontWeight), 197 !font.isPlatformFont() && (traits & NSFontItalicTrait) && !(substituteFontTraits & NSFontItalicTrait)); 181 198 return getCachedFontData(&alternateFont); 182 199 } … … 223 240 bool FontCache::fontExists(const FontDescription& fontDescription, const AtomicString& family) 224 241 { 225 NSFontTraitMask traits = 0; 226 if (fontDescription.italic()) 227 traits |= NSItalicFontMask; 228 if (fontDescription.bold()) 229 traits |= NSBoldFontMask; 242 NSFontTraitMask traits = fontDescription.italic() ? NSFontItalicTrait : 0; 243 int weight = toAppKitFontWeight(fontDescription.weight()); 230 244 float size = fontDescription.computedPixelSize(); 231 232 NSFont* nsFont = [WebFontCache fontWithFamily:family traits:traits size:size]; 233 return nsFont != 0; 245 246 return [WebFontCache fontWithFamily:family traits:traits weight:weight size:size]; 234 247 } 235 248 236 249 FontPlatformData* FontCache::createFontPlatformData(const FontDescription& fontDescription, const AtomicString& family) 237 250 { 238 NSFontTraitMask traits = 0; 239 if (fontDescription.italic()) 240 traits |= NSItalicFontMask; 241 if (fontDescription.bold()) 242 traits |= NSBoldFontMask; 251 NSFontTraitMask traits = fontDescription.italic() ? NSFontItalicTrait : 0; 252 NSInteger weight = toAppKitFontWeight(fontDescription.weight()); 243 253 float size = fontDescription.computedPixelSize(); 244 245 NSFont * nsFont = [WebFontCache fontWithFamily:family traits:traitssize:size];254 255 NSFont *nsFont = [WebFontCache fontWithFamily:family traits:traits weight:weight size:size]; 246 256 if (!nsFont) 247 257 return 0; 248 258 259 NSFontManager *fontManager = [NSFontManager sharedFontManager]; 249 260 NSFontTraitMask actualTraits = 0; 250 if (fontDescription.bold() || fontDescription.italic()) 251 actualTraits = [[NSFontManager sharedFontManager] traitsOfFont:nsFont]; 252 261 if (fontDescription.italic()) 262 actualTraits = [fontManager traitsOfFont:nsFont]; 263 NSInteger actualWeight = [fontManager weightOfFont:nsFont]; 264 253 265 FontPlatformData* result = new FontPlatformData; 254 266 255 267 // Use the correct font for print vs. screen. 256 268 result->setFont(fontDescription.usePrinterFont() ? [nsFont printerFont] : [nsFont screenFont]); 257 result->m_syntheticBold = (traits & NSBoldFontMask) && !(actualTraits & NSBoldFontMask);258 result->m_syntheticOblique = (traits & NS ItalicFontMask) && !(actualTraits & NSItalicFontMask);269 result->m_syntheticBold = isAppKitFontWeightBold(weight) && !isAppKitFontWeightBold(actualWeight); 270 result->m_syntheticOblique = (traits & NSFontItalicTrait) && !(actualTraits & NSFontItalicTrait); 259 271 return result; 260 272 } -
trunk/WebCore/platform/graphics/win/FontCacheWin.cpp
r31507 r31620 309 309 } 310 310 311 static LONG toGDIFontWeight(FontWeight fontWeight) 312 { 313 static LONG gdiFontWeights[] = { 314 FW_THIN, // FontWeight100 315 FW_EXTRALIGHT, // FontWeight200 316 FW_LIGHT, // FontWeight300 317 FW_NORMAL, // FontWeight400 318 FW_MEDIUM, // FontWeight500 319 FW_SEMIBOLD, // FontWeight600 320 FW_BOLD, // FontWeight700 321 FW_EXTRABOLD, // FontWeight800 322 FW_HEAVY // FontWeight900 323 }; 324 return gdiFontWeights[fontWeight]; 325 } 326 327 static inline bool isGDIFontWeightBold(LONG gdiFontWeight) 328 { 329 return gdiFontWeight >= FW_SEMIBOLD; 330 } 331 332 static LONG adjustedGDIFontWeight(LONG gdiFontWeight, const String& family) 333 { 334 static AtomicString lucidaStr("Lucida Grande"); 335 if (equalIgnoringCase(family, lucidaStr)) { 336 if (gdiFontWeight == FW_NORMAL) 337 return FW_MEDIUM; 338 if (gdiFontWeight == FW_BOLD) 339 return FW_SEMIBOLD; 340 } 341 return gdiFontWeight; 342 } 343 344 struct MatchImprovingProcData { 345 MatchImprovingProcData(LONG desiredWeight, bool desiredItalic) 346 : m_desiredWeight(desiredWeight) 347 , m_desiredItalic(desiredItalic) 348 , m_hasMatched(false) 349 { 350 } 351 352 LONG m_desiredWeight; 353 bool m_desiredItalic; 354 bool m_hasMatched; 355 LOGFONT m_chosen; 356 }; 357 358 static int CALLBACK matchImprovingEnumProc(CONST LOGFONT* candidate, CONST TEXTMETRIC* metrics, DWORD fontType, LPARAM lParam) 359 { 360 MatchImprovingProcData* matchData = reinterpret_cast<MatchImprovingProcData*>(lParam); 361 362 if (!matchData->m_hasMatched) { 363 matchData->m_hasMatched = true; 364 matchData->m_chosen = *candidate; 365 return 1; 366 } 367 368 if (!matchData->m_desiredItalic) 369 // Prefer the candidate if it helps us lose undesired italics. 370 if (matchData->m_chosen.lfItalic && !candidate->lfItalic) { 371 matchData->m_chosen = *candidate; 372 return 1; 373 } 374 // Reject the candidate if it adds undesired italics. 375 if (candidate->lfItalic && !matchData->m_chosed.lfItalic) 376 return 1; 377 } 378 379 unsigned chosenWeightDeltaMagnitude = abs(matchData->m_chosen.lfWeight - matchData->m_desiredWeight); 380 unsigned candidateWeightDeltaMagnitude = abs(candidate->lfWeight - matchData->m_desiredWeight); 381 382 // If both are the same distance from the desired weight, prefer the candidate if it is further from regular. 383 if (chosenWeightDeltaMagnitude == candidateWeightDeltaMagnitude && abs(candidate->lfWeight - FW_NORMAL) > abs(matchData->m_chosen.lfWeight - FW_NORMAL)) { 384 matchData->m_chosen = *candidate; 385 return 1; 386 } 387 388 // Otherwise, prefer the one closer to the desired weight. 389 if (candidateWeightDeltaMagnitude < chosenWeightDeltaMagnitude) 390 matchData->m_chosen = *candidate; 391 392 return 1; 393 } 394 395 static HFONT createGDIFont(const AtomicString& family, LONG desiredWeight, bool desiredItalic, int size) 396 { 397 HDC hdc = GetDC(0); 398 399 LOGFONT logFont; 400 logFont.lfCharSet = DEFAULT_CHARSET; 401 unsigned familyLength = min(family.length(), static_cast<unsigned>(LF_FACESIZE - 1)); 402 memcpy(logFont.lfFaceName, family.characters(), familyLength * sizeof(UChar)); 403 logFont.lfFaceName[familyLength] = 0; 404 logFont.lfPitchAndFamily = 0; 405 406 MatchImprovingProcData matchData(desiredWeight, desiredItalic); 407 EnumFontFamiliesEx(hdc, &logFont, matchImprovingEnumProc, reinterpret_cast<LPARAM>(&matchData), 0); 408 409 ReleaseDC(0, hdc); 410 411 if (!matchData.m_hasMatched) 412 return 0; 413 414 matchData.m_chosen.lfHeight = -size; 415 matchData.m_chosen.lfUnderline = false; 416 matchData.m_chosen.lfStrikeOut = false; 417 #if PLATFORM(CG) 418 matchData.m_chosen.lfOutPrecision = OUT_TT_ONLY_PRECIS; 419 #else 420 matchData.m_chosen.lfOutPrecision = OUT_TT_PRECIS; 421 #endif 422 matchData.m_chosen.lfQuality = CLEARTYPE_QUALITY; 423 424 return CreateFontIndirect(&matchData.m_chosen); 425 } 426 311 427 bool FontCache::fontExists(const FontDescription& fontDescription, const AtomicString& family) 312 428 { 313 LOGFONT winfont; 314 315 // The size here looks unusual. The negative number is intentional. The logical size constant is 32. 316 winfont.lfHeight = -fontDescription.computedPixelSize() * 32; 317 winfont.lfWidth = 0; 318 winfont.lfEscapement = 0; 319 winfont.lfOrientation = 0; 320 winfont.lfUnderline = false; 321 winfont.lfStrikeOut = false; 322 winfont.lfCharSet = DEFAULT_CHARSET; 323 #if PLATFORM(CG) 324 winfont.lfOutPrecision = OUT_TT_ONLY_PRECIS; 325 #else 326 winfont.lfOutPrecision = OUT_TT_PRECIS; 327 #endif 328 winfont.lfQuality = CLEARTYPE_QUALITY; 329 winfont.lfPitchAndFamily = DEFAULT_PITCH | FF_DONTCARE; 330 winfont.lfItalic = fontDescription.italic(); 331 332 // FIXME: Support weights for real. Do our own enumeration of the available weights. 333 // We can't rely on Windows here, since we need to follow the CSS2 algorithm for how to fill in 334 // gaps in the weight list. 335 // FIXME: Hardcoding Lucida Grande for now. It uses different weights than typical Win32 fonts 336 // (500/600 instead of 400/700). 337 static AtomicString lucidaStr("Lucida Grande"); 338 if (equalIgnoringCase(family, lucidaStr)) 339 winfont.lfWeight = fontDescription.bold() ? 600 : 500; 340 else 341 winfont.lfWeight = fontDescription.bold() ? 700 : 400; 342 int len = min(family.length(), (unsigned int)LF_FACESIZE - 1); 343 memcpy(winfont.lfFaceName, family.characters(), len * sizeof(WORD)); 344 winfont.lfFaceName[len] = '\0'; 345 346 HFONT hfont = CreateFontIndirect(&winfont); 347 // Windows will always give us a valid pointer here, even if the face name is non-existent. We have to double-check 348 // and see if the family name was really used. 349 HDC dc = GetDC(0); 350 SaveDC(dc); 351 SelectObject(dc, hfont); 352 WCHAR name[LF_FACESIZE]; 353 GetTextFace(dc, LF_FACESIZE, name); 354 RestoreDC(dc, -1); 355 ReleaseDC(0, dc); 356 429 HFONT hfont = createGDIFont(family, adjustedGDIFontWeight(toGDIFontWeight(fontDescription.weight()), family), 430 fontDescription.italic(), fontDescription.computedPixelSize()); 431 432 bool result = hfont; 357 433 DeleteObject(hfont); 358 434 359 return !wcsicmp(winfont.lfFaceName, name);435 return result; 360 436 } 361 437 … … 369 445 bool useGDI = fontDescription.renderingMode() == AlternateRenderingMode && !isLucidaGrande; 370 446 371 LOGFONT winfont; 372 373 // The size here looks unusual. The negative number is intentional. The logical size constant is 32. We do this 374 // for subpixel precision when rendering using Uniscribe. This masks rounding errors related to the HFONT metrics being 375 // different from the CGFont metrics. 376 // FIXME: We will eventually want subpixel precision for GDI mode, but the scaled rendering doesn't look as nice. That may be solvable though. 377 winfont.lfHeight = -fontDescription.computedPixelSize() * (useGDI ? 1 : 32); 378 winfont.lfWidth = 0; 379 winfont.lfEscapement = 0; 380 winfont.lfOrientation = 0; 381 winfont.lfUnderline = false; 382 winfont.lfStrikeOut = false; 383 winfont.lfCharSet = DEFAULT_CHARSET; 384 winfont.lfOutPrecision = OUT_TT_ONLY_PRECIS; 385 winfont.lfQuality = DEFAULT_QUALITY; 386 winfont.lfPitchAndFamily = DEFAULT_PITCH | FF_DONTCARE; 387 winfont.lfItalic = fontDescription.italic(); 388 389 // FIXME: Support weights for real. Do our own enumeration of the available weights. 390 // We can't rely on Windows here, since we need to follow the CSS2 algorithm for how to fill in 391 // gaps in the weight list. 392 // FIXME: Hardcoding Lucida Grande for now. It uses different weights than typical Win32 fonts 393 // (500/600 instead of 400/700). 394 if (isLucidaGrande) { 395 winfont.lfWeight = fontDescription.bold() ? 600 : 500; 447 // The logical size constant is 32. We do this for subpixel precision when rendering using Uniscribe. 448 // This masks rounding errors related to the HFONT metrics being different from the CGFont metrics. 449 // FIXME: We will eventually want subpixel precision for GDI mode, but the scaled rendering doesn't 450 // look as nice. That may be solvable though. 451 LONG weight = adjustedGDIFontWeight(toGDIFontWeight(fontDescription.weight()), family); 452 HFONT hfont = createGDIFont(family, weight, fontDescription.italic(), fontDescription.computedPixelSize() * (useGDI ? 1 : 32)); 453 454 if (!hfont) 455 return 0; 456 457 if (isLucidaGrande) 396 458 useGDI = false; // Never use GDI for Lucida Grande. 397 } else 398 winfont.lfWeight = fontDescription.bold() ? 700 : 400; 399 int len = min(family.length(), (unsigned int)LF_FACESIZE - 1); 400 memcpy(winfont.lfFaceName, family.characters(), len * sizeof(WORD)); 401 winfont.lfFaceName[len] = '\0'; 402 403 HFONT hfont = CreateFontIndirect(&winfont); 404 // Windows will always give us a valid pointer here, even if the face name is non-existent. We have to double-check 405 // and see if the family name was really used. 406 HDC dc = GetDC(0); 407 SaveDC(dc); 408 SelectObject(dc, hfont); 409 WCHAR name[LF_FACESIZE]; 410 GetTextFace(dc, LF_FACESIZE, name); 411 RestoreDC(dc, -1); 412 ReleaseDC(0, dc); 413 414 if (_wcsicmp(winfont.lfFaceName, name)) { 415 DeleteObject(hfont); 416 return 0; 417 } 418 419 FontPlatformData* result = new FontPlatformData(hfont, fontDescription.computedPixelSize(), 420 fontDescription.bold(), fontDescription.italic(), useGDI); 459 460 LOGFONT logFont; 461 GetObject(hfont, sizeof(LOGFONT), &logFont); 462 463 bool synthesizeBold = isGDIFontWeightBold(weight) && !isGDIFontWeightBold(logFont.lfWeight); 464 bool synthesizeItalic = fontDescription.italic() && !logFont.lfItalic; 465 466 FontPlatformData* result = new FontPlatformData(hfont, fontDescription.computedPixelSize(), synthesizeBold, synthesizeItalic, useGDI); 421 467 422 468 #if PLATFORM(CG) -
trunk/WebCore/platform/graphics/win/FontPlatformDataWin.cpp
r31507 r31620 36 36 namespace WebCore { 37 37 38 static const int Bold = (1 << 0);39 static const int Italic = (1 << 1);40 static const int BoldOblique = (1 << 2);41 42 static int CALLBACK enumStylesCallback(const LOGFONT* logFont, const TEXTMETRIC* metrics, DWORD fontType, LPARAM lParam)43 {44 int *style = reinterpret_cast<int*>(lParam);45 46 // FIXME: In order to accommodate Lucida we go ahead and consider a weight of 600 to be bold.47 // This does mean we'll consider demibold and semibold fonts on windows to also be bold. This48 // is rare enough that it seems like an ok hack for now.49 if (logFont->lfWeight >= 600) {50 if (logFont->lfItalic)51 *style |= BoldOblique;52 else53 *style |= Bold;54 } else if (logFont->lfItalic)55 *style |= Italic;56 57 return 1;58 }59 60 38 FontPlatformData::FontPlatformData(HFONT font, float size, bool bold, bool oblique, bool useGDI) 61 39 : m_font(RefCountedHFONT::create(font)) … … 67 45 , m_scaledFont(0) 68 46 #endif 69 , m_syntheticBold( false)70 , m_syntheticOblique( false)47 , m_syntheticBold(bold) 48 , m_syntheticOblique(oblique) 71 49 , m_useGDI(useGDI) 72 50 { … … 84 62 GetOutlineTextMetricsW(hdc, bufferSize, metrics); 85 63 WCHAR* faceName = (WCHAR*)((uintptr_t)metrics + (uintptr_t)metrics->otmpFaceName); 86 87 if (!useGDI && (bold || oblique)) {88 LOGFONT logFont;89 90 int len = min((int)wcslen(faceName), LF_FACESIZE - 1);91 memcpy(logFont.lfFaceName, faceName, len * sizeof(WORD));92 logFont.lfFaceName[len] = '\0';93 logFont.lfCharSet = metrics->otmTextMetrics.tmCharSet;94 logFont.lfPitchAndFamily = 0;95 96 int styles = 0;97 EnumFontFamiliesEx(hdc, &logFont, enumStylesCallback, reinterpret_cast<LPARAM>(&styles), 0);98 99 // Check if we need to synthesize bold or oblique. The rule that complicates things here100 // is that if the requested font is bold and oblique, and both a bold font and an oblique font101 // exist, the bold font should be used, and oblique synthesized.102 if (bold && oblique) {103 if (styles == 0) {104 m_syntheticBold = true;105 m_syntheticOblique = true;106 } else if (styles & Bold)107 m_syntheticOblique = true;108 else if (styles & Italic)109 m_syntheticBold = true;110 } else if (bold && (!(styles & Bold)))111 m_syntheticBold = true;112 else if (oblique && !(styles & Italic))113 m_syntheticOblique = true;114 }115 64 116 65 platformDataInit(font, size, hdc, faceName); -
trunk/WebCore/platform/graphics/win/SimpleFontDataWin.cpp
r30441 r31620 110 110 winfont.lfHeight = -lroundf(smallCapsHeight * (m_font.useGDI() ? 1 : 32)); 111 111 HFONT hfont = CreateFontIndirect(&winfont); 112 m_smallCapsFontData = new SimpleFontData(FontPlatformData(hfont, smallCapsHeight, fontDescription.bold(), fontDescription.italic(), m_font.useGDI()));112 m_smallCapsFontData = new SimpleFontData(FontPlatformData(hfont, smallCapsHeight, m_font.syntheticBold(), m_font.syntheticOblique(), m_font.useGDI())); 113 113 } 114 114 } -
trunk/WebCore/platform/mac/WebCoreTextRenderer.h
r15438 r31620 33 33 extern bool WebCoreShouldUseFontSmoothing(); 34 34 extern void WebCoreSetAlwaysUseATSU(bool); 35 extern NSFont* WebCoreFindFont(NSString* familyName, NSFontTraitMask, int size);35 extern NSFont* WebCoreFindFont(NSString* familyName, NSFontTraitMask, int weight, int size); 36 36 37 37 #ifdef __cplusplus -
trunk/WebCore/platform/mac/WebCoreTextRenderer.mm
r29663 r31620 83 83 } 84 84 85 NSFont* WebCoreFindFont(NSString* familyName, NSFontTraitMask traits, int size)85 NSFont* WebCoreFindFont(NSString* familyName, NSFontTraitMask traits, int weight, int size) 86 86 { 87 return [WebFontCache fontWithFamily:familyName traits:traits size:size];87 return [WebFontCache fontWithFamily:familyName traits:traits weight:weight size:size]; 88 88 } -
trunk/WebCore/platform/mac/WebFontCache.h
r29663 r31620 1 1 /* 2 2 * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. 3 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com> 3 4 * 4 5 * Redistribution and use in source and binary forms, with or without … … 26 27 // This interface exists so that third party products (like Silk) can patch in to an Obj-C method to manipulate WebKit's font caching/substitution. 27 28 @interface WebFontCache : NSObject 28 + (NSFont *)fontWithFamily:(NSString *)desiredFamily traits:(NSFontTraitMask)desiredTraits size:(float)size;29 + (NSFont *)fontWithFamily:(NSString *)desiredFamily traits:(NSFontTraitMask)desiredTraits weight:(int)desiredWeight size:(float)size; 29 30 @end -
trunk/WebCore/platform/mac/WebFontCache.mm
r30066 r31620 1 1 /* 2 2 * Copyright (C) 2006, 2007 Apple Inc. All rights reserved. 3 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com> 3 4 * 4 5 * Redistribution and use in source and binary forms, with or without … … 35 36 36 37 #define IMPORTANT_FONT_TRAITS (0 \ 37 | NSBoldFontMask \38 38 | NSCompressedFontMask \ 39 39 | NSCondensedFontMask \ … … 45 45 ) 46 46 47 #define DESIRED_WEIGHT 5 48 49 static BOOL acceptableChoice(NSFontTraitMask desiredTraits, int desiredWeight, 50 NSFontTraitMask candidateTraits, int candidateWeight) 47 static BOOL acceptableChoice(NSFontTraitMask desiredTraits, int desiredWeight, NSFontTraitMask candidateTraits, int candidateWeight) 51 48 { 52 49 desiredTraits &= ~SYNTHESIZED_FONT_TRAITS; … … 58 55 NSFontTraitMask candidateTraits, int candidateWeight) 59 56 { 60 if (!acceptableChoice(desiredTraits, desiredWeight, candidateTraits, candidateWeight)) {57 if (!acceptableChoice(desiredTraits, desiredWeight, candidateTraits, candidateWeight)) 61 58 return NO; 62 } 63 59 64 60 // A list of the traits we care about. 65 61 // The top item in the list is the worst trait to mismatch; if a font has this … … 73 69 NSExpandedFontMask, 74 70 NSNarrowFontMask, 75 NSBoldFontMask, 76 0 }; 71 0 72 }; 73 77 74 int i = 0; 78 75 NSFontTraitMask mask; … … 86 83 return NO; 87 84 } 88 89 int chosenWeightDelta = chosenWeight - desiredWeight; 90 int candidateWeightDelta = candidateWeight - desiredWeight; 91 92 int chosenWeightDeltaMagnitude = abs(chosenWeightDelta); 93 int candidateWeightDeltaMagnitude = abs(candidateWeightDelta); 94 95 // Smaller magnitude wins. 96 // If both have same magnitude, tie breaker is that the smaller weight wins. 97 // Otherwise, first font in the array wins (should almost never happen). 98 if (candidateWeightDeltaMagnitude < chosenWeightDeltaMagnitude) { 99 return YES; 100 } 101 if (candidateWeightDeltaMagnitude == chosenWeightDeltaMagnitude && candidateWeight < chosenWeight) { 102 return YES; 103 } 104 105 return NO; 85 86 int chosenWeightDeltaMagnitude = abs(chosenWeight - desiredWeight); 87 int candidateWeightDeltaMagnitude = abs(candidateWeight - desiredWeight); 88 89 // If both are the same distance from the desired weight, prefer the candidate if it is further from regular. 90 if (chosenWeightDeltaMagnitude == candidateWeightDeltaMagnitude) 91 return abs(candidateWeight - 5) > abs(chosenWeight - 5); 92 93 // Otherwise, prefer the one closer to the desired weight. 94 return candidateWeightDeltaMagnitude < chosenWeightDeltaMagnitude; 95 } 96 97 // Workaround for <rdar://problem/5781372>. 98 static inline void fixUpWeight(NSInteger& weight, NSString *fontName) 99 { 100 if (weight == 3 && [fontName rangeOfString:@"ultralight" options:NSCaseInsensitiveSearch | NSBackwardsSearch | NSLiteralSearch].location != NSNotFound) 101 weight = 2; 106 102 } 107 103 … … 111 107 // comparing the desiredFamily to the PostScript name of the installed fonts. If that fails 112 108 // we then do a search based on the family names of the installed fonts. 113 + (NSFont *)internalFontWithFamily:(NSString *)desiredFamily traits:(NSFontTraitMask)desiredTraits size:(float)size109 + (NSFont *)internalFontWithFamily:(NSString *)desiredFamily traits:(NSFontTraitMask)desiredTraits weight:(int)desiredWeight size:(float)size 114 110 { 115 111 NSFontManager *fontManager = [NSFontManager sharedFontManager]; … … 129 125 130 126 NSFontTraitMask traits = [fontManager traitsOfFont:nameMatchedFont]; 131 if ((traits & desiredTraits) == desiredTraits) 127 NSInteger weight = [fontManager weightOfFont:nameMatchedFont]; 128 fixUpWeight(weight, availableFont); 129 130 if ((traits & desiredTraits) == desiredTraits && weight == desiredWeight) 132 131 return [fontManager convertFont:nameMatchedFont toHaveTrait:desiredTraits]; 133 132 break; … … 152 151 int chosenWeight = 0; 153 152 NSFontTraitMask chosenTraits = 0; 153 NSString *chosenFullName = 0; 154 154 155 155 NSArray *fonts = [fontManager availableMembersOfFontFamily:availableFamily]; … … 160 160 161 161 // Array indices must be hard coded because of lame AppKit API. 162 NSString *fontFullName = [fontInfo objectAtIndex:0]; 162 163 int fontWeight = [[fontInfo objectAtIndex:2] intValue]; 164 fixUpWeight(fontWeight, fontFullName); 165 163 166 NSFontTraitMask fontTraits = [[fontInfo objectAtIndex:3] unsignedIntValue]; 164 167 165 168 BOOL newWinner; 166 169 if (!choseFont) 167 newWinner = acceptableChoice(desiredTraits, DESIRED_WEIGHT, fontTraits, fontWeight);170 newWinner = acceptableChoice(desiredTraits, desiredWeight, fontTraits, fontWeight); 168 171 else 169 newWinner = betterChoice(desiredTraits, DESIRED_WEIGHT, chosenTraits, chosenWeight, fontTraits, fontWeight);172 newWinner = betterChoice(desiredTraits, desiredWeight, chosenTraits, chosenWeight, fontTraits, fontWeight); 170 173 171 174 if (newWinner) { … … 173 176 chosenWeight = fontWeight; 174 177 chosenTraits = fontTraits; 175 176 if (chosenWeight == DESIRED_WEIGHT && (chosenTraits & IMPORTANT_FONT_TRAITS) == (desiredTraits & IMPORTANT_FONT_TRAITS)) 178 chosenFullName = fontFullName; 179 180 if (chosenWeight == desiredWeight && (chosenTraits & IMPORTANT_FONT_TRAITS) == (desiredTraits & IMPORTANT_FONT_TRAITS)) 177 181 break; 178 182 } … … 182 186 return nil; 183 187 184 NSFont *font = [ fontManager fontWithFamily:availableFamily traits:chosenTraits weight:chosenWeightsize:size];188 NSFont *font = [NSFont fontWithName:chosenFullName size:size]; 185 189 186 190 if (!font) … … 188 192 189 193 NSFontTraitMask actualTraits = 0; 190 if (desiredTraits & (NSItalicFontMask | NSBoldFontMask)) 191 actualTraits = [[NSFontManager sharedFontManager] traitsOfFont:font]; 192 193 bool syntheticBold = (desiredTraits & NSBoldFontMask) && !(actualTraits & NSBoldFontMask); 194 bool syntheticOblique = (desiredTraits & NSItalicFontMask) && !(actualTraits & NSItalicFontMask); 194 if (desiredTraits & NSFontItalicTrait) 195 actualTraits = [fontManager traitsOfFont:font]; 196 int actualWeight = [fontManager weightOfFont:font]; 197 198 bool syntheticBold = desiredWeight >= 7 && actualWeight < 7; 199 bool syntheticOblique = (desiredTraits & NSFontItalicTrait) && !(actualTraits & NSFontItalicTrait); 195 200 196 201 // There are some malformed fonts that will be correctly returned by -fontWithFamily:traits:weight:size: as a match for a particular trait, … … 216 221 } 217 222 218 + (NSFont *)fontWithFamily:(NSString *)desiredFamily traits:(NSFontTraitMask)desiredTraits size:(float)size223 + (NSFont *)fontWithFamily:(NSString *)desiredFamily traits:(NSFontTraitMask)desiredTraits weight:(int)desiredWeight size:(float)size 219 224 { 220 225 #ifndef BUILDING_ON_TIGER 221 NSFont *font = [self internalFontWithFamily:desiredFamily traits:desiredTraits size:size];226 NSFont *font = [self internalFontWithFamily:desiredFamily traits:desiredTraits weight:desiredWeight size:size]; 222 227 if (font) 223 228 return font; … … 228 233 #endif 229 234 230 return [self internalFontWithFamily:desiredFamily traits:desiredTraits size:size];235 return [self internalFontWithFamily:desiredFamily traits:desiredTraits weight:desiredWeight size:size]; 231 236 } 232 237 -
trunk/WebCore/platform/win/PopupMenuWin.cpp
r30135 r31620 518 518 if (client()->itemIsLabel(index)) { 519 519 FontDescription d = itemFont.fontDescription(); 520 d.set Bold(true);520 d.setWeight(d.bolderWeight()); 521 521 itemFont = Font(d, itemFont.letterSpacing(), itemFont.wordSpacing()); 522 522 itemFont.update(m_popupClient->fontSelector()); -
trunk/WebCore/rendering/RenderListBox.cpp
r29663 r31620 113 113 text = static_cast<HTMLOptGroupElement*>(element)->groupLabelText(); 114 114 FontDescription d = itemFont.fontDescription(); 115 d.set Bold(true);115 d.setWeight(d.bolderWeight()); 116 116 itemFont = Font(d, itemFont.letterSpacing(), itemFont.wordSpacing()); 117 117 itemFont.update(document()->styleSelector()->fontSelector()); … … 332 332 if (element->hasTagName(optgroupTag)) { 333 333 FontDescription d = itemFont.fontDescription(); 334 d.set Bold(true);334 d.setWeight(d.bolderWeight()); 335 335 itemFont = Font(d, itemFont.letterSpacing(), itemFont.wordSpacing()); 336 336 itemFont.update(document()->styleSelector()->fontSelector()); -
trunk/WebCore/rendering/RenderThemeMac.mm
r31160 r31620 139 139 } 140 140 141 static FontWeight toFontWeight(NSInteger appKitFontWeight) 142 { 143 ASSERT(appKitFontWeight > 0 && appKitFontWeight < 15); 144 if (appKitFontWeight > 14) 145 appKitFontWeight = 14; 146 else if (appKitFontWeight < 1) 147 appKitFontWeight = 1; 148 149 static FontWeight fontWeights[] = { 150 FontWeight100, 151 FontWeight100, 152 FontWeight200, 153 FontWeight300, 154 FontWeight400, 155 FontWeight500, 156 FontWeight600, 157 FontWeight600, 158 FontWeight700, 159 FontWeight800, 160 FontWeight800, 161 FontWeight900, 162 FontWeight900, 163 FontWeight900 164 }; 165 return fontWeights[appKitFontWeight - 1]; 166 } 167 141 168 void RenderThemeMac::systemFont(int cssValueId, FontDescription& fontDescription) const 142 169 { … … 189 216 190 217 if (font) { 218 NSFontManager *fontManager = [NSFontManager sharedFontManager]; 191 219 cachedDesc->setIsAbsoluteSize(true); 192 220 cachedDesc->setGenericFamily(FontDescription::NoFamily); 193 221 cachedDesc->firstFamily().setFamily([font familyName]); 194 222 cachedDesc->setSpecifiedSize([font pointSize]); 195 NSFontTraitMask traits = [[NSFontManager sharedFontManager] traitsOfFont:font]; 196 cachedDesc->setBold(traits & NSBoldFontMask); 197 cachedDesc->setItalic(traits & NSItalicFontMask); 223 cachedDesc->setWeight(toFontWeight([fontManager weightOfFont:font])); 224 cachedDesc->setItalic([fontManager traitsOfFont:font] & NSItalicFontMask); 198 225 } 199 226 fontDescription = *cachedDesc; -
trunk/WebCore/rendering/RenderThemeSafari.cpp
r31160 r31620 193 193 cachedDesc->firstFamily().setFamily("Lucida Grande"); 194 194 cachedDesc->setSpecifiedSize(fontSize); 195 cachedDesc->set Bold(false);195 cachedDesc->setWeight(FontWeightNormal); 196 196 cachedDesc->setItalic(false); 197 197 } -
trunk/WebKit/mac/ChangeLog
r31577 r31620 1 2008-04-03 Nicholas Shanks <webkit@nickshanks.com> 2 3 Updated by Dan Bernstein. Reviewed by Dave Hyatt. 4 5 - WebKit part of fixing http://bugs.webkit.org/show_bug.cgi?id=6484 6 font-weight does not properly support graded weights 7 8 * WebView/WebHTMLView.mm: 9 (-[WebHTMLView _styleFromFontAttributes:]): 10 (-[WebHTMLView _originalFontB]): 11 (-[WebHTMLView _addToStyle:fontA:fontB:]): 12 1 13 2008-04-02 Mark Rowe <mrowe@apple.com> 2 14 -
trunk/WebKit/mac/WebView/WebHTMLView.mm
r31423 r31620 254 254 255 255 #define STANDARD_WEIGHT 5 256 #define MIN_BOLD_WEIGHT 9257 #define STANDARD_BOLD_WEIGHT 10256 #define MIN_BOLD_WEIGHT 7 257 #define STANDARD_BOLD_WEIGHT 9 258 258 259 259 // Fake URL scheme. … … 3714 3714 3715 3715 NSFont *font = [dictionary objectForKey:NSFontAttributeName]; 3716 if ( font == nil) {3716 if (!font) { 3717 3717 [style setFontFamily:@"Helvetica"]; 3718 3718 [style setFontSize:@"12px"]; … … 3725 3725 [style setFontFamily:[NSString stringWithFormat:@"'%@'", [font familyName]]]; 3726 3726 [style setFontSize:[NSString stringWithFormat:@"%0.fpx", [font pointSize]]]; 3727 // FIXME: Map to the entire range of CSS weight values. 3727 3728 if ([fm weightOfFont:font] >= MIN_BOLD_WEIGHT) 3728 3729 [style setFontWeight:@"bold"]; 3729 3730 else 3730 3731 [style setFontWeight:@"normal"]; 3731 if ( ([fm traitsOfFont:font] & NSItalicFontMask) != 0)3732 if ([fm traitsOfFont:font] & NSItalicFontMask) 3732 3733 [style setFontStyle:@"italic"]; 3733 3734 else … … 3864 3865 - (NSFont *)_originalFontB 3865 3866 { 3866 return [[NSFontManager sharedFontManager] fontWithFamily:@"Times" traits: (NSBoldFontMask | NSItalicFontMask)weight:STANDARD_BOLD_WEIGHT size:12.0f];3867 return [[NSFontManager sharedFontManager] fontWithFamily:@"Times" traits:NSFontItalicTrait weight:STANDARD_BOLD_WEIGHT size:12.0f]; 3867 3868 } 3868 3869 … … 3889 3890 int aWeight = [fm weightOfFont:a]; 3890 3891 int bWeight = [fm weightOfFont:b]; 3891 3892 BOOL aIsBold = aWeight >= MIN_BOLD_WEIGHT;3893 3892 3894 3893 BOOL aIsItalic = ([fm traitsOfFont:a] & NSItalicFontMask) != 0; … … 3903 3902 3904 3903 // Find the font the same way the rendering code would later if it encountered this CSS. 3905 NSFontTraitMask traits = 0; 3906 if (aIsBold) 3907 traits |= NSBoldFontMask; 3908 if (aIsItalic) 3909 traits |= NSItalicFontMask; 3910 NSFont *foundFont = WebCoreFindFont(aFamilyName, traits, aPointSize); 3904 NSFontTraitMask traits = aIsItalic ? NSFontItalicTrait : 0; 3905 NSFont *foundFont = WebCoreFindFont(aFamilyName, traits, aWeight, aPointSize); 3911 3906 3912 3907 // If we don't find a font with the same Postscript name, then we'll have to use the 3913 3908 // Postscript name to make the CSS specific enough. 3914 if (![[foundFont fontName] isEqualToString:[a fontName]]) {3909 if (![[foundFont fontName] isEqualToString:[a fontName]]) 3915 3910 familyNameForCSS = [a fontName]; 3916 }3917 3911 3918 3912 // FIXME: Need more sophisticated escaping code if we want to handle family names … … 3930 3924 3931 3925 if (aWeight == bWeight) 3932 [style setFontWeight:a IsBold? @"bold" : @"normal"];3926 [style setFontWeight:aWeight > MIN_BOLD_WEIGHT ? @"bold" : @"normal"]; 3933 3927 3934 3928 if (aIsItalic == bIsItalic) -
trunk/WebKit/win/ChangeLog
r31611 r31620 1 2008-04-03 Dan Bernstein <mitz@apple.com> 2 3 Reviewed by Dave Hyatt. 4 5 - WebKit part of fixing http://bugs.webkit.org/show_bug.cgi?id=6484 6 font-weight does not properly support graded weights 7 8 * DOMCoreClasses.cpp: 9 (DOMElement::font): Updated for the change to FontDescription. 10 * WebCoreSupport/WebDragClient.cpp: 11 (dragLabelFont): Ditto. 12 * WebKitGraphics.cpp: 13 (makeFont): Ditto. 14 * WebKitGraphics.h: Added a FIXME. 15 1 16 2008-04-03 Steve Falkenburg <sfalken@apple.com> 2 17 -
trunk/WebKit/win/DOMCoreClasses.cpp
r31596 r31620 1062 1062 webFontDescription->familyLength = family.length(); 1063 1063 webFontDescription->size = fontDescription.computedSize(); 1064 webFontDescription->bold = fontDescription. bold();1064 webFontDescription->bold = fontDescription.weight() >= FontWeight600; 1065 1065 webFontDescription->italic = fontDescription.italic(); 1066 1066 -
trunk/WebKit/win/WebCoreSupport/WebDragClient.cpp
r30477 r31620 161 161 { 162 162 FontDescription desc; 163 desc.set Bold(bold);163 desc.setWeight(bold ? FontWeightBold : FontWeightNormal); 164 164 FontFamily family; 165 165 family.setFamily("Lucida Grande"); -
trunk/WebKit/win/WebKitGraphics.cpp
r28067 r31620 62 62 f.setComputedSize(description.size); 63 63 f.setItalic(description.italic); 64 f.set Bold(description.bold);64 f.setWeight(description.bold ? FontWeightBold : FontWeightNormal); 65 65 f.setIsAbsoluteSize(true); 66 66 -
trunk/WebKit/win/WebKitGraphics.h
r24553 r31620 40 40 unsigned familyLength; 41 41 float size; 42 // FIXME: Change to weight. 42 43 bool bold; 43 44 bool italic;
Note: See TracChangeset
for help on using the changeset viewer.