Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/harfbuzz/hb-subset.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

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 do not 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_NO_BIDI_CLOSURE: If set do not pull mirrored versions of input
0079  * codepoints into the subset. Since: 11.1.0
0080  * @HB_SUBSET_FLAGS_IFTB_REQUIREMENTS: If set enforce requirements on the output subset
0081  * to allow it to be used with incremental font transfer IFTB patches. Primarily,
0082  * this forces all outline data to use long (32 bit) offsets. Since: EXPERIMENTAL
0083  *
0084  * List of boolean properties that can be configured on the subset input.
0085  *
0086  * Since: 2.9.0
0087  **/
0088 typedef enum { /*< flags >*/
0089   HB_SUBSET_FLAGS_DEFAULT =          0x00000000u,
0090   HB_SUBSET_FLAGS_NO_HINTING =           0x00000001u,
0091   HB_SUBSET_FLAGS_RETAIN_GIDS =          0x00000002u,
0092   HB_SUBSET_FLAGS_DESUBROUTINIZE =       0x00000004u,
0093   HB_SUBSET_FLAGS_NAME_LEGACY =          0x00000008u,
0094   HB_SUBSET_FLAGS_SET_OVERLAPS_FLAG =        0x00000010u,
0095   HB_SUBSET_FLAGS_PASSTHROUGH_UNRECOGNIZED = 0x00000020u,
0096   HB_SUBSET_FLAGS_NOTDEF_OUTLINE =       0x00000040u,
0097   HB_SUBSET_FLAGS_GLYPH_NAMES =          0x00000080u,
0098   HB_SUBSET_FLAGS_NO_PRUNE_UNICODE_RANGES =  0x00000100u,
0099   HB_SUBSET_FLAGS_NO_LAYOUT_CLOSURE =        0x00000200u,
0100   HB_SUBSET_FLAGS_OPTIMIZE_IUP_DELTAS     =  0x00000400u,
0101   HB_SUBSET_FLAGS_NO_BIDI_CLOSURE         =  0x00000800u,
0102 #ifdef HB_EXPERIMENTAL_API
0103   HB_SUBSET_FLAGS_IFTB_REQUIREMENTS       =  0x00001000u,
0104 #endif
0105 } hb_subset_flags_t;
0106 
0107 /**
0108  * hb_subset_sets_t:
0109  * @HB_SUBSET_SETS_GLYPH_INDEX: the set of glyph indexes to retain in the subset.
0110  * @HB_SUBSET_SETS_UNICODE: the set of unicode codepoints to retain in the subset.
0111  * @HB_SUBSET_SETS_NO_SUBSET_TABLE_TAG: the set of table tags which specifies tables that should not be
0112  * subsetted.
0113  * @HB_SUBSET_SETS_DROP_TABLE_TAG: the set of table tags which specifies tables which will be dropped
0114  * in the subset.
0115  * @HB_SUBSET_SETS_NAME_ID: the set of name ids that will be retained.
0116  * @HB_SUBSET_SETS_NAME_LANG_ID: the set of name lang ids that will be retained.
0117  * @HB_SUBSET_SETS_LAYOUT_FEATURE_TAG: the set of layout feature tags that will be retained
0118  * in the subset.
0119  * @HB_SUBSET_SETS_LAYOUT_SCRIPT_TAG: the set of layout script tags that will be retained
0120  * in the subset. Defaults to all tags. Since: 5.0.0
0121  *
0122  * List of sets that can be configured on the subset input.
0123  *
0124  * Since: 2.9.1
0125  **/
0126 typedef enum {
0127   HB_SUBSET_SETS_GLYPH_INDEX = 0,
0128   HB_SUBSET_SETS_UNICODE,
0129   HB_SUBSET_SETS_NO_SUBSET_TABLE_TAG,
0130   HB_SUBSET_SETS_DROP_TABLE_TAG,
0131   HB_SUBSET_SETS_NAME_ID,
0132   HB_SUBSET_SETS_NAME_LANG_ID,
0133   HB_SUBSET_SETS_LAYOUT_FEATURE_TAG,
0134   HB_SUBSET_SETS_LAYOUT_SCRIPT_TAG,
0135 } hb_subset_sets_t;
0136 
0137 HB_EXTERN hb_subset_input_t *
0138 hb_subset_input_create_or_fail (void);
0139 
0140 HB_EXTERN hb_subset_input_t *
0141 hb_subset_input_reference (hb_subset_input_t *input);
0142 
0143 HB_EXTERN void
0144 hb_subset_input_destroy (hb_subset_input_t *input);
0145 
0146 HB_EXTERN hb_bool_t
0147 hb_subset_input_set_user_data (hb_subset_input_t  *input,
0148                    hb_user_data_key_t *key,
0149                    void *          data,
0150                    hb_destroy_func_t   destroy,
0151                    hb_bool_t       replace);
0152 
0153 HB_EXTERN void *
0154 hb_subset_input_get_user_data (const hb_subset_input_t *input,
0155                    hb_user_data_key_t      *key);
0156 
0157 HB_EXTERN void
0158 hb_subset_input_keep_everything (hb_subset_input_t *input);
0159 
0160 HB_EXTERN hb_set_t *
0161 hb_subset_input_unicode_set (hb_subset_input_t *input);
0162 
0163 HB_EXTERN hb_set_t *
0164 hb_subset_input_glyph_set (hb_subset_input_t *input);
0165 
0166 HB_EXTERN hb_set_t *
0167 hb_subset_input_set (hb_subset_input_t *input, hb_subset_sets_t set_type);
0168 
0169 HB_EXTERN hb_map_t*
0170 hb_subset_input_old_to_new_glyph_mapping (hb_subset_input_t *input);
0171 
0172 HB_EXTERN hb_subset_flags_t
0173 hb_subset_input_get_flags (hb_subset_input_t *input);
0174 
0175 HB_EXTERN void
0176 hb_subset_input_set_flags (hb_subset_input_t *input,
0177                unsigned value);
0178 
0179 HB_EXTERN hb_bool_t
0180 hb_subset_input_pin_all_axes_to_default (hb_subset_input_t  *input,
0181                      hb_face_t          *face);
0182 
0183 HB_EXTERN hb_bool_t
0184 hb_subset_input_pin_axis_to_default (hb_subset_input_t  *input,
0185                      hb_face_t          *face,
0186                      hb_tag_t            axis_tag);
0187 
0188 HB_EXTERN hb_bool_t
0189 hb_subset_input_pin_axis_location (hb_subset_input_t  *input,
0190                    hb_face_t          *face,
0191                    hb_tag_t            axis_tag,
0192                    float               axis_value);
0193 
0194 HB_EXTERN hb_bool_t
0195 hb_subset_input_get_axis_range (hb_subset_input_t  *input,
0196                 hb_tag_t            axis_tag,
0197                 float              *axis_min_value,
0198                 float              *axis_max_value,
0199                 float              *axis_def_value);
0200 
0201 HB_EXTERN hb_bool_t
0202 hb_subset_input_set_axis_range (hb_subset_input_t  *input,
0203                 hb_face_t          *face,
0204                 hb_tag_t            axis_tag,
0205                 float               axis_min_value,
0206                 float               axis_max_value,
0207                 float               axis_def_value);
0208 
0209 HB_EXTERN hb_bool_t
0210 hb_subset_axis_range_from_string (const char *str, int len,
0211                   float *axis_min_value,
0212                   float *axis_max_value,
0213                   float *axis_def_value);
0214 
0215 HB_EXTERN void
0216 hb_subset_axis_range_to_string (hb_subset_input_t *input,
0217                 hb_tag_t axis_tag,
0218                 char *buf,
0219                 unsigned size);
0220 
0221 #ifdef HB_EXPERIMENTAL_API
0222 HB_EXTERN hb_bool_t
0223 hb_subset_input_override_name_table (hb_subset_input_t  *input,
0224                      hb_ot_name_id_t     name_id,
0225                      unsigned            platform_id,
0226                      unsigned            encoding_id,
0227                      unsigned            language_id,
0228                      const char         *name_str,
0229                      int                 str_len);
0230 
0231 
0232 /*
0233 * Raw outline data access
0234 */
0235 
0236 HB_EXTERN hb_blob_t*
0237 hb_subset_cff_get_charstring_data (hb_face_t* face, hb_codepoint_t glyph_index);
0238 
0239 HB_EXTERN hb_blob_t*
0240 hb_subset_cff_get_charstrings_index (hb_face_t* face);
0241 
0242 HB_EXTERN hb_blob_t*
0243 hb_subset_cff2_get_charstring_data (hb_face_t* face, hb_codepoint_t glyph_index);
0244 
0245 HB_EXTERN hb_blob_t*
0246 hb_subset_cff2_get_charstrings_index (hb_face_t* face);
0247 #endif
0248 
0249 HB_EXTERN hb_face_t *
0250 hb_subset_preprocess (hb_face_t *source);
0251 
0252 HB_EXTERN hb_face_t *
0253 hb_subset_or_fail (hb_face_t *source, const hb_subset_input_t *input);
0254 
0255 HB_EXTERN hb_face_t *
0256 hb_subset_plan_execute_or_fail (hb_subset_plan_t *plan);
0257 
0258 HB_EXTERN hb_subset_plan_t *
0259 hb_subset_plan_create_or_fail (hb_face_t                 *face,
0260                                const hb_subset_input_t   *input);
0261 
0262 HB_EXTERN void
0263 hb_subset_plan_destroy (hb_subset_plan_t *plan);
0264 
0265 HB_EXTERN hb_map_t *
0266 hb_subset_plan_old_to_new_glyph_mapping (const hb_subset_plan_t *plan);
0267 
0268 HB_EXTERN hb_map_t *
0269 hb_subset_plan_new_to_old_glyph_mapping (const hb_subset_plan_t *plan);
0270 
0271 HB_EXTERN hb_map_t *
0272 hb_subset_plan_unicode_to_old_glyph_mapping (const hb_subset_plan_t *plan);
0273 
0274 
0275 HB_EXTERN hb_subset_plan_t *
0276 hb_subset_plan_reference (hb_subset_plan_t *plan);
0277 
0278 HB_EXTERN hb_bool_t
0279 hb_subset_plan_set_user_data (hb_subset_plan_t   *plan,
0280                               hb_user_data_key_t *key,
0281                               void               *data,
0282                               hb_destroy_func_t   destroy,
0283                               hb_bool_t           replace);
0284 
0285 HB_EXTERN void *
0286 hb_subset_plan_get_user_data (const hb_subset_plan_t *plan,
0287                               hb_user_data_key_t     *key);
0288 
0289 
0290 HB_END_DECLS
0291 
0292 #endif /* HB_SUBSET_H */