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

Side by Side Diff: Source/platform/fonts/FontCache.h

Issue 790733005: Blink side of the change to pass the system font metrics from the browser to the renderer on Windo… (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2008 Apple Computer, Inc. All rights reserved. 2 * Copyright (C) 2006, 2008 Apple Computer, Inc. All rights reserved.
3 * Copyright (C) 2007-2008 Torch Mobile, Inc. 3 * Copyright (C) 2007-2008 Torch Mobile, Inc.
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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 #if OS(WIN) 103 #if OS(WIN)
104 bool useSubpixelPositioning() const { return s_useSubpixelPositioning; } 104 bool useSubpixelPositioning() const { return s_useSubpixelPositioning; }
105 SkFontMgr* fontManager() { return m_fontManager.get(); } 105 SkFontMgr* fontManager() { return m_fontManager.get(); }
106 static bool useDirectWrite() { return s_useDirectWrite; } 106 static bool useDirectWrite() { return s_useDirectWrite; }
107 static float deviceScaleFactor() { return s_deviceScaleFactor; } 107 static float deviceScaleFactor() { return s_deviceScaleFactor; }
108 static void setUseDirectWrite(bool useDirectWrite) { s_useDirectWrite = useD irectWrite; } 108 static void setUseDirectWrite(bool useDirectWrite) { s_useDirectWrite = useD irectWrite; }
109 static void setDirectWriteFactory(IDWriteFactory* factory) { s_directWriteFa ctory = factory; } 109 static void setDirectWriteFactory(IDWriteFactory* factory) { s_directWriteFa ctory = factory; }
110 static void setDeviceScaleFactor(float deviceScaleFactor) { s_deviceScaleFac tor = deviceScaleFactor; } 110 static void setDeviceScaleFactor(float deviceScaleFactor) { s_deviceScaleFac tor = deviceScaleFactor; }
111 static void setUseSubpixelPositioning(bool useSubpixelPositioning) { s_useSu bpixelPositioning = useSubpixelPositioning; } 111 static void setUseSubpixelPositioning(bool useSubpixelPositioning) { s_useSu bpixelPositioning = useSubpixelPositioning; }
112 static void addSideloadedFontForTesting(SkTypeface*); 112 static void addSideloadedFontForTesting(SkTypeface*);
113 // Functions to cache and retrieve the system font metrics.
114 static void setMenuFontMetrics(const wchar_t* familyName, int32_t fontHeight );
115 static void setSmallCaptionFontMetrics(const wchar_t* familyName, int32_t fo ntHeight);
116 static void setStatusFontMetrics(const wchar_t* familyName, int32_t fontHeig ht);
117 static int32_t menuFontHeight() { return s_menuFontHeight; }
118 static const String& menuFontFamily() { return s_smallCaptionFontFamilyName; }
119 static int32_t smallCaptionFontHeight() { return s_smallCaptionFontHeight; }
120 static const String& smallCaptionFontFamily() { return s_smallCaptionFontFam ilyName; }
121 static int32_t statusFontHeight() { return s_statusFontHeight; }
122 static const String& statusFontFamily() { return s_statusFontFamilyName; }
113 #endif 123 #endif
114 124
115 typedef uint32_t FontFileKey; 125 typedef uint32_t FontFileKey;
116 PassRefPtr<OpenTypeVerticalData> getVerticalData(const FontFileKey&, const F ontPlatformData&); 126 PassRefPtr<OpenTypeVerticalData> getVerticalData(const FontFileKey&, const F ontPlatformData&);
117 127
118 #if OS(ANDROID) 128 #if OS(ANDROID)
119 static AtomicString getGenericFamilyNameForScript(const AtomicString& family Name, const FontDescription&); 129 static AtomicString getGenericFamilyNameForScript(const AtomicString& family Name, const FontDescription&);
120 #else 130 #else
121 struct PlatformFallbackFont { 131 struct PlatformFallbackFont {
122 String name; 132 String name;
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 // Don't purge if this count is > 0; 168 // Don't purge if this count is > 0;
159 int m_purgePreventCount; 169 int m_purgePreventCount;
160 170
161 #if OS(WIN) 171 #if OS(WIN)
162 OwnPtr<SkFontMgr> m_fontManager; 172 OwnPtr<SkFontMgr> m_fontManager;
163 static bool s_useDirectWrite; 173 static bool s_useDirectWrite;
164 static IDWriteFactory* s_directWriteFactory; 174 static IDWriteFactory* s_directWriteFactory;
165 static float s_deviceScaleFactor; 175 static float s_deviceScaleFactor;
166 static bool s_useSubpixelPositioning; 176 static bool s_useSubpixelPositioning;
167 static HashMap<String, RefPtr<SkTypeface> >* s_sideloadedFonts; 177 static HashMap<String, RefPtr<SkTypeface> >* s_sideloadedFonts;
178 // The system font metrics cache.
179 static String s_menuFontFamilyName;
scottmg 2015/01/06 23:13:57 you might need to make these String* and allocate
ananta 2015/01/06 23:30:16 Makes sense. Done. Changed these to AtomicString*
180 static int32_t s_menuFontHeight;
181 static String s_smallCaptionFontFamilyName;
182 static int32_t s_smallCaptionFontHeight;
183 static String s_statusFontFamilyName;
184 static int32_t s_statusFontHeight;
168 #endif 185 #endif
169 186
170 #if OS(MACOSX) || OS(ANDROID) 187 #if OS(MACOSX) || OS(ANDROID)
171 friend class ComplexTextController; 188 friend class ComplexTextController;
172 #endif 189 #endif
173 friend class SimpleFontData; // For fontDataFromFontPlatformData 190 friend class SimpleFontData; // For fontDataFromFontPlatformData
174 friend class FontFallbackList; 191 friend class FontFallbackList;
175 }; 192 };
176 193
177 class PLATFORM_EXPORT FontCachePurgePreventer { 194 class PLATFORM_EXPORT FontCachePurgePreventer {
178 public: 195 public:
179 FontCachePurgePreventer() { FontCache::fontCache()->disablePurging(); } 196 FontCachePurgePreventer() { FontCache::fontCache()->disablePurging(); }
180 ~FontCachePurgePreventer() { FontCache::fontCache()->enablePurging(); } 197 ~FontCachePurgePreventer() { FontCache::fontCache()->enablePurging(); }
181 }; 198 };
182 199
183 } // namespace blink 200 } // namespace blink
184 201
185 #endif 202 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698