Skip to content

Commit 675be78

Browse files
committed
Updates to Apr. 16th (abd064d)
1 parent d0342d8 commit 675be78

File tree

67 files changed

+1278
-807
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+1278
-807
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ lib/
1515
res/
1616
tmp/
1717

18+
# Test output directory
19+
target/
20+
1821
# Local configuration file (sdk path, etc)
1922
local.properties
2023

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ buildscript {
66
jcenter()
77
}
88
dependencies {
9-
classpath 'com.android.tools.build:gradle:2.2.3'
9+
classpath 'com.android.tools.build:gradle:2.3.0'
1010
}
1111
}
1212

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ VERSION_CODE=1
1919
ANDROID_BUILD_MIN_SDK_VERSION=9
2020
ANDROID_BUILD_TARGET_SDK_VERSION=21
2121
ANDROID_BUILD_SDK_VERSION=21
22-
ANDROID_BUILD_TOOLS_VERSION=24.0.3
22+
ANDROID_BUILD_TOOLS_VERSION=25.0.2
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
#Fri Oct 21 00:40:32 CDT 2016
1+
#Fri Mar 03 19:16:32 CST 2017
22
distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip

library/src/main/java/com/tom_roush/fontbox/afm/AFMParser.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,14 @@
1616
*/
1717
package com.tom_roush.fontbox.afm;
1818

19+
import com.tom_roush.fontbox.util.BoundingBox;
20+
1921
import java.io.File;
2022
import java.io.FileInputStream;
2123
import java.io.IOException;
2224
import java.io.InputStream;
2325
import java.util.StringTokenizer;
2426

