fixed off-by-one error in CFF1 Encoding lookup

This commit is contained in:
Michiharu Ariza 2018-11-07 09:09:13 -08:00
parent 7b21319edf
commit 7fed7d80f7
1 changed files with 4 additions and 0 deletions

View File

@ -64,6 +64,8 @@ struct Encoding0 {
inline hb_codepoint_t get_code (hb_codepoint_t glyph) const
{
assert (glyph > 0);
glyph--;
if (glyph < nCodes)
{
return (hb_codepoint_t)codes[glyph];
@ -106,6 +108,8 @@ struct Encoding1 {
inline hb_codepoint_t get_code (hb_codepoint_t glyph) const
{
assert (glyph > 0);
glyph--;
for (unsigned int i = 0; i < nRanges; i++)
{
if (glyph <= ranges[i].nLeft)