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 #include "ui/gfx/font_render_params.h" | 9 #include "ui/gfx/font_render_params.h" |
10 | 10 |
11 using blink::WebFontRendering; | 11 using blink::WebFontRendering; |
12 | 12 |
13 namespace content { | 13 namespace content { |
14 | 14 |
15 namespace { | 15 namespace { |
16 | 16 |
| 17 const int kMaxDefaultFontSize = 999; |
| 18 |
17 SkPaint::Hinting RendererPreferencesToSkiaHinting( | 19 SkPaint::Hinting RendererPreferencesToSkiaHinting( |
18 const RendererPreferences& prefs) { | 20 const RendererPreferences& prefs) { |
19 if (!prefs.should_antialias_text) { | 21 if (!prefs.should_antialias_text) { |
20 // When anti-aliasing is off, GTK maps all non-zero hinting settings to | 22 // When anti-aliasing is off, GTK maps all non-zero hinting settings to |
21 // 'Normal' hinting so we do the same. Otherwise, folks who have 'Slight' | 23 // 'Normal' hinting so we do the same. Otherwise, folks who have 'Slight' |
22 // hinting selected will see readable text in everything expect Chromium. | 24 // hinting selected will see readable text in everything expect Chromium. |
23 switch (prefs.hinting) { | 25 switch (prefs.hinting) { |
24 case gfx::FontRenderParams::HINTING_NONE: | 26 case gfx::FontRenderParams::HINTING_NONE: |
25 return SkPaint::kNo_Hinting; | 27 return SkPaint::kNo_Hinting; |
26 case gfx::FontRenderParams::HINTING_SLIGHT: | 28 case gfx::FontRenderParams::HINTING_SLIGHT: |
(...skipping 28 matching lines...) Expand all Loading... |
55 gfx::FontRenderParams::SubpixelRenderingToSkiaLCDOrder( | 57 gfx::FontRenderParams::SubpixelRenderingToSkiaLCDOrder( |
56 prefs.subpixel_rendering)); | 58 prefs.subpixel_rendering)); |
57 WebFontRendering::setLCDOrientation( | 59 WebFontRendering::setLCDOrientation( |
58 gfx::FontRenderParams::SubpixelRenderingToSkiaLCDOrientation( | 60 gfx::FontRenderParams::SubpixelRenderingToSkiaLCDOrientation( |
59 prefs.subpixel_rendering)); | 61 prefs.subpixel_rendering)); |
60 WebFontRendering::setAntiAlias(prefs.should_antialias_text); | 62 WebFontRendering::setAntiAlias(prefs.should_antialias_text); |
61 WebFontRendering::setSubpixelRendering( | 63 WebFontRendering::setSubpixelRendering( |
62 prefs.subpixel_rendering != | 64 prefs.subpixel_rendering != |
63 gfx::FontRenderParams::SUBPIXEL_RENDERING_NONE); | 65 gfx::FontRenderParams::SUBPIXEL_RENDERING_NONE); |
64 WebFontRendering::setSubpixelPositioning(prefs.use_subpixel_positioning); | 66 WebFontRendering::setSubpixelPositioning(prefs.use_subpixel_positioning); |
| 67 if (prefs.default_font_size > 0 && |
| 68 prefs.default_font_size <= kMaxDefaultFontSize) { |
| 69 WebFontRendering::setDefaultFontSize(prefs.default_font_size); |
| 70 } |
65 } | 71 } |
66 | 72 |
67 } // namespace content | 73 } // namespace content |
OLD | NEW |