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/layout/GlyphPositionAdjustments.h
38918 views
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-2005 - All Rights Reserved
29
*
30
*/
31
32
#ifndef __GLYPHPOSITIONADJUSTMENTS_H
33
#define __GLYPHPOSITIONADJUSTMENTS_H
34
35
/**
36
* \file
37
* \internal
38
*/
39
40
#include "LETypes.h"
41
#include "OpenTypeTables.h"
42
43
U_NAMESPACE_BEGIN
44
45
class LEGlyphStorage;
46
class LEFontInstance;
47
48
class GlyphPositionAdjustments : public UMemory
49
{
50
private:
51
class Adjustment : public UMemory {
52
public:
53
54
inline Adjustment();
55
inline Adjustment(float xPlace, float yPlace, float xAdv, float yAdv, le_int32 baseOff = -1);
56
inline ~Adjustment();
57
58
inline float getXPlacement() const;
59
inline float getYPlacement() const;
60
inline float getXAdvance() const;
61
inline float getYAdvance() const;
62
63
inline le_int32 getBaseOffset() const;
64
65
inline void setXPlacement(float newXPlacement);
66
inline void setYPlacement(float newYPlacement);
67
inline void setXAdvance(float newXAdvance);
68
inline void setYAdvance(float newYAdvance);
69
70
inline void setBaseOffset(le_int32 newBaseOffset);
71
72
inline void adjustXPlacement(float xAdjustment);
73
inline void adjustYPlacement(float yAdjustment);
74
inline void adjustXAdvance(float xAdjustment);
75
inline void adjustYAdvance(float yAdjustment);
76
77
private:
78
float xPlacement;
79
float yPlacement;
80
float xAdvance;
81
float yAdvance;
82
83
le_int32 baseOffset;
84
85
// allow copying of this class because all of its fields are simple types
86
};
87
88
class EntryExitPoint : public UMemory
89
{
90
public:
91
inline EntryExitPoint();
92
inline ~EntryExitPoint();
93
94
inline le_bool isCursiveGlyph() const;
95
inline le_bool baselineIsLogicalEnd() const;
96
97
LEPoint *getEntryPoint(LEPoint &entryPoint) const;
98
LEPoint *getExitPoint(LEPoint &exitPoint) const;
99
100
inline void clearEntryPoint();
101
inline void clearExitPoint();
102
inline void setEntryPoint(LEPoint &newEntryPoint, le_bool baselineIsLogicalEnd);
103
inline void setExitPoint(LEPoint &newExitPoint, le_bool baselineIsLogicalEnd);
104
inline void setCursiveGlyph(le_bool baselineIsLogicalEnd);
105
106
private:
107
enum EntryExitFlags
108
{
109
EEF_HAS_ENTRY_POINT = 0x80000000L,
110
EEF_HAS_EXIT_POINT = 0x40000000L,
111
EEF_IS_CURSIVE_GLYPH = 0x20000000L,
112
EEF_BASELINE_IS_LOGICAL_END = 0x10000000L
113
};
114
115
le_uint32 fFlags;
116
LEPoint fEntryPoint;
117
LEPoint fExitPoint;
118
};
119
120
le_int32 fGlyphCount;
121
EntryExitPoint *fEntryExitPoints;
122
Adjustment *fAdjustments;
123
124
GlyphPositionAdjustments();
125
126
public:
127
GlyphPositionAdjustments(le_int32 glyphCount);
128
~GlyphPositionAdjustments();
129
130
inline le_bool hasCursiveGlyphs() const;
131
inline le_bool isCursiveGlyph(le_int32 index) const;
132
inline le_bool baselineIsLogicalEnd(le_int32 index) const;
133
134
const LEPoint *getEntryPoint(le_int32 index, LEPoint &entryPoint) const;
135
const LEPoint *getExitPoint(le_int32 index, LEPoint &exitPoint) const;
136
137
inline float getXPlacement(le_int32 index) const;
138
inline float getYPlacement(le_int32 index) const;
139
inline float getXAdvance(le_int32 index) const;
140
inline float getYAdvance(le_int32 index) const;
141
142
inline le_int32 getBaseOffset(le_int32 index) const;
143
144
inline void setXPlacement(le_int32 index, float newXPlacement);
145
inline void setYPlacement(le_int32 index, float newYPlacement);
146
inline void setXAdvance(le_int32 index, float newXAdvance);
147
inline void setYAdvance(le_int32 index, float newYAdvance);
148
149
inline void setBaseOffset(le_int32 index, le_int32 newBaseOffset);
150
151
inline void adjustXPlacement(le_int32 index, float xAdjustment);
152
inline void adjustYPlacement(le_int32 index, float yAdjustment);
153
inline void adjustXAdvance(le_int32 index, float xAdjustment);
154
inline void adjustYAdvance(le_int32 index, float yAdjustment);
155
156
void clearEntryPoint(le_int32 index);
157
void clearExitPoint(le_int32 index);
158
void setEntryPoint(le_int32 index, LEPoint &newEntryPoint, le_bool baselineIsLogicalEnd);
159
void setExitPoint(le_int32 index, LEPoint &newExitPoint, le_bool baselineIsLogicalEnd);
160
void setCursiveGlyph(le_int32 index, le_bool baselineIsLogicalEnd);
161
162
void applyCursiveAdjustments(LEGlyphStorage &glyphStorage, le_bool rightToLeft, const LEFontInstance *fontInstance);
163
};
164
165
inline GlyphPositionAdjustments::Adjustment::Adjustment()
166
: xPlacement(0), yPlacement(0), xAdvance(0), yAdvance(0), baseOffset(-1)
167
{
168
// nothing else to do!
169
}
170
171
inline GlyphPositionAdjustments::Adjustment::Adjustment(float xPlace, float yPlace, float xAdv, float yAdv, le_int32 baseOff)
172
: xPlacement(xPlace), yPlacement(yPlace), xAdvance(xAdv), yAdvance(yAdv), baseOffset(baseOff)
173
{
174
// nothing else to do!
175
}
176
177
inline GlyphPositionAdjustments::Adjustment::~Adjustment()
178
{
179
// nothing to do!
180
}
181
182
inline float GlyphPositionAdjustments::Adjustment::getXPlacement() const
183
{
184
return xPlacement;
185
}
186
187
inline float GlyphPositionAdjustments::Adjustment::getYPlacement() const
188
{
189
return yPlacement;
190
}
191
192
inline float GlyphPositionAdjustments::Adjustment::getXAdvance() const
193
{
194
return xAdvance;
195
}
196
197
inline float GlyphPositionAdjustments::Adjustment::getYAdvance() const
198
{
199
return yAdvance;
200
}
201
202
inline le_int32 GlyphPositionAdjustments::Adjustment::getBaseOffset() const
203
{
204
return baseOffset;
205
}
206
207
inline void GlyphPositionAdjustments::Adjustment::setXPlacement(float newXPlacement)
208
{
209
xPlacement = newXPlacement;
210
}
211
212
inline void GlyphPositionAdjustments::Adjustment::setYPlacement(float newYPlacement)
213
{
214
yPlacement = newYPlacement;
215
}
216
217
inline void GlyphPositionAdjustments::Adjustment::setXAdvance(float newXAdvance)
218
{
219
xAdvance = newXAdvance;
220
}
221
222
inline void GlyphPositionAdjustments::Adjustment::setYAdvance(float newYAdvance)
223
{
224
yAdvance = newYAdvance;
225
}
226
227
inline void GlyphPositionAdjustments::Adjustment::setBaseOffset(le_int32 newBaseOffset)
228
{
229
baseOffset = newBaseOffset;
230
}
231
232
inline void GlyphPositionAdjustments::Adjustment::adjustXPlacement(float xAdjustment)
233
{
234
xPlacement += xAdjustment;
235
}
236
237
inline void GlyphPositionAdjustments::Adjustment::adjustYPlacement(float yAdjustment)
238
{
239
yPlacement += yAdjustment;
240
}
241
242
inline void GlyphPositionAdjustments::Adjustment::adjustXAdvance(float xAdjustment)
243
{
244
xAdvance += xAdjustment;
245
}
246
247
inline void GlyphPositionAdjustments::Adjustment::adjustYAdvance(float yAdjustment)
248
{
249
yAdvance += yAdjustment;
250
}
251
252
inline GlyphPositionAdjustments::EntryExitPoint::EntryExitPoint()
253
: fFlags(0)
254
{
255
fEntryPoint.fX = fEntryPoint.fY = fExitPoint.fX = fExitPoint.fY = 0;
256
}
257
258
inline GlyphPositionAdjustments::EntryExitPoint::~EntryExitPoint()
259
{
260
// nothing special to do
261
}
262
263
inline le_bool GlyphPositionAdjustments::EntryExitPoint::isCursiveGlyph() const
264
{
265
return (fFlags & EEF_IS_CURSIVE_GLYPH) != 0;
266
}
267
268
inline le_bool GlyphPositionAdjustments::EntryExitPoint::baselineIsLogicalEnd() const
269
{
270
return (fFlags & EEF_BASELINE_IS_LOGICAL_END) != 0;
271
}
272
273
inline void GlyphPositionAdjustments::EntryExitPoint::clearEntryPoint()
274
{
275
fFlags &= ~EEF_HAS_ENTRY_POINT;
276
}
277
278
inline void GlyphPositionAdjustments::EntryExitPoint::clearExitPoint()
279
{
280
fFlags &= ~EEF_HAS_EXIT_POINT;
281
}
282
283
inline void GlyphPositionAdjustments::EntryExitPoint::setEntryPoint(LEPoint &newEntryPoint, le_bool baselineIsLogicalEnd)
284
{
285
if (baselineIsLogicalEnd) {
286
fFlags |= (EEF_HAS_ENTRY_POINT | EEF_IS_CURSIVE_GLYPH | EEF_BASELINE_IS_LOGICAL_END);
287
} else {
288
fFlags |= (EEF_HAS_ENTRY_POINT | EEF_IS_CURSIVE_GLYPH);
289
}
290
291
fEntryPoint = newEntryPoint;
292
}
293
294
inline void GlyphPositionAdjustments::EntryExitPoint::setExitPoint(LEPoint &newExitPoint, le_bool baselineIsLogicalEnd)
295
{
296
if (baselineIsLogicalEnd) {
297
fFlags |= (EEF_HAS_EXIT_POINT | EEF_IS_CURSIVE_GLYPH | EEF_BASELINE_IS_LOGICAL_END);
298
} else {
299
fFlags |= (EEF_HAS_EXIT_POINT | EEF_IS_CURSIVE_GLYPH);
300
}
301
302
fExitPoint = newExitPoint;
303
}
304
305
inline void GlyphPositionAdjustments::EntryExitPoint::setCursiveGlyph(le_bool baselineIsLogicalEnd)
306
{
307
if (baselineIsLogicalEnd) {
308
fFlags |= (EEF_IS_CURSIVE_GLYPH | EEF_BASELINE_IS_LOGICAL_END);
309
} else {
310
fFlags |= EEF_IS_CURSIVE_GLYPH;
311
}
312
}
313
314
inline le_bool GlyphPositionAdjustments::isCursiveGlyph(le_int32 index) const
315
{
316
return fEntryExitPoints != NULL && fEntryExitPoints[index].isCursiveGlyph();
317
}
318
319
inline le_bool GlyphPositionAdjustments::baselineIsLogicalEnd(le_int32 index) const
320
{
321
return fEntryExitPoints != NULL && fEntryExitPoints[index].baselineIsLogicalEnd();
322
}
323
324
inline float GlyphPositionAdjustments::getXPlacement(le_int32 index) const
325
{
326
return fAdjustments[index].getXPlacement();
327
}
328
329
inline float GlyphPositionAdjustments::getYPlacement(le_int32 index) const
330
{
331
return fAdjustments[index].getYPlacement();
332
}
333
334
inline float GlyphPositionAdjustments::getXAdvance(le_int32 index) const
335
{
336
return fAdjustments[index].getXAdvance();
337
}
338
339
inline float GlyphPositionAdjustments::getYAdvance(le_int32 index) const
340
{
341
return fAdjustments[index].getYAdvance();
342
}
343
344
345
inline le_int32 GlyphPositionAdjustments::getBaseOffset(le_int32 index) const
346
{
347
return fAdjustments[index].getBaseOffset();
348
}
349
350
inline void GlyphPositionAdjustments::setXPlacement(le_int32 index, float newXPlacement)
351
{
352
fAdjustments[index].setXPlacement(newXPlacement);
353
}
354
355
inline void GlyphPositionAdjustments::setYPlacement(le_int32 index, float newYPlacement)
356
{
357
fAdjustments[index].setYPlacement(newYPlacement);
358
}
359
360
inline void GlyphPositionAdjustments::setXAdvance(le_int32 index, float newXAdvance)
361
{
362
fAdjustments[index].setXAdvance(newXAdvance);
363
}
364
365
inline void GlyphPositionAdjustments::setYAdvance(le_int32 index, float newYAdvance)
366
{
367
fAdjustments[index].setYAdvance(newYAdvance);
368
}
369
370
inline void GlyphPositionAdjustments::setBaseOffset(le_int32 index, le_int32 newBaseOffset)
371
{
372
fAdjustments[index].setBaseOffset(newBaseOffset);
373
}
374
375
inline void GlyphPositionAdjustments::adjustXPlacement(le_int32 index, float xAdjustment)
376
{
377
fAdjustments[index].adjustXPlacement(xAdjustment);
378
}
379
380
inline void GlyphPositionAdjustments::adjustYPlacement(le_int32 index, float yAdjustment)
381
{
382
fAdjustments[index].adjustYPlacement(yAdjustment);
383
}
384
385
inline void GlyphPositionAdjustments::adjustXAdvance(le_int32 index, float xAdjustment)
386
{
387
fAdjustments[index].adjustXAdvance(xAdjustment);
388
}
389
390
inline void GlyphPositionAdjustments::adjustYAdvance(le_int32 index, float yAdjustment)
391
{
392
fAdjustments[index].adjustYAdvance(yAdjustment);
393
}
394
395
inline le_bool GlyphPositionAdjustments::hasCursiveGlyphs() const
396
{
397
return fEntryExitPoints != NULL;
398
}
399
400
U_NAMESPACE_END
401
#endif
402
403