Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(559)

Side by Side Diff: include/core/SkTypeface.h

Issue 1129283003: Make SkAdvancedTypefaceMetrics private. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « include/core/SkAdvancedTypefaceMetrics.h ('k') | src/core/SkAdvancedTypefaceMetrics.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 SkTypeface_DEFINED 10 #ifndef SkTypeface_DEFINED
11 #define SkTypeface_DEFINED 11 #define SkTypeface_DEFINED
12 12
13 #include "SkAdvancedTypefaceMetrics.h"
14 #include "SkFontStyle.h" 13 #include "SkFontStyle.h"
15 #include "SkLazyPtr.h" 14 #include "SkLazyPtr.h"
15 #include "SkRect.h"
16 #include "SkString.h"
16 #include "SkWeakRefCnt.h" 17 #include "SkWeakRefCnt.h"
17 18
18 class SkDescriptor; 19 class SkDescriptor;
19 class SkFontDescriptor; 20 class SkFontDescriptor;
20 class SkScalerContext; 21 class SkScalerContext;
21 struct SkScalerContextRec; 22 struct SkScalerContextRec;
22 class SkStream; 23 class SkStream;
23 class SkStreamAsset; 24 class SkStreamAsset;
24 class SkAdvancedTypefaceMetrics; 25 class SkAdvancedTypefaceMetrics;
25 class SkWStream; 26 class SkWStream;
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 // PRIVATE / EXPERIMENTAL -- do not call 301 // PRIVATE / EXPERIMENTAL -- do not call
301 void filterRec(SkScalerContextRec* rec) const { 302 void filterRec(SkScalerContextRec* rec) const {
302 this->onFilterRec(rec); 303 this->onFilterRec(rec);
303 } 304 }
304 // PRIVATE / EXPERIMENTAL -- do not call 305 // PRIVATE / EXPERIMENTAL -- do not call
305 void getFontDescriptor(SkFontDescriptor* desc, bool* isLocal) const { 306 void getFontDescriptor(SkFontDescriptor* desc, bool* isLocal) const {
306 this->onGetFontDescriptor(desc, isLocal); 307 this->onGetFontDescriptor(desc, isLocal);
307 } 308 }
308 309
309 protected: 310 protected:
311 // The type of advance data wanted.
312 enum PerGlyphInfo {
313 kNo_PerGlyphInfo = 0x0, // Don't populate any per glyph info.
314 kHAdvance_PerGlyphInfo = 0x1, // Populate horizontal advance data.
315 kVAdvance_PerGlyphInfo = 0x2, // Populate vertical advance data.
316 kGlyphNames_PerGlyphInfo = 0x4, // Populate glyph names (Type 1 only).
317 kToUnicode_PerGlyphInfo = 0x8 // Populate ToUnicode table, ignored
318 // for Type 1 fonts
319 };
320
310 /** uniqueID must be unique and non-zero 321 /** uniqueID must be unique and non-zero
311 */ 322 */
312 SkTypeface(const SkFontStyle& style, SkFontID uniqueID, bool isFixedPitch = false); 323 SkTypeface(const SkFontStyle& style, SkFontID uniqueID, bool isFixedPitch = false);
313 virtual ~SkTypeface(); 324 virtual ~SkTypeface();
314 325
315 /** Sets the fixedPitch bit. If used, must be called in the constructor. */ 326 /** Sets the fixedPitch bit. If used, must be called in the constructor. */
316 void setIsFixedPitch(bool isFixedPitch) { fIsFixedPitch = isFixedPitch; } 327 void setIsFixedPitch(bool isFixedPitch) { fIsFixedPitch = isFixedPitch; }
317 328
318 friend class SkScalerContext; 329 friend class SkScalerContext;
319 static SkTypeface* GetDefaultTypeface(Style style = SkTypeface::kNormal); 330 static SkTypeface* GetDefaultTypeface(Style style = SkTypeface::kNormal);
320 331
321 virtual SkScalerContext* onCreateScalerContext(const SkDescriptor*) const = 0; 332 virtual SkScalerContext* onCreateScalerContext(const SkDescriptor*) const = 0;
322 virtual void onFilterRec(SkScalerContextRec*) const = 0; 333 virtual void onFilterRec(SkScalerContextRec*) const = 0;
323 virtual SkAdvancedTypefaceMetrics* onGetAdvancedTypefaceMetrics( 334 virtual SkAdvancedTypefaceMetrics* onGetAdvancedTypefaceMetrics(
324 SkAdvancedTypefaceMetrics::PerGlyphInfo perGlyphInfo, 335 PerGlyphInfo,
325 const uint32_t* glyphIDs, 336 const uint32_t* glyphIDs,
326 uint32_t glyphIDsCount) const = 0; 337 uint32_t glyphIDsCount) const = 0;
327 338
328 virtual SkStreamAsset* onOpenStream(int* ttcIndex) const = 0; 339 virtual SkStreamAsset* onOpenStream(int* ttcIndex) const = 0;
329 virtual void onGetFontDescriptor(SkFontDescriptor*, bool* isLocal) const = 0 ; 340 virtual void onGetFontDescriptor(SkFontDescriptor*, bool* isLocal) const = 0 ;
330 341
331 virtual int onCharsToGlyphs(const void* chars, Encoding, uint16_t glyphs[], 342 virtual int onCharsToGlyphs(const void* chars, Encoding, uint16_t glyphs[],
332 int glyphCount) const = 0; 343 int glyphCount) const = 0;
333 virtual int onCountGlyphs() const = 0; 344 virtual int onCountGlyphs() const = 0;
334 345
(...skipping 26 matching lines...) Expand all
361 @param perGlyphInfo Indicate what glyph specific information (advances, 372 @param perGlyphInfo Indicate what glyph specific information (advances,
362 names, etc.) should be populated. 373 names, etc.) should be populated.
363 @param glyphIDs For per-glyph info, specify subset of the font by 374 @param glyphIDs For per-glyph info, specify subset of the font by
364 giving glyph ids. Each integer represents a glyph 375 giving glyph ids. Each integer represents a glyph
365 id. Passing NULL means all glyphs in the font. 376 id. Passing NULL means all glyphs in the font.
366 @param glyphIDsCount Number of elements in subsetGlyphIds. Ignored if 377 @param glyphIDsCount Number of elements in subsetGlyphIds. Ignored if
367 glyphIDs is NULL. 378 glyphIDs is NULL.
368 @return The returned object has already been referenced. 379 @return The returned object has already been referenced.
369 */ 380 */
370 SkAdvancedTypefaceMetrics* getAdvancedTypefaceMetrics( 381 SkAdvancedTypefaceMetrics* getAdvancedTypefaceMetrics(
371 SkAdvancedTypefaceMetrics::PerGlyphInfo perGlyphInfo, 382 PerGlyphInfo,
372 const uint32_t* glyphIDs = NULL, 383 const uint32_t* glyphIDs = NULL,
373 uint32_t glyphIDsCount = 0) const; 384 uint32_t glyphIDsCount = 0) const;
374 385
375 private: 386 private:
376 static SkTypeface* CreateDefault(int style); // SkLazyPtr requires an int, not a Style. 387 static SkTypeface* CreateDefault(int style); // SkLazyPtr requires an int, not a Style.
377 static void DeleteDefault(SkTypeface*); 388 static void DeleteDefault(SkTypeface*);
378 389
379 struct BoundsComputer; 390 struct BoundsComputer;
380 // friend struct BoundsComputer; 391 // friend struct BoundsComputer;
381 392
382 SkLazyPtr<SkRect> fLazyBounds; 393 SkLazyPtr<SkRect> fLazyBounds;
383 SkFontID fUniqueID; 394 SkFontID fUniqueID;
384 SkFontStyle fStyle; 395 SkFontStyle fStyle;
385 bool fIsFixedPitch; 396 bool fIsFixedPitch;
386 397
387 friend class SkPaint; 398 friend class SkPaint;
388 friend class SkGlyphCache; // GetDefaultTypeface 399 friend class SkGlyphCache; // GetDefaultTypeface
389 400
390 typedef SkWeakRefCnt INHERITED; 401 typedef SkWeakRefCnt INHERITED;
391 }; 402 };
392 403
393 #endif 404 #endif
OLDNEW
« no previous file with comments | « include/core/SkAdvancedTypefaceMetrics.h ('k') | src/core/SkAdvancedTypefaceMetrics.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698