hb-ot-layout.cc revision f9cd1014f8f4d0394b5e0e9eefc1e2af13c59cab
1fd92a3dde32fd10df30c9eeb97641bc3c15b1e9bBehdad Esfahbod/* 26f425b11799aa20dab553085f05744191b7318e2Behdad Esfahbod * Copyright (C) 1998-2004 David Turner and Werner Lemberg 36f425b11799aa20dab553085f05744191b7318e2Behdad Esfahbod * Copyright (C) 2006 Behdad Esfahbod 4ee58aaebd296ea8237516754fd4e825d524b11b7Behdad Esfahbod * Copyright (C) 2007,2008,2009 Red Hat, Inc. 5fd92a3dde32fd10df30c9eeb97641bc3c15b1e9bBehdad Esfahbod * 6fd92a3dde32fd10df30c9eeb97641bc3c15b1e9bBehdad Esfahbod * This is part of HarfBuzz, an OpenType Layout engine library. 7fd92a3dde32fd10df30c9eeb97641bc3c15b1e9bBehdad Esfahbod * 8fd92a3dde32fd10df30c9eeb97641bc3c15b1e9bBehdad Esfahbod * Permission is hereby granted, without written agreement and without 9fd92a3dde32fd10df30c9eeb97641bc3c15b1e9bBehdad Esfahbod * license or royalty fees, to use, copy, modify, and distribute this 10fd92a3dde32fd10df30c9eeb97641bc3c15b1e9bBehdad Esfahbod * software and its documentation for any purpose, provided that the 11fd92a3dde32fd10df30c9eeb97641bc3c15b1e9bBehdad Esfahbod * above copyright notice and the following two paragraphs appear in 12fd92a3dde32fd10df30c9eeb97641bc3c15b1e9bBehdad Esfahbod * all copies of this software. 13fd92a3dde32fd10df30c9eeb97641bc3c15b1e9bBehdad Esfahbod * 14fd92a3dde32fd10df30c9eeb97641bc3c15b1e9bBehdad Esfahbod * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR 15fd92a3dde32fd10df30c9eeb97641bc3c15b1e9bBehdad Esfahbod * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES 16fd92a3dde32fd10df30c9eeb97641bc3c15b1e9bBehdad Esfahbod * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN 17fd92a3dde32fd10df30c9eeb97641bc3c15b1e9bBehdad Esfahbod * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH 18fd92a3dde32fd10df30c9eeb97641bc3c15b1e9bBehdad Esfahbod * DAMAGE. 19fd92a3dde32fd10df30c9eeb97641bc3c15b1e9bBehdad Esfahbod * 20fd92a3dde32fd10df30c9eeb97641bc3c15b1e9bBehdad Esfahbod * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, 21fd92a3dde32fd10df30c9eeb97641bc3c15b1e9bBehdad Esfahbod * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 22fd92a3dde32fd10df30c9eeb97641bc3c15b1e9bBehdad Esfahbod * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS 23fd92a3dde32fd10df30c9eeb97641bc3c15b1e9bBehdad Esfahbod * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO 24fd92a3dde32fd10df30c9eeb97641bc3c15b1e9bBehdad Esfahbod * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. 25fd92a3dde32fd10df30c9eeb97641bc3c15b1e9bBehdad Esfahbod * 26fd92a3dde32fd10df30c9eeb97641bc3c15b1e9bBehdad Esfahbod * Red Hat Author(s): Behdad Esfahbod 27fd92a3dde32fd10df30c9eeb97641bc3c15b1e9bBehdad Esfahbod */ 28fd92a3dde32fd10df30c9eeb97641bc3c15b1e9bBehdad Esfahbod 29fd92a3dde32fd10df30c9eeb97641bc3c15b1e9bBehdad Esfahbod#define HB_OT_LAYOUT_CC 30fd92a3dde32fd10df30c9eeb97641bc3c15b1e9bBehdad Esfahbod 315c0adce1ccc739415c4b26ff13ffd2d77ea4bc6cBehdad Esfahbod/* XXX */ 325c0adce1ccc739415c4b26ff13ffd2d77ea4bc6cBehdad Esfahbod#include "hb-buffer-private.h" 335c0adce1ccc739415c4b26ff13ffd2d77ea4bc6cBehdad Esfahbod 34fd92a3dde32fd10df30c9eeb97641bc3c15b1e9bBehdad Esfahbod#include "hb-ot-layout.h" 35fd92a3dde32fd10df30c9eeb97641bc3c15b1e9bBehdad Esfahbod#include "hb-ot-layout-private.h" 36fd92a3dde32fd10df30c9eeb97641bc3c15b1e9bBehdad Esfahbod 37fd92a3dde32fd10df30c9eeb97641bc3c15b1e9bBehdad Esfahbod#include "hb-ot-layout-open-private.h" 38fd92a3dde32fd10df30c9eeb97641bc3c15b1e9bBehdad Esfahbod#include "hb-ot-layout-gdef-private.h" 39fd92a3dde32fd10df30c9eeb97641bc3c15b1e9bBehdad Esfahbod#include "hb-ot-layout-gsub-private.h" 405e5eb0573f7ea2ce2cf037fef0df70a4351e82c0Behdad Esfahbod#include "hb-ot-layout-gpos-private.h" 41fd92a3dde32fd10df30c9eeb97641bc3c15b1e9bBehdad Esfahbod 426f425b11799aa20dab553085f05744191b7318e2Behdad Esfahbod 43fd92a3dde32fd10df30c9eeb97641bc3c15b1e9bBehdad Esfahbod#include <stdlib.h> 44aff831ed6787abe8e24a977e34d97ff2e0b7dc21Behdad Esfahbod#include <string.h> 45aff831ed6787abe8e24a977e34d97ff2e0b7dc21Behdad Esfahbod 46fd92a3dde32fd10df30c9eeb97641bc3c15b1e9bBehdad Esfahbod 47e50c3978d37b2c0d6ddd4ced6a6196f6857cd596Behdad Esfahbodhb_ot_layout_t * 484a26ea408c87f0bb59deca9ff44008d138471aa3Behdad Esfahbodhb_ot_layout_create (void) 494a26ea408c87f0bb59deca9ff44008d138471aa3Behdad Esfahbod{ 504a26ea408c87f0bb59deca9ff44008d138471aa3Behdad Esfahbod hb_ot_layout_t *layout = (hb_ot_layout_t *) calloc (1, sizeof (hb_ot_layout_t)); 514a26ea408c87f0bb59deca9ff44008d138471aa3Behdad Esfahbod 528b8358033184198ff638ee1379093717596e162dBehdad Esfahbod layout->gdef = &Null(GDEF); 538b8358033184198ff638ee1379093717596e162dBehdad Esfahbod layout->gsub = &Null(GSUB); 545e5eb0573f7ea2ce2cf037fef0df70a4351e82c0Behdad Esfahbod layout->gpos = &Null(GPOS); 554a26ea408c87f0bb59deca9ff44008d138471aa3Behdad Esfahbod 564a26ea408c87f0bb59deca9ff44008d138471aa3Behdad Esfahbod return layout; 574a26ea408c87f0bb59deca9ff44008d138471aa3Behdad Esfahbod} 584a26ea408c87f0bb59deca9ff44008d138471aa3Behdad Esfahbod 59f9cd1014f8f4d0394b5e0e9eefc1e2af13c59cabBehdad Esfahbodhb_bool_t 60f9cd1014f8f4d0394b5e0e9eefc1e2af13c59cabBehdad Esfahbodhb_ot_layout_has_substitution (hb_ot_layout_t *layout) 61f9cd1014f8f4d0394b5e0e9eefc1e2af13c59cabBehdad Esfahbod{ 62f9cd1014f8f4d0394b5e0e9eefc1e2af13c59cabBehdad Esfahbod return layout->gsub != &Null(GSUB); 63f9cd1014f8f4d0394b5e0e9eefc1e2af13c59cabBehdad Esfahbod} 64f9cd1014f8f4d0394b5e0e9eefc1e2af13c59cabBehdad Esfahbod 65f9cd1014f8f4d0394b5e0e9eefc1e2af13c59cabBehdad Esfahbodhb_bool_t 66f9cd1014f8f4d0394b5e0e9eefc1e2af13c59cabBehdad Esfahbodhb_ot_layout_has_positioning (hb_ot_layout_t *layout) 67f9cd1014f8f4d0394b5e0e9eefc1e2af13c59cabBehdad Esfahbod{ 68f9cd1014f8f4d0394b5e0e9eefc1e2af13c59cabBehdad Esfahbod return layout->gpos != &Null(GPOS); 69f9cd1014f8f4d0394b5e0e9eefc1e2af13c59cabBehdad Esfahbod} 70f9cd1014f8f4d0394b5e0e9eefc1e2af13c59cabBehdad Esfahbod 714a26ea408c87f0bb59deca9ff44008d138471aa3Behdad Esfahbodhb_ot_layout_t * 72dfa811965133bc4d1696fa5a0166e17ed4142c98Behdad Esfahbodhb_ot_layout_create_for_data (const char *font_data, 73dfa811965133bc4d1696fa5a0166e17ed4142c98Behdad Esfahbod int face_index) 74fd92a3dde32fd10df30c9eeb97641bc3c15b1e9bBehdad Esfahbod{ 754a26ea408c87f0bb59deca9ff44008d138471aa3Behdad Esfahbod hb_ot_layout_t *layout; 764a26ea408c87f0bb59deca9ff44008d138471aa3Behdad Esfahbod 774a26ea408c87f0bb59deca9ff44008d138471aa3Behdad Esfahbod if (HB_UNLIKELY (font_data == NULL)) 784a26ea408c87f0bb59deca9ff44008d138471aa3Behdad Esfahbod return hb_ot_layout_create (); 794a26ea408c87f0bb59deca9ff44008d138471aa3Behdad Esfahbod 804a26ea408c87f0bb59deca9ff44008d138471aa3Behdad Esfahbod layout = (hb_ot_layout_t *) calloc (1, sizeof (hb_ot_layout_t)); 81fd92a3dde32fd10df30c9eeb97641bc3c15b1e9bBehdad Esfahbod 82ead428d7a0bf4dc84340a99f3959e5cc58123e99Behdad Esfahbod const OpenTypeFontFile &font = OpenTypeFontFile::get_for_data (font_data); 83ead428d7a0bf4dc84340a99f3959e5cc58123e99Behdad Esfahbod const OpenTypeFontFace &face = font.get_face (face_index); 84fd92a3dde32fd10df30c9eeb97641bc3c15b1e9bBehdad Esfahbod 8554e5aac5e2947d4e2864c6f2987e4d275da73100Behdad Esfahbod layout->gdef = &GDEF::get_for_data (font.get_table_data (face.get_table_by_tag (GDEF::Tag))); 8654e5aac5e2947d4e2864c6f2987e4d275da73100Behdad Esfahbod layout->gsub = &GSUB::get_for_data (font.get_table_data (face.get_table_by_tag (GSUB::Tag))); 875e5eb0573f7ea2ce2cf037fef0df70a4351e82c0Behdad Esfahbod layout->gpos = &GPOS::get_for_data (font.get_table_data (face.get_table_by_tag (GPOS::Tag))); 88fd92a3dde32fd10df30c9eeb97641bc3c15b1e9bBehdad Esfahbod 89fd92a3dde32fd10df30c9eeb97641bc3c15b1e9bBehdad Esfahbod return layout; 90fd92a3dde32fd10df30c9eeb97641bc3c15b1e9bBehdad Esfahbod} 91fd92a3dde32fd10df30c9eeb97641bc3c15b1e9bBehdad Esfahbod 92f9cd1014f8f4d0394b5e0e9eefc1e2af13c59cabBehdad Esfahbodhb_ot_layout_t * 93f9cd1014f8f4d0394b5e0e9eefc1e2af13c59cabBehdad Esfahbodhb_ot_layout_create_for_tables (const char *gdef_data, 94f9cd1014f8f4d0394b5e0e9eefc1e2af13c59cabBehdad Esfahbod const char *gsub_data, 95f9cd1014f8f4d0394b5e0e9eefc1e2af13c59cabBehdad Esfahbod const char *gpos_data) 96f9cd1014f8f4d0394b5e0e9eefc1e2af13c59cabBehdad Esfahbod{ 97f9cd1014f8f4d0394b5e0e9eefc1e2af13c59cabBehdad Esfahbod hb_ot_layout_t *layout; 98f9cd1014f8f4d0394b5e0e9eefc1e2af13c59cabBehdad Esfahbod 99f9cd1014f8f4d0394b5e0e9eefc1e2af13c59cabBehdad Esfahbod if (HB_UNLIKELY (gdef_data == NULL && gsub_data == NULL && gpos_data == NULL)) 100f9cd1014f8f4d0394b5e0e9eefc1e2af13c59cabBehdad Esfahbod return hb_ot_layout_create (); 101f9cd1014f8f4d0394b5e0e9eefc1e2af13c59cabBehdad Esfahbod 102f9cd1014f8f4d0394b5e0e9eefc1e2af13c59cabBehdad Esfahbod layout = (hb_ot_layout_t *) calloc (1, sizeof (hb_ot_layout_t)); 103f9cd1014f8f4d0394b5e0e9eefc1e2af13c59cabBehdad Esfahbod 104f9cd1014f8f4d0394b5e0e9eefc1e2af13c59cabBehdad Esfahbod layout->gdef = &GDEF::get_for_data (gdef_data); 105f9cd1014f8f4d0394b5e0e9eefc1e2af13c59cabBehdad Esfahbod layout->gsub = &GSUB::get_for_data (gsub_data); 106f9cd1014f8f4d0394b5e0e9eefc1e2af13c59cabBehdad Esfahbod layout->gpos = &GPOS::get_for_data (gpos_data); 107f9cd1014f8f4d0394b5e0e9eefc1e2af13c59cabBehdad Esfahbod 108f9cd1014f8f4d0394b5e0e9eefc1e2af13c59cabBehdad Esfahbod return layout; 109f9cd1014f8f4d0394b5e0e9eefc1e2af13c59cabBehdad Esfahbod} 110f9cd1014f8f4d0394b5e0e9eefc1e2af13c59cabBehdad Esfahbod 111fd92a3dde32fd10df30c9eeb97641bc3c15b1e9bBehdad Esfahbodvoid 112e50c3978d37b2c0d6ddd4ced6a6196f6857cd596Behdad Esfahbodhb_ot_layout_destroy (hb_ot_layout_t *layout) 113fd92a3dde32fd10df30c9eeb97641bc3c15b1e9bBehdad Esfahbod{ 114fd92a3dde32fd10df30c9eeb97641bc3c15b1e9bBehdad Esfahbod free (layout); 115fd92a3dde32fd10df30c9eeb97641bc3c15b1e9bBehdad Esfahbod} 116fd92a3dde32fd10df30c9eeb97641bc3c15b1e9bBehdad Esfahbod 1172ebb89d63dd27e800f2b6cbf624924601105f48aBehdad Esfahbodvoid 1182ebb89d63dd27e800f2b6cbf624924601105f48aBehdad Esfahbodhb_ot_layout_set_direction (hb_ot_layout_t *layout, 1192ebb89d63dd27e800f2b6cbf624924601105f48aBehdad Esfahbod hb_bool_t r2l) 1202ebb89d63dd27e800f2b6cbf624924601105f48aBehdad Esfahbod{ 1212ebb89d63dd27e800f2b6cbf624924601105f48aBehdad Esfahbod layout->gpos_info.r2l = !!r2l; 1222ebb89d63dd27e800f2b6cbf624924601105f48aBehdad Esfahbod} 1232ebb89d63dd27e800f2b6cbf624924601105f48aBehdad Esfahbod 1242ebb89d63dd27e800f2b6cbf624924601105f48aBehdad Esfahbodvoid 1252ebb89d63dd27e800f2b6cbf624924601105f48aBehdad Esfahbodhb_ot_layout_set_hinting (hb_ot_layout_t *layout, 1262ebb89d63dd27e800f2b6cbf624924601105f48aBehdad Esfahbod hb_bool_t hinted) 1272ebb89d63dd27e800f2b6cbf624924601105f48aBehdad Esfahbod{ 1282ebb89d63dd27e800f2b6cbf624924601105f48aBehdad Esfahbod layout->gpos_info.dvi = !hinted; 1292ebb89d63dd27e800f2b6cbf624924601105f48aBehdad Esfahbod} 1302ebb89d63dd27e800f2b6cbf624924601105f48aBehdad Esfahbod 1312ebb89d63dd27e800f2b6cbf624924601105f48aBehdad Esfahbodvoid 1322ebb89d63dd27e800f2b6cbf624924601105f48aBehdad Esfahbodhb_ot_layout_set_scale (hb_ot_layout_t *layout, 1332ebb89d63dd27e800f2b6cbf624924601105f48aBehdad Esfahbod hb_16dot16_t x_scale, hb_16dot16_t y_scale) 1342ebb89d63dd27e800f2b6cbf624924601105f48aBehdad Esfahbod{ 1352ebb89d63dd27e800f2b6cbf624924601105f48aBehdad Esfahbod layout->gpos_info.x_scale = x_scale; 1362ebb89d63dd27e800f2b6cbf624924601105f48aBehdad Esfahbod layout->gpos_info.y_scale = y_scale; 1372ebb89d63dd27e800f2b6cbf624924601105f48aBehdad Esfahbod} 1382ebb89d63dd27e800f2b6cbf624924601105f48aBehdad Esfahbod 1392ebb89d63dd27e800f2b6cbf624924601105f48aBehdad Esfahbodvoid 1402ebb89d63dd27e800f2b6cbf624924601105f48aBehdad Esfahbodhb_ot_layout_set_ppem (hb_ot_layout_t *layout, 1412ebb89d63dd27e800f2b6cbf624924601105f48aBehdad Esfahbod unsigned int x_ppem, unsigned int y_ppem) 1422ebb89d63dd27e800f2b6cbf624924601105f48aBehdad Esfahbod{ 1432ebb89d63dd27e800f2b6cbf624924601105f48aBehdad Esfahbod layout->gpos_info.x_ppem = x_ppem; 1442ebb89d63dd27e800f2b6cbf624924601105f48aBehdad Esfahbod layout->gpos_info.y_ppem = y_ppem; 1452ebb89d63dd27e800f2b6cbf624924601105f48aBehdad Esfahbod} 1462ebb89d63dd27e800f2b6cbf624924601105f48aBehdad Esfahbod 147e1593a6e620ee6a8184487185d1c95e0d1820ba5Behdad Esfahbod 148590d55cbb9e21ef74dfd88eee51fd0a763958cd2Behdad Esfahbod/* 149590d55cbb9e21ef74dfd88eee51fd0a763958cd2Behdad Esfahbod * GDEF 150590d55cbb9e21ef74dfd88eee51fd0a763958cd2Behdad Esfahbod */ 151590d55cbb9e21ef74dfd88eee51fd0a763958cd2Behdad Esfahbod 152d6aae5f5cad54fc5dac8b0ff10a3921ebda533d4Behdad Esfahbod/* TODO the public class_t is a mess */ 15330bd763fa2fa4aceee51433ec9fc8dc28480b5d7Behdad Esfahbod 154590d55cbb9e21ef74dfd88eee51fd0a763958cd2Behdad Esfahbodhb_bool_t 155e50c3978d37b2c0d6ddd4ced6a6196f6857cd596Behdad Esfahbodhb_ot_layout_has_font_glyph_classes (hb_ot_layout_t *layout) 156590d55cbb9e21ef74dfd88eee51fd0a763958cd2Behdad Esfahbod{ 157590d55cbb9e21ef74dfd88eee51fd0a763958cd2Behdad Esfahbod return layout->gdef->has_glyph_classes (); 158590d55cbb9e21ef74dfd88eee51fd0a763958cd2Behdad Esfahbod} 159590d55cbb9e21ef74dfd88eee51fd0a763958cd2Behdad Esfahbod 160347f0b8621d3adfec157e5634ff3defc818ea37fBehdad EsfahbodHB_INTERNAL hb_bool_t 161e50c3978d37b2c0d6ddd4ced6a6196f6857cd596Behdad Esfahbod_hb_ot_layout_has_new_glyph_classes (hb_ot_layout_t *layout) 162590d55cbb9e21ef74dfd88eee51fd0a763958cd2Behdad Esfahbod{ 163590d55cbb9e21ef74dfd88eee51fd0a763958cd2Behdad Esfahbod return layout->new_gdef.len > 0; 164590d55cbb9e21ef74dfd88eee51fd0a763958cd2Behdad Esfahbod} 165590d55cbb9e21ef74dfd88eee51fd0a763958cd2Behdad Esfahbod 166347f0b8621d3adfec157e5634ff3defc818ea37fBehdad EsfahbodHB_INTERNAL unsigned int 16730bd763fa2fa4aceee51433ec9fc8dc28480b5d7Behdad Esfahbod_hb_ot_layout_get_glyph_property (hb_ot_layout_t *layout, 16830bd763fa2fa4aceee51433ec9fc8dc28480b5d7Behdad Esfahbod hb_codepoint_t glyph) 169ead428d7a0bf4dc84340a99f3959e5cc58123e99Behdad Esfahbod{ 170aff831ed6787abe8e24a977e34d97ff2e0b7dc21Behdad Esfahbod hb_ot_layout_class_t klass; 171aff831ed6787abe8e24a977e34d97ff2e0b7dc21Behdad Esfahbod 172e4b92b85a7750bd4271ad607b3c41f0184e89febBehdad Esfahbod klass = layout->gdef->get_glyph_class (glyph); 173ead428d7a0bf4dc84340a99f3959e5cc58123e99Behdad Esfahbod 174aff831ed6787abe8e24a977e34d97ff2e0b7dc21Behdad Esfahbod if (!klass && glyph < layout->new_gdef.len) 175aff831ed6787abe8e24a977e34d97ff2e0b7dc21Behdad Esfahbod klass = layout->new_gdef.klasses[glyph]; 176aff831ed6787abe8e24a977e34d97ff2e0b7dc21Behdad Esfahbod 177aff831ed6787abe8e24a977e34d97ff2e0b7dc21Behdad Esfahbod switch (klass) { 178aff831ed6787abe8e24a977e34d97ff2e0b7dc21Behdad Esfahbod default: 179aff831ed6787abe8e24a977e34d97ff2e0b7dc21Behdad Esfahbod case GDEF::UnclassifiedGlyph: return HB_OT_LAYOUT_GLYPH_CLASS_UNCLASSIFIED; 180aff831ed6787abe8e24a977e34d97ff2e0b7dc21Behdad Esfahbod case GDEF::BaseGlyph: return HB_OT_LAYOUT_GLYPH_CLASS_BASE_GLYPH; 181aff831ed6787abe8e24a977e34d97ff2e0b7dc21Behdad Esfahbod case GDEF::LigatureGlyph: return HB_OT_LAYOUT_GLYPH_CLASS_LIGATURE; 182aff831ed6787abe8e24a977e34d97ff2e0b7dc21Behdad Esfahbod case GDEF::ComponentGlyph: return HB_OT_LAYOUT_GLYPH_CLASS_COMPONENT; 1835130c35e93528bcf3095fee5baf3847589167a58Behdad Esfahbod case GDEF::MarkGlyph: 1845130c35e93528bcf3095fee5baf3847589167a58Behdad Esfahbod /* TODO old harfbuzz doesn't always parse mark attachments as it says it was 1855130c35e93528bcf3095fee5baf3847589167a58Behdad Esfahbod * introduced without a version bump, so it may not be safe */ 1865130c35e93528bcf3095fee5baf3847589167a58Behdad Esfahbod klass = layout->gdef->get_mark_attachment_type (glyph); 18709c292e3b688a67fbae67b645d1e6ffcf8d8eb6eBehdad Esfahbod return HB_OT_LAYOUT_GLYPH_CLASS_MARK + (klass << 8); 188aff831ed6787abe8e24a977e34d97ff2e0b7dc21Behdad Esfahbod } 189ead428d7a0bf4dc84340a99f3959e5cc58123e99Behdad Esfahbod} 190fd92a3dde32fd10df30c9eeb97641bc3c15b1e9bBehdad Esfahbod 191347f0b8621d3adfec157e5634ff3defc818ea37fBehdad EsfahbodHB_INTERNAL hb_bool_t 192c968fc2dc87cf85b53f60a40db59d5ee7b992edfBehdad Esfahbod_hb_ot_layout_check_glyph_property (hb_ot_layout_t *layout, 193c968fc2dc87cf85b53f60a40db59d5ee7b992edfBehdad Esfahbod hb_glyph_info_t *ginfo, 194c968fc2dc87cf85b53f60a40db59d5ee7b992edfBehdad Esfahbod unsigned int lookup_flags, 1954189b92aaa41e4a1756c561cc6e08b0ed024afdaBehdad Esfahbod unsigned int *property_out) 196590d55cbb9e21ef74dfd88eee51fd0a763958cd2Behdad Esfahbod{ 1974189b92aaa41e4a1756c561cc6e08b0ed024afdaBehdad Esfahbod unsigned int property; 1986f425b11799aa20dab553085f05744191b7318e2Behdad Esfahbod 199c968fc2dc87cf85b53f60a40db59d5ee7b992edfBehdad Esfahbod if (ginfo->gproperty == HB_BUFFER_GLYPH_PROPERTIES_UNKNOWN) 2004189b92aaa41e4a1756c561cc6e08b0ed024afdaBehdad Esfahbod ginfo->gproperty = _hb_ot_layout_get_glyph_property (layout, ginfo->gindex); 2014189b92aaa41e4a1756c561cc6e08b0ed024afdaBehdad Esfahbod property = ginfo->gproperty; 2024189b92aaa41e4a1756c561cc6e08b0ed024afdaBehdad Esfahbod if (property_out) 2034189b92aaa41e4a1756c561cc6e08b0ed024afdaBehdad Esfahbod *property_out = property; 2046f425b11799aa20dab553085f05744191b7318e2Behdad Esfahbod 2054189b92aaa41e4a1756c561cc6e08b0ed024afdaBehdad Esfahbod /* Not covered, if, for example, glyph class is ligature and 2061246e41021ab1d782b4c97e5d81c4917a57e3ed4Behdad Esfahbod * lookup_flags includes LookupFlags::IgnoreLigatures 2076f425b11799aa20dab553085f05744191b7318e2Behdad Esfahbod */ 2084189b92aaa41e4a1756c561cc6e08b0ed024afdaBehdad Esfahbod if (property & lookup_flags) 2096f425b11799aa20dab553085f05744191b7318e2Behdad Esfahbod return false; 2106f425b11799aa20dab553085f05744191b7318e2Behdad Esfahbod 2114189b92aaa41e4a1756c561cc6e08b0ed024afdaBehdad Esfahbod if (property & HB_OT_LAYOUT_GLYPH_CLASS_MARK) 212590d55cbb9e21ef74dfd88eee51fd0a763958cd2Behdad Esfahbod { 2131246e41021ab1d782b4c97e5d81c4917a57e3ed4Behdad Esfahbod /* If using mark filtering sets, the high short of 2144189b92aaa41e4a1756c561cc6e08b0ed024afdaBehdad Esfahbod * lookup_flags has the set index. 2151246e41021ab1d782b4c97e5d81c4917a57e3ed4Behdad Esfahbod */ 2161246e41021ab1d782b4c97e5d81c4917a57e3ed4Behdad Esfahbod if (lookup_flags & LookupFlag::UseMarkFilteringSet) 2171246e41021ab1d782b4c97e5d81c4917a57e3ed4Behdad Esfahbod return layout->gdef->mark_set_covers (lookup_flags >> 16, ginfo->gindex); 2181246e41021ab1d782b4c97e5d81c4917a57e3ed4Behdad Esfahbod 2191246e41021ab1d782b4c97e5d81c4917a57e3ed4Behdad Esfahbod /* The second byte of lookup_flags has the meaning 2201246e41021ab1d782b4c97e5d81c4917a57e3ed4Behdad Esfahbod * "ignore marks of attachment type different than 2211246e41021ab1d782b4c97e5d81c4917a57e3ed4Behdad Esfahbod * the attachment type specified." 2221246e41021ab1d782b4c97e5d81c4917a57e3ed4Behdad Esfahbod */ 2234189b92aaa41e4a1756c561cc6e08b0ed024afdaBehdad Esfahbod if (lookup_flags & LookupFlag::MarkAttachmentType && property & LookupFlag::MarkAttachmentType) 2244189b92aaa41e4a1756c561cc6e08b0ed024afdaBehdad Esfahbod return (lookup_flags & LookupFlag::MarkAttachmentType) == (property & LookupFlag::MarkAttachmentType); 225590d55cbb9e21ef74dfd88eee51fd0a763958cd2Behdad Esfahbod } 226590d55cbb9e21ef74dfd88eee51fd0a763958cd2Behdad Esfahbod 2276f425b11799aa20dab553085f05744191b7318e2Behdad Esfahbod return true; 228590d55cbb9e21ef74dfd88eee51fd0a763958cd2Behdad Esfahbod} 229590d55cbb9e21ef74dfd88eee51fd0a763958cd2Behdad Esfahbod 2304189b92aaa41e4a1756c561cc6e08b0ed024afdaBehdad EsfahbodHB_INTERNAL hb_bool_t 2314189b92aaa41e4a1756c561cc6e08b0ed024afdaBehdad Esfahbod_hb_ot_layout_skip_mark (hb_ot_layout_t *layout, 2324189b92aaa41e4a1756c561cc6e08b0ed024afdaBehdad Esfahbod hb_glyph_info_t *ginfo, 2334189b92aaa41e4a1756c561cc6e08b0ed024afdaBehdad Esfahbod unsigned int lookup_flags, 2344189b92aaa41e4a1756c561cc6e08b0ed024afdaBehdad Esfahbod unsigned int *property_out) 2354189b92aaa41e4a1756c561cc6e08b0ed024afdaBehdad Esfahbod{ 2364189b92aaa41e4a1756c561cc6e08b0ed024afdaBehdad Esfahbod unsigned int property; 2374189b92aaa41e4a1756c561cc6e08b0ed024afdaBehdad Esfahbod 2384189b92aaa41e4a1756c561cc6e08b0ed024afdaBehdad Esfahbod if (ginfo->gproperty == HB_BUFFER_GLYPH_PROPERTIES_UNKNOWN) 2394189b92aaa41e4a1756c561cc6e08b0ed024afdaBehdad Esfahbod ginfo->gproperty = _hb_ot_layout_get_glyph_property (layout, ginfo->gindex); 2404189b92aaa41e4a1756c561cc6e08b0ed024afdaBehdad Esfahbod property = ginfo->gproperty; 2414189b92aaa41e4a1756c561cc6e08b0ed024afdaBehdad Esfahbod if (property_out) 2424189b92aaa41e4a1756c561cc6e08b0ed024afdaBehdad Esfahbod *property_out = property; 2434189b92aaa41e4a1756c561cc6e08b0ed024afdaBehdad Esfahbod 2444189b92aaa41e4a1756c561cc6e08b0ed024afdaBehdad Esfahbod if (property & HB_OT_LAYOUT_GLYPH_CLASS_MARK) 2454189b92aaa41e4a1756c561cc6e08b0ed024afdaBehdad Esfahbod { 2464189b92aaa41e4a1756c561cc6e08b0ed024afdaBehdad Esfahbod /* Skip mark if lookup_flags includes LookupFlags::IgnoreMarks */ 2474189b92aaa41e4a1756c561cc6e08b0ed024afdaBehdad Esfahbod if (lookup_flags & LookupFlag::IgnoreMarks) 2484189b92aaa41e4a1756c561cc6e08b0ed024afdaBehdad Esfahbod return true; 2494189b92aaa41e4a1756c561cc6e08b0ed024afdaBehdad Esfahbod 2504189b92aaa41e4a1756c561cc6e08b0ed024afdaBehdad Esfahbod /* If using mark filtering sets, the high short of lookup_flags has the set index. */ 2514189b92aaa41e4a1756c561cc6e08b0ed024afdaBehdad Esfahbod if (lookup_flags & LookupFlag::UseMarkFilteringSet) 2524189b92aaa41e4a1756c561cc6e08b0ed024afdaBehdad Esfahbod return !layout->gdef->mark_set_covers (lookup_flags >> 16, ginfo->gindex); 2534189b92aaa41e4a1756c561cc6e08b0ed024afdaBehdad Esfahbod 2544189b92aaa41e4a1756c561cc6e08b0ed024afdaBehdad Esfahbod /* The second byte of lookup_flags has the meaning "ignore marks of attachment type 2554189b92aaa41e4a1756c561cc6e08b0ed024afdaBehdad Esfahbod * different than the attachment type specified." */ 2564189b92aaa41e4a1756c561cc6e08b0ed024afdaBehdad Esfahbod if (lookup_flags & LookupFlag::MarkAttachmentType && property & LookupFlag::MarkAttachmentType) 2574189b92aaa41e4a1756c561cc6e08b0ed024afdaBehdad Esfahbod return (lookup_flags & LookupFlag::MarkAttachmentType) != (property & LookupFlag::MarkAttachmentType); 2584189b92aaa41e4a1756c561cc6e08b0ed024afdaBehdad Esfahbod } 2594189b92aaa41e4a1756c561cc6e08b0ed024afdaBehdad Esfahbod 2604189b92aaa41e4a1756c561cc6e08b0ed024afdaBehdad Esfahbod return false; 2614189b92aaa41e4a1756c561cc6e08b0ed024afdaBehdad Esfahbod} 2624189b92aaa41e4a1756c561cc6e08b0ed024afdaBehdad Esfahbod 263347f0b8621d3adfec157e5634ff3defc818ea37fBehdad EsfahbodHB_INTERNAL void 26430bd763fa2fa4aceee51433ec9fc8dc28480b5d7Behdad Esfahbod_hb_ot_layout_set_glyph_property (hb_ot_layout_t *layout, 26530bd763fa2fa4aceee51433ec9fc8dc28480b5d7Behdad Esfahbod hb_codepoint_t glyph, 26630bd763fa2fa4aceee51433ec9fc8dc28480b5d7Behdad Esfahbod unsigned int property) 2671246e41021ab1d782b4c97e5d81c4917a57e3ed4Behdad Esfahbod{ hb_ot_layout_set_glyph_class (layout, glyph, (hb_ot_layout_glyph_class_t) (property & 0xff)); } 26830bd763fa2fa4aceee51433ec9fc8dc28480b5d7Behdad Esfahbod 269590d55cbb9e21ef74dfd88eee51fd0a763958cd2Behdad Esfahbod 270aff831ed6787abe8e24a977e34d97ff2e0b7dc21Behdad Esfahbodhb_ot_layout_glyph_class_t 271e50c3978d37b2c0d6ddd4ced6a6196f6857cd596Behdad Esfahbodhb_ot_layout_get_glyph_class (hb_ot_layout_t *layout, 2722d15e72c75931398db5e027e660f1320bb979117Behdad Esfahbod hb_codepoint_t glyph) 2731246e41021ab1d782b4c97e5d81c4917a57e3ed4Behdad Esfahbod{ return (hb_ot_layout_glyph_class_t) (_hb_ot_layout_get_glyph_property (layout, glyph) & 0xff); } 274ead428d7a0bf4dc84340a99f3959e5cc58123e99Behdad Esfahbod 275aff831ed6787abe8e24a977e34d97ff2e0b7dc21Behdad Esfahbodvoid 276e50c3978d37b2c0d6ddd4ced6a6196f6857cd596Behdad Esfahbodhb_ot_layout_set_glyph_class (hb_ot_layout_t *layout, 2772d15e72c75931398db5e027e660f1320bb979117Behdad Esfahbod hb_codepoint_t glyph, 278aff831ed6787abe8e24a977e34d97ff2e0b7dc21Behdad Esfahbod hb_ot_layout_glyph_class_t klass) 279aff831ed6787abe8e24a977e34d97ff2e0b7dc21Behdad Esfahbod{ 280aff831ed6787abe8e24a977e34d97ff2e0b7dc21Behdad Esfahbod /* TODO optimize this, similar to old harfbuzz code for example */ 281aff831ed6787abe8e24a977e34d97ff2e0b7dc21Behdad Esfahbod 282aff831ed6787abe8e24a977e34d97ff2e0b7dc21Behdad Esfahbod hb_ot_layout_class_t gdef_klass; 283aff831ed6787abe8e24a977e34d97ff2e0b7dc21Behdad Esfahbod int len = layout->new_gdef.len; 284aff831ed6787abe8e24a977e34d97ff2e0b7dc21Behdad Esfahbod 2854acaffd786a11b5bd7d41b39fc65625fd8cd5077Behdad Esfahbod if (HB_UNLIKELY (glyph > 65535)) 28630bd763fa2fa4aceee51433ec9fc8dc28480b5d7Behdad Esfahbod return; 28730bd763fa2fa4aceee51433ec9fc8dc28480b5d7Behdad Esfahbod 288aff831ed6787abe8e24a977e34d97ff2e0b7dc21Behdad Esfahbod if (glyph >= len) { 289aff831ed6787abe8e24a977e34d97ff2e0b7dc21Behdad Esfahbod int new_len; 290590d55cbb9e21ef74dfd88eee51fd0a763958cd2Behdad Esfahbod unsigned char *new_klasses; 291aff831ed6787abe8e24a977e34d97ff2e0b7dc21Behdad Esfahbod 292aff831ed6787abe8e24a977e34d97ff2e0b7dc21Behdad Esfahbod new_len = len == 0 ? 120 : 2 * len; 293aff831ed6787abe8e24a977e34d97ff2e0b7dc21Behdad Esfahbod if (new_len > 65535) 294aff831ed6787abe8e24a977e34d97ff2e0b7dc21Behdad Esfahbod new_len = 65535; 295590d55cbb9e21ef74dfd88eee51fd0a763958cd2Behdad Esfahbod new_klasses = (unsigned char *) realloc (layout->new_gdef.klasses, new_len * sizeof (unsigned char)); 296aff831ed6787abe8e24a977e34d97ff2e0b7dc21Behdad Esfahbod 2974acaffd786a11b5bd7d41b39fc65625fd8cd5077Behdad Esfahbod if (HB_UNLIKELY (!new_klasses)) 298aff831ed6787abe8e24a977e34d97ff2e0b7dc21Behdad Esfahbod return; 299ce48f03946bef895912019046bdbe62bb1301d0bBehdad Esfahbod 300aff831ed6787abe8e24a977e34d97ff2e0b7dc21Behdad Esfahbod memset (new_klasses + len, 0, new_len - len); 301aff831ed6787abe8e24a977e34d97ff2e0b7dc21Behdad Esfahbod 302aff831ed6787abe8e24a977e34d97ff2e0b7dc21Behdad Esfahbod layout->new_gdef.klasses = new_klasses; 303aff831ed6787abe8e24a977e34d97ff2e0b7dc21Behdad Esfahbod layout->new_gdef.len = new_len; 304aff831ed6787abe8e24a977e34d97ff2e0b7dc21Behdad Esfahbod } 305aff831ed6787abe8e24a977e34d97ff2e0b7dc21Behdad Esfahbod 306aff831ed6787abe8e24a977e34d97ff2e0b7dc21Behdad Esfahbod switch (klass) { 307aff831ed6787abe8e24a977e34d97ff2e0b7dc21Behdad Esfahbod default: 308aff831ed6787abe8e24a977e34d97ff2e0b7dc21Behdad Esfahbod case HB_OT_LAYOUT_GLYPH_CLASS_UNCLASSIFIED: gdef_klass = GDEF::UnclassifiedGlyph; break; 309aff831ed6787abe8e24a977e34d97ff2e0b7dc21Behdad Esfahbod case HB_OT_LAYOUT_GLYPH_CLASS_BASE_GLYPH: gdef_klass = GDEF::BaseGlyph; break; 310aff831ed6787abe8e24a977e34d97ff2e0b7dc21Behdad Esfahbod case HB_OT_LAYOUT_GLYPH_CLASS_LIGATURE: gdef_klass = GDEF::LigatureGlyph; break; 311aff831ed6787abe8e24a977e34d97ff2e0b7dc21Behdad Esfahbod case HB_OT_LAYOUT_GLYPH_CLASS_MARK: gdef_klass = GDEF::MarkGlyph; break; 312aff831ed6787abe8e24a977e34d97ff2e0b7dc21Behdad Esfahbod case HB_OT_LAYOUT_GLYPH_CLASS_COMPONENT: gdef_klass = GDEF::ComponentGlyph; break; 313aff831ed6787abe8e24a977e34d97ff2e0b7dc21Behdad Esfahbod } 314aff831ed6787abe8e24a977e34d97ff2e0b7dc21Behdad Esfahbod 315aff831ed6787abe8e24a977e34d97ff2e0b7dc21Behdad Esfahbod layout->new_gdef.klasses[glyph] = gdef_klass; 316aff831ed6787abe8e24a977e34d97ff2e0b7dc21Behdad Esfahbod return; 317aff831ed6787abe8e24a977e34d97ff2e0b7dc21Behdad Esfahbod} 318590d55cbb9e21ef74dfd88eee51fd0a763958cd2Behdad Esfahbod 319590d55cbb9e21ef74dfd88eee51fd0a763958cd2Behdad Esfahbodvoid 320e50c3978d37b2c0d6ddd4ced6a6196f6857cd596Behdad Esfahbodhb_ot_layout_build_glyph_classes (hb_ot_layout_t *layout, 321e50c3978d37b2c0d6ddd4ced6a6196f6857cd596Behdad Esfahbod uint16_t num_total_glyphs, 3222d15e72c75931398db5e027e660f1320bb979117Behdad Esfahbod hb_codepoint_t *glyphs, 323e50c3978d37b2c0d6ddd4ced6a6196f6857cd596Behdad Esfahbod unsigned char *klasses, 324e50c3978d37b2c0d6ddd4ced6a6196f6857cd596Behdad Esfahbod uint16_t count) 325590d55cbb9e21ef74dfd88eee51fd0a763958cd2Behdad Esfahbod{ 3264acaffd786a11b5bd7d41b39fc65625fd8cd5077Behdad Esfahbod if (HB_UNLIKELY (!count || !glyphs || !klasses)) 327590d55cbb9e21ef74dfd88eee51fd0a763958cd2Behdad Esfahbod return; 328590d55cbb9e21ef74dfd88eee51fd0a763958cd2Behdad Esfahbod 329590d55cbb9e21ef74dfd88eee51fd0a763958cd2Behdad Esfahbod if (layout->new_gdef.len == 0) { 330590d55cbb9e21ef74dfd88eee51fd0a763958cd2Behdad Esfahbod layout->new_gdef.klasses = (unsigned char *) calloc (num_total_glyphs, sizeof (unsigned char)); 331590d55cbb9e21ef74dfd88eee51fd0a763958cd2Behdad Esfahbod layout->new_gdef.len = count; 332590d55cbb9e21ef74dfd88eee51fd0a763958cd2Behdad Esfahbod } 333590d55cbb9e21ef74dfd88eee51fd0a763958cd2Behdad Esfahbod 334f4c9514935cf97a58dcb3b1962ac3f3b5ba61264Behdad Esfahbod for (unsigned int i = 0; i < count; i++) 335590d55cbb9e21ef74dfd88eee51fd0a763958cd2Behdad Esfahbod hb_ot_layout_set_glyph_class (layout, glyphs[i], (hb_ot_layout_glyph_class_t) klasses[i]); 336590d55cbb9e21ef74dfd88eee51fd0a763958cd2Behdad Esfahbod} 337706ab25a4cb043d46e6088aa0a7184ee200276c9Behdad Esfahbod 33862964afcecd96038cfaa8bc2bc931f43ee83be7eBehdad Esfahbodhb_bool_t 33979420ad9caf2d5fc94c3693e8292edfa27060b2dBehdad Esfahbodhb_ot_layout_get_attach_points (hb_ot_layout_t *layout, 34079420ad9caf2d5fc94c3693e8292edfa27060b2dBehdad Esfahbod hb_codepoint_t glyph, 34179420ad9caf2d5fc94c3693e8292edfa27060b2dBehdad Esfahbod unsigned int *point_count /* IN/OUT */, 34279420ad9caf2d5fc94c3693e8292edfa27060b2dBehdad Esfahbod unsigned int *point_array /* OUT */) 34379420ad9caf2d5fc94c3693e8292edfa27060b2dBehdad Esfahbod{ 344e4b92b85a7750bd4271ad607b3c41f0184e89febBehdad Esfahbod return layout->gdef->get_attach_points (glyph, point_count, point_array); 34562964afcecd96038cfaa8bc2bc931f43ee83be7eBehdad Esfahbod} 34662964afcecd96038cfaa8bc2bc931f43ee83be7eBehdad Esfahbod 34762964afcecd96038cfaa8bc2bc931f43ee83be7eBehdad Esfahbodhb_bool_t 34862964afcecd96038cfaa8bc2bc931f43ee83be7eBehdad Esfahbodhb_ot_layout_get_lig_carets (hb_ot_layout_t *layout, 34962964afcecd96038cfaa8bc2bc931f43ee83be7eBehdad Esfahbod hb_codepoint_t glyph, 35062964afcecd96038cfaa8bc2bc931f43ee83be7eBehdad Esfahbod unsigned int *caret_count /* IN/OUT */, 35162964afcecd96038cfaa8bc2bc931f43ee83be7eBehdad Esfahbod int *caret_array /* OUT */) 35262964afcecd96038cfaa8bc2bc931f43ee83be7eBehdad Esfahbod{ 35362964afcecd96038cfaa8bc2bc931f43ee83be7eBehdad Esfahbod return layout->gdef->get_lig_carets (layout, glyph, caret_count, caret_array); 35479420ad9caf2d5fc94c3693e8292edfa27060b2dBehdad Esfahbod} 35579420ad9caf2d5fc94c3693e8292edfa27060b2dBehdad Esfahbod 356706ab25a4cb043d46e6088aa0a7184ee200276c9Behdad Esfahbod/* 357706ab25a4cb043d46e6088aa0a7184ee200276c9Behdad Esfahbod * GSUB/GPOS 358706ab25a4cb043d46e6088aa0a7184ee200276c9Behdad Esfahbod */ 359706ab25a4cb043d46e6088aa0a7184ee200276c9Behdad Esfahbod 360706ab25a4cb043d46e6088aa0a7184ee200276c9Behdad Esfahbodstatic const GSUBGPOS& 361706ab25a4cb043d46e6088aa0a7184ee200276c9Behdad Esfahbodget_gsubgpos_table (hb_ot_layout_t *layout, 362706ab25a4cb043d46e6088aa0a7184ee200276c9Behdad Esfahbod hb_ot_layout_table_type_t table_type) 363706ab25a4cb043d46e6088aa0a7184ee200276c9Behdad Esfahbod{ 364706ab25a4cb043d46e6088aa0a7184ee200276c9Behdad Esfahbod switch (table_type) { 365706ab25a4cb043d46e6088aa0a7184ee200276c9Behdad Esfahbod case HB_OT_LAYOUT_TABLE_TYPE_GSUB: return *(layout->gsub); 366706ab25a4cb043d46e6088aa0a7184ee200276c9Behdad Esfahbod case HB_OT_LAYOUT_TABLE_TYPE_GPOS: return *(layout->gpos); 3678b8358033184198ff638ee1379093717596e162dBehdad Esfahbod default: return Null(GSUBGPOS); 368706ab25a4cb043d46e6088aa0a7184ee200276c9Behdad Esfahbod } 369706ab25a4cb043d46e6088aa0a7184ee200276c9Behdad Esfahbod} 370706ab25a4cb043d46e6088aa0a7184ee200276c9Behdad Esfahbod 371706ab25a4cb043d46e6088aa0a7184ee200276c9Behdad Esfahbod 372706ab25a4cb043d46e6088aa0a7184ee200276c9Behdad Esfahbodunsigned int 373c44733596c6648e209c12349e18e35424edf3d59Behdad Esfahbodhb_ot_layout_table_get_script_count (hb_ot_layout_t *layout, 374c44733596c6648e209c12349e18e35424edf3d59Behdad Esfahbod hb_ot_layout_table_type_t table_type) 375706ab25a4cb043d46e6088aa0a7184ee200276c9Behdad Esfahbod{ 376706ab25a4cb043d46e6088aa0a7184ee200276c9Behdad Esfahbod const GSUBGPOS &g = get_gsubgpos_table (layout, table_type); 377706ab25a4cb043d46e6088aa0a7184ee200276c9Behdad Esfahbod 378706ab25a4cb043d46e6088aa0a7184ee200276c9Behdad Esfahbod return g.get_script_count (); 379706ab25a4cb043d46e6088aa0a7184ee200276c9Behdad Esfahbod} 380706ab25a4cb043d46e6088aa0a7184ee200276c9Behdad Esfahbod 381706ab25a4cb043d46e6088aa0a7184ee200276c9Behdad Esfahbodhb_tag_t 382c44733596c6648e209c12349e18e35424edf3d59Behdad Esfahbodhb_ot_layout_table_get_script_tag (hb_ot_layout_t *layout, 383c44733596c6648e209c12349e18e35424edf3d59Behdad Esfahbod hb_ot_layout_table_type_t table_type, 384c44733596c6648e209c12349e18e35424edf3d59Behdad Esfahbod unsigned int script_index) 385706ab25a4cb043d46e6088aa0a7184ee200276c9Behdad Esfahbod{ 386706ab25a4cb043d46e6088aa0a7184ee200276c9Behdad Esfahbod const GSUBGPOS &g = get_gsubgpos_table (layout, table_type); 387706ab25a4cb043d46e6088aa0a7184ee200276c9Behdad Esfahbod 388706ab25a4cb043d46e6088aa0a7184ee200276c9Behdad Esfahbod return g.get_script_tag (script_index); 389706ab25a4cb043d46e6088aa0a7184ee200276c9Behdad Esfahbod} 390706ab25a4cb043d46e6088aa0a7184ee200276c9Behdad Esfahbod 391706ab25a4cb043d46e6088aa0a7184ee200276c9Behdad Esfahbodhb_bool_t 392c44733596c6648e209c12349e18e35424edf3d59Behdad Esfahbodhb_ot_layout_table_find_script (hb_ot_layout_t *layout, 393c44733596c6648e209c12349e18e35424edf3d59Behdad Esfahbod hb_ot_layout_table_type_t table_type, 394c44733596c6648e209c12349e18e35424edf3d59Behdad Esfahbod hb_tag_t script_tag, 395c44733596c6648e209c12349e18e35424edf3d59Behdad Esfahbod unsigned int *script_index) 396706ab25a4cb043d46e6088aa0a7184ee200276c9Behdad Esfahbod{ 3974a26ea408c87f0bb59deca9ff44008d138471aa3Behdad Esfahbod ASSERT_STATIC (NO_INDEX == HB_OT_LAYOUT_NO_SCRIPT_INDEX); 398706ab25a4cb043d46e6088aa0a7184ee200276c9Behdad Esfahbod const GSUBGPOS &g = get_gsubgpos_table (layout, table_type); 399706ab25a4cb043d46e6088aa0a7184ee200276c9Behdad Esfahbod 400706ab25a4cb043d46e6088aa0a7184ee200276c9Behdad Esfahbod if (g.find_script_index (script_tag, script_index)) 401706ab25a4cb043d46e6088aa0a7184ee200276c9Behdad Esfahbod return TRUE; 402706ab25a4cb043d46e6088aa0a7184ee200276c9Behdad Esfahbod 403706ab25a4cb043d46e6088aa0a7184ee200276c9Behdad Esfahbod /* try finding 'DFLT' */ 404706ab25a4cb043d46e6088aa0a7184ee200276c9Behdad Esfahbod if (g.find_script_index (HB_OT_LAYOUT_TAG_DEFAULT_SCRIPT, script_index)) 405706ab25a4cb043d46e6088aa0a7184ee200276c9Behdad Esfahbod return FALSE; 406706ab25a4cb043d46e6088aa0a7184ee200276c9Behdad Esfahbod 407706ab25a4cb043d46e6088aa0a7184ee200276c9Behdad Esfahbod /* try with 'dflt'; MS site has had typos and many fonts use it now :( */ 408706ab25a4cb043d46e6088aa0a7184ee200276c9Behdad Esfahbod if (g.find_script_index (HB_OT_LAYOUT_TAG_DEFAULT_LANGUAGE, script_index)) 409706ab25a4cb043d46e6088aa0a7184ee200276c9Behdad Esfahbod return FALSE; 410706ab25a4cb043d46e6088aa0a7184ee200276c9Behdad Esfahbod 411706ab25a4cb043d46e6088aa0a7184ee200276c9Behdad Esfahbod if (script_index) *script_index = HB_OT_LAYOUT_NO_SCRIPT_INDEX; 412706ab25a4cb043d46e6088aa0a7184ee200276c9Behdad Esfahbod return FALSE; 413706ab25a4cb043d46e6088aa0a7184ee200276c9Behdad Esfahbod} 414706ab25a4cb043d46e6088aa0a7184ee200276c9Behdad Esfahbod 415706ab25a4cb043d46e6088aa0a7184ee200276c9Behdad Esfahbodunsigned int 416c44733596c6648e209c12349e18e35424edf3d59Behdad Esfahbodhb_ot_layout_table_get_feature_count (hb_ot_layout_t *layout, 417c44733596c6648e209c12349e18e35424edf3d59Behdad Esfahbod hb_ot_layout_table_type_t table_type) 418c44733596c6648e209c12349e18e35424edf3d59Behdad Esfahbod{ 419c44733596c6648e209c12349e18e35424edf3d59Behdad Esfahbod const GSUBGPOS &g = get_gsubgpos_table (layout, table_type); 420c44733596c6648e209c12349e18e35424edf3d59Behdad Esfahbod 421c44733596c6648e209c12349e18e35424edf3d59Behdad Esfahbod return g.get_feature_count (); 422c44733596c6648e209c12349e18e35424edf3d59Behdad Esfahbod} 423c44733596c6648e209c12349e18e35424edf3d59Behdad Esfahbod 424c44733596c6648e209c12349e18e35424edf3d59Behdad Esfahbodhb_tag_t 425c44733596c6648e209c12349e18e35424edf3d59Behdad Esfahbodhb_ot_layout_table_get_feature_tag (hb_ot_layout_t *layout, 426c44733596c6648e209c12349e18e35424edf3d59Behdad Esfahbod hb_ot_layout_table_type_t table_type, 427c44733596c6648e209c12349e18e35424edf3d59Behdad Esfahbod unsigned int feature_index) 428c44733596c6648e209c12349e18e35424edf3d59Behdad Esfahbod{ 429c44733596c6648e209c12349e18e35424edf3d59Behdad Esfahbod const GSUBGPOS &g = get_gsubgpos_table (layout, table_type); 430c44733596c6648e209c12349e18e35424edf3d59Behdad Esfahbod 431c44733596c6648e209c12349e18e35424edf3d59Behdad Esfahbod return g.get_feature_tag (feature_index); 432c44733596c6648e209c12349e18e35424edf3d59Behdad Esfahbod} 433c44733596c6648e209c12349e18e35424edf3d59Behdad Esfahbod 434c44733596c6648e209c12349e18e35424edf3d59Behdad Esfahbodhb_bool_t 435c44733596c6648e209c12349e18e35424edf3d59Behdad Esfahbodhb_ot_layout_table_find_feature (hb_ot_layout_t *layout, 436706ab25a4cb043d46e6088aa0a7184ee200276c9Behdad Esfahbod hb_ot_layout_table_type_t table_type, 437c44733596c6648e209c12349e18e35424edf3d59Behdad Esfahbod hb_tag_t feature_tag, 438c44733596c6648e209c12349e18e35424edf3d59Behdad Esfahbod unsigned int *feature_index) 439c44733596c6648e209c12349e18e35424edf3d59Behdad Esfahbod{ 440c44733596c6648e209c12349e18e35424edf3d59Behdad Esfahbod ASSERT_STATIC (NO_INDEX == HB_OT_LAYOUT_NO_FEATURE_INDEX); 441c44733596c6648e209c12349e18e35424edf3d59Behdad Esfahbod const GSUBGPOS &g = get_gsubgpos_table (layout, table_type); 442c44733596c6648e209c12349e18e35424edf3d59Behdad Esfahbod 443c44733596c6648e209c12349e18e35424edf3d59Behdad Esfahbod if (g.find_feature_index (feature_tag, feature_index)) 444c44733596c6648e209c12349e18e35424edf3d59Behdad Esfahbod return TRUE; 445c44733596c6648e209c12349e18e35424edf3d59Behdad Esfahbod 446c44733596c6648e209c12349e18e35424edf3d59Behdad Esfahbod if (feature_index) *feature_index = HB_OT_LAYOUT_NO_FEATURE_INDEX; 447c44733596c6648e209c12349e18e35424edf3d59Behdad Esfahbod return FALSE; 448c44733596c6648e209c12349e18e35424edf3d59Behdad Esfahbod} 449c44733596c6648e209c12349e18e35424edf3d59Behdad Esfahbod 450c44733596c6648e209c12349e18e35424edf3d59Behdad Esfahbodunsigned int 451c44733596c6648e209c12349e18e35424edf3d59Behdad Esfahbodhb_ot_layout_table_get_lookup_count (hb_ot_layout_t *layout, 452c44733596c6648e209c12349e18e35424edf3d59Behdad Esfahbod hb_ot_layout_table_type_t table_type) 453c44733596c6648e209c12349e18e35424edf3d59Behdad Esfahbod{ 454c44733596c6648e209c12349e18e35424edf3d59Behdad Esfahbod const GSUBGPOS &g = get_gsubgpos_table (layout, table_type); 455c44733596c6648e209c12349e18e35424edf3d59Behdad Esfahbod 456c44733596c6648e209c12349e18e35424edf3d59Behdad Esfahbod return g.get_lookup_count (); 457c44733596c6648e209c12349e18e35424edf3d59Behdad Esfahbod} 458c44733596c6648e209c12349e18e35424edf3d59Behdad Esfahbod 459c44733596c6648e209c12349e18e35424edf3d59Behdad Esfahbod 460c44733596c6648e209c12349e18e35424edf3d59Behdad Esfahbodunsigned int 461c44733596c6648e209c12349e18e35424edf3d59Behdad Esfahbodhb_ot_layout_script_get_language_count (hb_ot_layout_t *layout, 462c44733596c6648e209c12349e18e35424edf3d59Behdad Esfahbod hb_ot_layout_table_type_t table_type, 463c44733596c6648e209c12349e18e35424edf3d59Behdad Esfahbod unsigned int script_index) 464706ab25a4cb043d46e6088aa0a7184ee200276c9Behdad Esfahbod{ 465706ab25a4cb043d46e6088aa0a7184ee200276c9Behdad Esfahbod const Script &s = get_gsubgpos_table (layout, table_type).get_script (script_index); 466706ab25a4cb043d46e6088aa0a7184ee200276c9Behdad Esfahbod 467706ab25a4cb043d46e6088aa0a7184ee200276c9Behdad Esfahbod return s.get_lang_sys_count (); 468706ab25a4cb043d46e6088aa0a7184ee200276c9Behdad Esfahbod} 469706ab25a4cb043d46e6088aa0a7184ee200276c9Behdad Esfahbod 470706ab25a4cb043d46e6088aa0a7184ee200276c9Behdad Esfahbodhb_tag_t 471c44733596c6648e209c12349e18e35424edf3d59Behdad Esfahbodhb_ot_layout_script_get_language_tag (hb_ot_layout_t *layout, 472c44733596c6648e209c12349e18e35424edf3d59Behdad Esfahbod hb_ot_layout_table_type_t table_type, 473c44733596c6648e209c12349e18e35424edf3d59Behdad Esfahbod unsigned int script_index, 474c44733596c6648e209c12349e18e35424edf3d59Behdad Esfahbod unsigned int language_index) 475706ab25a4cb043d46e6088aa0a7184ee200276c9Behdad Esfahbod{ 476706ab25a4cb043d46e6088aa0a7184ee200276c9Behdad Esfahbod const Script &s = get_gsubgpos_table (layout, table_type).get_script (script_index); 477706ab25a4cb043d46e6088aa0a7184ee200276c9Behdad Esfahbod 478706ab25a4cb043d46e6088aa0a7184ee200276c9Behdad Esfahbod return s.get_lang_sys_tag (language_index); 479706ab25a4cb043d46e6088aa0a7184ee200276c9Behdad Esfahbod} 480706ab25a4cb043d46e6088aa0a7184ee200276c9Behdad Esfahbod 481706ab25a4cb043d46e6088aa0a7184ee200276c9Behdad Esfahbodhb_bool_t 482c44733596c6648e209c12349e18e35424edf3d59Behdad Esfahbodhb_ot_layout_script_find_language (hb_ot_layout_t *layout, 483c44733596c6648e209c12349e18e35424edf3d59Behdad Esfahbod hb_ot_layout_table_type_t table_type, 484c44733596c6648e209c12349e18e35424edf3d59Behdad Esfahbod unsigned int script_index, 485c44733596c6648e209c12349e18e35424edf3d59Behdad Esfahbod hb_tag_t language_tag, 486c44733596c6648e209c12349e18e35424edf3d59Behdad Esfahbod unsigned int *language_index) 487706ab25a4cb043d46e6088aa0a7184ee200276c9Behdad Esfahbod{ 4884a26ea408c87f0bb59deca9ff44008d138471aa3Behdad Esfahbod ASSERT_STATIC (NO_INDEX == HB_OT_LAYOUT_DEFAULT_LANGUAGE_INDEX); 489706ab25a4cb043d46e6088aa0a7184ee200276c9Behdad Esfahbod const Script &s = get_gsubgpos_table (layout, table_type).get_script (script_index); 490706ab25a4cb043d46e6088aa0a7184ee200276c9Behdad Esfahbod 4914a26ea408c87f0bb59deca9ff44008d138471aa3Behdad Esfahbod if (s.find_lang_sys_index (language_tag, language_index)) 492706ab25a4cb043d46e6088aa0a7184ee200276c9Behdad Esfahbod return TRUE; 493706ab25a4cb043d46e6088aa0a7184ee200276c9Behdad Esfahbod 494706ab25a4cb043d46e6088aa0a7184ee200276c9Behdad Esfahbod /* try with 'dflt'; MS site has had typos and many fonts use it now :( */ 4954a26ea408c87f0bb59deca9ff44008d138471aa3Behdad Esfahbod if (s.find_lang_sys_index (HB_OT_LAYOUT_TAG_DEFAULT_LANGUAGE, language_index)) 496706ab25a4cb043d46e6088aa0a7184ee200276c9Behdad Esfahbod return FALSE; 497706ab25a4cb043d46e6088aa0a7184ee200276c9Behdad Esfahbod 4984a26ea408c87f0bb59deca9ff44008d138471aa3Behdad Esfahbod if (language_index) *language_index = HB_OT_LAYOUT_DEFAULT_LANGUAGE_INDEX; 499706ab25a4cb043d46e6088aa0a7184ee200276c9Behdad Esfahbod return FALSE; 5004a26ea408c87f0bb59deca9ff44008d138471aa3Behdad Esfahbod} 501706ab25a4cb043d46e6088aa0a7184ee200276c9Behdad Esfahbod 5024a26ea408c87f0bb59deca9ff44008d138471aa3Behdad Esfahbodhb_bool_t 503c44733596c6648e209c12349e18e35424edf3d59Behdad Esfahbodhb_ot_layout_language_get_required_feature_index (hb_ot_layout_t *layout, 504c44733596c6648e209c12349e18e35424edf3d59Behdad Esfahbod hb_ot_layout_table_type_t table_type, 505c44733596c6648e209c12349e18e35424edf3d59Behdad Esfahbod unsigned int script_index, 506c44733596c6648e209c12349e18e35424edf3d59Behdad Esfahbod unsigned int language_index, 507c44733596c6648e209c12349e18e35424edf3d59Behdad Esfahbod unsigned int *feature_index) 5084a26ea408c87f0bb59deca9ff44008d138471aa3Behdad Esfahbod{ 5094a26ea408c87f0bb59deca9ff44008d138471aa3Behdad Esfahbod const LangSys &l = get_gsubgpos_table (layout, table_type).get_script (script_index).get_lang_sys (language_index); 510706ab25a4cb043d46e6088aa0a7184ee200276c9Behdad Esfahbod 5114a26ea408c87f0bb59deca9ff44008d138471aa3Behdad Esfahbod if (feature_index) *feature_index = l.get_required_feature_index (); 512706ab25a4cb043d46e6088aa0a7184ee200276c9Behdad Esfahbod 5134a26ea408c87f0bb59deca9ff44008d138471aa3Behdad Esfahbod return l.has_required_feature (); 5144a26ea408c87f0bb59deca9ff44008d138471aa3Behdad Esfahbod} 515706ab25a4cb043d46e6088aa0a7184ee200276c9Behdad Esfahbod 5164a26ea408c87f0bb59deca9ff44008d138471aa3Behdad Esfahbodunsigned int 517c44733596c6648e209c12349e18e35424edf3d59Behdad Esfahbodhb_ot_layout_language_get_feature_count (hb_ot_layout_t *layout, 518c44733596c6648e209c12349e18e35424edf3d59Behdad Esfahbod hb_ot_layout_table_type_t table_type, 519c44733596c6648e209c12349e18e35424edf3d59Behdad Esfahbod unsigned int script_index, 520c44733596c6648e209c12349e18e35424edf3d59Behdad Esfahbod unsigned int language_index) 5214a26ea408c87f0bb59deca9ff44008d138471aa3Behdad Esfahbod{ 5224a26ea408c87f0bb59deca9ff44008d138471aa3Behdad Esfahbod const LangSys &l = get_gsubgpos_table (layout, table_type).get_script (script_index).get_lang_sys (language_index); 5234a26ea408c87f0bb59deca9ff44008d138471aa3Behdad Esfahbod 5244a26ea408c87f0bb59deca9ff44008d138471aa3Behdad Esfahbod return l.get_feature_count (); 5254a26ea408c87f0bb59deca9ff44008d138471aa3Behdad Esfahbod} 5264a26ea408c87f0bb59deca9ff44008d138471aa3Behdad Esfahbod 527c44733596c6648e209c12349e18e35424edf3d59Behdad Esfahbodunsigned int 528c44733596c6648e209c12349e18e35424edf3d59Behdad Esfahbodhb_ot_layout_language_get_feature_index (hb_ot_layout_t *layout, 529c44733596c6648e209c12349e18e35424edf3d59Behdad Esfahbod hb_ot_layout_table_type_t table_type, 530c44733596c6648e209c12349e18e35424edf3d59Behdad Esfahbod unsigned int script_index, 531c44733596c6648e209c12349e18e35424edf3d59Behdad Esfahbod unsigned int language_index, 532c44733596c6648e209c12349e18e35424edf3d59Behdad Esfahbod unsigned int num_feature) 5334a26ea408c87f0bb59deca9ff44008d138471aa3Behdad Esfahbod{ 5344a26ea408c87f0bb59deca9ff44008d138471aa3Behdad Esfahbod const GSUBGPOS &g = get_gsubgpos_table (layout, table_type); 5354a26ea408c87f0bb59deca9ff44008d138471aa3Behdad Esfahbod const LangSys &l = g.get_script (script_index).get_lang_sys (language_index); 5364a26ea408c87f0bb59deca9ff44008d138471aa3Behdad Esfahbod 537c44733596c6648e209c12349e18e35424edf3d59Behdad Esfahbod return l.get_feature_index (num_feature); 538c44733596c6648e209c12349e18e35424edf3d59Behdad Esfahbod} 539c44733596c6648e209c12349e18e35424edf3d59Behdad Esfahbod 540c44733596c6648e209c12349e18e35424edf3d59Behdad Esfahbodhb_tag_t 541c44733596c6648e209c12349e18e35424edf3d59Behdad Esfahbodhb_ot_layout_language_get_feature_tag (hb_ot_layout_t *layout, 542c44733596c6648e209c12349e18e35424edf3d59Behdad Esfahbod hb_ot_layout_table_type_t table_type, 543c44733596c6648e209c12349e18e35424edf3d59Behdad Esfahbod unsigned int script_index, 544c44733596c6648e209c12349e18e35424edf3d59Behdad Esfahbod unsigned int language_index, 545c44733596c6648e209c12349e18e35424edf3d59Behdad Esfahbod unsigned int num_feature) 546c44733596c6648e209c12349e18e35424edf3d59Behdad Esfahbod{ 547c44733596c6648e209c12349e18e35424edf3d59Behdad Esfahbod const GSUBGPOS &g = get_gsubgpos_table (layout, table_type); 548c44733596c6648e209c12349e18e35424edf3d59Behdad Esfahbod const LangSys &l = g.get_script (script_index).get_lang_sys (language_index); 549c44733596c6648e209c12349e18e35424edf3d59Behdad Esfahbod unsigned int feature_index = l.get_feature_index (num_feature); 5504a26ea408c87f0bb59deca9ff44008d138471aa3Behdad Esfahbod 5514a26ea408c87f0bb59deca9ff44008d138471aa3Behdad Esfahbod return g.get_feature_tag (feature_index); 5524a26ea408c87f0bb59deca9ff44008d138471aa3Behdad Esfahbod} 5534a26ea408c87f0bb59deca9ff44008d138471aa3Behdad Esfahbod 5544a26ea408c87f0bb59deca9ff44008d138471aa3Behdad Esfahbod 5554a26ea408c87f0bb59deca9ff44008d138471aa3Behdad Esfahbodhb_bool_t 556c44733596c6648e209c12349e18e35424edf3d59Behdad Esfahbodhb_ot_layout_language_find_feature (hb_ot_layout_t *layout, 557c44733596c6648e209c12349e18e35424edf3d59Behdad Esfahbod hb_ot_layout_table_type_t table_type, 558c44733596c6648e209c12349e18e35424edf3d59Behdad Esfahbod unsigned int script_index, 559c44733596c6648e209c12349e18e35424edf3d59Behdad Esfahbod unsigned int language_index, 560c44733596c6648e209c12349e18e35424edf3d59Behdad Esfahbod hb_tag_t feature_tag, 561c44733596c6648e209c12349e18e35424edf3d59Behdad Esfahbod unsigned int *feature_index) 5624a26ea408c87f0bb59deca9ff44008d138471aa3Behdad Esfahbod{ 5634a26ea408c87f0bb59deca9ff44008d138471aa3Behdad Esfahbod ASSERT_STATIC (NO_INDEX == HB_OT_LAYOUT_NO_FEATURE_INDEX); 5644a26ea408c87f0bb59deca9ff44008d138471aa3Behdad Esfahbod const GSUBGPOS &g = get_gsubgpos_table (layout, table_type); 5654a26ea408c87f0bb59deca9ff44008d138471aa3Behdad Esfahbod const LangSys &l = g.get_script (script_index).get_lang_sys (language_index); 5664a26ea408c87f0bb59deca9ff44008d138471aa3Behdad Esfahbod 567f4c9514935cf97a58dcb3b1962ac3f3b5ba61264Behdad Esfahbod unsigned int num_features = l.get_feature_count (); 568f4c9514935cf97a58dcb3b1962ac3f3b5ba61264Behdad Esfahbod for (unsigned int i = 0; i < num_features; i++) { 5694a26ea408c87f0bb59deca9ff44008d138471aa3Behdad Esfahbod unsigned int f_index = l.get_feature_index (i); 5704a26ea408c87f0bb59deca9ff44008d138471aa3Behdad Esfahbod 5714a26ea408c87f0bb59deca9ff44008d138471aa3Behdad Esfahbod if (feature_tag == g.get_feature_tag (f_index)) { 5724a26ea408c87f0bb59deca9ff44008d138471aa3Behdad Esfahbod if (feature_index) *feature_index = f_index; 5734a26ea408c87f0bb59deca9ff44008d138471aa3Behdad Esfahbod return TRUE; 5744a26ea408c87f0bb59deca9ff44008d138471aa3Behdad Esfahbod } 5754a26ea408c87f0bb59deca9ff44008d138471aa3Behdad Esfahbod } 576706ab25a4cb043d46e6088aa0a7184ee200276c9Behdad Esfahbod 5774a26ea408c87f0bb59deca9ff44008d138471aa3Behdad Esfahbod if (feature_index) *feature_index = HB_OT_LAYOUT_NO_FEATURE_INDEX; 578706ab25a4cb043d46e6088aa0a7184ee200276c9Behdad Esfahbod return FALSE; 579706ab25a4cb043d46e6088aa0a7184ee200276c9Behdad Esfahbod} 580c44733596c6648e209c12349e18e35424edf3d59Behdad Esfahbod 581c44733596c6648e209c12349e18e35424edf3d59Behdad Esfahbodunsigned int 582c44733596c6648e209c12349e18e35424edf3d59Behdad Esfahbodhb_ot_layout_feature_get_lookup_count (hb_ot_layout_t *layout, 583c44733596c6648e209c12349e18e35424edf3d59Behdad Esfahbod hb_ot_layout_table_type_t table_type, 584c44733596c6648e209c12349e18e35424edf3d59Behdad Esfahbod unsigned int feature_index) 585c44733596c6648e209c12349e18e35424edf3d59Behdad Esfahbod{ 586c44733596c6648e209c12349e18e35424edf3d59Behdad Esfahbod const GSUBGPOS &g = get_gsubgpos_table (layout, table_type); 587c44733596c6648e209c12349e18e35424edf3d59Behdad Esfahbod const Feature &f = g.get_feature (feature_index); 588c44733596c6648e209c12349e18e35424edf3d59Behdad Esfahbod 589c44733596c6648e209c12349e18e35424edf3d59Behdad Esfahbod return f.get_lookup_count (); 590c44733596c6648e209c12349e18e35424edf3d59Behdad Esfahbod} 591c44733596c6648e209c12349e18e35424edf3d59Behdad Esfahbod 592c44733596c6648e209c12349e18e35424edf3d59Behdad Esfahbodunsigned int 593c44733596c6648e209c12349e18e35424edf3d59Behdad Esfahbodhb_ot_layout_feature_get_lookup_index (hb_ot_layout_t *layout, 594c44733596c6648e209c12349e18e35424edf3d59Behdad Esfahbod hb_ot_layout_table_type_t table_type, 595c44733596c6648e209c12349e18e35424edf3d59Behdad Esfahbod unsigned int feature_index, 596c44733596c6648e209c12349e18e35424edf3d59Behdad Esfahbod unsigned int num_lookup) 597c44733596c6648e209c12349e18e35424edf3d59Behdad Esfahbod{ 598c44733596c6648e209c12349e18e35424edf3d59Behdad Esfahbod const GSUBGPOS &g = get_gsubgpos_table (layout, table_type); 599c44733596c6648e209c12349e18e35424edf3d59Behdad Esfahbod const Feature &f = g.get_feature (feature_index); 600c44733596c6648e209c12349e18e35424edf3d59Behdad Esfahbod 601c44733596c6648e209c12349e18e35424edf3d59Behdad Esfahbod return f.get_lookup_index (num_lookup); 602c44733596c6648e209c12349e18e35424edf3d59Behdad Esfahbod} 6032d15e72c75931398db5e027e660f1320bb979117Behdad Esfahbod 6042d15e72c75931398db5e027e660f1320bb979117Behdad Esfahbod/* 6052d15e72c75931398db5e027e660f1320bb979117Behdad Esfahbod * GSUB 6062d15e72c75931398db5e027e660f1320bb979117Behdad Esfahbod */ 6072d15e72c75931398db5e027e660f1320bb979117Behdad Esfahbod 6082d15e72c75931398db5e027e660f1320bb979117Behdad Esfahbodhb_bool_t 6092d15e72c75931398db5e027e660f1320bb979117Behdad Esfahbodhb_ot_layout_substitute_lookup (hb_ot_layout_t *layout, 6102d15e72c75931398db5e027e660f1320bb979117Behdad Esfahbod hb_buffer_t *buffer, 6112d15e72c75931398db5e027e660f1320bb979117Behdad Esfahbod unsigned int lookup_index, 6122d15e72c75931398db5e027e660f1320bb979117Behdad Esfahbod hb_ot_layout_feature_mask_t mask) 6132d15e72c75931398db5e027e660f1320bb979117Behdad Esfahbod{ 614fc36d9453ed7edb0a570abc44d7caa87aafb0fcfBehdad Esfahbod return layout->gsub->substitute_lookup (layout, buffer, lookup_index, mask); 6155a0b791184cf6ef39eae0570e14aca21abc32845Behdad Esfahbod} 6165a0b791184cf6ef39eae0570e14aca21abc32845Behdad Esfahbod 6179c42f05a5ccbb48a9367b80ecdf3679e88088fcfBehdad Esfahbod/* 6189c42f05a5ccbb48a9367b80ecdf3679e88088fcfBehdad Esfahbod * GPOS 6199c42f05a5ccbb48a9367b80ecdf3679e88088fcfBehdad Esfahbod */ 6209c42f05a5ccbb48a9367b80ecdf3679e88088fcfBehdad Esfahbod 6219c42f05a5ccbb48a9367b80ecdf3679e88088fcfBehdad Esfahbodhb_bool_t 6229c42f05a5ccbb48a9367b80ecdf3679e88088fcfBehdad Esfahbodhb_ot_layout_position_lookup (hb_ot_layout_t *layout, 6239c42f05a5ccbb48a9367b80ecdf3679e88088fcfBehdad Esfahbod hb_buffer_t *buffer, 6249c42f05a5ccbb48a9367b80ecdf3679e88088fcfBehdad Esfahbod unsigned int lookup_index, 6259c42f05a5ccbb48a9367b80ecdf3679e88088fcfBehdad Esfahbod hb_ot_layout_feature_mask_t mask) 6269c42f05a5ccbb48a9367b80ecdf3679e88088fcfBehdad Esfahbod{ 6279c42f05a5ccbb48a9367b80ecdf3679e88088fcfBehdad Esfahbod return layout->gpos->position_lookup (layout, buffer, lookup_index, mask); 6289c42f05a5ccbb48a9367b80ecdf3679e88088fcfBehdad Esfahbod} 629