[subset] add implementation for get/set flag on subset input.

This commit is contained in:
Garret Rieger 2021-06-09 12:54:14 -07:00
parent 83727837ef
commit 38de3491a0
2 changed files with 67 additions and 29 deletions

View File

@ -278,18 +278,53 @@ hb_subset_input_drop_tables_set (hb_subset_input_t *subset_input)
HB_EXTERN hb_bool_t
hb_subset_input_get_bool (hb_subset_property_t property)
hb_subset_input_get_flag (hb_subset_input_t *input,
hb_subset_flag_t flag)
{
// TODO(garretrieger): implement.
switch (flag)
{
case HB_SUBSET_FLAG_HINTING:
return !input->drop_hints;
case HB_SUBSET_FLAG_RETAIN_GIDS:
return input->retain_gids;
case HB_SUBSET_FLAG_DESUBROUTINIZE:
return input->desubroutinize;
case HB_SUBSET_FLAG_NAME_LEGACY:
return input->name_legacy;
case HB_SUBSET_FLAG_SET_OVERLAPS_FLAG:
return input->overlaps_flag;
default:
return false;
}
}
HB_EXTERN void
hb_subset_input_set_bool (hb_subset_property_t property, hb_bool_t value)
hb_subset_input_set_flag (hb_subset_input_t *input,
hb_subset_flag_t flag,
hb_bool_t value)
{
// TODO(garretrieger): implement.
switch (flag)
{
case HB_SUBSET_FLAG_HINTING:
input->drop_hints = !value;
break;
case HB_SUBSET_FLAG_RETAIN_GIDS:
input->retain_gids = value;
break;
case HB_SUBSET_FLAG_DESUBROUTINIZE:
input->desubroutinize = value;
break;
case HB_SUBSET_FLAG_NAME_LEGACY:
input->name_legacy = value;
break;
case HB_SUBSET_FLAG_SET_OVERLAPS_FLAG:
input->overlaps_flag = value;
break;
default:
// Do nothing.
break;
}
}
HB_EXTERN void
hb_subset_input_set_drop_hints (hb_subset_input_t *subset_input,

View File

@ -39,14 +39,14 @@ HB_BEGIN_DECLS
typedef struct hb_subset_input_t hb_subset_input_t;
enum hb_subset_property_t
typedef enum
{
HB_SUBSET_PROPERTY_HINTING = 1,
HB_SUBSET_PROPERTY_RETAIN_GIDS = 2,
HB_SUBSET_PROPERTY_DESUBROUTINIZE = 3,
HB_SUBSET_PROPERTY_NAME_LEGACY = 4,
HB_SUBSET_PROPERTY_SET_OVERLAPS_FLAG = 5,
};
HB_SUBSET_FLAG_HINTING = 1,
HB_SUBSET_FLAG_RETAIN_GIDS = 2,
HB_SUBSET_FLAG_DESUBROUTINIZE = 3,
HB_SUBSET_FLAG_NAME_LEGACY = 4,
HB_SUBSET_FLAG_SET_OVERLAPS_FLAG = 5,
} hb_subset_flag_t;
HB_EXTERN hb_subset_input_t *
hb_subset_input_create_or_fail (void);
@ -83,10 +83,13 @@ hb_subset_input_drop_tables_set (hb_subset_input_t *subset_input);
HB_EXTERN hb_bool_t
hb_subset_input_get_bool (hb_subset_property_t property);
hb_subset_input_get_flag (hb_subset_input_t *input,
hb_subset_flag_t flag);
HB_EXTERN void
hb_subset_input_set_bool (hb_subset_property_t property, hb_bool_t value);
hb_subset_input_set_flag (hb_subset_input_t *input,
hb_subset_flag_t flag,
hb_bool_t value);
// TODO(garretrieger): remove bool property get/set methods.