Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
[Unreleased]
- Nothing here so far.
[1.4.1]
- BREAKING CHANGE: The dependency on libGDX has been updated to 1.14.0. This precipitated another breaking change.
- BREAKING CHANGE: TypingLabel#getOriginalText() now returns a CharArray, not a libGDX StringBuilder, because libGDX no longer contains that class.
- The test now uses LWJGL3 instead of LWJGL2, which allows it to run on newer MacOS hardware.
- The RegExodus dependency has updated to 0.1.20, which shouldn't have any major breaking changes, just feature additions and fixes for some platforms (RoboVM and GWT). It also should be a slightly smaller dependency.
- For building Typing-Label, Gradle was updated to 9.2.1, which is allows building with Java 25 if that's all you have on your machine.

[1.4.0]
- BREAKING CHANGE: Added support for multiple TypingListeners in TypingLabel. Methods "getTypingListener" and "getTypingListeners" were replaced by "setTypingListener" and "addTypingListener".
- Added If Conditionals! {IF=GENDER;f=She;m=He;t=Them;Unknown} -- See details in the wiki.
- Updated Regexodus dependency for GWT. If you use GWT and inherit Regexodus in your project, follow the installation instructions again, as some of them have changed (namely the `inherits` line).
- Updated RegExodus dependency for GWT. If you use GWT and inherit RegExodus in your project, follow the installation instructions again, as some of them have changed (namely the `inherits` line).
- Fixed color tags being applied to the incorrect glyph indices. Thanks @tommyettinger!
- Fixed alpha not being applied to glyphs not affected by color-altering tokens. Thanks @tommyettinger!

Expand Down
47 changes: 40 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Open _build.gradle_ in project root and add this to the _ext_ section under _all

```groovy
typingLabelVersion = '1.4.0'
regExodusVersion = '0.1.13' // Only if you're using HTML / GWT
regExodusVersion = '0.1.20' // Only if you're using HTML / GWT
```

