Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/openjdk-multiarch-jdk8u
Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/share/native/sun/font/fontscalerdefs.h
38829 views
1
/*
2
* Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
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
7
* published by the Free Software Foundation. Oracle designates this
8
* particular file as subject to the "Classpath" exception as provided
9
* by Oracle in the LICENSE file that accompanied this code.
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
*
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.
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 __cplusplus
59
#ifndef false
60
#define false 0
61
#endif
62
63
#ifndef true
64
#define true 1
65
#endif
66
#endif
67
68
#define kPosInfinity32 (0x7fffffff)
69
#define kNegInfinity32 (0x80000000)
70
71
#define F26Dot6ToFixed(n) ((n) << 10)
72
#define F26Dot6ToScalar(n) (((t2kScalar)(n)) / (t2kScalar)64)
73
74
/* t2kFixed is the same as F16Dot16 format although T2K also uses 26.6 */
75
typedef Int32 t2kFixed;
76
typedef float t2kScalar;
77
78
#define t2kIntToFixed(x) ((t2kFixed)(x) << 16)
79
#define t2kFixedToInt(x) ((x) >> 16)
80
81
#define t2kFixedRound(x) (((x) + 0x8000) >> 16)
82
#define t2kFixed1 t2kIntToFixed(1)
83
84
#define t2kFloatToFixed(f) (t2kFixed)((f) * (float)(t2kFixed1))
85
#define t2kFixedToFloat(x) ((x) / (float)(65536))
86
87
#define t2kScalarAverage(a, b) (((a) + (b)) / (t2kScalar)(2))
88
89
/* managed: 1 means the glyph has a hardware cached
90
* copy, and its freeing is managed by the the usual
91
* 2D disposer code.
92
* A value of 0 means its either unaccelerated (and so has no cellInfos)
93
* or we want to free this in a different way.
94
* The field uses previously unused padding, so doesn't enlarge
95
* the structure.
96
*/
97
#define UNMANAGED_GLYPH 0
98
#define MANAGED_GLYPH 1
99
typedef struct GlyphInfo {
100
float advanceX;
101
float advanceY;
102
UInt16 width;
103
UInt16 height;
104
UInt16 rowBytes;
105
UInt8 managed;
106
float topLeftX;
107
float topLeftY;
108
void *cellInfo;
109
UInt8 *image;
110
} GlyphInfo;
111
112
/* We use fffe and ffff as meaning invisible glyphs which have no
113
* image, or advance and an empty outline.
114
* Since there are no valid glyphs with this great a value (watch out for
115
* large fonts in the future!) we can safely use check for >= this value
116
*/
117
#define INVISIBLE_GLYPHS 0xfffe
118
119
#define GSUB_TAG 0x47535542 /* 'GSUB' */
120
#define GPOS_TAG 0x47504F53 /* 'GPOS' */
121
#define GDEF_TAG 0x47444546 /* 'GDEF' */
122
#define MORT_TAG 0x6D6F7274 /* 'mort' */
123
#define MORX_TAG 0x6D6F7278 /* 'morx' */
124
#define KERN_TAG 0x6B65726E /* 'kern' */
125
126
typedef struct TTLayoutTableCacheEntry {
127
const void* ptr;
128
int len;
129
} TTLayoutTableCacheEntry;
130
131
#define LAYOUTCACHE_ENTRIES 6
132
133
typedef struct TTLayoutTableCache {
134
TTLayoutTableCacheEntry entries[LAYOUTCACHE_ENTRIES];
135
void* kernPairs;
136
} TTLayoutTableCache;
137
138
#include "sunfontids.h"
139
140
JNIEXPORT extern TTLayoutTableCache* newLayoutTableCache();
141
JNIEXPORT extern void freeLayoutTableCache(TTLayoutTableCache* ltc);
142
143
/* If font is malformed then scaler context created by particular scaler
144
* will be replaced by null scaler context.
145
* Note that this context is not compatible with structure of the context
146
* object used by particular scaler. Therefore, before using context
147
* scaler has to check if it is NullContext.
148
*
149
* Note that in theory request with NullContext should not even reach native
150
* scaler.
151
*
152
* It seems that the only reason to support NullContext is to simplify
153
* FileFontStrike logic - presence of context is used as marker to
154
* free the memory.
155
*/
156
JNIEXPORT int isNullScalerContext(void *context);
157
158
#ifdef __cplusplus
159
}
160
#endif
161
162
#endif
163
164