1 /* 2 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3 * 4 * This code is free software; you can redistribute it and/or modify it 5 * under the terms of the GNU General Public License version 2 only, as 6 * published by the Free Software Foundation. Oracle designates this 7 * particular file as subject to the "Classpath" exception as provided 8 * by Oracle in the LICENSE file that accompanied this code. 9 * 10 * This code is distributed in the hope that it will be useful, but WITHOUT 11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 13 * version 2 for more details (a copy is included in the LICENSE file that 14 * accompanied this code). 15 * 16 * You should have received a copy of the GNU General Public License version 17 * 2 along with this work; if not, write to the Free Software Foundation, 18 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 19 * 20 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 21 * or visit www.oracle.com if you need additional information or have any 22 * questions. 23 */ 24 25 // This file is available under and governed by the GNU General Public 26 // License version 2 only, as published by the Free Software Foundation. 27 // However, the following notice accompanied the original version of this 28 // file: 29 // 30 /* 31 * Copyright © 2009 Red Hat, Inc. 32 * Copyright © 2011 Google, Inc. 33 * 34 * This is part of HarfBuzz, a text shaping library. 35 * 36 * Permission is hereby granted, without written agreement and without 37 * license or royalty fees, to use, copy, modify, and distribute this 38 * software and its documentation for any purpose, provided that the 39 * above copyright notice and the following two paragraphs appear in 40 * all copies of this software. 41 * 42 * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR 43 * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES 44 * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN 45 * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH 46 * DAMAGE. 47 * 48 * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, 49 * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 50 * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS 51 * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO 52 * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. 53 * 54 * Red Hat Author(s): Behdad Esfahbod 55 * Google Author(s): Behdad Esfahbod 56 */ 57 58 #ifndef HB_FACE_PRIVATE_HH 59 #define HB_FACE_PRIVATE_HH 60 61 #include "hb-private.hh" 62 63 #include "hb-object-private.hh" 64 #include "hb-shaper-private.hh" 65 #include "hb-shape-plan-private.hh" 66 67 68 /* 69 * hb_face_t 70 */ 71 72 struct hb_face_t { 73 hb_object_header_t header; 74 ASSERT_POD (); 75 76 hb_bool_t immutable; 77 78 hb_reference_table_func_t reference_table_func; 79 void *user_data; 80 hb_destroy_func_t destroy; 81 82 unsigned int index; 83 mutable unsigned int upem; 84 mutable unsigned int num_glyphs; 85 86 struct hb_shaper_data_t shaper_data; 87 88 struct plan_node_t { 89 hb_shape_plan_t *shape_plan; 90 plan_node_t *next; 91 } *shape_plans; 92 93 94 inline hb_blob_t *reference_table (hb_tag_t tag) const 95 { 96 hb_blob_t *blob; 97 98 if (unlikely (!reference_table_func)) 99 return hb_blob_get_empty (); 100 101 blob = reference_table_func (/*XXX*/const_cast<hb_face_t *> (this), tag, user_data); 102 if (unlikely (!blob)) 103 return hb_blob_get_empty (); 104 105 return blob; 106 } 107 108 inline HB_PURE_FUNC unsigned int get_upem (void) const 109 { 110 if (unlikely (!upem)) 111 load_upem (); 112 return upem; 113 } 114 115 inline unsigned int get_num_glyphs (void) const 116 { 117 if (unlikely (num_glyphs == (unsigned int) -1)) 118 load_num_glyphs (); 119 return num_glyphs; 120 } 121 122 private: 123 HB_INTERNAL void load_upem (void) const; 124 HB_INTERNAL void load_num_glyphs (void) const; 125 }; 126 127 extern HB_INTERNAL const hb_face_t _hb_face_nil; 128 129 #define HB_SHAPER_DATA_CREATE_FUNC_EXTRA_ARGS 130 #define HB_SHAPER_IMPLEMENT(shaper) HB_SHAPER_DATA_PROTOTYPE(shaper, face); 131 #include "hb-shaper-list.hh" 132 #undef HB_SHAPER_IMPLEMENT 133 #undef HB_SHAPER_DATA_CREATE_FUNC_EXTRA_ARGS 134 135 136 #endif /* HB_FACE_PRIVATE_HH */