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,38 @@
|
|
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: PrepTable.java,v 1.3 2004/08/18 07:15:22 vhardy Exp $
|
25
|
+
* @author <a href="mailto:david@steadystate.co.uk">David Schweinsberg</a>
|
26
|
+
*/
|
27
|
+
public class PrepTable extends Program implements Table {
|
28
|
+
|
29
|
+
public PrepTable(DirectoryEntry de,RandomAccessFileEmulator raf) throws IOException {
|
30
|
+
raf.seek(de.getOffset());
|
31
|
+
readInstructions(raf, de.getLength());
|
32
|
+
}
|
33
|
+
|
34
|
+
@Override
|
35
|
+
public int getType() {
|
36
|
+
return prep;
|
37
|
+
}
|
38
|
+
}
|
@@ -0,0 +1,49 @@
|
|
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: Program.java,v 1.4 2004/08/18 07:15:22 vhardy Exp $
|
26
|
+
* @author <a href="mailto:david@steadystate.co.uk">David Schweinsberg</a>
|
27
|
+
*/
|
28
|
+
public abstract class Program {
|
29
|
+
|
30
|
+
private short[] instructions;
|
31
|
+
|
32
|
+
public short[] getInstructions() {
|
33
|
+
return instructions;
|
34
|
+
}
|
35
|
+
|
36
|
+
protected void readInstructions(RandomAccessFileEmulator raf, int count) throws IOException {
|
37
|
+
instructions = new short[count];
|
38
|
+
for (int i = 0; i < count; i++) {
|
39
|
+
instructions[i] = (short) raf.readUnsignedByte();
|
40
|
+
}
|
41
|
+
}
|
42
|
+
|
43
|
+
protected void readInstructions(ByteArrayInputStream bais, int count) {
|
44
|
+
instructions = new short[count];
|
45
|
+
for (int i = 0; i < count; i++) {
|
46
|
+
instructions[i] = (short) bais.read();
|
47
|
+
}
|
48
|
+
}
|
49
|
+
}
|
@@ -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
|
+
* Coverage Index (GlyphID) = StartCoverageIndex + GlyphID - Start GlyphID
|
25
|
+
*
|
26
|
+
* @author <a href="mailto:david@steadystate.co.uk">David Schweinsberg</a>
|
27
|
+
* @version $Id: RangeRecord.java,v 1.3 2004/08/18 07:15:22 vhardy Exp $
|
28
|
+
*/
|
29
|
+
public class RangeRecord {
|
30
|
+
|
31
|
+
private final int start;
|
32
|
+
private final int end;
|
33
|
+
private final int startCoverageIndex;
|
34
|
+
|
35
|
+
/** Creates new RangeRecord
|
36
|
+
* @param raf
|
37
|
+
* @throws java.io.IOException
|
38
|
+
*/
|
39
|
+
public RangeRecord(RandomAccessFileEmulator raf) throws IOException {
|
40
|
+
start = raf.readUnsignedShort();
|
41
|
+
end = raf.readUnsignedShort();
|
42
|
+
startCoverageIndex = raf.readUnsignedShort();
|
43
|
+
}
|
44
|
+
|
45
|
+
public boolean isInRange(int glyphId) {
|
46
|
+
return (start <= glyphId && glyphId <= end);
|
47
|
+
}
|
48
|
+
|
49
|
+
public int getCoverageIndex(int glyphId) {
|
50
|
+
if (isInRange(glyphId)) {
|
51
|
+
return startCoverageIndex + glyphId - start;
|
52
|
+
}
|
53
|
+
return -1;
|
54
|
+
}
|
55
|
+
|
56
|
+
}
|
57
|
+
|
@@ -0,0 +1,72 @@
|
|
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: Script.java,v 1.3 2004/08/18 07:15:22 vhardy Exp $
|
27
|
+
*/
|
28
|
+
public class Script {
|
29
|
+
|
30
|
+
private final int defaultLangSysOffset;
|
31
|
+
private final int langSysCount;
|
32
|
+
private LangSysRecord[] langSysRecords;
|
33
|
+
private LangSys defaultLangSys;
|
34
|
+
private LangSys[] langSys;
|
35
|
+
|
36
|
+
/**
|
37
|
+
* Creates new ScriptTable
|
38
|
+
*
|
39
|
+
* @param raf
|
40
|
+
* @param offset
|
41
|
+
* @throws java.io.IOException
|
42
|
+
*/
|
43
|
+
protected Script(RandomAccessFileEmulator raf, int offset) throws IOException {
|
44
|
+
raf.seek(offset);
|
45
|
+
defaultLangSysOffset = raf.readUnsignedShort();
|
46
|
+
langSysCount = raf.readUnsignedShort();
|
47
|
+
if (langSysCount > 0) {
|
48
|
+
langSysRecords = new LangSysRecord[langSysCount];
|
49
|
+
for (int i = 0; i < langSysCount; i++) {
|
50
|
+
langSysRecords[i] = new LangSysRecord(raf);
|
51
|
+
}
|
52
|
+
}
|
53
|
+
|
54
|
+
// Read the LangSys tables
|
55
|
+
if (langSysCount > 0) {
|
56
|
+
langSys = new LangSys[langSysCount];
|
57
|
+
for (int i = 0; i < langSysCount; i++) {
|
58
|
+
raf.seek(offset + langSysRecords[i].getOffset());
|
59
|
+
langSys[i] = new LangSys(raf);
|
60
|
+
}
|
61
|
+
}
|
62
|
+
if (defaultLangSysOffset > 0) {
|
63
|
+
raf.seek(offset + defaultLangSysOffset);
|
64
|
+
defaultLangSys = new LangSys(raf);
|
65
|
+
}
|
66
|
+
}
|
67
|
+
|
68
|
+
public LangSys getDefaultLangSys() {
|
69
|
+
return defaultLangSys;
|
70
|
+
}
|
71
|
+
|
72
|
+
}
|
@@ -0,0 +1,78 @@
|
|
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: ScriptList.java,v 1.4 2004/08/18 07:15:22 vhardy Exp $
|
27
|
+
*/
|
28
|
+
public class ScriptList {
|
29
|
+
|
30
|
+
private int scriptCount = 0;
|
31
|
+
private final ScriptRecord[] scriptRecords;
|
32
|
+
private final Script[] scripts;
|
33
|
+
|
34
|
+
/**
|
35
|
+
* Creates new ScriptList
|
36
|
+
*
|
37
|
+
* @param raf
|
38
|
+
* @param offset
|
39
|
+
* @throws java.io.IOException
|
40
|
+
*/
|
41
|
+
protected ScriptList(RandomAccessFileEmulator raf, int offset) throws IOException {
|
42
|
+
raf.seek(offset);
|
43
|
+
scriptCount = raf.readUnsignedShort();
|
44
|
+
scriptRecords = new ScriptRecord[scriptCount];
|
45
|
+
scripts = new Script[scriptCount];
|
46
|
+
for (int i = 0; i < scriptCount; i++) {
|
47
|
+
scriptRecords[i] = new ScriptRecord(raf);
|
48
|
+
}
|
49
|
+
for (int i = 0; i < scriptCount; i++) {
|
50
|
+
scripts[i] = new Script(raf, offset + scriptRecords[i].getOffset());
|
51
|
+
}
|
52
|
+
}
|
53
|
+
|
54
|
+
public int getScriptCount() {
|
55
|
+
return scriptCount;
|
56
|
+
}
|
57
|
+
|
58
|
+
public ScriptRecord getScriptRecord(int i) {
|
59
|
+
return scriptRecords[i];
|
60
|
+
}
|
61
|
+
|
62
|
+
public Script findScript(String tag) {
|
63
|
+
if (tag.length() != 4) {
|
64
|
+
return null;
|
65
|
+
}
|
66
|
+
int tagVal = ((tag.charAt(0) << 24)
|
67
|
+
| (tag.charAt(1) << 16)
|
68
|
+
| (tag.charAt(2) << 8)
|
69
|
+
| tag.charAt(3));
|
70
|
+
for (int i = 0; i < scriptCount; i++) {
|
71
|
+
if (scriptRecords[i].getTag() == tagVal) {
|
72
|
+
return scripts[i];
|
73
|
+
}
|
74
|
+
}
|
75
|
+
return null;
|
76
|
+
}
|
77
|
+
|
78
|
+
}
|
@@ -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: ScriptRecord.java,v 1.3 2004/08/18 07:15:22 vhardy Exp $
|
27
|
+
*/
|
28
|
+
public class ScriptRecord {
|
29
|
+
|
30
|
+
private final int tag;
|
31
|
+
private final int offset;
|
32
|
+
|
33
|
+
/**
|
34
|
+
* Creates new ScriptRecord
|
35
|
+
*
|
36
|
+
* @param raf
|
37
|
+
* @throws java.io.IOException
|
38
|
+
*/
|
39
|
+
protected ScriptRecord(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,28 @@
|
|
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
|
+
/**
|
21
|
+
* Definition of Script tags
|
22
|
+
*
|
23
|
+
* @version $Id: ScriptTags.java,v 1.3 2004/08/18 07:15:22 vhardy Exp $
|
24
|
+
* @author <a href="mailto:vincent.hardy@eng.sun.com">Vincent Hardy</a>
|
25
|
+
*/
|
26
|
+
public interface ScriptTags {
|
27
|
+
String SCRIPT_TAG_ARAB = "arab";
|
28
|
+
}
|
@@ -0,0 +1,47 @@
|
|
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: SingleSubst.java,v 1.3 2004/08/18 07:15:22 vhardy Exp $
|
27
|
+
*/
|
28
|
+
public abstract class SingleSubst extends LookupSubtable {
|
29
|
+
|
30
|
+
public abstract int getFormat();
|
31
|
+
|
32
|
+
public abstract int substitute(int glyphId);
|
33
|
+
|
34
|
+
public static SingleSubst read(RandomAccessFileEmulator raf, int offset) throws IOException {
|
35
|
+
SingleSubst s = null;
|
36
|
+
raf.seek(offset);
|
37
|
+
int format = raf.readUnsignedShort();
|
38
|
+
if (format == 1) {
|
39
|
+
s = new SingleSubstFormat1(raf, offset);
|
40
|
+
} else if (format == 2) {
|
41
|
+
s = new SingleSubstFormat2(raf, offset);
|
42
|
+
}
|
43
|
+
return s;
|
44
|
+
}
|
45
|
+
|
46
|
+
}
|
47
|
+
|
@@ -0,0 +1,67 @@
|
|
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: SingleSubstFormat1.java,v 1.3 2004/08/18 07:15:22 vhardy Exp $
|
27
|
+
*/
|
28
|
+
public class SingleSubstFormat1 extends SingleSubst {
|
29
|
+
|
30
|
+
private final int coverageOffset;
|
31
|
+
private final short deltaGlyphID;
|
32
|
+
private final Coverage coverage;
|
33
|
+
|
34
|
+
/**
|
35
|
+
* Creates new SingleSubstFormat1
|
36
|
+
*
|
37
|
+
* @param raf
|
38
|
+
* @param offset
|
39
|
+
* @throws java.io.IOException
|
40
|
+
*/
|
41
|
+
protected SingleSubstFormat1(RandomAccessFileEmulator raf, int offset) throws IOException {
|
42
|
+
coverageOffset = raf.readUnsignedShort();
|
43
|
+
deltaGlyphID = raf.readShort();
|
44
|
+
raf.seek(offset + coverageOffset);
|
45
|
+
coverage = Coverage.read(raf);
|
46
|
+
}
|
47
|
+
|
48
|
+
@Override
|
49
|
+
public int getFormat() {
|
50
|
+
return 1;
|
51
|
+
}
|
52
|
+
|
53
|
+
/**
|
54
|
+
*
|
55
|
+
* @param glyphId
|
56
|
+
* @return
|
57
|
+
*/
|
58
|
+
@Override
|
59
|
+
public int substitute(int glyphId) {
|
60
|
+
int i = coverage.findGlyph(glyphId);
|
61
|
+
if (i > -1) {
|
62
|
+
return glyphId + deltaGlyphID;
|
63
|
+
}
|
64
|
+
return glyphId;
|
65
|
+
}
|
66
|
+
|
67
|
+
}
|