Update interface to hb-subset-glyf to subset glyf and loca.
This commit is contained in:
parent
f2ceb5ee4d
commit
f9c665fed1
|
@ -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 writes to make sure they are in-bounds.
|
||||||
// TODO(grieger): Sanity check allocation size for the new table.
|
// TODO(grieger): Sanity check allocation size for the new table.
|
||||||
// TODO(grieger): Subset loca simultaneously.
|
// TODO(grieger): Subset loca simultaneously.
|
||||||
|
// TODO(grieger): Don't fail on bad offsets, just dump them.
|
||||||
|
|
||||||
unsigned int glyf_prime_size;
|
unsigned int glyf_prime_size;
|
||||||
if (unlikely (!_calculate_glyf_prime_size (glyf,
|
if (unlikely (!_calculate_glyf_prime_size (glyf,
|
||||||
|
@ -115,9 +116,10 @@ _hb_subset_glyf (const OT::glyf::accelerator_t &glyf,
|
||||||
* Since: 1.7.5
|
* Since: 1.7.5
|
||||||
**/
|
**/
|
||||||
bool
|
bool
|
||||||
hb_subset_glyf (hb_subset_plan_t *plan,
|
hb_subset_glyf_and_loca (hb_subset_plan_t *plan,
|
||||||
hb_face_t *face,
|
hb_face_t *face,
|
||||||
hb_blob_t **glyf_prime /* OUT */)
|
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));
|
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);
|
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);
|
bool result = _hb_subset_glyf (glyf, glyf_data, plan->glyphs_to_retain, glyf_prime);
|
||||||
glyf.fini();
|
glyf.fini();
|
||||||
|
|
||||||
|
// TODO(grieger): Subset loca
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,8 +30,9 @@
|
||||||
#include "hb-subset-plan.hh"
|
#include "hb-subset-plan.hh"
|
||||||
|
|
||||||
bool
|
bool
|
||||||
hb_subset_glyf (hb_subset_plan_t *plan,
|
hb_subset_glyf_and_loca (hb_subset_plan_t *plan,
|
||||||
hb_face_t *face,
|
hb_face_t *face,
|
||||||
hb_blob_t **glyf_prime /* OUT */);
|
hb_blob_t **glyf_prime /* OUT */,
|
||||||
|
hb_blob_t **loca_prime /* OUT */);
|
||||||
|
|
||||||
#endif /* HB_SUBSET_GLYF_HH */
|
#endif /* HB_SUBSET_GLYF_HH */
|
||||||
|
|
|
@ -310,8 +310,11 @@ hb_subset (hb_face_t *source,
|
||||||
hb_face_t *dest = nullptr; // TODO allocate dest
|
hb_face_t *dest = nullptr; // TODO allocate dest
|
||||||
|
|
||||||
hb_blob_t *glyf_prime = nullptr;
|
hb_blob_t *glyf_prime = nullptr;
|
||||||
if (hb_subset_glyf (plan, source, &glyf_prime)) {
|
hb_blob_t *loca_prime = nullptr;
|
||||||
// TODO: write new glyf to new face.
|
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);
|
hb_blob_destroy (glyf_prime);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue