15569331642446be05292e3e1f8a51218827168cdclaireho/* 25569331642446be05292e3e1f8a51218827168cdclaireho * Copyright (C) 1998-2004 David Turner and Werner Lemberg 35569331642446be05292e3e1f8a51218827168cdclaireho * Copyright (C) 2006 Behdad Esfahbod 45569331642446be05292e3e1f8a51218827168cdclaireho * 55569331642446be05292e3e1f8a51218827168cdclaireho * This is part of HarfBuzz, an OpenType Layout engine library. 65569331642446be05292e3e1f8a51218827168cdclaireho * 75569331642446be05292e3e1f8a51218827168cdclaireho * Permission is hereby granted, without written agreement and without 85569331642446be05292e3e1f8a51218827168cdclaireho * license or royalty fees, to use, copy, modify, and distribute this 95569331642446be05292e3e1f8a51218827168cdclaireho * software and its documentation for any purpose, provided that the 105569331642446be05292e3e1f8a51218827168cdclaireho * above copyright notice and the following two paragraphs appear in 115569331642446be05292e3e1f8a51218827168cdclaireho * all copies of this software. 125569331642446be05292e3e1f8a51218827168cdclaireho * 135569331642446be05292e3e1f8a51218827168cdclaireho * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR 145569331642446be05292e3e1f8a51218827168cdclaireho * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES 155569331642446be05292e3e1f8a51218827168cdclaireho * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN 165569331642446be05292e3e1f8a51218827168cdclaireho * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH 175569331642446be05292e3e1f8a51218827168cdclaireho * DAMAGE. 185569331642446be05292e3e1f8a51218827168cdclaireho * 195569331642446be05292e3e1f8a51218827168cdclaireho * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, 205569331642446be05292e3e1f8a51218827168cdclaireho * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 215569331642446be05292e3e1f8a51218827168cdclaireho * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS 225569331642446be05292e3e1f8a51218827168cdclaireho * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO 235569331642446be05292e3e1f8a51218827168cdclaireho * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. 245569331642446be05292e3e1f8a51218827168cdclaireho */ 255569331642446be05292e3e1f8a51218827168cdclaireho 265569331642446be05292e3e1f8a51218827168cdclaireho#ifndef HARFBUZZ_GDEF_H 275569331642446be05292e3e1f8a51218827168cdclaireho#define HARFBUZZ_GDEF_H 285569331642446be05292e3e1f8a51218827168cdclaireho 295569331642446be05292e3e1f8a51218827168cdclaireho#include "harfbuzz-open.h" 305569331642446be05292e3e1f8a51218827168cdclaireho#include "harfbuzz-stream.h" 315569331642446be05292e3e1f8a51218827168cdclaireho 325569331642446be05292e3e1f8a51218827168cdclairehoHB_BEGIN_HEADER 335569331642446be05292e3e1f8a51218827168cdclaireho 3457e6107a9d66a9a97b146def0ef38c010f954be6claireho#ifdef HB_USE_PACKED_STRUCTS 3557e6107a9d66a9a97b146def0ef38c010f954be6claireho#pragma pack(push, 1) 3657e6107a9d66a9a97b146def0ef38c010f954be6claireho#endif 3757e6107a9d66a9a97b146def0ef38c010f954be6claireho 385569331642446be05292e3e1f8a51218827168cdclaireho/* GDEF glyph properties. Note that HB_GDEF_COMPONENT has no corresponding 395569331642446be05292e3e1f8a51218827168cdclaireho * flag in the LookupFlag field. */ 405569331642446be05292e3e1f8a51218827168cdclaireho#define HB_GDEF_BASE_GLYPH 0x0002 415569331642446be05292e3e1f8a51218827168cdclaireho#define HB_GDEF_LIGATURE 0x0004 425569331642446be05292e3e1f8a51218827168cdclaireho#define HB_GDEF_MARK 0x0008 435569331642446be05292e3e1f8a51218827168cdclaireho#define HB_GDEF_COMPONENT 0x0010 445569331642446be05292e3e1f8a51218827168cdclaireho 455569331642446be05292e3e1f8a51218827168cdclaireho 465569331642446be05292e3e1f8a51218827168cdclairehotypedef struct HB_AttachPoint_ HB_AttachPoint; 475569331642446be05292e3e1f8a51218827168cdclaireho 485569331642446be05292e3e1f8a51218827168cdclaireho 495569331642446be05292e3e1f8a51218827168cdclairehostruct HB_AttachList_ 505569331642446be05292e3e1f8a51218827168cdclaireho{ 5157e6107a9d66a9a97b146def0ef38c010f954be6claireho HB_AttachPoint* AttachPoint; /* array of AttachPoint tables */ 525569331642446be05292e3e1f8a51218827168cdclaireho HB_Coverage Coverage; /* Coverage table */ 535569331642446be05292e3e1f8a51218827168cdclaireho HB_UShort GlyphCount; /* number of glyphs with 545569331642446be05292e3e1f8a51218827168cdclaireho attachments */ 5557e6107a9d66a9a97b146def0ef38c010f954be6claireho HB_Bool loaded; 565569331642446be05292e3e1f8a51218827168cdclaireho}; 575569331642446be05292e3e1f8a51218827168cdclaireho 585569331642446be05292e3e1f8a51218827168cdclairehotypedef struct HB_AttachList_ HB_AttachList; 595569331642446be05292e3e1f8a51218827168cdclaireho 605569331642446be05292e3e1f8a51218827168cdclairehotypedef struct HB_LigGlyph_ HB_LigGlyph; 615569331642446be05292e3e1f8a51218827168cdclaireho 625569331642446be05292e3e1f8a51218827168cdclairehostruct HB_LigCaretList_ 635569331642446be05292e3e1f8a51218827168cdclaireho{ 6457e6107a9d66a9a97b146def0ef38c010f954be6claireho HB_LigGlyph* LigGlyph; /* array of LigGlyph tables */ 655569331642446be05292e3e1f8a51218827168cdclaireho HB_Coverage Coverage; /* Coverage table */ 665569331642446be05292e3e1f8a51218827168cdclaireho HB_UShort LigGlyphCount; /* number of ligature glyphs */ 6757e6107a9d66a9a97b146def0ef38c010f954be6claireho HB_Bool loaded; 685569331642446be05292e3e1f8a51218827168cdclaireho}; 695569331642446be05292e3e1f8a51218827168cdclaireho 705569331642446be05292e3e1f8a51218827168cdclairehotypedef struct HB_LigCaretList_ HB_LigCaretList; 715569331642446be05292e3e1f8a51218827168cdclaireho 725569331642446be05292e3e1f8a51218827168cdclaireho 735569331642446be05292e3e1f8a51218827168cdclaireho 745569331642446be05292e3e1f8a51218827168cdclaireho/* The `NewGlyphClasses' field is not defined in the TTO specification. 755569331642446be05292e3e1f8a51218827168cdclaireho We use it for fonts with a constructed `GlyphClassDef' structure 765569331642446be05292e3e1f8a51218827168cdclaireho (i.e., which don't have a GDEF table) to collect glyph classes 775569331642446be05292e3e1f8a51218827168cdclaireho assigned during the lookup process. The number of arrays in this 785569331642446be05292e3e1f8a51218827168cdclaireho pointer array is GlyphClassDef->cd.cd2.ClassRangeCount+1; the nth 795569331642446be05292e3e1f8a51218827168cdclaireho array then contains the glyph class values of the glyphs not covered 805569331642446be05292e3e1f8a51218827168cdclaireho by the ClassRangeRecords structures with index n-1 and n. We store 815569331642446be05292e3e1f8a51218827168cdclaireho glyph class values for four glyphs in a single array element. 825569331642446be05292e3e1f8a51218827168cdclaireho 835569331642446be05292e3e1f8a51218827168cdclaireho `LastGlyph' is identical to the number of glyphs minus one in the 845569331642446be05292e3e1f8a51218827168cdclaireho font; we need it only if `NewGlyphClasses' is not NULL (to have an 855569331642446be05292e3e1f8a51218827168cdclaireho upper bound for the last array). 865569331642446be05292e3e1f8a51218827168cdclaireho 875569331642446be05292e3e1f8a51218827168cdclaireho Note that we first store the file offset to the `MarkAttachClassDef' 885569331642446be05292e3e1f8a51218827168cdclaireho field (which has been introduced in OpenType 1.2) -- since the 895569331642446be05292e3e1f8a51218827168cdclaireho `Version' field value hasn't been increased to indicate that we have 905569331642446be05292e3e1f8a51218827168cdclaireho one more field for some obscure reason, we must parse the GSUB table 915569331642446be05292e3e1f8a51218827168cdclaireho to find out whether class values refer to this table. Only then we 925569331642446be05292e3e1f8a51218827168cdclaireho can finally load the MarkAttachClassDef structure if necessary. */ 935569331642446be05292e3e1f8a51218827168cdclaireho 945569331642446be05292e3e1f8a51218827168cdclairehostruct HB_GDEFHeader_ 955569331642446be05292e3e1f8a51218827168cdclaireho{ 9657e6107a9d66a9a97b146def0ef38c010f954be6claireho HB_UShort** NewGlyphClasses; 975569331642446be05292e3e1f8a51218827168cdclaireho HB_UInt offset; 9857e6107a9d66a9a97b146def0ef38c010f954be6claireho HB_UInt MarkAttachClassDef_offset; 995569331642446be05292e3e1f8a51218827168cdclaireho 1005569331642446be05292e3e1f8a51218827168cdclaireho HB_16Dot16 Version; 1015569331642446be05292e3e1f8a51218827168cdclaireho 1025569331642446be05292e3e1f8a51218827168cdclaireho HB_ClassDefinition GlyphClassDef; 1035569331642446be05292e3e1f8a51218827168cdclaireho HB_AttachList AttachList; 1045569331642446be05292e3e1f8a51218827168cdclaireho HB_LigCaretList LigCaretList; 1055569331642446be05292e3e1f8a51218827168cdclaireho HB_ClassDefinition MarkAttachClassDef; /* new in OT 1.2 */ 1065569331642446be05292e3e1f8a51218827168cdclaireho 1075569331642446be05292e3e1f8a51218827168cdclaireho HB_UShort LastGlyph; 1085569331642446be05292e3e1f8a51218827168cdclaireho}; 1095569331642446be05292e3e1f8a51218827168cdclaireho 1105569331642446be05292e3e1f8a51218827168cdclairehotypedef struct HB_GDEFHeader_ HB_GDEFHeader; 1115569331642446be05292e3e1f8a51218827168cdclairehotypedef struct HB_GDEFHeader_* HB_GDEF; 1125569331642446be05292e3e1f8a51218827168cdclaireho 1135569331642446be05292e3e1f8a51218827168cdclaireho 1145569331642446be05292e3e1f8a51218827168cdclairehoHB_Error HB_New_GDEF_Table( HB_GDEFHeader** retptr ); 1155569331642446be05292e3e1f8a51218827168cdclaireho 1165569331642446be05292e3e1f8a51218827168cdclaireho 1175569331642446be05292e3e1f8a51218827168cdclairehoHB_Error HB_Load_GDEF_Table( HB_Stream stream, 1185569331642446be05292e3e1f8a51218827168cdclaireho HB_GDEFHeader** gdef ); 1195569331642446be05292e3e1f8a51218827168cdclaireho 1205569331642446be05292e3e1f8a51218827168cdclaireho 1215569331642446be05292e3e1f8a51218827168cdclairehoHB_Error HB_Done_GDEF_Table ( HB_GDEFHeader* gdef ); 1225569331642446be05292e3e1f8a51218827168cdclaireho 1235569331642446be05292e3e1f8a51218827168cdclaireho 1245569331642446be05292e3e1f8a51218827168cdclairehoHB_Error HB_GDEF_Get_Glyph_Property( HB_GDEFHeader* gdef, 1255569331642446be05292e3e1f8a51218827168cdclaireho HB_UShort glyphID, 1265569331642446be05292e3e1f8a51218827168cdclaireho HB_UShort* property ); 1275569331642446be05292e3e1f8a51218827168cdclaireho 1285569331642446be05292e3e1f8a51218827168cdclairehoHB_Error HB_GDEF_Build_ClassDefinition( HB_GDEFHeader* gdef, 1295569331642446be05292e3e1f8a51218827168cdclaireho HB_UShort num_glyphs, 1305569331642446be05292e3e1f8a51218827168cdclaireho HB_UShort glyph_count, 1315569331642446be05292e3e1f8a51218827168cdclaireho HB_UShort* glyph_array, 1325569331642446be05292e3e1f8a51218827168cdclaireho HB_UShort* class_array ); 1335569331642446be05292e3e1f8a51218827168cdclaireho 13457e6107a9d66a9a97b146def0ef38c010f954be6claireho#ifdef HB_USE_PACKED_STRUCTS 13557e6107a9d66a9a97b146def0ef38c010f954be6claireho#pragma pack(pop) 13657e6107a9d66a9a97b146def0ef38c010f954be6claireho#endif 1375569331642446be05292e3e1f8a51218827168cdclaireho 1385569331642446be05292e3e1f8a51218827168cdclairehoHB_END_HEADER 1395569331642446be05292e3e1f8a51218827168cdclaireho 1405569331642446be05292e3e1f8a51218827168cdclaireho#endif /* HARFBUZZ_GDEF_H */ 141