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_PRIVATE_H 265569331642446be05292e3e1f8a51218827168cdclaireho#define HARFBUZZ_SHAPER_PRIVATE_H 275569331642446be05292e3e1f8a51218827168cdclaireho 285569331642446be05292e3e1f8a51218827168cdclairehoHB_BEGIN_HEADER 295569331642446be05292e3e1f8a51218827168cdclaireho 305569331642446be05292e3e1f8a51218827168cdclairehoenum { 315569331642446be05292e3e1f8a51218827168cdclaireho C_DOTTED_CIRCLE = 0x25CC 325569331642446be05292e3e1f8a51218827168cdclaireho}; 335569331642446be05292e3e1f8a51218827168cdclaireho 345569331642446be05292e3e1f8a51218827168cdclairehotypedef enum 355569331642446be05292e3e1f8a51218827168cdclaireho{ 365569331642446be05292e3e1f8a51218827168cdclaireho HB_Combining_BelowLeftAttached = 200, 375569331642446be05292e3e1f8a51218827168cdclaireho HB_Combining_BelowAttached = 202, 385569331642446be05292e3e1f8a51218827168cdclaireho HB_Combining_BelowRightAttached = 204, 395569331642446be05292e3e1f8a51218827168cdclaireho HB_Combining_LeftAttached = 208, 405569331642446be05292e3e1f8a51218827168cdclaireho HB_Combining_RightAttached = 210, 415569331642446be05292e3e1f8a51218827168cdclaireho HB_Combining_AboveLeftAttached = 212, 425569331642446be05292e3e1f8a51218827168cdclaireho HB_Combining_AboveAttached = 214, 435569331642446be05292e3e1f8a51218827168cdclaireho HB_Combining_AboveRightAttached = 216, 445569331642446be05292e3e1f8a51218827168cdclaireho 455569331642446be05292e3e1f8a51218827168cdclaireho HB_Combining_BelowLeft = 218, 465569331642446be05292e3e1f8a51218827168cdclaireho HB_Combining_Below = 220, 475569331642446be05292e3e1f8a51218827168cdclaireho HB_Combining_BelowRight = 222, 485569331642446be05292e3e1f8a51218827168cdclaireho HB_Combining_Left = 224, 495569331642446be05292e3e1f8a51218827168cdclaireho HB_Combining_Right = 226, 505569331642446be05292e3e1f8a51218827168cdclaireho HB_Combining_AboveLeft = 228, 515569331642446be05292e3e1f8a51218827168cdclaireho HB_Combining_Above = 230, 525569331642446be05292e3e1f8a51218827168cdclaireho HB_Combining_AboveRight = 232, 535569331642446be05292e3e1f8a51218827168cdclaireho 545569331642446be05292e3e1f8a51218827168cdclaireho HB_Combining_DoubleBelow = 233, 555569331642446be05292e3e1f8a51218827168cdclaireho HB_Combining_DoubleAbove = 234, 565569331642446be05292e3e1f8a51218827168cdclaireho HB_Combining_IotaSubscript = 240 575569331642446be05292e3e1f8a51218827168cdclaireho} HB_CombiningClass; 585569331642446be05292e3e1f8a51218827168cdclaireho 595569331642446be05292e3e1f8a51218827168cdclairehotypedef enum { 6057e6107a9d66a9a97b146def0ef38c010f954be6claireho LocaProperty = 0x1, 6157e6107a9d66a9a97b146def0ef38c010f954be6claireho CcmpProperty = 0x2, 6257e6107a9d66a9a97b146def0ef38c010f954be6claireho InitProperty = 0x4, 6357e6107a9d66a9a97b146def0ef38c010f954be6claireho IsolProperty = 0x8, 6457e6107a9d66a9a97b146def0ef38c010f954be6claireho FinaProperty = 0x10, 6557e6107a9d66a9a97b146def0ef38c010f954be6claireho MediProperty = 0x20, 6657e6107a9d66a9a97b146def0ef38c010f954be6claireho RligProperty = 0x40, 6757e6107a9d66a9a97b146def0ef38c010f954be6claireho CaltProperty = 0x80, 6857e6107a9d66a9a97b146def0ef38c010f954be6claireho LigaProperty = 0x100, 6957e6107a9d66a9a97b146def0ef38c010f954be6claireho DligProperty = 0x200, 7057e6107a9d66a9a97b146def0ef38c010f954be6claireho CswhProperty = 0x400, 7157e6107a9d66a9a97b146def0ef38c010f954be6claireho MsetProperty = 0x800, 725569331642446be05292e3e1f8a51218827168cdclaireho 735569331642446be05292e3e1f8a51218827168cdclaireho /* used by indic and myanmar shaper */ 7457e6107a9d66a9a97b146def0ef38c010f954be6claireho NuktaProperty = 0x8, 7557e6107a9d66a9a97b146def0ef38c010f954be6claireho AkhantProperty = 0x10, 7657e6107a9d66a9a97b146def0ef38c010f954be6claireho RephProperty = 0x20, 7757e6107a9d66a9a97b146def0ef38c010f954be6claireho PreFormProperty = 0x40, 7857e6107a9d66a9a97b146def0ef38c010f954be6claireho BelowFormProperty = 0x80, 7957e6107a9d66a9a97b146def0ef38c010f954be6claireho AboveFormProperty = 0x100, 8057e6107a9d66a9a97b146def0ef38c010f954be6claireho HalfFormProperty = 0x200, 8157e6107a9d66a9a97b146def0ef38c010f954be6claireho PostFormProperty = 0x400, 8257e6107a9d66a9a97b146def0ef38c010f954be6claireho ConjunctFormProperty = 0x800, 8357e6107a9d66a9a97b146def0ef38c010f954be6claireho VattuProperty = 0x1000, 8457e6107a9d66a9a97b146def0ef38c010f954be6claireho PreSubstProperty = 0x2000, 8557e6107a9d66a9a97b146def0ef38c010f954be6claireho BelowSubstProperty = 0x4000, 8657e6107a9d66a9a97b146def0ef38c010f954be6claireho AboveSubstProperty = 0x8000, 8757e6107a9d66a9a97b146def0ef38c010f954be6claireho PostSubstProperty = 0x10000, 8857e6107a9d66a9a97b146def0ef38c010f954be6claireho HalantProperty = 0x20000, 8957e6107a9d66a9a97b146def0ef38c010f954be6claireho CligProperty = 0x40000, 9057e6107a9d66a9a97b146def0ef38c010f954be6claireho IndicCaltProperty = 0x80000 915569331642446be05292e3e1f8a51218827168cdclaireho 925569331642446be05292e3e1f8a51218827168cdclaireho} HB_OpenTypeProperty; 935569331642446be05292e3e1f8a51218827168cdclaireho 945569331642446be05292e3e1f8a51218827168cdclaireho/* return true if ok. */ 955569331642446be05292e3e1f8a51218827168cdclairehotypedef HB_Bool (*HB_ShapeFunction)(HB_ShaperItem *shaper_item); 965569331642446be05292e3e1f8a51218827168cdclairehotypedef void (*HB_AttributeFunction)(HB_Script script, const HB_UChar16 *string, hb_uint32 from, hb_uint32 len, HB_CharAttributes *attributes); 975569331642446be05292e3e1f8a51218827168cdclaireho 985569331642446be05292e3e1f8a51218827168cdclairehotypedef struct { 995569331642446be05292e3e1f8a51218827168cdclaireho HB_ShapeFunction shape; 1005569331642446be05292e3e1f8a51218827168cdclaireho HB_AttributeFunction charAttributes; 1015569331642446be05292e3e1f8a51218827168cdclaireho} HB_ScriptEngine; 1025569331642446be05292e3e1f8a51218827168cdclaireho 1035569331642446be05292e3e1f8a51218827168cdclairehoextern const HB_ScriptEngine hb_scriptEngines[]; 1045569331642446be05292e3e1f8a51218827168cdclaireho 1055569331642446be05292e3e1f8a51218827168cdclairehoextern HB_Bool HB_BasicShape(HB_ShaperItem *shaper_item); 10657e6107a9d66a9a97b146def0ef38c010f954be6clairehoextern HB_Bool HB_GreekShape(HB_ShaperItem *shaper_item); 1075569331642446be05292e3e1f8a51218827168cdclairehoextern HB_Bool HB_TibetanShape(HB_ShaperItem *shaper_item); 1085569331642446be05292e3e1f8a51218827168cdclairehoextern HB_Bool HB_HebrewShape(HB_ShaperItem *shaper_item); 1095569331642446be05292e3e1f8a51218827168cdclairehoextern HB_Bool HB_ArabicShape(HB_ShaperItem *shaper_item); 1105569331642446be05292e3e1f8a51218827168cdclairehoextern HB_Bool HB_HangulShape(HB_ShaperItem *shaper_item); 1115569331642446be05292e3e1f8a51218827168cdclairehoextern HB_Bool HB_MyanmarShape(HB_ShaperItem *shaper_item); 1125569331642446be05292e3e1f8a51218827168cdclairehoextern HB_Bool HB_KhmerShape(HB_ShaperItem *shaper_item); 1135569331642446be05292e3e1f8a51218827168cdclairehoextern HB_Bool HB_IndicShape(HB_ShaperItem *shaper_item); 1145569331642446be05292e3e1f8a51218827168cdclaireho 1155569331642446be05292e3e1f8a51218827168cdclairehoextern void HB_TibetanAttributes(HB_Script script, const HB_UChar16 *string, hb_uint32 from, hb_uint32 len, HB_CharAttributes *attributes); 1165569331642446be05292e3e1f8a51218827168cdclaireho 1175569331642446be05292e3e1f8a51218827168cdclairehoextern void HB_MyanmarAttributes(HB_Script script, const HB_UChar16 *string, hb_uint32 from, hb_uint32 len, HB_CharAttributes *attributes); 1185569331642446be05292e3e1f8a51218827168cdclaireho 1195569331642446be05292e3e1f8a51218827168cdclairehoextern void HB_KhmerAttributes(HB_Script script, const HB_UChar16 *string, hb_uint32 from, hb_uint32 len, HB_CharAttributes *attributes); 1205569331642446be05292e3e1f8a51218827168cdclaireho 1215569331642446be05292e3e1f8a51218827168cdclairehoextern void HB_IndicAttributes(HB_Script script, const HB_UChar16 *string, hb_uint32 from, hb_uint32 len, HB_CharAttributes *attributes); 1225569331642446be05292e3e1f8a51218827168cdclaireho 1235569331642446be05292e3e1f8a51218827168cdclairehoextern void HB_ThaiAttributes(HB_Script script, const HB_UChar16 *string, hb_uint32 from, hb_uint32 len, HB_CharAttributes *attributes); 1245569331642446be05292e3e1f8a51218827168cdclaireho 1255569331642446be05292e3e1f8a51218827168cdclairehotypedef struct { 1265569331642446be05292e3e1f8a51218827168cdclaireho hb_uint32 tag; 1275569331642446be05292e3e1f8a51218827168cdclaireho hb_uint32 property; 1285569331642446be05292e3e1f8a51218827168cdclaireho} HB_OpenTypeFeature; 1295569331642446be05292e3e1f8a51218827168cdclaireho 1305569331642446be05292e3e1f8a51218827168cdclaireho#define PositioningProperties 0x80000000 1315569331642446be05292e3e1f8a51218827168cdclaireho 1325569331642446be05292e3e1f8a51218827168cdclairehoHB_Bool HB_SelectScript(HB_ShaperItem *item, const HB_OpenTypeFeature *features); 1335569331642446be05292e3e1f8a51218827168cdclaireho 1345569331642446be05292e3e1f8a51218827168cdclairehoHB_Bool HB_OpenTypeShape(HB_ShaperItem *item, const hb_uint32 *properties); 1355569331642446be05292e3e1f8a51218827168cdclairehoHB_Bool HB_OpenTypePosition(HB_ShaperItem *item, int availableGlyphs, HB_Bool doLogClusters); 1365569331642446be05292e3e1f8a51218827168cdclaireho 1375569331642446be05292e3e1f8a51218827168cdclairehovoid HB_HeuristicPosition(HB_ShaperItem *item); 1385569331642446be05292e3e1f8a51218827168cdclairehovoid HB_HeuristicSetGlyphAttributes(HB_ShaperItem *item); 1395569331642446be05292e3e1f8a51218827168cdclaireho 1405569331642446be05292e3e1f8a51218827168cdclaireho#define HB_IsControlChar(uc) \ 1415569331642446be05292e3e1f8a51218827168cdclaireho ((uc >= 0x200b && uc <= 0x200f /* ZW Space, ZWNJ, ZWJ, LRM and RLM */) \ 1425569331642446be05292e3e1f8a51218827168cdclaireho || (uc >= 0x2028 && uc <= 0x202f /* LS, PS, LRE, RLE, PDF, LRO, RLO, NNBSP */) \ 1435569331642446be05292e3e1f8a51218827168cdclaireho || (uc >= 0x206a && uc <= 0x206f /* ISS, ASS, IAFS, AFS, NADS, NODS */)) 1445569331642446be05292e3e1f8a51218827168cdclaireho 1455569331642446be05292e3e1f8a51218827168cdclairehoHB_Bool HB_ConvertStringToGlyphIndices(HB_ShaperItem *shaper_item); 1465569331642446be05292e3e1f8a51218827168cdclaireho 1475569331642446be05292e3e1f8a51218827168cdclaireho#define HB_GetGlyphAdvances(shaper_item) \ 1485569331642446be05292e3e1f8a51218827168cdclaireho shaper_item->font->klass->getGlyphAdvances(shaper_item->font, \ 1495569331642446be05292e3e1f8a51218827168cdclaireho shaper_item->glyphs, shaper_item->num_glyphs, \ 1505569331642446be05292e3e1f8a51218827168cdclaireho shaper_item->advances, \ 1515569331642446be05292e3e1f8a51218827168cdclaireho shaper_item->face->current_flags); 1525569331642446be05292e3e1f8a51218827168cdclaireho 1535569331642446be05292e3e1f8a51218827168cdclaireho#define HB_DECLARE_STACKARRAY(Type, Name) \ 1545569331642446be05292e3e1f8a51218827168cdclaireho Type stack##Name[512]; \ 1555569331642446be05292e3e1f8a51218827168cdclaireho Type *Name = stack##Name; 1565569331642446be05292e3e1f8a51218827168cdclaireho 1575569331642446be05292e3e1f8a51218827168cdclaireho#define HB_INIT_STACKARRAY(Type, Name, Length) \ 1585569331642446be05292e3e1f8a51218827168cdclaireho if ((Length) >= 512) \ 1595569331642446be05292e3e1f8a51218827168cdclaireho Name = (Type *)malloc((Length) * sizeof(Type)); 1605569331642446be05292e3e1f8a51218827168cdclaireho 1615569331642446be05292e3e1f8a51218827168cdclaireho#define HB_STACKARRAY(Type, Name, Length) \ 1625569331642446be05292e3e1f8a51218827168cdclaireho HB_DECLARE_STACKARRAY(Type, Name) \ 1635569331642446be05292e3e1f8a51218827168cdclaireho HB_INIT_STACKARRAY(Type, Name, Length) 1645569331642446be05292e3e1f8a51218827168cdclaireho 1655569331642446be05292e3e1f8a51218827168cdclaireho#define HB_FREE_STACKARRAY(Name) \ 1665569331642446be05292e3e1f8a51218827168cdclaireho if (stack##Name != Name) \ 1675569331642446be05292e3e1f8a51218827168cdclaireho free(Name); 1685569331642446be05292e3e1f8a51218827168cdclaireho 1695569331642446be05292e3e1f8a51218827168cdclairehoHB_END_HEADER 1705569331642446be05292e3e1f8a51218827168cdclaireho 1715569331642446be05292e3e1f8a51218827168cdclaireho#endif 172