1c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath/* 2c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) 3c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath * 4c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath * This is part of HarfBuzz, an OpenType Layout engine library. 5c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath * 6c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath * Permission is hereby granted, without written agreement and without 7c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath * license or royalty fees, to use, copy, modify, and distribute this 8c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath * software and its documentation for any purpose, provided that the 9c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath * above copyright notice and the following two paragraphs appear in 10c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath * all copies of this software. 11c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath * 12c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR 13c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES 14c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN 15c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH 16c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath * DAMAGE. 17c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath * 18c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, 19c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 20c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS 21c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO 22c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. 23c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath */ 24c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath 25c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath#ifndef HARFBUZZ_SHAPER_H 26c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath#define HARFBUZZ_SHAPER_H 27c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath 28c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath#include "harfbuzz-global.h" 29c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath#include "harfbuzz-gdef.h" 30c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath#include "harfbuzz-gpos.h" 31c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath#include "harfbuzz-gsub.h" 32c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath#include "harfbuzz-external.h" 33c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath#include "harfbuzz-stream-private.h" 34c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath 35c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan KamathHB_BEGIN_HEADER 36c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath 37c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath#ifdef HB_USE_PACKED_STRUCTS 38c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath#pragma pack(push, 1) 39c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath#endif 40c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath 41c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath/* 42c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath using anything else than signed or unsigned for bitfields in C is non standard, 43c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath but accepted by almost all compilers. And it gives a significant reduction in 44c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath memory consumption as HB_CharAttributes and HB_GlyphAttributes will not have 45c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath a 4 byte alignment 46c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath*/ 47c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath#ifdef __xlC__ 48c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamathtypedef unsigned hb_bitfield; 49c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath#else 50c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamathtypedef hb_uint8 hb_bitfield; 51c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath#endif 52c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath 53c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamathtypedef enum { 54c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath HB_Script_Common, 55c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath HB_Script_Greek, 56c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath HB_Script_Cyrillic, 57c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath HB_Script_Armenian, 58c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath HB_Script_Hebrew, 59c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath HB_Script_Arabic, 60c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath HB_Script_Syriac, 61c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath HB_Script_Thaana, 62c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath HB_Script_Devanagari, 63c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath HB_Script_Bengali, 64c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath HB_Script_Gurmukhi, 65c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath HB_Script_Gujarati, 66c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath HB_Script_Oriya, 67c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath HB_Script_Tamil, 68c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath HB_Script_Telugu, 69c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath HB_Script_Kannada, 70c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath HB_Script_Malayalam, 71c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath HB_Script_Sinhala, 72c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath HB_Script_Thai, 73c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath HB_Script_Lao, 74c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath HB_Script_Tibetan, 75c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath HB_Script_Myanmar, 76c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath HB_Script_Georgian, 77c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath HB_Script_Hangul, 78c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath HB_Script_Ogham, 79c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath HB_Script_Runic, 80c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath HB_Script_Khmer, 81c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath HB_Script_Nko, 82c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath HB_Script_Inherited, 83c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath HB_ScriptCount = HB_Script_Inherited 84c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath /* 85c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath HB_Script_Latin = Common, 86c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath HB_Script_Ethiopic = Common, 87c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath HB_Script_Cherokee = Common, 88c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath HB_Script_CanadianAboriginal = Common, 89c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath HB_Script_Mongolian = Common, 90c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath HB_Script_Hiragana = Common, 91c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath HB_Script_Katakana = Common, 92c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath HB_Script_Bopomofo = Common, 93c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath HB_Script_Han = Common, 94c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath HB_Script_Yi = Common, 95c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath HB_Script_OldItalic = Common, 96c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath HB_Script_Gothic = Common, 97c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath HB_Script_Deseret = Common, 98c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath HB_Script_Tagalog = Common, 99c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath HB_Script_Hanunoo = Common, 100c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath HB_Script_Buhid = Common, 101c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath HB_Script_Tagbanwa = Common, 102c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath HB_Script_Limbu = Common, 103c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath HB_Script_TaiLe = Common, 104c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath HB_Script_LinearB = Common, 105c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath HB_Script_Ugaritic = Common, 106c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath HB_Script_Shavian = Common, 107c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath HB_Script_Osmanya = Common, 108c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath HB_Script_Cypriot = Common, 109c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath HB_Script_Braille = Common, 110c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath HB_Script_Buginese = Common, 111c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath HB_Script_Coptic = Common, 112c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath HB_Script_NewTaiLue = Common, 113c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath HB_Script_Glagolitic = Common, 114c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath HB_Script_Tifinagh = Common, 115c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath HB_Script_SylotiNagri = Common, 116c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath HB_Script_OldPersian = Common, 117c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath HB_Script_Kharoshthi = Common, 118c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath HB_Script_Balinese = Common, 119c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath HB_Script_Cuneiform = Common, 120c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath HB_Script_Phoenician = Common, 121c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath HB_Script_PhagsPa = Common, 122c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath */ 123c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath} HB_Script; 124c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath 125c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamathtypedef struct 126c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath{ 127c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath hb_uint32 pos; 128c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath hb_uint32 length; 129c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath HB_Script script; 130c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath hb_uint8 bidiLevel; 131c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath} HB_ScriptItem; 132c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath 133c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath 134c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamathtypedef enum { 135c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath HB_LeftToRight = 0, 136c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath HB_RightToLeft = 1 137c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath} HB_StringToGlyphsFlags; 138c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath 139c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamathtypedef enum { 140c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath HB_ShaperFlag_Default = 0, 141c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath HB_ShaperFlag_NoKerning = 1, 142c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath HB_ShaperFlag_UseDesignMetrics = 2 143c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath} HB_ShaperFlag; 144c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath 145c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath/* 146c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath highest value means highest priority for justification. Justification is done by first inserting kashidas 147c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath starting with the highest priority positions, then stretching spaces, afterwards extending inter char 148c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath spacing, and last spacing between arabic words. 149c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath NoJustification is for example set for arabic where no Kashida can be inserted or for diacritics. 150c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath*/ 151c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamathtypedef enum { 152c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath HB_NoJustification= 0, /* Justification can't be applied after this glyph */ 153c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath HB_Arabic_Space = 1, /* This glyph represents a space inside arabic text */ 154c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath HB_Character = 2, /* Inter-character justification point follows this glyph */ 155c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath HB_Space = 4, /* This glyph represents a blank outside an Arabic run */ 156c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath HB_Arabic_Normal = 7, /* Normal Middle-Of-Word glyph that connects to the right (begin) */ 157c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath HB_Arabic_Waw = 8, /* Next character is final form of Waw/Ain/Qaf/Fa */ 158c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath HB_Arabic_BaRa = 9, /* Next two chars are Ba + Ra/Ya/AlefMaksura */ 159c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath HB_Arabic_Alef = 10, /* Next character is final form of Alef/Tah/Lam/Kaf/Gaf */ 160c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath HB_Arabic_HaaDal = 11, /* Next character is final form of Haa/Dal/Taa Marbutah */ 161c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath HB_Arabic_Seen = 12, /* Initial or Medial form Of Seen/Sad */ 162c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath HB_Arabic_Kashida = 13 /* Kashida(U+640) in middle of word */ 163c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath} HB_JustificationClass; 164c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath 165c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath/* This structure is binary compatible with Uniscribe's SCRIPT_VISATTR. Would be nice to keep 166c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath * it like that. If this is a problem please tell Trolltech :) 167c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath */ 168c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamathtypedef struct { 169c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath hb_bitfield justification :4; /* Justification class */ 170c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath hb_bitfield clusterStart :1; /* First glyph of representation of cluster */ 171c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath hb_bitfield mark :1; /* needs to be positioned around base char */ 172c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath hb_bitfield zeroWidth :1; /* ZWJ, ZWNJ etc, with no width */ 173c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath hb_bitfield dontPrint :1; 174c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath hb_bitfield combiningClass :8; 175c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath} HB_GlyphAttributes; 176c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath 177c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamathtypedef struct HB_FaceRec_ { 178c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath HB_Bool isSymbolFont; 179c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath 180c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath HB_GDEF gdef; 181c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath HB_GSUB gsub; 182c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath HB_GPOS gpos; 183c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath HB_Bool supported_scripts[HB_ScriptCount]; 184c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath HB_Buffer buffer; 185c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath HB_Script current_script; 186c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath int current_flags; /* HB_ShaperFlags */ 187c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath HB_Bool has_opentype_kerning; 188c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath HB_Bool glyphs_substituted; 189c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath HB_GlyphAttributes *tmpAttributes; 190c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath unsigned int *tmpLogClusters; 191c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath int length; 192c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath int orig_nglyphs; 193c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath} HB_FaceRec; 194c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath 195c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamathtypedef HB_Error (*HB_GetFontTableFunc)(void *font, HB_Tag tag, HB_Byte *buffer, HB_UInt *length); 196c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath 197c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan KamathHB_Face HB_NewFace(void *font, HB_GetFontTableFunc tableFunc); 198c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamathvoid HB_FreeFace(HB_Face face); 199c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath 200c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamathtypedef struct { 201c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath HB_Fixed x, y; 202c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath HB_Fixed width, height; 203c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath HB_Fixed xOffset, yOffset; 204c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath} HB_GlyphMetrics; 205c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath 206c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamathtypedef enum { 207c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath HB_FontAscent 208c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath} HB_FontMetric; 209c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath 210c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamathtypedef struct { 211c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath HB_Bool (*convertStringToGlyphIndices)(HB_Font font, const HB_UChar16 *string, hb_uint32 length, HB_Glyph *glyphs, hb_uint32 *numGlyphs, HB_Bool rightToLeft); 212c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath void (*getGlyphAdvances)(HB_Font font, const HB_Glyph *glyphs, hb_uint32 numGlyphs, HB_Fixed *advances, int flags /*HB_ShaperFlag*/); 213c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath HB_Bool (*canRender)(HB_Font font, const HB_UChar16 *string, hb_uint32 length); 214c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath /* implementation needs to make sure to load a scaled glyph, so /no/ FT_LOAD_NO_SCALE */ 215c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath HB_Error (*getPointInOutline)(HB_Font font, HB_Glyph glyph, int flags /*HB_ShaperFlag*/, hb_uint32 point, HB_Fixed *xpos, HB_Fixed *ypos, hb_uint32 *nPoints); 216c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath void (*getGlyphMetrics)(HB_Font font, HB_Glyph glyph, HB_GlyphMetrics *metrics); 217c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath HB_Fixed (*getFontMetric)(HB_Font font, HB_FontMetric metric); 218c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath} HB_FontClass; 219c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath 220c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamathtypedef struct HB_Font_ { 221c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath const HB_FontClass *klass; 222c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath 223c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath /* Metrics */ 224c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath HB_UShort x_ppem, y_ppem; 225c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath HB_16Dot16 x_scale, y_scale; 226c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath 227c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath void *userData; 228c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath} HB_FontRec; 229c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath 230c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath#ifdef HB_USE_PACKED_STRUCTS 231c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath#pragma pack(pop) 232c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath#endif 233c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath 234c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamathtypedef struct HB_ShaperItem_ HB_ShaperItem; 235c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath 236c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamathstruct HB_ShaperItem_ { 237c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath const HB_UChar16 *string; /* input: the Unicode UTF16 text to be shaped */ 238c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath hb_uint32 stringLength; /* input: the length of the input in 16-bit words */ 239c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath HB_ScriptItem item; /* input: the current run to be shaped: a run of text all in the same script that is a substring of <string> */ 240c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath HB_Font font; /* input: the font: scale, units and function pointers supplying glyph indices and metrics */ 241c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath HB_Face face; /* input: the shaper state; current script, access to the OpenType tables , etc. */ 242c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath int shaperFlags; /* input (unused) should be set to 0; intended to support flags defined in HB_ShaperFlag */ 243c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath HB_Bool glyphIndicesPresent; /* input: true if the <glyphs> array contains glyph indices ready to be shaped */ 244c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath hb_uint32 initialGlyphCount; /* input: if glyphIndicesPresent is true, the number of glyph indices in the <glyphs> array */ 245c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath 246c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath hb_uint32 num_glyphs; /* input: capacity of output arrays <glyphs>, <attributes>, <advances>, <offsets>, and <log_clusters>; */ 247c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath /* output: required capacity (may be larger than actual capacity) */ 248c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath 249c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath HB_Glyph *glyphs; /* output: <num_glyphs> indices of shaped glyphs */ 250c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath HB_GlyphAttributes *attributes; /* output: <num_glyphs> glyph attributes */ 251c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath HB_Fixed *advances; /* output: <num_glyphs> advances */ 252c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath HB_FixedPoint *offsets; /* output: <num_glyphs> offsets */ 253c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath unsigned short *log_clusters; /* output: for each output glyph, the index in the input of the start of its logical cluster */ 254c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath /* XXX the discription for log_clusters is wrong. It maps each input position to output glyph position! */ 255c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath 256c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath /* internal */ 257c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath HB_Bool kerning_applied; /* output: true if kerning was applied by the shaper */ 258c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath}; 259c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath 260c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan KamathHB_Bool HB_ShapeItem(HB_ShaperItem *item); 261c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath 262c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan KamathHB_END_HEADER 263c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath 264c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath#endif 265