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