| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2008 Apple Computer, Inc. All rights reserved. | 2 * Copyright (C) 2006, 2008 Apple Computer, Inc. All rights reserved. |
| 3 * Copyright (C) 2007-2008 Torch Mobile, Inc. | 3 * Copyright (C) 2007-2008 Torch Mobile, Inc. |
| 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 | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * | 8 * |
| 9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. 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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 class FontCacheClient; | 62 class FontCacheClient; |
| 63 class FontFaceCreationParams; | 63 class FontFaceCreationParams; |
| 64 class FontPlatformData; | 64 class FontPlatformData; |
| 65 class FontDescription; | 65 class FontDescription; |
| 66 class OpenTypeVerticalData; | 66 class OpenTypeVerticalData; |
| 67 class ShapeCache; | 67 class ShapeCache; |
| 68 class SimpleFontData; | 68 class SimpleFontData; |
| 69 | 69 |
| 70 enum ShouldRetain { Retain, DoNotRetain }; | 70 enum ShouldRetain { Retain, DoNotRetain }; |
| 71 enum PurgeSeverity { PurgeIfNeeded, ForcePurge }; | 71 enum PurgeSeverity { PurgeIfNeeded, ForcePurge }; |
| 72 enum class AlternateFontName { AllowAlternate, NoAlternate, LastResort }; | 72 enum class AlternateFontName { |
| 73 AllowAlternate, |
| 74 NoAlternate, |
| 75 LocalUniqueFace, |
| 76 LastResort |
| 77 }; |
| 73 | 78 |
| 74 class PLATFORM_EXPORT FontCache { | 79 class PLATFORM_EXPORT FontCache { |
| 75 friend class FontCachePurgePreventer; | 80 friend class FontCachePurgePreventer; |
| 76 | 81 |
| 77 WTF_MAKE_NONCOPYABLE(FontCache); | 82 WTF_MAKE_NONCOPYABLE(FontCache); |
| 78 USING_FAST_MALLOC(FontCache); | 83 USING_FAST_MALLOC(FontCache); |
| 79 | 84 |
| 80 public: | 85 public: |
| 81 static FontCache* fontCache(); | 86 static FontCache* fontCache(); |
| 82 | 87 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 94 void platformInit(); | 99 void platformInit(); |
| 95 | 100 |
| 96 PassRefPtr<SimpleFontData> getFontData( | 101 PassRefPtr<SimpleFontData> getFontData( |
| 97 const FontDescription&, | 102 const FontDescription&, |
| 98 const AtomicString&, | 103 const AtomicString&, |
| 99 AlternateFontName = AlternateFontName::AllowAlternate, | 104 AlternateFontName = AlternateFontName::AllowAlternate, |
| 100 ShouldRetain = Retain); | 105 ShouldRetain = Retain); |
| 101 PassRefPtr<SimpleFontData> getLastResortFallbackFont(const FontDescription&, | 106 PassRefPtr<SimpleFontData> getLastResortFallbackFont(const FontDescription&, |
| 102 ShouldRetain = Retain); | 107 ShouldRetain = Retain); |
| 103 SimpleFontData* getNonRetainedLastResortFallbackFont(const FontDescription&); | 108 SimpleFontData* getNonRetainedLastResortFallbackFont(const FontDescription&); |
| 104 bool isPlatformFontAvailable(const FontDescription&, const AtomicString&); | 109 |
| 110 // Should be used in determining whether family names listed in font-family: |
| 111 // ... are available locally. Only returns true if family name matches. |
| 112 bool isPlatformFamilyMatchAvailable(const FontDescription&, |
| 113 const AtomicString& family); |
| 114 |
| 115 // Should be used in determining whether the <abc> argument to local in |
| 116 // @font-face { ... src: local(<abc>) } are available locally, which should |
| 117 // match Postscript name or full font name. Compare |
| 118 // https://drafts.csswg.org/css-fonts-3/#src-desc |
| 119 // TODO crbug.com/627143 complete this and actually look at the right |
| 120 // namerecords. |
| 121 bool isPlatformFontUniqueNameMatchAvailable( |
| 122 const FontDescription&, |
| 123 const AtomicString& uniqueFontName); |
| 124 |
| 105 static String firstAvailableOrFirst(const String&); | 125 static String firstAvailableOrFirst(const String&); |
| 106 | 126 |
| 107 // Returns the ShapeCache instance associated with the given cache key. | 127 // Returns the ShapeCache instance associated with the given cache key. |
| 108 // Creates a new instance as needed and as such is guaranteed not to return | 128 // Creates a new instance as needed and as such is guaranteed not to return |
| 109 // a nullptr. Instances are managed by FontCache and are only guaranteed to | 129 // a nullptr. Instances are managed by FontCache and are only guaranteed to |
| 110 // be valid for the duration of the current session, as controlled by | 130 // be valid for the duration of the current session, as controlled by |
| 111 // disable/enablePurging. | 131 // disable/enablePurging. |
| 112 ShapeCache* getShapeCache(const FallbackListCompositeKey&); | 132 ShapeCache* getShapeCache(const FallbackListCompositeKey&); |
| 113 | 133 |
| 114 void addClient(FontCacheClient*); | 134 void addClient(FontCacheClient*); |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 282 public: | 302 public: |
| 283 FontCachePurgePreventer() { FontCache::fontCache()->disablePurging(); } | 303 FontCachePurgePreventer() { FontCache::fontCache()->disablePurging(); } |
| 284 ~FontCachePurgePreventer() { FontCache::fontCache()->enablePurging(); } | 304 ~FontCachePurgePreventer() { FontCache::fontCache()->enablePurging(); } |
| 285 }; | 305 }; |
| 286 | 306 |
| 287 AtomicString toAtomicString(const SkString&); | 307 AtomicString toAtomicString(const SkString&); |
| 288 | 308 |
| 289 } // namespace blink | 309 } // namespace blink |
| 290 | 310 |
| 291 #endif | 311 #endif |
| OLD | NEW |