15569331642446be05292e3e1f8a51218827168cdclaireho/*
25569331642446be05292e3e1f8a51218827168cdclaireho * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
35569331642446be05292e3e1f8a51218827168cdclaireho *
45569331642446be05292e3e1f8a51218827168cdclaireho * This is part of HarfBuzz, an OpenType Layout engine library.
55569331642446be05292e3e1f8a51218827168cdclaireho *
65569331642446be05292e3e1f8a51218827168cdclaireho * Permission is hereby granted, without written agreement and without
75569331642446be05292e3e1f8a51218827168cdclaireho * license or royalty fees, to use, copy, modify, and distribute this
85569331642446be05292e3e1f8a51218827168cdclaireho * software and its documentation for any purpose, provided that the
95569331642446be05292e3e1f8a51218827168cdclaireho * above copyright notice and the following two paragraphs appear in
105569331642446be05292e3e1f8a51218827168cdclaireho * all copies of this software.
115569331642446be05292e3e1f8a51218827168cdclaireho *
125569331642446be05292e3e1f8a51218827168cdclaireho * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
135569331642446be05292e3e1f8a51218827168cdclaireho * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
145569331642446be05292e3e1f8a51218827168cdclaireho * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
155569331642446be05292e3e1f8a51218827168cdclaireho * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
165569331642446be05292e3e1f8a51218827168cdclaireho * DAMAGE.
175569331642446be05292e3e1f8a51218827168cdclaireho *
185569331642446be05292e3e1f8a51218827168cdclaireho * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
195569331642446be05292e3e1f8a51218827168cdclaireho * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
205569331642446be05292e3e1f8a51218827168cdclaireho * FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
215569331642446be05292e3e1f8a51218827168cdclaireho * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
225569331642446be05292e3e1f8a51218827168cdclaireho * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
235569331642446be05292e3e1f8a51218827168cdclaireho */
245569331642446be05292e3e1f8a51218827168cdclaireho
255569331642446be05292e3e1f8a51218827168cdclaireho#ifndef HARFBUZZ_SHAPER_H
265569331642446be05292e3e1f8a51218827168cdclaireho#define HARFBUZZ_SHAPER_H
275569331642446be05292e3e1f8a51218827168cdclaireho
285569331642446be05292e3e1f8a51218827168cdclaireho#include "harfbuzz-global.h"
295569331642446be05292e3e1f8a51218827168cdclaireho#include "harfbuzz-gdef.h"
305569331642446be05292e3e1f8a51218827168cdclaireho#include "harfbuzz-gpos.h"
315569331642446be05292e3e1f8a51218827168cdclaireho#include "harfbuzz-gsub.h"
325569331642446be05292e3e1f8a51218827168cdclaireho#include "harfbuzz-external.h"
335569331642446be05292e3e1f8a51218827168cdclaireho#include "harfbuzz-stream-private.h"
345569331642446be05292e3e1f8a51218827168cdclaireho
355569331642446be05292e3e1f8a51218827168cdclairehoHB_BEGIN_HEADER
365569331642446be05292e3e1f8a51218827168cdclaireho
3757e6107a9d66a9a97b146def0ef38c010f954be6claireho#ifdef HB_USE_PACKED_STRUCTS
3857e6107a9d66a9a97b146def0ef38c010f954be6claireho#pragma pack(push, 1)
3957e6107a9d66a9a97b146def0ef38c010f954be6claireho#endif
4057e6107a9d66a9a97b146def0ef38c010f954be6claireho
4157e6107a9d66a9a97b146def0ef38c010f954be6claireho/*
4257e6107a9d66a9a97b146def0ef38c010f954be6claireho   using anything else than signed or unsigned for bitfields in C is non standard,
4357e6107a9d66a9a97b146def0ef38c010f954be6claireho   but accepted by almost all compilers. And it gives a significant reduction in
4457e6107a9d66a9a97b146def0ef38c010f954be6claireho   memory consumption as HB_CharAttributes and HB_GlyphAttributes will not have
4557e6107a9d66a9a97b146def0ef38c010f954be6claireho   a 4 byte alignment
4657e6107a9d66a9a97b146def0ef38c010f954be6claireho*/
4757e6107a9d66a9a97b146def0ef38c010f954be6claireho#ifdef  __xlC__
4857e6107a9d66a9a97b146def0ef38c010f954be6clairehotypedef unsigned hb_bitfield;
4957e6107a9d66a9a97b146def0ef38c010f954be6claireho#else
5057e6107a9d66a9a97b146def0ef38c010f954be6clairehotypedef hb_uint8 hb_bitfield;
5157e6107a9d66a9a97b146def0ef38c010f954be6claireho#endif
5257e6107a9d66a9a97b146def0ef38c010f954be6claireho
535569331642446be05292e3e1f8a51218827168cdclairehotypedef enum {
545569331642446be05292e3e1f8a51218827168cdclaireho        HB_Script_Common,
555569331642446be05292e3e1f8a51218827168cdclaireho        HB_Script_Greek,
565569331642446be05292e3e1f8a51218827168cdclaireho        HB_Script_Cyrillic,
575569331642446be05292e3e1f8a51218827168cdclaireho        HB_Script_Armenian,
585569331642446be05292e3e1f8a51218827168cdclaireho        HB_Script_Hebrew,
595569331642446be05292e3e1f8a51218827168cdclaireho        HB_Script_Arabic,
605569331642446be05292e3e1f8a51218827168cdclaireho        HB_Script_Syriac,
615569331642446be05292e3e1f8a51218827168cdclaireho        HB_Script_Thaana,
625569331642446be05292e3e1f8a51218827168cdclaireho        HB_Script_Devanagari,
635569331642446be05292e3e1f8a51218827168cdclaireho        HB_Script_Bengali,
645569331642446be05292e3e1f8a51218827168cdclaireho        HB_Script_Gurmukhi,
655569331642446be05292e3e1f8a51218827168cdclaireho        HB_Script_Gujarati,
665569331642446be05292e3e1f8a51218827168cdclaireho        HB_Script_Oriya,
675569331642446be05292e3e1f8a51218827168cdclaireho        HB_Script_Tamil,
685569331642446be05292e3e1f8a51218827168cdclaireho        HB_Script_Telugu,
695569331642446be05292e3e1f8a51218827168cdclaireho        HB_Script_Kannada,
705569331642446be05292e3e1f8a51218827168cdclaireho        HB_Script_Malayalam,
715569331642446be05292e3e1f8a51218827168cdclaireho        HB_Script_Sinhala,
725569331642446be05292e3e1f8a51218827168cdclaireho        HB_Script_Thai,
735569331642446be05292e3e1f8a51218827168cdclaireho        HB_Script_Lao,
745569331642446be05292e3e1f8a51218827168cdclaireho        HB_Script_Tibetan,
755569331642446be05292e3e1f8a51218827168cdclaireho        HB_Script_Myanmar,
765569331642446be05292e3e1f8a51218827168cdclaireho        HB_Script_Georgian,
775569331642446be05292e3e1f8a51218827168cdclaireho        HB_Script_Hangul,
785569331642446be05292e3e1f8a51218827168cdclaireho        HB_Script_Ogham,
795569331642446be05292e3e1f8a51218827168cdclaireho        HB_Script_Runic,
805569331642446be05292e3e1f8a51218827168cdclaireho        HB_Script_Khmer,
815569331642446be05292e3e1f8a51218827168cdclaireho        HB_Script_Nko,
825569331642446be05292e3e1f8a51218827168cdclaireho        HB_Script_Inherited,
835569331642446be05292e3e1f8a51218827168cdclaireho        HB_ScriptCount = HB_Script_Inherited
845569331642446be05292e3e1f8a51218827168cdclaireho        /*
855569331642446be05292e3e1f8a51218827168cdclaireho        HB_Script_Latin = Common,
865569331642446be05292e3e1f8a51218827168cdclaireho        HB_Script_Ethiopic = Common,
875569331642446be05292e3e1f8a51218827168cdclaireho        HB_Script_Cherokee = Common,
885569331642446be05292e3e1f8a51218827168cdclaireho        HB_Script_CanadianAboriginal = Common,
895569331642446be05292e3e1f8a51218827168cdclaireho        HB_Script_Mongolian = Common,
905569331642446be05292e3e1f8a51218827168cdclaireho        HB_Script_Hiragana = Common,
915569331642446be05292e3e1f8a51218827168cdclaireho        HB_Script_Katakana = Common,
925569331642446be05292e3e1f8a51218827168cdclaireho        HB_Script_Bopomofo = Common,
935569331642446be05292e3e1f8a51218827168cdclaireho        HB_Script_Han = Common,
945569331642446be05292e3e1f8a51218827168cdclaireho        HB_Script_Yi = Common,
955569331642446be05292e3e1f8a51218827168cdclaireho        HB_Script_OldItalic = Common,
965569331642446be05292e3e1f8a51218827168cdclaireho        HB_Script_Gothic = Common,
975569331642446be05292e3e1f8a51218827168cdclaireho        HB_Script_Deseret = Common,
985569331642446be05292e3e1f8a51218827168cdclaireho        HB_Script_Tagalog = Common,
995569331642446be05292e3e1f8a51218827168cdclaireho        HB_Script_Hanunoo = Common,
1005569331642446be05292e3e1f8a51218827168cdclaireho        HB_Script_Buhid = Common,
1015569331642446be05292e3e1f8a51218827168cdclaireho        HB_Script_Tagbanwa = Common,
1025569331642446be05292e3e1f8a51218827168cdclaireho        HB_Script_Limbu = Common,
1035569331642446be05292e3e1f8a51218827168cdclaireho        HB_Script_TaiLe = Common,
1045569331642446be05292e3e1f8a51218827168cdclaireho        HB_Script_LinearB = Common,
1055569331642446be05292e3e1f8a51218827168cdclaireho        HB_Script_Ugaritic = Common,
1065569331642446be05292e3e1f8a51218827168cdclaireho        HB_Script_Shavian = Common,
1075569331642446be05292e3e1f8a51218827168cdclaireho        HB_Script_Osmanya = Common,
1085569331642446be05292e3e1f8a51218827168cdclaireho        HB_Script_Cypriot = Common,
1095569331642446be05292e3e1f8a51218827168cdclaireho        HB_Script_Braille = Common,
1105569331642446be05292e3e1f8a51218827168cdclaireho        HB_Script_Buginese = Common,
1115569331642446be05292e3e1f8a51218827168cdclaireho        HB_Script_Coptic = Common,
1125569331642446be05292e3e1f8a51218827168cdclaireho        HB_Script_NewTaiLue = Common,
1135569331642446be05292e3e1f8a51218827168cdclaireho        HB_Script_Glagolitic = Common,
1145569331642446be05292e3e1f8a51218827168cdclaireho        HB_Script_Tifinagh = Common,
1155569331642446be05292e3e1f8a51218827168cdclaireho        HB_Script_SylotiNagri = Common,
1165569331642446be05292e3e1f8a51218827168cdclaireho        HB_Script_OldPersian = Common,
1175569331642446be05292e3e1f8a51218827168cdclaireho        HB_Script_Kharoshthi = Common,
1185569331642446be05292e3e1f8a51218827168cdclaireho        HB_Script_Balinese = Common,
1195569331642446be05292e3e1f8a51218827168cdclaireho        HB_Script_Cuneiform = Common,
1205569331642446be05292e3e1f8a51218827168cdclaireho        HB_Script_Phoenician = Common,
1215569331642446be05292e3e1f8a51218827168cdclaireho        HB_Script_PhagsPa = Common,
1225569331642446be05292e3e1f8a51218827168cdclaireho        */
1235569331642446be05292e3e1f8a51218827168cdclaireho} HB_Script;
1245569331642446be05292e3e1f8a51218827168cdclaireho
1255569331642446be05292e3e1f8a51218827168cdclairehotypedef struct
1265569331642446be05292e3e1f8a51218827168cdclaireho{
1275569331642446be05292e3e1f8a51218827168cdclaireho    hb_uint32 pos;
1285569331642446be05292e3e1f8a51218827168cdclaireho    hb_uint32 length;
1295569331642446be05292e3e1f8a51218827168cdclaireho    HB_Script script;
1305569331642446be05292e3e1f8a51218827168cdclaireho    hb_uint8 bidiLevel;
1315569331642446be05292e3e1f8a51218827168cdclaireho} HB_ScriptItem;
1325569331642446be05292e3e1f8a51218827168cdclaireho
1335569331642446be05292e3e1f8a51218827168cdclairehotypedef enum {
1345569331642446be05292e3e1f8a51218827168cdclaireho    HB_NoBreak,
1355569331642446be05292e3e1f8a51218827168cdclaireho    HB_SoftHyphen,
1365569331642446be05292e3e1f8a51218827168cdclaireho    HB_Break,
1375569331642446be05292e3e1f8a51218827168cdclaireho    HB_ForcedBreak
1385569331642446be05292e3e1f8a51218827168cdclaireho} HB_LineBreakType;
1395569331642446be05292e3e1f8a51218827168cdclaireho
1405569331642446be05292e3e1f8a51218827168cdclaireho
1415569331642446be05292e3e1f8a51218827168cdclairehotypedef struct {
14257e6107a9d66a9a97b146def0ef38c010f954be6claireho    /*HB_LineBreakType*/ hb_bitfield lineBreakType  :2;
14357e6107a9d66a9a97b146def0ef38c010f954be6claireho    /*HB_Bool*/ hb_bitfield whiteSpace              :1;     /* A unicode whitespace character, except NBSP, ZWNBSP */
14457e6107a9d66a9a97b146def0ef38c010f954be6claireho    /*HB_Bool*/ hb_bitfield charStop                :1;     /* Valid cursor position (for left/right arrow) */
14557e6107a9d66a9a97b146def0ef38c010f954be6claireho    /*HB_Bool*/ hb_bitfield wordBoundary            :1;
14657e6107a9d66a9a97b146def0ef38c010f954be6claireho    /*HB_Bool*/ hb_bitfield sentenceBoundary        :1;
14757e6107a9d66a9a97b146def0ef38c010f954be6claireho    hb_bitfield unused                  :2;
1485569331642446be05292e3e1f8a51218827168cdclaireho} HB_CharAttributes;
1495569331642446be05292e3e1f8a51218827168cdclaireho
1505569331642446be05292e3e1f8a51218827168cdclairehovoid HB_GetCharAttributes(const HB_UChar16 *string, hb_uint32 stringLength,
1515569331642446be05292e3e1f8a51218827168cdclaireho                          const HB_ScriptItem *items, hb_uint32 numItems,
1525569331642446be05292e3e1f8a51218827168cdclaireho                          HB_CharAttributes *attributes);
1535569331642446be05292e3e1f8a51218827168cdclaireho
1545569331642446be05292e3e1f8a51218827168cdclaireho/* requires HB_GetCharAttributes to be called before */
1555569331642446be05292e3e1f8a51218827168cdclairehovoid HB_GetWordBoundaries(const HB_UChar16 *string, hb_uint32 stringLength,
1565569331642446be05292e3e1f8a51218827168cdclaireho                          const HB_ScriptItem *items, hb_uint32 numItems,
1575569331642446be05292e3e1f8a51218827168cdclaireho                          HB_CharAttributes *attributes);
1585569331642446be05292e3e1f8a51218827168cdclaireho
1595569331642446be05292e3e1f8a51218827168cdclaireho/* requires HB_GetCharAttributes to be called before */
1605569331642446be05292e3e1f8a51218827168cdclairehovoid HB_GetSentenceBoundaries(const HB_UChar16 *string, hb_uint32 stringLength,
1615569331642446be05292e3e1f8a51218827168cdclaireho                              const HB_ScriptItem *items, hb_uint32 numItems,
1625569331642446be05292e3e1f8a51218827168cdclaireho                              HB_CharAttributes *attributes);
1635569331642446be05292e3e1f8a51218827168cdclaireho
1645569331642446be05292e3e1f8a51218827168cdclaireho
1655569331642446be05292e3e1f8a51218827168cdclairehotypedef enum {
1665569331642446be05292e3e1f8a51218827168cdclaireho    HB_LeftToRight = 0,
1675569331642446be05292e3e1f8a51218827168cdclaireho    HB_RightToLeft = 1
1685569331642446be05292e3e1f8a51218827168cdclaireho} HB_StringToGlyphsFlags;
1695569331642446be05292e3e1f8a51218827168cdclaireho
1705569331642446be05292e3e1f8a51218827168cdclairehotypedef enum {
1715569331642446be05292e3e1f8a51218827168cdclaireho    HB_ShaperFlag_Default = 0,
1725569331642446be05292e3e1f8a51218827168cdclaireho    HB_ShaperFlag_NoKerning = 1,
17357e6107a9d66a9a97b146def0ef38c010f954be6claireho    HB_ShaperFlag_UseDesignMetrics = 2
1745569331642446be05292e3e1f8a51218827168cdclaireho} HB_ShaperFlag;
1755569331642446be05292e3e1f8a51218827168cdclaireho
1765569331642446be05292e3e1f8a51218827168cdclaireho/*
1775569331642446be05292e3e1f8a51218827168cdclaireho   highest value means highest priority for justification. Justification is done by first inserting kashidas
1785569331642446be05292e3e1f8a51218827168cdclaireho   starting with the highest priority positions, then stretching spaces, afterwards extending inter char
1795569331642446be05292e3e1f8a51218827168cdclaireho   spacing, and last spacing between arabic words.
1805569331642446be05292e3e1f8a51218827168cdclaireho   NoJustification is for example set for arabic where no Kashida can be inserted or for diacritics.
1815569331642446be05292e3e1f8a51218827168cdclaireho*/
1825569331642446be05292e3e1f8a51218827168cdclairehotypedef enum {
1835569331642446be05292e3e1f8a51218827168cdclaireho    HB_NoJustification= 0,   /* Justification can't be applied after this glyph */
1845569331642446be05292e3e1f8a51218827168cdclaireho    HB_Arabic_Space   = 1,   /* This glyph represents a space inside arabic text */
1855569331642446be05292e3e1f8a51218827168cdclaireho    HB_Character      = 2,   /* Inter-character justification point follows this glyph */
1865569331642446be05292e3e1f8a51218827168cdclaireho    HB_Space          = 4,   /* This glyph represents a blank outside an Arabic run */
1875569331642446be05292e3e1f8a51218827168cdclaireho    HB_Arabic_Normal  = 7,   /* Normal Middle-Of-Word glyph that connects to the right (begin) */
1885569331642446be05292e3e1f8a51218827168cdclaireho    HB_Arabic_Waw     = 8,   /* Next character is final form of Waw/Ain/Qaf/Fa */
1895569331642446be05292e3e1f8a51218827168cdclaireho    HB_Arabic_BaRa    = 9,   /* Next two chars are Ba + Ra/Ya/AlefMaksura */
1905569331642446be05292e3e1f8a51218827168cdclaireho    HB_Arabic_Alef    = 10,  /* Next character is final form of Alef/Tah/Lam/Kaf/Gaf */
1915569331642446be05292e3e1f8a51218827168cdclaireho    HB_Arabic_HaaDal  = 11,  /* Next character is final form of Haa/Dal/Taa Marbutah */
1925569331642446be05292e3e1f8a51218827168cdclaireho    HB_Arabic_Seen    = 12,  /* Initial or Medial form Of Seen/Sad */
1935569331642446be05292e3e1f8a51218827168cdclaireho    HB_Arabic_Kashida = 13   /* Kashida(U+640) in middle of word */
1945569331642446be05292e3e1f8a51218827168cdclaireho} HB_JustificationClass;
1955569331642446be05292e3e1f8a51218827168cdclaireho
1965569331642446be05292e3e1f8a51218827168cdclaireho/* This structure is binary compatible with Uniscribe's SCRIPT_VISATTR. Would be nice to keep
1975569331642446be05292e3e1f8a51218827168cdclaireho * it like that. If this is a problem please tell Trolltech :)
1985569331642446be05292e3e1f8a51218827168cdclaireho */
1995569331642446be05292e3e1f8a51218827168cdclairehotypedef struct {
20057e6107a9d66a9a97b146def0ef38c010f954be6claireho    hb_bitfield justification   :4;  /* Justification class */
20157e6107a9d66a9a97b146def0ef38c010f954be6claireho    hb_bitfield clusterStart    :1;  /* First glyph of representation of cluster */
20257e6107a9d66a9a97b146def0ef38c010f954be6claireho    hb_bitfield mark            :1;  /* needs to be positioned around base char */
20357e6107a9d66a9a97b146def0ef38c010f954be6claireho    hb_bitfield zeroWidth       :1;  /* ZWJ, ZWNJ etc, with no width */
20457e6107a9d66a9a97b146def0ef38c010f954be6claireho    hb_bitfield dontPrint       :1;
20557e6107a9d66a9a97b146def0ef38c010f954be6claireho    hb_bitfield combiningClass  :8;
2065569331642446be05292e3e1f8a51218827168cdclaireho} HB_GlyphAttributes;
2075569331642446be05292e3e1f8a51218827168cdclaireho
2085569331642446be05292e3e1f8a51218827168cdclairehotypedef struct HB_FaceRec_ {
2095569331642446be05292e3e1f8a51218827168cdclaireho    HB_Bool isSymbolFont;
2105569331642446be05292e3e1f8a51218827168cdclaireho
2115569331642446be05292e3e1f8a51218827168cdclaireho    HB_GDEF gdef;
2125569331642446be05292e3e1f8a51218827168cdclaireho    HB_GSUB gsub;
2135569331642446be05292e3e1f8a51218827168cdclaireho    HB_GPOS gpos;
2145569331642446be05292e3e1f8a51218827168cdclaireho    HB_Bool supported_scripts[HB_ScriptCount];
2155569331642446be05292e3e1f8a51218827168cdclaireho    HB_Buffer buffer;
2165569331642446be05292e3e1f8a51218827168cdclaireho    HB_Script current_script;
2175569331642446be05292e3e1f8a51218827168cdclaireho    int current_flags; /* HB_ShaperFlags */
2185569331642446be05292e3e1f8a51218827168cdclaireho    HB_Bool has_opentype_kerning;
2195569331642446be05292e3e1f8a51218827168cdclaireho    HB_Bool glyphs_substituted;
2205569331642446be05292e3e1f8a51218827168cdclaireho    HB_GlyphAttributes *tmpAttributes;
2215569331642446be05292e3e1f8a51218827168cdclaireho    unsigned int *tmpLogClusters;
2225569331642446be05292e3e1f8a51218827168cdclaireho    int length;
2235569331642446be05292e3e1f8a51218827168cdclaireho    int orig_nglyphs;
2245569331642446be05292e3e1f8a51218827168cdclaireho} HB_FaceRec;
2255569331642446be05292e3e1f8a51218827168cdclaireho
2265569331642446be05292e3e1f8a51218827168cdclairehotypedef HB_Error (*HB_GetFontTableFunc)(void *font, HB_Tag tag, HB_Byte *buffer, HB_UInt *length);
2275569331642446be05292e3e1f8a51218827168cdclaireho
2285569331642446be05292e3e1f8a51218827168cdclairehoHB_Face HB_NewFace(void *font, HB_GetFontTableFunc tableFunc);
2295569331642446be05292e3e1f8a51218827168cdclairehovoid HB_FreeFace(HB_Face face);
2305569331642446be05292e3e1f8a51218827168cdclaireho
2315569331642446be05292e3e1f8a51218827168cdclairehotypedef struct {
2325569331642446be05292e3e1f8a51218827168cdclaireho    HB_Fixed x, y;
2335569331642446be05292e3e1f8a51218827168cdclaireho    HB_Fixed width, height;
2345569331642446be05292e3e1f8a51218827168cdclaireho    HB_Fixed xOffset, yOffset;
2355569331642446be05292e3e1f8a51218827168cdclaireho} HB_GlyphMetrics;
2365569331642446be05292e3e1f8a51218827168cdclaireho
2375569331642446be05292e3e1f8a51218827168cdclairehotypedef enum {
2385569331642446be05292e3e1f8a51218827168cdclaireho    HB_FontAscent
2395569331642446be05292e3e1f8a51218827168cdclaireho} HB_FontMetric;
2405569331642446be05292e3e1f8a51218827168cdclaireho
2415569331642446be05292e3e1f8a51218827168cdclairehotypedef struct {
2425569331642446be05292e3e1f8a51218827168cdclaireho    HB_Bool  (*convertStringToGlyphIndices)(HB_Font font, const HB_UChar16 *string, hb_uint32 length, HB_Glyph *glyphs, hb_uint32 *numGlyphs, HB_Bool rightToLeft);
2435569331642446be05292e3e1f8a51218827168cdclaireho    void     (*getGlyphAdvances)(HB_Font font, const HB_Glyph *glyphs, hb_uint32 numGlyphs, HB_Fixed *advances, int flags /*HB_ShaperFlag*/);
2445569331642446be05292e3e1f8a51218827168cdclaireho    HB_Bool  (*canRender)(HB_Font font, const HB_UChar16 *string, hb_uint32 length);
2455569331642446be05292e3e1f8a51218827168cdclaireho    /* implementation needs to make sure to load a scaled glyph, so /no/ FT_LOAD_NO_SCALE */
2465569331642446be05292e3e1f8a51218827168cdclaireho    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);
2475569331642446be05292e3e1f8a51218827168cdclaireho    void     (*getGlyphMetrics)(HB_Font font, HB_Glyph glyph, HB_GlyphMetrics *metrics);
2485569331642446be05292e3e1f8a51218827168cdclaireho    HB_Fixed (*getFontMetric)(HB_Font font, HB_FontMetric metric);
2495569331642446be05292e3e1f8a51218827168cdclaireho} HB_FontClass;
2505569331642446be05292e3e1f8a51218827168cdclaireho
2515569331642446be05292e3e1f8a51218827168cdclairehotypedef struct HB_Font_ {
2525569331642446be05292e3e1f8a51218827168cdclaireho    const HB_FontClass *klass;
2535569331642446be05292e3e1f8a51218827168cdclaireho
2545569331642446be05292e3e1f8a51218827168cdclaireho    /* Metrics */
2555569331642446be05292e3e1f8a51218827168cdclaireho    HB_UShort x_ppem, y_ppem;
2565569331642446be05292e3e1f8a51218827168cdclaireho    HB_16Dot16 x_scale, y_scale;
2575569331642446be05292e3e1f8a51218827168cdclaireho
2585569331642446be05292e3e1f8a51218827168cdclaireho    void *userData;
2595569331642446be05292e3e1f8a51218827168cdclaireho} HB_FontRec;
2605569331642446be05292e3e1f8a51218827168cdclaireho
26157e6107a9d66a9a97b146def0ef38c010f954be6claireho#ifdef HB_USE_PACKED_STRUCTS
26257e6107a9d66a9a97b146def0ef38c010f954be6claireho#pragma pack(pop)
26357e6107a9d66a9a97b146def0ef38c010f954be6claireho#endif
26457e6107a9d66a9a97b146def0ef38c010f954be6claireho
2655569331642446be05292e3e1f8a51218827168cdclairehotypedef struct HB_ShaperItem_ HB_ShaperItem;
2665569331642446be05292e3e1f8a51218827168cdclaireho
2675569331642446be05292e3e1f8a51218827168cdclairehostruct HB_ShaperItem_ {
2685569331642446be05292e3e1f8a51218827168cdclaireho    const HB_UChar16 *string;               /* input: the Unicode UTF16 text to be shaped */
2695569331642446be05292e3e1f8a51218827168cdclaireho    hb_uint32 stringLength;                 /* input: the length of the input in 16-bit words */
2705569331642446be05292e3e1f8a51218827168cdclaireho    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> */
2715569331642446be05292e3e1f8a51218827168cdclaireho    HB_Font font;                           /* input: the font: scale, units and function pointers supplying glyph indices and metrics */
2725569331642446be05292e3e1f8a51218827168cdclaireho    HB_Face face;                           /* input: the shaper state; current script, access to the OpenType tables , etc. */
2735569331642446be05292e3e1f8a51218827168cdclaireho    int shaperFlags;                        /* input (unused) should be set to 0; intended to support flags defined in HB_ShaperFlag */
2745569331642446be05292e3e1f8a51218827168cdclaireho    HB_Bool glyphIndicesPresent;            /* input: true if the <glyphs> array contains glyph indices ready to be shaped */
2755569331642446be05292e3e1f8a51218827168cdclaireho    hb_uint32 initialGlyphCount;            /* input: if glyphIndicesPresent is true, the number of glyph indices in the <glyphs> array */
2765569331642446be05292e3e1f8a51218827168cdclaireho
2775569331642446be05292e3e1f8a51218827168cdclaireho    hb_uint32 num_glyphs;                   /* input: capacity of output arrays <glyphs>, <attributes>, <advances>, <offsets>, and <log_clusters>; */
2785569331642446be05292e3e1f8a51218827168cdclaireho                                            /* output: required capacity (may be larger than actual capacity) */
2795569331642446be05292e3e1f8a51218827168cdclaireho
2805569331642446be05292e3e1f8a51218827168cdclaireho    HB_Glyph *glyphs;                       /* output: <num_glyphs> indices of shaped glyphs */
2815569331642446be05292e3e1f8a51218827168cdclaireho    HB_GlyphAttributes *attributes;         /* output: <num_glyphs> glyph attributes */
2825569331642446be05292e3e1f8a51218827168cdclaireho    HB_Fixed *advances;                     /* output: <num_glyphs> advances */
2835569331642446be05292e3e1f8a51218827168cdclaireho    HB_FixedPoint *offsets;                 /* output: <num_glyphs> offsets */
2845569331642446be05292e3e1f8a51218827168cdclaireho    unsigned short *log_clusters;           /* output: for each output glyph, the index in the input of the start of its logical cluster */
2855569331642446be05292e3e1f8a51218827168cdclaireho
2865569331642446be05292e3e1f8a51218827168cdclaireho    /* internal */
2875569331642446be05292e3e1f8a51218827168cdclaireho    HB_Bool kerning_applied;                /* output: true if kerning was applied by the shaper */
2885569331642446be05292e3e1f8a51218827168cdclaireho};
2895569331642446be05292e3e1f8a51218827168cdclaireho
2905569331642446be05292e3e1f8a51218827168cdclairehoHB_Bool HB_ShapeItem(HB_ShaperItem *item);
2915569331642446be05292e3e1f8a51218827168cdclaireho
2925569331642446be05292e3e1f8a51218827168cdclairehoHB_END_HEADER
2935569331642446be05292e3e1f8a51218827168cdclaireho
2945569331642446be05292e3e1f8a51218827168cdclaireho#endif
295