Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Side by Side Diff: ui/gfx/font_render_params_linux.cc

Issue 401303002: linux: Use scalable fonts and Fontconfig's bitmap setting. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 "ui/gfx/font_render_params.h" 5 #include "ui/gfx/font_render_params.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "ui/gfx/font.h" 9 #include "ui/gfx/font.h"
10 #include "ui/gfx/linux_font_delegate.h" 10 #include "ui/gfx/linux_font_delegate.h"
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 // GetCustomFontRenderParams() for descriptions of arguments. 42 // GetCustomFontRenderParams() for descriptions of arguments.
43 bool QueryFontconfig(const std::vector<std::string>* family_list, 43 bool QueryFontconfig(const std::vector<std::string>* family_list,
44 const int* pixel_size, 44 const int* pixel_size,
45 const int* point_size, 45 const int* point_size,
46 const int* style, 46 const int* style,
47 FontRenderParams* params_out, 47 FontRenderParams* params_out,
48 std::string* family_out) { 48 std::string* family_out) {
49 FcPattern* pattern = FcPatternCreate(); 49 FcPattern* pattern = FcPatternCreate();
50 CHECK(pattern); 50 CHECK(pattern);
51 51
52 FcPatternAddBool(pattern, FC_SCALABLE, FcTrue);
53
52 if (family_list) { 54 if (family_list) {
53 for (std::vector<std::string>::const_iterator it = family_list->begin(); 55 for (std::vector<std::string>::const_iterator it = family_list->begin();
54 it != family_list->end(); ++it) { 56 it != family_list->end(); ++it) {
55 FcPatternAddString( 57 FcPatternAddString(
56 pattern, FC_FAMILY, reinterpret_cast<const FcChar8*>(it->c_str())); 58 pattern, FC_FAMILY, reinterpret_cast<const FcChar8*>(it->c_str()));
57 } 59 }
58 } 60 }
59 if (pixel_size) 61 if (pixel_size)
60 FcPatternAddDouble(pattern, FC_PIXEL_SIZE, *pixel_size); 62 FcPatternAddDouble(pattern, FC_PIXEL_SIZE, *pixel_size);
61 if (point_size) 63 if (point_size)
(...skipping 22 matching lines...) Expand all
84 86
85 if (params_out) { 87 if (params_out) {
86 FcBool fc_antialias = 0; 88 FcBool fc_antialias = 0;
87 FcPatternGetBool(match, FC_ANTIALIAS, 0, &fc_antialias); 89 FcPatternGetBool(match, FC_ANTIALIAS, 0, &fc_antialias);
88 params_out->antialiasing = fc_antialias; 90 params_out->antialiasing = fc_antialias;
89 91
90 FcBool fc_autohint = 0; 92 FcBool fc_autohint = 0;
91 FcPatternGetBool(match, FC_AUTOHINT, 0, &fc_autohint); 93 FcPatternGetBool(match, FC_AUTOHINT, 0, &fc_autohint);
92 params_out->autohinter = fc_autohint; 94 params_out->autohinter = fc_autohint;
93 95
96 FcBool fc_bitmap = 0;
97 FcPatternGetBool(match, FC_EMBEDDED_BITMAP, 0, &fc_bitmap);
98 params_out->use_bitmaps = fc_bitmap;
99
94 FcBool fc_hinting = 0; 100 FcBool fc_hinting = 0;
95 int fc_hint_style = FC_HINT_NONE; 101 int fc_hint_style = FC_HINT_NONE;
96 FcPatternGetBool(match, FC_HINTING, 0, &fc_hinting); 102 FcPatternGetBool(match, FC_HINTING, 0, &fc_hinting);
97 if (fc_hinting) 103 if (fc_hinting)
98 FcPatternGetInteger(match, FC_HINT_STYLE, 0, &fc_hint_style); 104 FcPatternGetInteger(match, FC_HINT_STYLE, 0, &fc_hint_style);
99 params_out->hinting = ConvertFontconfigHintStyle(fc_hint_style); 105 params_out->hinting = ConvertFontconfigHintStyle(fc_hint_style);
100 106
101 int fc_rgba = FC_RGBA_NONE; 107 int fc_rgba = FC_RGBA_NONE;
102 FcPatternGetInteger(match, FC_RGBA, 0, &fc_rgba); 108 FcPatternGetInteger(match, FC_RGBA, 0, &fc_rgba);
103 params_out->subpixel_rendering = ConvertFontconfigRgba(fc_rgba); 109 params_out->subpixel_rendering = ConvertFontconfigRgba(fc_rgba);
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 161
156 // Use the first family from the list if Fontconfig didn't suggest a family. 162 // Use the first family from the list if Fontconfig didn't suggest a family.
157 if (family_out && family_out->empty() && 163 if (family_out && family_out->empty() &&
158 family_list && !family_list->empty()) 164 family_list && !family_list->empty())
159 *family_out = (*family_list)[0]; 165 *family_out = (*family_list)[0];
160 166
161 return params; 167 return params;
162 } 168 }
163 169
164 } // namespace gfx 170 } // namespace gfx
OLDNEW
« no previous file with comments | « no previous file | ui/gfx/font_render_params_linux_unittest.cc » ('j') | ui/gfx/font_render_params_linux_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698