[buffer] Add ensure_glyphs()/ensure_unicode()
Use in deserialize. To be used more.
diff --git a/src/hb-buffer-deserialize-json.rl b/src/hb-buffer-deserialize-json.rl
index 988b288..382423f 100644
--- a/src/hb-buffer-deserialize-json.rl
+++ b/src/hb-buffer-deserialize-json.rl
@@ -52,25 +52,8 @@
tok = p;
}
-action ensure_glyphs {
- if (unlikely (buffer->content_type != HB_BUFFER_CONTENT_TYPE_GLYPHS))
- {
- if (buffer->content_type != HB_BUFFER_CONTENT_TYPE_INVALID)
- return false;
- assert (buffer->len == 0);
- buffer->content_type = HB_BUFFER_CONTENT_TYPE_GLYPHS;
- }
-}
-
-action ensure_unicode {
- if (unlikely (buffer->content_type != HB_BUFFER_CONTENT_TYPE_UNICODE))
- {
- if (buffer->content_type != HB_BUFFER_CONTENT_TYPE_INVALID)
- return false;
- assert (buffer->len == 0);
- buffer->content_type = HB_BUFFER_CONTENT_TYPE_UNICODE;
- }
-}
+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. */