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/CursiveAttachmentSubtables.cpp
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
* (C) Copyright IBM Corp. 1998 - 2005 - All Rights Reserved
28
*
29
*/
30
31
#include "LETypes.h"
32
#include "OpenTypeTables.h"
33
#include "GlyphPositioningTables.h"
34
#include "CursiveAttachmentSubtables.h"
35
#include "AnchorTables.h"
36
#include "GlyphIterator.h"
37
#include "OpenTypeUtilities.h"
38
#include "LESwaps.h"
39
40
U_NAMESPACE_BEGIN
41
42
le_uint32 CursiveAttachmentSubtable::process(const LEReferenceTo<CursiveAttachmentSubtable> &base, GlyphIterator *glyphIterator, const LEFontInstance *fontInstance, LEErrorCode &success) const
43
{
44
if (LE_FAILURE(success)) {
45
return 0;
46
}
47
48
LEGlyphID glyphID = glyphIterator->getCurrGlyphID();
49
le_int32 coverageIndex = getGlyphCoverage(base, glyphID, success);
50
le_uint16 eeCount = SWAPW(entryExitCount);
51
52
LEReferenceToArrayOf<EntryExitRecord>
53
entryExitRecordsArrayRef(base, success, entryExitRecords, eeCount);
54
55
if (coverageIndex < 0 || coverageIndex >= eeCount || LE_FAILURE(success)) {
56
glyphIterator->setCursiveGlyph();
57
return 0;
58
}
59
60
LEPoint entryAnchor, exitAnchor;
61
Offset entryOffset = SWAPW(entryExitRecords[coverageIndex].entryAnchor);
62
Offset exitOffset = SWAPW(entryExitRecords[coverageIndex].exitAnchor);
63
64
if (entryOffset != 0) {
65
LEReferenceTo<AnchorTable> entryAnchorTable(base, success, entryOffset);
66
67
if( LE_SUCCESS(success) ) {
68
entryAnchorTable->getAnchor(entryAnchorTable, glyphID, fontInstance, entryAnchor, success);
69
glyphIterator->setCursiveEntryPoint(entryAnchor);
70
}
71
} else {
72
//glyphIterator->clearCursiveEntryPoint();
73
}
74
75
if (exitOffset != 0) {
76
LEReferenceTo<AnchorTable> exitAnchorTable(base, success, exitOffset);
77
78
if( LE_SUCCESS(success) ) {
79
exitAnchorTable->getAnchor(exitAnchorTable, glyphID, fontInstance, exitAnchor, success);
80
glyphIterator->setCursiveExitPoint(exitAnchor);
81
}
82
} else {
83
//glyphIterator->clearCursiveExitPoint();
84
}
85
86
return 1;
87
}
88
89
U_NAMESPACE_END
90
91