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_GPOS_H
275569331642446be05292e3e1f8a51218827168cdclaireho#define HARFBUZZ_GPOS_H
285569331642446be05292e3e1f8a51218827168cdclaireho
295569331642446be05292e3e1f8a51218827168cdclaireho#include "harfbuzz-gdef.h"
305569331642446be05292e3e1f8a51218827168cdclaireho#include "harfbuzz-buffer.h"
315569331642446be05292e3e1f8a51218827168cdclaireho
325569331642446be05292e3e1f8a51218827168cdclairehoHB_BEGIN_HEADER
335569331642446be05292e3e1f8a51218827168cdclaireho
345569331642446be05292e3e1f8a51218827168cdclaireho
355569331642446be05292e3e1f8a51218827168cdclaireho/* Lookup types for glyph positioning */
365569331642446be05292e3e1f8a51218827168cdclaireho
375569331642446be05292e3e1f8a51218827168cdclaireho#define HB_GPOS_LOOKUP_SINGLE     1
385569331642446be05292e3e1f8a51218827168cdclaireho#define HB_GPOS_LOOKUP_PAIR       2
395569331642446be05292e3e1f8a51218827168cdclaireho#define HB_GPOS_LOOKUP_CURSIVE    3
405569331642446be05292e3e1f8a51218827168cdclaireho#define HB_GPOS_LOOKUP_MARKBASE   4
415569331642446be05292e3e1f8a51218827168cdclaireho#define HB_GPOS_LOOKUP_MARKLIG    5
425569331642446be05292e3e1f8a51218827168cdclaireho#define HB_GPOS_LOOKUP_MARKMARK   6
435569331642446be05292e3e1f8a51218827168cdclaireho#define HB_GPOS_LOOKUP_CONTEXT    7
445569331642446be05292e3e1f8a51218827168cdclaireho#define HB_GPOS_LOOKUP_CHAIN      8
455569331642446be05292e3e1f8a51218827168cdclaireho#define HB_GPOS_LOOKUP_EXTENSION  9
465569331642446be05292e3e1f8a51218827168cdclaireho
4757e6107a9d66a9a97b146def0ef38c010f954be6claireho#ifdef HB_SUPPORT_MULTIPLE_MASTER
485569331642446be05292e3e1f8a51218827168cdclaireho/* A pointer to a function which accesses the PostScript interpreter.
495569331642446be05292e3e1f8a51218827168cdclaireho   Multiple Master fonts need this interface to convert a metric ID
505569331642446be05292e3e1f8a51218827168cdclaireho   (as stored in an OpenType font version 1.2 or higher) `metric_id'
515569331642446be05292e3e1f8a51218827168cdclaireho   into a metric value (returned in `metric_value').
525569331642446be05292e3e1f8a51218827168cdclaireho
535569331642446be05292e3e1f8a51218827168cdclaireho   `data' points to the user-defined structure specified during a
545569331642446be05292e3e1f8a51218827168cdclaireho   call to HB_GPOS_Register_MM_Function().
555569331642446be05292e3e1f8a51218827168cdclaireho
565569331642446be05292e3e1f8a51218827168cdclaireho   `metric_value' must be returned as a scaled value (but shouldn't
575569331642446be05292e3e1f8a51218827168cdclaireho   be rounded).                                                       */
585569331642446be05292e3e1f8a51218827168cdclaireho
595569331642446be05292e3e1f8a51218827168cdclairehotypedef HB_Error  (*HB_MMFunction)(HB_Font       font,
605569331642446be05292e3e1f8a51218827168cdclaireho				    HB_UShort    metric_id,
615569331642446be05292e3e1f8a51218827168cdclaireho				    HB_Fixed*      metric_value,
625569331642446be05292e3e1f8a51218827168cdclaireho				    void*        data );
6357e6107a9d66a9a97b146def0ef38c010f954be6claireho#endif
645569331642446be05292e3e1f8a51218827168cdclaireho
655569331642446be05292e3e1f8a51218827168cdclaireho
665569331642446be05292e3e1f8a51218827168cdclairehostruct  HB_GPOSHeader_
675569331642446be05292e3e1f8a51218827168cdclaireho{
685569331642446be05292e3e1f8a51218827168cdclaireho  HB_16Dot16           Version;
695569331642446be05292e3e1f8a51218827168cdclaireho
705569331642446be05292e3e1f8a51218827168cdclaireho  HB_ScriptList     ScriptList;
715569331642446be05292e3e1f8a51218827168cdclaireho  HB_FeatureList    FeatureList;
725569331642446be05292e3e1f8a51218827168cdclaireho  HB_LookupList     LookupList;
735569331642446be05292e3e1f8a51218827168cdclaireho
745569331642446be05292e3e1f8a51218827168cdclaireho  HB_GDEFHeader*    gdef;
755569331642446be05292e3e1f8a51218827168cdclaireho
7657e6107a9d66a9a97b146def0ef38c010f954be6claireho#ifdef HB_SUPPORT_MULTIPLE_MASTER
775569331642446be05292e3e1f8a51218827168cdclaireho  /* this is OpenType 1.2 -- Multiple Master fonts need this
785569331642446be05292e3e1f8a51218827168cdclaireho     callback function to get various metric values from the
795569331642446be05292e3e1f8a51218827168cdclaireho     PostScript interpreter.                                 */
805569331642446be05292e3e1f8a51218827168cdclaireho
815569331642446be05292e3e1f8a51218827168cdclaireho  HB_MMFunction     mmfunc;
825569331642446be05292e3e1f8a51218827168cdclaireho  void*              data;
8357e6107a9d66a9a97b146def0ef38c010f954be6claireho#endif
845569331642446be05292e3e1f8a51218827168cdclaireho};
855569331642446be05292e3e1f8a51218827168cdclaireho
865569331642446be05292e3e1f8a51218827168cdclairehotypedef struct HB_GPOSHeader_  HB_GPOSHeader;
875569331642446be05292e3e1f8a51218827168cdclairehotypedef HB_GPOSHeader* HB_GPOS;
885569331642446be05292e3e1f8a51218827168cdclaireho
895569331642446be05292e3e1f8a51218827168cdclaireho
905569331642446be05292e3e1f8a51218827168cdclairehoHB_Error  HB_Load_GPOS_Table( HB_Stream stream,
915569331642446be05292e3e1f8a51218827168cdclaireho                              HB_GPOSHeader** gpos,
925569331642446be05292e3e1f8a51218827168cdclaireho			      HB_GDEFHeader*  gdef,
935569331642446be05292e3e1f8a51218827168cdclaireho                              HB_Stream       gdefStream );
945569331642446be05292e3e1f8a51218827168cdclaireho
955569331642446be05292e3e1f8a51218827168cdclaireho
965569331642446be05292e3e1f8a51218827168cdclairehoHB_Error  HB_Done_GPOS_Table( HB_GPOSHeader* gpos );
975569331642446be05292e3e1f8a51218827168cdclaireho
985569331642446be05292e3e1f8a51218827168cdclaireho
995569331642446be05292e3e1f8a51218827168cdclairehoHB_Error  HB_GPOS_Select_Script( HB_GPOSHeader*  gpos,
1005569331642446be05292e3e1f8a51218827168cdclaireho				 HB_UInt         script_tag,
1015569331642446be05292e3e1f8a51218827168cdclaireho				 HB_UShort*       script_index );
1025569331642446be05292e3e1f8a51218827168cdclaireho
1035569331642446be05292e3e1f8a51218827168cdclairehoHB_Error  HB_GPOS_Select_Language( HB_GPOSHeader*  gpos,
1045569331642446be05292e3e1f8a51218827168cdclaireho				   HB_UInt         language_tag,
1055569331642446be05292e3e1f8a51218827168cdclaireho				   HB_UShort        script_index,
1065569331642446be05292e3e1f8a51218827168cdclaireho				   HB_UShort*       language_index,
1075569331642446be05292e3e1f8a51218827168cdclaireho				   HB_UShort*       req_feature_index );
1085569331642446be05292e3e1f8a51218827168cdclaireho
1095569331642446be05292e3e1f8a51218827168cdclairehoHB_Error  HB_GPOS_Select_Feature( HB_GPOSHeader*  gpos,
1105569331642446be05292e3e1f8a51218827168cdclaireho				  HB_UInt         feature_tag,
1115569331642446be05292e3e1f8a51218827168cdclaireho				  HB_UShort        script_index,
1125569331642446be05292e3e1f8a51218827168cdclaireho				  HB_UShort        language_index,
1135569331642446be05292e3e1f8a51218827168cdclaireho				  HB_UShort*       feature_index );
1145569331642446be05292e3e1f8a51218827168cdclaireho
1155569331642446be05292e3e1f8a51218827168cdclaireho
1165569331642446be05292e3e1f8a51218827168cdclairehoHB_Error  HB_GPOS_Query_Scripts( HB_GPOSHeader*  gpos,
1175569331642446be05292e3e1f8a51218827168cdclaireho				 HB_UInt**       script_tag_list );
1185569331642446be05292e3e1f8a51218827168cdclaireho
1195569331642446be05292e3e1f8a51218827168cdclairehoHB_Error  HB_GPOS_Query_Languages( HB_GPOSHeader*  gpos,
1205569331642446be05292e3e1f8a51218827168cdclaireho				   HB_UShort        script_index,
1215569331642446be05292e3e1f8a51218827168cdclaireho				   HB_UInt**       language_tag_list );
1225569331642446be05292e3e1f8a51218827168cdclaireho
1235569331642446be05292e3e1f8a51218827168cdclairehoHB_Error  HB_GPOS_Query_Features( HB_GPOSHeader*  gpos,
1245569331642446be05292e3e1f8a51218827168cdclaireho				  HB_UShort        script_index,
1255569331642446be05292e3e1f8a51218827168cdclaireho				  HB_UShort        language_index,
1265569331642446be05292e3e1f8a51218827168cdclaireho				  HB_UInt**       feature_tag_list );
1275569331642446be05292e3e1f8a51218827168cdclaireho
1285569331642446be05292e3e1f8a51218827168cdclaireho
1295569331642446be05292e3e1f8a51218827168cdclairehoHB_Error  HB_GPOS_Add_Feature( HB_GPOSHeader*  gpos,
1305569331642446be05292e3e1f8a51218827168cdclaireho			       HB_UShort        feature_index,
1315569331642446be05292e3e1f8a51218827168cdclaireho			       HB_UInt          property );
1325569331642446be05292e3e1f8a51218827168cdclaireho
1335569331642446be05292e3e1f8a51218827168cdclairehoHB_Error  HB_GPOS_Clear_Features( HB_GPOSHeader*  gpos );
1345569331642446be05292e3e1f8a51218827168cdclaireho
1355569331642446be05292e3e1f8a51218827168cdclaireho
13657e6107a9d66a9a97b146def0ef38c010f954be6claireho#ifdef HB_SUPPORT_MULTIPLE_MASTER
1375569331642446be05292e3e1f8a51218827168cdclairehoHB_Error  HB_GPOS_Register_MM_Function( HB_GPOSHeader*  gpos,
1385569331642446be05292e3e1f8a51218827168cdclaireho					HB_MMFunction   mmfunc,
1395569331642446be05292e3e1f8a51218827168cdclaireho					void*            data );
14057e6107a9d66a9a97b146def0ef38c010f954be6claireho#endif
1415569331642446be05292e3e1f8a51218827168cdclaireho
1425569331642446be05292e3e1f8a51218827168cdclaireho/* If `dvi' is TRUE, glyph contour points for anchor points and device
1435569331642446be05292e3e1f8a51218827168cdclaireho   tables are ignored -- you will get device independent values.         */
1445569331642446be05292e3e1f8a51218827168cdclaireho
1455569331642446be05292e3e1f8a51218827168cdclaireho
1465569331642446be05292e3e1f8a51218827168cdclairehoHB_Error  HB_GPOS_Apply_String( HB_Font           font,
1475569331642446be05292e3e1f8a51218827168cdclaireho				HB_GPOSHeader*   gpos,
1485569331642446be05292e3e1f8a51218827168cdclaireho				HB_UShort         load_flags,
1495569331642446be05292e3e1f8a51218827168cdclaireho				HB_Buffer        buffer,
1505569331642446be05292e3e1f8a51218827168cdclaireho				HB_Bool           dvi,
1515569331642446be05292e3e1f8a51218827168cdclaireho				HB_Bool           r2l );
1525569331642446be05292e3e1f8a51218827168cdclaireho
1535569331642446be05292e3e1f8a51218827168cdclairehoHB_END_HEADER
1545569331642446be05292e3e1f8a51218827168cdclaireho
1555569331642446be05292e3e1f8a51218827168cdclaireho#endif /* HARFBUZZ_GPOS_H */
156