From 5134041f216bbe0941ea5d068e008fc534d0732e Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Fri, 1 Jul 2022 16:48:47 -0600 Subject: [PATCH] [deserialize-json] Make it actually work! Was not correctly deserializing glyph names as it was not dropping double-quotes from glyph name before parsing. --- src/hb-buffer-deserialize-json.hh | 12 ++++++------ src/hb-buffer-deserialize-json.rl | 2 +- src/hb-buffer-deserialize-text.hh | 10 +++++----- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/hb-buffer-deserialize-json.hh b/src/hb-buffer-deserialize-json.hh index e80cfea6e..858497c00 100644 --- a/src/hb-buffer-deserialize-json.hh +++ b/src/hb-buffer-deserialize-json.hh @@ -32,7 +32,7 @@ #include "hb.hh" -#line 36 "hb-buffer-deserialize-json.hh" +#line 33 "hb-buffer-deserialize-json.hh" static const unsigned char _deserialize_json_trans_keys[] = { 0u, 0u, 9u, 123u, 9u, 34u, 97u, 117u, 120u, 121u, 34u, 34u, 9u, 58u, 9u, 57u, 48u, 57u, 9u, 125u, 9u, 125u, 9u, 125u, 34u, 34u, 9u, 58u, 9u, 57u, 48u, 57u, @@ -508,12 +508,12 @@ _hb_buffer_deserialize_json (hb_buffer_t *buffer, hb_glyph_info_t info = {0}; hb_glyph_position_t pos = {0}; -#line 512 "hb-buffer-deserialize-json.hh" +#line 505 "hb-buffer-deserialize-json.hh" { cs = deserialize_json_start; } -#line 517 "hb-buffer-deserialize-json.hh" +#line 508 "hb-buffer-deserialize-json.hh" { int _slen; int _trans; @@ -574,7 +574,7 @@ _resume: { /* TODO Unescape \" and \\ if found. */ if (!hb_font_glyph_from_string (font, - tok, p - tok, + tok+1, p - tok - 2, /* Skip "" */ &info.codepoint)) return false; } @@ -624,7 +624,7 @@ _resume: { /* TODO Unescape \" and \\ if found. */ if (!hb_font_glyph_from_string (font, - tok, p - tok, + tok+1, p - tok - 2, /* Skip "" */ &info.codepoint)) return false; } @@ -709,7 +709,7 @@ _resume: *end_ptr = p; } break; -#line 713 "hb-buffer-deserialize-json.hh" +#line 673 "hb-buffer-deserialize-json.hh" } _again: diff --git a/src/hb-buffer-deserialize-json.rl b/src/hb-buffer-deserialize-json.rl index 382423f6c..fa87ea4b7 100644 --- a/src/hb-buffer-deserialize-json.rl +++ b/src/hb-buffer-deserialize-json.rl @@ -58,7 +58,7 @@ action ensure_unicode { if (unlikely (!buffer->ensure_unicode ())) return false; action parse_glyph_name { /* TODO Unescape \" and \\ if found. */ if (!hb_font_glyph_from_string (font, - tok, p - tok, + tok+1, p - tok - 2, /* Skip "" */ &info.codepoint)) return false; } diff --git a/src/hb-buffer-deserialize-text.hh b/src/hb-buffer-deserialize-text.hh index 06a605e22..86fc2b480 100644 --- a/src/hb-buffer-deserialize-text.hh +++ b/src/hb-buffer-deserialize-text.hh @@ -32,7 +32,7 @@ #include "hb.hh" -#line 36 "hb-buffer-deserialize-text.hh" +#line 33 "hb-buffer-deserialize-text.hh" static const unsigned char _deserialize_text_trans_keys[] = { 0u, 0u, 9u, 91u, 85u, 85u, 43u, 43u, 48u, 102u, 9u, 85u, 48u, 57u, 45u, 57u, 48u, 57u, 48u, 57u, 45u, 57u, 48u, 57u, 44u, 44u, 45u, 57u, 48u, 57u, 44u, 57u, @@ -424,12 +424,12 @@ _hb_buffer_deserialize_text (hb_buffer_t *buffer, hb_glyph_info_t info = {0}; hb_glyph_position_t pos = {0}; -#line 428 "hb-buffer-deserialize-text.hh" +#line 421 "hb-buffer-deserialize-text.hh" { cs = deserialize_text_start; } -#line 433 "hb-buffer-deserialize-text.hh" +#line 424 "hb-buffer-deserialize-text.hh" { int _slen; int _trans; @@ -718,7 +718,7 @@ _resume: *end_ptr = p; } break; -#line 722 "hb-buffer-deserialize-text.hh" +#line 666 "hb-buffer-deserialize-text.hh" } _again: @@ -835,7 +835,7 @@ _again: *end_ptr = p; } break; -#line 839 "hb-buffer-deserialize-text.hh" +#line 766 "hb-buffer-deserialize-text.hh" } }