[subset] Rename _subset2 to _subset

This commit is contained in:
Ebrahim Byagowi 2020-02-04 21:29:19 +03:30
parent 2792fb8ba1
commit 5b43603385
1 changed files with 21 additions and 41 deletions

View File

@ -69,7 +69,7 @@ _plan_estimate_subset_table_size (hb_subset_plan_t *plan,
template<typename TableType> template<typename TableType>
static bool static bool
_subset2 (hb_subset_plan_t *plan) _subset (hb_subset_plan_t *plan)
{ {
bool result = false; bool result = false;
hb_blob_t *source_blob = hb_sanitize_context_t ().reference_table<TableType> (plan->source); hb_blob_t *source_blob = hb_sanitize_context_t ().reference_table<TableType> (plan->source);
@ -133,26 +133,6 @@ _subset2 (hb_subset_plan_t *plan)
return result; return result;
} }
template<typename TableType>
static bool
_subset (hb_subset_plan_t *plan)
{
hb_blob_t *source_blob = hb_sanitize_context_t ().reference_table<TableType> (plan->source);
const TableType *table = source_blob->as<TableType> ();
hb_tag_t tag = TableType::tableTag;
hb_bool_t result = false;
if (source_blob->data)
result = table->subset (plan);
else
DEBUG_MSG(SUBSET, nullptr, "OT::%c%c%c%c::subset sanitize failed on source table.", HB_UNTAG (tag));
hb_blob_destroy (source_blob);
DEBUG_MSG(SUBSET, nullptr, "OT::%c%c%c%c::subset %s", HB_UNTAG (tag), result ? "success" : "FAILED!");
return result;
}
static bool static bool
_subset_table (hb_subset_plan_t *plan, _subset_table (hb_subset_plan_t *plan,
hb_tag_t tag) hb_tag_t tag)
@ -161,13 +141,13 @@ _subset_table (hb_subset_plan_t *plan,
bool result = true; bool result = true;
switch (tag) { switch (tag) {
case HB_OT_TAG_glyf: case HB_OT_TAG_glyf:
result = _subset2<const OT::glyf> (plan); result = _subset<const OT::glyf> (plan);
break; break;
case HB_OT_TAG_hdmx: case HB_OT_TAG_hdmx:
result = _subset2<const OT::hdmx> (plan); result = _subset<const OT::hdmx> (plan);
break; break;
case HB_OT_TAG_name: case HB_OT_TAG_name:
result = _subset2<const OT::name> (plan); result = _subset<const OT::name> (plan);
break; break;
case HB_OT_TAG_head: case HB_OT_TAG_head:
// TODO that won't work well if there is no glyf // TODO that won't work well if there is no glyf
@ -178,66 +158,66 @@ _subset_table (hb_subset_plan_t *plan,
DEBUG_MSG(SUBSET, nullptr, "skip hhea handled by hmtx"); DEBUG_MSG(SUBSET, nullptr, "skip hhea handled by hmtx");
return true; return true;
case HB_OT_TAG_hmtx: case HB_OT_TAG_hmtx:
result = _subset2<const OT::hmtx> (plan); result = _subset<const OT::hmtx> (plan);
break; break;
case HB_OT_TAG_vhea: case HB_OT_TAG_vhea:
DEBUG_MSG(SUBSET, nullptr, "skip vhea handled by vmtx"); DEBUG_MSG(SUBSET, nullptr, "skip vhea handled by vmtx");
return true; return true;
case HB_OT_TAG_vmtx: case HB_OT_TAG_vmtx:
result = _subset2<const OT::vmtx> (plan); result = _subset<const OT::vmtx> (plan);
break; break;
case HB_OT_TAG_maxp: case HB_OT_TAG_maxp:
result = _subset2<const OT::maxp> (plan); result = _subset<const OT::maxp> (plan);
break; break;
case HB_OT_TAG_sbix: case HB_OT_TAG_sbix:
result = _subset2<const OT::sbix> (plan); result = _subset<const OT::sbix> (plan);
break; break;
case HB_OT_TAG_loca: case HB_OT_TAG_loca:
DEBUG_MSG(SUBSET, nullptr, "skip loca handled by glyf"); DEBUG_MSG(SUBSET, nullptr, "skip loca handled by glyf");
return true; return true;
case HB_OT_TAG_cmap: case HB_OT_TAG_cmap:
result = _subset2<const OT::cmap> (plan); result = _subset<const OT::cmap> (plan);
break; break;
case HB_OT_TAG_OS2: case HB_OT_TAG_OS2:
result = _subset2<const OT::OS2> (plan); result = _subset<const OT::OS2> (plan);
break; break;
case HB_OT_TAG_post: case HB_OT_TAG_post:
result = _subset2<const OT::post> (plan); result = _subset<const OT::post> (plan);
break; break;
case HB_OT_TAG_COLR: case HB_OT_TAG_COLR:
result = _subset2<const OT::COLR> (plan); result = _subset<const OT::COLR> (plan);
break; break;
#ifndef HB_NO_SUBSET_CFF #ifndef HB_NO_SUBSET_CFF
case HB_OT_TAG_cff1: case HB_OT_TAG_cff1:
result = _subset2<const OT::cff1> (plan); result = _subset<const OT::cff1> (plan);
break; break;
case HB_OT_TAG_cff2: case HB_OT_TAG_cff2:
result = _subset2<const OT::cff2> (plan); result = _subset<const OT::cff2> (plan);
break; break;
case HB_OT_TAG_VORG: case HB_OT_TAG_VORG:
result = _subset2<const OT::VORG> (plan); result = _subset<const OT::VORG> (plan);
break; break;
#endif #endif
#ifndef HB_NO_SUBSET_LAYOUT #ifndef HB_NO_SUBSET_LAYOUT
case HB_OT_TAG_GDEF: case HB_OT_TAG_GDEF:
result = _subset2<const OT::GDEF> (plan); result = _subset<const OT::GDEF> (plan);
break; break;
case HB_OT_TAG_GSUB: case HB_OT_TAG_GSUB:
result = _subset2<const OT::GSUB> (plan); result = _subset<const OT::GSUB> (plan);
break; break;
case HB_OT_TAG_GPOS: case HB_OT_TAG_GPOS:
result = _subset2<const OT::GPOS> (plan); result = _subset<const OT::GPOS> (plan);
break; break;
case HB_OT_TAG_gvar: case HB_OT_TAG_gvar:
result = _subset2<const OT::gvar> (plan); result = _subset<const OT::gvar> (plan);
break; break;
case HB_OT_TAG_HVAR: case HB_OT_TAG_HVAR:
result = _subset2<const OT::HVAR> (plan); result = _subset<const OT::HVAR> (plan);
break; break;
case HB_OT_TAG_VVAR: case HB_OT_TAG_VVAR:
result = _subset2<const OT::VVAR> (plan); result = _subset<const OT::VVAR> (plan);
break; break;
#endif #endif