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

Side by Side Diff: Source/platform/fonts/win/FontCacheSkiaWin.cpp

Issue 210243004: Usage of DirectWrite now determined browser-side (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: web function rather than RuntimeEnabledFeature Created 6 years, 9 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
« no previous file with comments | « Source/platform/fonts/FontCache.cpp ('k') | Source/web/web.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2007 Apple Computer, Inc. 2 * Copyright (C) 2006, 2007 Apple Computer, Inc.
3 * Copyright (c) 2006, 2007, 2008, 2009, 2012 Google Inc. All rights reserved. 3 * Copyright (c) 2006, 2007, 2008, 2009, 2012 Google Inc. All rights reserved.
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 are 6 * modification, are permitted provided that the following conditions are
7 * met: 7 * met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * 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 27 matching lines...) Expand all
38 #include "platform/fonts/FontDescription.h" 38 #include "platform/fonts/FontDescription.h"
39 #include "platform/fonts/SimpleFontData.h" 39 #include "platform/fonts/SimpleFontData.h"
40 #include "platform/fonts/win/FontFallbackWin.h" 40 #include "platform/fonts/win/FontFallbackWin.h"
41 #include "platform/fonts/win/FontPlatformDataWin.h" 41 #include "platform/fonts/win/FontPlatformDataWin.h"
42 42
43 namespace WebCore { 43 namespace WebCore {
44 44
45 FontCache::FontCache() 45 FontCache::FontCache()
46 : m_purgePreventCount(0) 46 : m_purgePreventCount(0)
47 { 47 {
48 SkFontMgr* fontManager = 0; 48 SkFontMgr* fontManager;
49 49
50 // Prefer DirectWrite (if runtime feature is enabled) but fallback 50 if (s_useDirectWrite) {
51 // to GDI on platforms where DirectWrite is not supported.
52 if (RuntimeEnabledFeatures::directWriteEnabled())
53 fontManager = SkFontMgr_New_DirectWrite(); 51 fontManager = SkFontMgr_New_DirectWrite();
54 52 } else {
55 // Subpixel text positioning is not supported by the GDI backend.
56 m_useSubpixelPositioning = fontManager
57 ? RuntimeEnabledFeatures::subpixelFontScalingEnabled()
58 : false;
59
60 if (!fontManager)
61 fontManager = SkFontMgr_New_GDI(); 53 fontManager = SkFontMgr_New_GDI();
54 // Subpixel text positioning is not supported by the GDI backend.
55 s_useSubpixelPositioning = false;
56 }
62 57
eae 2014/03/25 22:14:49 ASSERT(fontManager);
scottmg 2014/03/25 22:21:56 Done.
63 m_fontManager = adoptPtr(fontManager); 58 m_fontManager = adoptPtr(fontManager);
64 } 59 }
65 60
66 static bool fontContainsCharacter(const FontPlatformData* fontData, const wchar_ t* family, UChar32 character) 61 static bool fontContainsCharacter(const FontPlatformData* fontData, const wchar_ t* family, UChar32 character)
67 { 62 {
68 SkPaint paint; 63 SkPaint paint;
69 fontData->setupPaint(&paint); 64 fontData->setupPaint(&paint);
70 paint.setTextEncoding(SkPaint::kUTF32_TextEncoding); 65 paint.setTextEncoding(SkPaint::kUTF32_TextEncoding);
71 66
72 uint16_t glyph; 67 uint16_t glyph;
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 if (!typefacesMatchesFamily(tf.get(), family)) { 200 if (!typefacesMatchesFamily(tf.get(), family)) {
206 return 0; 201 return 0;
207 } 202 }
208 203
209 FontPlatformData* result = new FontPlatformData(tf, 204 FontPlatformData* result = new FontPlatformData(tf,
210 name.data(), 205 name.data(),
211 fontSize, 206 fontSize,
212 fontDescription.weight() >= FontWeightBold && !tf->isBold() || fontDescr iption.isSyntheticBold(), 207 fontDescription.weight() >= FontWeightBold && !tf->isBold() || fontDescr iption.isSyntheticBold(),
213 fontDescription.style() == FontStyleItalic && !tf->isItalic() || fontDes cription.isSyntheticItalic(), 208 fontDescription.style() == FontStyleItalic && !tf->isItalic() || fontDes cription.isSyntheticItalic(),
214 fontDescription.orientation(), 209 fontDescription.orientation(),
215 m_useSubpixelPositioning); 210 s_useSubpixelPositioning);
216 return result; 211 return result;
217 } 212 }
218 213
219 } 214 }
OLDNEW
« no previous file with comments | « Source/platform/fonts/FontCache.cpp ('k') | Source/web/web.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698