• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  *
3  * (C) Copyright IBM Corp. 1998-2013 - All Rights Reserved
4  *
5  */
6 
7 #ifndef __VALUERECORDS_H
8 #define __VALUERECORDS_H
9 
10 /**
11  * \file
12  * \internal
13  */
14 
15 #include "LETypes.h"
16 #include "LEFontInstance.h"
17 #include "OpenTypeTables.h"
18 #include "GlyphIterator.h"
19 
20 U_NAMESPACE_BEGIN
21 
22 typedef le_uint16 ValueFormat;
23 typedef le_int16 ValueRecordField;
24 
25 struct ValueRecord
26 {
27     le_int16   values[ANY_NUMBER];
28 
29     le_int16   getFieldValue(ValueFormat valueFormat, ValueRecordField field) const;
30     le_int16   getFieldValue(le_int16 index, ValueFormat valueFormat, ValueRecordField field) const;
31     void    adjustPosition(ValueFormat valueFormat, const char *base, GlyphIterator &glyphIterator,
32                 const LEFontInstance *fontInstance) const;
33     void    adjustPosition(le_int16 index, ValueFormat valueFormat, const char *base, GlyphIterator &glyphIterator,
34                 const LEFontInstance *fontInstance) const;
35 
36     static le_int16    getSize(ValueFormat valueFormat);
37 
38 private:
39     static le_int16    getFieldCount(ValueFormat valueFormat);
40     static le_int16    getFieldIndex(ValueFormat valueFormat, ValueRecordField field);
41 };
42 LE_VAR_ARRAY(ValueRecord, values)
43 
44 enum ValueRecordFields
45 {
46     vrfXPlacement   = 0,
47     vrfYPlacement   = 1,
48     vrfXAdvance     = 2,
49     vrfYAdvance     = 3,
50     vrfXPlaDevice   = 4,
51     vrfYPlaDevice   = 5,
52     vrfXAdvDevice   = 6,
53     vrfYAdvDevice   = 7
54 };
55 
56 enum ValueFormatBits
57 {
58     vfbXPlacement   = 0x0001,
59     vfbYPlacement   = 0x0002,
60     vfbXAdvance     = 0x0004,
61     vfbYAdvance     = 0x0008,
62     vfbXPlaDevice   = 0x0010,
63     vfbYPlaDevice   = 0x0020,
64     vfbXAdvDevice   = 0x0040,
65     vfbYAdvDevice   = 0x0080,
66     vfbReserved     = 0xFF00,
67     vfbAnyDevice    = vfbXPlaDevice + vfbYPlaDevice + vfbXAdvDevice + vfbYAdvDevice
68 };
69 
70 U_NAMESPACE_END
71 #endif
72 
73 
74