TTF and OTF Replacement#2178
Open
G-LimeJuice wants to merge 4 commits intoPhobos-developers:developfrom
Open
Conversation
## Overview This implementation is **hooked directly into the game code (BitFont & BitText)** to replace legacy `.FNT` font rendering with modern `.TTF` / `.OTF` fonts. It overrides the original font pipeline and injects custom rendering using external libraries. --- ## How It Works - Hooks into **BitFont** and **BitText** rendering functions - Replaces `.FNT` font loading with `.TTF` / `.OTF` - Uses: - **HarfBuzz** → glyph shaping - **FriBidi** → RTL (Arabic) handling --- ## Setup 1. Go to your game directory 2. Create a folder: 3. Create a config file inside it (e.g. `config.ini`) --- ## Configuration ```ini [EnableTTF] Enabled=TRUE; [Font] FileName=arial.ttf [Size] LatinSize=14 ArabicSize=15 ; Ignore it Place your `.ttf` / `.otf` file inside the `Fonts` folder. The font file name must match the value set in `FileName`. If you don’t have a font file, you can download `.ttf` or `.otf` fonts from online font websites. `vcpkg` was cloned into the Phobos project directory to install dependencies (HarfBuzz and FriBidi). Source: https://github.com/microsoft/vcpkg Run the integration command: `.\vcpkg integrate install` Done! Now your project should support .TTF and .OTF fonts with proper rendering. If it doesn't work, specify the root manually: Replace "Directory" with your actual path, for example: `C:\XXX\Phobos\vcpgk ` `.\vcpkg --vcpkg-root="Directory" integrate install`
Contributor
|
Docs are needed. |
Contributor
Is it necessary to create a new ini file? Why not in RA2MD.ini, RULESMD.ini or UIMD.ini? |
Author
updated |
56e8746 to
8cefd18
Compare
62e4796 to
d29defe
Compare
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.
Overview
This implementation is hooked directly into the game code (BitFont & BitText) to replace legacy
.FNTfont rendering with modern.TTF/.OTFfonts.It overrides the original font pipeline and injects custom rendering using external libraries.
How It Works
.FNTfont loading with.TTF/.OTFSetup
Place your
.ttf/.otffile inside theFontsfolder.The font file name must match the value set in
FileName.If you don’t have a font file, you can download
.ttfor.otffonts from online font websites.you need clone into the Phobos project directory to install dependencies (HarfBuzz and FriBidi).
Source: https://github.com/microsoft/vcpkg
Run the integration command on directory vcpkg:
.\vcpkg integrate installIf it doesn't work, specify the root manually:
Replace "Directory" with your actual path, for example:
C:\XXX\Phobos\vcpgk.\vcpkg --vcpkg-root="Directory" integrate installAnd install harfbuzz
.\vcpkg install harfbuzz --triplet x86-windowsAnd also install fribidi
.\vcpkg install fribidi --triplet x86-windowsNow your project should support .TTF and .OTF fonts with proper rendering.