[subset] drop hint tables if so flagged. Still need to dump glyf instructions.
This commit is contained in:
parent
0bd100e144
commit
74e0c13a4a
|
@ -191,6 +191,7 @@ hb_subset_plan_create (hb_face_t *face,
|
||||||
plan->gids_to_retain_sorted.init();
|
plan->gids_to_retain_sorted.init();
|
||||||
plan->source = hb_face_reference (face);
|
plan->source = hb_face_reference (face);
|
||||||
plan->dest = hb_subset_face_create ();
|
plan->dest = hb_subset_face_create ();
|
||||||
|
plan->drop_hints = input->drop_hints;
|
||||||
|
|
||||||
_populate_codepoints (input->unicodes, plan->codepoints);
|
_populate_codepoints (input->unicodes, plan->codepoints);
|
||||||
_populate_gids_to_retain (face,
|
_populate_gids_to_retain (face,
|
||||||
|
|
|
@ -37,6 +37,8 @@ struct hb_subset_plan_t {
|
||||||
hb_object_header_t header;
|
hb_object_header_t header;
|
||||||
ASSERT_POD ();
|
ASSERT_POD ();
|
||||||
|
|
||||||
|
hb_bool_t drop_hints;
|
||||||
|
|
||||||
// TODO(Q1) actual map, drop this crap
|
// TODO(Q1) actual map, drop this crap
|
||||||
// Look at me ma, I'm a poor mans map codepoint : new gid
|
// Look at me ma, I'm a poor mans map codepoint : new gid
|
||||||
// codepoints is sorted and aligned with gids_to_retain.
|
// codepoints is sorted and aligned with gids_to_retain.
|
||||||
|
|
|
@ -43,7 +43,7 @@ struct hb_subset_input_t {
|
||||||
hb_set_t *unicodes;
|
hb_set_t *unicodes;
|
||||||
hb_set_t *glyphs;
|
hb_set_t *glyphs;
|
||||||
|
|
||||||
hb_bool_t retain_hints;
|
hb_bool_t drop_hints;
|
||||||
/* TODO
|
/* TODO
|
||||||
*
|
*
|
||||||
* features
|
* features
|
||||||
|
|
|
@ -268,9 +268,16 @@ _subset_table (hb_subset_plan_t *plan,
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
_should_drop_table(hb_tag_t tag)
|
_should_drop_table(hb_subset_plan_t *plan, hb_tag_t tag)
|
||||||
{
|
{
|
||||||
switch (tag) {
|
switch (tag) {
|
||||||
|
case HB_TAG ('c', 'v', 'a', 'r'): /* hint table, fallthrough */
|
||||||
|
case HB_TAG ('c', 'v', 't', ' '): /* hint table, fallthrough */
|
||||||
|
case HB_TAG ('f', 'p', 'g', 'm'): /* hint table, fallthrough */
|
||||||
|
case HB_TAG ('p', 'r', 'e', 'p'): /* hint table, fallthrough */
|
||||||
|
case HB_TAG ('h', 'd', 'm', 'x'): /* hint table, fallthrough */
|
||||||
|
case HB_TAG ('V', 'D', 'M', 'X'): /* hint table, fallthrough */
|
||||||
|
return plan->drop_hints;
|
||||||
case HB_TAG ('G', 'D', 'E', 'F'): /* temporary */
|
case HB_TAG ('G', 'D', 'E', 'F'): /* temporary */
|
||||||
case HB_TAG ('G', 'P', 'O', 'S'): /* temporary */
|
case HB_TAG ('G', 'P', 'O', 'S'): /* temporary */
|
||||||
case HB_TAG ('G', 'S', 'U', 'B'): /* temporary */
|
case HB_TAG ('G', 'S', 'U', 'B'): /* temporary */
|
||||||
|
@ -307,7 +314,7 @@ hb_subset (hb_face_t *source,
|
||||||
for (unsigned int i = 0; i < count; i++)
|
for (unsigned int i = 0; i < count; i++)
|
||||||
{
|
{
|
||||||
hb_tag_t tag = table_tags[i];
|
hb_tag_t tag = table_tags[i];
|
||||||
if (_should_drop_table(tag))
|
if (_should_drop_table(plan, tag))
|
||||||
{
|
{
|
||||||
DEBUG_MSG(SUBSET, nullptr, "drop %c%c%c%c", HB_UNTAG(tag));
|
DEBUG_MSG(SUBSET, nullptr, "drop %c%c%c%c", HB_UNTAG(tag));
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -90,7 +90,7 @@ struct subset_consumer_t
|
||||||
|
|
||||||
void finish (const font_options_t *font_opts)
|
void finish (const font_options_t *font_opts)
|
||||||
{
|
{
|
||||||
input->retain_hints = subset_options.hinting;
|
input->drop_hints = subset_options.drop_hints;
|
||||||
|
|
||||||
hb_subset_profile_t *subset_profile = hb_subset_profile_create();
|
hb_subset_profile_t *subset_profile = hb_subset_profile_create();
|
||||||
hb_face_t *face = hb_font_get_face (font);
|
hb_face_t *face = hb_font_get_face (font);
|
||||||
|
|
|
@ -992,7 +992,7 @@ subset_options_t::add_options (option_parser_t *parser)
|
||||||
{
|
{
|
||||||
GOptionEntry entries[] =
|
GOptionEntry entries[] =
|
||||||
{
|
{
|
||||||
{"hinting", 0, 0, G_OPTION_ARG_NONE, &this->hinting, "Whether to retain or drop hints", nullptr},
|
{"no-hinting", 0, 0, G_OPTION_ARG_NONE, &this->drop_hints, "Whether to drop hints", nullptr},
|
||||||
{nullptr}
|
{nullptr}
|
||||||
};
|
};
|
||||||
parser->add_group (entries,
|
parser->add_group (entries,
|
||||||
|
|
|
@ -653,14 +653,14 @@ struct subset_options_t : option_group_t
|
||||||
{
|
{
|
||||||
subset_options_t (option_parser_t *parser)
|
subset_options_t (option_parser_t *parser)
|
||||||
{
|
{
|
||||||
hinting = true;
|
drop_hints = false;
|
||||||
|
|
||||||
add_options (parser);
|
add_options (parser);
|
||||||
}
|
}
|
||||||
|
|
||||||
void add_options (option_parser_t *parser);
|
void add_options (option_parser_t *parser);
|
||||||
|
|
||||||
hb_bool_t hinting;
|
hb_bool_t drop_hints;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* fallback implementation for scalbn()/scalbnf() for pre-2013 MSVC */
|
/* fallback implementation for scalbn()/scalbnf() for pre-2013 MSVC */
|
||||||
|
|
Loading…
Reference in New Issue