OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org) |
3 * (C) 2000 Antti Koivisto (koivisto@kde.org) | 3 * (C) 2000 Antti Koivisto (koivisto@kde.org) |
4 * (C) 2000 Dirk Mueller (mueller@kde.org) | 4 * (C) 2000 Dirk Mueller (mueller@kde.org) |
5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserv
ed. | 5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights |
| 6 * reserved. |
6 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com> | 7 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com> |
7 * | 8 * |
8 * This library is free software; you can redistribute it and/or | 9 * This library is free software; you can redistribute it and/or |
9 * modify it under the terms of the GNU Library General Public | 10 * modify it under the terms of the GNU Library General Public |
10 * License as published by the Free Software Foundation; either | 11 * License as published by the Free Software Foundation; either |
11 * version 2 of the License, or (at your option) any later version. | 12 * version 2 of the License, or (at your option) any later version. |
12 * | 13 * |
13 * This library is distributed in the hope that it will be useful, | 14 * This library is distributed in the hope that it will be useful, |
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 15 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 return static_cast<FontStretch>(m_fields.m_stretch); | 180 return static_cast<FontStretch>(m_fields.m_stretch); |
180 } | 181 } |
181 static FontWeight lighterWeight(FontWeight); | 182 static FontWeight lighterWeight(FontWeight); |
182 static FontWeight bolderWeight(FontWeight); | 183 static FontWeight bolderWeight(FontWeight); |
183 static Size largerSize(const Size&); | 184 static Size largerSize(const Size&); |
184 static Size smallerSize(const Size&); | 185 static Size smallerSize(const Size&); |
185 GenericFamilyType genericFamily() const { | 186 GenericFamilyType genericFamily() const { |
186 return static_cast<GenericFamilyType>(m_fields.m_genericFamily); | 187 return static_cast<GenericFamilyType>(m_fields.m_genericFamily); |
187 } | 188 } |
188 | 189 |
189 // only use fixed default size when there is only one font family, and that fa
mily is "monospace" | 190 // only use fixed default size when there is only one font family, and that |
| 191 // family is "monospace" |
190 bool isMonospace() const { | 192 bool isMonospace() const { |
191 return genericFamily() == MonospaceFamily && !family().next() && | 193 return genericFamily() == MonospaceFamily && !family().next() && |
192 family().family() == FontFamilyNames::webkit_monospace; | 194 family().family() == FontFamilyNames::webkit_monospace; |
193 } | 195 } |
194 Kerning getKerning() const { | 196 Kerning getKerning() const { |
195 return static_cast<Kerning>(m_fields.m_kerning); | 197 return static_cast<Kerning>(m_fields.m_kerning); |
196 } | 198 } |
197 VariantLigatures getVariantLigatures() const; | 199 VariantLigatures getVariantLigatures() const; |
198 FontVariantNumeric variantNumeric() const { | 200 FontVariantNumeric variantNumeric() const { |
199 return FontVariantNumeric::initializeFromUnsigned( | 201 return FontVariantNumeric::initializeFromUnsigned( |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
315 | 317 |
316 static void setSubpixelPositioning(bool b) { | 318 static void setSubpixelPositioning(bool b) { |
317 s_useSubpixelTextPositioning = b; | 319 s_useSubpixelTextPositioning = b; |
318 } | 320 } |
319 static bool subpixelPositioning() { return s_useSubpixelTextPositioning; } | 321 static bool subpixelPositioning() { return s_useSubpixelTextPositioning; } |
320 | 322 |
321 static void setDefaultTypesettingFeatures(TypesettingFeatures); | 323 static void setDefaultTypesettingFeatures(TypesettingFeatures); |
322 static TypesettingFeatures defaultTypesettingFeatures(); | 324 static TypesettingFeatures defaultTypesettingFeatures(); |
323 | 325 |
324 unsigned styleHashWithoutFamilyList() const; | 326 unsigned styleHashWithoutFamilyList() const; |
325 // TODO(drott): We should not expose internal structure here, but rather intro
duce | 327 // TODO(drott): We should not expose internal structure here, but rather |
326 // a hash function here. | 328 // introduce a hash function here. |
327 unsigned bitmapFields() const { return m_fieldsAsUnsigned.parts[0]; } | 329 unsigned bitmapFields() const { return m_fieldsAsUnsigned.parts[0]; } |
328 unsigned auxiliaryBitmapFields() const { return m_fieldsAsUnsigned.parts[1]; } | 330 unsigned auxiliaryBitmapFields() const { return m_fieldsAsUnsigned.parts[1]; } |
329 | 331 |
330 SkFontStyle skiaFontStyle() const; | 332 SkFontStyle skiaFontStyle() const; |
331 | 333 |
332 private: | 334 private: |
333 FontFamily m_familyList; // The list of font families to be used. | 335 FontFamily m_familyList; // The list of font families to be used. |
334 RefPtr<FontFeatureSettings> m_featureSettings; | 336 RefPtr<FontFeatureSettings> m_featureSettings; |
335 RefPtr<const LayoutLocale> m_locale; | 337 RefPtr<const LayoutLocale> m_locale; |
336 | 338 |
337 void updateTypesettingFeatures(); | 339 void updateTypesettingFeatures(); |
338 | 340 |
339 float | 341 // Specified CSS value. Independent of rendering issues such as integer |
340 m_specifiedSize; // Specified CSS value. Independent of rendering issues
such as integer | 342 // rounding, minimum font sizes, and zooming. |
341 // rounding, minimum font sizes, and zooming. | 343 float m_specifiedSize; |
342 float | 344 // Computed size adjusted for the minimum font size and the zoom factor. |
343 m_computedSize; // Computed size adjusted for the minimum font size and t
he zoom factor. | 345 float m_computedSize; |
344 | 346 |
345 // (Given aspect value / aspect value of a font family) * specifiedSize. | 347 // (Given aspect value / aspect value of a font family) * specifiedSize. |
346 // This value is adjusted for the minimum font size and the zoom factor | 348 // This value is adjusted for the minimum font size and the zoom factor |
347 // as well as a computed size is. | 349 // as well as a computed size is. |
348 float m_adjustedSize; | 350 float m_adjustedSize; |
349 | 351 |
350 // Given aspect value, i.e. font-size-adjust. | 352 // Given aspect value, i.e. font-size-adjust. |
351 float m_sizeAdjust; | 353 float m_sizeAdjust; |
352 | 354 |
353 float m_letterSpacing; | 355 float m_letterSpacing; |
(...skipping 14 matching lines...) Expand all Loading... |
368 unsigned m_stretch : 4; // FontStretch | 370 unsigned m_stretch : 4; // FontStretch |
369 unsigned m_genericFamily : 3; // GenericFamilyType | 371 unsigned m_genericFamily : 3; // GenericFamilyType |
370 | 372 |
371 unsigned m_kerning : 2; // Kerning | 373 unsigned m_kerning : 2; // Kerning |
372 | 374 |
373 unsigned m_commonLigaturesState : 2; | 375 unsigned m_commonLigaturesState : 2; |
374 unsigned m_discretionaryLigaturesState : 2; | 376 unsigned m_discretionaryLigaturesState : 2; |
375 unsigned m_historicalLigaturesState : 2; | 377 unsigned m_historicalLigaturesState : 2; |
376 unsigned m_contextualLigaturesState : 2; | 378 unsigned m_contextualLigaturesState : 2; |
377 | 379 |
378 unsigned | 380 // We cache whether or not a font is currently represented by a CSS keyword |
379 m_keywordSize : 4; // We cache whether or not a font is currently repre
sented by a CSS keyword (e.g., medium). If so, | 381 // (e.g., medium). If so, then we can accurately translate across different |
380 // then we can accurately translate across different generic families to adj
ust for different preference settings | 382 // generic families to adjust for different preference settings (e.g., 13px |
381 // (e.g., 13px monospace vs. 16px everything else). Sizes are 1-8 (like the
HTML size values for <font>). | 383 // monospace vs. 16px everything else). Sizes are 1-8 (like the HTML size |
| 384 // values for <font>). |
| 385 unsigned m_keywordSize : 4; |
382 | 386 |
383 unsigned m_fontSmoothing : 2; // FontSmoothingMode | 387 unsigned m_fontSmoothing : 2; // FontSmoothingMode |
384 unsigned m_textRendering : 2; // TextRenderingMode | 388 unsigned m_textRendering : 2; // TextRenderingMode |
385 unsigned m_syntheticBold : 1; | 389 unsigned m_syntheticBold : 1; |
386 unsigned m_syntheticItalic : 1; | 390 unsigned m_syntheticItalic : 1; |
387 unsigned m_subpixelTextPosition : 1; | 391 unsigned m_subpixelTextPosition : 1; |
388 unsigned m_typesettingFeatures : 3; | 392 unsigned m_typesettingFeatures : 3; |
389 unsigned m_variantNumeric : 8; | 393 unsigned m_variantNumeric : 8; |
390 }; | 394 }; |
391 | 395 |
(...skipping 20 matching lines...) Expand all Loading... |
412 m_fieldsAsUnsigned.parts[0] == other.m_fieldsAsUnsigned.parts[0] && | 416 m_fieldsAsUnsigned.parts[0] == other.m_fieldsAsUnsigned.parts[0] && |
413 m_fieldsAsUnsigned.parts[1] == other.m_fieldsAsUnsigned.parts[1] && | 417 m_fieldsAsUnsigned.parts[1] == other.m_fieldsAsUnsigned.parts[1] && |
414 (m_featureSettings == other.m_featureSettings || | 418 (m_featureSettings == other.m_featureSettings || |
415 (m_featureSettings && other.m_featureSettings && | 419 (m_featureSettings && other.m_featureSettings && |
416 *m_featureSettings == *other.m_featureSettings)); | 420 *m_featureSettings == *other.m_featureSettings)); |
417 } | 421 } |
418 | 422 |
419 } // namespace blink | 423 } // namespace blink |
420 | 424 |
421 #endif | 425 #endif |
OLD | NEW |