OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2007 Apple Computer, Inc. | 2 * Copyright (C) 2006, 2007 Apple Computer, Inc. |
3 * Copyright (c) 2006, 2007, 2008, 2009, 2012 Google Inc. All rights reserved. | 3 * Copyright (c) 2006, 2007, 2008, 2009, 2012 Google Inc. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are | 6 * modification, are permitted provided that the following conditions are |
7 * met: | 7 * met: |
8 * | 8 * |
9 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 void FontCache::SetStatusFontMetrics(const wchar_t* family_name, | 98 void FontCache::SetStatusFontMetrics(const wchar_t* family_name, |
99 int32_t font_height) { | 99 int32_t font_height) { |
100 status_font_family_name_ = new AtomicString(family_name); | 100 status_font_family_name_ = new AtomicString(family_name); |
101 status_font_height_ = EnsureMinimumFontHeightIfNeeded(font_height); | 101 status_font_height_ = EnsureMinimumFontHeightIfNeeded(font_height); |
102 } | 102 } |
103 | 103 |
104 FontCache::FontCache() : purge_prevent_count_(0) { | 104 FontCache::FontCache() : purge_prevent_count_(0) { |
105 font_manager_ = sk_ref_sp(static_font_manager_); | 105 font_manager_ = sk_ref_sp(static_font_manager_); |
106 if (!font_manager_) | 106 if (!font_manager_) |
107 font_manager_ = SkFontMgr_New_DirectWrite(); | 107 font_manager_ = SkFontMgr_New_DirectWrite(); |
108 ASSERT(font_manager_.get()); | 108 DCHECK(font_manager_.get()); |
109 } | 109 } |
110 | 110 |
111 // Given the desired base font, this will create a SimpleFontData for a specific | 111 // Given the desired base font, this will create a SimpleFontData for a specific |
112 // font that can be used to render the given range of characters. | 112 // font that can be used to render the given range of characters. |
113 PassRefPtr<SimpleFontData> FontCache::FallbackFontForCharacter( | 113 PassRefPtr<SimpleFontData> FontCache::FallbackFontForCharacter( |
114 const FontDescription& font_description, | 114 const FontDescription& font_description, |
115 UChar32 character, | 115 UChar32 character, |
116 const SimpleFontData* original_font_data, | 116 const SimpleFontData* original_font_data, |
117 FontFallbackPriority fallback_priority) { | 117 FontFallbackPriority fallback_priority) { |
118 // First try the specified font with standard style & weight. | 118 // First try the specified font with standard style & weight. |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
329 } | 329 } |
330 | 330 |
331 return false; | 331 return false; |
332 } | 332 } |
333 | 333 |
334 std::unique_ptr<FontPlatformData> FontCache::CreateFontPlatformData( | 334 std::unique_ptr<FontPlatformData> FontCache::CreateFontPlatformData( |
335 const FontDescription& font_description, | 335 const FontDescription& font_description, |
336 const FontFaceCreationParams& creation_params, | 336 const FontFaceCreationParams& creation_params, |
337 float font_size, | 337 float font_size, |
338 AlternateFontName alternate_font_name) { | 338 AlternateFontName alternate_font_name) { |
339 ASSERT(creation_params.CreationType() == kCreateFontByFamily); | 339 DCHECK_EQ(creation_params.CreationType(), kCreateFontByFamily); |
340 | 340 |
341 CString name; | 341 CString name; |
342 sk_sp<SkTypeface> tf = | 342 sk_sp<SkTypeface> tf = |
343 CreateTypeface(font_description, creation_params, name); | 343 CreateTypeface(font_description, creation_params, name); |
344 // Windows will always give us a valid pointer here, even if the face name | 344 // Windows will always give us a valid pointer here, even if the face name |
345 // is non-existent. We have to double-check and see if the family name was | 345 // is non-existent. We have to double-check and see if the family name was |
346 // really used. | 346 // really used. |
347 if (!tf || !TypefacesMatchesFamily(tf.get(), creation_params.Family())) { | 347 if (!tf || !TypefacesMatchesFamily(tf.get(), creation_params.Family())) { |
348 AtomicString adjusted_name; | 348 AtomicString adjusted_name; |
349 FontWeight variant_weight; | 349 FontWeight variant_weight; |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
397 ((font_description.Style() == kFontStyleItalic || | 397 ((font_description.Style() == kFontStyleItalic || |
398 font_description.Style() == kFontStyleOblique) && | 398 font_description.Style() == kFontStyleOblique) && |
399 !tf->isItalic()) || | 399 !tf->isItalic()) || |
400 font_description.IsSyntheticItalic(), | 400 font_description.IsSyntheticItalic(), |
401 font_description.Orientation())); | 401 font_description.Orientation())); |
402 | 402 |
403 return result; | 403 return result; |
404 } | 404 } |
405 | 405 |
406 } // namespace blink | 406 } // namespace blink |
OLD | NEW |