geomerative 0.1.0-java
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +14 -0
- data/LICENSE +662 -0
- data/LICENSE.md +9 -0
- data/README.md +2 -0
- data/Rakefile +37 -0
- data/examples/README.md +7 -0
- data/examples/data/FreeSans.ttf +0 -0
- data/examples/data/ReplicaBold.ttf +0 -0
- data/examples/data/bot1.svg +160 -0
- data/examples/hello_svg_to_pdf.rb +26 -0
- data/examples/hello_world.rb +23 -0
- data/examples/physics_type.rb +77 -0
- data/examples/rotate_first_letter.rb +28 -0
- data/geomerative.gemspec +32 -0
- data/lib/geomerative.rb +12 -0
- data/lib/geomerative/version.rb +3 -0
- data/pom.xml +110 -0
- data/src/geomerative/FastRClip.java +2715 -0
- data/src/geomerative/RClip.java +2892 -0
- data/src/geomerative/RClosest.java +64 -0
- data/src/geomerative/RCommand.java +1941 -0
- data/src/geomerative/RContour.java +348 -0
- data/src/geomerative/RFont.java +583 -0
- data/src/geomerative/RG.java +753 -0
- data/src/geomerative/RGeomElem.java +1075 -0
- data/src/geomerative/RGroup.java +888 -0
- data/src/geomerative/RMatrix.java +401 -0
- data/src/geomerative/RMesh.java +420 -0
- data/src/geomerative/RPath.java +1095 -0
- data/src/geomerative/RPoint.java +419 -0
- data/src/geomerative/RPolygon.java +1110 -0
- data/src/geomerative/RRectangle.java +91 -0
- data/src/geomerative/RSVG.java +976 -0
- data/src/geomerative/RShape.java +2045 -0
- data/src/geomerative/RStrip.java +221 -0
- data/src/geomerative/RStyle.java +469 -0
- data/src/org/apache/batik/svggen/font/.SVGFont.java.swp +0 -0
- data/src/org/apache/batik/svggen/font/Font.java +188 -0
- data/src/org/apache/batik/svggen/font/Glyph.java +113 -0
- data/src/org/apache/batik/svggen/font/Messages.java.bak +72 -0
- data/src/org/apache/batik/svggen/font/Point.java +38 -0
- data/src/org/apache/batik/svggen/font/RandomAccessFileEmulator.java +15 -0
- data/src/org/apache/batik/svggen/font/table/ClassDef.java +42 -0
- data/src/org/apache/batik/svggen/font/table/ClassDefFormat1.java +55 -0
- data/src/org/apache/batik/svggen/font/table/ClassDefFormat2.java +49 -0
- data/src/org/apache/batik/svggen/font/table/CmapFormat.java +81 -0
- data/src/org/apache/batik/svggen/font/table/CmapFormat0.java +60 -0
- data/src/org/apache/batik/svggen/font/table/CmapFormat2.java +48 -0
- data/src/org/apache/batik/svggen/font/table/CmapFormat4.java +147 -0
- data/src/org/apache/batik/svggen/font/table/CmapFormat6.java +60 -0
- data/src/org/apache/batik/svggen/font/table/CmapIndexEntry.java +84 -0
- data/src/org/apache/batik/svggen/font/table/CmapTable.java +87 -0
- data/src/org/apache/batik/svggen/font/table/Coverage.java +50 -0
- data/src/org/apache/batik/svggen/font/table/CoverageFormat1.java +59 -0
- data/src/org/apache/batik/svggen/font/table/CoverageFormat2.java +56 -0
- data/src/org/apache/batik/svggen/font/table/CvtTable.java +48 -0
- data/src/org/apache/batik/svggen/font/table/Device.java +63 -0
- data/src/org/apache/batik/svggen/font/table/DirectoryEntry.java +73 -0
- data/src/org/apache/batik/svggen/font/table/Feature.java +56 -0
- data/src/org/apache/batik/svggen/font/table/FeatureList.java +70 -0
- data/src/org/apache/batik/svggen/font/table/FeatureRecord.java +52 -0
- data/src/org/apache/batik/svggen/font/table/FeatureTags.java +30 -0
- data/src/org/apache/batik/svggen/font/table/FpgmTable.java +38 -0
- data/src/org/apache/batik/svggen/font/table/GlyfCompositeComp.java +165 -0
- data/src/org/apache/batik/svggen/font/table/GlyfCompositeDescript.java +160 -0
- data/src/org/apache/batik/svggen/font/table/GlyfDescript.java +79 -0
- data/src/org/apache/batik/svggen/font/table/GlyfSimpleDescript.java +155 -0
- data/src/org/apache/batik/svggen/font/table/GlyfTable.java +111 -0
- data/src/org/apache/batik/svggen/font/table/GlyphDescription.java +39 -0
- data/src/org/apache/batik/svggen/font/table/GposTable.java +80 -0
- data/src/org/apache/batik/svggen/font/table/GsubTable.java +118 -0
- data/src/org/apache/batik/svggen/font/table/HeadTable.java +159 -0
- data/src/org/apache/batik/svggen/font/table/HheaTable.java +109 -0
- data/src/org/apache/batik/svggen/font/table/HmtxTable.java +99 -0
- data/src/org/apache/batik/svggen/font/table/KernSubtable.java +58 -0
- data/src/org/apache/batik/svggen/font/table/KernSubtableFormat0.java +65 -0
- data/src/org/apache/batik/svggen/font/table/KernSubtableFormat2.java +56 -0
- data/src/org/apache/batik/svggen/font/table/KernTable.java +64 -0
- data/src/org/apache/batik/svggen/font/table/KerningPair.java +53 -0
- data/src/org/apache/batik/svggen/font/table/LangSys.java +58 -0
- data/src/org/apache/batik/svggen/font/table/LangSysRecord.java +52 -0
- data/src/org/apache/batik/svggen/font/table/Ligature.java +57 -0
- data/src/org/apache/batik/svggen/font/table/LigatureSet.java +55 -0
- data/src/org/apache/batik/svggen/font/table/LigatureSubst.java +40 -0
- data/src/org/apache/batik/svggen/font/table/LigatureSubstFormat1.java +63 -0
- data/src/org/apache/batik/svggen/font/table/LocaTable.java +72 -0
- data/src/org/apache/batik/svggen/font/table/Lookup.java +77 -0
- data/src/org/apache/batik/svggen/font/table/LookupList.java +68 -0
- data/src/org/apache/batik/svggen/font/table/LookupSubtable.java +27 -0
- data/src/org/apache/batik/svggen/font/table/LookupSubtableFactory.java +31 -0
- data/src/org/apache/batik/svggen/font/table/MaxpTable.java +124 -0
- data/src/org/apache/batik/svggen/font/table/NameRecord.java +98 -0
- data/src/org/apache/batik/svggen/font/table/NameTable.java +67 -0
- data/src/org/apache/batik/svggen/font/table/Os2Table.java +232 -0
- data/src/org/apache/batik/svggen/font/table/Panose.java +108 -0
- data/src/org/apache/batik/svggen/font/table/PostTable.java +379 -0
- data/src/org/apache/batik/svggen/font/table/PrepTable.java +38 -0
- data/src/org/apache/batik/svggen/font/table/Program.java +49 -0
- data/src/org/apache/batik/svggen/font/table/RangeRecord.java +57 -0
- data/src/org/apache/batik/svggen/font/table/Script.java +72 -0
- data/src/org/apache/batik/svggen/font/table/ScriptList.java +78 -0
- data/src/org/apache/batik/svggen/font/table/ScriptRecord.java +52 -0
- data/src/org/apache/batik/svggen/font/table/ScriptTags.java +28 -0
- data/src/org/apache/batik/svggen/font/table/SingleSubst.java +47 -0
- data/src/org/apache/batik/svggen/font/table/SingleSubstFormat1.java +67 -0
- data/src/org/apache/batik/svggen/font/table/SingleSubstFormat2.java +67 -0
- data/src/org/apache/batik/svggen/font/table/Table.java +204 -0
- data/src/org/apache/batik/svggen/font/table/TableDirectory.java +94 -0
- data/src/org/apache/batik/svggen/font/table/TableFactory.java +121 -0
- metadata +206 -0
@@ -0,0 +1,84 @@
|
|
1
|
+
/*
|
2
|
+
|
3
|
+
Copyright 2001 The Apache Software Foundation
|
4
|
+
|
5
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
you may not use this file except in compliance with the License.
|
7
|
+
You may obtain a copy of the License at
|
8
|
+
|
9
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
|
11
|
+
Unless required by applicable law or agreed to in writing, software
|
12
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
See the License for the specific language governing permissions and
|
15
|
+
limitations under the License.
|
16
|
+
|
17
|
+
*/
|
18
|
+
package org.apache.batik.svggen.font.table;
|
19
|
+
|
20
|
+
import java.io.IOException;
|
21
|
+
import org.apache.batik.svggen.font.*;
|
22
|
+
|
23
|
+
/**
|
24
|
+
* @version $Id: CmapIndexEntry.java,v 1.3 2004/08/18 07:15:20 vhardy Exp $
|
25
|
+
* @author <a href="mailto:david@steadystate.co.uk">David Schweinsberg</a>
|
26
|
+
*/
|
27
|
+
public class CmapIndexEntry {
|
28
|
+
|
29
|
+
private final int platformId;
|
30
|
+
private final int encodingId;
|
31
|
+
private final int offset;
|
32
|
+
|
33
|
+
protected CmapIndexEntry(RandomAccessFileEmulator raf) throws IOException {
|
34
|
+
platformId = raf.readUnsignedShort();
|
35
|
+
encodingId = raf.readUnsignedShort();
|
36
|
+
offset = raf.readInt();
|
37
|
+
}
|
38
|
+
|
39
|
+
public int getEncodingId() {
|
40
|
+
return encodingId;
|
41
|
+
}
|
42
|
+
|
43
|
+
public int getOffset() {
|
44
|
+
return offset;
|
45
|
+
}
|
46
|
+
|
47
|
+
public int getPlatformId() {
|
48
|
+
return platformId;
|
49
|
+
}
|
50
|
+
|
51
|
+
@Override
|
52
|
+
public String toString() {
|
53
|
+
String platform;
|
54
|
+
String encoding = "";
|
55
|
+
|
56
|
+
switch (platformId) {
|
57
|
+
case 1: platform = " (Macintosh)"; break;
|
58
|
+
case 3: platform = " (Windows)"; break;
|
59
|
+
default: platform = "";
|
60
|
+
}
|
61
|
+
if (platformId == 3) {
|
62
|
+
// Windows specific encodings
|
63
|
+
switch (encodingId) {
|
64
|
+
case 0: encoding = " (Symbol)"; break;
|
65
|
+
case 1: encoding = " (Unicode)"; break;
|
66
|
+
case 2: encoding = " (ShiftJIS)"; break;
|
67
|
+
case 3: encoding = " (Big5)"; break;
|
68
|
+
case 4: encoding = " (PRC)"; break;
|
69
|
+
case 5: encoding = " (Wansung)"; break;
|
70
|
+
case 6: encoding = " (Johab)"; break;
|
71
|
+
default: encoding = "";
|
72
|
+
}
|
73
|
+
}
|
74
|
+
return new StringBuffer()
|
75
|
+
.append( "platform id: " )
|
76
|
+
.append( platformId )
|
77
|
+
.append( platform )
|
78
|
+
.append( ", encoding id: " )
|
79
|
+
.append( encodingId )
|
80
|
+
.append( encoding )
|
81
|
+
.append( ", offset: " )
|
82
|
+
.append( offset ).toString();
|
83
|
+
}
|
84
|
+
}
|
@@ -0,0 +1,87 @@
|
|
1
|
+
/*
|
2
|
+
|
3
|
+
Copyright 2001 The Apache Software Foundation
|
4
|
+
|
5
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
you may not use this file except in compliance with the License.
|
7
|
+
You may obtain a copy of the License at
|
8
|
+
|
9
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
|
11
|
+
Unless required by applicable law or agreed to in writing, software
|
12
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
See the License for the specific language governing permissions and
|
15
|
+
limitations under the License.
|
16
|
+
|
17
|
+
*/
|
18
|
+
package org.apache.batik.svggen.font.table;
|
19
|
+
|
20
|
+
import java.io.IOException;
|
21
|
+
import org.apache.batik.svggen.font.*;
|
22
|
+
|
23
|
+
/**
|
24
|
+
* @version $Id: CmapTable.java,v 1.3 2004/08/18 07:15:20 vhardy Exp $
|
25
|
+
* @author <a href="mailto:david@steadystate.co.uk">David Schweinsberg</a>
|
26
|
+
*/
|
27
|
+
public class CmapTable implements Table {
|
28
|
+
|
29
|
+
private final int version;
|
30
|
+
private final int numTables;
|
31
|
+
private final CmapIndexEntry[] entries;
|
32
|
+
private final CmapFormat[] formats;
|
33
|
+
|
34
|
+
protected CmapTable(DirectoryEntry de, RandomAccessFileEmulator raf) throws IOException {
|
35
|
+
long fp = de.getOffset();
|
36
|
+
raf.seek(fp);
|
37
|
+
version = raf.readUnsignedShort();
|
38
|
+
numTables = raf.readUnsignedShort();
|
39
|
+
entries = new CmapIndexEntry[numTables];
|
40
|
+
formats = new CmapFormat[numTables];
|
41
|
+
|
42
|
+
// Get each of the index entries
|
43
|
+
for (int i = 0; i < numTables; i++) {
|
44
|
+
entries[i] = new CmapIndexEntry(raf);
|
45
|
+
}
|
46
|
+
|
47
|
+
// Get each of the tables
|
48
|
+
for (int i = 0; i < numTables; i++) {
|
49
|
+
raf.seek(fp + entries[i].getOffset());
|
50
|
+
int format = raf.readUnsignedShort();
|
51
|
+
formats[i] = CmapFormat.create(format, raf);
|
52
|
+
}
|
53
|
+
}
|
54
|
+
|
55
|
+
public CmapFormat getCmapFormat(short platformId, short encodingId) {
|
56
|
+
|
57
|
+
// Find the requested format
|
58
|
+
for (int i = 0; i < numTables; i++) {
|
59
|
+
if (entries[i].getPlatformId() == platformId
|
60
|
+
&& entries[i].getEncodingId() == encodingId) {
|
61
|
+
return formats[i];
|
62
|
+
}
|
63
|
+
}
|
64
|
+
return null;
|
65
|
+
}
|
66
|
+
|
67
|
+
@Override
|
68
|
+
public int getType() {
|
69
|
+
return cmap;
|
70
|
+
}
|
71
|
+
|
72
|
+
@Override
|
73
|
+
public String toString() {
|
74
|
+
StringBuffer sb = new StringBuffer().append("cmap\n");
|
75
|
+
|
76
|
+
// Get each of the index entries
|
77
|
+
for (int i = 0; i < numTables; i++) {
|
78
|
+
sb.append("\t").append(entries[i].toString()).append("\n");
|
79
|
+
}
|
80
|
+
|
81
|
+
// Get each of the tables
|
82
|
+
for (int i = 0; i < numTables; i++) {
|
83
|
+
sb.append("\t").append(formats[i].toString()).append("\n");
|
84
|
+
}
|
85
|
+
return sb.toString();
|
86
|
+
}
|
87
|
+
}
|
@@ -0,0 +1,50 @@
|
|
1
|
+
/*
|
2
|
+
|
3
|
+
Copyright 2001,2003 The Apache Software Foundation
|
4
|
+
|
5
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
you may not use this file except in compliance with the License.
|
7
|
+
You may obtain a copy of the License at
|
8
|
+
|
9
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
|
11
|
+
Unless required by applicable law or agreed to in writing, software
|
12
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
See the License for the specific language governing permissions and
|
15
|
+
limitations under the License.
|
16
|
+
|
17
|
+
*/
|
18
|
+
package org.apache.batik.svggen.font.table;
|
19
|
+
|
20
|
+
import java.io.IOException;
|
21
|
+
import org.apache.batik.svggen.font.*;
|
22
|
+
|
23
|
+
/**
|
24
|
+
*
|
25
|
+
* @author <a href="mailto:david@steadystate.co.uk">David Schweinsberg</a>
|
26
|
+
* @version $Id: Coverage.java,v 1.5 2005/03/27 08:58:36 cam Exp $
|
27
|
+
*/
|
28
|
+
public abstract class Coverage {
|
29
|
+
|
30
|
+
public abstract int getFormat();
|
31
|
+
|
32
|
+
/**
|
33
|
+
* @param glyphId The ID of the glyph to find.
|
34
|
+
* @return The index of the glyph within the coverage, or -1 if the glyph
|
35
|
+
* can't be found.
|
36
|
+
*/
|
37
|
+
public abstract int findGlyph(int glyphId);
|
38
|
+
|
39
|
+
protected static Coverage read(RandomAccessFileEmulator raf) throws IOException {
|
40
|
+
Coverage c = null;
|
41
|
+
int format = raf.readUnsignedShort();
|
42
|
+
if (format == 1) {
|
43
|
+
c = new CoverageFormat1(raf);
|
44
|
+
} else if (format == 2) {
|
45
|
+
c = new CoverageFormat2(raf);
|
46
|
+
}
|
47
|
+
return c;
|
48
|
+
}
|
49
|
+
|
50
|
+
}
|
@@ -0,0 +1,59 @@
|
|
1
|
+
/*
|
2
|
+
|
3
|
+
Copyright 2001,2003 The Apache Software Foundation
|
4
|
+
|
5
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
you may not use this file except in compliance with the License.
|
7
|
+
You may obtain a copy of the License at
|
8
|
+
|
9
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
|
11
|
+
Unless required by applicable law or agreed to in writing, software
|
12
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
See the License for the specific language governing permissions and
|
15
|
+
limitations under the License.
|
16
|
+
|
17
|
+
*/
|
18
|
+
package org.apache.batik.svggen.font.table;
|
19
|
+
|
20
|
+
import java.io.IOException;
|
21
|
+
import org.apache.batik.svggen.font.*;
|
22
|
+
|
23
|
+
/**
|
24
|
+
*
|
25
|
+
* @author <a href="mailto:david@steadystate.co.uk">David Schweinsberg</a>
|
26
|
+
* @version $Id: CoverageFormat1.java,v 1.4 2004/08/18 07:15:20 vhardy Exp $
|
27
|
+
*/
|
28
|
+
public class CoverageFormat1 extends Coverage {
|
29
|
+
|
30
|
+
private final int glyphCount;
|
31
|
+
private final int[] glyphIds;
|
32
|
+
|
33
|
+
/** Creates new CoverageFormat1
|
34
|
+
* @param raf
|
35
|
+
* @throws java.io.IOException */
|
36
|
+
protected CoverageFormat1(RandomAccessFileEmulator raf) throws IOException {
|
37
|
+
glyphCount = raf.readUnsignedShort();
|
38
|
+
glyphIds = new int[glyphCount];
|
39
|
+
for (int i = 0; i < glyphCount; i++) {
|
40
|
+
glyphIds[i] = raf.readUnsignedShort();
|
41
|
+
}
|
42
|
+
}
|
43
|
+
|
44
|
+
@Override
|
45
|
+
public int getFormat() {
|
46
|
+
return 1;
|
47
|
+
}
|
48
|
+
|
49
|
+
@Override
|
50
|
+
public int findGlyph(int glyphId) {
|
51
|
+
for (int i = 0; i < glyphCount; i++) {
|
52
|
+
if (glyphIds[i] == glyphId) {
|
53
|
+
return i;
|
54
|
+
}
|
55
|
+
}
|
56
|
+
return -1;
|
57
|
+
}
|
58
|
+
|
59
|
+
}
|
@@ -0,0 +1,56 @@
|
|
1
|
+
/*
|
2
|
+
|
3
|
+
Copyright 2001,2003 The Apache Software Foundation
|
4
|
+
|
5
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
you may not use this file except in compliance with the License.
|
7
|
+
You may obtain a copy of the License at
|
8
|
+
|
9
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
|
11
|
+
Unless required by applicable law or agreed to in writing, software
|
12
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
See the License for the specific language governing permissions and
|
15
|
+
limitations under the License.
|
16
|
+
|
17
|
+
*/
|
18
|
+
package org.apache.batik.svggen.font.table;
|
19
|
+
|
20
|
+
import java.io.IOException;
|
21
|
+
import org.apache.batik.svggen.font.*;
|
22
|
+
|
23
|
+
/**
|
24
|
+
*
|
25
|
+
* @author <a href="mailto:david@steadystate.co.uk">David Schweinsberg</a>
|
26
|
+
* @version $Id: CoverageFormat2.java,v 1.4 2004/08/18 07:15:20 vhardy Exp $
|
27
|
+
*/
|
28
|
+
public class CoverageFormat2 extends Coverage {
|
29
|
+
|
30
|
+
private int rangeCount;
|
31
|
+
private RangeRecord[] rangeRecords;
|
32
|
+
|
33
|
+
/** Creates new CoverageFormat2 */
|
34
|
+
protected CoverageFormat2(RandomAccessFileEmulator raf) throws IOException {
|
35
|
+
rangeCount = raf.readUnsignedShort();
|
36
|
+
rangeRecords = new RangeRecord[rangeCount];
|
37
|
+
for (int i = 0; i < rangeCount; i++) {
|
38
|
+
rangeRecords[i] = new RangeRecord(raf);
|
39
|
+
}
|
40
|
+
}
|
41
|
+
|
42
|
+
public int getFormat() {
|
43
|
+
return 2;
|
44
|
+
}
|
45
|
+
|
46
|
+
public int findGlyph(int glyphId) {
|
47
|
+
for (int i = 0; i < rangeCount; i++) {
|
48
|
+
int n = rangeRecords[i].getCoverageIndex(glyphId);
|
49
|
+
if (n > -1) {
|
50
|
+
return n;
|
51
|
+
}
|
52
|
+
}
|
53
|
+
return -1;
|
54
|
+
}
|
55
|
+
|
56
|
+
}
|
@@ -0,0 +1,48 @@
|
|
1
|
+
/*
|
2
|
+
|
3
|
+
Copyright 2001,2003 The Apache Software Foundation
|
4
|
+
|
5
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
you may not use this file except in compliance with the License.
|
7
|
+
You may obtain a copy of the License at
|
8
|
+
|
9
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
|
11
|
+
Unless required by applicable law or agreed to in writing, software
|
12
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
See the License for the specific language governing permissions and
|
15
|
+
limitations under the License.
|
16
|
+
|
17
|
+
*/
|
18
|
+
package org.apache.batik.svggen.font.table;
|
19
|
+
|
20
|
+
import java.io.IOException;
|
21
|
+
import org.apache.batik.svggen.font.*;
|
22
|
+
|
23
|
+
/**
|
24
|
+
* @version $Id: CvtTable.java,v 1.4 2004/08/18 07:15:20 vhardy Exp $
|
25
|
+
* @author <a href="mailto:david@steadystate.co.uk">David Schweinsberg</a>
|
26
|
+
*/
|
27
|
+
public class CvtTable implements Table {
|
28
|
+
|
29
|
+
private final short[] values;
|
30
|
+
|
31
|
+
protected CvtTable(DirectoryEntry de,RandomAccessFileEmulator raf) throws IOException {
|
32
|
+
raf.seek(de.getOffset());
|
33
|
+
int len = de.getLength() / 2;
|
34
|
+
values = new short[len];
|
35
|
+
for (int i = 0; i < len; i++) {
|
36
|
+
values[i] = raf.readShort();
|
37
|
+
}
|
38
|
+
}
|
39
|
+
|
40
|
+
@Override
|
41
|
+
public int getType() {
|
42
|
+
return cvt;
|
43
|
+
}
|
44
|
+
|
45
|
+
public short[] getValues() {
|
46
|
+
return values;
|
47
|
+
}
|
48
|
+
}
|
@@ -0,0 +1,63 @@
|
|
1
|
+
/*
|
2
|
+
|
3
|
+
Copyright 2001 The Apache Software Foundation
|
4
|
+
|
5
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
you may not use this file except in compliance with the License.
|
7
|
+
You may obtain a copy of the License at
|
8
|
+
|
9
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
|
11
|
+
Unless required by applicable law or agreed to in writing, software
|
12
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
See the License for the specific language governing permissions and
|
15
|
+
limitations under the License.
|
16
|
+
|
17
|
+
*/
|
18
|
+
package org.apache.batik.svggen.font.table;
|
19
|
+
|
20
|
+
import java.io.IOException;
|
21
|
+
import org.apache.batik.svggen.font.*;
|
22
|
+
|
23
|
+
/**
|
24
|
+
*
|
25
|
+
* @author <a href="mailto:david@steadystate.co.uk">David Schweinsberg</a>
|
26
|
+
* @version $Id: Device.java,v 1.3 2004/08/18 07:15:20 vhardy Exp $
|
27
|
+
*/
|
28
|
+
public class Device extends Object {
|
29
|
+
|
30
|
+
private int startSize;
|
31
|
+
private int endSize;
|
32
|
+
private int deltaFormat;
|
33
|
+
private final int[] deltaValues;
|
34
|
+
|
35
|
+
/**
|
36
|
+
* Creates new Device
|
37
|
+
*
|
38
|
+
* @param raf
|
39
|
+
* @throws java.io.IOException
|
40
|
+
*/
|
41
|
+
public Device(RandomAccessFileEmulator raf) throws IOException {
|
42
|
+
startSize = raf.readUnsignedShort();
|
43
|
+
endSize = raf.readUnsignedShort();
|
44
|
+
deltaFormat = raf.readUnsignedShort();
|
45
|
+
int size = startSize - endSize;
|
46
|
+
switch (deltaFormat) {
|
47
|
+
case 1:
|
48
|
+
size = (size % 8 == 0) ? size / 8 : size / 8 + 1;
|
49
|
+
break;
|
50
|
+
case 2:
|
51
|
+
size = (size % 4 == 0) ? size / 4 : size / 4 + 1;
|
52
|
+
break;
|
53
|
+
case 3:
|
54
|
+
size = (size % 2 == 0) ? size / 2 : size / 2 + 1;
|
55
|
+
break;
|
56
|
+
}
|
57
|
+
deltaValues = new int[size];
|
58
|
+
for (int i = 0; i < size; i++) {
|
59
|
+
deltaValues[i] = raf.readUnsignedShort();
|
60
|
+
}
|
61
|
+
}
|
62
|
+
|
63
|
+
}
|