1/*
2 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
3 *
4 * This code is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License version 2 only, as
6 * published by the Free Software Foundation.  Oracle designates this
7 * particular file as subject to the "Classpath" exception as provided
8 * by Oracle in the LICENSE file that accompanied this code.
9 *
10 * This code is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
13 * version 2 for more details (a copy is included in the LICENSE file that
14 * accompanied this code).
15 *
16 * You should have received a copy of the GNU General Public License version
17 * 2 along with this work; if not, write to the Free Software Foundation,
18 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
19 *
20 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
21 * or visit www.oracle.com if you need additional information or have any
22 * questions.
23 *
24 */
25
26/*
27 *
28 * (C) Copyright IBM Corp. 1998-2004 - All Rights Reserved
29 *
30 */
31
32#ifndef __PAIRPOSITIONINGSUBTABLES_H
33#define __PAIRPOSITIONINGSUBTABLES_H
34
35/**
36 * \file
37 * \internal
38 */
39
40#include "LETypes.h"
41#include "LEFontInstance.h"
42#include "OpenTypeTables.h"
43#include "GlyphPositioningTables.h"
44#include "ValueRecords.h"
45#include "GlyphIterator.h"
46
47U_NAMESPACE_BEGIN
48
49// NOTE: ValueRecord has a variable size
50struct PairValueRecord
51{
52    TTGlyphID     secondGlyph;
53    ValueRecord valueRecord1;
54//  ValueRecord valueRecord2;
55};
56
57struct PairSetTable
58{
59    le_uint16       pairValueCount;
60    PairValueRecord pairValueRecordArray[ANY_NUMBER];
61};
62LE_VAR_ARRAY(PairSetTable, pairValueRecordArray)
63
64struct PairPositioningSubtable : GlyphPositioningSubtable
65{
66    ValueFormat valueFormat1;
67    ValueFormat valueFormat2;
68
69    le_uint32  process(const LEReferenceTo<PairPositioningSubtable> &base, GlyphIterator *glyphIterator, const LEFontInstance *fontInstance, LEErrorCode &success) const;
70};
71
72struct PairPositioningFormat1Subtable : PairPositioningSubtable
73{
74    le_uint16   pairSetCount;
75    Offset      pairSetTableOffsetArray[ANY_NUMBER];
76
77    le_uint32  process(const LEReferenceTo<PairPositioningFormat1Subtable> &base, GlyphIterator *glyphIterator, const LEFontInstance *fontInstance, LEErrorCode &success) const;
78
79private:
80    LEReferenceTo<PairValueRecord> findPairValueRecord(TTGlyphID glyphID, LEReferenceTo<PairValueRecord> &records,
81        le_uint16 recordCount, le_uint16 recordSize, LEErrorCode &success) const;
82};
83LE_VAR_ARRAY(PairPositioningFormat1Subtable, pairSetTableOffsetArray)
84
85// NOTE: ValueRecord has a variable size
86struct Class2Record
87{
88    ValueRecord valueRecord1;
89//  ValueRecord valurRecord2;
90};
91
92struct Class1Record
93{
94    Class2Record class2RecordArray[ANY_NUMBER];
95};
96LE_VAR_ARRAY(Class1Record, class2RecordArray)
97
98struct PairPositioningFormat2Subtable : PairPositioningSubtable
99{
100    Offset       classDef1Offset;
101    Offset       classDef2Offset;
102    le_uint16    class1Count;
103    le_uint16    class2Count;
104    Class1Record class1RecordArray[ANY_NUMBER];
105
106    le_uint32  process(const LEReferenceTo<PairPositioningFormat2Subtable> &base, GlyphIterator *glyphIterator, const LEFontInstance *fontInstance, LEErrorCode &success) const;
107};
108LE_VAR_ARRAY(PairPositioningFormat2Subtable, class1RecordArray)
109
110U_NAMESPACE_END
111#endif
112