├── sample ├── .gitignore ├── src │ └── main │ │ ├── assets │ │ └── font.ttf │ │ ├── res │ │ ├── mipmap-hdpi │ │ │ └── ic_launcher.png │ │ ├── mipmap-mdpi │ │ │ └── ic_launcher.png │ │ ├── mipmap-xhdpi │ │ │ └── ic_launcher.png │ │ ├── mipmap-xxhdpi │ │ │ └── ic_launcher.png │ │ ├── mipmap-xxxhdpi │ │ │ └── ic_launcher.png │ │ ├── values │ │ │ ├── strings.xml │ │ │ ├── colors.xml │ │ │ ├── dimens.xml │ │ │ └── styles.xml │ │ ├── values-v21 │ │ │ └── styles.xml │ │ ├── values-w820dp │ │ │ └── dimens.xml │ │ ├── drawable │ │ │ └── ic_font_white_24dp.xml │ │ ├── menu │ │ │ └── menu_main.xml │ │ └── layout │ │ │ ├── content_main.xml │ │ │ └── activity_main.xml │ │ ├── AndroidManifest.xml │ │ └── java │ │ └── com │ │ └── jaredrummler │ │ └── truetype │ │ └── sample │ │ └── MainActivity.java ├── build.gradle └── proguard-rules.pro ├── lib-truetypeparser ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ └── java │ └── com │ └── jaredrummler │ └── fontreader │ ├── util │ ├── GlyphTester.java │ └── ScriptContextTester.java │ ├── truetype │ ├── TTFTableOutputStream.java │ ├── TTFOutputStream.java │ ├── TTFGlyphOutputStream.java │ ├── OFDirTabEntry.java │ ├── OFMtxEntry.java │ ├── OFTableName.java │ └── TTFFile.java │ ├── complexscripts │ ├── fonts │ │ ├── GlyphDefinition.java │ │ ├── GlyphCoverageMapping.java │ │ ├── GlyphContextTester.java │ │ ├── GlyphPositioning.java │ │ ├── AdvancedTypographicTableFormatException.java │ │ ├── GlyphClassMapping.java │ │ ├── Positionable.java │ │ ├── GlyphDefinitionSubtable.java │ │ ├── Substitutable.java │ │ ├── GlyphPositioningSubtable.java │ │ ├── GlyphCoverageTable.java │ │ ├── GlyphClassTable.java │ │ └── GlyphPositioningState.java │ ├── bidi │ │ └── BidiConstants.java │ └── scripts │ │ └── DefaultScriptProcessor.java │ ├── io │ ├── ClosedInputStream.java │ ├── StringBuilderWriter.java │ ├── LineIterator.java │ └── Charsets.java │ └── fonts │ ├── GlyphSubstitution.java │ ├── SingleByteEncoding.java │ ├── Glyphs.java │ ├── CMapSegment.java │ ├── Typeface.java │ ├── FontType.java │ ├── FontTriplet.java │ ├── GlyphSubstitutionSubtable.java │ ├── FontUtil.java │ ├── FontMetrics.java │ └── OTFScript.java ├── lib-truetypeparser-light ├── .gitignore ├── build.gradle ├── proguard-rules.pro ├── gradle.properties └── src │ └── main │ ├── AndroidManifest.xml │ └── java │ └── com │ └── jaredrummler │ └── truetypeparser │ ├── TTFTableName.java │ ├── TTFDirTabEntry.java │ ├── FontFileReader.java │ └── TTFFile.java ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── .gitignore ├── settings.gradle ├── gradle.properties ├── README.md ├── gradlew.bat ├── gradle-mvn-push.gradle └── gradlew /sample/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /lib-truetypeparser/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /lib-truetypeparser-light/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /sample/src/main/assets/font.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jaredrummler/TrueTypeParser/HEAD/sample/src/main/assets/font.ttf -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jaredrummler/TrueTypeParser/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /sample/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jaredrummler/TrueTypeParser/HEAD/sample/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /sample/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jaredrummler/TrueTypeParser/HEAD/sample/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /sample/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jaredrummler/TrueTypeParser/HEAD/sample/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /sample/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jaredrummler/TrueTypeParser/HEAD/sample/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /sample/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jaredrummler/TrueTypeParser/HEAD/sample/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Tue Oct 04 11:01:44 PDT 2016 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip 7 | -------------------------------------------------------------------------------- /lib-truetypeparser-light/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | 3 | android { 4 | compileSdkVersion 24 5 | buildToolsVersion "24.0.3" 6 | defaultConfig { 7 | minSdkVersion 4 8 | targetSdkVersion 24 9 | } 10 | lintOptions { 11 | abortOnError false 12 | } 13 | } 14 | 15 | apply from: '../gradle-mvn-push.gradle' 16 | 17 | afterEvaluate { 18 | androidJavadocs.classpath += project.android.libraryVariants.toList().first().javaCompile.classpath 19 | } -------------------------------------------------------------------------------- /lib-truetypeparser/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | 3 | android { 4 | compileSdkVersion 24 5 | buildToolsVersion "24.0.3" 6 | 7 | defaultConfig { 8 | minSdkVersion 7 9 | targetSdkVersion 24 10 | } 11 | 12 | lintOptions { 13 | abortOnError false 14 | } 15 | } 16 | 17 | apply from: '../gradle-mvn-push.gradle' 18 | 19 | afterEvaluate { 20 | androidJavadocs.classpath += project.android.libraryVariants.toList().first().javaCompile.classpath 21 | } 22 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ########### Specifies intentionally untracked files to ignore ########### 2 | 3 | ### Gradle 4 | .gradle/ 5 | build/ 6 | 7 | ### IntelliJ IDEA 8 | /.idea 9 | *.iml 10 | *.iws 11 | captures/ 12 | .navigation/ 13 | local.properties 14 | bin/ 15 | gen/ 16 | out/ 17 | *.apk 18 | *.ap_ 19 | 20 | ### Android 21 | *.jks 22 | *.dex 23 | 24 | ### Java 25 | *.class 26 | hs_err_pid* 27 | 28 | ### Windows 29 | Desktop.ini 30 | Thumbs.db 31 | ehthumbs.db 32 | 33 | ### OSX 34 | .DS_Store 35 | 36 | ### Linux 37 | *~ 38 | .fuse_hidden* 39 | .directory 40 | .Trash-* 41 | 42 | ### Logs 43 | *.log 44 | 45 | ### Crashlytics 46 | crashlytics.properties 47 | fabric.properties -------------------------------------------------------------------------------- /sample/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 24 5 | buildToolsVersion "24.0.3" 6 | 7 | defaultConfig { 8 | applicationId "com.jaredrummler.truetype.sample" 9 | minSdkVersion 14 10 | targetSdkVersion 24 11 | versionCode 1 12 | versionName "1.0" 13 | } 14 | buildTypes { 15 | release { 16 | minifyEnabled false 17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 18 | } 19 | } 20 | } 21 | 22 | dependencies { 23 | compile 'com.android.support:appcompat-v7:24.2.1' 24 | compile 'com.android.support:design:24.2.1' 25 | compile project(':lib-truetypeparser') 26 | } 27 | -------------------------------------------------------------------------------- /sample/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in C:\android-sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -------------------------------------------------------------------------------- /lib-truetypeparser/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in C:\android-sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -------------------------------------------------------------------------------- /lib-truetypeparser-light/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in C:\android-sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 Jared Rummler 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | include ':sample', ':lib-truetypeparser', ':lib-truetypeparser-light' 19 | -------------------------------------------------------------------------------- /lib-truetypeparser-light/gradle.properties: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2016 Jared Rummler 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | # 17 | 18 | VERSION_NAME=1.0.0 19 | VERSION_CODE=0 20 | POM_ARTIFACT_ID=truetypeparser-light -------------------------------------------------------------------------------- /sample/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 17 | 18 | 19 | TrueType Parser 20 | Settings 21 | 22 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | VERSION_NAME=1.0.0 2 | VERSION_CODE=0 3 | GROUP=com.jaredrummler 4 | 5 | POM_NAME=True Type Parser 6 | POM_ARTIFACT_ID=truetypeparser 7 | POM_PACKAGING=aar 8 | 9 | POM_DESCRIPTION=TTF and OTF font parser 10 | POM_URL=https://github.com/jaredrummler/TrueTypeParser 11 | POM_SCM_URL=https://github.com/jaredrummler/TrueTypeParser 12 | POM_SCM_CONNECTION=scm:git@github.com:jaredrummler/TrueTypeParser.git 13 | POM_SCM_DEV_CONNECTION=scm:git@github.com:jaredrummler/TrueTypeParser.git 14 | POM_LICENCE_NAME=The Apache Software License, Version 2.0 15 | POM_LICENCE_URL=http://www.apache.org/licenses/LICENSE-2.0.txt 16 | POM_LICENCE_DIST=repo 17 | POM_DEVELOPER_ID=jaredrummler 18 | POM_DEVELOPER_NAME=Jared Rummler 19 | 20 | SNAPSHOT_REPOSITORY_URL=https://oss.sonatype.org/content/repositories/snapshots 21 | RELEASE_REPOSITORY_URL=https://oss.sonatype.org/service/local/staging/deploy/maven2 22 | -------------------------------------------------------------------------------- /lib-truetypeparser/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 17 | 18 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /lib-truetypeparser-light/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 17 | 18 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /sample/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 18 | 19 | 20 | #3F51B5 21 | #303F9F 22 | #FF4081 23 | 24 | -------------------------------------------------------------------------------- /sample/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 17 | 18 | 19 | 20 | 16dp 21 | 16dp 22 | 16dp 23 | 24 | -------------------------------------------------------------------------------- /sample/src/main/res/values-v21/styles.xml: -------------------------------------------------------------------------------- 1 | 17 | 18 | > 19 | 20 | 26 | 27 | -------------------------------------------------------------------------------- /sample/src/main/res/values-w820dp/dimens.xml: -------------------------------------------------------------------------------- 1 | 17 | 18 | 19 | 22 | 64dp 23 | 24 | -------------------------------------------------------------------------------- /sample/src/main/res/drawable/ic_font_white_24dp.xml: -------------------------------------------------------------------------------- 1 | 17 | 18 | 23 | 26 | 27 | -------------------------------------------------------------------------------- /sample/src/main/res/menu/menu_main.xml: -------------------------------------------------------------------------------- 1 | 17 | 18 | 22 | 27 | 28 | -------------------------------------------------------------------------------- /lib-truetypeparser/src/main/java/com/jaredrummler/fontreader/util/GlyphTester.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 Jared Rummler 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package com.jaredrummler.fontreader.util; 19 | 20 | /** 21 | *

