IppUrlFont.java
8.02 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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
/*
* Decompiled with CFR 0_118.
*/
package com.scene7.is.ipp.messages;
import com.scene7.is.ipp.messages.Ipp;
import com.scene7.is.ipp.messages.IppBool;
import com.scene7.is.ipp.messages.IppInt;
import com.scene7.is.ipp.messages.IppLongString;
import com.scene7.is.ipp.messages.IppUri;
import com.scene7.is.ipp.messages.Offset;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.io.Writer;
public class IppUrlFont {
private String name_;
private String postscriptName_;
private IppUri file_;
private IppUri metricsFile_;
private IppUri customKerningFile_;
private boolean bold_;
private boolean italic_;
public IppUrlFont(String name, String postscriptName, IppUri file, IppUri metricsFile, IppUri customKerningFile, boolean bold, boolean italic) {
this.name_ = name;
this.postscriptName_ = postscriptName;
this.file_ = file;
this.metricsFile_ = metricsFile;
this.customKerningFile_ = customKerningFile;
this.bold_ = bold;
this.italic_ = italic;
}
public String toString() {
StringBuffer buffer = new StringBuffer();
buffer.append("[");
buffer.append("name: ").append(String.valueOf(this.name_)).append(" ");
buffer.append("postscriptName: ").append(String.valueOf(this.postscriptName_)).append(" ");
buffer.append("file: ").append(String.valueOf(this.file_)).append(" ");
buffer.append("metricsFile: ").append(String.valueOf(this.metricsFile_)).append(" ");
buffer.append("customKerningFile: ").append(String.valueOf(this.customKerningFile_)).append(" ");
buffer.append("bold: ").append(String.valueOf(this.bold_)).append(" ");
buffer.append("italic: ").append(String.valueOf(this.italic_)).append(" ");
buffer.append("]");
return buffer.toString();
}
public boolean equals(Object o) {
if (!(o instanceof IppUrlFont)) {
return false;
}
IppUrlFont e = (IppUrlFont)o;
if (!this.name_.equals(e.name_)) {
return false;
}
if (!this.postscriptName_.equals(e.postscriptName_)) {
return false;
}
if (!this.file_.equals(e.file_)) {
return false;
}
if (!this.metricsFile_.equals(e.metricsFile_)) {
return false;
}
if (!this.customKerningFile_.equals(e.customKerningFile_)) {
return false;
}
if (this.bold_ != e.bold_) {
return false;
}
if (this.italic_ != e.italic_) {
return false;
}
return true;
}
public static IppUrlFont Unstuff(byte[] arr, Offset arrayPos) {
Ipp.Assert((arrayPos.val & 3) == 0, "IppUrlFont align");
String name = IppLongString.Unstuff(arr, arrayPos);
String postscriptName = IppLongString.Unstuff(arr, arrayPos);
IppUri file = IppUri.Unstuff(arr, arrayPos);
IppUri metricsFile = IppUri.Unstuff(arr, arrayPos);
IppUri customKerningFile = IppUri.Unstuff(arr, arrayPos);
boolean bold = IppBool.Unstuff(arr, arrayPos);
boolean italic = IppBool.Unstuff(arr, arrayPos);
return new IppUrlFont(name, postscriptName, file, metricsFile, customKerningFile, bold, italic);
}
public static IppUrlFont[] UnstuffArray(byte[] arr, Offset arrayPos) {
Ipp.Assert((arrayPos.val & 3) == 0, "IppUrlFont alignemt");
int count = IppInt.Unstuff(arr, arrayPos);
int size = IppInt.Unstuff(arr, arrayPos);
Ipp.Assert(count == 0 || size >= 124, "IppUrlFont count");
Offset roff = new Offset(IppInt.Unstuff(arr, arrayPos));
Offset loff = new Offset(roff.val);
IppUrlFont[] result = new IppUrlFont[count];
for (int i = 0; i < count; ++i) {
loff.val = roff.val;
result[i] = IppUrlFont.Unstuff(arr, loff);
roff.val += size;
}
return result;
}
public static IppUrlFont[] UnstuffFixedArray(byte[] arr, Offset arrayPos, int count) {
IppUrlFont[] result = new IppUrlFont[count];
for (int i = 0; i < count; ++i) {
result[i] = IppUrlFont.Unstuff(arr, arrayPos);
}
return result;
}
public static void Stuff(byte[] arr, Offset arrayPos, Offset varPos, IppUrlFont val) {
Ipp.Assert((arrayPos.val & 3) == 0, "IppUrlFont align");
if (val != null) {
IppLongString.Stuff(arr, arrayPos, varPos, val.name());
IppLongString.Stuff(arr, arrayPos, varPos, val.postscriptName());
IppUri.Stuff(arr, arrayPos, varPos, val.file());
IppUri.Stuff(arr, arrayPos, varPos, val.metricsFile());
IppUri.Stuff(arr, arrayPos, varPos, val.customKerningFile());
IppBool.Stuff(arr, arrayPos, varPos, val.bold());
IppBool.Stuff(arr, arrayPos, varPos, val.italic());
} else {
Ipp.StuffNullBytes(arr, arrayPos, 124);
}
}
public static void StuffArray(byte[] arr, Offset arrayPos, Offset varPos, IppUrlFont[] val) {
Ipp.Assert((arrayPos.val & 3) == 0, "IppUrlFont stuffarray align");
int len = val != null ? val.length : 0;
IppInt.Stuff(arr, arrayPos, varPos, len);
IppInt.Stuff(arr, arrayPos, varPos, 124);
Ipp.StuffOffset(arr, arrayPos, varPos, len > 0 ? 4 : 1);
Offset varvarPos = new Offset(varPos.val + 124 * len);
for (int i = 0; i < len; ++i) {
IppUrlFont.Stuff(arr, varPos, varvarPos, val[i]);
}
varPos.val = varvarPos.val;
}
public static void StuffFixedArray(byte[] arr, Offset arrayPos, Offset varPos, int count, IppUrlFont[] val) {
Ipp.Assert(val.length == count, "IppUrlFont count");
for (int i = 0; i < count; ++i) {
IppUrlFont.Stuff(arr, arrayPos, varPos, val[i]);
}
}
public static void Print(Writer tf, String label, IppUrlFont it) throws IOException {
String ll = label + "IppUrlFont: ";
if (it == null) {
tf.write(ll + "NULL!!\n");
return;
}
tf.write(ll + "\n");
IppLongString.Print(tf, ll + "name: ", it.name());
IppLongString.Print(tf, ll + "postscriptName: ", it.postscriptName());
IppUri.Print(tf, ll + "file: ", it.file());
IppUri.Print(tf, ll + "metricsFile: ", it.metricsFile());
IppUri.Print(tf, ll + "customKerningFile: ", it.customKerningFile());
IppBool.Print(tf, ll + "bold: ", it.bold());
IppBool.Print(tf, ll + "italic: ", it.italic());
}
public static void PrintArray(Writer tf, String label, IppUrlFont[] it) throws IOException {
String ll = label + "IppUrlFont Array, length: ";
tf.write(ll);
if (it == null) {
tf.write("NULL!!!\n");
return;
}
tf.write("" + it.length + "\n");
for (int i = 0; i < it.length; ++i) {
ll = label + "IppUrlFont[" + String.valueOf(i) + "]: ";
IppUrlFont.Print(tf, ll, it[i]);
}
}
public void adjustVarPos(Offset varPos) {
try {
varPos.val += this.name_.getBytes("UTF-8").length + 1;
}
catch (UnsupportedEncodingException e) {
throw new AssertionError(e);
}
try {
varPos.val += this.postscriptName_.getBytes("UTF-8").length + 1;
}
catch (UnsupportedEncodingException e) {
throw new AssertionError(e);
}
this.file_.adjustVarPos(varPos);
this.metricsFile_.adjustVarPos(varPos);
this.customKerningFile_.adjustVarPos(varPos);
}
public String name() {
return this.name_;
}
public String postscriptName() {
return this.postscriptName_;
}
public IppUri file() {
return this.file_;
}
public IppUri metricsFile() {
return this.metricsFile_;
}
public IppUri customKerningFile() {
return this.customKerningFile_;
}
public boolean bold() {
return this.bold_;
}
public boolean italic() {
return this.italic_;
}
}