| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2012 Google Inc. All rights reserved. | 2 * Copyright (c) 2012 Google Inc. All rights reserved. |
| 3 * Copyright (C) 2013 BlackBerry Limited. All rights reserved. | 3 * Copyright (C) 2013 BlackBerry Limited. All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions are | 6 * modification, are permitted provided that the following conditions are |
| 7 * met: | 7 * met: |
| 8 * | 8 * |
| 9 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 800 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 811 } | 811 } |
| 812 | 812 |
| 813 bool HarfBuzzShaper::shapeHarfBuzzRuns() | 813 bool HarfBuzzShaper::shapeHarfBuzzRuns() |
| 814 { | 814 { |
| 815 HarfBuzzScopedPtr<hb_buffer_t> harfBuzzBuffer(hb_buffer_create(), hb_buffer_
destroy); | 815 HarfBuzzScopedPtr<hb_buffer_t> harfBuzzBuffer(hb_buffer_create(), hb_buffer_
destroy); |
| 816 | 816 |
| 817 HarfBuzzRunCache& runCache = harfBuzzRunCache(); | 817 HarfBuzzRunCache& runCache = harfBuzzRunCache(); |
| 818 const FontDescription& fontDescription = m_font->fontDescription(); | 818 const FontDescription& fontDescription = m_font->fontDescription(); |
| 819 const String& localeString = fontDescription.locale(); | 819 const String& localeString = fontDescription.locale(); |
| 820 CString locale = localeString.latin1(); | 820 CString locale = localeString.latin1(); |
| 821 const hb_language_t language = hb_language_from_string(locale.data(), locale
.length()); |
| 821 HarfBuzzRun* previousRun = nullptr; | 822 HarfBuzzRun* previousRun = nullptr; |
| 822 | 823 |
| 823 for (unsigned i = 0; i < m_harfBuzzRuns.size(); ++i) { | 824 for (unsigned i = 0; i < m_harfBuzzRuns.size(); ++i) { |
| 824 unsigned runIndex = m_run.rtl() ? m_harfBuzzRuns.size() - i - 1 : i; | 825 unsigned runIndex = m_run.rtl() ? m_harfBuzzRuns.size() - i - 1 : i; |
| 825 HarfBuzzRun* currentRun = m_harfBuzzRuns[runIndex].get(); | 826 HarfBuzzRun* currentRun = m_harfBuzzRuns[runIndex].get(); |
| 826 | 827 |
| 827 const SimpleFontData* currentFontData = currentRun->fontData(); | 828 const SimpleFontData* currentFontData = currentRun->fontData(); |
| 828 FontPlatformData* platformData = const_cast<FontPlatformData*>(¤tF
ontData->platformData()); | 829 FontPlatformData* platformData = const_cast<FontPlatformData*>(¤tF
ontData->platformData()); |
| 829 HarfBuzzFace* face = platformData->harfBuzzFace(); | 830 HarfBuzzFace* face = platformData->harfBuzzFace(); |
| 830 if (!face) | 831 if (!face) |
| 831 return false; | 832 return false; |
| 832 | 833 |
| 833 hb_buffer_set_language(harfBuzzBuffer.get(), hb_language_from_string(loc
ale.data(), locale.length())); | 834 hb_buffer_set_language(harfBuzzBuffer.get(), language); |
| 834 hb_buffer_set_script(harfBuzzBuffer.get(), currentRun->script()); | 835 hb_buffer_set_script(harfBuzzBuffer.get(), currentRun->script()); |
| 835 hb_buffer_set_direction(harfBuzzBuffer.get(), currentRun->direction()); | 836 hb_buffer_set_direction(harfBuzzBuffer.get(), currentRun->direction()); |
| 836 | 837 |
| 837 const UChar* src = m_normalizedBuffer.get() + currentRun->startIndex(); | 838 const UChar* src = m_normalizedBuffer.get() + currentRun->startIndex(); |
| 838 std::wstring key(src, src + currentRun->numCharacters()); | 839 std::wstring key(src, src + currentRun->numCharacters()); |
| 839 | 840 |
| 840 CachedShapingResults* cachedResults = runCache.find(key); | 841 CachedShapingResults* cachedResults = runCache.find(key); |
| 841 if (cachedResults) { | 842 if (cachedResults) { |
| 842 if (isValidCachedResult(m_font, currentRun->direction(), | 843 if (isValidCachedResult(m_font, currentRun->direction(), |
| 843 localeString, cachedResults)) { | 844 localeString, cachedResults)) { |
| (...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1206 // possibly invalid from, to arguments. | 1207 // possibly invalid from, to arguments. |
| 1207 if (!foundToX && !foundFromX) | 1208 if (!foundToX && !foundFromX) |
| 1208 fromX = toX = 0; | 1209 fromX = toX = 0; |
| 1209 | 1210 |
| 1210 if (fromX < toX) | 1211 if (fromX < toX) |
| 1211 return FloatRect(point.x() + fromX, point.y(), toX - fromX, height); | 1212 return FloatRect(point.x() + fromX, point.y(), toX - fromX, height); |
| 1212 return FloatRect(point.x() + toX, point.y(), fromX - toX, height); | 1213 return FloatRect(point.x() + toX, point.y(), fromX - toX, height); |
| 1213 } | 1214 } |
| 1214 | 1215 |
| 1215 } // namespace blink | 1216 } // namespace blink |
| OLD | NEW |