OLD | NEW |
| (Empty) |
1 /* | |
2 * Copyright (C) 2006, 2007 Apple Computer, Inc. | |
3 * Copyright (c) 2006, 2007, 2008, 2009, Google Inc. All rights reserved. | |
4 * | |
5 * Redistribution and use in source and binary forms, with or without | |
6 * modification, are permitted provided that the following conditions are | |
7 * met: | |
8 * | |
9 * * Redistributions of source code must retain the above copyright | |
10 * notice, this list of conditions and the following disclaimer. | |
11 * * Redistributions in binary form must reproduce the above | |
12 * copyright notice, this list of conditions and the following disclaimer | |
13 * in the documentation and/or other materials provided with the | |
14 * distribution. | |
15 * * Neither the name of Google Inc. nor the names of its | |
16 * contributors may be used to endorse or promote products derived from | |
17 * this software without specific prior written permission. | |
18 * | |
19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |
20 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |
21 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | |
22 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | |
23 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |
24 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |
25 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
26 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |
29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
30 */ | |
31 | |
32 #ifndef FontPlatformDataChromiumWin_h | |
33 #define FontPlatformDataChromiumWin_h | |
34 | |
35 #include "SkPaint.h" | |
36 #include "SkTypeface.h" | |
37 #include "SkTypeface_win.h" | |
38 #include "platform/SharedBuffer.h" | |
39 #include "platform/fonts/FontOrientation.h" | |
40 #include "platform/fonts/opentype/OpenTypeVerticalData.h" | |
41 #include "wtf/Forward.h" | |
42 #include "wtf/HashTableDeletedValueType.h" | |
43 #include "wtf/OwnPtr.h" | |
44 #include "wtf/PassRefPtr.h" | |
45 #include "wtf/RefCounted.h" | |
46 #include "wtf/RefPtr.h" | |
47 #include "wtf/text/StringImpl.h" | |
48 | |
49 namespace WebCore { | |
50 | |
51 class FontDescription; | |
52 class GraphicsContext; | |
53 class HarfBuzzFace; | |
54 | |
55 class PLATFORM_EXPORT FontPlatformData { | |
56 public: | |
57 // Used for deleted values in the font cache's hash tables. The hash table | |
58 // will create us with this structure, and it will compare other values | |
59 // to this "Deleted" one. It expects the Deleted one to be differentiable | |
60 // from the NULL one (created with the empty constructor), so we can't just | |
61 // set everything to NULL. | |
62 FontPlatformData(WTF::HashTableDeletedValueType); | |
63 FontPlatformData(); | |
64 FontPlatformData(float size, bool bold, bool oblique); | |
65 FontPlatformData(const FontPlatformData&); | |
66 FontPlatformData(const FontPlatformData&, float textSize); | |
67 FontPlatformData(PassRefPtr<SkTypeface>, const char* name, float textSize, b
ool syntheticBold, bool syntheticItalic, FontOrientation = Horizontal, bool useS
ubpixelPositioning = defaultUseSubpixelPositioning()); | |
68 | |
69 void setupPaint(SkPaint*, GraphicsContext* = 0) const; | |
70 | |
71 FontPlatformData& operator=(const FontPlatformData&); | |
72 | |
73 bool isHashTableDeletedValue() const { return m_isHashTableDeletedValue; } | |
74 | |
75 ~FontPlatformData(); | |
76 | |
77 bool isFixedPitch() const; | |
78 float size() const { return m_textSize; } | |
79 HarfBuzzFace* harfBuzzFace() const; | |
80 SkTypeface* typeface() const { return m_typeface.get(); } | |
81 SkFontID uniqueID() const { return m_typeface->uniqueID(); } | |
82 int paintTextFlags() const { return m_paintTextFlags; } | |
83 | |
84 String fontFamilyName() const; | |
85 | |
86 FontOrientation orientation() const { return m_orientation; } | |
87 void setOrientation(FontOrientation orientation) { m_orientation = orientati
on; } | |
88 | |
89 unsigned hash() const; | |
90 | |
91 bool operator==(const FontPlatformData&) const; | |
92 | |
93 #if ENABLE(OPENTYPE_VERTICAL) | |
94 PassRefPtr<OpenTypeVerticalData> verticalData() const; | |
95 PassRefPtr<SharedBuffer> openTypeTable(uint32_t table) const; | |
96 #endif | |
97 | |
98 #ifndef NDEBUG | |
99 String description() const; | |
100 #endif | |
101 | |
102 private: | |
103 bool static defaultUseSubpixelPositioning(); | |
104 | |
105 float m_textSize; // Point size of the font in pixels. | |
106 FontOrientation m_orientation; | |
107 bool m_syntheticBold; | |
108 bool m_syntheticItalic; | |
109 | |
110 RefPtr<SkTypeface> m_typeface; | |
111 int m_paintTextFlags; | |
112 | |
113 mutable RefPtr<HarfBuzzFace> m_harfBuzzFace; | |
114 | |
115 bool m_isHashTableDeletedValue; | |
116 bool m_useSubpixelPositioning; | |
117 }; | |
118 | |
119 } // WebCore | |
120 | |
121 #endif // FontPlatformDataChromiumWin_h | |
OLD | NEW |