#### Core module
Expand Down Expand Up @@ -52,12 +52,45 @@ api "com.rafaskoberg.gdx:typing-label:$typingLabelVersion:sources"
Check the Wiki:
- [Usage examples](https://github.com/rafaskb/typing-label/wiki/Examples)
- [Tokens](https://github.com/rafaskb/typing-label/wiki/Tokens)
- [Fine tuning](https://github.com/rafaskb/typing-label/wiki/Fine-Tuning)
- [Fine-tuning](https://github.com/rafaskb/typing-label/wiki/Fine-Tuning)
- [Custom Effects](https://github.com/rafaskb/typing-label/wiki/Tokens#custom-effects)

## textratypist and SDF / MSDF Support
_Multi-channel Signed Distance Field_ fonts allow you to prepare and load just one font file and render it in any scale you want, while mantaining the quality and cripsness of the original texture, as if you were working directly with vectors.

Since TypingLabel aims to be a replacement for regular scene2d.ui Labels though, that means it relies on BitmapFonts, which have a specific size and don't work well with scaling.

If you're using SDF fonts in your project and want TypingLabel features, then make sure to take a look at [Textramode](https://github.com/tommyettinger/textramode) and [Textratypist](https://github.com/tommyettinger/textramode) libraries by [Tommy Ettinger](https://github.com/tommyettinger). They support SDF and MSDF fonts, have much of the TypingLabel features, as well extended markup such as bold and oblique, and much more.
_Signed Distance Field_ and _Multi-channel Signed Distance Field_ fonts allow you to prepare and load just one font file
and render it in any scale you want, while maintaining the quality and crispness of the original texture, as if you were
working directly with vectors.

Since TypingLabel aims to be a replacement for regular scene2d.ui Labels though, that means it relies on BitmapFonts,
which have a specific size and don't work well with scaling. There is a DistanceFieldFont class in libGDX that extends
BitmapFont, but it flushes its Batch a lot more than a BitmapFont does, and isn't exactly easy to use.

If you're using SDF or MSDF fonts in your project and want TypingLabel features, then make sure to take a look at the
[Textratypist](https://github.com/tommyettinger/textratypist) library by
[Tommy Ettinger](https://github.com/tommyettinger). It supports SDF and MSDF fonts, has most of the TypingLabel
features, offers extended markup such as bold and oblique, and much more.

(Tommy Ettinger has hijacked the README.md at this point.)

Other features in TextraTypist include inline images such as emoji, click-able links that go to a URL, click-able words
that trigger an event via TypingListener, rotating glyphs in-place (with various effects that use this),
stretching/squashing individual glyphs (also used by various effects), named colors that can mix and alter their parts
(like `darker dull blue green`), no usage of reflection except what Skin uses (useful for Graal Native Images), various
ways to adjust fonts to force monospace, change line-height, increase or decrease glyph width, experimental support for
justifying text... It goes on for a while.

However, TextraTypist isn't as drop-in compatible as Typing-Label with scene2d.ui support! The `TypingLabel` in this
library extends `Label` from scene2d.ui, while the one in TextraTypist does not, and in fact there's a whole duplicate
set of scene2d.ui widgets that use TextraTypist's `Font` class instead of `BitmapFont`. These aren't always necessary to
use, but they are needed if you need most of the mentioned TextraTypist features, like how a TextraSelectBox can have
emoji icons in its text rows.

A few other features are present in Typing-Label but are absent from TextraTypist. TextraTypist uses both square braces
and curly brackets for different types of markup, so it doesn't have an easy way to swap out an effect like `{RAINBOW}`
and make it use a different syntax, like `<<RAINBOW>>`. Typing-Label can do this! TextraTypist can, at most, use the
alternate syntax `[-RAINBOW]` to be compatible with I18N properties files.

When gdx-liftoff added effects to warning messages to draw attention to them, it added Typing-Label as a dependency, and
it applied smoothly in-place. When gdx-liftoff updated to libGDX 1.14.0, Typing-Label wasn't compatible immediately, so
the dependency switched to TextraTypist -- because TextraTypist ~~stole~~ built upon mostly the same code as
Typing-Label, the needed changes were small. Typing-Label should be compatible with libGDX 1.14.0 as of now (at least
via JitPack, and probably via a Maven Central release), so this isn't going to be a problem in the future.
51 changes: 32 additions & 19 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,65 +2,78 @@ buildscript {
repositories {
mavenLocal()
mavenCentral()
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
maven { url = "https://oss.sonatype.org/content/repositories/snapshots/" }
gradlePluginPortal()
}
dependencies {
classpath 'com.vanniktech:gradle-maven-publish-plugin:0.17.0'
classpath 'com.vanniktech:gradle-maven-publish-plugin:0.35.0'
}
}

apply plugin: 'java-library'
apply plugin: 'com.vanniktech.maven.publish'
apply plugin: 'idea'

sourceCompatibility = 1.7
java.sourceCompatibility = 1.8

def projectName = 'typing-label'
version "$VERSION_NAME"
group 'com.rafaskoberg.gdx'
def projectName = "typing-label"
version = "$VERSION_NAME"
group = "com.rafaskoberg.gdx"

[compileJava, compileTestJava, javadoc]*.options*.encoding = 'UTF-8'

// Disable JDK 8's doclint
// http://blog.joda.org/2014/02/turning-off-doclint-in-jdk-8-javadoc.html
if (JavaVersion.current().isJava8Compatible()) {
allprojects {
tasks.withType(Javadoc) {
// The -quiet is because of some sort of weird JDK JavaCompiler bug:
// https://discuss.gradle.org/t/passing-arguments-to-compiler-and-javadoc/1661
options.addStringOption('Xdoclint:none,-missing', '-quiet')
tasks.withType(Javadoc).tap {
configureEach {
// The -quiet is because of some sort of weird JDK JavaCompiler bug:
// https://discuss.gradle.org/t/passing-arguments-to-compiler-and-javadoc/1661
options.addStringOption('Xdoclint:none,-missing', '-quiet')
}
}
}
}

if(JavaVersion.current().isJava9Compatible()) {
allprojects {
tasks.withType(JavaCompile) {
options.release.set(7)
tasks.withType(JavaCompile).tap {
configureEach {
options.release.set(8)
}
}
}
}

sourceSets.test.resources.srcDirs = [ file('src/test/resources').path ]

tasks.withType(AbstractTestTask).configureEach {
failOnNoDiscoveredTests = false
}

idea.module.excludeDirs += [file("docs/")]

javadoc.destinationDir = file('docs/apidocs')

jar {
duplicatesStrategy(DuplicatesStrategy.EXCLUDE)
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
archiveBaseName.set(projectName)
manifest {
attributes 'Implementation-Title': projectName, 'Implementation-Version': archiveVersion
attributes 'Implementation-Title': projectName, 'Implementation-Version': archiveVersion, 'Enable-Native-Access': 'ALL-UNNAMED'
}
}

repositories {
mavenLocal()
mavenCentral()
maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' }
maven { url = 'https://central.sonatype.com/repository/maven-snapshots/' }
}

dependencies {
api group: 'com.badlogicgames.gdx', name: 'gdx', version: gdxVersion
api group: 'com.github.tommyettinger', name: 'regexodus', version: regExodusVersion
testImplementation group: 'com.badlogicgames.gdx', name: 'gdx-backend-lwjgl', version: gdxVersion
testImplementation group: 'com.badlogicgames.gdx', name: 'gdx-platform', version: gdxVersion, classifier: 'natives-desktop'
api "com.badlogicgames.gdx:gdx:$gdxVersion"
api "com.github.tommyettinger:regexodus:$regExodusVersion"

testImplementation "com.badlogicgames.gdx:gdx-backend-lwjgl3:$gdxVersion"
testImplementation "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop"
}
11 changes: 9 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ org.gradle.daemon=true
org.gradle.jvmargs=-Xms128m -Xmx512m -Dfile.encoding=UTF-8 -Dconsole.encoding=UTF-8
org.gradle.configureondemand=false

gdxVersion=1.11.0
regExodusVersion=0.1.15
gdxVersion=1.14.0
regExodusVersion=0.1.20

GROUP=com.rafaskoberg.gdx
POM_ARTIFACT_ID=typing-label
Expand All @@ -26,3 +26,10 @@ POM_DEVELOPER_ID=rafaskb
POM_DEVELOPER_NAME=Rafa Skoberg
POM_DEVELOPER_URL=https://github.com/rafaskb/
POM_DEVELOPER_EMAIL=rafa.skoberg@gmail.com

SONATYPE_HOST=CENTRAL_PORTAL
# This next line might need changing if JitPack.io can't build a released version. It might not...
# It must be true when running Gradle tasks to publish this project to Maven Central.
# JitPack should be able to avoid trying to sign the release now, though.
# Any attempt to sign JARs by JitPack will fail because it doesn't have any secrets.
RELEASE_SIGNING_ENABLED=true
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
4 changes: 3 additions & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-9.2.1-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading