Skip to content

Add /kamkeel testfont GUI and scalable OpenSans renderer#257

Open
KAMKEEL wants to merge 4 commits intodevfrom
add-example-gui-for-scalable-text-rendering-1jfeqz
Open

Add /kamkeel testfont GUI and scalable OpenSans renderer#257
KAMKEEL wants to merge 4 commits intodevfrom
add-example-gui-for-scalable-text-rendering-1jfeqz

Conversation

@KAMKEEL
Copy link
Owner

@KAMKEEL KAMKEEL commented Feb 7, 2026

Motivation

  • Provide an in-game example GUI that demonstrates crisp, scalable text rendering using the existing TTF shipped in resources.
  • Offer a client-only debug/demo screen that proves alignment (baseline/grid), renderer details and works via the existing KAMKEEL command system.
  • Ship a robust renderer that prefers SDF+shader for sharp scaling and falls back to per-size rebaked atlases to avoid blurry bitmap scaling.

Description

  • Added a client-side GUI GuiFontTest that hardcodes the discovered font path assets/customnpcs/OpenSans.ttf and draws a title, sample text at sizes 8, 12, 16, 24, 32, 48, 64, baseline markers, and debug info. (new file: src/main/java/noppes/npcs/client/gui/GuiFontTest.java)
  • Implemented ScalableFontRenderer which loads the TTF from the classpath, builds an SDF atlas and renders via a GLSL (GL20) shader, with a deterministic per-size raster rebake fallback if shaders fail; atlas upload uses GL_LINEAR filtering and GL_CLAMP_TO_EDGE, glyphs rendered as quads batched with Tessellator, and GL state is pushed/popped to avoid affecting vanilla GUI state. (new file: src/main/java/noppes/npcs/client/gui/font/ScalableFontRenderer.java)
  • Added a server-to-client packet GuiFontTestPacket and a server-side TestCommand mapped into the existing KAMKEEL command set so /kamkeel testfont opens the GUI client-side; packet and command are client-safe. (new files: src/main/java/kamkeel/npcs/network/packets/data/gui/GuiFontTestPacket.java, src/main/java/kamkeel/npcs/command/TestCommand.java)
  • Registered the new packet and command: updated CommandKamkeel to register the command, added GUI_FONT_TEST to EnumDataPacket, and registered the packet in PacketHandler. (modified files: src/main/java/kamkeel/npcs/command/CommandKamkeel.java, src/main/java/kamkeel/npcs/network/enums/EnumDataPacket.java, src/main/java/kamkeel/npcs/network/PacketHandler.java)

Testing

  • Ran the repository initialization steps: git submodule sync --recursive and git submodule update --init --recursive to ensure API and gradle-plugin submodules were present; these completed successfully.
  • Executed the compile check ./gradlew compileJava; an environment toolchain issue was addressed during CI setup and the final build completed successfully with BUILD SUCCESSFUL.
  • Automated build output summary: BUILD SUCCESSFUL in 2m 3s (compile task completed without errors).

Codex Task

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