25-
import com.tom_roush.fontbox.util.BoundingBox;
26-
2727
/**
2828
* This class is used to parse AFM(Adobe Font Metrics) documents.
2929
*
@@ -674,7 +674,7 @@ else if( KERN_PAIR_KPY.equals( cmd ) )
674674
*
675675
* @throws IOException If the string is in an invalid format.
676676
*/
677-
private static String hexToString( String hexString ) throws IOException
677+
private String hexToString( String hexString ) throws IOException
678678
{
679679
if( hexString.length() < 2 )
680680
{
@@ -917,7 +917,7 @@ else if( nextCommand.equals( CHARMETRICS_L ) )
917917
*
918918
* @throws IOException If the semicolon is missing.
919919
*/
920-
private static void verifySemicolon( StringTokenizer tokenizer ) throws IOException
920+
private void verifySemicolon( StringTokenizer tokenizer ) throws IOException
921921
{
922922
if( tokenizer.hasMoreTokens() )
923923
{
@@ -1033,7 +1033,7 @@ private String readString() throws IOException
10331033
*
10341034
* @return true If the character is whitespace as defined by the AFM spec.
10351035
*/
1036-
private static boolean isEOL( int character )
1036+
private boolean isEOL( int character )
10371037
{
10381038
return character == 0x0D ||
10391039
character == 0x0A;
@@ -1046,7 +1046,7 @@ private static boolean isEOL( int character )
10461046
*
10471047
* @return true If the character is whitespace as defined by the AFM spec.
10481048
*/
1049-
private static boolean isWhitespace( int character )
1049+
private boolean isWhitespace( int character )
10501050
{
10511051
return character == ' ' ||
10521052
character == '\t' ||

library/src/main/java/com/tom_roush/fontbox/cff/Type2CharStringParser.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ else if (b0 == 19 || b0 == 20)
207207
return new CharStringCommand(b0);
208208
}
209209

210-
private static Integer readNumber(int b0, DataInput input) throws IOException
210+
private Integer readNumber(int b0, DataInput input) throws IOException
211211
{
212212

213213
if (b0 == 28)

library/src/main/java/com/tom_roush/fontbox/cmap/CMap.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ else if (range.getStart().length < match.getStart().length)
169169
/**
170170
* Returns an int given a List<Byte>
171171
*/
172-
private static int toInt(List<Byte> data)
172+
private int toInt(List<Byte> data)
173173
{
174174
int code = 0;
175175
for (byte b : data)
@@ -210,7 +210,7 @@ public int toCID(int code)
210210
* @param length The length of the data we are getting.
211211
* @return the resulting integer
212212
*/
213-
private static int getCodeFromArray( byte[] data, int offset, int length )
213+
private int getCodeFromArray( byte[] data, int offset, int length )
214214
{
215215
int code = 0;
216216
for( int i=0; i<length; i++ )

library/src/main/java/com/tom_roush/fontbox/cmap/CMapParser.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
*/
1717
package com.tom_roush.fontbox.cmap;
1818

19+
import com.tom_roush.pdfbox.util.PDFBoxResourceLoader;
20+
1921
import java.io.File;
2022
import java.io.FileInputStream;
2123
import java.io.IOException;
@@ -27,8 +29,6 @@
2729
import java.util.List;
2830
import java.util.Map;
2931

30-
import com.tom_roush.pdfbox.util.PDFBoxResourceLoader;
31-
3232
/**
3333
* Parses a CMap stream.
3434
*
@@ -638,7 +638,7 @@ else if (isWhitespaceOrEOF(theNextByte))
638638
return retval;
639639
}
640640

641-
private static void readUntilEndOfLine(InputStream is, StringBuffer buf) throws IOException
641+
private void readUntilEndOfLine(InputStream is, StringBuffer buf) throws IOException
642642
{
643643
int nextByte = is.read();
644644
while (nextByte != -1 && nextByte != 0x0D && nextByte != 0x0A)
@@ -648,13 +648,13 @@ private static void readUntilEndOfLine(InputStream is, StringBuffer buf) throws
648648
}
649649
}
650650

651-
private static boolean isWhitespaceOrEOF(int aByte)
651+
private boolean isWhitespaceOrEOF(int aByte)
652652
{
653653
return aByte == -1 || aByte == 0x20 || aByte == 0x0D || aByte == 0x0A;
654654
}
655655

656656
/** Is this a standard PDF delimiter character? */
657-
private static boolean isDelimiter(int aByte)
657+
private boolean isDelimiter(int aByte)
658658
{
659659
switch (aByte)
660660
{
@@ -692,7 +692,7 @@ private void increment(byte[] data, int position)
692692
}
693693
}
694694

695-
private static int createIntFromBytes(byte[] bytes)
695+
private int createIntFromBytes(byte[] bytes)
696696
{
697697
int intValue = (bytes[0] + 256) % 256;
698698
if (bytes.length == 2)
@@ -703,7 +703,7 @@ private static int createIntFromBytes(byte[] bytes)
703703
return intValue;
704704
}
705705

706-
private static String createStringFromBytes(byte[] bytes) throws IOException
706+
private String createStringFromBytes(byte[] bytes) throws IOException
707707
{
708708
String retval;
709709
if (bytes.length == 1)
@@ -717,7 +717,7 @@ private static String createStringFromBytes(byte[] bytes) throws IOException
717717
return retval;
718718
}
719719

720-
private static int compare(byte[] first, byte[] second)
720+
private int compare(byte[] first, byte[] second)
721721
{
722722
int retval = 1;
723723
int firstLength = first.length;

library/src/main/java/com/tom_roush/fontbox/ttf/MemoryTTFDataStream.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
* @author Ben Litchfield
2929
*
3030
*/
31-
public class MemoryTTFDataStream extends TTFDataStream
31+
class MemoryTTFDataStream extends TTFDataStream
3232
{
3333
private byte[] data = null;
3434
private int currentPosition = 0;
@@ -38,7 +38,7 @@ public class MemoryTTFDataStream extends TTFDataStream
3838
* @param is The stream of read from.
3939
* @throws IOException If an error occurs while reading from the stream.
4040
*/
41-
public MemoryTTFDataStream( InputStream is ) throws IOException
41+
MemoryTTFDataStream( InputStream is ) throws IOException
4242
{
4343
try
4444
{
@@ -60,8 +60,6 @@ public MemoryTTFDataStream( InputStream is ) throws IOException
6060
}
6161
}
6262

63-
64-
6563
/**
6664
* Read an unsigned byte.
6765
* @return An unsigned byte.

library/src/main/java/com/tom_roush/fontbox/ttf/OTFParser.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
/**
2525
* OpenType font file parser.
2626
*/
27-
public class OTFParser extends TTFParser
27+
public final class OTFParser extends TTFParser
2828
{
2929
/**
3030
* Constructor.
@@ -74,13 +74,13 @@ public OpenTypeFont parse(InputStream data) throws IOException
7474
}
7575

7676
@Override
77-
public OpenTypeFont parse(TTFDataStream raf) throws IOException
77+
protected OpenTypeFont parse(TTFDataStream raf) throws IOException
7878
{
7979
return (OpenTypeFont)super.parse(raf);
8080
}
8181

8282
@Override
83-
protected OpenTypeFont newFont(TTFDataStream raf)
83+
OpenTypeFont newFont(TTFDataStream raf)
8484
{
8585
return new OpenTypeFont(raf);
8686
}

library/src/main/java/com/tom_roush/fontbox/ttf/RAFDataStream.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
*
2929
* @author Ben Litchfield
3030
*/
31-
public class RAFDataStream extends TTFDataStream
31+
class RAFDataStream extends TTFDataStream
3232
{
3333
private RandomAccessFile raf = null;
3434
private File ttfFile = null;
@@ -43,7 +43,7 @@ public class RAFDataStream extends TTFDataStream
4343
*
4444
* @see RandomAccessFile#RandomAccessFile( String, String )
4545
*/
46-
public RAFDataStream(String name, String mode) throws FileNotFoundException
46+
RAFDataStream(String name, String mode) throws FileNotFoundException
4747
{
4848
this( new File( name ), mode );
4949
}
@@ -58,7 +58,7 @@ public RAFDataStream(String name, String mode) throws FileNotFoundException
5858
*
5959
* @see RandomAccessFile#RandomAccessFile( File, String )
6060
*/
61-
public RAFDataStream(File file, String mode) throws FileNotFoundException
61+
RAFDataStream(File file, String mode) throws FileNotFoundException
6262
{
6363
raf = new RandomAccessFile( file, mode );
6464
ttfFile = file;
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one or more
3+
* contributor license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright ownership.
5+
* The ASF licenses this file to You under the Apache License, Version 2.0
6+
* (the "License"); you may not use this file except in compliance with
7+
* the License. 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 com.tom_roush.fontbox.ttf;
19+
20+
import java.io.IOException;
21+
import java.io.InputStream;
22+
23+
/**
24+
* A wrapper for a TTF stream inside a TTC file, does not close the underlying shared stream.
25+
*
26+
* @author John Hewson
27+
*/
28+
class TTCDataStream extends TTFDataStream
29+
{
30+
private final TTFDataStream stream;
31+
32+
TTCDataStream(TTFDataStream stream)
33+
{
34+
this.stream = stream;
35+
}
36+
37+
@Override
38+
public int read() throws IOException
39+
{
40+
return stream.read();
41+
}
42+
43+
@Override
44+
public long readLong() throws IOException
45+
{
46+
return stream.readLong();
47+
}
48+
49+
@Override
50+
public int readUnsignedShort() throws IOException
51+
{
52+
return stream.readUnsignedShort();
53+
}
54+
55+
@Override
56+
public short readSignedShort() throws IOException
57+
{
58+
return stream.readSignedShort();
59+
}
60+
61+
@Override
62+
public void close() throws IOException
63+
{
64+
// don't close the underlying stream, as it is shared by all fonts from the same TTC
65+
// TrueTypeCollection.close() must be called instead
66+
}
67+
68+
@Override
69+
public void seek(long pos) throws IOException
70+
{
71+
stream.seek(pos);
72+
}
73+
74+
@Override
75+
public int read(byte[] b, int off, int len) throws IOException
76+
{
77+
return stream.read(b, off, len);
78+
}
79+
80+
@Override
81+
public long getCurrentPosition() throws IOException
82+
{
83+
return stream.getCurrentPosition();
84+
}
85+
86+
@Override
87+
public InputStream getOriginalData() throws IOException
88+
{
89+
return stream.getOriginalData();
90+
}
91+
}

library/src/main/java/com/tom_roush/fontbox/ttf/TTFDataStream.java

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,11 @@
2929
*
3030
* @author Ben Litchfield
3131
*/
32-
public abstract class TTFDataStream implements Closeable
32+
abstract class TTFDataStream implements Closeable
3333
{
34+
TTFDataStream()
35+
{
36+
}
3437

3538
/**
3639
* Read a 16.16 fixed value, where the first 16 bits are the decimal and the last 16 bits are the fraction.
@@ -203,6 +206,15 @@ public Calendar readInternationalDate() throws IOException
203206
return cal;
204207
}
205208

209+
/**
210+
* Reads a tag, an arrau of four uint8s used to identify a script, language system, feature,
211+
* or baseline.
212+
*/
213+
public String readTag() throws IOException
214+
{
215+
return new String(read(4), "US-ASCII");
216+
}
217+
206218
/**
207219
* Close the underlying resources.
208220
*

0 commit comments

Comments
 (0)