KHtml

woff-private.h
1 /*
2  This file is part of the KDE libraries
3 
4  The Original Code is WOFF font packaging code.
5  Copyright (C) 2009 Mozilla Corporation
6 
7  Contributor(s):
8  Jonathan Kew <[email protected]>
9  Germain Garand <[email protected]>
10 
11  This library is free software; you can redistribute it and/or
12  modify it under the terms of the GNU Library General Public
13  License as published by the Free Software Foundation; either
14  version 2 of the License, or (at your option) any later version.
15 
16  This library is distributed in the hope that it will be useful,
17  but WITHOUT ANY WARRANTY; without even the implied warranty of
18  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19  Library General Public License for more details.
20 
21  You should have received a copy of the GNU Library General Public License
22  along with this library; see the file COPYING.LIB. If not, write to
23  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
24  Boston, MA 02110-1301, USA.
25 */
26 
27 #ifndef WOFF_PRIVATE_H_
28 #define WOFF_PRIVATE_H_
29 
30 #include "woff.h"
31 #include <QtGlobal>
32 
33 /* private definitions used in the WOFF encoder/decoder functions */
34 
35 /* create an OT tag from 4 characters */
36 #define TAG(a,b,c,d) ((a)<<24 | (b)<<16 | (c)<<8 | (d))
37 
38 #define WOFF_SIGNATURE TAG('w','O','F','F')
39 
40 #define SFNT_VERSION_CFF TAG('O','T','T','O')
41 #define SFNT_VERSION_TT 0x00010000
42 #define SFNT_VERSION_true TAG('t','r','u','e')
43 
44 #define TABLE_TAG_DSIG TAG('D','S','I','G')
45 #define TABLE_TAG_head TAG('h','e','a','d')
46 #define TABLE_TAG_bhed TAG('b','h','e','d')
47 
48 #define SFNT_CHECKSUM_CALC_CONST 0xB1B0AFBAU /* from the TT/OT spec */
49 
50 #if Q_BYTE_ORDER == Q_BIG_ENDIAN
51 # define READ16BE(x) (x)
52 # define READ32BE(x) (x)
53 #else
54 # define READ16BE(x) ((((x) & 0xff) << 8) | (((x) >> 8) & 0xff))
55 # define READ32BE(x) ((READ16BE((x) & 0xffff) << 16) | (READ16BE((x) >> 16)))
56 # endif
57 
58 #if defined(__SUNPRO_CC)
59 #pragma pack(1) /* no pragma stack in Sun Studio */
60 #else
61 #pragma pack(push,1) /* assume this is GCC compatible */
62 #endif
63 
64 typedef struct {
65  quint32 version;
66  quint16 numTables;
67  quint16 searchRange;
68  quint16 entrySelector;
69  quint16 rangeShift;
70 } sfntHeader;
71 
72 typedef struct {
73  quint32 tag;
74  quint32 checksum;
75  quint32 offset;
76  quint32 length;
77 } sfntDirEntry;
78 
79 typedef struct {
80  quint32 signature;
81  quint32 flavor;
82  quint32 length;
83  quint16 numTables;
84  quint16 reserved;
85  quint32 totalSfntSize;
86  quint16 majorVersion;
87  quint16 minorVersion;
88  quint32 metaOffset;
89  quint32 metaCompLen;
90  quint32 metaOrigLen;
91  quint32 privOffset;
92  quint32 privLen;
93 } woffHeader;
94 
95 typedef struct {
96  quint32 tag;
97  quint32 offset;
98  quint32 compLen;
99  quint32 origLen;
100  quint32 checksum;
101 } woffDirEntry;
102 
103 typedef struct {
104  quint32 version;
105  quint32 fontRevision;
106  quint32 checkSumAdjustment;
107  quint32 magicNumber;
108  quint16 flags;
109  quint16 unitsPerEm;
110  quint32 created[2];
111  quint32 modified[2];
112  qint16 xMin;
113  qint16 yMin;
114  qint16 xMax;
115  qint16 yMax;
116  quint16 macStyle;
117  quint16 lowestRecPpem;
118  qint16 fontDirectionHint;
119  qint16 indexToLocFormat;
120  qint16 glyphDataFormat;
121 } sfntHeadTable;
122 
123 #define HEAD_TABLE_SIZE 54 /* sizeof(sfntHeadTable) may report 56 because of alignment */
124 
125 typedef struct {
126  quint32 offset;
127  quint16 oldIndex;
128  quint16 newIndex;
129 } tableOrderRec;
130 
131 #if defined(__SUNPRO_CC)
132 #pragma pack()
133 #else
134 #pragma pack(pop)
135 #endif
136 
137 #endif
KDB_EXPORT KDbVersionInfo version()
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Tue Oct 26 2021 22:48:10 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.