Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-21 10:04:02

0001 /*
0002  * Copyright © 2018  Google, Inc.
0003  *
0004  *  This is part of HarfBuzz, a text shaping library.
0005  *
0006  * Permission is hereby granted, without written agreement and without
0007  * license or royalty fees, to use, copy, modify, and distribute this
0008  * software and its documentation for any purpose, provided that the
0009  * above copyright notice and the following two paragraphs appear in
0010  * all copies of this software.
0011  *
0012  * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
0013  * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
0014  * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
0015  * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
0016  * DAMAGE.
0017  *
0018  * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
0019  * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
0020  * FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
0021  * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
0022  * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
0023  *
0024  * Google Author(s): Rod Sheeter
0025  */
0026 
0027 #ifndef HB_SUBSET_H
0028 #define HB_SUBSET_H
0029 
0030 #include "hb.h"
0031 #include "hb-ot.h"
0032 
0033 HB_BEGIN_DECLS
0034 
0035 /**
0036  * hb_subset_input_t:
0037  *
0038  * Things that change based on the input. Characters to keep, etc.
0039  */
0040 
0041 typedef struct hb_subset_input_t hb_subset_input_t;
0042 
0043 /**
0044  * hb_subset_plan_t:
0045  *
0046  * Contains information about how the subset operation will be executed.
0047  * Such as mappings from the old glyph ids to the new ones in the subset.
0048  */
0049 
0050 typedef struct hb_subset_plan_t hb_subset_plan_t;
0051 
0052 /**
0053  * hb_subset_flags_t:
0054  * @HB_SUBSET_FLAGS_DEFAULT: all flags at their default value of false.
0055  * @HB_SUBSET_FLAGS_NO_HINTING: If set hinting instructions will be dropped in
0056  * the produced subset. Otherwise hinting instructions will be retained.
0057  * @HB_SUBSET_FLAGS_RETAIN_GIDS: If set glyph indices will not be modified in
0058  * the produced subset. If glyphs are dropped their indices will be retained
0059  * as an empty glyph.
0060  * @HB_SUBSET_FLAGS_DESUBROUTINIZE: If set and subsetting a CFF font the
0061  * subsetter will attempt to remove subroutines from the CFF glyphs.
0062  * @HB_SUBSET_FLAGS_NAME_LEGACY: If set non-unicode name records will be
0063  * retained in the subset.
0064  * @HB_SUBSET_FLAGS_SET_OVERLAPS_FLAG:  If set the subsetter will set the
0065  * OVERLAP_SIMPLE flag on each simple glyph.
0066  * @HB_SUBSET_FLAGS_PASSTHROUGH_UNRECOGNIZED: If set the subsetter will not
0067  * drop unrecognized tables and instead pass them through untouched.
0068  * @HB_SUBSET_FLAGS_NOTDEF_OUTLINE: If set the notdef glyph outline will be
0069  * retained in the final subset.
0070  * @HB_SUBSET_FLAGS_GLYPH_NAMES: If set the PS glyph names will be retained
0071  * in the final subset.
0072  * @HB_SUBSET_FLAGS_NO_PRUNE_UNICODE_RANGES: If set then the unicode ranges in
0073  * OS/2 will not be recalculated.
0074  * @HB_SUBSET_FLAGS_NO_LAYOUT_CLOSURE: If set don't perform glyph closure on layout
0075  * substitution rules (GSUB). Since: 7.2.0.
0076  * @HB_SUBSET_FLAGS_OPTIMIZE_IUP_DELTAS: If set perform IUP delta optimization on the
0077  * remaining gvar table's deltas. Since: 8.5.0
0078  * @HB_SUBSET_FLAGS_IFTB_REQUIREMENTS: If set enforce requirements on the output subset
0079  * to allow it to be used with incremental font transfer IFTB patches. Primarily,
0080  * this forces all outline data to use long (32 bit) offsets. Since: EXPERIMENTAL
0081  *
0082  * List of boolean properties that can be configured on the subset input.
0083  *
0084  * Since: 2.9.0
0085  **/
0086 typedef enum { /*< flags >*/
0087   HB_SUBSET_FLAGS_DEFAULT =          0x00000000u,
0088   HB_SUBSET_FLAGS_NO_HINTING =           0x00000001u,
0089   HB_SUBSET_FLAGS_RETAIN_GIDS =          0x00000002u,
0090   HB_SUBSET_FLAGS_DESUBROUTINIZE =       0x00000004u,
0091   HB_SUBSET_FLAGS_NAME_LEGACY =          0x00000008u,
0092   HB_SUBSET_FLAGS_SET_OVERLAPS_FLAG =        0x00000010u,
0093   HB_SUBSET_FLAGS_PASSTHROUGH_UNRECOGNIZED = 0x00000020u,
0094   HB_SUBSET_FLAGS_NOTDEF_OUTLINE =       0x00000040u,
0095   HB_SUBSET_FLAGS_GLYPH_NAMES =          0x00000080u,
0096   HB_SUBSET_FLAGS_NO_PRUNE_UNICODE_RANGES =  0x00000100u,
0097   HB_SUBSET_FLAGS_NO_LAYOUT_CLOSURE =        0x00000200u,
0098   HB_SUBSET_FLAGS_OPTIMIZE_IUP_DELTAS     =  0x00000400u,
0099 #ifdef HB_EXPERIMENTAL_API
0100   HB_SUBSET_FLAGS_IFTB_REQUIREMENTS       =  0x00000800u,
0101 #endif
0102 } hb_subset_flags_t;
0103 
0104 /**
0105  * hb_subset_sets_t:
0106  * @HB_SUBSET_SETS_GLYPH_INDEX: the set of glyph indexes to retain in the subset.
0107  * @HB_SUBSET_SETS_UNICODE: the set of unicode codepoints to retain in the subset.
0108  * @HB_SUBSET_SETS_NO_SUBSET_TABLE_TAG: the set of table tags which specifies tables that should not be
0109  * subsetted.
0110  * @HB_SUBSET_SETS_DROP_TABLE_TAG: the set of table tags which specifies tables which will be dropped
0111  * in the subset.
0112  * @HB_SUBSET_SETS_NAME_ID: the set of name ids that will be retained.
0113  * @HB_SUBSET_SETS_NAME_LANG_ID: the set of name lang ids that will be retained.
0114  * @HB_SUBSET_SETS_LAYOUT_FEATURE_TAG: the set of layout feature tags that will be retained
0115  * in the subset.
0116  * @HB_SUBSET_SETS_LAYOUT_SCRIPT_TAG: the set of layout script tags that will be retained
0117  * in the subset. Defaults to all tags. Since: 5.0.0
0118  *
0119  * List of sets that can be configured on the subset input.
0120  *
0121  * Since: 2.9.1
0122  **/
0123 typedef enum {
0124   HB_SUBSET_SETS_GLYPH_INDEX = 0,
0125   HB_SUBSET_SETS_UNICODE,
0126   HB_SUBSET_SETS_NO_SUBSET_TABLE_TAG,
0127   HB_SUBSET_SETS_DROP_TABLE_TAG,
0128   HB_SUBSET_SETS_NAME_ID,
0129   HB_SUBSET_SETS_NAME_LANG_ID,
0130   HB_SUBSET_SETS_LAYOUT_FEATURE_TAG,
0131   HB_SUBSET_SETS_LAYOUT_SCRIPT_TAG,
0132 } hb_subset_sets_t;
0133 
0134 HB_EXTERN hb_subset_input_t *
0135 hb_subset_input_create_or_fail (void);
0136 
0137 HB_EXTERN hb_subset_input_t *
0138 hb_subset_input_reference (hb_subset_input_t *input);
0139 
0140 HB_EXTERN void
0141 hb_subset_input_destroy (hb_subset_input_t *input);
0142 
0143 HB_EXTERN hb_bool_t
0144 hb_subset_input_set_user_data (hb_subset_input_t  *input,
0145                    hb_user_data_key_t *key,
0146                    void *          data,
0147                    hb_destroy_func_t   destroy,
0148                    hb_bool_t       replace);
0149 
0150 HB_EXTERN void *
0151 hb_subset_input_get_user_data (const hb_subset_input_t *input,
0152                    hb_user_data_key_t      *key);
0153 
0154 HB_EXTERN void
0155 hb_subset_input_keep_everything (hb_subset_input_t *input);
0156 
0157 HB_EXTERN hb_set_t *
0158 hb_subset_input_unicode_set (hb_subset_input_t *input);
0159 
0160 HB_EXTERN hb_set_t *
0161 hb_subset_input_glyph_set (hb_subset_input_t *input);
0162 
0163 HB_EXTERN hb_set_t *
0164 hb_subset_input_set (hb_subset_input_t *input, hb_subset_sets_t set_type);
0165 
0166 HB_EXTERN hb_map_t*
0167 hb_subset_input_old_to_new_glyph_mapping (hb_subset_input_t *input);
0168 
0169 HB_EXTERN hb_subset_flags_t
0170 hb_subset_input_get_flags (hb_subset_input_t *input);
0171 
0172 HB_EXTERN void
0173 hb_subset_input_set_flags (hb_subset_input_t *input,
0174                unsigned value);
0175 
0176 HB_EXTERN hb_bool_t
0177 hb_subset_input_pin_all_axes_to_default (hb_subset_input_t  *input,
0178                      hb_face_t          *face);
0179 
0180 HB_EXTERN hb_bool_t
0181 hb_subset_input_pin_axis_to_default (hb_subset_input_t  *input,
0182                      hb_face_t          *face,
0183                      hb_tag_t            axis_tag);
0184 
0185 HB_EXTERN hb_bool_t
0186 hb_subset_input_pin_axis_location (hb_subset_input_t  *input,
0187                    hb_face_t          *face,
0188                    hb_tag_t            axis_tag,
0189                    float               axis_value);
0190 
0191 HB_EXTERN hb_bool_t
0192 hb_subset_input_get_axis_range (hb_subset_input_t  *input,
0193                 hb_tag_t            axis_tag,
0194                 float              *axis_min_value,
0195                 float              *axis_max_value,
0196                 float              *axis_def_value);
0197 
0198 HB_EXTERN hb_bool_t
0199 hb_subset_input_set_axis_range (hb_subset_input_t  *input,
0200                 hb_face_t          *face,
0201                 hb_tag_t            axis_tag,
0202                 float               axis_min_value,
0203                 float               axis_max_value,
0204                 float               axis_def_value);
0205 
0206 #ifdef HB_EXPERIMENTAL_API
0207 HB_EXTERN hb_bool_t
0208 hb_subset_input_override_name_table (hb_subset_input_t  *input,
0209                      hb_ot_name_id_t     name_id,
0210                      unsigned            platform_id,
0211                      unsigned            encoding_id,
0212                      unsigned            language_id,
0213                      const char         *name_str,
0214                      int                 str_len);
0215 #endif
0216 
0217 HB_EXTERN hb_face_t *
0218 hb_subset_preprocess (hb_face_t *source);
0219 
0220 HB_EXTERN hb_face_t *
0221 hb_subset_or_fail (hb_face_t *source, const hb_subset_input_t *input);
0222 
0223 HB_EXTERN hb_face_t *
0224 hb_subset_plan_execute_or_fail (hb_subset_plan_t *plan);
0225 
0226 HB_EXTERN hb_subset_plan_t *
0227 hb_subset_plan_create_or_fail (hb_face_t                 *face,
0228                                const hb_subset_input_t   *input);
0229 
0230 HB_EXTERN void
0231 hb_subset_plan_destroy (hb_subset_plan_t *plan);
0232 
0233 HB_EXTERN hb_map_t *
0234 hb_subset_plan_old_to_new_glyph_mapping (const hb_subset_plan_t *plan);
0235 
0236 HB_EXTERN hb_map_t *
0237 hb_subset_plan_new_to_old_glyph_mapping (const hb_subset_plan_t *plan);
0238 
0239 HB_EXTERN hb_map_t *
0240 hb_subset_plan_unicode_to_old_glyph_mapping (const hb_subset_plan_t *plan);
0241 
0242 
0243 HB_EXTERN hb_subset_plan_t *
0244 hb_subset_plan_reference (hb_subset_plan_t *plan);
0245 
0246 HB_EXTERN hb_bool_t
0247 hb_subset_plan_set_user_data (hb_subset_plan_t   *plan,
0248                               hb_user_data_key_t *key,
0249                               void               *data,
0250                               hb_destroy_func_t   destroy,
0251                               hb_bool_t           replace);
0252 
0253 HB_EXTERN void *
0254 hb_subset_plan_get_user_data (const hb_subset_plan_t *plan,
0255                               hb_user_data_key_t     *key);
0256 
0257 
0258 HB_END_DECLS
0259 
0260 #endif /* HB_SUBSET_H */