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 30 matching lines...) Expand all Loading... |
41 references the closest matching font available on the host system. | 41 references the closest matching font available on the host system. |
42 2) Given the data for a font (either in a stream or a file name), return | 42 2) Given the data for a font (either in a stream or a file name), return |
43 a typeface that allows access to that data. | 43 a typeface that allows access to that data. |
44 3) Each typeface instance carries a 32bit ID for its corresponding font. | 44 3) Each typeface instance carries a 32bit ID for its corresponding font. |
45 SkFontHost turns that ID into a stream to access the font's data. | 45 SkFontHost turns that ID into a stream to access the font's data. |
46 4) Given a font ID, return a subclass of SkScalerContext, which connects a | 46 4) Given a font ID, return a subclass of SkScalerContext, which connects a |
47 font scaler (e.g. freetype or other) to the font's data. | 47 font scaler (e.g. freetype or other) to the font's data. |
48 5) Utilites to manage the font cache (budgeting) and gamma correction | 48 5) Utilites to manage the font cache (budgeting) and gamma correction |
49 */ | 49 */ |
50 class SK_API SkFontHost { | 50 class SK_API SkFontHost { |
51 public: | 51 private: |
52 /** Return a new, closest matching typeface given either an existing family | 52 /** Return a new, closest matching typeface given either an existing family |
53 (specified by a typeface in that family) or by a familyName and a | 53 (specified by a typeface in that family) or by a familyName and a |
54 requested style. | 54 requested style. |
55 1) If familyFace is null, use familyName. | 55 1) If familyFace is null, use familyName. |
56 2) If familyName is null, use data (UTF-16 to cover). | 56 2) If familyName is null, use data (UTF-16 to cover). |
57 3) If all are null, return the default font that best matches style | 57 3) If all are null, return the default font that best matches style |
58 */ | 58 */ |
59 static SkTypeface* CreateTypeface(const SkTypeface* familyFace, | 59 static SkTypeface* CreateTypeface(const SkTypeface* familyFace, |
60 const char familyName[], | 60 const char familyName[], |
61 SkTypeface::Style style); | 61 SkTypeface::Style style); |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 @return the number of bytes actually copied into data. If offset+length | 222 @return the number of bytes actually copied into data. If offset+length |
223 exceeds the table's size, then only the bytes up to the table's | 223 exceeds the table's size, then only the bytes up to the table's |
224 size are actually copied, and this is the value returned. If | 224 size are actually copied, and this is the value returned. If |
225 offset > the table's size, or tag is not a valid table, | 225 offset > the table's size, or tag is not a valid table, |
226 then 0 is returned. | 226 then 0 is returned. |
227 */ | 227 */ |
228 static size_t GetTableData(SkFontID fontID, SkFontTableTag tag, | 228 static size_t GetTableData(SkFontID fontID, SkFontTableTag tag, |
229 size_t offset, size_t length, void* data); | 229 size_t offset, size_t length, void* data); |
230 | 230 |
231 /////////////////////////////////////////////////////////////////////////// | 231 /////////////////////////////////////////////////////////////////////////// |
| 232 public: |
232 | 233 |
233 /** LCDs either have their color elements arranged horizontally or | 234 /** LCDs either have their color elements arranged horizontally or |
234 vertically. When rendering subpixel glyphs we need to know which way | 235 vertically. When rendering subpixel glyphs we need to know which way |
235 round they are. | 236 round they are. |
236 | 237 |
237 Note, if you change this after startup, you'll need to flush the glyph | 238 Note, if you change this after startup, you'll need to flush the glyph |
238 cache because it'll have the wrong type of masks cached. | 239 cache because it'll have the wrong type of masks cached. |
239 | 240 |
240 @deprecated use SkPixelGeometry instead. | 241 @deprecated use SkPixelGeometry instead. |
241 */ | 242 */ |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
284 static uint32_t GetUnitsPerEm(SkFontID fontID); | 285 static uint32_t GetUnitsPerEm(SkFontID fontID); |
285 #endif | 286 #endif |
286 | 287 |
287 /** If Skia is running in a constrained environment and the typeface | 288 /** If Skia is running in a constrained environment and the typeface |
288 implementation is handle based, the typeface data may become | 289 implementation is handle based, the typeface data may become |
289 unavailable asynchronously. If a font host or scaler context method is | 290 unavailable asynchronously. If a font host or scaler context method is |
290 unable to access font data, it may call this function as a request to | 291 unable to access font data, it may call this function as a request to |
291 make the handle contained in the typeface useable. | 292 make the handle contained in the typeface useable. |
292 */ | 293 */ |
293 static void EnsureTypefaceAccessible(const SkTypeface& typeface); | 294 static void EnsureTypefaceAccessible(const SkTypeface& typeface); |
| 295 |
| 296 private: |
| 297 friend class SkTypeface; |
294 }; | 298 }; |
295 | 299 |
296 #endif | 300 #endif |
OLD | NEW |