[deserialize-json] Make it actually work!

Was not correctly deserializing glyph names as it was not dropping
double-quotes from glyph name before parsing.
pull/3702/head
Behdad Esfahbod 2 years ago
parent 534b0911f7
commit 5134041f21
  1. 12
      src/hb-buffer-deserialize-json.hh
  2. 2
      src/hb-buffer-deserialize-json.rl
  3. 10
      src/hb-buffer-deserialize-text.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:

@ -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;
}

@ -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"
}
}

Loading…
Cancel
Save