提交 c6bc7c38 编写于 作者: B Behdad Esfahbod

Set num glyphs on sanitizer reference_table()

Move out-of-class definitions of two methods to hb-static so they
are accessible in libharfbuzz-subset.
上级 9401829d
...@@ -31,8 +31,6 @@ ...@@ -31,8 +31,6 @@
#include "hb-face-private.hh" #include "hb-face-private.hh"
#include "hb-blob-private.hh" #include "hb-blob-private.hh"
#include "hb-open-file-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) ...@@ -448,15 +446,6 @@ hb_face_get_upem (hb_face_t *face)
return face->get_upem (); return face->get_upem ();
} }
void
hb_face_t::load_upem (void) const
{
hb_blob_t *head_blob = OT::hb_sanitize_context_t().reference_table<OT::head> (this);
const OT::head *head_table = head_blob->as<OT::head> ();
upem = head_table->get_upem ();
hb_blob_destroy (head_blob);
}
/** /**
* hb_face_set_glyph_count: * hb_face_set_glyph_count:
* @face: a face. * @face: a face.
...@@ -492,15 +481,6 @@ hb_face_get_glyph_count (hb_face_t *face) ...@@ -492,15 +481,6 @@ hb_face_get_glyph_count (hb_face_t *face)
return face->get_num_glyphs (); 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<OT::maxp> (this);
const OT::maxp *maxp_table = maxp_blob->as<OT::maxp> ();
num_glyphs = maxp_table->get_num_glyphs ();
hb_blob_destroy (maxp_blob);
}
/** /**
* hb_face_get_table_tags: * hb_face_get_table_tags:
* @face: a face. * @face: a face.
......
...@@ -348,6 +348,7 @@ struct hb_sanitize_context_t : ...@@ -348,6 +348,7 @@ struct hb_sanitize_context_t :
template <typename Type> template <typename Type>
inline hb_blob_t *reference_table (const hb_face_t *face, hb_tag_t tableTag = Type::tableTag) 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<Type> (face->reference_table (tableTag)); return sanitize_blob<Type> (face->reference_table (tableTag));
} }
......
...@@ -25,8 +25,30 @@ ...@@ -25,8 +25,30 @@
*/ */
#include "hb-private.hh" #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 #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)] = {}; 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)] = {}; /*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 #endif
void
hb_face_t::load_num_glyphs (void) const
{
hb_blob_t *maxp_blob = OT::hb_sanitize_context_t().reference_table<OT::maxp> (this);
const OT::maxp *maxp_table = maxp_blob->as<OT::maxp> ();
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<OT::head> (this);
const OT::head *head_table = head_blob->as<OT::head> ();
upem = head_table->get_upem ();
hb_blob_destroy (head_blob);
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册