ClassDefinitionTables.h revision c73f511526464f8e56c242df80552e9b0d94ae3d
1/*
2 *
3 * (C) Copyright IBM Corp. 1998-2013 - All Rights Reserved
4 *
5 */
6
7#ifndef __CLASSDEFINITIONTABLES_H
8#define __CLASSDEFINITIONTABLES_H
9
10/**
11 * \file
12 * \internal
13 */
14
15#include "LETypes.h"
16#include "OpenTypeTables.h"
17
18U_NAMESPACE_BEGIN
19
20struct ClassDefinitionTable
21{
22    le_uint16 classFormat;
23
24    le_int32  getGlyphClass(const LETableReference &base, LEGlyphID glyphID, LEErrorCode &success) const;
25    le_bool   hasGlyphClass(const LETableReference &base, le_int32 glyphClass, LEErrorCode &success) const;
26
27  le_int32 getGlyphClass(LEGlyphID glyphID) const {
28    LETableReference base((const le_uint8*)this);
29    LEErrorCode ignored = LE_NO_ERROR;
30    return getGlyphClass(base,glyphID,ignored);
31  }
32
33  le_bool hasGlyphClass(le_int32 glyphClass) const {
34    LETableReference base((const le_uint8*)this);
35    LEErrorCode ignored = LE_NO_ERROR;
36    return hasGlyphClass(base,glyphClass,ignored);
37  }
38};
39
40struct ClassDefFormat1Table : ClassDefinitionTable
41{
42    TTGlyphID  startGlyph;
43    le_uint16  glyphCount;
44    le_uint16  classValueArray[ANY_NUMBER];
45
46    le_int32 getGlyphClass(const LETableReference &base, LEGlyphID glyphID, LEErrorCode &success) const;
47    le_bool  hasGlyphClass(const LETableReference &base, le_int32 glyphClass, LEErrorCode &success) const;
48};
49LE_VAR_ARRAY(ClassDefFormat1Table, classValueArray)
50
51
52struct ClassRangeRecord
53{
54    TTGlyphID start;
55    TTGlyphID end;
56    le_uint16 classValue;
57};
58
59struct ClassDefFormat2Table : ClassDefinitionTable
60{
61    le_uint16        classRangeCount;
62    GlyphRangeRecord classRangeRecordArray[ANY_NUMBER];
63
64    le_int32 getGlyphClass(const LETableReference &base, LEGlyphID glyphID, LEErrorCode &success) const;
65    le_bool hasGlyphClass(const LETableReference &base, le_int32 glyphClass, LEErrorCode &success) const;
66};
67LE_VAR_ARRAY(ClassDefFormat2Table, classRangeRecordArray)
68
69U_NAMESPACE_END
70#endif
71