1 /* 2 * Copyright 2012 Google Inc. 3 * 4 * Use of this source code is governed by a BSD-style license that can be 5 * found in the LICENSE file. 6 */ 7 8 #ifndef SkFontDescriptor_DEFINED 9 #define SkFontDescriptor_DEFINED 10 11 #include "SkString.h" 12 #include "SkTypeface.h" 13 14 class SkStream; 15 class SkWStream; 16 17 class SkFontDescriptor { 18 public: 19 SkFontDescriptor(SkTypeface::Style = SkTypeface::kNormal); 20 SkFontDescriptor(SkStream*); 21 22 void serialize(SkWStream*); 23 getStyle()24 SkTypeface::Style getStyle() { return fStyle; } setStyle(SkTypeface::Style style)25 void setStyle(SkTypeface::Style style) { fStyle = style; } 26 getFamilyName()27 const char* getFamilyName() { return fFamilyName.c_str(); } getFullName()28 const char* getFullName() { return fFullName.c_str(); } getPostscriptName()29 const char* getPostscriptName() { return fPostscriptName.c_str(); } getFontFileName()30 const char* getFontFileName() { return fFontFileName.c_str(); } 31 setFamilyName(const char * name)32 void setFamilyName(const char* name) { fFamilyName.set(name); } setFullName(const char * name)33 void setFullName(const char* name) { fFullName.set(name); } setPostscriptName(const char * name)34 void setPostscriptName(const char* name) { fPostscriptName.set(name); } setFontFileName(const char * name)35 void setFontFileName(const char* name) { fFontFileName.set(name); } 36 37 private: 38 SkString fFamilyName; 39 SkString fFullName; 40 SkString fPostscriptName; 41 SkString fFontFileName; 42 43 SkTypeface::Style fStyle; 44 }; 45 46 #endif // SkFontDescriptor_DEFINED 47