OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/public/web/linux/WebFontRendering.h" | 8 #include "third_party/WebKit/public/web/linux/WebFontRendering.h" |
9 | 9 |
10 using blink::WebFontRendering; | 10 using blink::WebFontRendering; |
11 | 11 |
12 namespace content { | 12 namespace content { |
13 | 13 |
14 namespace { | 14 namespace { |
15 | 15 |
16 const int kMaxDefaultFontSize = 999; | |
17 | |
16 SkPaint::Hinting RendererPreferencesToSkiaHinting( | 18 SkPaint::Hinting RendererPreferencesToSkiaHinting( |
17 const RendererPreferences& prefs) { | 19 const RendererPreferences& prefs) { |
18 if (!prefs.should_antialias_text) { | 20 if (!prefs.should_antialias_text) { |
19 // When anti-aliasing is off, GTK maps all non-zero hinting settings to | 21 // When anti-aliasing is off, GTK maps all non-zero hinting settings to |
20 // 'Normal' hinting so we do the same. Otherwise, folks who have 'Slight' | 22 // 'Normal' hinting so we do the same. Otherwise, folks who have 'Slight' |
21 // hinting selected will see readable text in everything expect Chromium. | 23 // hinting selected will see readable text in everything expect Chromium. |
22 switch (prefs.hinting) { | 24 switch (prefs.hinting) { |
23 case gfx::FontRenderParams::HINTING_NONE: | 25 case gfx::FontRenderParams::HINTING_NONE: |
24 return SkPaint::kNo_Hinting; | 26 return SkPaint::kNo_Hinting; |
25 case gfx::FontRenderParams::HINTING_SLIGHT: | 27 case gfx::FontRenderParams::HINTING_SLIGHT: |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
83 WebFontRendering::setAutoHint(prefs.use_autohinter); | 85 WebFontRendering::setAutoHint(prefs.use_autohinter); |
84 WebFontRendering::setUseBitmaps(prefs.use_bitmaps); | 86 WebFontRendering::setUseBitmaps(prefs.use_bitmaps); |
85 WebFontRendering::setLCDOrder(RendererPreferencesToSkiaLCDOrder(prefs)); | 87 WebFontRendering::setLCDOrder(RendererPreferencesToSkiaLCDOrder(prefs)); |
86 WebFontRendering::setLCDOrientation( | 88 WebFontRendering::setLCDOrientation( |
87 RendererPreferencesToSkiaLCDOrientation(prefs)); | 89 RendererPreferencesToSkiaLCDOrientation(prefs)); |
88 WebFontRendering::setAntiAlias(prefs.should_antialias_text); | 90 WebFontRendering::setAntiAlias(prefs.should_antialias_text); |
89 WebFontRendering::setSubpixelRendering( | 91 WebFontRendering::setSubpixelRendering( |
90 prefs.subpixel_rendering != | 92 prefs.subpixel_rendering != |
91 gfx::FontRenderParams::SUBPIXEL_RENDERING_NONE); | 93 gfx::FontRenderParams::SUBPIXEL_RENDERING_NONE); |
92 WebFontRendering::setSubpixelPositioning(prefs.use_subpixel_positioning); | 94 WebFontRendering::setSubpixelPositioning(prefs.use_subpixel_positioning); |
95 if (prefs.default_font_size > 0 && | |
96 prefs.default_font_size <= kMaxDefaultFontSize) | |
jochen (gone - plz use gerrit)
2014/10/15 15:27:40
nit add { }
| |
97 WebFontRendering::setDefaultFontSize(prefs.default_font_size); | |
93 } | 98 } |
94 | 99 |
95 } // namespace content | 100 } // namespace content |
OLD | NEW |