12e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod/* 22e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod * Copyright © 2009 Red Hat, Inc. 32e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod * Copyright © 2012 Google, Inc. 42e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod * 52e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod * This is part of HarfBuzz, a text shaping library. 62e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod * 72e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod * Permission is hereby granted, without written agreement and without 82e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod * license or royalty fees, to use, copy, modify, and distribute this 92e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod * software and its documentation for any purpose, provided that the 102e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod * above copyright notice and the following two paragraphs appear in 112e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod * all copies of this software. 122e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod * 132e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR 142e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES 152e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN 162e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH 172e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod * DAMAGE. 182e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod * 192e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, 202e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 212e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS 222e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO 232e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. 242e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod * 252e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod * Red Hat Author(s): Behdad Esfahbod 262e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod * Google Author(s): Behdad Esfahbod 272e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod */ 282e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod 292e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod#include "hb-private.hh" 302e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod 312e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod#include "hb-ot-layout-private.hh" 322e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod 332e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod#include "hb-font-private.hh" 342e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod#include "hb-open-file-private.hh" 352e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod#include "hb-ot-head-table.hh" 362e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod#include "hb-ot-maxp-table.hh" 372e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod 382e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod#include "hb-cache-private.hh" 392e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod 402e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod#include <string.h> 412e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod 422e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod 432e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod/* 442e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod * hb_face_t 452e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod */ 462e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod 472e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbodconst hb_face_t _hb_face_nil = { 482e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod HB_OBJECT_HEADER_STATIC, 492e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod 502e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod true, /* immutable */ 512e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod 522e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod NULL, /* reference_table_func */ 532e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod NULL, /* user_data */ 542e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod NULL, /* destroy */ 552e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod 562e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod 0, /* index */ 572e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod 1000, /* upem */ 582e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod 0, /* num_glyphs */ 592e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod 602e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod { 612e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod#define HB_SHAPER_IMPLEMENT(shaper) HB_SHAPER_DATA_INVALID, 622e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod#include "hb-shaper-list.hh" 632e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod#undef HB_SHAPER_IMPLEMENT 642e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod }, 652e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod 662e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod NULL, /* shape_plans */ 672e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod}; 682e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod 692e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod 70288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod/** 71288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * hb_face_create_for_tables: 72ace5c7eb4c2302a6a7eb3576e6dbc3bc026e569cBehdad Esfahbod * @reference_table_func: (closure user_data) (destroy destroy) (scope notified): 73288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * @user_data: 74288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * @destroy: 75288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * 76288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * 77288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * 78288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * Return value: (transfer full) 79288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * 805d74ff02ab01df67808b416af8bb9cefb06f841eBehdad Esfahbod * Since: 0.9.2 81288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod **/ 822e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbodhb_face_t * 832e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbodhb_face_create_for_tables (hb_reference_table_func_t reference_table_func, 842e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod void *user_data, 852e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod hb_destroy_func_t destroy) 862e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod{ 872e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod hb_face_t *face; 882e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod 892e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod if (!reference_table_func || !(face = hb_object_create<hb_face_t> ())) { 902e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod if (destroy) 912e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod destroy (user_data); 922e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod return hb_face_get_empty (); 932e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod } 942e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod 952e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod face->reference_table_func = reference_table_func; 962e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod face->user_data = user_data; 972e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod face->destroy = destroy; 982e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod 992e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod face->upem = 0; 1002e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod face->num_glyphs = (unsigned int) -1; 1012e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod 1022e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod return face; 1032e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod} 1042e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod 1052e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod 1062e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbodtypedef struct hb_face_for_data_closure_t { 1072e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod hb_blob_t *blob; 1082e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod unsigned int index; 1092e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod} hb_face_for_data_closure_t; 1102e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod 1112e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbodstatic hb_face_for_data_closure_t * 1122e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod_hb_face_for_data_closure_create (hb_blob_t *blob, unsigned int index) 1132e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod{ 1142e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod hb_face_for_data_closure_t *closure; 1152e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod 116a5efaac4ff61b587f228830b265b39fe8e5e4e47Behdad Esfahbod closure = (hb_face_for_data_closure_t *) calloc (1, sizeof (hb_face_for_data_closure_t)); 1172e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod if (unlikely (!closure)) 1182e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod return NULL; 1192e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod 1202e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod closure->blob = blob; 1212e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod closure->index = index; 1222e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod 1232e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod return closure; 1242e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod} 1252e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod 1262e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbodstatic void 1272e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod_hb_face_for_data_closure_destroy (hb_face_for_data_closure_t *closure) 1282e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod{ 1292e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod hb_blob_destroy (closure->blob); 1302e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod free (closure); 1312e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod} 1322e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod 1332e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbodstatic hb_blob_t * 1342e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod_hb_face_for_data_reference_table (hb_face_t *face HB_UNUSED, hb_tag_t tag, void *user_data) 1352e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod{ 1362e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod hb_face_for_data_closure_t *data = (hb_face_for_data_closure_t *) user_data; 1372e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod 1382e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod if (tag == HB_TAG_NONE) 1392e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod return hb_blob_reference (data->blob); 1402e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod 1412e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod const OT::OpenTypeFontFile &ot_file = *OT::Sanitizer<OT::OpenTypeFontFile>::lock_instance (data->blob); 1422e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod const OT::OpenTypeFontFace &ot_face = ot_file.get_face (data->index); 1432e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod 1442e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod const OT::OpenTypeTable &table = ot_face.get_table_by_tag (tag); 1452e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod 1462e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod hb_blob_t *blob = hb_blob_create_sub_blob (data->blob, table.offset, table.length); 1472e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod 1482e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod return blob; 1492e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod} 1502e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod 151288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod/** 152085d4291a9f253a4b8e2eec8003ac11d02a9394fBehdad Esfahbod * hb_face_create: (Xconstructor) 153288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * @blob: 154288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * @index: 155288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * 156288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * 157288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * 158288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * Return value: (transfer full): 159288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * 1605d74ff02ab01df67808b416af8bb9cefb06f841eBehdad Esfahbod * Since: 0.9.2 161288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod **/ 1622e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbodhb_face_t * 1632e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbodhb_face_create (hb_blob_t *blob, 1642e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod unsigned int index) 1652e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod{ 1662e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod hb_face_t *face; 1672e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod 168eb0bf3ae6688b7e98a706df2ad2714c071d77e22Behdad Esfahbod if (unlikely (!blob)) 169eb0bf3ae6688b7e98a706df2ad2714c071d77e22Behdad Esfahbod blob = hb_blob_get_empty (); 1702e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod 1712e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod hb_face_for_data_closure_t *closure = _hb_face_for_data_closure_create (OT::Sanitizer<OT::OpenTypeFontFile>::sanitize (hb_blob_reference (blob)), index); 1722e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod 1732e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod if (unlikely (!closure)) 1742e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod return hb_face_get_empty (); 1752e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod 1762e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod face = hb_face_create_for_tables (_hb_face_for_data_reference_table, 1772e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod closure, 1782e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod (hb_destroy_func_t) _hb_face_for_data_closure_destroy); 1792e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod 1802e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod hb_face_set_index (face, index); 1812e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod 1822e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod return face; 1832e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod} 1842e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod 185288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod/** 186288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * hb_face_get_empty: 187288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * 188288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * 189288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * 190288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * Return value: (transfer full) 191288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * 1925d74ff02ab01df67808b416af8bb9cefb06f841eBehdad Esfahbod * Since: 0.9.2 193288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod **/ 1942e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbodhb_face_t * 1952e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbodhb_face_get_empty (void) 1962e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod{ 1972e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod return const_cast<hb_face_t *> (&_hb_face_nil); 1982e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod} 1992e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod 2002e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod 201288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod/** 202288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * hb_face_reference: (skip) 203288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * @face: a face. 204288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * 205288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * 206288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * 207288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * Return value: 208288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * 2095d74ff02ab01df67808b416af8bb9cefb06f841eBehdad Esfahbod * Since: 0.9.2 210288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod **/ 2112e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbodhb_face_t * 2122e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbodhb_face_reference (hb_face_t *face) 2132e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod{ 2142e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod return hb_object_reference (face); 2152e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod} 2162e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod 217288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod/** 218288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * hb_face_destroy: (skip) 219288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * @face: a face. 220288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * 221288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * 222288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * 2235d74ff02ab01df67808b416af8bb9cefb06f841eBehdad Esfahbod * Since: 0.9.2 224288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod **/ 2252e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbodvoid 2262e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbodhb_face_destroy (hb_face_t *face) 2272e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod{ 2282e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod if (!hb_object_destroy (face)) return; 2292e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod 2302e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod for (hb_face_t::plan_node_t *node = face->shape_plans; node; ) 2312e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod { 2322e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod hb_face_t::plan_node_t *next = node->next; 2332e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod hb_shape_plan_destroy (node->shape_plan); 2342e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod free (node); 2352e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod node = next; 2362e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod } 2372e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod 2382e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod#define HB_SHAPER_IMPLEMENT(shaper) HB_SHAPER_DATA_DESTROY(shaper, face); 2392e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod#include "hb-shaper-list.hh" 2402e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod#undef HB_SHAPER_IMPLEMENT 2412e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod 2422e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod if (face->destroy) 2432e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod face->destroy (face->user_data); 2442e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod 2452e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod free (face); 2462e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod} 2472e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod 248288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod/** 249288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * hb_face_set_user_data: (skip) 250288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * @face: a face. 251288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * @key: 252288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * @data: 253288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * @destroy: 254288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * @replace: 255288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * 256288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * 257288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * 258288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * Return value: 259288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * 2605d74ff02ab01df67808b416af8bb9cefb06f841eBehdad Esfahbod * Since: 0.9.2 261288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod **/ 2622e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbodhb_bool_t 2632e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbodhb_face_set_user_data (hb_face_t *face, 2642e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod hb_user_data_key_t *key, 2652e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod void * data, 2662e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod hb_destroy_func_t destroy, 2672e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod hb_bool_t replace) 2682e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod{ 2692e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod return hb_object_set_user_data (face, key, data, destroy, replace); 2702e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod} 2712e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod 272288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod/** 273288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * hb_face_get_user_data: (skip) 274288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * @face: a face. 275288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * @key: 276288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * 277288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * 278288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * 279288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * Return value: (transfer none): 280288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * 2815d74ff02ab01df67808b416af8bb9cefb06f841eBehdad Esfahbod * Since: 0.9.2 282288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod **/ 2832e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbodvoid * 2842e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbodhb_face_get_user_data (hb_face_t *face, 2852e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod hb_user_data_key_t *key) 2862e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod{ 2872e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod return hb_object_get_user_data (face, key); 2882e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod} 2892e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod 290288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod/** 291288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * hb_face_make_immutable: 292288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * @face: a face. 293288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * 294288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * 295288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * 2965d74ff02ab01df67808b416af8bb9cefb06f841eBehdad Esfahbod * Since: 0.9.2 297288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod **/ 2982e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbodvoid 2992e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbodhb_face_make_immutable (hb_face_t *face) 3002e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod{ 3013f310dc0cae9015c45ba642b9b83d5695c807aadBehdad Esfahbod if (unlikely (hb_object_is_inert (face))) 3022e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod return; 3032e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod 3042e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod face->immutable = true; 3052e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod} 3062e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod 307288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod/** 308288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * hb_face_is_immutable: 309288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * @face: a face. 310288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * 311288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * 312288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * 313288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * Return value: 314288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * 3155d74ff02ab01df67808b416af8bb9cefb06f841eBehdad Esfahbod * Since: 0.9.2 316288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod **/ 3172e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbodhb_bool_t 3182e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbodhb_face_is_immutable (hb_face_t *face) 3192e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod{ 3202e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod return face->immutable; 3212e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod} 3222e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod 3232e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod 324288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod/** 325288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * hb_face_reference_table: 326288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * @face: a face. 327288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * @tag: 328288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * 329288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * 330288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * 331288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * Return value: (transfer full): 332288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * 3335d74ff02ab01df67808b416af8bb9cefb06f841eBehdad Esfahbod * Since: 0.9.2 334288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod **/ 3352e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbodhb_blob_t * 3362e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbodhb_face_reference_table (hb_face_t *face, 3372e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod hb_tag_t tag) 3382e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod{ 3392e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod return face->reference_table (tag); 3402e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod} 3412e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod 342288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod/** 343288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * hb_face_reference_blob: 344288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * @face: a face. 345288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * 346288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * 347288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * 348288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * Return value: (transfer full): 349288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * 35001c3a88543850c87483fd8671044df53b368c520Sascha Brawer * Since: 0.9.2 351288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod **/ 3522e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbodhb_blob_t * 3532e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbodhb_face_reference_blob (hb_face_t *face) 3542e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod{ 3552e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod return face->reference_table (HB_TAG_NONE); 3562e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod} 3572e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod 358288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod/** 359288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * hb_face_set_index: 360288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * @face: a face. 361288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * @index: 362288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * 363288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * 364288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * 36501c3a88543850c87483fd8671044df53b368c520Sascha Brawer * Since: 0.9.2 366288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod **/ 3672e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbodvoid 3682e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbodhb_face_set_index (hb_face_t *face, 3692e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod unsigned int index) 3702e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod{ 3713f310dc0cae9015c45ba642b9b83d5695c807aadBehdad Esfahbod if (face->immutable) 3722e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod return; 3732e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod 3742e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod face->index = index; 3752e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod} 3762e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod 377288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod/** 378288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * hb_face_get_index: 379288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * @face: a face. 380288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * 381288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * 382288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * 383288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * Return value: 384288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * 38501c3a88543850c87483fd8671044df53b368c520Sascha Brawer * Since: 0.9.2 386288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod **/ 3872e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbodunsigned int 3882e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbodhb_face_get_index (hb_face_t *face) 3892e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod{ 3902e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod return face->index; 3912e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod} 3922e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod 393288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod/** 394288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * hb_face_set_upem: 395288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * @face: a face. 396288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * @upem: 397288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * 398288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * 399288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * 40001c3a88543850c87483fd8671044df53b368c520Sascha Brawer * Since: 0.9.2 401288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod **/ 4022e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbodvoid 4032e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbodhb_face_set_upem (hb_face_t *face, 4042e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod unsigned int upem) 4052e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod{ 4063f310dc0cae9015c45ba642b9b83d5695c807aadBehdad Esfahbod if (face->immutable) 4072e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod return; 4082e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod 4092e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod face->upem = upem; 4102e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod} 4112e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod 412288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod/** 413288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * hb_face_get_upem: 414288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * @face: a face. 415288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * 416288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * 417288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * 418288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * Return value: 419288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * 4205d74ff02ab01df67808b416af8bb9cefb06f841eBehdad Esfahbod * Since: 0.9.2 421288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod **/ 4222e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbodunsigned int 4232e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbodhb_face_get_upem (hb_face_t *face) 4242e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod{ 4252e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod return face->get_upem (); 4262e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod} 4272e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod 4282e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbodvoid 4292e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbodhb_face_t::load_upem (void) const 4302e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod{ 4312e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod hb_blob_t *head_blob = OT::Sanitizer<OT::head>::sanitize (reference_table (HB_OT_TAG_head)); 4322e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod const OT::head *head_table = OT::Sanitizer<OT::head>::lock_instance (head_blob); 4332e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod upem = head_table->get_upem (); 4342e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod hb_blob_destroy (head_blob); 4352e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod} 4362e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod 437288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod/** 438288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * hb_face_set_glyph_count: 439288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * @face: a face. 440288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * @glyph_count: 441288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * 442288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * 443288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * 44401c3a88543850c87483fd8671044df53b368c520Sascha Brawer * Since: 0.9.7 445288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod **/ 4462e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbodvoid 4472e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbodhb_face_set_glyph_count (hb_face_t *face, 4482e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod unsigned int glyph_count) 4492e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod{ 4503f310dc0cae9015c45ba642b9b83d5695c807aadBehdad Esfahbod if (face->immutable) 4512e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod return; 4522e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod 4532e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod face->num_glyphs = glyph_count; 4542e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod} 4552e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod 456288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod/** 457288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * hb_face_get_glyph_count: 458288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * @face: a face. 459288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * 460288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * 461288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * 462288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * Return value: 463288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * 46401c3a88543850c87483fd8671044df53b368c520Sascha Brawer * Since: 0.9.7 465288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod **/ 4662e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbodunsigned int 4672e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbodhb_face_get_glyph_count (hb_face_t *face) 4682e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod{ 4692e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod return face->get_num_glyphs (); 4702e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod} 4712e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod 4722e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbodvoid 4732e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbodhb_face_t::load_num_glyphs (void) const 4742e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod{ 4752e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod hb_blob_t *maxp_blob = OT::Sanitizer<OT::maxp>::sanitize (reference_table (HB_OT_TAG_maxp)); 4762e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod const OT::maxp *maxp_table = OT::Sanitizer<OT::maxp>::lock_instance (maxp_blob); 4772e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod num_glyphs = maxp_table->get_num_glyphs (); 4782e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod hb_blob_destroy (maxp_blob); 4792e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod} 4802e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod 4812e3a07abdf97b0ad2105c3a52f3ff0e0b60b29c4Behdad Esfahbod 482