Fix pixel-grid misalignment caused by shared vertex insetting#5
Open
Aerhhh wants to merge 1 commit intominecraft-library:masterfrom
Open
Fix pixel-grid misalignment caused by shared vertex insetting#5Aerhhh wants to merge 1 commit intominecraft-library:masterfrom
Aerhhh wants to merge 1 commit intominecraft-library:masterfrom
Conversation
_inset_shared_vertices nudged shared contour vertices by 1 font unit along the bisector of adjacent edges to suppress a FontForge wrong-direction false positive. This moved outline coordinates off the pixel grid (e.g. (127, 769) instead of (128, 768)), causing font rasterizers (FreeType, Java2D) to produce platform-dependent rendering artifacts on characters with multiple contours (A, M, H, S, K, etc.). Removing the function restores all glyph coordinates to exact multiples of 128 font units (1 Minecraft pixel at UPM 1024 / 8ppem), producing clean pixel-perfect rendering at all integer multiples of the native design size.
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.
Summary
_inset_shared_verticeswhich nudged shared contour vertices by 1 font unit off the pixel gridProblem
_inset_shared_verticeswas introduced to suppress a FontForge wrong-direction false positive on glyphs where outer and hole contours share a vertex. It shifts those vertices by 1 font unit along the bisector of adjacent edges.This moves outline coordinates off the pixel grid - for example
(127, 769)instead of(128, 768). When font rasterizers (FreeType on Linux, Java2D, etc.) encounter these off-grid coordinates, they make different rounding decisions depending on the platform, producing inconsistent rendering artifacts on characters with multiple contours (A, M, H, S, K, and many others).Before (off-grid coordinates for 'A'):
After (grid-aligned):
Rendering comparison (Python/Pillow at 16px)
Before - 'A' has asymmetric strokes:
After - clean 2x pixel grid: