DisplacementEntry.java
2.92 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
/*
* Decompiled with CFR 0_118.
*
* Could not load the following classes:
* com.adobe.internal.pdftoolkit.core.cos.CosArray
* com.adobe.internal.pdftoolkit.core.exceptions.PDFIOException
* com.adobe.internal.pdftoolkit.core.exceptions.PDFInvalidDocumentException
* com.adobe.internal.pdftoolkit.core.exceptions.PDFSecurityException
*/
package com.adobe.internal.pdftoolkit.pdf.graphics.font;
import com.adobe.internal.pdftoolkit.core.cos.CosArray;
import com.adobe.internal.pdftoolkit.core.exceptions.PDFIOException;
import com.adobe.internal.pdftoolkit.core.exceptions.PDFInvalidDocumentException;
import com.adobe.internal.pdftoolkit.core.exceptions.PDFSecurityException;
class DisplacementEntry {
private final int startCID;
private final int endCID;
private final Object metrics;
DisplacementEntry(int startCID, CosArray metrics) {
this.startCID = startCID;
this.endCID = startCID + metrics.size() / 3;
this.metrics = metrics;
}
DisplacementEntry(int startCID, int endCID, double w11y, double v1x, double v1y) {
this.startCID = startCID;
this.endCID = endCID;
this.metrics = new double[3];
((double[])this.metrics)[0] = w11y;
((double[])this.metrics)[1] = v1x;
((double[])this.metrics)[2] = v1y;
}
int getStartCID() {
return this.startCID;
}
int getEndCID() {
return this.endCID;
}
boolean contains(int cid) {
return cid >= this.startCID && cid <= this.endCID;
}
double[] getMetrics(int cid) throws PDFInvalidDocumentException, PDFIOException, PDFSecurityException {
double[] vector = new double[3];
if (this.metrics instanceof CosArray) {
int base = (cid - this.startCID) * 3;
vector[0] = ((CosArray)this.metrics).getDouble(base);
vector[1] = ((CosArray)this.metrics).getDouble(base + 1);
vector[2] = ((CosArray)this.metrics).getDouble(base + 2);
} else {
vector = (double[])this.metrics;
}
return vector;
}
double getVerticalDisplacement(int cid) throws PDFInvalidDocumentException, PDFIOException, PDFSecurityException {
int index = (cid - this.startCID) * 3;
if (this.metrics instanceof CosArray) {
return ((CosArray)this.metrics).getDouble(index);
}
return ((double[])this.metrics)[0];
}
double[] getPositionVector(int cid) throws PDFInvalidDocumentException, PDFIOException, PDFSecurityException {
double[] vector = new double[2];
if (this.metrics instanceof CosArray) {
int base = (cid - this.startCID) * 3;
vector[0] = ((CosArray)this.metrics).getDouble(base + 1);
vector[1] = ((CosArray)this.metrics).getDouble(base + 2);
} else {
vector[0] = ((double[])this.metrics)[1];
vector[1] = ((double[])this.metrics)[2];
}
return vector;
}
}