提交 f9c665fe 编写于 作者: G Garret Rieger 提交者: Behdad Esfahbod

Update interface to hb-subset-glyf to subset glyf and loca.

上级 f2ceb5ee
......@@ -83,6 +83,7 @@ _hb_subset_glyf (const OT::glyf::accelerator_t &glyf,
// TODO(grieger): Sanity check writes to make sure they are in-bounds.
// TODO(grieger): Sanity check allocation size for the new table.
// TODO(grieger): Subset loca simultaneously.
// TODO(grieger): Don't fail on bad offsets, just dump them.
unsigned int glyf_prime_size;
if (unlikely (!_calculate_glyf_prime_size (glyf,
......@@ -115,9 +116,10 @@ _hb_subset_glyf (const OT::glyf::accelerator_t &glyf,
* Since: 1.7.5
**/
bool
hb_subset_glyf (hb_subset_plan_t *plan,
hb_face_t *face,
hb_blob_t **glyf_prime /* OUT */)
hb_subset_glyf_and_loca (hb_subset_plan_t *plan,
hb_face_t *face,
hb_blob_t **glyf_prime /* OUT */,
hb_blob_t **loca_prime /* OUT */)
{
hb_blob_t *glyf_blob = OT::Sanitizer<OT::glyf>().sanitize (face->reference_table (HB_OT_TAG_glyf));
const char *glyf_data = hb_blob_get_data(glyf_blob, nullptr);
......@@ -127,5 +129,7 @@ hb_subset_glyf (hb_subset_plan_t *plan,
bool result = _hb_subset_glyf (glyf, glyf_data, plan->glyphs_to_retain, glyf_prime);
glyf.fini();
// TODO(grieger): Subset loca
return result;
}
......@@ -30,8 +30,9 @@
#include "hb-subset-plan.hh"
bool
hb_subset_glyf (hb_subset_plan_t *plan,
hb_face_t *face,
hb_blob_t **glyf_prime /* OUT */);
hb_subset_glyf_and_loca (hb_subset_plan_t *plan,
hb_face_t *face,
hb_blob_t **glyf_prime /* OUT */,
hb_blob_t **loca_prime /* OUT */);
#endif /* HB_SUBSET_GLYF_HH */
......@@ -310,8 +310,11 @@ hb_subset (hb_face_t *source,
hb_face_t *dest = nullptr; // TODO allocate dest
hb_blob_t *glyf_prime = nullptr;
if (hb_subset_glyf (plan, source, &glyf_prime)) {
// TODO: write new glyf to new face.
hb_blob_t *loca_prime = nullptr;
if (hb_subset_glyf_and_loca (plan, source, &glyf_prime, &loca_prime)) {
// TODO: write new glyf and loca to new face.
} else {
success = false;
}
hb_blob_destroy (glyf_prime);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册