许多人都知道三维图形的问题-文本输出问题中缺少轻量级的跨平台解决方案。
大多数实现允许您将所选字体用作纹理。已发布的ttf2mesh库实现了另一种方法-将TrueType字体矢量字符转换为网格对象。这使您可以将文本显示为一组三角形。

这种方法具有重要的优点和缺点。下文描述的任务的复杂性以及对字体设计的宏伟形式的思考为开发带来了很多乐趣。我希望你也喜欢它。
沉浸在问题中
在stackoverflow网站上,您可能会遇到“如何仅使用OpenGL方法绘制文本?”的问题。。对它的详细解答以短语“为什么很难”开头。我会对此答案做一个简短的翻译,因为它比较好-很难描述这个问题。
常见字体(例如TrueType或OpenType)具有用于表示字符的矢量格式:其轮廓由一组Bezier曲线定义。

— OpenGL, (, , ).
, CPU, — OpenGL- . , . :

, . , web- (CSS-sprites).
FOSDEM 2014, , :
- : . GPU . : ; O(N log N).
- . : , . Resolution independent cubic bezier drawing on GPU (Blinn/Loop)
- OpenVG. : API , (. OpenGL, OpenVG. Draw text OpenVG implementation)
, 3d- 2016 . .. "Distance fields" ( , . ). .
FreeType
FreeType . FTGL, API, "Distance fields" .
— libgdx.
github.com/nothings/stb/blob/master/stb_truetype.h
www.angelcode.com/products/bmfont
, . (DDS, PNG) . — .
FOSDEM 2014 .
: — ? 6000 ( Ubuntu ):

2.5 (Times New Roman , 15000 ).
, , ( )? ( , , , GPU ), .
O(N log N)
, , . , ( ) — . log(N) . , . , , .. " " , , . , .
, . , :
: ; .
. "" "", .
ttf2mesh
" ". ttf2mesh — (ttf2mesh.h ttf2mesh.c) C99. , :
API. , ttf2mesh.h doxygen-. ttf_export_to_obj, Wavefront .obj. , . examples - ttf2obj.
:
- TTF- ,
- ( )
5.1.
5.2. ( )
5.3.
5.4.
TTF-
Microsoft (OpenType specification). OpenType- (.otf) — TrueType- (.ttf), , . , , TTF, , OTF TTC.
. ( ELF ) TrueType … . … , , .
TTF- Windows 7 font list Ubuntu 18.04.4 LTS ( 500 TTF ).
TrueType — . .
— , . outline quality .

.
ttf2mesh . TTF_QUALITY_LOW, TTF_QUALITY_NORMAL TTF_QUALITY_HIGH. . .

"Q" 76, 97 175 .
, . — . . , . . :
, , U+2592 (▒). . , , Ctrl+V. … : , .
, ( ), EPSILON.
— .
. , . , - , . . ?
— .
Microsoft Apple. . , Microsoft Apple (. Overlapping contours) .
, ( , ?). — , . , even-odd , nonzero.
, 0.1% Windows 7. 497931 680 UNICODE:
UNICODEBasic Latin — 14 errors
Latin-1 Supplement — 9 errors
Latin Extended-A — 2 errors
Greek and Coptic — 2 errors
Thai — 11 errors
Letterlike Symbols — 1 errors
Mathematical Operators — 1 errors
Block Elements — 1 errors
Geometric Shapes — 1 errors
Hiragana — 1 errors
Enclosed CJK Letters and Months — 1 errors
CJK Unified Ideographs Extension A — 74 errors
CJK Unified Ideographs — 555 errors
Private Use Area — 3 errors
CJK Compatibility Ideographs — 4 errors
, 36 497931 ( 0.01%). "Basic Latin", : IrisUPC, KodchiangUPC, LilyUPC, Footlight MT Light, Kunstler Script, Papyrus, Parchment Viner Hand ITC. UPC (Unity Progress Company).
, . , .
. "B", , 3 : - . "" 1 -. - . .

, , . U+00A2 — (), , ().
)
) 
. — , . … . , . — "/" "C". . — , - "" .
, , . . . .

1) (y). p19, p15 .
2) . . , advancing front, . . .
3) , , 2 . , .
4) .3 , . p2.
5) . , . p5.
( Point event) , 2008 V. Domiter & B. Žalik "Sweep‐line algorithm for constrained Delaunay triangulation" (DOI: 10.1080/13658810701492241).
( ) , . , , . .
. , .

( X — , Y — ).
, , ( ) O(N). , O(N log N) , , . .
, , 2000 . "Tibetan Machine Uni" U+0FC7 (Tibetan Symbol Rdo Rje Rgya Gram) :
:

OpenGL MSAA:

...
. ( , , ) . , . .
ttf2mesh , . OBJ . , SVG , , PostScript.
. — , .

ttf2mesh库具有MIT许可证,可在此处获得。我希望它将对社会有用。