| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 // We break up glyph run generation for the string by FontData. | 237 // We break up glyph run generation for the string by FontData. |
| 238 const UChar* cp; | 238 const UChar* cp; |
| 239 | 239 |
| 240 if (m_run.is8Bit()) { | 240 if (m_run.is8Bit()) { |
| 241 String stringFor8BitRun = String::make16BitFrom8BitSource(m_run.characte
rs8(), m_run.length()); | 241 String stringFor8BitRun = String::make16BitFrom8BitSource(m_run.characte
rs8(), m_run.length()); |
| 242 cp = stringFor8BitRun.characters16(); | 242 cp = stringFor8BitRun.characters16(); |
| 243 m_stringsFor8BitRuns.append(stringFor8BitRun); | 243 m_stringsFor8BitRuns.append(stringFor8BitRun); |
| 244 } else | 244 } else |
| 245 cp = m_run.characters16(); | 245 cp = m_run.characters16(); |
| 246 | 246 |
| 247 if (m_font.fontDescription().variant()) | 247 if (m_font.fontDescription().variant() == FontVariantSmallCaps) |
| 248 m_smallCapsBuffer.resize(m_end); | 248 m_smallCapsBuffer.resize(m_end); |
| 249 | 249 |
| 250 unsigned indexOfFontTransition = 0; | 250 unsigned indexOfFontTransition = 0; |
| 251 const UChar* curr = cp; | 251 const UChar* curr = cp; |
| 252 const UChar* end = cp + m_end; | 252 const UChar* end = cp + m_end; |
| 253 | 253 |
| 254 const SimpleFontData* fontData; | 254 const SimpleFontData* fontData; |
| 255 bool isMissingGlyph; | 255 bool isMissingGlyph; |
| 256 const SimpleFontData* nextFontData; | 256 const SimpleFontData* nextFontData; |
| 257 bool nextIsMissingGlyph; | 257 bool nextIsMissingGlyph; |
| 258 | 258 |
| 259 unsigned markCount; | 259 unsigned markCount; |
| 260 const UChar* sequenceStart = curr; | 260 const UChar* sequenceStart = curr; |
| 261 UChar32 baseCharacter; | 261 UChar32 baseCharacter; |
| 262 if (!advanceByCombiningCharacterSequence(curr, end, baseCharacter, markCount
)) | 262 if (!advanceByCombiningCharacterSequence(curr, end, baseCharacter, markCount
)) |
| 263 return; | 263 return; |
| 264 | 264 |
| 265 UChar uppercaseCharacter = 0; | 265 UChar uppercaseCharacter = 0; |
| 266 | 266 |
| 267 bool isSmallCaps; | 267 bool isSmallCaps; |
| 268 bool nextIsSmallCaps = m_font.fontDescription().variant() && !(U_GET_GC_MASK
(baseCharacter) & U_GC_M_MASK) && (uppercaseCharacter = u_toupper(baseCharacter)
) != baseCharacter; | 268 bool nextIsSmallCaps = m_font.fontDescription().variant() == FontVariantSmal
lCaps && !(U_GET_GC_MASK(baseCharacter) & U_GC_M_MASK) && (uppercaseCharacter =
u_toupper(baseCharacter)) != baseCharacter; |
| 269 | 269 |
| 270 if (nextIsSmallCaps) { | 270 if (nextIsSmallCaps) { |
| 271 m_smallCapsBuffer[sequenceStart - cp] = uppercaseCharacter; | 271 m_smallCapsBuffer[sequenceStart - cp] = uppercaseCharacter; |
| 272 for (unsigned i = 0; i < markCount; ++i) | 272 for (unsigned i = 0; i < markCount; ++i) |
| 273 m_smallCapsBuffer[sequenceStart - cp + i + 1] = sequenceStart[i + 1]
; | 273 m_smallCapsBuffer[sequenceStart - cp + i + 1] = sequenceStart[i + 1]
; |
| 274 } | 274 } |
| 275 | 275 |
| 276 nextIsMissingGlyph = false; | 276 nextIsMissingGlyph = false; |
| 277 nextFontData = m_font.fontDataForCombiningCharacterSequence(sequenceStart, c
urr - sequenceStart, nextIsSmallCaps ? SmallCapsVariant : NormalVariant); | 277 nextFontData = m_font.fontDataForCombiningCharacterSequence(sequenceStart, c
urr - sequenceStart, nextIsSmallCaps ? SmallCapsVariant : NormalVariant); |
| 278 if (!nextFontData) | 278 if (!nextFontData) |
| (...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 660 | 660 |
| 661 lastCharacterIndex = characterIndex; | 661 lastCharacterIndex = characterIndex; |
| 662 } | 662 } |
| 663 if (!isMonotonic) | 663 if (!isMonotonic) |
| 664 complexTextRun.setIsNonMonotonic(); | 664 complexTextRun.setIsNonMonotonic(); |
| 665 } | 665 } |
| 666 m_totalWidth += widthSinceLastCommit; | 666 m_totalWidth += widthSinceLastCommit; |
| 667 } | 667 } |
| 668 | 668 |
| 669 } // namespace WebCore | 669 } // namespace WebCore |
| OLD | NEW |