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 |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 , m_textSize(0) | 47 , m_textSize(0) |
48 , m_syntheticBold(false) | 48 , m_syntheticBold(false) |
49 , m_syntheticItalic(false) | 49 , m_syntheticItalic(false) |
50 , m_orientation(FontOrientation::Horizontal) | 50 , m_orientation(FontOrientation::Horizontal) |
51 #if !OS(MACOSX) | 51 #if !OS(MACOSX) |
52 , m_style(FontRenderStyle()) | 52 , m_style(FontRenderStyle()) |
53 #endif | 53 #endif |
54 , m_isHashTableDeletedValue(true) | 54 , m_isHashTableDeletedValue(true) |
55 #if OS(WIN) | 55 #if OS(WIN) |
56 , m_paintTextFlags(0) | 56 , m_paintTextFlags(0) |
57 , m_useSubpixelPositioning(false) | |
58 , m_minSizeForAntiAlias(0) | 57 , m_minSizeForAntiAlias(0) |
59 , m_minSizeForSubpixel(0) | 58 , m_minSizeForSubpixel(0) |
60 #endif | 59 #endif |
61 { | 60 { |
62 } | 61 } |
63 | 62 |
64 FontPlatformData::FontPlatformData() | 63 FontPlatformData::FontPlatformData() |
65 : m_typeface(nullptr) | 64 : m_typeface(nullptr) |
66 #if !OS(WIN) | 65 #if !OS(WIN) |
67 , m_family(CString()) | 66 , m_family(CString()) |
68 #endif | 67 #endif |
69 , m_textSize(0) | 68 , m_textSize(0) |
70 , m_syntheticBold(false) | 69 , m_syntheticBold(false) |
71 , m_syntheticItalic(false) | 70 , m_syntheticItalic(false) |
72 , m_orientation(FontOrientation::Horizontal) | 71 , m_orientation(FontOrientation::Horizontal) |
73 #if !OS(MACOSX) | 72 #if !OS(MACOSX) |
74 , m_style(FontRenderStyle()) | 73 , m_style(FontRenderStyle()) |
75 #endif | 74 #endif |
76 , m_isHashTableDeletedValue(false) | 75 , m_isHashTableDeletedValue(false) |
77 #if OS(WIN) | 76 #if OS(WIN) |
78 , m_paintTextFlags(0) | 77 , m_paintTextFlags(0) |
79 , m_useSubpixelPositioning(false) | |
80 , m_minSizeForAntiAlias(0) | 78 , m_minSizeForAntiAlias(0) |
81 , m_minSizeForSubpixel(0) | 79 , m_minSizeForSubpixel(0) |
82 #endif | 80 #endif |
83 { | 81 { |
84 } | 82 } |
85 | 83 |
86 FontPlatformData::FontPlatformData(float size, bool syntheticBold, bool syntheti
cItalic, FontOrientation orientation) | 84 FontPlatformData::FontPlatformData(float size, bool syntheticBold, bool syntheti
cItalic, FontOrientation orientation) |
87 : m_typeface(nullptr) | 85 : m_typeface(nullptr) |
88 #if !OS(WIN) | 86 #if !OS(WIN) |
89 , m_family(CString()) | 87 , m_family(CString()) |
90 #endif | 88 #endif |
91 , m_textSize(size) | 89 , m_textSize(size) |
92 , m_syntheticBold(syntheticBold) | 90 , m_syntheticBold(syntheticBold) |
93 , m_syntheticItalic(syntheticItalic) | 91 , m_syntheticItalic(syntheticItalic) |
94 , m_orientation(orientation) | 92 , m_orientation(orientation) |
95 #if !OS(MACOSX) | 93 #if !OS(MACOSX) |
96 , m_style(FontRenderStyle()) | 94 , m_style(FontRenderStyle()) |
97 #endif | 95 #endif |
98 , m_isHashTableDeletedValue(false) | 96 , m_isHashTableDeletedValue(false) |
99 #if OS(WIN) | 97 #if OS(WIN) |
100 , m_paintTextFlags(0) | 98 , m_paintTextFlags(0) |
101 , m_useSubpixelPositioning(false) | |
102 , m_minSizeForAntiAlias(0) | 99 , m_minSizeForAntiAlias(0) |
103 , m_minSizeForSubpixel(0) | 100 , m_minSizeForSubpixel(0) |
104 #endif | 101 #endif |
105 { | 102 { |
106 } | 103 } |
107 | 104 |
108 FontPlatformData::FontPlatformData(const FontPlatformData& source) | 105 FontPlatformData::FontPlatformData(const FontPlatformData& source) |
109 : m_typeface(source.m_typeface) | 106 : m_typeface(source.m_typeface) |
110 #if !OS(WIN) | 107 #if !OS(WIN) |
111 , m_family(source.m_family) | 108 , m_family(source.m_family) |
112 #endif | 109 #endif |
113 , m_textSize(source.m_textSize) | 110 , m_textSize(source.m_textSize) |
114 , m_syntheticBold(source.m_syntheticBold) | 111 , m_syntheticBold(source.m_syntheticBold) |
115 , m_syntheticItalic(source.m_syntheticItalic) | 112 , m_syntheticItalic(source.m_syntheticItalic) |
116 , m_orientation(source.m_orientation) | 113 , m_orientation(source.m_orientation) |
117 #if !OS(MACOSX) | 114 #if !OS(MACOSX) |
118 , m_style(source.m_style) | 115 , m_style(source.m_style) |
119 #endif | 116 #endif |
120 , m_harfBuzzFace(nullptr) | 117 , m_harfBuzzFace(nullptr) |
121 , m_isHashTableDeletedValue(false) | 118 , m_isHashTableDeletedValue(false) |
122 #if OS(WIN) | 119 #if OS(WIN) |
123 , m_paintTextFlags(source.m_paintTextFlags) | 120 , m_paintTextFlags(source.m_paintTextFlags) |
124 , m_useSubpixelPositioning(source.m_useSubpixelPositioning) | |
125 , m_minSizeForAntiAlias(source.m_minSizeForAntiAlias) | 121 , m_minSizeForAntiAlias(source.m_minSizeForAntiAlias) |
126 , m_minSizeForSubpixel(source.m_minSizeForSubpixel) | 122 , m_minSizeForSubpixel(source.m_minSizeForSubpixel) |
127 #endif | 123 #endif |
128 { | 124 { |
129 } | 125 } |
130 | 126 |
131 FontPlatformData::FontPlatformData(const FontPlatformData& src, float textSize) | 127 FontPlatformData::FontPlatformData(const FontPlatformData& src, float textSize) |
132 : m_typeface(src.m_typeface) | 128 : m_typeface(src.m_typeface) |
133 #if !OS(WIN) | 129 #if !OS(WIN) |
134 , m_family(src.m_family) | 130 , m_family(src.m_family) |
135 #endif | 131 #endif |
136 , m_textSize(textSize) | 132 , m_textSize(textSize) |
137 , m_syntheticBold(src.m_syntheticBold) | 133 , m_syntheticBold(src.m_syntheticBold) |
138 , m_syntheticItalic(src.m_syntheticItalic) | 134 , m_syntheticItalic(src.m_syntheticItalic) |
139 , m_orientation(src.m_orientation) | 135 , m_orientation(src.m_orientation) |
140 #if !OS(MACOSX) | 136 #if !OS(MACOSX) |
141 , m_style(src.m_style) | 137 , m_style(src.m_style) |
142 #endif | 138 #endif |
143 , m_harfBuzzFace(nullptr) | 139 , m_harfBuzzFace(nullptr) |
144 , m_isHashTableDeletedValue(false) | 140 , m_isHashTableDeletedValue(false) |
145 #if OS(WIN) | 141 #if OS(WIN) |
146 , m_paintTextFlags(src.m_paintTextFlags) | 142 , m_paintTextFlags(src.m_paintTextFlags) |
147 , m_useSubpixelPositioning(src.m_useSubpixelPositioning) | |
148 , m_minSizeForAntiAlias(src.m_minSizeForAntiAlias) | 143 , m_minSizeForAntiAlias(src.m_minSizeForAntiAlias) |
149 , m_minSizeForSubpixel(src.m_minSizeForSubpixel) | 144 , m_minSizeForSubpixel(src.m_minSizeForSubpixel) |
150 #endif | 145 #endif |
151 { | 146 { |
152 #if !OS(MACOSX) | 147 #if !OS(MACOSX) |
153 querySystemForRenderStyle(FontDescription::subpixelPositioning()); | 148 querySystemForRenderStyle(); |
154 #endif | 149 #endif |
155 } | 150 } |
156 | 151 |
157 FontPlatformData::FontPlatformData(PassRefPtr<SkTypeface> tf, const char* family
, float textSize, bool syntheticBold, bool syntheticItalic, FontOrientation orie
ntation, bool subpixelTextPosition) | 152 FontPlatformData::FontPlatformData(PassRefPtr<SkTypeface> tf, |
| 153 const char* family, float textSize, bool syntheticBold, |
| 154 bool syntheticItalic, FontOrientation orientation) |
158 : m_typeface(tf) | 155 : m_typeface(tf) |
159 #if !OS(WIN) | 156 #if !OS(WIN) |
160 , m_family(family) | 157 , m_family(family) |
161 #endif | 158 #endif |
162 , m_textSize(textSize) | 159 , m_textSize(textSize) |
163 , m_syntheticBold(syntheticBold) | 160 , m_syntheticBold(syntheticBold) |
164 , m_syntheticItalic(syntheticItalic) | 161 , m_syntheticItalic(syntheticItalic) |
165 , m_orientation(orientation) | 162 , m_orientation(orientation) |
166 , m_isHashTableDeletedValue(false) | 163 , m_isHashTableDeletedValue(false) |
167 #if OS(WIN) | 164 #if OS(WIN) |
168 , m_paintTextFlags(0) | 165 , m_paintTextFlags(0) |
169 , m_useSubpixelPositioning(subpixelTextPosition) | |
170 , m_minSizeForAntiAlias(0) | 166 , m_minSizeForAntiAlias(0) |
171 , m_minSizeForSubpixel(0) | 167 , m_minSizeForSubpixel(0) |
172 #endif | 168 #endif |
173 { | 169 { |
174 #if !OS(MACOSX) | 170 #if !OS(MACOSX) |
175 querySystemForRenderStyle(subpixelTextPosition); | 171 querySystemForRenderStyle(); |
176 #endif | 172 #endif |
177 } | 173 } |
178 | 174 |
179 FontPlatformData::~FontPlatformData() | 175 FontPlatformData::~FontPlatformData() |
180 { | 176 { |
181 } | 177 } |
182 | 178 |
183 #if OS(MACOSX) | 179 #if OS(MACOSX) |
184 CTFontRef FontPlatformData::ctFont() const | 180 CTFontRef FontPlatformData::ctFont() const |
185 { | 181 { |
(...skipping 22 matching lines...) Expand all Loading... |
208 m_harfBuzzFace = nullptr; | 204 m_harfBuzzFace = nullptr; |
209 m_orientation = other.m_orientation; | 205 m_orientation = other.m_orientation; |
210 #if !OS(MACOSX) | 206 #if !OS(MACOSX) |
211 m_style = other.m_style; | 207 m_style = other.m_style; |
212 #endif | 208 #endif |
213 | 209 |
214 #if OS(WIN) | 210 #if OS(WIN) |
215 m_paintTextFlags = 0; | 211 m_paintTextFlags = 0; |
216 m_minSizeForAntiAlias = other.m_minSizeForAntiAlias; | 212 m_minSizeForAntiAlias = other.m_minSizeForAntiAlias; |
217 m_minSizeForSubpixel = other.m_minSizeForSubpixel; | 213 m_minSizeForSubpixel = other.m_minSizeForSubpixel; |
218 m_useSubpixelPositioning = other.m_useSubpixelPositioning; | |
219 #endif | 214 #endif |
220 | 215 |
221 return *this; | 216 return *this; |
222 } | 217 } |
223 | 218 |
224 bool FontPlatformData::operator==(const FontPlatformData& a) const | 219 bool FontPlatformData::operator==(const FontPlatformData& a) const |
225 { | 220 { |
226 // If either of the typeface pointers are null then we test for pointer | 221 // If either of the typeface pointers are null then we test for pointer |
227 // equality. Otherwise, we call SkTypeface::Equal on the valid pointers. | 222 // equality. Otherwise, we call SkTypeface::Equal on the valid pointers. |
228 bool typefacesEqual = false; | 223 bool typefacesEqual = false; |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
360 const size_t tableSize = m_typeface->getTableSize(tag); | 355 const size_t tableSize = m_typeface->getTableSize(tag); |
361 if (tableSize) { | 356 if (tableSize) { |
362 Vector<char> tableBuffer(tableSize); | 357 Vector<char> tableBuffer(tableSize); |
363 m_typeface->getTableData(tag, 0, tableSize, &tableBuffer[0]); | 358 m_typeface->getTableData(tag, 0, tableSize, &tableBuffer[0]); |
364 buffer = SharedBuffer::adoptVector(tableBuffer); | 359 buffer = SharedBuffer::adoptVector(tableBuffer); |
365 } | 360 } |
366 return buffer.release(); | 361 return buffer.release(); |
367 } | 362 } |
368 | 363 |
369 } // namespace blink | 364 } // namespace blink |
OLD | NEW |