OLD | NEW |
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 12 matching lines...) Expand all Loading... |
23 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 23 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
24 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 24 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
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 "SkPaint.h" |
| 34 #include "SkTypeface.h" |
| 35 #include "platform/PlatformExport.h" |
33 #include "wtf/Allocator.h" | 36 #include "wtf/Allocator.h" |
| 37 #include "wtf/text/CString.h" |
34 | 38 |
35 namespace blink { | 39 namespace blink { |
36 | 40 |
37 // FontRenderStyle describes the user's preferences for rendering a font at a | 41 // FontRenderStyle describes the user's preferences for rendering a font at a |
38 // given size. | 42 // given size. |
39 struct FontRenderStyle { | 43 struct FontRenderStyle { |
40 DISALLOW_NEW(); | 44 DISALLOW_NEW(); |
41 enum { | 45 enum { |
42 NoPreference = 2, | 46 NoPreference = 2, |
43 }; | 47 }; |
(...skipping 11 matching lines...) Expand all Loading... |
55 { | 59 { |
56 return useBitmaps == a.useBitmaps | 60 return useBitmaps == a.useBitmaps |
57 && useAutoHint == a.useAutoHint | 61 && useAutoHint == a.useAutoHint |
58 && useHinting == a.useHinting | 62 && useHinting == a.useHinting |
59 && hintStyle == a.hintStyle | 63 && hintStyle == a.hintStyle |
60 && useAntiAlias == a.useAntiAlias | 64 && useAntiAlias == a.useAntiAlias |
61 && useSubpixelRendering == a.useSubpixelRendering | 65 && useSubpixelRendering == a.useSubpixelRendering |
62 && useSubpixelPositioning == a.useSubpixelPositioning; | 66 && useSubpixelPositioning == a.useSubpixelPositioning; |
63 } | 67 } |
64 | 68 |
| 69 PLATFORM_EXPORT static void setHinting(SkPaint::Hinting); |
| 70 PLATFORM_EXPORT static void setAutoHint(bool); |
| 71 PLATFORM_EXPORT static void setUseBitmaps(bool); |
| 72 PLATFORM_EXPORT static void setAntiAlias(bool); |
| 73 PLATFORM_EXPORT static void setSubpixelRendering(bool); |
| 74 |
| 75 static FontRenderStyle querySystem(const CString& family, float textSize, Sk
Typeface::Style typefaceStyle); |
| 76 void applyToPaint(SkPaint&, float deviceScaleFactor) const; |
| 77 |
65 // Each of the use* members below can take one of three values: | 78 // Each of the use* members below can take one of three values: |
66 // 0: off | 79 // 0: off |
67 // 1: on | 80 // 1: on |
68 // NoPreference: no preference expressed | 81 // NoPreference: no preference expressed |
69 char useBitmaps; // use embedded bitmap strike if possible | 82 char useBitmaps; // use embedded bitmap strike if possible |
70 char useAutoHint; // use 'auto' hinting (FreeType specific) | 83 char useAutoHint; // use 'auto' hinting (FreeType specific) |
71 char useHinting; // hint glyphs to the pixel grid | 84 char useHinting; // hint glyphs to the pixel grid |
72 char hintStyle; // level of hinting, 0..3 | 85 char hintStyle; // level of hinting, 0..3 |
73 char useAntiAlias; // antialias glyph shapes | 86 char useAntiAlias; // antialias glyph shapes |
74 char useSubpixelRendering; // use subpixel rendering (partially-filled pixel
s) | 87 char useSubpixelRendering; // use subpixel rendering (partially-filled pixel
s) |
75 char useSubpixelPositioning; // use subpixel positioning (fractional X posit
ions for glyphs) | 88 char useSubpixelPositioning; // use subpixel positioning (fractional X posit
ions for glyphs) |
76 }; | 89 }; |
77 | 90 |
78 } // namespace blink | 91 } // namespace blink |
79 | 92 |
80 #endif // FontRenderStyle_h | 93 #endif // FontRenderStyle_h |
OLD | NEW |