diff options
author | Akira Kakuto <kakuto@fuk.kindai.ac.jp> | 2020-12-24 07:21:30 +0000 |
---|---|---|
committer | Akira Kakuto <kakuto@fuk.kindai.ac.jp> | 2020-12-24 07:21:30 +0000 |
commit | f88f99b079f2902f7705a2aff36c0ff8c13df8a8 (patch) | |
tree | 9a4408ede2a693471e9316ce59708ca0eca1b68c /Build/source/libs/harfbuzz/harfbuzz-src/src/hb-buffer-deserialize-json.rl | |
parent | d9a6a275c51f6dcebc04e63329571f020c5de19a (diff) |
harfbuzz 2.7.3
git-svn-id: svn://tug.org/texlive/trunk@57216 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/libs/harfbuzz/harfbuzz-src/src/hb-buffer-deserialize-json.rl')
-rw-r--r-- | Build/source/libs/harfbuzz/harfbuzz-src/src/hb-buffer-deserialize-json.rl | 29 |
1 files changed, 20 insertions, 9 deletions
diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-buffer-deserialize-json.rl b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-buffer-deserialize-json.rl index f3abb027b20..382423f6c7d 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-buffer-deserialize-json.rl +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-buffer-deserialize-json.rl @@ -52,14 +52,18 @@ action tok { tok = p; } -action parse_glyph { +action ensure_glyphs { if (unlikely (!buffer->ensure_glyphs ())) return false; } +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, &info.codepoint)) return false; } -action parse_gid { if (!parse_uint (tok, p, &info.codepoint)) return false; } +action parse_codepoint { if (!parse_uint (tok, p, &info.codepoint)) return false; } action parse_cluster { if (!parse_uint (tok, p, &info.cluster )) return false; } action parse_x_offset { if (!parse_int (tok, p, &pos.x_offset )) return false; } action parse_y_offset { if (!parse_int (tok, p, &pos.y_offset )) return false; } @@ -72,20 +76,27 @@ num = '-'? unum; comma = space* ',' space*; colon = space* ':' space*; -glyph_id = unum; -glyph_name = alpha (alnum|'_'|'.'|'-')*; +codepoint = unum; +glyph_name = '"' ([^\\"] | '\\' [\\"])* '"'; -glyph_string = '"' (glyph_name >tok %parse_glyph) '"'; -glyph_number = (glyph_id >tok %parse_gid); +parse_glyph_name = (glyph_name >tok %parse_glyph_name); +parse_codepoint = (codepoint >tok %parse_codepoint); -glyph = "\"g\"" colon (glyph_string | glyph_number); +glyph = "\"g\"" colon (parse_glyph_name | parse_codepoint); +unicode = "\"u\"" colon parse_codepoint; cluster = "\"cl\"" colon (unum >tok %parse_cluster); xoffset = "\"dx\"" colon (num >tok %parse_x_offset); yoffset = "\"dy\"" colon (num >tok %parse_y_offset); xadvance= "\"ax\"" colon (num >tok %parse_x_advance); yadvance= "\"ay\"" colon (num >tok %parse_y_advance); -element = glyph | cluster | xoffset | yoffset | xadvance | yadvance; +element = glyph @ensure_glyphs + | unicode @ensure_unicode + | cluster + | xoffset + | yoffset + | xadvance + | yadvance; item = ( '{' space* element (comma element)* space* '}') >clear_item @@ -97,7 +108,7 @@ main := space* item (comma item)* space* (','|']')?; }%% static hb_bool_t -_hb_buffer_deserialize_glyphs_json (hb_buffer_t *buffer, +_hb_buffer_deserialize_json (hb_buffer_t *buffer, const char *buf, unsigned int buf_len, const char **end_ptr, |