Fix font rendering for color and formatting codes #1017
Open
ayushthoren wants to merge 3 commits intosmartcmd:mainfrom
Open
Fix font rendering for color and formatting codes #1017ayushthoren wants to merge 3 commits intosmartcmd:mainfrom
ayushthoren wants to merge 3 commits intosmartcmd:mainfrom
Conversation
Signed-off-by: Ayush Thoren <ayushthoren@gmail.com>
|
wouldn't it be efficient to keep rendering in the same batch but use vertex colors to apply the color instead? |
Signed-off-by: Ayush Thoren <ayushthoren@gmail.com>
Contributor
Author
|
Yep, hopefully these changes are more optimized! New implementation: |
Signed-off-by: Ayush Thoren <ayushthoren@gmail.com>
Contributor
Author
|
Well, I went down a rabbit hole and found that there were some more glaring issues with the font renderer involving some of the other formatting options. Details have been added in the edited PR description. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Edits: This PR was originally made to fix just the "Colormatic" splash text appearance, but has since fixed more general issues with the font renderer.
Description
Fixes issues with font color and formatting when using the tesselator-based text renderer.
Changes
Previous Behavior
Text using formatting codes such as color (
§c,§a) and styles (§n,§m, etc.) could render incorrectly.Notably, one consequence of this is that the Colormaitc splash (
§1C§2o§3l§4o§5r§6m§7a§8t§9i§ac) rendered in one flat color instead of showing per-segment colors.Root Cause
Font rendering mixed two rendering paths:
Because the style lines were not part of the tesselator batch, they did not use the same vertex color as the text and could render incorrectly.
New Behavior
Formatted text now renders consistently, with underline and strikethrough lines matching the color of the surrounding text and all formatted glyphs rendering correctly in the same batch.
Fix Implementation
In
Minecraft.Client/Font.cpp, style line rendering was moved into the tesselator path.addSolidQuad) was added to emit these quads inside the active tesselator batch.emitCharacterGeometryto remove duplicated geometry code.This ensures previous glyphs keep their original color and new ones use the updated color.
AI Use Disclosure
I used AI as a tool to track down the possible root causes of the rendering issues, then confirmed them and implemented the fixes myself.
Related Issues
How it looked before:
Test splash


Colormatic splash
How it looks after:
Test splash


Colormatic splash