Can't load codepoints needed for Unicode text rendering
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 35/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Da chiarire
- Stato di attività
- Attiva
- Stack tecnologico
- cpp
- Ambito
- computer-graphics
Direzione di ricerca
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.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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...?
- Lingua principale
- C++
- Stelle
- 960
- Fork
- 120
- Merge medio
- 10m
- PR unite (30g)
- 1
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di RobLoach/raylib-cpp
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
RobLoach/raylib-cpp#425 ·
-
Code gen Aperta
Difficoltà 5/5 Più di una settimana Idoneità per principianti 30/100
RobLoach/raylib-cpp#415 · 1 commento ·
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 45/100
RobLoach/raylib-cpp#370 · 1 commento ·
-
SDF Font Support Aperta
Difficoltà 3/5 1-2 giorni Idoneità per principianti 55/100
RobLoach/raylib-cpp#366 · 3 commenti ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 45/100
RobLoach/raylib-cpp#359 · 5 commenti ·
Tutte le issue di RobLoach/raylib-cpp
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
duckdb/duckdb-wasm#2258 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
objectionary/eo-graphs#75 ·
-
Coarray integration tests carry no LABELS, so run_tests.py silently skips them under every backend Apertacoarray
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
FISCO-BCOS/FISCO-BCOS#5642 ·