Can't load codepoints needed for Unicode text rendering
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 35/100
- Issue 类型
- 功能
- 描述清晰度
- 需要澄清
- 活跃度
- 活跃
- 技术栈
- cpp
调研方向
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.
由索引模型根据 Issue 内容生成。
描述
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...?
- 主要语言
- C++
- 星标
- 960
- 派生
- 120
- 平均合并
- 10 分钟
- 30 天内合并 PR
- 1
贡献指南
这个仓库没有索引到贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
RobLoach/raylib-cpp 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 74/100
RobLoach/raylib-cpp#425 ·
-
Code gen 未关闭
难度 5/5 一周以上 新手友好度 30/100
RobLoach/raylib-cpp#415 · 1 条评论 ·
-
难度 3/5 1-2 天 新手友好度 45/100
RobLoach/raylib-cpp#370 · 1 条评论 ·
-
SDF Font Support 未关闭
难度 3/5 1-2 天 新手友好度 55/100
RobLoach/raylib-cpp#366 · 3 条评论 ·
-
难度 4/5 3-5 天 新手友好度 45/100
RobLoach/raylib-cpp#359 · 5 条评论 ·
查看 RobLoach/raylib-cpp 的全部 Issue
相似的 Issue
-
难度 1/5 1-3 小时 新手友好度 92/100
autowarefoundation/autoware_universe#13413 ·
-
难度 2/5 1-3 小时 新手友好度 88/100
-
automated-analysis bug memory-safety
难度 2/5 1-3 小时 新手友好度 68/100
-
难度 2/5 1-3 小时 新手友好度 86/100
-
Sensor initialization takes very long when `--initial-sim-time` is set to current UNIX timestamp 未关闭
难度 2/5 1-3 小时 新手友好度 78/100
gazebosim/gz-sensors#662 · 1 条评论 ·