Skip to content

Conversation

@KAMKEEL
Copy link
Owner

@KAMKEEL KAMKEEL commented Feb 7, 2026

Motivation

  • Provide an example GUI demonstrating crisp, scalable text rendering using the existing TTF in resources and a client-side command to open it.
  • Verify alignment and renderer behavior by showing baseline markers and renderer/atlas/debug info at multiple sizes.

Description

  • Added a client GUI GuiFontTest that renders a title and sample text at sizes 8, 12, 16, 24, 32, 48, 64 with per-line baseline markers and debug text (renderer path, atlas dims, GUI scale, scale factor).
  • Implemented ScalableSdfFontRenderer which loads assets/customnpcs/OpenSans.ttf from the classpath (ResourceLocation("customnpcs","OpenSans.ttf")), generates an SDF atlas and attempts GL20 shader rendering; if shader compilation fails it falls back to baking raster atlases per size (no single-bitmap upscaling); texture params set to linear filtering and clamp-to-edge and mipmaps disabled; GL state is saved/restored around rendering.
  • Added GuiFontTestPacket (client-open packet) and TestCommand to expose /kamkeel testfont; registered the packet enum GUI_FONT_TEST, registered the packet in PacketHandler, and registered the command in the KAMKEEL command registry.
  • Modified/added files:
    • Added: src/main/java/kamkeel/npcs/client/gui/GuiFontTest.java
    • Added: src/main/java/kamkeel/npcs/client/renderer/font/ScalableSdfFontRenderer.java
    • Added: src/main/java/kamkeel/npcs/command/TestCommand.java
    • Added: src/main/java/kamkeel/npcs/network/packets/data/gui/GuiFontTestPacket.java
    • Modified: src/main/java/kamkeel/npcs/command/CommandKamkeel.java
    • Modified: src/main/java/kamkeel/npcs/network/PacketHandler.java
    • Modified: src/main/java/kamkeel/npcs/network/enums/EnumDataPacket.java

Testing

  • Initialized submodules as required with git submodule sync --recursive && git submodule update --init --recursive, which completed successfully.
  • Verified the TTF location with rg --files src/main/resources | rg '\.ttf$' and found src/main/resources/assets/customnpcs/OpenSans.ttf.
  • Built the project with ./gradlew compileJava and observed a successful build: BUILD SUCCESSFUL in 2m 11s (18 actionable tasks: 18 executed).

Codex Task

@KAMKEEL KAMKEEL closed this Feb 7, 2026
@KAMKEEL KAMKEEL deleted the add-example-gui-for-scalable-text-rendering-0bwcs9 branch February 7, 2026 02:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant