Replace LCD MonoFont with embedded Barlow Regular font (SFML)#123
Merged
Conversation
Switch SFML text rendering from the custom segment-based MonoFont (which simulated an LCD display) to a real TrueType font rendered through SFML's sf::Text, with no runtime file dependencies. - Add EmbeddedFont.h: Barlow Regular TTF (SIL OFL 1.1) encoded as a C array (kEmbeddedFontData / kEmbeddedFontSize), included only inside SFML_HOG.cpp. - Change sf::Window → sf::RenderWindow throughout SFML_HOG.cpp and SFML_HOG.h so that pushGLStates/popGLStates and sf::Text drawing are available. - Add EnsureFontLoaded() to lazily open the font from memory on first text draw. - Add DrawTextSFML() which converts HOG viewport coordinates and textAlign/textBaseline to SFML pixel positions and draws with the embedded font, properly suspending OpenGL state around the draw. - Replace both font.GetTextLines() + DrawLines() calls (background text and foreground text) with DrawTextSFML(). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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
MonoFontLCD-style text renderer from the SFML drawing path.EmbeddedFont.h— Barlow Regular TTF (SIL Open Font License 1.1) encoded as a C byte array, included only insideSFML_HOG.cpp. No external font files are required at runtime.sf::Window→sf::RenderWindowthroughoutSFML_HOG.cpp/SFML_HOG.hto gain access topushGLStates/popGLStatesandsf::Textrendering.DrawTextSFML()which:sf::Font::openFromMemory.ViewportToScreen/screenRectinfrastructure.textAlign(Left,Center,Right) andtextBaseline(Top,Middle,Bottom) values to SFML origin offsets.pushGLStates/popGLStatesto safely interleave with OpenGL rendering.font.GetTextLines()+DrawLines()call sites (background text and foreground text loops) withDrawTextSFML().Reviewer notes
MonoFontis still compiled (it's used by other non-SFML code paths); only the SFML call sites are replaced.sf::RenderWindowis a drop-in subclass ofsf::Window; all existing event handling,setFramerateLimit, etc. are unaffected.Test plan
textAlignCenter/textAlignRightandtextBaselineTop/textBaselineMiddlepositions look correct in a demo that exercises those paths.pushGLStates/popGLStatespair should restore state cleanly).🤖 Generated with Claude Code