hb-ot-layout-private.hh revision c57d454accff66e5f2c58006e8fb40bc020b6182
1fd92a3dde32fd10df30c9eeb97641bc3c15b1e9bBehdad Esfahbod/* 26c78683c042250a7b5a6fc6ebae4717b03fadf9eBehdad Esfahbod * Copyright (C) 2007,2008,2009 Red Hat, Inc. 3fd92a3dde32fd10df30c9eeb97641bc3c15b1e9bBehdad Esfahbod * 4c755cb3e3ac55156d0d2ec05adea7a650b97cc41Behdad Esfahbod * This is part of HarfBuzz, a text shaping library. 5fd92a3dde32fd10df30c9eeb97641bc3c15b1e9bBehdad Esfahbod * 6fd92a3dde32fd10df30c9eeb97641bc3c15b1e9bBehdad Esfahbod * Permission is hereby granted, without written agreement and without 7fd92a3dde32fd10df30c9eeb97641bc3c15b1e9bBehdad Esfahbod * license or royalty fees, to use, copy, modify, and distribute this 8fd92a3dde32fd10df30c9eeb97641bc3c15b1e9bBehdad Esfahbod * software and its documentation for any purpose, provided that the 9fd92a3dde32fd10df30c9eeb97641bc3c15b1e9bBehdad Esfahbod * above copyright notice and the following two paragraphs appear in 10fd92a3dde32fd10df30c9eeb97641bc3c15b1e9bBehdad Esfahbod * all copies of this software. 11fd92a3dde32fd10df30c9eeb97641bc3c15b1e9bBehdad Esfahbod * 12fd92a3dde32fd10df30c9eeb97641bc3c15b1e9bBehdad Esfahbod * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR 13fd92a3dde32fd10df30c9eeb97641bc3c15b1e9bBehdad Esfahbod * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES 14fd92a3dde32fd10df30c9eeb97641bc3c15b1e9bBehdad Esfahbod * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN 15fd92a3dde32fd10df30c9eeb97641bc3c15b1e9bBehdad Esfahbod * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH 16fd92a3dde32fd10df30c9eeb97641bc3c15b1e9bBehdad Esfahbod * DAMAGE. 17fd92a3dde32fd10df30c9eeb97641bc3c15b1e9bBehdad Esfahbod * 18fd92a3dde32fd10df30c9eeb97641bc3c15b1e9bBehdad Esfahbod * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, 19fd92a3dde32fd10df30c9eeb97641bc3c15b1e9bBehdad Esfahbod * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 20fd92a3dde32fd10df30c9eeb97641bc3c15b1e9bBehdad Esfahbod * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS 21fd92a3dde32fd10df30c9eeb97641bc3c15b1e9bBehdad Esfahbod * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO 22fd92a3dde32fd10df30c9eeb97641bc3c15b1e9bBehdad Esfahbod * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. 23fd92a3dde32fd10df30c9eeb97641bc3c15b1e9bBehdad Esfahbod * 24fd92a3dde32fd10df30c9eeb97641bc3c15b1e9bBehdad Esfahbod * Red Hat Author(s): Behdad Esfahbod 25fd92a3dde32fd10df30c9eeb97641bc3c15b1e9bBehdad Esfahbod */ 26fd92a3dde32fd10df30c9eeb97641bc3c15b1e9bBehdad Esfahbod 270f0cd9d361f1bb614aa3fd4616160d027062370eBehdad Esfahbod#ifndef HB_OT_LAYOUT_PRIVATE_HH 280f0cd9d361f1bb614aa3fd4616160d027062370eBehdad Esfahbod#define HB_OT_LAYOUT_PRIVATE_HH 29fd92a3dde32fd10df30c9eeb97641bc3c15b1e9bBehdad Esfahbod 30c57d454accff66e5f2c58006e8fb40bc020b6182Behdad Esfahbod#include "hb-private.hh" 312c80296aa5991ad67483889147f5c84fefe54af2Behdad Esfahbod 32fd92a3dde32fd10df30c9eeb97641bc3c15b1e9bBehdad Esfahbod#include "hb-ot-layout.h" 330dd200d28f51bf4062d8a377432c8977c80cb210Behdad Esfahbod#include "hb-ot-head-private.hh" 342c80296aa5991ad67483889147f5c84fefe54af2Behdad Esfahbod 35c57d454accff66e5f2c58006e8fb40bc020b6182Behdad Esfahbod#include "hb-font-private.hh" 3622da7fd94d6318c52df69d70470a85464ffc533dBehdad Esfahbod#include "hb-buffer-private.hh" 37fd92a3dde32fd10df30c9eeb97641bc3c15b1e9bBehdad Esfahbod 3823c86aa0009324433e78fcd0c47f2c0ff14b1949Behdad EsfahbodHB_BEGIN_DECLS 3923c86aa0009324433e78fcd0c47f2c0ff14b1949Behdad Esfahbod 40acdba3f90b232fc12fcb200dca2584481b339118Behdad Esfahbod 41c2709119c8c610a0d4d71884a7d4fdba7cb65b72Behdad Esfahbod/* buffer var allocations */ 423a852ae7fe6edfaadd75625d27515a3689503395Behdad Esfahbod#define props_cache() var1.u16[1] /* glyph_props cache */ 43c2709119c8c610a0d4d71884a7d4fdba7cb65b72Behdad Esfahbod 441115890b90709fa5329a55d22f543020f3df9f6fBehdad Esfahbod 453a852ae7fe6edfaadd75625d27515a3689503395Behdad Esfahbod/* XXX cleanup */ 4698370e89d1bff248737b482d129c2a4deb8bfd95Behdad Esfahbodtypedef enum { 47bf94b3ad22b2fe4730d4e64d673c63154fc5b5feBehdad Esfahbod HB_OT_LAYOUT_GLYPH_CLASS_UNCLASSIFIED = 0x0001, 4898370e89d1bff248737b482d129c2a4deb8bfd95Behdad Esfahbod HB_OT_LAYOUT_GLYPH_CLASS_BASE_GLYPH = 0x0002, 4998370e89d1bff248737b482d129c2a4deb8bfd95Behdad Esfahbod HB_OT_LAYOUT_GLYPH_CLASS_LIGATURE = 0x0004, 5098370e89d1bff248737b482d129c2a4deb8bfd95Behdad Esfahbod HB_OT_LAYOUT_GLYPH_CLASS_MARK = 0x0008, 51bf94b3ad22b2fe4730d4e64d673c63154fc5b5feBehdad Esfahbod HB_OT_LAYOUT_GLYPH_CLASS_COMPONENT = 0x0010 5298370e89d1bff248737b482d129c2a4deb8bfd95Behdad Esfahbod} hb_ot_layout_glyph_class_t; 5398370e89d1bff248737b482d129c2a4deb8bfd95Behdad Esfahbod 54ead428d7a0bf4dc84340a99f3959e5cc58123e99Behdad Esfahbod 550ead481a5a8623103565fd7d924666e7342278ddBehdad Esfahbod/* 560ead481a5a8623103565fd7d924666e7342278ddBehdad Esfahbod * hb_ot_layout_t 570ead481a5a8623103565fd7d924666e7342278ddBehdad Esfahbod */ 580ead481a5a8623103565fd7d924666e7342278ddBehdad Esfahbod 590a4399ca228d244e646abdb3487da0f13b228889Behdad Esfahbodstruct hb_ot_layout_t 6060d77cf05fddc5304b4b1fc19cdedba15cbee1e9Behdad Esfahbod{ 6170e0f2a75ec1559f2f70ada837ce4bc4baca49e3Behdad Esfahbod hb_blob_t *gdef_blob; 6270e0f2a75ec1559f2f70ada837ce4bc4baca49e3Behdad Esfahbod hb_blob_t *gsub_blob; 6370e0f2a75ec1559f2f70ada837ce4bc4baca49e3Behdad Esfahbod hb_blob_t *gpos_blob; 6470e0f2a75ec1559f2f70ada837ce4bc4baca49e3Behdad Esfahbod 65c43562b2a7587fa3f9ef4c1c4338e4eda77368b5Behdad Esfahbod const struct GDEF *gdef; 66c43562b2a7587fa3f9ef4c1c4338e4eda77368b5Behdad Esfahbod const struct GSUB *gsub; 675e5eb0573f7ea2ce2cf037fef0df70a4351e82c0Behdad Esfahbod const struct GPOS *gpos; 680ead481a5a8623103565fd7d924666e7342278ddBehdad Esfahbod}; 695e5eb0573f7ea2ce2cf037fef0df70a4351e82c0Behdad Esfahbod 700a4399ca228d244e646abdb3487da0f13b228889Behdad Esfahbodstruct hb_ot_layout_context_t 710ead481a5a8623103565fd7d924666e7342278ddBehdad Esfahbod{ 7223c86aa0009324433e78fcd0c47f2c0ff14b1949Behdad Esfahbod hb_face_t *face; 730ead481a5a8623103565fd7d924666e7342278ddBehdad Esfahbod hb_font_t *font; 742ebb89d63dd27e800f2b6cbf624924601105f48aBehdad Esfahbod 750a4399ca228d244e646abdb3487da0f13b228889Behdad Esfahbod /* Convert from font-space to user-space */ 76f0feb084b0fd1510474b25404d1dcc5686ee0538Behdad Esfahbod inline hb_position_t scale_x (int16_t v) { return scale (v, this->font->x_scale); } 77f0feb084b0fd1510474b25404d1dcc5686ee0538Behdad Esfahbod inline hb_position_t scale_y (int16_t v) { return scale (v, this->font->y_scale); } 78f0feb084b0fd1510474b25404d1dcc5686ee0538Behdad Esfahbod 79f0feb084b0fd1510474b25404d1dcc5686ee0538Behdad Esfahbod private: 80f0feb084b0fd1510474b25404d1dcc5686ee0538Behdad Esfahbod inline hb_position_t scale (int16_t v, unsigned int scale) { return v * (int64_t) scale / this->face->head_table->get_upem (); } 81c43562b2a7587fa3f9ef4c1c4338e4eda77368b5Behdad Esfahbod}; 82c43562b2a7587fa3f9ef4c1c4338e4eda77368b5Behdad Esfahbod 83c43562b2a7587fa3f9ef4c1c4338e4eda77368b5Behdad Esfahbod 840a4399ca228d244e646abdb3487da0f13b228889Behdad EsfahbodHB_INTERNAL hb_ot_layout_t * 850a4399ca228d244e646abdb3487da0f13b228889Behdad Esfahbod_hb_ot_layout_new (hb_face_t *face); 8623c86aa0009324433e78fcd0c47f2c0ff14b1949Behdad Esfahbod 87eee8598d75d3af692d9ececf7e8ac458e892ba9eBehdad EsfahbodHB_INTERNAL void 880a4399ca228d244e646abdb3487da0f13b228889Behdad Esfahbod_hb_ot_layout_free (hb_ot_layout_t *layout); 8923c86aa0009324433e78fcd0c47f2c0ff14b1949Behdad Esfahbod 90aff831ed6787abe8e24a977e34d97ff2e0b7dc21Behdad Esfahbod 9154e5aac5e2947d4e2864c6f2987e4d275da73100Behdad Esfahbod/* 9254e5aac5e2947d4e2864c6f2987e4d275da73100Behdad Esfahbod * GDEF 9354e5aac5e2947d4e2864c6f2987e4d275da73100Behdad Esfahbod */ 9454e5aac5e2947d4e2864c6f2987e4d275da73100Behdad Esfahbod 95bf94b3ad22b2fe4730d4e64d673c63154fc5b5feBehdad EsfahbodHB_INTERNAL unsigned int 96bf94b3ad22b2fe4730d4e64d673c63154fc5b5feBehdad Esfahbod_hb_ot_layout_get_glyph_property (hb_face_t *face, 97bf94b3ad22b2fe4730d4e64d673c63154fc5b5feBehdad Esfahbod hb_glyph_info_t *info); 98bf94b3ad22b2fe4730d4e64d673c63154fc5b5feBehdad Esfahbod 99347f0b8621d3adfec157e5634ff3defc818ea37fBehdad EsfahbodHB_INTERNAL hb_bool_t 10023c86aa0009324433e78fcd0c47f2c0ff14b1949Behdad Esfahbod_hb_ot_layout_check_glyph_property (hb_face_t *face, 10188474c6fdaf35c56368694a5b164f4988a004d49Behdad Esfahbod hb_glyph_info_t *ginfo, 1028c69e65abed961002d90024c92e18538c6516262Behdad Esfahbod unsigned int lookup_props, 1034a2d844c2f12dc1b858ab4ddd737ded7c0852221Behdad Esfahbod unsigned int *property_out); 1045a0b791184cf6ef39eae0570e14aca21abc32845Behdad Esfahbod 1054a2d844c2f12dc1b858ab4ddd737ded7c0852221Behdad EsfahbodHB_INTERNAL hb_bool_t 10623c86aa0009324433e78fcd0c47f2c0ff14b1949Behdad Esfahbod_hb_ot_layout_skip_mark (hb_face_t *face, 10788474c6fdaf35c56368694a5b164f4988a004d49Behdad Esfahbod hb_glyph_info_t *ginfo, 1088c69e65abed961002d90024c92e18538c6516262Behdad Esfahbod unsigned int lookup_props, 1094a2d844c2f12dc1b858ab4ddd737ded7c0852221Behdad Esfahbod unsigned int *property_out); 1104189b92aaa41e4a1756c561cc6e08b0ed024afdaBehdad Esfahbod 111acdba3f90b232fc12fcb200dca2584481b339118Behdad Esfahbod 112f96ffd43bce0ac6d9c897933c9be0e51d543e570Behdad EsfahbodHB_END_DECLS 113fd92a3dde32fd10df30c9eeb97641bc3c15b1e9bBehdad Esfahbod 1140f0cd9d361f1bb614aa3fd4616160d027062370eBehdad Esfahbod#endif /* HB_OT_LAYOUT_PRIVATE_HH */ 115