Chromium Code Reviews| Index: Source/platform/fonts/harfbuzz/HarfBuzzShaper.cpp |
| diff --git a/Source/platform/fonts/harfbuzz/HarfBuzzShaper.cpp b/Source/platform/fonts/harfbuzz/HarfBuzzShaper.cpp |
| index c6bfb7ffa305822398e76a2257cbc1168df55e66..b1cb0a24c9584da285ebfd6b953008949245b901 100644 |
| --- a/Source/platform/fonts/harfbuzz/HarfBuzzShaper.cpp |
| +++ b/Source/platform/fonts/harfbuzz/HarfBuzzShaper.cpp |
| @@ -86,12 +86,13 @@ typedef std::map<std::wstring, CachedShapingResults*> CachedShapingResultsMap; |
| typedef std::list<CachedShapingResultsLRUNode*> CachedShapingResultsLRU; |
| struct CachedShapingResults { |
| - CachedShapingResults(hb_buffer_t* harfBuzzBuffer, const Font* runFont, hb_direction_t runDir); |
| + CachedShapingResults(hb_buffer_t* harfBuzzBuffer, const Font* runFont, hb_direction_t runDir, CString newLocale); |
|
Inactive
2014/05/23 19:34:26
You really don't want to copy a CString (passed by
h.joshi
2014/05/24 01:27:00
Okey, did that after the previous comment related
|
| ~CachedShapingResults(); |
| hb_buffer_t* buffer; |
| Font font; |
| hb_direction_t dir; |
| + CString locale; |
|
Inactive
2014/05/23 19:34:26
String
h.joshi
2014/05/24 01:27:00
ditto
|
| CachedShapingResultsLRU::iterator lru; |
| }; |
| @@ -102,10 +103,11 @@ struct CachedShapingResultsLRUNode { |
| CachedShapingResultsMap::iterator entry; |
| }; |
| -CachedShapingResults::CachedShapingResults(hb_buffer_t* harfBuzzBuffer, const Font* fontData, hb_direction_t dirData) |
| +CachedShapingResults::CachedShapingResults(hb_buffer_t* harfBuzzBuffer, const Font* fontData, hb_direction_t dirData, CString newLocale) |
|
Inactive
2014/05/23 19:34:26
const String&
h.joshi
2014/05/24 01:27:00
ditto
|
| : buffer(harfBuzzBuffer) |
| , font(*fontData) |
| , dir(dirData) |
| + , locale(newLocale) |
| { |
| } |
| @@ -792,6 +794,7 @@ bool HarfBuzzShaper::shapeHarfBuzzRuns() |
| HarfBuzzScopedPtr<hb_buffer_t> harfBuzzBuffer(hb_buffer_create(), hb_buffer_destroy); |
| HarfBuzzRunCache& runCache = harfBuzzRunCache(); |
| + CString locale = m_font->fontDescription().locale().latin1(); |
|
Inactive
2014/05/23 19:34:26
You should probably store m_font->fontDescription(
h.joshi
2014/05/24 01:27:00
Okey, will be making String related changes.
|
| for (unsigned i = 0; i < m_harfBuzzRuns.size(); ++i) { |
| unsigned runIndex = m_run.rtl() ? m_harfBuzzRuns.size() - i - 1 : i; |
| @@ -805,6 +808,7 @@ bool HarfBuzzShaper::shapeHarfBuzzRuns() |
| if (!face) |
| return false; |
| + hb_buffer_set_language(harfBuzzBuffer.get(), hb_language_from_string(locale.data(), locale.length())); |
| hb_buffer_set_script(harfBuzzBuffer.get(), currentRun->script()); |
| hb_buffer_set_direction(harfBuzzBuffer.get(), currentRun->rtl() ? HB_DIRECTION_RTL : HB_DIRECTION_LTR); |
| @@ -816,7 +820,7 @@ bool HarfBuzzShaper::shapeHarfBuzzRuns() |
| CachedShapingResults* cachedResults = runCache.find(key); |
| if (cachedResults) { |
| - if (cachedResults->dir == props.direction && cachedResults->font == *m_font) { |
| + if (cachedResults->dir == props.direction && cachedResults->font == *m_font && cachedResults->locale == locale) { |
|
Inactive
2014/05/23 19:34:26
Compare Strings here.
|
| currentRun->applyShapeResult(cachedResults->buffer); |
| setGlyphPositionsForHarfBuzzRun(currentRun, cachedResults->buffer); |
| @@ -852,7 +856,7 @@ bool HarfBuzzShaper::shapeHarfBuzzRuns() |
| currentRun->applyShapeResult(harfBuzzBuffer.get()); |
| setGlyphPositionsForHarfBuzzRun(currentRun, harfBuzzBuffer.get()); |
| - runCache.insert(key, new CachedShapingResults(harfBuzzBuffer.get(), m_font, props.direction)); |
| + runCache.insert(key, new CachedShapingResults(harfBuzzBuffer.get(), m_font, props.direction, locale)); |
|
Inactive
2014/05/23 19:34:26
Pass String here.
h.joshi
2014/05/24 01:27:00
ditto
|
| harfBuzzBuffer.set(hb_buffer_create()); |
| } |