OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/renderer/render_view_impl.h" | 5 #include "content/renderer/render_view_impl.h" |
6 | 6 |
7 #include "content/public/common/renderer_preferences.h" | 7 #include "content/public/common/renderer_preferences.h" |
| 8 #include "third_party/WebKit/Source/WebKit/chromium/public/linux/WebFontInfo.h" |
8 #include "third_party/WebKit/Source/WebKit/chromium/public/linux/WebFontRenderin
g.h" | 9 #include "third_party/WebKit/Source/WebKit/chromium/public/linux/WebFontRenderin
g.h" |
9 | 10 |
| 11 using WebKit::WebFontInfo; |
10 using WebKit::WebFontRendering; | 12 using WebKit::WebFontRendering; |
11 | 13 |
12 static SkPaint::Hinting RendererPreferencesToSkiaHinting( | 14 static SkPaint::Hinting RendererPreferencesToSkiaHinting( |
13 const content::RendererPreferences& prefs) { | 15 const content::RendererPreferences& prefs) { |
14 if (!prefs.should_antialias_text) { | 16 if (!prefs.should_antialias_text) { |
15 // When anti-aliasing is off, GTK maps all non-zero hinting settings to | 17 // When anti-aliasing is off, GTK maps all non-zero hinting settings to |
16 // 'Normal' hinting so we do the same. Otherwise, folks who have 'Slight' | 18 // 'Normal' hinting so we do the same. Otherwise, folks who have 'Slight' |
17 // hinting selected will see readable text in everything expect Chromium. | 19 // hinting selected will see readable text in everything expect Chromium. |
18 switch (prefs.hinting) { | 20 switch (prefs.hinting) { |
19 case content::RENDERER_PREFERENCES_HINTING_NONE: | 21 case content::RENDERER_PREFERENCES_HINTING_NONE: |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 NOTREACHED(); | 81 NOTREACHED(); |
80 return SkFontHost::kHorizontal_LCDOrientation; | 82 return SkFontHost::kHorizontal_LCDOrientation; |
81 } | 83 } |
82 } | 84 } |
83 | 85 |
84 static bool RendererPreferencesToAntiAliasFlag( | 86 static bool RendererPreferencesToAntiAliasFlag( |
85 const content::RendererPreferences& prefs) { | 87 const content::RendererPreferences& prefs) { |
86 return prefs.should_antialias_text; | 88 return prefs.should_antialias_text; |
87 } | 89 } |
88 | 90 |
89 static bool RendererPreferencesToSubpixelGlyphsFlag( | 91 static bool RendererPreferencesToSubpixelRenderingFlag( |
90 const content::RendererPreferences& prefs) { | 92 const content::RendererPreferences& prefs) { |
91 if (prefs.subpixel_rendering != | 93 if (prefs.subpixel_rendering != |
92 content::RENDERER_PREFERENCES_SUBPIXEL_RENDERING_SYSTEM_DEFAULT && | 94 content::RENDERER_PREFERENCES_SUBPIXEL_RENDERING_SYSTEM_DEFAULT && |
93 prefs.subpixel_rendering != | 95 prefs.subpixel_rendering != |
94 content::RENDERER_PREFERENCES_SUBPIXEL_RENDERING_NONE) { | 96 content::RENDERER_PREFERENCES_SUBPIXEL_RENDERING_NONE) { |
95 return true; | 97 return true; |
96 } | 98 } |
97 | |
98 return false; | 99 return false; |
99 } | 100 } |
100 | 101 |
101 void RenderViewImpl::UpdateFontRenderingFromRendererPrefs() { | 102 void RenderViewImpl::UpdateFontRenderingFromRendererPrefs() { |
102 const content::RendererPreferences& prefs = renderer_preferences_; | 103 const content::RendererPreferences& prefs = renderer_preferences_; |
103 WebFontRendering::setHinting(RendererPreferencesToSkiaHinting(prefs)); | 104 WebFontRendering::setHinting(RendererPreferencesToSkiaHinting(prefs)); |
104 WebFontRendering::setLCDOrder(RendererPreferencesToSkiaLCDOrder( | 105 WebFontRendering::setLCDOrder( |
105 prefs.subpixel_rendering)); | 106 RendererPreferencesToSkiaLCDOrder(prefs.subpixel_rendering)); |
106 WebFontRendering::setLCDOrientation(RendererPreferencesToSkiaLCDOrientation( | 107 WebFontRendering::setLCDOrientation( |
107 prefs.subpixel_rendering)); | 108 RendererPreferencesToSkiaLCDOrientation(prefs.subpixel_rendering)); |
108 WebFontRendering::setAntiAlias(RendererPreferencesToAntiAliasFlag(prefs)); | 109 WebFontRendering::setAntiAlias(RendererPreferencesToAntiAliasFlag(prefs)); |
109 WebFontRendering::setSubpixelGlyphs(RendererPreferencesToSubpixelGlyphsFlag( | 110 WebFontRendering::setSubpixelRendering( |
110 prefs)); | 111 RendererPreferencesToSubpixelRenderingFlag(prefs)); |
| 112 WebFontRendering::setSubpixelPositioning(prefs.use_subpixel_positioning); |
| 113 WebFontInfo::setSubpixelPositioning(prefs.use_subpixel_positioning); |
111 } | 114 } |
OLD | NEW |