harfbuzz-gdef.h 4.4 KB
Newer Older
1 2 3
/*
 * Copyright (C) 1998-2004  David Turner and Werner Lemberg
 * Copyright (C) 2006  Behdad Esfahbod
4 5 6
 *
 *  This is part of HarfBuzz, an OpenType Layout engine library.
 *
7 8 9 10 11
 * Permission is hereby granted, without written agreement and without
 * license or royalty fees, to use, copy, modify, and distribute this
 * software and its documentation for any purpose, provided that the
 * above copyright notice and the following two paragraphs appear in
 * all copies of this software.
12
 *
13 14 15 16 17 18 19 20 21 22 23 24 25
 * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
 * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
 * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
 * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
 * DAMAGE.
 *
 * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
 * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
 * FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
 * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
 * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
 */

26 27 28 29 30
#ifndef HARFBUZZ_GDEF_H
#define HARFBUZZ_GDEF_H

#include "harfbuzz-open.h"

31
HB_BEGIN_HEADER
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46


/* GDEF glyph properties.  Note that HB_GDEF_COMPONENT has no corresponding
 * flag in the LookupFlag field.     */
#define HB_GDEF_BASE_GLYPH  0x0002
#define HB_GDEF_LIGATURE    0x0004
#define HB_GDEF_MARK        0x0008
#define HB_GDEF_COMPONENT   0x0010


typedef struct HB_AttachPoint_  HB_AttachPoint;


struct  HB_AttachList_
{
47
  HB_Bool           loaded;
48 49

  HB_Coverage       Coverage;         /* Coverage table              */
50
  HB_UShort         GlyphCount;       /* number of glyphs with
51 52 53 54 55 56 57 58 59 60
					 attachments                 */
  HB_AttachPoint*   AttachPoint;      /* array of AttachPoint tables */
};

typedef struct HB_AttachList_  HB_AttachList;

typedef struct HB_LigGlyph_  HB_LigGlyph;

struct  HB_LigCaretList_
{
61
  HB_Bool        loaded;
62 63

  HB_Coverage    Coverage;            /* Coverage table            */
64
  HB_UShort      LigGlyphCount;       /* number of ligature glyphs */
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93
  HB_LigGlyph*   LigGlyph;            /* array of LigGlyph tables  */
};

typedef struct HB_LigCaretList_  HB_LigCaretList;



/* The `NewGlyphClasses' field is not defined in the TTO specification.
   We use it for fonts with a constructed `GlyphClassDef' structure
   (i.e., which don't have a GDEF table) to collect glyph classes
   assigned during the lookup process.  The number of arrays in this
   pointer array is GlyphClassDef->cd.cd2.ClassRangeCount+1; the nth
   array then contains the glyph class values of the glyphs not covered
   by the ClassRangeRecords structures with index n-1 and n.  We store
   glyph class values for four glyphs in a single array element.

   `LastGlyph' is identical to the number of glyphs minus one in the
   font; we need it only if `NewGlyphClasses' is not NULL (to have an
   upper bound for the last array).

   Note that we first store the file offset to the `MarkAttachClassDef'
   field (which has been introduced in OpenType 1.2) -- since the
   `Version' field value hasn't been increased to indicate that we have
   one more field for some obscure reason, we must parse the GSUB table
   to find out whether class values refer to this table.  Only then we
   can finally load the MarkAttachClassDef structure if necessary.      */

struct  HB_GDEFHeader_
{
94
  HB_UInt             offset;
95

B
Behdad Esfahbod 已提交
96
  HB_16Dot16             Version;
97 98 99 100

  HB_ClassDefinition   GlyphClassDef;
  HB_AttachList        AttachList;
  HB_LigCaretList      LigCaretList;
101
  HB_UInt             MarkAttachClassDef_offset;
102 103
  HB_ClassDefinition   MarkAttachClassDef;        /* new in OT 1.2 */

104 105
  HB_UShort            LastGlyph;
  HB_UShort**          NewGlyphClasses;
106 107 108 109 110 111
};

typedef struct HB_GDEFHeader_   HB_GDEFHeader;
typedef struct HB_GDEFHeader_*  HB_GDEF;


112
HB_Error  HB_New_GDEF_Table( HB_GDEFHeader** retptr );
113 114
      

B
Behdad Esfahbod 已提交
115
HB_Error  HB_Load_GDEF_Table( HB_Font         font,
116 117 118
			      HB_GDEFHeader** gdef );


119
HB_Error  HB_Done_GDEF_Table ( HB_GDEFHeader* gdef );
120 121


122
HB_Error  HB_GDEF_Get_Glyph_Property( HB_GDEFHeader*  gdef,
123
				      HB_UShort        glyphID,
B
Behdad Esfahbod 已提交
124
				      HB_UShort*       properties );
125

126
HB_Error  HB_GDEF_Build_ClassDefinition( HB_GDEFHeader*  gdef,
127 128 129 130
					 HB_UShort        num_glyphs,
					 HB_UShort        glyph_count,
					 HB_UShort*       glyph_array,
					 HB_UShort*       class_array );
131 132


133
HB_END_HEADER
134 135

#endif /* HARFBUZZ_GDEF_H */