diff --git a/src/hb-face.cc b/src/hb-face.cc index ad44eff594fc26f6d12cd9f44221bf3d62f2b97e..fab2aa3a9f8eec25892e7f39340833ea72b6fec6 100644 --- a/src/hb-face.cc +++ b/src/hb-face.cc @@ -31,8 +31,6 @@ #include "hb-face-private.hh" #include "hb-blob-private.hh" #include "hb-open-file-private.hh" -#include "hb-ot-head-table.hh" -#include "hb-ot-maxp-table.hh" @@ -448,15 +446,6 @@ hb_face_get_upem (hb_face_t *face) return face->get_upem (); } -void -hb_face_t::load_upem (void) const -{ - hb_blob_t *head_blob = OT::hb_sanitize_context_t().reference_table (this); - const OT::head *head_table = head_blob->as (); - upem = head_table->get_upem (); - hb_blob_destroy (head_blob); -} - /** * hb_face_set_glyph_count: * @face: a face. @@ -492,15 +481,6 @@ hb_face_get_glyph_count (hb_face_t *face) return face->get_num_glyphs (); } -void -hb_face_t::load_num_glyphs (void) const -{ - hb_blob_t *maxp_blob = OT::hb_sanitize_context_t().reference_table (this); - const OT::maxp *maxp_table = maxp_blob->as (); - num_glyphs = maxp_table->get_num_glyphs (); - hb_blob_destroy (maxp_blob); -} - /** * hb_face_get_table_tags: * @face: a face. diff --git a/src/hb-open-type-private.hh b/src/hb-open-type-private.hh index c59bb6a53bea3721b08ce10ddb9aad838406faf1..e2a135562276850a2c9db35591257c0c0c71aeaa 100644 --- a/src/hb-open-type-private.hh +++ b/src/hb-open-type-private.hh @@ -348,6 +348,7 @@ struct hb_sanitize_context_t : template inline hb_blob_t *reference_table (const hb_face_t *face, hb_tag_t tableTag = Type::tableTag) { + set_num_glyphs (face->get_num_glyphs ()); return sanitize_blob (face->reference_table (tableTag)); } diff --git a/src/hb-static.cc b/src/hb-static.cc index ee17cd3481cb75701eb8ddbe7be78735ae93907e..729b242c56ba22d895331d3b1c28d9a599560f18 100644 --- a/src/hb-static.cc +++ b/src/hb-static.cc @@ -25,8 +25,30 @@ */ #include "hb-private.hh" +#include "hb-face-private.hh" +#include "hb-open-type-private.hh" +#include "hb-ot-head-table.hh" +#include "hb-ot-maxp-table.hh" #ifndef HB_NO_VISIBILITY hb_vector_size_impl_t const _hb_NullPool[(HB_NULL_POOL_SIZE + sizeof (hb_vector_size_impl_t) - 1) / sizeof (hb_vector_size_impl_t)] = {}; /*thread_local*/ hb_vector_size_impl_t _hb_CrapPool[(HB_NULL_POOL_SIZE + sizeof (hb_vector_size_impl_t) - 1) / sizeof (hb_vector_size_impl_t)] = {}; #endif + +void +hb_face_t::load_num_glyphs (void) const +{ + hb_blob_t *maxp_blob = OT::hb_sanitize_context_t().reference_table (this); + const OT::maxp *maxp_table = maxp_blob->as (); + num_glyphs = maxp_table->get_num_glyphs (); + hb_blob_destroy (maxp_blob); +} + +void +hb_face_t::load_upem (void) const +{ + hb_blob_t *head_blob = OT::hb_sanitize_context_t().reference_table (this); + const OT::head *head_table = head_blob->as (); + upem = head_table->get_upem (); + hb_blob_destroy (head_blob); +}