author | lana |
Sat, 29 May 2010 23:26:16 -0700 | |
changeset 5580 | 629274e4c99f |
parent 5579 | 1a5e995a710b |
parent 5506 | 202f599c92aa |
child 7668 | d4a77089c587 |
permissions | -rw-r--r-- |
2 | 1 |
/* |
5506 | 2 |
* Copyright (c) 2003, 2007, Oracle and/or its affiliates. All rights reserved. |
2 | 3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
* |
|
5 |
* This code is free software; you can redistribute it and/or modify it |
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
|
5506 | 7 |
* published by the Free Software Foundation. Oracle designates this |
2 | 8 |
* particular file as subject to the "Classpath" exception as provided |
5506 | 9 |
* by Oracle in the LICENSE file that accompanied this code. |
2 | 10 |
* |
11 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
13 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
14 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
15 |
* accompanied this code). |
|
16 |
* |
|
17 |
* You should have received a copy of the GNU General Public License version |
|
18 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
19 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
20 |
* |
|
5506 | 21 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
22 |
* or visit www.oracle.com if you need additional information or have any |
|
23 |
* questions. |
|
2 | 24 |
*/ |
25 |
||
26 |
#ifndef FontScalerDefsIncludesDefined |
|
27 |
#define FontScalerDefsIncludesDefined |
|
28 |
||
29 |
#include "AccelGlyphCache.h" |
|
30 |
||
31 |
#ifdef __cplusplus |
|
32 |
extern "C" { |
|
33 |
#endif |
|
34 |
||
35 |
#define kPosInfinity16 (32767) |
|
36 |
#define kNegInfinity16 (-32768) |
|
37 |
||
38 |
#define kPosInfinity32 (0x7fffffff) |
|
39 |
#define kNegInfinity32 (0x80000000) |
|
40 |
||
41 |
||
42 |
#ifdef _LP64 |
|
43 |
typedef unsigned int UInt32; |
|
44 |
typedef int Int32; |
|
45 |
#else |
|
46 |
typedef unsigned long UInt32; |
|
47 |
typedef long Int32; |
|
48 |
#endif |
|
49 |
typedef unsigned short UInt16; |
|
50 |
typedef short Int16; |
|
51 |
typedef unsigned char UInt8; |
|
52 |
||
53 |
typedef UInt8 Byte; |
|
54 |
typedef Int32 hsFixed; |
|
55 |
typedef Int32 hsFract; |
|
56 |
typedef UInt32 Bool32; |
|
57 |
||
58 |
#ifndef false |
|
59 |
#define false 0 |
|
60 |
#endif |
|
61 |
||
62 |
#ifndef true |
|
63 |
#define true 1 |
|
64 |
#endif |
|
65 |
||
66 |
#define kPosInfinity32 (0x7fffffff) |
|
67 |
#define kNegInfinity32 (0x80000000) |
|
68 |
||
69 |
#define F26Dot6ToFixed(n) ((n) << 10) |
|
70 |
#define F26Dot6ToScalar(n) (((t2kScalar)(n)) / (t2kScalar)64) |
|
71 |
||
72 |
/* t2kFixed is the same as F16Dot16 format although T2K also uses 26.6 */ |
|
73 |
typedef Int32 t2kFixed; |
|
74 |
typedef float t2kScalar; |
|
75 |
||
76 |
#define t2kIntToFixed(x) ((t2kFixed)(x) << 16) |
|
77 |
#define t2kFixedToInt(x) ((x) >> 16) |
|
78 |
||
79 |
#define t2kFixedRound(x) (((x) + 0x8000) >> 16) |
|
80 |
#define t2kFixed1 t2kIntToFixed(1) |
|
81 |
||
82 |
#define t2kFloatToFixed(f) (t2kFixed)((f) * (float)(t2kFixed1)) |
|
83 |
#define t2kFixedToFloat(x) ((x) / (float)(65536)) |
|
84 |
||
85 |
#define t2kScalarAverage(a, b) (((a) + (b)) / (t2kScalar)(2)) |
|
86 |
||
5579
1a5e995a710b
6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents:
2
diff
changeset
|
87 |
/* managed: 1 means the glyph has a hardware cached |
1a5e995a710b
6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents:
2
diff
changeset
|
88 |
* copy, and its freeing is managed by the the usual |
1a5e995a710b
6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents:
2
diff
changeset
|
89 |
* 2D disposer code. |
1a5e995a710b
6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents:
2
diff
changeset
|
90 |
* A value of 0 means its either unaccelerated (and so has no cellInfos) |
1a5e995a710b
6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents:
2
diff
changeset
|
91 |
* or we want to free this in a different way. |
1a5e995a710b
6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents:
2
diff
changeset
|
92 |
* The field uses previously unused padding, so doesn't enlarge |
1a5e995a710b
6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents:
2
diff
changeset
|
93 |
* the structure. |
1a5e995a710b
6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents:
2
diff
changeset
|
94 |
*/ |
1a5e995a710b
6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents:
2
diff
changeset
|
95 |
#define UNMANAGED_GLYPH 0 |
1a5e995a710b
6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents:
2
diff
changeset
|
96 |
#define MANAGED_GLYPH 1 |
2 | 97 |
typedef struct GlyphInfo { |
98 |
float advanceX; |
|
99 |
float advanceY; |
|
100 |
UInt16 width; |
|
101 |
UInt16 height; |
|
102 |
UInt16 rowBytes; |
|
5579
1a5e995a710b
6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents:
2
diff
changeset
|
103 |
UInt8 managed; |
2 | 104 |
float topLeftX; |
105 |
float topLeftY; |
|
5579
1a5e995a710b
6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents:
2
diff
changeset
|
106 |
void *cellInfo; |
2 | 107 |
UInt8 *image; |
108 |
} GlyphInfo; |
|
109 |
||
110 |
/* We use fffe and ffff as meaning invisible glyphs which have no |
|
111 |
* image, or advance and an empty outline. |
|
112 |
* Since there are no valid glyphs with this great a value (watch out for |
|
113 |
* large fonts in the future!) we can safely use check for >= this value |
|
114 |
*/ |
|
115 |
#define INVISIBLE_GLYPHS 0xfffe |
|
116 |
||
117 |
#define GSUB_TAG 0x47535542 /* 'GSUB' */ |
|
118 |
#define GPOS_TAG 0x47504F53 /* 'GPOS' */ |
|
119 |
#define GDEF_TAG 0x47444546 /* 'GDEF' */ |
|
120 |
#define MORT_TAG 0x6D6F7274 /* 'mort' */ |
|
121 |
#define KERN_TAG 0x6B65726E /* 'kern' */ |
|
122 |
||
123 |
typedef struct TTLayoutTableCache { |
|
124 |
void* gsub; |
|
125 |
void* gpos; |
|
126 |
void* gdef; |
|
127 |
void* mort; |
|
128 |
void* kern; |
|
129 |
void* kernPairs; |
|
130 |
int gsub_len; |
|
131 |
int gpos_len; |
|
132 |
int gdef_len; |
|
133 |
int mort_len; |
|
134 |
int kern_len; |
|
135 |
} TTLayoutTableCache; |
|
136 |
||
137 |
#include "sunfontids.h" |
|
138 |
||
139 |
JNIEXPORT extern TTLayoutTableCache* newLayoutTableCache(); |
|
140 |
JNIEXPORT extern void freeLayoutTableCache(TTLayoutTableCache* ltc); |
|
141 |
||
142 |
/* If font is malformed then scaler context created by particular scaler |
|
143 |
* will be replaced by null scaler context. |
|
144 |
* Note that this context is not compatible with structure of the context |
|
145 |
* object used by particular scaler. Therefore, before using context |
|
146 |
* scaler has to check if it is NullContext. |
|
147 |
* |
|
148 |
* Note that in theory request with NullContext should not even reach native |
|
149 |
* scaler. |
|
150 |
* |
|
151 |
* It seems that the only reason to support NullContext is to simplify |
|
152 |
* FileFontStrike logic - presence of context is used as marker to |
|
153 |
* free the memory. |
|
154 |
*/ |
|
155 |
JNIEXPORT int isNullScalerContext(void *context); |
|
156 |
||
157 |
#ifdef __cplusplus |
|
158 |
} |
|
159 |
#endif |
|
160 |
||
161 |
#endif |