OLD | NEW |
| (Empty) |
1 /* | |
2 * Copyright (C) 2011 Brent Fulgham | |
3 * | |
4 * This library is free software; you can redistribute it and/or | |
5 * modify it under the terms of the GNU Library General Public | |
6 * License as published by the Free Software Foundation; either | |
7 * version 2 of the License, or (at your option) any later version. | |
8 * | |
9 * This library is distributed in the hope that it will be useful, | |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
12 * Library General Public License for more details. | |
13 * | |
14 * You should have received a copy of the GNU Library General Public License | |
15 * along with this library; see the file COPYING.LIB. If not, write to | |
16 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | |
17 * Boston, MA 02110-1301, USA. | |
18 * | |
19 */ | |
20 | |
21 #include "config.h" | |
22 #include "core/platform/graphics/FontPlatformData.h" | |
23 | |
24 #include "wtf/HashMap.h" | |
25 #include "wtf/text/StringHash.h" | |
26 #include "wtf/text/WTFString.h" | |
27 #include "wtf/Vector.h" | |
28 | |
29 #if OS(MACOSX) | |
30 #include "core/platform/graphics/harfbuzz/HarfBuzzFace.h" | |
31 #endif | |
32 | |
33 using namespace std; | |
34 | |
35 namespace WebCore { | |
36 | |
37 FontPlatformData::FontPlatformData(WTF::HashTableDeletedValueType) | |
38 : m_syntheticBold(false) | |
39 , m_syntheticOblique(false) | |
40 , m_orientation(Horizontal) | |
41 , m_size(0) | |
42 , m_widthVariant(RegularWidth) | |
43 #if OS(MACOSX) | |
44 , m_font(hashTableDeletedFontValue()) | |
45 #endif | |
46 , m_isColorBitmapFont(false) | |
47 , m_isCompositeFontReference(false) | |
48 #if OS(MACOSX) | |
49 , m_isPrinterFont(false) | |
50 #endif | |
51 { | |
52 } | |
53 | |
54 FontPlatformData::FontPlatformData() | |
55 : m_syntheticBold(false) | |
56 , m_syntheticOblique(false) | |
57 , m_orientation(Horizontal) | |
58 , m_size(0) | |
59 , m_widthVariant(RegularWidth) | |
60 #if OS(MACOSX) | |
61 , m_font(0) | |
62 #endif | |
63 , m_isColorBitmapFont(false) | |
64 , m_isCompositeFontReference(false) | |
65 #if OS(MACOSX) | |
66 , m_isPrinterFont(false) | |
67 #endif | |
68 { | |
69 } | |
70 | |
71 FontPlatformData::FontPlatformData(float size, bool syntheticBold, bool syntheti
cOblique, FontOrientation orientation, FontWidthVariant widthVariant) | |
72 : m_syntheticBold(syntheticBold) | |
73 , m_syntheticOblique(syntheticOblique) | |
74 , m_orientation(orientation) | |
75 , m_size(size) | |
76 , m_widthVariant(widthVariant) | |
77 #if OS(MACOSX) | |
78 , m_font(0) | |
79 #endif | |
80 , m_isColorBitmapFont(false) | |
81 , m_isCompositeFontReference(false) | |
82 #if OS(MACOSX) | |
83 , m_isPrinterFont(false) | |
84 #endif | |
85 { | |
86 } | |
87 | |
88 #if OS(MACOSX) | |
89 FontPlatformData::FontPlatformData(CGFontRef cgFont, float size, bool syntheticB
old, bool syntheticOblique, FontOrientation orientation, FontWidthVariant widthV
ariant) | |
90 : m_syntheticBold(syntheticBold) | |
91 , m_syntheticOblique(syntheticOblique) | |
92 , m_orientation(orientation) | |
93 , m_size(size) | |
94 , m_widthVariant(widthVariant) | |
95 , m_font(0) | |
96 , m_cgFont(cgFont) | |
97 , m_isColorBitmapFont(false) | |
98 , m_isCompositeFontReference(false) | |
99 , m_isPrinterFont(false) | |
100 { | |
101 } | |
102 #endif | |
103 | |
104 FontPlatformData::FontPlatformData(const FontPlatformData& source) | |
105 : m_syntheticBold(source.m_syntheticBold) | |
106 , m_syntheticOblique(source.m_syntheticOblique) | |
107 , m_orientation(source.m_orientation) | |
108 , m_size(source.m_size) | |
109 , m_widthVariant(source.m_widthVariant) | |
110 , m_isColorBitmapFont(source.m_isColorBitmapFont) | |
111 , m_isCompositeFontReference(source.m_isCompositeFontReference) | |
112 #if OS(MACOSX) | |
113 , m_isPrinterFont(source.m_isPrinterFont) | |
114 #endif | |
115 { | |
116 platformDataInit(source); | |
117 } | |
118 | |
119 const FontPlatformData& FontPlatformData::operator=(const FontPlatformData& othe
r) | |
120 { | |
121 // Check for self-assignment. | |
122 if (this == &other) | |
123 return *this; | |
124 | |
125 m_syntheticBold = other.m_syntheticBold; | |
126 m_syntheticOblique = other.m_syntheticOblique; | |
127 m_orientation = other.m_orientation; | |
128 m_size = other.m_size; | |
129 m_widthVariant = other.m_widthVariant; | |
130 m_isColorBitmapFont = other.m_isColorBitmapFont; | |
131 m_isCompositeFontReference = other.m_isCompositeFontReference; | |
132 #if OS(MACOSX) | |
133 m_isPrinterFont = other.m_isPrinterFont; | |
134 #endif | |
135 | |
136 return platformDataAssign(other); | |
137 } | |
138 | |
139 } | |
OLD | NEW |