# specchar **Repository Path**: lightsever/specchar ## Basic Information - **Project Name**: specchar - **Description**: No description available - **Primary Language**: C# - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2025-09-14 - **Last Updated**: 2025-09-15 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # 特殊字符的显示 ## 1. 放弃 系统自己的文本渲染系统 让我们用最常见的ttf 字体处理库 freetype 来处理文本 freetype 是一个 c 开源库,这里我们用一个 c# 的封装库 freetype-sharp来 执行 https://github.com/ryancheung/FreeTypeSharp 这个仓库有各个平台的,我只搞了一个win_x64的进来 ```c# //关键函数,一般的系统都是这样做char->glyph的映射 //这无法处置合字等ttf规则 //用harfbuzz 能实现一个更好的映射 unsafe uint[] String2Glyphs(string text) { List glyphs = new List(); foreach (var c in text) { var index = FT.FT_Get_Char_Index(_ft_face, (System.UIntPtr)c); glyphs.Add(index); Debug.LogWarning(c + "=>" + index); } return glyphs.ToArray(); } ``` ## 2. 使用 harfbuzz 来处理 https://github.com/harfbuzz/harfbuzz