Skip to content

Fix blurry rendering in nanovg example on HiDPI displays - #188

Open
srgpqt wants to merge 2 commits into
odin-lang:masterfrom
srgpqt:nanovg-px-ratio
Open

srgpqt wants to merge 2 commits into
odin-lang:masterfrom
srgpqt:nanovg-px-ratio

Conversation

@srgpqt

@srgpqt srgpqt commented Oct 13, 2026 •

Copy link
Copy Markdown

Tiny fix for the pixel ratio calculation in the nanovg example.

The previous f32(fw) / f32(fw) would obviously always produce an incorrect pixel ratio 1.

  • This example has been added to .github/workflows/check.yml (for automatic testing)
  • This example compiles cleanly with flags -vet -strict-style -vet-tabs -disallow-do -warnings-as-errors
  • This example the naming and style convention: https://github.com/odin-lang/examples/wiki/Naming-and-style-convention (exceptions can be made for ports of examples that need to match 1:1 to the original source).
  • By submitting, I understand that this example is made available under these licenses: Public Domain and Odin's zlib license. Only for third-party dependencies are other licenses allowed.

srgpqt and others added 2 commits October 12, 2026 21:12
nvg.TextGlyphPositions returns glyph offsets in device pixels without
scaling them back to logical units. Query the positions at origin 0 and
divide by the device pixel ratio before adding the paragraph x offset.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant