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

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

Issue 1819753003: Allow various font weights in gfx. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Further Mac and Linux fixes. Created 4 years, 9 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
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 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 FC_FAMILY, reinterpret_cast<const FcChar8*>(it->c_str())); 109 FC_FAMILY, reinterpret_cast<const FcChar8*>(it->c_str()));
110 } 110 }
111 if (query.pixel_size > 0) 111 if (query.pixel_size > 0)
112 FcPatternAddDouble(query_pattern.get(), FC_PIXEL_SIZE, query.pixel_size); 112 FcPatternAddDouble(query_pattern.get(), FC_PIXEL_SIZE, query.pixel_size);
113 if (query.point_size > 0) 113 if (query.point_size > 0)
114 FcPatternAddInteger(query_pattern.get(), FC_SIZE, query.point_size); 114 FcPatternAddInteger(query_pattern.get(), FC_SIZE, query.point_size);
115 if (query.style >= 0) { 115 if (query.style >= 0) {
116 FcPatternAddInteger(query_pattern.get(), FC_SLANT, 116 FcPatternAddInteger(query_pattern.get(), FC_SLANT,
117 (query.style & Font::ITALIC) ? FC_SLANT_ITALIC : FC_SLANT_ROMAN); 117 (query.style & Font::ITALIC) ? FC_SLANT_ITALIC : FC_SLANT_ROMAN);
118 FcPatternAddInteger(query_pattern.get(), FC_WEIGHT, 118 FcPatternAddInteger(query_pattern.get(), FC_WEIGHT,
119 (query.style & Font::BOLD) ? FC_WEIGHT_BOLD : FC_WEIGHT_NORMAL); 119 (query.weight == Font::Weight::INVALID)
120 ? static_cast<int>(Font::Weight::NORMAL)
121 : static_cast<int>(query.weight));
120 } 122 }
121 123
122 FcConfigSubstitute(NULL, query_pattern.get(), FcMatchPattern); 124 FcConfigSubstitute(NULL, query_pattern.get(), FcMatchPattern);
123 FcDefaultSubstitute(query_pattern.get()); 125 FcDefaultSubstitute(query_pattern.get());
124 126
125 ScopedFcPattern result_pattern; 127 ScopedFcPattern result_pattern;
126 if (query.is_empty()) { 128 if (query.is_empty()) {
127 // If the query was empty, call FcConfigSubstituteWithPat() to get a 129 // If the query was empty, call FcConfigSubstituteWithPat() to get a
128 // non-family- or size-specific configuration so it can be used as the 130 // non-family- or size-specific configuration so it can be used as the
129 // default. 131 // default.
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 float GetFontRenderParamsDeviceScaleFactor() { 285 float GetFontRenderParamsDeviceScaleFactor() {
284 return device_scale_factor_for_internal_display; 286 return device_scale_factor_for_internal_display;
285 } 287 }
286 288
287 void SetFontRenderParamsDeviceScaleFactor(float device_scale_factor) { 289 void SetFontRenderParamsDeviceScaleFactor(float device_scale_factor) {
288 device_scale_factor_for_internal_display = device_scale_factor; 290 device_scale_factor_for_internal_display = device_scale_factor;
289 } 291 }
290 #endif 292 #endif
291 293
292 } // namespace gfx 294 } // namespace gfx
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698