RobLoach / RobLoach/raylib-cpp
Can't load codepoints needed for Unicode text rendering
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 960
- Forks
- 120
- Avg merge
- 10m
- Merged PRs (30d)
- 1
Description
As far as I've looked, if you want to use text with foreign characters you need to specify codepoints --the conversion codes from UTF-x to real Unicode-- in the Font object. The examples I've looked include iterating for a specific range of characters to match the language you want (for C Raylib).
// Source - https://stackoverflow.com/q/73248125
// Posted by Dmitriy, modified by community. See post 'Timeline' for change history
// Retrieved 2026-09-18, License - CC BY-SA 4.0
int codepoints[512] = { 0 };
for (int i = 0; i < 95; i++) codepoints[i] = 32 + i;
for (int i = 0; i < 255; i++) codepoints[96 + i] = 0x400 + i;
Font font = LoadFontEx("arial.ttf", 32, codepoints, 512);
I've tried something similar in a project:
// codepoints
std::vector<int> codepoints;
// Load codepoints from a Unicode subset (Basic Latin)
for (int cp = 0x20; cp <= 0x7E; ++cp)
codepoints.push_back(cp);
raylib::Font font{"src/Milonga-Regular.ttf", 30, codepoints.data(),
static_cast<int>(codepoints.size())};
raylib::Text text{text_str, 30, WHITE, font};
(...)
while (!w.ShouldClose()) // Detect window close button or ESC key
{
// Update
// TODO: Update your variables here
(...)
// Draw
BeginDrawing();
ClearBackground(GetColor(gunmetalGray));
(...)
text.Draw(Vector2{20, 20});
EndDrawing();
}
...but it doesn't work.
Another solution in Raylib is using GetCodepoints() for a string, but there's no bindings for that.
There's a recommended approach for raylib-cpp or...?
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing the raylib-cpp Font usage shown in the issue and the raylib GetCodepoints() API it references. Determine how Unicode text and codepoints should be exposed through the wrapper, then verify that the recommended approach works for the reported rendering case.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- computer-graphics
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100