1919#include " TextLayoutCache.h"
2020#include " TextLayout.h"
2121#include " SkFontHost.h"
22+ #include " SkTypeface_android.h"
2223#include < unicode/unistr.h>
2324#include < unicode/normlzr.h>
2425#include < unicode/uchar.h>
@@ -224,7 +225,7 @@ void TextLayoutCache::dumpCacheStats() {
224225 */
225226TextLayoutCacheKey::TextLayoutCacheKey (): text(NULL ), start(0 ), count(0 ), contextCount(0 ),
226227 dirFlags (0 ), typeface(NULL ), textSize(0 ), textSkewX(0 ), textScaleX(0 ), flags(0 ),
227- hinting(SkPaint::kNo_Hinting ) {
228+ hinting(SkPaint::kNo_Hinting ), variant(SkPaint:: kDefault_Variant ), language() {
228229}
229230
230231TextLayoutCacheKey::TextLayoutCacheKey (const SkPaint* paint, const UChar* text,
@@ -237,6 +238,8 @@ TextLayoutCacheKey::TextLayoutCacheKey(const SkPaint* paint, const UChar* text,
237238 textScaleX = paint->getTextScaleX ();
238239 flags = paint->getFlags ();
239240 hinting = paint->getHinting ();
241+ variant = paint->getFontVariant ();
242+ language = paint->getLanguage ();
240243}
241244
242245TextLayoutCacheKey::TextLayoutCacheKey (const TextLayoutCacheKey& other) :
@@ -251,7 +254,9 @@ TextLayoutCacheKey::TextLayoutCacheKey(const TextLayoutCacheKey& other) :
251254 textSkewX(other.textSkewX),
252255 textScaleX(other.textScaleX),
253256 flags(other.flags),
254- hinting(other.hinting) {
257+ hinting(other.hinting),
258+ variant(other.variant),
259+ language(other.language) {
255260 if (other.text ) {
256261 textCopy.setTo (other.text , other.contextCount );
257262 }
@@ -288,6 +293,12 @@ int TextLayoutCacheKey::compare(const TextLayoutCacheKey& lhs, const TextLayoutC
288293 deltaInt = lhs.dirFlags - rhs.dirFlags ;
289294 if (deltaInt) return (deltaInt);
290295
296+ deltaInt = lhs.variant - rhs.variant ;
297+ if (deltaInt) return (deltaInt);
298+
299+ if (lhs.language < rhs.language ) return -1 ;
300+ if (lhs.language > rhs.language ) return +1 ;
301+
291302 return memcmp (lhs.getText (), rhs.getText (), lhs.contextCount * sizeof (UChar));
292303}
293304
@@ -615,6 +626,8 @@ void TextLayoutShaper::computeRunValues(const SkPaint* paint, const UChar* chars
615626 mShapingPaint .setTextScaleX (paint->getTextScaleX ());
616627 mShapingPaint .setFlags (paint->getFlags ());
617628 mShapingPaint .setHinting (paint->getHinting ());
629+ mShapingPaint .setFontVariant (paint->getFontVariant ());
630+ mShapingPaint .setLanguage (paint->getLanguage ());
618631
619632 // Split the BiDi run into Script runs. Harfbuzz will populate the pos, length and script
620633 // into the shaperItem
0 commit comments