Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(77)

Side by Side Diff: Source/platform/fonts/skia/FontCacheSkia.cpp

Issue 138273018: Use synthetic bold/italic terminology consistently (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2006, 2007, 2008, 2009 Google Inc. All rights reserved. 2 * Copyright (c) 2006, 2007, 2008, 2009 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 icu::Locale locale = icu::Locale::getDefault(); 54 icu::Locale locale = icu::Locale::getDefault();
55 FontCache::SimpleFontFamily family; 55 FontCache::SimpleFontFamily family;
56 FontCache::getFontFamilyForCharacter(c, locale.getLanguage(), &family); 56 FontCache::getFontFamilyForCharacter(c, locale.getLanguage(), &family);
57 if (family.name.isEmpty()) 57 if (family.name.isEmpty())
58 return 0; 58 return 0;
59 59
60 AtomicString atomicFamily(family.name); 60 AtomicString atomicFamily(family.name);
61 // Changes weight and/or italic of given FontDescription depends on 61 // Changes weight and/or italic of given FontDescription depends on
62 // the result of fontconfig so that keeping the correct font mapping 62 // the result of fontconfig so that keeping the correct font mapping
63 // of the given character. See http://crbug.com/32109 for details. 63 // of the given character. See http://crbug.com/32109 for details.
64 bool shouldSetFakeBold = false; 64 bool shouldSetSyntheticBold = false;
65 bool shouldSetFakeItalic = false; 65 bool shouldSetSyntheticItalic = false;
66 FontDescription description(fontDescription); 66 FontDescription description(fontDescription);
67 if (family.isBold && description.weight() < FontWeightBold) 67 if (family.isBold && description.weight() < FontWeightBold)
68 description.setWeight(FontWeightBold); 68 description.setWeight(FontWeightBold);
69 if (!family.isBold && description.weight() >= FontWeightBold) { 69 if (!family.isBold && description.weight() >= FontWeightBold) {
70 shouldSetFakeBold = true; 70 shouldSetSyntheticBold = true;
71 description.setWeight(FontWeightNormal); 71 description.setWeight(FontWeightNormal);
72 } 72 }
73 if (family.isItalic && description.italic() == FontItalicOff) 73 if (family.isItalic && description.italic() == FontItalicOff)
74 description.setItalic(FontItalicOn); 74 description.setItalic(FontItalicOn);
75 if (!family.isItalic && description.italic() == FontItalicOn) { 75 if (!family.isItalic && description.italic() == FontItalicOn) {
76 shouldSetFakeItalic = true; 76 shouldSetSyntheticItalic = true;
77 description.setItalic(FontItalicOff); 77 description.setItalic(FontItalicOff);
78 } 78 }
79 79
80 FontPlatformData* substitutePlatformData = getFontPlatformData(description, atomicFamily); 80 FontPlatformData* substitutePlatformData = getFontPlatformData(description, atomicFamily);
81 if (!substitutePlatformData) 81 if (!substitutePlatformData)
82 return 0; 82 return 0;
83 FontPlatformData platformData = FontPlatformData(*substitutePlatformData); 83 FontPlatformData platformData = FontPlatformData(*substitutePlatformData);
84 platformData.setFakeBold(shouldSetFakeBold); 84 platformData.setSyntheticBold(shouldSetSyntheticBold);
85 platformData.setFakeItalic(shouldSetFakeItalic); 85 platformData.setSyntheticItalic(shouldSetSyntheticItalic);
86 return fontDataFromFontPlatformData(&platformData, DoNotRetain); 86 return fontDataFromFontPlatformData(&platformData, DoNotRetain);
87 } 87 }
88 88
89 #endif // !OS(WINDOWNS) && !OS(ANDROID) 89 #endif // !OS(WINDOWNS) && !OS(ANDROID)
90 90
91 PassRefPtr<SimpleFontData> FontCache::getLastResortFallbackFont(const FontDescri ption& description, ShouldRetain shouldRetain) 91 PassRefPtr<SimpleFontData> FontCache::getLastResortFallbackFont(const FontDescri ption& description, ShouldRetain shouldRetain)
92 { 92 {
93 const AtomicString fallbackFontFamily = getFallbackFontFamily(description); 93 const AtomicString fallbackFontFamily = getFallbackFontFamily(description);
94 const FontPlatformData* fontPlatformData = 0; 94 const FontPlatformData* fontPlatformData = 0;
95 if (!fallbackFontFamily.isEmpty()) 95 if (!fallbackFontFamily.isEmpty())
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 fontSize, 163 fontSize,
164 (fontDescription.weight() >= FontWeightBold && !tf->isBold()) || fontDes cription.isSyntheticBold(), 164 (fontDescription.weight() >= FontWeightBold && !tf->isBold()) || fontDes cription.isSyntheticBold(),
165 (fontDescription.italic() && !tf->isItalic()) || fontDescription.isSynth eticItalic(), 165 (fontDescription.italic() && !tf->isItalic()) || fontDescription.isSynth eticItalic(),
166 fontDescription.orientation(), 166 fontDescription.orientation(),
167 fontDescription.useSubpixelPositioning()); 167 fontDescription.useSubpixelPositioning());
168 return result; 168 return result;
169 } 169 }
170 #endif // !OS(WINDOWNS) 170 #endif // !OS(WINDOWNS)
171 171
172 } // namespace WebCore 172 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/platform/fonts/harfbuzz/FontPlatformDataHarfBuzz.cpp ('k') | Source/platform/fonts/skia/FontPlatformDataSkia.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698