OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2006, 2007, 2008, Google Inc. All rights reserved. | 2 * Copyright (c) 2006, 2007, 2008, Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 // ----------------------------------------------------------------------------- | 58 // ----------------------------------------------------------------------------- |
59 class PLATFORM_EXPORT FontPlatformData { | 59 class PLATFORM_EXPORT FontPlatformData { |
60 public: | 60 public: |
61 // Used for deleted values in the font cache's hash tables. The hash table | 61 // Used for deleted values in the font cache's hash tables. The hash table |
62 // will create us with this structure, and it will compare other values | 62 // will create us with this structure, and it will compare other values |
63 // to this "Deleted" one. It expects the Deleted one to be differentiable | 63 // to this "Deleted" one. It expects the Deleted one to be differentiable |
64 // from the 0 one (created with the empty constructor), so we can't just | 64 // from the 0 one (created with the empty constructor), so we can't just |
65 // set everything to 0. | 65 // set everything to 0. |
66 FontPlatformData(WTF::HashTableDeletedValueType); | 66 FontPlatformData(WTF::HashTableDeletedValueType); |
67 FontPlatformData(); | 67 FontPlatformData(); |
68 FontPlatformData(float textSize, bool fakeBold, bool fakeItalic); | 68 FontPlatformData(float textSize, bool syntheticBold, bool syntheticItalic); |
69 FontPlatformData(const FontPlatformData&); | 69 FontPlatformData(const FontPlatformData&); |
70 FontPlatformData(PassRefPtr<SkTypeface>, const char* name, float textSize, b
ool fakeBold, bool fakeItalic, FontOrientation = Horizontal, bool subpixelTextPo
sition = FontDescription::subpixelPositioning()); | 70 FontPlatformData(PassRefPtr<SkTypeface>, const char* name, float textSize, b
ool syntheticBold, bool syntheticItalic, FontOrientation = Horizontal, bool subp
ixelTextPosition = FontDescription::subpixelPositioning()); |
71 FontPlatformData(const FontPlatformData& src, float textSize); | 71 FontPlatformData(const FontPlatformData& src, float textSize); |
72 ~FontPlatformData(); | 72 ~FontPlatformData(); |
73 | 73 |
74 String fontFamilyName() const; | 74 String fontFamilyName() const; |
75 | 75 |
76 // ------------------------------------------------------------------------- | 76 // ------------------------------------------------------------------------- |
77 // Return true iff this font is monospaced (i.e. every glyph has an equal x | 77 // Return true iff this font is monospaced (i.e. every glyph has an equal x |
78 // advance) | 78 // advance) |
79 // ------------------------------------------------------------------------- | 79 // ------------------------------------------------------------------------- |
80 bool isFixedPitch() const; | 80 bool isFixedPitch() const; |
81 | 81 |
82 // ------------------------------------------------------------------------- | 82 // ------------------------------------------------------------------------- |
83 // Setup a Skia painting context to use this font. | 83 // Setup a Skia painting context to use this font. |
84 // ------------------------------------------------------------------------- | 84 // ------------------------------------------------------------------------- |
85 void setupPaint(SkPaint*, GraphicsContext* = 0) const; | 85 void setupPaint(SkPaint*, GraphicsContext* = 0) const; |
86 | 86 |
87 // ------------------------------------------------------------------------- | 87 // ------------------------------------------------------------------------- |
88 // Return Skia's unique id for this font. This encodes both the style and | 88 // Return Skia's unique id for this font. This encodes both the style and |
89 // the font's file name so refers to a single face. | 89 // the font's file name so refers to a single face. |
90 // ------------------------------------------------------------------------- | 90 // ------------------------------------------------------------------------- |
91 SkFontID uniqueID() const; | 91 SkFontID uniqueID() const; |
92 SkTypeface* typeface() const { return m_typeface.get(); } | 92 SkTypeface* typeface() const { return m_typeface.get(); } |
93 | 93 |
94 unsigned hash() const; | 94 unsigned hash() const; |
95 float size() const { return m_textSize; } | 95 float size() const { return m_textSize; } |
96 int emSizeInFontUnits() const; | 96 int emSizeInFontUnits() const; |
97 | 97 |
98 FontOrientation orientation() const { return m_orientation; } | 98 FontOrientation orientation() const { return m_orientation; } |
99 void setOrientation(FontOrientation orientation) { m_orientation = orientati
on; } | 99 void setOrientation(FontOrientation orientation) { m_orientation = orientati
on; } |
100 void setFakeBold(bool fakeBold) { m_fakeBold = fakeBold; } | 100 void setSyntheticBold(bool syntheticBold) { m_syntheticBold = syntheticBold;
} |
101 void setFakeItalic(bool fakeItalic) { m_fakeItalic = fakeItalic; } | 101 void setSyntheticItalic(bool syntheticItalic) { m_syntheticItalic = syntheti
cItalic; } |
102 bool operator==(const FontPlatformData&) const; | 102 bool operator==(const FontPlatformData&) const; |
103 FontPlatformData& operator=(const FontPlatformData&); | 103 FontPlatformData& operator=(const FontPlatformData&); |
104 bool isHashTableDeletedValue() const { return m_isHashTableDeletedValue; } | 104 bool isHashTableDeletedValue() const { return m_isHashTableDeletedValue; } |
105 | 105 |
106 #if ENABLE(OPENTYPE_VERTICAL) | 106 #if ENABLE(OPENTYPE_VERTICAL) |
107 PassRefPtr<OpenTypeVerticalData> verticalData() const; | 107 PassRefPtr<OpenTypeVerticalData> verticalData() const; |
108 PassRefPtr<SharedBuffer> openTypeTable(uint32_t table) const; | 108 PassRefPtr<SharedBuffer> openTypeTable(uint32_t table) const; |
109 #endif | 109 #endif |
110 | 110 |
111 #ifndef NDEBUG | 111 #ifndef NDEBUG |
(...skipping 15 matching lines...) Expand all Loading... |
127 static void setSubpixelRendering(bool); | 127 static void setSubpixelRendering(bool); |
128 | 128 |
129 private: | 129 private: |
130 void getRenderStyleForStrike(const char*, int); | 130 void getRenderStyleForStrike(const char*, int); |
131 void querySystemForRenderStyle(bool useSkiaSubpixelPositioning); | 131 void querySystemForRenderStyle(bool useSkiaSubpixelPositioning); |
132 | 132 |
133 RefPtr<SkTypeface> m_typeface; | 133 RefPtr<SkTypeface> m_typeface; |
134 CString m_family; | 134 CString m_family; |
135 float m_textSize; | 135 float m_textSize; |
136 mutable int m_emSizeInFontUnits; | 136 mutable int m_emSizeInFontUnits; |
137 bool m_fakeBold; | 137 bool m_syntheticBold; |
138 bool m_fakeItalic; | 138 bool m_syntheticItalic; |
139 FontOrientation m_orientation; | 139 FontOrientation m_orientation; |
140 FontRenderStyle m_style; | 140 FontRenderStyle m_style; |
141 mutable RefPtr<HarfBuzzFace> m_harfBuzzFace; | 141 mutable RefPtr<HarfBuzzFace> m_harfBuzzFace; |
142 bool m_isHashTableDeletedValue; | 142 bool m_isHashTableDeletedValue; |
143 }; | 143 }; |
144 | 144 |
145 } // namespace WebCore | 145 } // namespace WebCore |
146 | 146 |
147 #endif // ifdef FontPlatformDataHarfBuzz_h | 147 #endif // ifdef FontPlatformDataHarfBuzz_h |
OLD | NEW |