Bug 1424648 - Provide proper face index to FreeType FontDescriptorOutput; r?lsalzman
OpenType font collections (*.ttc) contain multiple faces in a single file,
identified via index. When creating a font descriptor for a FreeType or
Fontconfig font, we mistakenly set the index to zero, always.
This bug became visible when layout and WebRender would disagree on the face in
use, rendering text with the metrics from the proper face but the outlines of
another. Unless, of course, the selected face was the first (or only) in the
font file.
MozReview-Commit-ID: 73qcPOD0HIr
--- a/gfx/2d/ScaledFontFontconfig.cpp
+++ b/gfx/2d/ScaledFontFontconfig.cpp
@@ -479,14 +479,14 @@ bool
UnscaledFontFontconfig::GetWRFontDescriptor(WRFontDescriptorOutput aCb, void* aBaton)
{
if (mFile.empty()) {
return false;
}
const char* path = mFile.c_str();
size_t pathLength = strlen(path);
- aCb(reinterpret_cast<const uint8_t*>(path), pathLength, 0, aBaton);
+ aCb(reinterpret_cast<const uint8_t*>(path), pathLength, mIndex, aBaton);
return true;
}
} // namespace gfx
} // namespace mozilla
--- a/gfx/2d/UnscaledFontFreeType.cpp
+++ b/gfx/2d/UnscaledFontFreeType.cpp
@@ -66,15 +66,15 @@ bool
UnscaledFontFreeType::GetFontDescriptor(FontDescriptorOutput aCb, void* aBaton)
{
if (mFile.empty()) {
return false;
}
const char* path = mFile.c_str();
size_t pathLength = strlen(path) + 1;
- aCb(reinterpret_cast<const uint8_t*>(path), pathLength, 0, aBaton);
+ aCb(reinterpret_cast<const uint8_t*>(path), pathLength, mIndex, aBaton);
return true;
}
} // namespace gfx
} // namespace mozilla