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