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

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

Issue 811123002: linux/chromeos: Improve querying for Fontconfig defaults. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add derat as OWNER for font_render_params* Created 6 years 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
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 <fontconfig/fontconfig.h> 7 #include <fontconfig/fontconfig.h>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/containers/mru_cache.h" 10 #include "base/containers/mru_cache.h"
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 FcPatternAddInteger(query_pattern, FC_WEIGHT, 116 FcPatternAddInteger(query_pattern, FC_WEIGHT,
117 (query.style & Font::BOLD) ? FC_WEIGHT_BOLD : FC_WEIGHT_NORMAL); 117 (query.style & Font::BOLD) ? FC_WEIGHT_BOLD : FC_WEIGHT_NORMAL);
118 } 118 }
119 119
120 FcConfigSubstitute(NULL, query_pattern, FcMatchPattern); 120 FcConfigSubstitute(NULL, query_pattern, FcMatchPattern);
121 FcDefaultSubstitute(query_pattern); 121 FcDefaultSubstitute(query_pattern);
122 122
123 // If the query was non-empty, match a specific font and destroy the query 123 // If the query was non-empty, match a specific font and destroy the query
124 // pattern. Otherwise, just use the query pattern. 124 // pattern. Otherwise, just use the query pattern.
125 FcPattern* result_pattern = query_pattern; 125 FcPattern* result_pattern = query_pattern;
126 if (!query.is_empty()) { 126 bool should_do_match = !query.is_empty();
127 #if !defined(OS_CHROMEOS)
128 // Also perform a match for desktop Linux since many users don't have default
129 // patterns configured (http://crbug.com/442443, http://crbug.com/435277,
msw 2014/12/17 22:42:23 optional nit: to avoid wrapping onto the next line
Daniel Erat 2014/12/18 00:15:46 Done.
130 // etc.).
131 should_do_match = true;
132 #endif
133 if (should_do_match) {
127 FcResult result; 134 FcResult result;
128 result_pattern = FcFontMatch(NULL, query_pattern, &result); 135 result_pattern = FcFontMatch(NULL, query_pattern, &result);
129 FcPatternDestroy(query_pattern); 136 FcPatternDestroy(query_pattern);
130 query_pattern = NULL; 137 query_pattern = NULL;
131 if (!result_pattern) 138 if (!result_pattern)
132 return false; 139 return false;
133 } 140 }
134 141
135 if (family_out) { 142 if (family_out) {
136 FcChar8* family = NULL; 143 FcChar8* family = NULL;
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 float GetFontRenderParamsDeviceScaleFactor() { 274 float GetFontRenderParamsDeviceScaleFactor() {
268 return device_scale_factor_for_internal_display; 275 return device_scale_factor_for_internal_display;
269 } 276 }
270 277
271 void SetFontRenderParamsDeviceScaleFactor(float device_scale_factor) { 278 void SetFontRenderParamsDeviceScaleFactor(float device_scale_factor) {
272 device_scale_factor_for_internal_display = device_scale_factor; 279 device_scale_factor_for_internal_display = device_scale_factor;
273 } 280 }
274 #endif 281 #endif
275 282
276 } // namespace gfx 283 } // namespace gfx
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698