Skip to content

Commit

Permalink
2.5b release
Browse files Browse the repository at this point in the history
  • Loading branch information
LazyWizard committed Jan 20, 2021
1 parent 269e891 commit 0322b50
Show file tree
Hide file tree
Showing 7 changed files with 68 additions and 15 deletions.
4 changes: 4 additions & 0 deletions docs/index-files/index-6.html
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,10 @@ <h2 class="title">G</h2>
<dd>
<div class="block">Returns a reference to the <a href="../org/lazywizard/lazylib/ui/LazyFont.html" title="class in org.lazywizard.lazylib.ui"><code>LazyFont</code></a> used to create this <a href="../org/lazywizard/lazylib/ui/LazyFont.DrawableString.html" title="class in org.lazywizard.lazylib.ui"><code>LazyFont.DrawableString</code></a>.</div>
</dd>
<dt><span class="memberNameLink"><a href="../org/lazywizard/lazylib/ui/LazyFont.html#getFontName--">getFontName()</a></span> - Method in class <a href="../org/lazywizard/lazylib/ui/LazyFont.html" title="class in org.lazywizard.lazylib.ui">LazyFont</a></dt>
<dd>
<div class="block">Returns the name of the font, as defined in its .fnt file.</div>
</dd>
<dt><span class="memberNameLink"><a href="../org/lazywizard/lazylib/ui/LazyFont.DrawableString.html#getFontSize--">getFontSize()</a></span> - Method in class <a href="../org/lazywizard/lazylib/ui/LazyFont.DrawableString.html" title="class in org.lazywizard.lazylib.ui">LazyFont.DrawableString</a></dt>
<dd>
<div class="block">Returns the font size text will be drawn at.</div>
Expand Down
37 changes: 30 additions & 7 deletions docs/org/lazywizard/lazylib/ui/LazyFont.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
catch(err) {
}
//-->
var methods = {"i0":10,"i1":10,"i2":10,"i3":10,"i4":10,"i5":10,"i6":10,"i7":42,"i8":10,"i9":10,"i10":10,"i11":10,"i12":10,"i13":9,"i14":10,"i15":10,"i16":10};
var methods = {"i0":10,"i1":10,"i2":10,"i3":10,"i4":10,"i5":10,"i6":10,"i7":42,"i8":10,"i9":10,"i10":10,"i11":10,"i12":10,"i13":10,"i14":9,"i15":10,"i16":10,"i17":10};
var tabs = {65535:["t0","All Methods"],1:["t1","Static Methods"],2:["t2","Instance Methods"],8:["t4","Concrete Methods"],32:["t6","Deprecated Methods"]};
var altColor = "altColor";
var rowColor = "rowColor";
Expand Down Expand Up @@ -330,30 +330,36 @@ <h3>Method Summary</h3>
</td>
</tr>
<tr id="i10" class="altColor">
<td class="colFirst"><code>@NotNull <a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/lazywizard/lazylib/ui/LazyFont.html#getFontName--">getFontName</a></span>()</code>
<div class="block">Returns the name of the font, as defined in its .fnt file.</div>
</td>
</tr>
<tr id="i11" class="rowColor">
<td class="colFirst"><code>float</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/lazywizard/lazylib/ui/LazyFont.html#getTextureHeight--">getTextureHeight</a></span>()</code>
<div class="block">Returns the height of the font's underlying texture atlas.</div>
</td>
</tr>
<tr id="i11" class="rowColor">
<tr id="i12" class="altColor">
<td class="colFirst"><code>int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/lazywizard/lazylib/ui/LazyFont.html#getTextureId--">getTextureId</a></span>()</code>
<div class="block">Returns the ID of the font's underlying texture atlas.</div>
</td>
</tr>
<tr id="i12" class="altColor">
<tr id="i13" class="rowColor">
<td class="colFirst"><code>float</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/lazywizard/lazylib/ui/LazyFont.html#getTextureWidth--">getTextureWidth</a></span>()</code>
<div class="block">Returns the width of the font's underlying texture atlas.</div>
</td>
</tr>
<tr id="i13" class="rowColor">
<tr id="i14" class="altColor">
<td class="colFirst"><code>static @NotNull <a href="../../../../org/lazywizard/lazylib/ui/LazyFont.html" title="class in org.lazywizard.lazylib.ui">LazyFont</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/lazywizard/lazylib/ui/LazyFont.html#loadFont-java.lang.String-">loadFont</a></span>(<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;fontPath)</code>
<div class="block">Loads a bitmap font and returns the <a href="../../../../org/lazywizard/lazylib/ui/LazyFont.html" title="class in org.lazywizard.lazylib.ui"><code>LazyFont</code></a> representation.</div>
</td>
</tr>
<tr id="i14" class="altColor">
<tr id="i15" class="rowColor">
<td class="colFirst"><code>@NotNull <a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/lazywizard/lazylib/ui/LazyFont.html#wrapString-java.lang.String-float-float-">wrapString</a></span>(<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;toWrap,
float&nbsp;fontSize,
Expand All @@ -362,7 +368,7 @@ <h3>Method Summary</h3>
font size.</div>
</td>
</tr>
<tr id="i15" class="rowColor">
<tr id="i16" class="altColor">
<td class="colFirst"><code>@NotNull <a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/lazywizard/lazylib/ui/LazyFont.html#wrapString-java.lang.String-float-float-float-">wrapString</a></span>(<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;toWrap,
float&nbsp;fontSize,
Expand All @@ -372,7 +378,7 @@ <h3>Method Summary</h3>
font size.</div>
</td>
</tr>
<tr id="i16" class="altColor">
<tr id="i17" class="rowColor">
<td class="colFirst"><code>@NotNull <a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/lazywizard/lazylib/ui/LazyFont.html#wrapString-java.lang.String-float-float-float-int-">wrapString</a></span>(<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;toWrap,
float&nbsp;fontSize,
Expand Down Expand Up @@ -598,6 +604,23 @@ <h4>calcWidth</h4>
</dl>
</li>
</ul>
<a name="getFontName--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getFontName</h4>
<pre>@NotNull
public&nbsp;@NotNull <a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;getFontName()</pre>
<div class="block">Returns the name of the font, as defined in its .fnt file.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>The name of the loaded font.</dd>
<dt><span class="simpleTagLabel">Since:</span></dt>
<dd>2.5b</dd>
</dl>
</li>
</ul>
<a name="getChar-char-">
<!-- -->
</a>
Expand Down
15 changes: 14 additions & 1 deletion docstubs/org/lazywizard/lazylib/ui/LazyFont.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import org.jetbrains.annotations.NotNull;
import org.lwjgl.util.vector.Vector2f;

