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

Side by Side Diff: third_party/WebKit/Source/platform/fonts/FontRenderStyle.h

Issue 1931393002: Introduce typeface cache in blink::FontCache (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: wip: others Created 4 years, 7 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 /* Copyright (c) 2010, Google Inc. All rights reserved. 1 /* Copyright (c) 2010, Google Inc. All rights reserved.
2 * 2 *
3 * Redistribution and use in source and binary forms, with or without 3 * Redistribution and use in source and binary forms, with or without
4 * modification, are permitted provided that the following conditions are 4 * modification, are permitted provided that the following conditions are
5 * met: 5 * met:
6 * 6 *
7 * * Redistributions of source code must retain the above copyright 7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above 9 * * Redistributions in binary form must reproduce the above
10 * copyright notice, this list of conditions and the following disclaimer 10 * copyright notice, this list of conditions and the following disclaimer
(...skipping 14 matching lines...) Expand all
25 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 */ 28 */
29 29
30 #ifndef FontRenderStyle_h 30 #ifndef FontRenderStyle_h
31 #define FontRenderStyle_h 31 #define FontRenderStyle_h
32 32
33 #include "wtf/Allocator.h" 33 #include "wtf/Allocator.h"
34 34
35 #include "platform/PlatformExport.h"
36 #include "SkTypeface.h"
37 #include "SkPaint.h"
38
39 namespace WTF {
40 class String;
41 }
42
35 namespace blink { 43 namespace blink {
36 44
37 // FontRenderStyle describes the user's preferences for rendering a font at a 45 // FontRenderStyle describes the user's preferences for rendering a font at a
38 // given size. 46 // given size.
39 struct FontRenderStyle { 47 struct PLATFORM_EXPORT FontRenderStyle {
40 DISALLOW_NEW(); 48 DISALLOW_NEW();
41 enum { 49 enum {
42 NoPreference = 2, 50 NoPreference = 2,
43 }; 51 };
44 52
45 FontRenderStyle() 53 FontRenderStyle()
46 : useBitmaps(0) 54 : useBitmaps(0)
47 , useAutoHint(0) 55 , useAutoHint(0)
48 , useHinting(0) 56 , useHinting(0)
49 , hintStyle(0) 57 , hintStyle(0)
50 , useAntiAlias(0) 58 , useAntiAlias(0)
51 , useSubpixelRendering(0) 59 , useSubpixelRendering(0)
52 , useSubpixelPositioning(0) { } 60 , useSubpixelPositioning(0) { }
53 61
54 bool operator==(const FontRenderStyle& a) const 62 bool operator==(const FontRenderStyle& a) const
55 { 63 {
56 return useBitmaps == a.useBitmaps 64 return useBitmaps == a.useBitmaps
57 && useAutoHint == a.useAutoHint 65 && useAutoHint == a.useAutoHint
58 && useHinting == a.useHinting 66 && useHinting == a.useHinting
59 && hintStyle == a.hintStyle 67 && hintStyle == a.hintStyle
60 && useAntiAlias == a.useAntiAlias 68 && useAntiAlias == a.useAntiAlias
61 && useSubpixelRendering == a.useSubpixelRendering 69 && useSubpixelRendering == a.useSubpixelRendering
62 && useSubpixelPositioning == a.useSubpixelPositioning; 70 && useSubpixelPositioning == a.useSubpixelPositioning;
63 } 71 }
64 72
73 static void setHinting(SkPaint::Hinting);
74 static void setAutoHint(bool);
75 static void setUseBitmaps(bool);
76 static void setAntiAlias(bool);
77 static void setSubpixelRendering(bool);
78
79 void apply(SkPaint*, float deviceScaleFactor = 1.0) const;
80 void querySystemForRenderStyle(WTF::String family, float textSize, SkTypefac e::Style);
81
65 // Each of the use* members below can take one of three values: 82 // Each of the use* members below can take one of three values:
66 // 0: off 83 // 0: off
67 // 1: on 84 // 1: on
68 // NoPreference: no preference expressed 85 // NoPreference: no preference expressed
69 char useBitmaps; // use embedded bitmap strike if possible 86 char useBitmaps; // use embedded bitmap strike if possible
70 char useAutoHint; // use 'auto' hinting (FreeType specific) 87 char useAutoHint; // use 'auto' hinting (FreeType specific)
71 char useHinting; // hint glyphs to the pixel grid 88 char useHinting; // hint glyphs to the pixel grid
72 char hintStyle; // level of hinting, 0..3 89 char hintStyle; // level of hinting, 0..3
73 char useAntiAlias; // antialias glyph shapes 90 char useAntiAlias; // antialias glyph shapes
74 char useSubpixelRendering; // use subpixel rendering (partially-filled pixel s) 91 char useSubpixelRendering; // use subpixel rendering (partially-filled pixel s)
75 char useSubpixelPositioning; // use subpixel positioning (fractional X posit ions for glyphs) 92 char useSubpixelPositioning; // use subpixel positioning (fractional X posit ions for glyphs)
76 }; 93 };
77 94
78 } // namespace blink 95 } // namespace blink
79 96
80 #endif // FontRenderStyle_h 97 #endif // FontRenderStyle_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698