OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012 Google Inc. All rights reserved. | 2 * Copyright (c) 2012 Google 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 are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
360 , m_letterSpacing(font->letterSpacing()) | 360 , m_letterSpacing(font->letterSpacing()) |
361 , m_fromIndex(0) | 361 , m_fromIndex(0) |
362 , m_toIndex(m_run.length()) | 362 , m_toIndex(m_run.length()) |
363 { | 363 { |
364 m_normalizedBuffer = adoptArrayPtr(new UChar[m_run.length() + 1]); | 364 m_normalizedBuffer = adoptArrayPtr(new UChar[m_run.length() + 1]); |
365 normalizeCharacters(m_run, m_run.length(), m_normalizedBuffer.get(), &m_norm
alizedBufferLength); | 365 normalizeCharacters(m_run, m_run.length(), m_normalizedBuffer.get(), &m_norm
alizedBufferLength); |
366 setPadding(m_run.expansion()); | 366 setPadding(m_run.expansion()); |
367 setFontFeatures(); | 367 setFontFeatures(); |
368 } | 368 } |
369 | 369 |
370 HarfBuzzShaper::~HarfBuzzShaper() | |
371 { | |
372 } | |
373 | |
374 static void normalizeSpacesAndMirrorChars(const UChar* source, unsigned length,
UChar* destination, unsigned* destinationLength, HarfBuzzShaper::NormalizeMode n
ormalizeMode) | 370 static void normalizeSpacesAndMirrorChars(const UChar* source, unsigned length,
UChar* destination, unsigned* destinationLength, HarfBuzzShaper::NormalizeMode n
ormalizeMode) |
375 { | 371 { |
376 int position = 0; | 372 int position = 0; |
377 bool error = false; | 373 bool error = false; |
378 // Iterate characters in source and mirror character if needed. | 374 // Iterate characters in source and mirror character if needed. |
379 *destinationLength = 0; | 375 *destinationLength = 0; |
380 while (position < length) { | 376 while (position < length) { |
381 UChar32 character; | 377 UChar32 character; |
382 U16_NEXT(source, position, length, character); | 378 U16_NEXT(source, position, length, character); |
383 // Don't normalize tabs as they are not treated as spaces for word-end | 379 // Don't normalize tabs as they are not treated as spaces for word-end |
(...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
868 if (!foundToX) | 864 if (!foundToX) |
869 toX = m_run.rtl() ? 0 : m_totalWidth; | 865 toX = m_run.rtl() ? 0 : m_totalWidth; |
870 | 866 |
871 // Using floorf() and roundf() as the same as mac port. | 867 // Using floorf() and roundf() as the same as mac port. |
872 if (fromX < toX) | 868 if (fromX < toX) |
873 return FloatRect(floorf(point.x() + fromX), point.y(), roundf(toX - from
X), height); | 869 return FloatRect(floorf(point.x() + fromX), point.y(), roundf(toX - from
X), height); |
874 return FloatRect(floorf(point.x() + toX), point.y(), roundf(fromX - toX), he
ight); | 870 return FloatRect(floorf(point.x() + toX), point.y(), roundf(fromX - toX), he
ight); |
875 } | 871 } |
876 | 872 |
877 } // namespace WebCore | 873 } // namespace WebCore |
OLD | NEW |