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

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

Issue 2066323002: Remove SK_SUPPORT_LEGACY_TYPEFACE_PTR (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: moar Mac fixes Created 4 years, 6 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
« no previous file with comments | « ui/gfx/harfbuzz_font_skia.cc ('k') | ui/gfx/render_text.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/platform_font_linux.h" 5 #include "ui/gfx/platform_font_linux.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 9
10 #include "base/lazy_instance.h" 10 #include "base/lazy_instance.h"
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 } 279 }
280 280
281 void PlatformFontLinux::ComputeMetricsIfNecessary() { 281 void PlatformFontLinux::ComputeMetricsIfNecessary() {
282 if (metrics_need_computation_) { 282 if (metrics_need_computation_) {
283 metrics_need_computation_ = false; 283 metrics_need_computation_ = false;
284 284
285 SkPaint paint; 285 SkPaint paint;
286 paint.setAntiAlias(false); 286 paint.setAntiAlias(false);
287 paint.setSubpixelText(false); 287 paint.setSubpixelText(false);
288 paint.setTextSize(font_size_pixels_); 288 paint.setTextSize(font_size_pixels_);
289 paint.setTypeface(typeface_.get()); 289 paint.setTypeface(typeface_);
290 paint.setFakeBoldText(weight_ >= Font::Weight::BOLD && 290 paint.setFakeBoldText(weight_ >= Font::Weight::BOLD &&
291 !typeface_->isBold()); 291 !typeface_->isBold());
292 paint.setTextSkewX((Font::ITALIC & style_) && !typeface_->isItalic() ? 292 paint.setTextSkewX((Font::ITALIC & style_) && !typeface_->isItalic() ?
293 -SK_Scalar1/4 : 0); 293 -SK_Scalar1/4 : 0);
294 SkPaint::FontMetrics metrics; 294 SkPaint::FontMetrics metrics;
295 paint.getFontMetrics(&metrics); 295 paint.getFontMetrics(&metrics);
296 ascent_pixels_ = SkScalarCeilToInt(-metrics.fAscent); 296 ascent_pixels_ = SkScalarCeilToInt(-metrics.fAscent);
297 height_pixels_ = ascent_pixels_ + SkScalarCeilToInt(metrics.fDescent); 297 height_pixels_ = ascent_pixels_ + SkScalarCeilToInt(metrics.fDescent);
298 cap_height_pixels_ = SkScalarCeilToInt(metrics.fCapHeight); 298 cap_height_pixels_ = SkScalarCeilToInt(metrics.fCapHeight);
299 average_width_pixels_ = SkScalarToDouble(metrics.fAvgCharWidth); 299 average_width_pixels_ = SkScalarToDouble(metrics.fAvgCharWidth);
300 } 300 }
301 } 301 }
302 302
303 //////////////////////////////////////////////////////////////////////////////// 303 ////////////////////////////////////////////////////////////////////////////////
304 // PlatformFont, public: 304 // PlatformFont, public:
305 305
306 // static 306 // static
307 PlatformFont* PlatformFont::CreateDefault() { 307 PlatformFont* PlatformFont::CreateDefault() {
308 return new PlatformFontLinux; 308 return new PlatformFontLinux;
309 } 309 }
310 310
311 // static 311 // static
312 PlatformFont* PlatformFont::CreateFromNameAndSize(const std::string& font_name, 312 PlatformFont* PlatformFont::CreateFromNameAndSize(const std::string& font_name,
313 int font_size) { 313 int font_size) {
314 return new PlatformFontLinux(font_name, font_size); 314 return new PlatformFontLinux(font_name, font_size);
315 } 315 }
316 316
317 } // namespace gfx 317 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/gfx/harfbuzz_font_skia.cc ('k') | ui/gfx/render_text.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698