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_GSUB_H 275569331642446be05292e3e1f8a51218827168cdclaireho#define HARFBUZZ_GSUB_H 285569331642446be05292e3e1f8a51218827168cdclaireho 295569331642446be05292e3e1f8a51218827168cdclaireho#include "harfbuzz-gdef.h" 305569331642446be05292e3e1f8a51218827168cdclaireho#include "harfbuzz-buffer.h" 315569331642446be05292e3e1f8a51218827168cdclaireho 325569331642446be05292e3e1f8a51218827168cdclairehoHB_BEGIN_HEADER 335569331642446be05292e3e1f8a51218827168cdclaireho 345569331642446be05292e3e1f8a51218827168cdclaireho 3557e6107a9d66a9a97b146def0ef38c010f954be6claireho#ifdef HB_USE_PACKED_STRUCTS 3657e6107a9d66a9a97b146def0ef38c010f954be6claireho#pragma pack(push, 1) 3757e6107a9d66a9a97b146def0ef38c010f954be6claireho#endif 3857e6107a9d66a9a97b146def0ef38c010f954be6claireho 395569331642446be05292e3e1f8a51218827168cdclaireho/* Lookup types for glyph substitution */ 405569331642446be05292e3e1f8a51218827168cdclaireho 415569331642446be05292e3e1f8a51218827168cdclaireho#define HB_GSUB_LOOKUP_SINGLE 1 425569331642446be05292e3e1f8a51218827168cdclaireho#define HB_GSUB_LOOKUP_MULTIPLE 2 435569331642446be05292e3e1f8a51218827168cdclaireho#define HB_GSUB_LOOKUP_ALTERNATE 3 445569331642446be05292e3e1f8a51218827168cdclaireho#define HB_GSUB_LOOKUP_LIGATURE 4 455569331642446be05292e3e1f8a51218827168cdclaireho#define HB_GSUB_LOOKUP_CONTEXT 5 465569331642446be05292e3e1f8a51218827168cdclaireho#define HB_GSUB_LOOKUP_CHAIN 6 475569331642446be05292e3e1f8a51218827168cdclaireho#define HB_GSUB_LOOKUP_EXTENSION 7 485569331642446be05292e3e1f8a51218827168cdclaireho#define HB_GSUB_LOOKUP_REVERSE_CHAIN 8 495569331642446be05292e3e1f8a51218827168cdclaireho 505569331642446be05292e3e1f8a51218827168cdclaireho 515569331642446be05292e3e1f8a51218827168cdclaireho/* A pointer to a function which selects the alternate glyph. `pos' is 525569331642446be05292e3e1f8a51218827168cdclaireho the position of the glyph with index `glyphID', `num_alternates' 535569331642446be05292e3e1f8a51218827168cdclaireho gives the number of alternates in the `alternates' array. `data' 545569331642446be05292e3e1f8a51218827168cdclaireho points to the user-defined structure specified during a call to 555569331642446be05292e3e1f8a51218827168cdclaireho HB_GSUB_Register_Alternate_Function(). The function must return an 565569331642446be05292e3e1f8a51218827168cdclaireho index into the `alternates' array. */ 575569331642446be05292e3e1f8a51218827168cdclaireho 585569331642446be05292e3e1f8a51218827168cdclairehotypedef HB_UShort (*HB_AltFunction)(HB_UInt pos, 595569331642446be05292e3e1f8a51218827168cdclaireho HB_UShort glyphID, 605569331642446be05292e3e1f8a51218827168cdclaireho HB_UShort num_alternates, 615569331642446be05292e3e1f8a51218827168cdclaireho HB_UShort* alternates, 625569331642446be05292e3e1f8a51218827168cdclaireho void* data ); 635569331642446be05292e3e1f8a51218827168cdclaireho 645569331642446be05292e3e1f8a51218827168cdclaireho 655569331642446be05292e3e1f8a51218827168cdclairehostruct HB_GSUBHeader_ 665569331642446be05292e3e1f8a51218827168cdclaireho{ 6757e6107a9d66a9a97b146def0ef38c010f954be6claireho HB_GDEFHeader* gdef; 6857e6107a9d66a9a97b146def0ef38c010f954be6claireho 6957e6107a9d66a9a97b146def0ef38c010f954be6claireho /* the next two fields are used for an alternate substitution callback 7057e6107a9d66a9a97b146def0ef38c010f954be6claireho function to select the proper alternate glyph. */ 7157e6107a9d66a9a97b146def0ef38c010f954be6claireho 7257e6107a9d66a9a97b146def0ef38c010f954be6claireho void* data; 7357e6107a9d66a9a97b146def0ef38c010f954be6claireho HB_AltFunction altfunc; 7457e6107a9d66a9a97b146def0ef38c010f954be6claireho 755569331642446be05292e3e1f8a51218827168cdclaireho HB_UInt offset; 765569331642446be05292e3e1f8a51218827168cdclaireho 775569331642446be05292e3e1f8a51218827168cdclaireho HB_16Dot16 Version; 785569331642446be05292e3e1f8a51218827168cdclaireho 795569331642446be05292e3e1f8a51218827168cdclaireho HB_ScriptList ScriptList; 805569331642446be05292e3e1f8a51218827168cdclaireho HB_FeatureList FeatureList; 815569331642446be05292e3e1f8a51218827168cdclaireho HB_LookupList LookupList; 825569331642446be05292e3e1f8a51218827168cdclaireho}; 835569331642446be05292e3e1f8a51218827168cdclaireho 845569331642446be05292e3e1f8a51218827168cdclairehotypedef struct HB_GSUBHeader_ HB_GSUBHeader; 855569331642446be05292e3e1f8a51218827168cdclairehotypedef HB_GSUBHeader* HB_GSUB; 865569331642446be05292e3e1f8a51218827168cdclaireho 875569331642446be05292e3e1f8a51218827168cdclaireho 885569331642446be05292e3e1f8a51218827168cdclairehoHB_Error HB_Load_GSUB_Table( HB_Stream stream, 895569331642446be05292e3e1f8a51218827168cdclaireho HB_GSUBHeader** gsub, 905569331642446be05292e3e1f8a51218827168cdclaireho HB_GDEFHeader* gdef, 915569331642446be05292e3e1f8a51218827168cdclaireho HB_Stream gdefStream ); 925569331642446be05292e3e1f8a51218827168cdclaireho 935569331642446be05292e3e1f8a51218827168cdclaireho 945569331642446be05292e3e1f8a51218827168cdclairehoHB_Error HB_Done_GSUB_Table( HB_GSUBHeader* gsub ); 955569331642446be05292e3e1f8a51218827168cdclaireho 965569331642446be05292e3e1f8a51218827168cdclaireho 975569331642446be05292e3e1f8a51218827168cdclairehoHB_Error HB_GSUB_Select_Script( HB_GSUBHeader* gsub, 985569331642446be05292e3e1f8a51218827168cdclaireho HB_UInt script_tag, 995569331642446be05292e3e1f8a51218827168cdclaireho HB_UShort* script_index ); 1005569331642446be05292e3e1f8a51218827168cdclaireho 1015569331642446be05292e3e1f8a51218827168cdclairehoHB_Error HB_GSUB_Select_Language( HB_GSUBHeader* gsub, 1025569331642446be05292e3e1f8a51218827168cdclaireho HB_UInt language_tag, 1035569331642446be05292e3e1f8a51218827168cdclaireho HB_UShort script_index, 1045569331642446be05292e3e1f8a51218827168cdclaireho HB_UShort* language_index, 1055569331642446be05292e3e1f8a51218827168cdclaireho HB_UShort* req_feature_index ); 1065569331642446be05292e3e1f8a51218827168cdclaireho 1075569331642446be05292e3e1f8a51218827168cdclairehoHB_Error HB_GSUB_Select_Feature( HB_GSUBHeader* gsub, 1085569331642446be05292e3e1f8a51218827168cdclaireho HB_UInt feature_tag, 1095569331642446be05292e3e1f8a51218827168cdclaireho HB_UShort script_index, 1105569331642446be05292e3e1f8a51218827168cdclaireho HB_UShort language_index, 1115569331642446be05292e3e1f8a51218827168cdclaireho HB_UShort* feature_index ); 1125569331642446be05292e3e1f8a51218827168cdclaireho 1135569331642446be05292e3e1f8a51218827168cdclaireho 1145569331642446be05292e3e1f8a51218827168cdclairehoHB_Error HB_GSUB_Query_Scripts( HB_GSUBHeader* gsub, 1155569331642446be05292e3e1f8a51218827168cdclaireho HB_UInt** script_tag_list ); 1165569331642446be05292e3e1f8a51218827168cdclaireho 1175569331642446be05292e3e1f8a51218827168cdclairehoHB_Error HB_GSUB_Query_Languages( HB_GSUBHeader* gsub, 1185569331642446be05292e3e1f8a51218827168cdclaireho HB_UShort script_index, 1195569331642446be05292e3e1f8a51218827168cdclaireho HB_UInt** language_tag_list ); 1205569331642446be05292e3e1f8a51218827168cdclaireho 1215569331642446be05292e3e1f8a51218827168cdclairehoHB_Error HB_GSUB_Query_Features( HB_GSUBHeader* gsub, 1225569331642446be05292e3e1f8a51218827168cdclaireho HB_UShort script_index, 1235569331642446be05292e3e1f8a51218827168cdclaireho HB_UShort language_index, 1245569331642446be05292e3e1f8a51218827168cdclaireho HB_UInt** feature_tag_list ); 1255569331642446be05292e3e1f8a51218827168cdclaireho 1265569331642446be05292e3e1f8a51218827168cdclaireho 1275569331642446be05292e3e1f8a51218827168cdclairehoHB_Error HB_GSUB_Add_Feature( HB_GSUBHeader* gsub, 1285569331642446be05292e3e1f8a51218827168cdclaireho HB_UShort feature_index, 1295569331642446be05292e3e1f8a51218827168cdclaireho HB_UInt property ); 1305569331642446be05292e3e1f8a51218827168cdclaireho 1315569331642446be05292e3e1f8a51218827168cdclairehoHB_Error HB_GSUB_Clear_Features( HB_GSUBHeader* gsub ); 1325569331642446be05292e3e1f8a51218827168cdclaireho 1335569331642446be05292e3e1f8a51218827168cdclaireho 1345569331642446be05292e3e1f8a51218827168cdclairehoHB_Error HB_GSUB_Register_Alternate_Function( HB_GSUBHeader* gsub, 1355569331642446be05292e3e1f8a51218827168cdclaireho HB_AltFunction altfunc, 1365569331642446be05292e3e1f8a51218827168cdclaireho void* data ); 1375569331642446be05292e3e1f8a51218827168cdclaireho 1385569331642446be05292e3e1f8a51218827168cdclaireho 1395569331642446be05292e3e1f8a51218827168cdclairehoHB_Error HB_GSUB_Apply_String( HB_GSUBHeader* gsub, 1405569331642446be05292e3e1f8a51218827168cdclaireho HB_Buffer buffer ); 1415569331642446be05292e3e1f8a51218827168cdclaireho 14257e6107a9d66a9a97b146def0ef38c010f954be6claireho#ifdef HB_USE_PACKED_STRUCTS 14357e6107a9d66a9a97b146def0ef38c010f954be6claireho#pragma pack(pop) 14457e6107a9d66a9a97b146def0ef38c010f954be6claireho#endif 1455569331642446be05292e3e1f8a51218827168cdclaireho 1465569331642446be05292e3e1f8a51218827168cdclairehoHB_END_HEADER 1475569331642446be05292e3e1f8a51218827168cdclaireho 1485569331642446be05292e3e1f8a51218827168cdclaireho#endif /* HARFBUZZ_GSUB_H */ 149