/* * Copyright © 2017 Google, Inc. * Copyright © 2018 Ebrahim Byagowi * * This is part of HarfBuzz, a text shaping library. * * Permission is hereby granted, without written agreement and without * license or royalty fees, to use, copy, modify, and distribute this * software and its documentation for any purpose, provided that the * above copyright notice and the following two paragraphs appear in * all copies of this software. * * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH * DAMAGE. * * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. * * Google Author(s): Behdad Esfahbod */ #include "hb.hh" #include "hb-aat-layout.hh" #include "hb-aat-layout-ankr-table.hh" #include "hb-aat-layout-bsln-table.hh" // Just so we compile it; unused otherwise. #include "hb-aat-layout-feat-table.hh" #include "hb-aat-layout-just-table.hh" // Just so we compile it; unused otherwise. #include "hb-aat-layout-kerx-table.hh" #include "hb-aat-layout-morx-table.hh" #include "hb-aat-layout-trak-table.hh" #include "hb-aat-ltag-table.hh" /* * hb_aat_apply_context_t */ /* Note: This context is used for kerning, even without AAT, hence the condition. */ #if !defined(HB_NO_AAT) || !defined(HB_NO_OT_KERN) AAT::hb_aat_apply_context_t::hb_aat_apply_context_t (const hb_ot_shape_plan_t *plan_, hb_font_t *font_, hb_buffer_t *buffer_, hb_blob_t *blob) : … { … } AAT::hb_aat_apply_context_t::~hb_aat_apply_context_t () { … } void AAT::hb_aat_apply_context_t::set_ankr_table (const AAT::ankr *ankr_table_) { … } #endif /** * SECTION:hb-aat-layout * @title: hb-aat-layout * @short_description: Apple Advanced Typography Layout * @include: hb-aat.h * * Functions for querying AAT Layout features in the font face. * * HarfBuzz supports all of the AAT tables used to implement shaping. Other * AAT tables and their associated features are not supported. **/ #if !defined(HB_NO_AAT) || defined(HAVE_CORETEXT) /* Mapping from OpenType feature tags to AAT feature names and selectors. * * Table data courtesy of Apple. Converted from mnemonics to integers * when moving to this file. */ static const hb_aat_feature_mapping_t feature_mappings[] = …; /** * hb_aat_layout_find_feature_mapping: * @tag: The requested #hb_tag_t feature tag * * Fetches the AAT feature-and-selector combination that corresponds * to a given OpenType feature tag. * * Return value: the AAT features and selectors corresponding to the * OpenType feature tag queried * **/ const hb_aat_feature_mapping_t * hb_aat_layout_find_feature_mapping (hb_tag_t tag) { … } #endif #ifndef HB_NO_AAT /* * mort/morx/kerx/trak */ void hb_aat_layout_compile_map (const hb_aat_map_builder_t *mapper, hb_aat_map_t *map) { … } /** * hb_aat_layout_has_substitution: * @face: #hb_face_t to work upon * * Tests whether the specified face includes any substitutions in the * `morx` or `mort` tables. * * <note>Note: does not examine the `GSUB` table.</note> * * Return value: `true` if data found, `false` otherwise * * Since: 2.3.0 */ hb_bool_t hb_aat_layout_has_substitution (hb_face_t *face) { … } void hb_aat_layout_substitute (const hb_ot_shape_plan_t *plan, hb_font_t *font, hb_buffer_t *buffer, const hb_feature_t *features, unsigned num_features) { … } void hb_aat_layout_zero_width_deleted_glyphs (hb_buffer_t *buffer) { … } static bool is_deleted_glyph (const hb_glyph_info_t *info) { … } void hb_aat_layout_remove_deleted_glyphs (hb_buffer_t *buffer) { … } /** * hb_aat_layout_has_positioning: * @face: #hb_face_t to work upon * * Tests whether the specified face includes any positioning information * in the `kerx` table. * * <note>Note: does not examine the `GPOS` table.</note> * * Return value: `true` if data found, `false` otherwise * * Since: 2.3.0 */ hb_bool_t hb_aat_layout_has_positioning (hb_face_t *face) { … } void hb_aat_layout_position (const hb_ot_shape_plan_t *plan, hb_font_t *font, hb_buffer_t *buffer) { … } /** * hb_aat_layout_has_tracking: * @face:: #hb_face_t to work upon * * Tests whether the specified face includes any tracking information * in the `trak` table. * * Return value: `true` if data found, `false` otherwise * * Since: 2.3.0 */ hb_bool_t hb_aat_layout_has_tracking (hb_face_t *face) { … } void hb_aat_layout_track (const hb_ot_shape_plan_t *plan, hb_font_t *font, hb_buffer_t *buffer) { … } /** * hb_aat_layout_get_feature_types: * @face: #hb_face_t to work upon * @start_offset: offset of the first feature type to retrieve * @feature_count: (inout) (optional): Input = the maximum number of feature types to return; * Output = the actual number of feature types returned (may be zero) * @features: (out caller-allocates) (array length=feature_count): Array of feature types found * * Fetches a list of the AAT feature types included in the specified face. * * Return value: Number of all available feature types. * * Since: 2.2.0 */ unsigned int hb_aat_layout_get_feature_types (hb_face_t *face, unsigned int start_offset, unsigned int *feature_count, /* IN/OUT. May be NULL. */ hb_aat_layout_feature_type_t *features /* OUT. May be NULL. */) { … } /** * hb_aat_layout_feature_type_get_name_id: * @face: #hb_face_t to work upon * @feature_type: The #hb_aat_layout_feature_type_t of the requested feature type * * Fetches the name identifier of the specified feature type in the face's `name` table. * * Return value: Name identifier of the requested feature type * * Since: 2.2.0 */ hb_ot_name_id_t hb_aat_layout_feature_type_get_name_id (hb_face_t *face, hb_aat_layout_feature_type_t feature_type) { … } /** * hb_aat_layout_feature_type_get_selector_infos: * @face: #hb_face_t to work upon * @feature_type: The #hb_aat_layout_feature_type_t of the requested feature type * @start_offset: offset of the first feature type to retrieve * @selector_count: (inout) (optional): Input = the maximum number of selectors to return; * Output = the actual number of selectors returned (may be zero) * @selectors: (out caller-allocates) (array length=selector_count) (optional): * A buffer pointer. The selectors available for the feature type queries. * @default_index: (out) (optional): The index of the feature's default selector, if any * * Fetches a list of the selectors available for the specified feature in the given face. * * If upon return, @default_index is set to #HB_AAT_LAYOUT_NO_SELECTOR_INDEX, then * the feature type is non-exclusive. Otherwise, @default_index is the index of * the selector that is selected by default. * * Return value: Number of all available feature selectors * * Since: 2.2.0 */ unsigned int hb_aat_layout_feature_type_get_selector_infos (hb_face_t *face, hb_aat_layout_feature_type_t feature_type, unsigned int start_offset, unsigned int *selector_count, /* IN/OUT. May be NULL. */ hb_aat_layout_feature_selector_info_t *selectors, /* OUT. May be NULL. */ unsigned int *default_index /* OUT. May be NULL. */) { … } #endif