1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "ui/gfx/font_render_params.h"
7 #include "base/logging.h"
11 FontRenderParams::FontRenderParams()
13 subpixel_positioning(true),
16 hinting(HINTING_MEDIUM
),
17 subpixel_rendering(SUBPIXEL_RENDERING_NONE
) {
20 FontRenderParams::~FontRenderParams() {}
23 SkFontHost::LCDOrder
FontRenderParams::SubpixelRenderingToSkiaLCDOrder(
24 FontRenderParams::SubpixelRendering subpixel_rendering
) {
25 switch (subpixel_rendering
) {
26 case gfx::FontRenderParams::SUBPIXEL_RENDERING_NONE
:
27 case gfx::FontRenderParams::SUBPIXEL_RENDERING_RGB
:
28 case gfx::FontRenderParams::SUBPIXEL_RENDERING_VRGB
:
29 return SkFontHost::kRGB_LCDOrder
;
30 case gfx::FontRenderParams::SUBPIXEL_RENDERING_BGR
:
31 case gfx::FontRenderParams::SUBPIXEL_RENDERING_VBGR
:
32 return SkFontHost::kBGR_LCDOrder
;
36 return SkFontHost::kRGB_LCDOrder
;
40 SkFontHost::LCDOrientation
41 FontRenderParams::SubpixelRenderingToSkiaLCDOrientation(
42 FontRenderParams::SubpixelRendering subpixel_rendering
) {
43 switch (subpixel_rendering
) {
44 case gfx::FontRenderParams::SUBPIXEL_RENDERING_NONE
:
45 case gfx::FontRenderParams::SUBPIXEL_RENDERING_RGB
:
46 case gfx::FontRenderParams::SUBPIXEL_RENDERING_BGR
:
47 return SkFontHost::kHorizontal_LCDOrientation
;
48 case gfx::FontRenderParams::SUBPIXEL_RENDERING_VRGB
:
49 case gfx::FontRenderParams::SUBPIXEL_RENDERING_VBGR
:
50 return SkFontHost::kVertical_LCDOrientation
;
54 return SkFontHost::kHorizontal_LCDOrientation
;
57 FontRenderParamsQuery::FontRenderParamsQuery()
61 device_scale_factor(0) {
64 FontRenderParamsQuery::~FontRenderParamsQuery() {}