Switch engine to UTF-8 and add FreeType TTF/OTF font rendering (closes #419)#2113
Open
ChugunovRoman wants to merge 6 commits into
Open
Switch engine to UTF-8 and add FreeType TTF/OTF font rendering (closes #419)#2113ChugunovRoman wants to merge 6 commits into
ChugunovRoman wants to merge 6 commits into
Conversation
Use the OpenXRay-adapted fork at https://github.com/ChugunovRoman/freetype.git (commit f025a8c92c09d55a43d696985913005add4907e0). The upstream FreeType repo is not used; the fork already contains the PFR fix, so no manual patches are needed.
… Cyrillic input Migrates the engine to native UTF-8 text handling: - Adds FreeType TTF/OTF font rendering (GameFont, dxFontRender, FontManager, UILines). - Adds xrCore/Text/Utf8Utils for UTF-8 <-> CP1251/ACP/Wide conversions. - Handles UTF-8 BOM in XML and INI files. - Enables Cyrillic input in console/edit controls. - Updates path handling (FS, LocatorAPI, os_clipboard) for Unicode/UTF-8. - Adds FreeType MSVC project and wires it into engine.sln / CMake. Files deleted on dev (xrSentry.cpp, multiline_edit_control.cpp/.h) are left deleted; the freetype_pfr_stub.cpp from the original commit is omitted because the fork already fixes the PFR issue.
- Fix text rendering at small UI scales. - Adjust default text scale. - Add r_font_legacy console variable to switch back to legacy bitmap fonts (.dds + .ini) alongside FreeType TTF/OTF rendering.
…bers, fix legacy edge cases
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.
This PR switches the engine to native UTF-8 text handling and adds FreeType-based TTF/OTF font rendering while keeping the existing legacy X-Ray bitmap font path intact. On Windows, file-system paths and clipboard operations now use wide-character APIs so Unicode works end-to-end, and BOM stripping is applied to INI/XML/script files loaded by the engine. Console and UI edit-box input was also updated to work with UTF-8 characters.
Two new console variables control the font behavior:
r_font_legacy— toggles between legacy bitmap fonts (1) and FreeType TTF/OTF fonts (0, default). If a requested TTF/OTF font cannot be found, the engine automatically falls back to the legacy bitmap font for that section.ui_text_scale— global multiplier for in-game UI text width/height.Externals/freetypeis added as a Git submodule pointing to the project fork; make sure to rungit submodule update --init --recursiveafter checking out this branch. Legacy.inimetrics files are still expected to be CP1251-encoded and are mapped to Unicode at load time.Closes #419