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

Side by Side Diff: Source/core/platform/graphics/FontCache.cpp

Issue 23672027: Rename OS(WINDOWS) to OS(WIN) (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 3 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2008 Apple Inc. All rights reserved.
3 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com> 3 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com>
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 8 *
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 using namespace WTF; 46 using namespace WTF;
47 47
48 namespace WebCore { 48 namespace WebCore {
49 49
50 FontCache* fontCache() 50 FontCache* fontCache()
51 { 51 {
52 DEFINE_STATIC_LOCAL(FontCache, globalFontCache, ()); 52 DEFINE_STATIC_LOCAL(FontCache, globalFontCache, ());
53 return &globalFontCache; 53 return &globalFontCache;
54 } 54 }
55 55
56 #if !OS(WINDOWS) || ENABLE(GDI_FONTS_ON_WINDOWS) 56 #if !OS(WIN) || ENABLE(GDI_FONTS_ON_WINDOWS)
57 FontCache::FontCache() 57 FontCache::FontCache()
58 : m_purgePreventCount(0) 58 : m_purgePreventCount(0)
59 { 59 {
60 } 60 }
61 #endif // !OS(WINDOWS) || ENABLE(GDI_FONTS_ON_WINDOWS) 61 #endif // !OS(WIN) || ENABLE(GDI_FONTS_ON_WINDOWS)
62 62
63 struct FontPlatformDataCacheKey { 63 struct FontPlatformDataCacheKey {
64 WTF_MAKE_FAST_ALLOCATED; 64 WTF_MAKE_FAST_ALLOCATED;
65 public: 65 public:
66 FontPlatformDataCacheKey(const AtomicString& family = AtomicString(), unsign ed size = 0, unsigned weight = 0, bool italic = false, 66 FontPlatformDataCacheKey(const AtomicString& family = AtomicString(), unsign ed size = 0, unsigned weight = 0, bool italic = false,
67 bool isPrinterFont = false, FontOrientation orientation = Horizontal, Fo ntWidthVariant widthVariant = RegularWidth) 67 bool isPrinterFont = false, FontOrientation orientation = Horizontal, Fo ntWidthVariant widthVariant = RegularWidth)
68 : m_size(size) 68 : m_size(size)
69 , m_weight(weight) 69 , m_weight(weight)
70 , m_family(family) 70 , m_family(family)
71 , m_italic(italic) 71 , m_italic(italic)
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 129
130 static FontPlatformDataCache* gFontPlatformDataCache = 0; 130 static FontPlatformDataCache* gFontPlatformDataCache = 0;
131 131
132 static const AtomicString& alternateFamilyName(const AtomicString& familyName) 132 static const AtomicString& alternateFamilyName(const AtomicString& familyName)
133 { 133 {
134 // Alias Courier <-> Courier New 134 // Alias Courier <-> Courier New
135 DEFINE_STATIC_LOCAL(AtomicString, courier, ("Courier", AtomicString::Constru ctFromLiteral)); 135 DEFINE_STATIC_LOCAL(AtomicString, courier, ("Courier", AtomicString::Constru ctFromLiteral));
136 DEFINE_STATIC_LOCAL(AtomicString, courierNew, ("Courier New", AtomicString:: ConstructFromLiteral)); 136 DEFINE_STATIC_LOCAL(AtomicString, courierNew, ("Courier New", AtomicString:: ConstructFromLiteral));
137 if (equalIgnoringCase(familyName, courier)) 137 if (equalIgnoringCase(familyName, courier))
138 return courierNew; 138 return courierNew;
139 #if !OS(WINDOWS) 139 #if !OS(WIN)
140 // On Windows, Courier New (truetype font) is always present and 140 // On Windows, Courier New (truetype font) is always present and
141 // Courier is a bitmap font. So, we don't want to map Courier New to 141 // Courier is a bitmap font. So, we don't want to map Courier New to
142 // Courier. 142 // Courier.
143 if (equalIgnoringCase(familyName, courierNew)) 143 if (equalIgnoringCase(familyName, courierNew))
144 return courier; 144 return courier;
145 #endif 145 #endif
146 146
147 // Alias Times and Times New Roman. 147 // Alias Times and Times New Roman.
148 DEFINE_STATIC_LOCAL(AtomicString, times, ("Times", AtomicString::ConstructFr omLiteral)); 148 DEFINE_STATIC_LOCAL(AtomicString, times, ("Times", AtomicString::ConstructFr omLiteral));
149 DEFINE_STATIC_LOCAL(AtomicString, timesNewRoman, ("Times New Roman", AtomicS tring::ConstructFromLiteral)); 149 DEFINE_STATIC_LOCAL(AtomicString, timesNewRoman, ("Times New Roman", AtomicS tring::ConstructFromLiteral));
150 if (equalIgnoringCase(familyName, times)) 150 if (equalIgnoringCase(familyName, times))
151 return timesNewRoman; 151 return timesNewRoman;
152 if (equalIgnoringCase(familyName, timesNewRoman)) 152 if (equalIgnoringCase(familyName, timesNewRoman))
153 return times; 153 return times;
154 154
155 // Alias Arial and Helvetica 155 // Alias Arial and Helvetica
156 DEFINE_STATIC_LOCAL(AtomicString, arial, ("Arial", AtomicString::ConstructFr omLiteral)); 156 DEFINE_STATIC_LOCAL(AtomicString, arial, ("Arial", AtomicString::ConstructFr omLiteral));
157 DEFINE_STATIC_LOCAL(AtomicString, helvetica, ("Helvetica", AtomicString::Con structFromLiteral)); 157 DEFINE_STATIC_LOCAL(AtomicString, helvetica, ("Helvetica", AtomicString::Con structFromLiteral));
158 if (equalIgnoringCase(familyName, arial)) 158 if (equalIgnoringCase(familyName, arial))
159 return helvetica; 159 return helvetica;
160 if (equalIgnoringCase(familyName, helvetica)) 160 if (equalIgnoringCase(familyName, helvetica))
161 return arial; 161 return arial;
162 162
163 #if OS(WINDOWS) 163 #if OS(WIN)
164 // On Windows, bitmap fonts are blocked altogether so that we have to 164 // On Windows, bitmap fonts are blocked altogether so that we have to
165 // alias MS Sans Serif (bitmap font) -> Microsoft Sans Serif (truetype font) 165 // alias MS Sans Serif (bitmap font) -> Microsoft Sans Serif (truetype font)
166 DEFINE_STATIC_LOCAL(AtomicString, msSans, ("MS Sans Serif", AtomicString::Co nstructFromLiteral)); 166 DEFINE_STATIC_LOCAL(AtomicString, msSans, ("MS Sans Serif", AtomicString::Co nstructFromLiteral));
167 DEFINE_STATIC_LOCAL(AtomicString, microsoftSans, ("Microsoft Sans Serif", At omicString::ConstructFromLiteral)); 167 DEFINE_STATIC_LOCAL(AtomicString, microsoftSans, ("Microsoft Sans Serif", At omicString::ConstructFromLiteral));
168 if (equalIgnoringCase(familyName, msSans)) 168 if (equalIgnoringCase(familyName, msSans))
169 return microsoftSans; 169 return microsoftSans;
170 170
171 // Alias MS Serif (bitmap) -> Times New Roman (truetype font). There's no 171 // Alias MS Serif (bitmap) -> Times New Roman (truetype font). There's no
172 // 'Microsoft Sans Serif-equivalent' for Serif. 172 // 'Microsoft Sans Serif-equivalent' for Serif.
173 DEFINE_STATIC_LOCAL(AtomicString, msSerif, ("MS Serif", AtomicString::Constr uctFromLiteral)); 173 DEFINE_STATIC_LOCAL(AtomicString, msSerif, ("MS Serif", AtomicString::Constr uctFromLiteral));
174 if (equalIgnoringCase(familyName, msSerif)) 174 if (equalIgnoringCase(familyName, msSerif))
175 return timesNewRoman; 175 return timesNewRoman;
176 #endif 176 #endif
177 177
178 return emptyAtom; 178 return emptyAtom;
179 } 179 }
180 180
181 FontPlatformData* FontCache::getFontResourcePlatformData(const FontDescription& fontDescription, 181 FontPlatformData* FontCache::getFontResourcePlatformData(const FontDescription& fontDescription,
182 const AtomicString& passe dFamilyName, 182 const AtomicString& passe dFamilyName,
183 bool checkingAlternateNam e) 183 bool checkingAlternateNam e)
184 { 184 {
185 #if OS(WINDOWS) && ENABLE(OPENTYPE_VERTICAL) 185 #if OS(WIN) && ENABLE(OPENTYPE_VERTICAL)
186 // Leading "@" in the font name enables Windows vertical flow flag for the f ont. 186 // Leading "@" in the font name enables Windows vertical flow flag for the f ont.
187 // Because we do vertical flow by ourselves, we don't want to use the Window s feature. 187 // Because we do vertical flow by ourselves, we don't want to use the Window s feature.
188 // IE disregards "@" regardless of the orientatoin, so we follow the behavio r. 188 // IE disregards "@" regardless of the orientatoin, so we follow the behavio r.
189 const AtomicString& familyName = (passedFamilyName.isEmpty() || passedFamily Name[0] != '@') ? 189 const AtomicString& familyName = (passedFamilyName.isEmpty() || passedFamily Name[0] != '@') ?
190 passedFamilyName : AtomicString(passedFamilyName.impl()->substring(1)); 190 passedFamilyName : AtomicString(passedFamilyName.impl()->substring(1));
191 #else 191 #else
192 const AtomicString& familyName = passedFamilyName; 192 const AtomicString& familyName = passedFamilyName;
193 #endif 193 #endif
194 194
195 if (!gFontPlatformDataCache) { 195 if (!gFontPlatformDataCache) {
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after
579 case FontDescription::SansSerifFamily: 579 case FontDescription::SansSerifFamily:
580 default: 580 default:
581 fontPlatformData = getFontResourcePlatformData(description, sansStr); 581 fontPlatformData = getFontResourcePlatformData(description, sansStr);
582 break; 582 break;
583 } 583 }
584 584
585 return fontPlatformData; 585 return fontPlatformData;
586 } 586 }
587 587
588 } // namespace WebCore 588 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/platform/graphics/FontCache.h ('k') | Source/core/platform/graphics/FontCustomPlatformData.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698