Issue: When a string with a non-printable ASCII character (like CR - ascii 10 or LF - ascii code 13) was passed to be shaped, it would hit an infinite loop.
Defect: The shaping code would resolve that there was no glyph available, and then enter the fallback code path - fallbackFor. The problem, though, is in these cases, we'd return the same font - and then we'd try and resolve the hole using the 'new' (really, the same) font - endlessly.
There also seemed to be an off-by-one issue in resolveHole that caused an additional glyph to be surfaced in this case.
Fix: In the case where the fallback font is the same as the source font, resolving the hole isn't going to help, so detect that case and handle it the same as the error case.
Test Impact:
Add cases for all ASCII characters to catch this
Add a simple CJK fallback case to verify we're still handling fallback in the simple case correctly
Issue: When a string with a non-printable ASCII character (like
CR
- ascii 10 orLF
- ascii code 13) was passed to be shaped, it would hit an infinite loop.Defect: The shaping code would resolve that there was no glyph available, and then enter the fallback code path -
fallbackFor
. The problem, though, is in these cases, we'd return the same font - and then we'd try and resolve the hole using the 'new' (really, the same) font - endlessly.There also seemed to be an off-by-one issue in
resolveHole
that caused an additional glyph to be surfaced in this case.Fix: In the case where the fallback font is the same as the source font, resolving the hole isn't going to help, so detect that case and handle it the same as the error case.
Test Impact: