OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2006 The Android Open Source Project | 3 * Copyright 2006 The Android Open Source Project |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 | 9 |
10 #ifndef SkFontHost_DEFINED | 10 #ifndef SkFontHost_DEFINED |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 | 103 |
104 /** If Skia is running in a constrained environment and the typeface | 104 /** If Skia is running in a constrained environment and the typeface |
105 implementation is handle based, the typeface data may become | 105 implementation is handle based, the typeface data may become |
106 unavailable asynchronously. If a font host or scaler context method is | 106 unavailable asynchronously. If a font host or scaler context method is |
107 unable to access font data, it may call this function as a request to | 107 unable to access font data, it may call this function as a request to |
108 make the handle contained in the typeface useable. | 108 make the handle contained in the typeface useable. |
109 */ | 109 */ |
110 static void EnsureTypefaceAccessible(const SkTypeface& typeface); | 110 static void EnsureTypefaceAccessible(const SkTypeface& typeface); |
111 | 111 |
112 /** | 112 /** |
113 * Return a subclass of SkScalarContext | |
114 * DEPRECATED -- will be moved to SkTypeface | |
115 */ | |
116 static SkScalerContext* CreateScalerContext(const SkDescriptor* desc); | |
117 | |
118 /** | |
119 * DEPRECATED -- will be DESTROYED | 113 * DEPRECATED -- will be DESTROYED |
120 * | 114 * |
121 * Given a "current" fontID, return the next logical fontID to use | 115 * Given a "current" fontID, return a ref to the next logical typeface |
122 * when searching fonts for a given unicode value. Typically the caller | 116 * when searching fonts for a given unicode value. Typically the caller |
123 * will query a given font, and if a unicode value is not supported, they | 117 * will query a given font, and if a unicode value is not supported, they |
124 * will call this, and if 0 is not returned, will search that font, and so | 118 * will call this, and if 0 is not returned, will search that font, and so |
125 * on. This process must be finite, and when the fonthost sees a | 119 * on. This process must be finite, and when the fonthost sees a |
126 * font with no logical successor, it must return 0. | 120 * font with no logical successor, it must return NULL. |
127 * | 121 * |
128 * The original fontID is also provided. This is the initial font that was | 122 * The original fontID is also provided. This is the initial font that was |
129 * stored in the typeface of the caller. It is provided as an aid to choose | 123 * stored in the typeface of the caller. It is provided as an aid to choose |
130 * the best next logical font. e.g. If the original font was bold or serif, | 124 * the best next logical font. e.g. If the original font was bold or serif, |
131 * but the 2nd in the logical chain was plain, then a subsequent call to | 125 * but the 2nd in the logical chain was plain, then a subsequent call to |
132 * get the 3rd can still inspect the original, and try to match its | 126 * get the 3rd can still inspect the original, and try to match its |
133 * stylistic attributes. | 127 * stylistic attributes. |
134 */ | 128 */ |
135 static SkFontID NextLogicalFont(SkFontID currFontID, SkFontID origFontID); | 129 static SkTypeface* NextLogicalTypeface(SkFontID currFontID, SkFontID origFon
tID); |
136 | 130 |
137 | 131 |
138 ///// public HACK FOR FREETYPE -- will be fixed | 132 ///// public HACK FOR FREETYPE -- will be fixed |
139 | 133 |
140 /** Return a new stream to read the font data, or null if the uniqueID does | 134 /** Return a new stream to read the font data, or null if the uniqueID does |
141 not match an existing typeface. .The caller must call stream->unref() | 135 not match an existing typeface. .The caller must call stream->unref() |
142 when it is finished reading the data. | 136 when it is finished reading the data. |
143 */ | 137 */ |
144 static SkStream* OpenStream(SkFontID uniqueID); | 138 static SkStream* OpenStream(SkFontID uniqueID); |
145 | 139 |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 | 211 |
218 /** Given a stream created by Serialize(), return a new typeface (like | 212 /** Given a stream created by Serialize(), return a new typeface (like |
219 CreateTypeface) which is either an exact match to the one serialized | 213 CreateTypeface) which is either an exact match to the one serialized |
220 or the best available typeface based on the data in the deserialized | 214 or the best available typeface based on the data in the deserialized |
221 SkFontDescriptor. | 215 SkFontDescriptor. |
222 */ | 216 */ |
223 static SkTypeface* Deserialize(SkStream*); | 217 static SkTypeface* Deserialize(SkStream*); |
224 | 218 |
225 /////////////////////////////////////////////////////////////////////////// | 219 /////////////////////////////////////////////////////////////////////////// |
226 | 220 |
227 /** Given a filled-out rec, the fonthost may decide to modify it to reflect | |
228 what the host is actually capable of fulfilling. For example, if the | |
229 rec is requesting a level of hinting that, for this host, maps some | |
230 other level (e.g. kFull -> kNormal), it should update the rec to reflect | |
231 what will actually be done. This is an optimization so that the font | |
232 cache does not contain different recs (i.e. keys) that in reality map to | |
233 the same output. | |
234 | |
235 A lazy (but valid) fonthost can do nothing in its FilterRec routine. | |
236 | |
237 The provided typeface corresponds to the fFontID field. | |
238 */ | |
239 static void FilterRec(SkScalerContextRec* rec, SkTypeface* typeface); | |
240 | |
241 /////////////////////////////////////////////////////////////////////////// | |
242 | |
243 /** Retrieve detailed typeface metrics. Used by the PDF backend. | 221 /** Retrieve detailed typeface metrics. Used by the PDF backend. |
244 @param perGlyphInfo Indicate what glyph specific information (advances, | 222 @param perGlyphInfo Indicate what glyph specific information (advances, |
245 names, etc.) should be populated. | 223 names, etc.) should be populated. |
246 @return The returned object has already been referenced. NULL is | 224 @return The returned object has already been referenced. NULL is |
247 returned if the font is not found. | 225 returned if the font is not found. |
248 @param glyphIDs For per-glyph info, specify subset of the font by | 226 @param glyphIDs For per-glyph info, specify subset of the font by |
249 giving glyph ids. Each integer represents a glyph | 227 giving glyph ids. Each integer represents a glyph |
250 id. Passing NULL means all glyphs in the font. | 228 id. Passing NULL means all glyphs in the font. |
251 @param glyphIDsCount Number of elements in subsetGlyphIds. Ignored if | 229 @param glyphIDsCount Number of elements in subsetGlyphIds. Ignored if |
252 glyphIDs is NULL. | 230 glyphIDs is NULL. |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
293 */ | 271 */ |
294 static size_t GetTableData(SkFontID fontID, SkFontTableTag tag, | 272 static size_t GetTableData(SkFontID fontID, SkFontTableTag tag, |
295 size_t offset, size_t length, void* data); | 273 size_t offset, size_t length, void* data); |
296 | 274 |
297 /////////////////////////////////////////////////////////////////////////// | 275 /////////////////////////////////////////////////////////////////////////// |
298 | 276 |
299 friend class SkTypeface; | 277 friend class SkTypeface; |
300 }; | 278 }; |
301 | 279 |
302 #endif | 280 #endif |
OLD | NEW |