michael@0: /* michael@0: * Copyright © 2009 Red Hat, Inc. michael@0: * Copyright © 2011 Google, Inc. michael@0: * michael@0: * This is part of HarfBuzz, a text shaping library. michael@0: * michael@0: * Permission is hereby granted, without written agreement and without michael@0: * license or royalty fees, to use, copy, modify, and distribute this michael@0: * software and its documentation for any purpose, provided that the michael@0: * above copyright notice and the following two paragraphs appear in michael@0: * all copies of this software. michael@0: * michael@0: * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR michael@0: * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES michael@0: * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN michael@0: * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH michael@0: * DAMAGE. michael@0: * michael@0: * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, michael@0: * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND michael@0: * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS michael@0: * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO michael@0: * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. michael@0: * michael@0: * Red Hat Author(s): Behdad Esfahbod michael@0: * Google Author(s): Behdad Esfahbod michael@0: */ michael@0: michael@0: #ifndef HB_FACE_PRIVATE_HH michael@0: #define HB_FACE_PRIVATE_HH michael@0: michael@0: #include "hb-private.hh" michael@0: michael@0: #include "hb-object-private.hh" michael@0: #include "hb-shaper-private.hh" michael@0: #include "hb-shape-plan-private.hh" michael@0: michael@0: michael@0: /* michael@0: * hb_face_t michael@0: */ michael@0: michael@0: struct hb_face_t { michael@0: hb_object_header_t header; michael@0: ASSERT_POD (); michael@0: michael@0: hb_bool_t immutable; michael@0: michael@0: hb_reference_table_func_t reference_table_func; michael@0: void *user_data; michael@0: hb_destroy_func_t destroy; michael@0: michael@0: unsigned int index; michael@0: mutable unsigned int upem; michael@0: mutable unsigned int num_glyphs; michael@0: michael@0: struct hb_shaper_data_t shaper_data; michael@0: michael@0: struct plan_node_t { michael@0: hb_shape_plan_t *shape_plan; michael@0: plan_node_t *next; michael@0: } *shape_plans; michael@0: michael@0: michael@0: inline hb_blob_t *reference_table (hb_tag_t tag) const michael@0: { michael@0: hb_blob_t *blob; michael@0: michael@0: if (unlikely (!this || !reference_table_func)) michael@0: return hb_blob_get_empty (); michael@0: michael@0: blob = reference_table_func (/*XXX*/const_cast (this), tag, user_data); michael@0: if (unlikely (!blob)) michael@0: return hb_blob_get_empty (); michael@0: michael@0: return blob; michael@0: } michael@0: michael@0: inline HB_PURE_FUNC unsigned int get_upem (void) const michael@0: { michael@0: if (unlikely (!upem)) michael@0: load_upem (); michael@0: return upem; michael@0: } michael@0: michael@0: inline unsigned int get_num_glyphs (void) const michael@0: { michael@0: if (unlikely (num_glyphs == (unsigned int) -1)) michael@0: load_num_glyphs (); michael@0: return num_glyphs; michael@0: } michael@0: michael@0: private: michael@0: HB_INTERNAL void load_upem (void) const; michael@0: HB_INTERNAL void load_num_glyphs (void) const; michael@0: }; michael@0: michael@0: extern HB_INTERNAL const hb_face_t _hb_face_nil; michael@0: michael@0: #define HB_SHAPER_DATA_CREATE_FUNC_EXTRA_ARGS michael@0: #define HB_SHAPER_IMPLEMENT(shaper) HB_SHAPER_DATA_PROTOTYPE(shaper, face); michael@0: #include "hb-shaper-list.hh" michael@0: #undef HB_SHAPER_IMPLEMENT michael@0: #undef HB_SHAPER_DATA_CREATE_FUNC_EXTRA_ARGS michael@0: michael@0: michael@0: #endif /* HB_FACE_PRIVATE_HH */