Version 2.7 is out, get it
here!
This update contains some bug fixes as well as two new features for the library's text rendering: setting the
anchor point for rendering (so you can tell it to render text above, to the left, to the right and below etc a certain point), and alignment controls (so you can now have centered or
right-aligned text). It also fixes a minor memory leak when dispose() was not called on DrawableStrings before garbage collection.
2.7 should be a drop-in replacement for 2.6, with one minor exception for modders: if you're using font rendering in Kotlin with named parameters,
color has been renamed to
baseColor. Any existing compiled code should continue to work, but if you're using
color as a named parameter then your IDE will scream at you until you change it.
There have also been some improvements to the
Javadoc, especially regarding font rendering. Let me know if anything is still confusing.
Full changelog:
2.7 (October 22, 2021)
========================
Fixed links to online Starsector API in javadoc.zip
Updated bundled libraries:
- kotlin-stdlib: v1.4.31 -> v1.5.31
- kotlinx-coroutines: v1.4.3 -> v1.5.2
- jetbrains-annotations: v20.1.0 -> 22.0.0
Changes to CombatUtils:
- Fixed a bug where ships spawned by spawnShipOrWingDirectly() would
report the wrong fleet side in some circumstances
Changes to LazyFont:
- Fixed log spam with some whitespace being considered unsupported characters
Changes to LazyFont.DrawableString:
- Fixed minor memory leak when dispose() is not called before GC
- Added TextAlignment, setAlignment(), and getAlignment(). TextAlignment
controls whether text is drawn left-aligned (the default), right-aligned,
or centered
- Added TextAnchor, setAnchor(), and getAnchor(). TextAnchor controls the
origin when drawing text; for example, TextAnchor.TOP_LEFT (the default)
will mean draw() will start drawing at the top left, so the text will
appear below and to the right of the position passed into draw()
- Added setBaseColor() and getBaseColor() (replace setColor()/getColor())
- Added isRebuildNeeded() and triggerRebuildIfNeeded() (unnecessary 99% of
the time as rebuilding happens automatically, but useful in fringe cases)
- Cleaned up some out-of-date documentation
Deprecated in LazyFont.DrawableString:
- Deprecated setColor() and getColor(), as users were assuming they set the
color of the next append. Added setBaseColor() and getBaseColor() as
replacements that better convey what these methods do (set/get the color of
all text that _doesn't_ have a color argument passed in)