-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Description
When working with XPS documents WPF will subset fonts in order to reduce their size during embedding. In certain cases, this can result in the font growing during subsetting.
This results in us returning ERR_WOULD_GROW:
wpf/src/Microsoft.DotNet.Wpf/src/DirectWriteForwarder/CPP/TrueTypeSubsetter/TtfDelta/ttfdelta.cpp
Line 920 in e4a212b
errCode = ERR_WOULD_GROW; /* use the original font */ |
We already know what to do in this case (as the comments in the code above suggest), use the original font. However, we seem to be ignoring that:
wpf/src/Microsoft.DotNet.Wpf/src/DirectWriteForwarder/CPP/TrueTypeSubsetter/truetype.cpp
Lines 105 to 106 in 70da708
if (errCode != NO_ERROR) | |
throw gcnew FileFormatException(sourceUri); |
The fix is pretty straightforward, simply copy the font into the result buffer when we detect ERR_WOULD_GROW
and return as usual.