import java.awt.*;
import java.awt.Color;
import java.util.Map;

/**
Expand Down Expand Up @@ -251,6 +251,19 @@ public float calcWidth(String rawLine, float fontSize)
return 0f;
}

/***
* Returns the name of the font, as defined in its .fnt file.
*
* @return The name of the loaded font.
*
* @since 2.5b
*/
@NotNull
public String getFontName()
{
return "";
}

/**
* Returns font metadata for a specific character. If the font does not support the character, data for '?' is
* returned instead.
Expand Down
13 changes: 12 additions & 1 deletion mod/changelog.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
2.4g (January 18, 2021)
2.5b (January 20, 2021)
=========================
Retroactively renamed v2.4g to v2.5
Changes to LazyFont:
- Added getFontName()
Changes to LazyFont.DrawableString:
- Fixed a crash with word-wrapped text that includes a hyphenated line break
- Added setRenderDebugBounds(), which draws a box showing the text's width,
height, and position.

2.5 (January 18, 2021)
========================
(originally released as v2.4g)
Updated bundled libraries:
- kotlin-stdlib: v1.3.61 -> v1.4.21
- kotlinx-coroutines: v1.2.0 -> v1.4.2
Expand Down
4 changes: 2 additions & 2 deletions mod/lazylib.version
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"modVersion":
{
"major":2,
"minor":4,
"patch":g
"minor":5,
"patch":b
}
}
4 changes: 2 additions & 2 deletions mod/mod_info.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"id": "lw_lazylib", #// If changed, update MOD_ID in org.lazywizard.lazylib.LazyLib to avoid a crash!
"id": "lw_lazylib", #// If changed, also update MOD_ID in org.lazywizard.lazylib.LazyLib
"name": "LazyLib",
"author": "LazyWizard",
"utility": "true",
"version": "2.4g",
"version": "2.5b",
"description": "A collection of classes to aid modding. Not a mod in itself, but required by certain other mods.",
"gameVersion": "0.9.1a",
"jars": ["jars/LazyLib.jar","jars/LazyLib-Kotlin.jar","jars/lib/Kotlin-Runtime.jar"],
Expand Down
6 changes: 4 additions & 2 deletions src/org/lazywizard/lazylib/ui/LazyFont.kt
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ class LazyFont private constructor(

// If the character isn't in the defined set, return a question mark (or a
// blank space if the font doesn't define a question mark, either)
//System.out.println("Error: character '$character' is not defined in font data")
Log.warn("Character '$character' is not defined in font data")
return if (character == '?') getChar(' ') else getChar('?')
}

Expand Down Expand Up @@ -546,13 +546,15 @@ class LazyFont private constructor(
// Check if we're about to exceed the max textbox height
if (-yOffset + fontSize > maxHeight) {
sizeX = Math.max(sizeX, xOffset)
Log.debug("\n\nBroke line\n\n")
break@outer
}

yOffset -= fontSize
sizeY += fontSize
sizeX = Math.max(sizeX, xOffset)
xOffset = -kerning // Not a mistake - negates localX kerning adjustment below
Log.debug("\n\nAdjusted kerning\n\n")
}

val localX = xOffset + kerning + ch.xOffset * scaleFactor
Expand Down Expand Up @@ -618,7 +620,7 @@ class LazyFont private constructor(
glColor(color)
glDrawArrays(GL_QUADS, 0, len * 8)

// Render bounds when debug flag is set
// Render visual bounds if the debug flag is set
if (renderDebugBounds) {
glDisable(GL_TEXTURE_2D)
glLineWidth(1f)
Expand Down

0 comments on commit 0322b50

Please sign in to comment.