OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 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, 2006, 2010, 2011 Apple Inc. All rights reserved. | 5 * Copyright (C) 2003, 2006, 2010, 2011 Apple Inc. All rights reserved. |
6 * | 6 * |
7 * This library is free software; you can redistribute it and/or | 7 * This library is free software; you can redistribute it and/or |
8 * modify it under the terms of the GNU Library General Public | 8 * modify it under the terms of the GNU Library General Public |
9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
10 * version 2 of the License, or (at your option) any later version. | 10 * version 2 of the License, or (at your option) any later version. |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 | 69 |
70 Font::Font() | 70 Font::Font() |
71 : m_letterSpacing(0) | 71 : m_letterSpacing(0) |
72 , m_wordSpacing(0) | 72 , m_wordSpacing(0) |
73 , m_isPlatformFont(false) | 73 , m_isPlatformFont(false) |
74 , m_needsTranscoding(false) | 74 , m_needsTranscoding(false) |
75 , m_typesettingFeatures(0) | 75 , m_typesettingFeatures(0) |
76 { | 76 { |
77 } | 77 } |
78 | 78 |
79 Font::Font(const FontDescription& fd, short letterSpacing, short wordSpacing) | 79 Font::Font(const FontDescription& fd, float letterSpacing, float wordSpacing) |
80 : m_fontDescription(fd) | 80 : m_fontDescription(fd) |
81 , m_letterSpacing(letterSpacing) | 81 , m_letterSpacing(letterSpacing) |
82 , m_wordSpacing(wordSpacing) | 82 , m_wordSpacing(wordSpacing) |
83 , m_isPlatformFont(false) | 83 , m_isPlatformFont(false) |
84 , m_needsTranscoding(fontTranscoder().needsTranscoding(fd)) | 84 , m_needsTranscoding(fontTranscoder().needsTranscoding(fd)) |
85 , m_typesettingFeatures(computeTypesettingFeatures()) | 85 , m_typesettingFeatures(computeTypesettingFeatures()) |
86 { | 86 { |
87 } | 87 } |
88 | 88 |
89 Font::Font(const FontPlatformData& fontData, bool isPrinterFont, FontSmoothingMo
de fontSmoothingMode) | 89 Font::Font(const FontPlatformData& fontData, bool isPrinterFont, FontSmoothingMo
de fontSmoothingMode) |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 if (codePathToUse != Complex) { | 194 if (codePathToUse != Complex) { |
195 // The complex path is more restrictive about returning fallback fonts t
han the simple path, so we need an explicit test to make their behaviors match. | 195 // The complex path is more restrictive about returning fallback fonts t
han the simple path, so we need an explicit test to make their behaviors match. |
196 if (!canReturnFallbackFontsForComplexText()) | 196 if (!canReturnFallbackFontsForComplexText()) |
197 fallbackFonts = 0; | 197 fallbackFonts = 0; |
198 // The simple path can optimize the case where glyph overflow is not obs
ervable. | 198 // The simple path can optimize the case where glyph overflow is not obs
ervable. |
199 if (codePathToUse != SimpleWithGlyphOverflow && (glyphOverflow && !glyph
Overflow->computeBounds)) | 199 if (codePathToUse != SimpleWithGlyphOverflow && (glyphOverflow && !glyph
Overflow->computeBounds)) |
200 glyphOverflow = 0; | 200 glyphOverflow = 0; |
201 } | 201 } |
202 | 202 |
203 bool hasKerningOrLigatures = typesettingFeatures() & (Kerning | Ligatures); | 203 bool hasKerningOrLigatures = typesettingFeatures() & (Kerning | Ligatures); |
204 bool hasWordSpacingOrLetterSpacing = wordSpacing() | letterSpacing(); | 204 bool hasWordSpacingOrLetterSpacing = wordSpacing() || letterSpacing(); |
205 float* cacheEntry = m_fontFallbackList->widthCache().add(run, std::numeric_l
imits<float>::quiet_NaN(), hasKerningOrLigatures, hasWordSpacingOrLetterSpacing,
glyphOverflow); | 205 float* cacheEntry = m_fontFallbackList->widthCache().add(run, std::numeric_l
imits<float>::quiet_NaN(), hasKerningOrLigatures, hasWordSpacingOrLetterSpacing,
glyphOverflow); |
206 if (cacheEntry && !std::isnan(*cacheEntry)) | 206 if (cacheEntry && !std::isnan(*cacheEntry)) |
207 return *cacheEntry; | 207 return *cacheEntry; |
208 | 208 |
209 float result; | 209 float result; |
210 if (codePathToUse == Complex) | 210 if (codePathToUse == Complex) |
211 result = floatWidthForComplexText(run, fallbackFonts, glyphOverflow); | 211 result = floatWidthForComplexText(run, fallbackFonts, glyphOverflow); |
212 else | 212 else |
213 result = floatWidthForSimpleText(run, fallbackFonts, glyphOverflow); | 213 result = floatWidthForSimpleText(run, fallbackFonts, glyphOverflow); |
214 | 214 |
(...skipping 575 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
790 | 790 |
791 // Additional word-separator characters listed in CSS Text Level 3 Editor's
Draft 3 November 2010. | 791 // Additional word-separator characters listed in CSS Text Level 3 Editor's
Draft 3 November 2010. |
792 if (c == ethiopicWordspace || c == aegeanWordSeparatorLine || c == aegeanWor
dSeparatorDot | 792 if (c == ethiopicWordspace || c == aegeanWordSeparatorLine || c == aegeanWor
dSeparatorDot |
793 || c == ugariticWordDivider || c == tibetanMarkIntersyllabicTsheg || c =
= tibetanMarkDelimiterTshegBstar) | 793 || c == ugariticWordDivider || c == tibetanMarkIntersyllabicTsheg || c =
= tibetanMarkDelimiterTshegBstar) |
794 return false; | 794 return false; |
795 | 795 |
796 return true; | 796 return true; |
797 } | 797 } |
798 | 798 |
799 } | 799 } |
OLD | NEW |