diff options
Diffstat (limited to 'src/ports')
-rw-r--r-- | src/ports/SkFontHost_FreeType.cpp | 4 | ||||
-rw-r--r-- | src/ports/SkFontHost_mac.cpp | 4 |
2 files changed, 6 insertions, 2 deletions
diff --git a/src/ports/SkFontHost_FreeType.cpp b/src/ports/SkFontHost_FreeType.cpp index 240f75c2e2..91801cdbd0 100644 --- a/src/ports/SkFontHost_FreeType.cpp +++ b/src/ports/SkFontHost_FreeType.cpp @@ -1855,7 +1855,9 @@ bool SkTypeface_FreeType::Scanner::scanFont( const SkScalar axisMin = SkFixedToScalar(axisDefinition.fMinimum); const SkScalar axisMax = SkFixedToScalar(axisDefinition.fMaximum); axisValues[i] = axisDefinition.fDefault; - for (int j = 0; j < position.coordinateCount; ++j) { + // The position may be over specified. If there are multiple values for a given axis, + // use the last one since that's what css-fonts-4 requires. + for (int j = position.coordinateCount; j --> 0;) { const auto& coordinate = position.coordinates[j]; if (axisDefinition.fTag == coordinate.axis) { const SkScalar axisValue = SkTPin(coordinate.value, axisMin, axisMax); diff --git a/src/ports/SkFontHost_mac.cpp b/src/ports/SkFontHost_mac.cpp index 176a20cd65..d13be5a03b 100644 --- a/src/ports/SkFontHost_mac.cpp +++ b/src/ports/SkFontHost_mac.cpp @@ -2488,7 +2488,9 @@ protected: } double value = defDouble; - for (int j = 0; j < position.coordinateCount; ++j) { + // The position may be over specified. If there are multiple values for a given axis, + // use the last one since that's what css-fonts-4 requires. + for (int j = position.coordinateCount; j --> 0;) { if (position.coordinates[j].axis == tagLong) { value = SkTPin(SkScalarToDouble(position.coordinates[j].value), minDouble, maxDouble); |