ILXL / ILXL/cpputils

Text object

未关闭
#9 2 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
C++
星标
4
派生
1
PR 合并指标
30 天内没有已合并 PR

描述

Design a Text object that allows you to set its size, color, and value. Its most important feature is to retrieve the text width and height so that developers can check whether they fit in a given region. For example, the feature allows you to check whether the text could fit inside a box of a given height and width.

A possible solution would be to create an image object, drawtext on it, then retrieve the objects resulting width and height as described [here](https://stackoverflow.com/questions/24190327/getting-the-dimensions-of-a-rendered-text-in-cimg-library). The suggested code is shown below for reference:

```cpp
CImg imgtext;
unsigned char color = 1;
imgtext.draw_text(0,0,"Hello guys !",&color,0,1,23); // Draw with font height 23.
// Now, imgtext.width() and imgtext.height() gives you the dimensions you want.
```

贡献指南

这个仓库没有索引到贡献指南

调研方向

从链接的 CImg draw_text 示例开始,确定 Text 对象应如何提供 size、color、value 以及渲染后的尺寸。完成的标准是开发者可以设置这些属性,并获取 width 和 height,以检查文本是否适合指定区域。

由索引模型根据 Issue 内容生成。

评估

技术栈
cpp
领域
computer-graphics
Issue 类型
功能
难度
5/5
预计耗时
一周以上
活跃度
停滞
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。