Skip to content

Internal utf8#4920

Open
PieterVdc wants to merge 60 commits into
dkfans:masterfrom
PieterVdc:internal_utf8
Open

Internal utf8#4920
PieterVdc wants to merge 60 commits into
dkfans:masterfrom
PieterVdc:internal_utf8

Conversation

@PieterVdc

@PieterVdc PieterVdc commented Jun 14, 2026

Copy link
Copy Markdown
Member

Internally use utf-8 everywhere instead of the the language dependent custom ones
also replaces the dbc languages font with unifont

languages are way less relevant now
it can mix sprite fonts and a simpler fallback font

it actually checks what codepage a dat was made for and loads it correctly regardless of user language
so if a campaign only has japanese and game set to english, it'll display japanese text instead of the corrupted gibberish it used to
same in the opposite direction if the eng used any non ascii chars in it

QUICK_MESSAGE etc all now accept utf-8 as well
the fallback font covers everything in the bmp, so if someone wanted a Bamum translation or whatever wierd shit they can come up with, likely got them covered already

for the dbc languages I still default to dbc mode for now
added a console command !dbc to switch between the modes, both will display any text, just has some exceptions spread throughout
eventually I would want to merge dbc mode into the main one, but to many spots to look at I'll do that seperately

there's 3 fonts japanese, chinese simpified, and traditional for the han unified glyphs to still use a localized variant so if you're not on japanese the han might look bit simplified chinese style but should be fine if language is

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR moves the project toward using UTF-8 internally (instead of language-dependent custom encodings), and introduces a UniFont-based glyph source to replace DBC language fonts.

Changes:

  • Added a UniFont .hex.fxfont converter script and a helper batch file for generating font binaries.
  • Refactored text rendering to decode UTF-8 codepoints and introduced a new bflib_text helper module.
  • Simplified translation-table storage to keep UTF-8 strings (removed the prior internal-codepage conversion path).

Reviewed changes

Copilot reviewed 10 out of 14 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
tools/fxfontmaker/unifont_hex_to_binary.py New converter producing a fixed BMP index + glyph data block binary.
tools/fxfontmaker/make_fonts.bat Batch helper to generate .fxfont outputs from UniFont .hex inputs.
src/config_translation.c Stops converting translation strings into an internal codepage and stores UTF-8 directly.
src/config_keeperfx.c Removes DBC-language setup hook during config load.
src/bflib_text.h New header for UTF-8 decoding helper(s).
src/bflib_text.c New UTF-8 decoding + codepage conversion utilities (used for UTF-8 decoding by renderer).
src/bflib_sprfnt.h Updates font API signatures to accept uint32_t codepoints; removes old DBC font structures.
src/bflib_sprfnt.c Major UTF-8 decoding/rendering changes; UniFont .fxfont loading; new DBC rendering path.
Makefile Adds obj/bflib_text.o to the build.
config/fxdata/translation.toml Adjusts a few language keys (RUS entries).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/config_translation.c Outdated
Comment thread src/bflib_sprfnt.c Outdated
Comment thread src/bflib_sprfnt.c Outdated
Comment thread src/bflib_sprfnt.c
Comment thread src/bflib_sprfnt.c
Comment thread src/bflib_sprfnt.c
Comment thread src/bflib_text.h Outdated
Comment thread src/bflib_sprfnt.c Outdated

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 33 out of 38 changed files in this pull request and generated 11 comments.

Comment thread src/bflib_text.c
Comment thread src/bflib_text.c Outdated
Comment thread src/bflib_text.c Outdated
Comment thread src/bflib_text.h Outdated
Comment thread src/bflib_sprfnt.c
Comment thread src/bflib_sprfnt.c Outdated
Comment thread src/bflib_sprfnt.c
Comment thread src/bflib_sprfnt.h Outdated
Comment thread src/console_cmd.c
Comment thread src/main.cpp
@PieterVdc PieterVdc marked this pull request as ready for review June 22, 2026 17:27
@PieterVdc PieterVdc marked this pull request as draft June 22, 2026 17:30
@PieterVdc PieterVdc marked this pull request as ready for review June 22, 2026 17:32
@AdamPlenty

Copy link
Copy Markdown
Contributor

Old Japanese dats don't work:

image

@PieterVdc PieterVdc marked this pull request as draft June 23, 2026 06:02
@PieterVdc PieterVdc marked this pull request as ready for review June 23, 2026 17:15
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.

UTF-8 support Codepage/encoding issue with objectives and information strings in level scripts

3 participants