geomerative 0.1.0-java
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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,52 @@
|
|
|
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: LangSysRecord.java,v 1.3 2004/08/18 07:15:21 vhardy Exp $
|
|
27
|
+
*/
|
|
28
|
+
public class LangSysRecord {
|
|
29
|
+
|
|
30
|
+
private final int tag;
|
|
31
|
+
private final int offset;
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Creates new LangSysRecord
|
|
35
|
+
*
|
|
36
|
+
* @param raf
|
|
37
|
+
* @throws java.io.IOException
|
|
38
|
+
*/
|
|
39
|
+
public LangSysRecord(RandomAccessFileEmulator raf) throws IOException {
|
|
40
|
+
tag = raf.readInt();
|
|
41
|
+
offset = raf.readUnsignedShort();
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
public int getTag() {
|
|
45
|
+
return tag;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
public int getOffset() {
|
|
49
|
+
return offset;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
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: Ligature.java,v 1.3 2004/08/18 07:15:21 vhardy Exp $
|
|
27
|
+
*/
|
|
28
|
+
public class Ligature {
|
|
29
|
+
|
|
30
|
+
private final int ligGlyph;
|
|
31
|
+
private final int compCount;
|
|
32
|
+
private final int[] components;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Creates new Ligature
|
|
36
|
+
*
|
|
37
|
+
* @param raf
|
|
38
|
+
* @throws java.io.IOException
|
|
39
|
+
*/
|
|
40
|
+
public Ligature(RandomAccessFileEmulator raf) throws IOException {
|
|
41
|
+
ligGlyph = raf.readUnsignedShort();
|
|
42
|
+
compCount = raf.readUnsignedShort();
|
|
43
|
+
components = new int[compCount - 1];
|
|
44
|
+
for (int i = 0; i < compCount - 1; i++) {
|
|
45
|
+
components[i] = raf.readUnsignedShort();
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
public int getGlyphCount() {
|
|
50
|
+
return compCount;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
public int getGlyphId(int i) {
|
|
54
|
+
return (i == 0) ? ligGlyph : components[i - 1];
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
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: LigatureSet.java,v 1.3 2004/08/18 07:15:21 vhardy Exp $
|
|
27
|
+
*/
|
|
28
|
+
public class LigatureSet {
|
|
29
|
+
|
|
30
|
+
private final int ligatureCount;
|
|
31
|
+
private final int[] ligatureOffsets;
|
|
32
|
+
private final Ligature[] ligatures;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Creates new LigatureSet
|
|
36
|
+
*
|
|
37
|
+
* @param raf
|
|
38
|
+
* @param offset
|
|
39
|
+
* @throws java.io.IOException
|
|
40
|
+
*/
|
|
41
|
+
public LigatureSet(RandomAccessFileEmulator raf, int offset) throws IOException {
|
|
42
|
+
raf.seek(offset);
|
|
43
|
+
ligatureCount = raf.readUnsignedShort();
|
|
44
|
+
ligatureOffsets = new int[ligatureCount];
|
|
45
|
+
ligatures = new Ligature[ligatureCount];
|
|
46
|
+
for (int i = 0; i < ligatureCount; i++) {
|
|
47
|
+
ligatureOffsets[i] = raf.readUnsignedShort();
|
|
48
|
+
}
|
|
49
|
+
for (int i = 0; i < ligatureCount; i++) {
|
|
50
|
+
raf.seek(offset + ligatureOffsets[i]);
|
|
51
|
+
ligatures[i] = new Ligature(raf);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
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: LigatureSubst.java,v 1.3 2004/08/18 07:15:21 vhardy Exp $
|
|
27
|
+
*/
|
|
28
|
+
public abstract class LigatureSubst extends LookupSubtable {
|
|
29
|
+
|
|
30
|
+
public static LigatureSubst read(RandomAccessFileEmulator raf, int offset) throws IOException {
|
|
31
|
+
LigatureSubst ls = null;
|
|
32
|
+
raf.seek(offset);
|
|
33
|
+
int format = raf.readUnsignedShort();
|
|
34
|
+
if (format == 1) {
|
|
35
|
+
ls = new LigatureSubstFormat1(raf, offset);
|
|
36
|
+
}
|
|
37
|
+
return ls;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
}
|
|
@@ -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: LigatureSubstFormat1.java,v 1.3 2004/08/18 07:15:21 vhardy Exp
|
|
27
|
+
* $
|
|
28
|
+
*/
|
|
29
|
+
public class LigatureSubstFormat1 extends LigatureSubst {
|
|
30
|
+
|
|
31
|
+
private final int coverageOffset;
|
|
32
|
+
private final int ligSetCount;
|
|
33
|
+
private final int[] ligatureSetOffsets;
|
|
34
|
+
private final Coverage coverage;
|
|
35
|
+
private final LigatureSet[] ligatureSets;
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Creates new LigatureSubstFormat1
|
|
39
|
+
*
|
|
40
|
+
* @param raf
|
|
41
|
+
* @param offset
|
|
42
|
+
* @throws java.io.IOException
|
|
43
|
+
*/
|
|
44
|
+
protected LigatureSubstFormat1(RandomAccessFileEmulator raf, int offset) throws IOException {
|
|
45
|
+
coverageOffset = raf.readUnsignedShort();
|
|
46
|
+
ligSetCount = raf.readUnsignedShort();
|
|
47
|
+
ligatureSetOffsets = new int[ligSetCount];
|
|
48
|
+
ligatureSets = new LigatureSet[ligSetCount];
|
|
49
|
+
for (int i = 0; i < ligSetCount; i++) {
|
|
50
|
+
ligatureSetOffsets[i] = raf.readUnsignedShort();
|
|
51
|
+
}
|
|
52
|
+
raf.seek(offset + coverageOffset);
|
|
53
|
+
coverage = Coverage.read(raf);
|
|
54
|
+
for (int i = 0; i < ligSetCount; i++) {
|
|
55
|
+
ligatureSets[i] = new LigatureSet(raf, offset + ligatureSetOffsets[i]);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
public int getFormat() {
|
|
60
|
+
return 1;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
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.ByteArrayInputStream;
|
|
21
|
+
import java.io.IOException;
|
|
22
|
+
import org.apache.batik.svggen.font.*;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* @version $Id: LocaTable.java,v 1.4 2004/08/18 07:15:21 vhardy Exp $
|
|
26
|
+
* @author <a href="mailto:david@steadystate.co.uk">David Schweinsberg</a>
|
|
27
|
+
*/
|
|
28
|
+
public class LocaTable implements Table {
|
|
29
|
+
|
|
30
|
+
private byte[] buf = null;
|
|
31
|
+
private int[] offsets = null;
|
|
32
|
+
private short factor = 0;
|
|
33
|
+
|
|
34
|
+
protected LocaTable(DirectoryEntry de, RandomAccessFileEmulator raf) throws IOException {
|
|
35
|
+
raf.seek(de.getOffset());
|
|
36
|
+
buf = new byte[de.getLength()];
|
|
37
|
+
raf.read(buf);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
public void init(int numGlyphs, boolean shortEntries) {
|
|
41
|
+
if (buf == null) {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
offsets = new int[numGlyphs + 1];
|
|
45
|
+
ByteArrayInputStream bais = new ByteArrayInputStream(buf);
|
|
46
|
+
if (shortEntries) {
|
|
47
|
+
factor = 2;
|
|
48
|
+
for (int i = 0; i <= numGlyphs; i++) {
|
|
49
|
+
offsets[i] = (bais.read()<<8 | bais.read());
|
|
50
|
+
}
|
|
51
|
+
} else {
|
|
52
|
+
factor = 1;
|
|
53
|
+
for (int i = 0; i <= numGlyphs; i++) {
|
|
54
|
+
offsets[i] = (bais.read()<<24 | bais.read()<<16 |
|
|
55
|
+
bais.read()<< 8 | bais.read());
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
buf = null;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
public int getOffset(int i) {
|
|
62
|
+
if (offsets == null) {
|
|
63
|
+
return 0;
|
|
64
|
+
}
|
|
65
|
+
return offsets[i] * factor;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
@Override
|
|
69
|
+
public int getType() {
|
|
70
|
+
return loca;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
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: Lookup.java,v 1.3 2004/08/18 07:15:21 vhardy Exp $
|
|
27
|
+
*/
|
|
28
|
+
public class Lookup {
|
|
29
|
+
|
|
30
|
+
// LookupFlag bit enumeration
|
|
31
|
+
public static final int IGNORE_BASE_GLYPHS = 0x0002;
|
|
32
|
+
public static final int IGNORE_BASE_LIGATURES = 0x0004;
|
|
33
|
+
public static final int IGNORE_BASE_MARKS = 0x0008;
|
|
34
|
+
public static final int MARK_ATTACHMENT_TYPE = 0xFF00;
|
|
35
|
+
|
|
36
|
+
private final int type;
|
|
37
|
+
private final int flag;
|
|
38
|
+
private final int subTableCount;
|
|
39
|
+
private final int[] subTableOffsets;
|
|
40
|
+
private final LookupSubtable[] subTables;
|
|
41
|
+
|
|
42
|
+
/** Creates new Lookup
|
|
43
|
+
* @param factory
|
|
44
|
+
* @param raf
|
|
45
|
+
* @param offset
|
|
46
|
+
* @throws java.io.IOException
|
|
47
|
+
*/
|
|
48
|
+
public Lookup(LookupSubtableFactory factory, RandomAccessFileEmulator raf, int offset)
|
|
49
|
+
throws IOException {
|
|
50
|
+
raf.seek(offset);
|
|
51
|
+
type = raf.readUnsignedShort();
|
|
52
|
+
flag = raf.readUnsignedShort();
|
|
53
|
+
subTableCount = raf.readUnsignedShort();
|
|
54
|
+
subTableOffsets = new int[subTableCount];
|
|
55
|
+
subTables = new LookupSubtable[subTableCount];
|
|
56
|
+
for (int i = 0; i < subTableCount; i++) {
|
|
57
|
+
subTableOffsets[i] = raf.readUnsignedShort();
|
|
58
|
+
}
|
|
59
|
+
for (int i = 0; i < subTableCount; i++) {
|
|
60
|
+
subTables[i] = factory.read(type, raf, offset + subTableOffsets[i]);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
public int getType() {
|
|
65
|
+
return type;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
public int getSubtableCount() {
|
|
69
|
+
return subTableCount;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
public LookupSubtable getSubtable(int i) {
|
|
73
|
+
return subTables[i];
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
}
|
|
77
|
+
|
|
@@ -0,0 +1,68 @@
|
|
|
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: LookupList.java,v 1.3 2004/08/18 07:15:21 vhardy Exp $
|
|
27
|
+
*/
|
|
28
|
+
public class LookupList {
|
|
29
|
+
|
|
30
|
+
private final int lookupCount;
|
|
31
|
+
private final int[] lookupOffsets;
|
|
32
|
+
private final Lookup[] lookups;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Creates new LookupList
|
|
36
|
+
*
|
|
37
|
+
* @param raf
|
|
38
|
+
* @param offset
|
|
39
|
+
* @param factory
|
|
40
|
+
* @throws java.io.IOException
|
|
41
|
+
*/
|
|
42
|
+
public LookupList(RandomAccessFileEmulator raf, int offset, LookupSubtableFactory factory)
|
|
43
|
+
throws IOException {
|
|
44
|
+
raf.seek(offset);
|
|
45
|
+
lookupCount = raf.readUnsignedShort();
|
|
46
|
+
lookupOffsets = new int[lookupCount];
|
|
47
|
+
lookups = new Lookup[lookupCount];
|
|
48
|
+
for (int i = 0; i < lookupCount; i++) {
|
|
49
|
+
lookupOffsets[i] = raf.readUnsignedShort();
|
|
50
|
+
}
|
|
51
|
+
for (int i = 0; i < lookupCount; i++) {
|
|
52
|
+
lookups[i] = new Lookup(factory, raf, offset + lookupOffsets[i]);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
public Lookup getLookup(Feature feature, int index) {
|
|
57
|
+
if (feature == null) {
|
|
58
|
+
System.out.println("Feature is null!! Index is " + index + "!!");
|
|
59
|
+
return null;
|
|
60
|
+
}
|
|
61
|
+
if (feature.getLookupCount() > index) {
|
|
62
|
+
int i = feature.getLookupListIndex(index);
|
|
63
|
+
return lookups[i];
|
|
64
|
+
}
|
|
65
|
+
return null;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
}
|