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 "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 Loading... |
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, etc. |
| 130 should_do_match = true; |
| 131 #endif |
| 132 if (should_do_match) { |
127 FcResult result; | 133 FcResult result; |
128 result_pattern = FcFontMatch(NULL, query_pattern, &result); | 134 result_pattern = FcFontMatch(NULL, query_pattern, &result); |
129 FcPatternDestroy(query_pattern); | 135 FcPatternDestroy(query_pattern); |
130 query_pattern = NULL; | 136 query_pattern = NULL; |
131 if (!result_pattern) | 137 if (!result_pattern) |
132 return false; | 138 return false; |
133 } | 139 } |
134 | 140 |
135 if (family_out) { | 141 if (family_out) { |
136 FcChar8* family = NULL; | 142 FcChar8* family = NULL; |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
267 float GetFontRenderParamsDeviceScaleFactor() { | 273 float GetFontRenderParamsDeviceScaleFactor() { |
268 return device_scale_factor_for_internal_display; | 274 return device_scale_factor_for_internal_display; |
269 } | 275 } |
270 | 276 |
271 void SetFontRenderParamsDeviceScaleFactor(float device_scale_factor) { | 277 void SetFontRenderParamsDeviceScaleFactor(float device_scale_factor) { |
272 device_scale_factor_for_internal_display = device_scale_factor; | 278 device_scale_factor_for_internal_display = device_scale_factor; |
273 } | 279 } |
274 #endif | 280 #endif |
275 | 281 |
276 } // namespace gfx | 282 } // namespace gfx |
OLD | NEW |