| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "gfx/platform_font_gtk.h" | 5 #include "gfx/platform_font_gtk.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <fontconfig/fontconfig.h> | 8 #include <fontconfig/fontconfig.h> |
| 9 #include <gdk/gdk.h> | 9 #include <gdk/gdk.h> |
| 10 #include <gtk/gtk.h> | 10 #include <gtk/gtk.h> |
| (...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 272 //////////////////////////////////////////////////////////////////////////////// | 272 //////////////////////////////////////////////////////////////////////////////// |
| 273 // PlatformFontGtk, private: | 273 // PlatformFontGtk, private: |
| 274 | 274 |
| 275 PlatformFontGtk::PlatformFontGtk(SkTypeface* typeface, | 275 PlatformFontGtk::PlatformFontGtk(SkTypeface* typeface, |
| 276 const std::wstring& name, | 276 const std::wstring& name, |
| 277 int size, | 277 int size, |
| 278 int style) { | 278 int style) { |
| 279 InitWithTypefaceNameSizeAndStyle(typeface, name, size, style); | 279 InitWithTypefaceNameSizeAndStyle(typeface, name, size, style); |
| 280 } | 280 } |
| 281 | 281 |
| 282 PlatformFontGtk::~PlatformFontGtk() {} |
| 283 |
| 282 void PlatformFontGtk::InitWithNameAndSize(const std::wstring& font_name, | 284 void PlatformFontGtk::InitWithNameAndSize(const std::wstring& font_name, |
| 283 int font_size) { | 285 int font_size) { |
| 284 DCHECK_GT(font_size, 0); | 286 DCHECK_GT(font_size, 0); |
| 285 std::wstring fallback; | 287 std::wstring fallback; |
| 286 | 288 |
| 287 SkTypeface* typeface = SkTypeface::CreateFromName( | 289 SkTypeface* typeface = SkTypeface::CreateFromName( |
| 288 base::SysWideToUTF8(font_name).c_str(), SkTypeface::kNormal); | 290 base::SysWideToUTF8(font_name).c_str(), SkTypeface::kNormal); |
| 289 if (!typeface) { | 291 if (!typeface) { |
| 290 // A non-scalable font such as .pcf is specified. Falls back to a default | 292 // A non-scalable font such as .pcf is specified. Falls back to a default |
| 291 // scalable font. | 293 // scalable font. |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 432 return new PlatformFontGtk(native_font); | 434 return new PlatformFontGtk(native_font); |
| 433 } | 435 } |
| 434 | 436 |
| 435 // static | 437 // static |
| 436 PlatformFont* PlatformFont::CreateFromNameAndSize(const std::wstring& font_name, | 438 PlatformFont* PlatformFont::CreateFromNameAndSize(const std::wstring& font_name, |
| 437 int font_size) { | 439 int font_size) { |
| 438 return new PlatformFontGtk(font_name, font_size); | 440 return new PlatformFontGtk(font_name, font_size); |
| 439 } | 441 } |
| 440 | 442 |
| 441 } // namespace gfx | 443 } // namespace gfx |
| OLD | NEW |