Interface for testing glyph properties according to glyph identifier.

22 | * 23 | *

This work was originally authored by Glenn Adams (gadams@apache.org).

24 | */ 25 | public interface GlyphTester { 26 | 27 | /** 28 | * Perform a test on a glyph identifier. 29 | * 30 | * @param gi 31 | * glyph identififer 32 | * @param flags 33 | * that apply to lookup in scope 34 | * @return true if test is satisfied 35 | */ 36 | boolean test(int gi, int flags); 37 | 38 | } 39 | -------------------------------------------------------------------------------- /lib-truetypeparser/src/main/java/com/jaredrummler/fontreader/truetype/TTFTableOutputStream.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 Jared Rummler 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package com.jaredrummler.fontreader.truetype; 19 | 20 | import java.io.IOException; 21 | 22 | /** 23 | * An interface for writing a TrueType table to an output stream. 24 | */ 25 | public interface TTFTableOutputStream { 26 | 27 | /** 28 | * Streams a table from the given byte array. 29 | * 30 | * @param ttfData 31 | * the source of the table to stream from 32 | * @param offset 33 | * the position in the byte array where the table starts 34 | * @param size 35 | * the size of the table in bytes 36 | */ 37 | void streamTable(byte[] ttfData, int offset, int size) throws IOException; 38 | } 39 | -------------------------------------------------------------------------------- /lib-truetypeparser/src/main/java/com/jaredrummler/fontreader/complexscripts/fonts/GlyphDefinition.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 Jared Rummler 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package com.jaredrummler.fontreader.complexscripts.fonts; 19 | 20 | /** 21 | *

The GlyphDefinition interface is a marker interface implemented by a glyph definition 22 | * subtable.

23 | * 24 | *

This work was originally authored by Glenn Adams (gadams@apache.org).

25 | */ 26 | public interface GlyphDefinition { 27 | 28 | /** 29 | * Determine if some definition is available for a specific glyph. 30 | * 31 | * @param gi 32 | * a glyph index 33 | * @return true if some (unspecified) definition is available for the specified glyph 34 | */ 35 | boolean hasDefinition(int gi); 36 | 37 | } 38 | -------------------------------------------------------------------------------- /lib-truetypeparser/src/main/java/com/jaredrummler/fontreader/util/ScriptContextTester.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 Jared Rummler 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package com.jaredrummler.fontreader.util; 19 | 20 | import com.jaredrummler.fontreader.complexscripts.fonts.GlyphContextTester; 21 | 22 | /** 23 | *

Interface for providing script specific context testers.

24 | * 25 | *

This work was originally authored by Glenn Adams (gadams@apache.org).

26 | */ 27 | public interface ScriptContextTester { 28 | 29 | /** 30 | * Obtain a glyph context tester for the specified feature. 31 | * 32 | * @param feature 33 | * a feature identifier 34 | * @return a glyph context tester or null if none available for the specified feature 35 | */ 36 | GlyphContextTester getTester(String feature); 37 | 38 | } 39 | -------------------------------------------------------------------------------- /sample/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 17 | 18 | 19 | 20 | 21 | 27 | 28 | 32 | 33 |