SubsetDefaultImpl.java
3.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
/*
* Decompiled with CFR 0_118.
*/
package com.adobe.fontengine.font;
import com.adobe.fontengine.font.InvalidFontException;
import com.adobe.fontengine.font.Subset;
import com.adobe.fontengine.font.UnsupportedFontException;
public class SubsetDefaultImpl
implements Subset {
protected final boolean doSubset;
protected int subsetGlyphCount;
protected int[] fullGid2subsetGid;
protected int[] subsetGid2fullGid;
public SubsetDefaultImpl(int numGlyphs, boolean doSubset) throws InvalidFontException, UnsupportedFontException {
this.doSubset = doSubset;
if (!doSubset) {
this.subsetGlyphCount = numGlyphs;
this.fullGid2subsetGid = null;
this.subsetGid2fullGid = null;
} else {
this.subsetGlyphCount = 0;
this.fullGid2subsetGid = new int[numGlyphs];
this.subsetGid2fullGid = new int[numGlyphs];
for (int i = this.subsetGlyphCount; i < numGlyphs; ++i) {
this.fullGid2subsetGid[i] = -1;
}
}
}
public boolean doSubset() {
return this.doSubset;
}
/*
* WARNING - Removed try catching itself - possible behaviour change.
*/
public int getNumGlyphs() {
SubsetDefaultImpl subsetDefaultImpl = this;
synchronized (subsetDefaultImpl) {
return this.subsetGlyphCount;
}
}
/*
* WARNING - Removed try catching itself - possible behaviour change.
*/
public int getSubsetGid(int fullGid) throws InvalidFontException, UnsupportedFontException {
if (this.doSubset) {
SubsetDefaultImpl subsetDefaultImpl = this;
synchronized (subsetDefaultImpl) {
try {
if (this.fullGid2subsetGid[fullGid] == -1) {
this.fullGid2subsetGid[fullGid] = this.subsetGlyphCount++;
this.subsetGid2fullGid[this.subsetGlyphCount] = fullGid;
this.pullComponentGlyphs(fullGid);
}
}
catch (ArrayIndexOutOfBoundsException e) {
throw new InvalidFontException(e);
}
return this.fullGid2subsetGid[fullGid];
}
}
return fullGid;
}
/*
* WARNING - Removed try catching itself - possible behaviour change.
*/
public int getFullGid(int subsetGid) {
if (this.doSubset) {
SubsetDefaultImpl subsetDefaultImpl = this;
synchronized (subsetDefaultImpl) {
return this.subsetGid2fullGid[subsetGid];
}
}
return subsetGid;
}
protected void pullComponentGlyphs(int fullGid) throws UnsupportedFontException, InvalidFontException {
}
public int getExistingSubsetGid(int fullGid) {
if (this.doSubset) {
if (fullGid >= this.fullGid2subsetGid.length) {
return -1;
}
return this.fullGid2subsetGid[fullGid];
}
return fullGid;
}
}