From 552e05d498da1dce78f8824ec5c98bde2c21d44e Mon Sep 17 00:00:00 2001 From: dnesov Date: Sun, 29 Jun 2025 14:09:11 +0200 Subject: [PATCH] WIP: use Unicode for charmaps inside a font, try read all unicode symbols. --- Voile/Source/Resources/Loaders/FontLoader.cs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Voile/Source/Resources/Loaders/FontLoader.cs b/Voile/Source/Resources/Loaders/FontLoader.cs index 5bf60c2..67b5eca 100644 --- a/Voile/Source/Resources/Loaders/FontLoader.cs +++ b/Voile/Source/Resources/Loaders/FontLoader.cs @@ -48,6 +48,17 @@ public class FontLoader : ResourceLoader error = FT_New_Memory_Face(*lib, (byte*)handle.Pointer, (nint)font.BufferSize, 0, &face); error = FT_Set_Pixel_Sizes(face, 0, (uint)font.Size); + error = FT_Select_Charmap(face, FT_Encoding_.FT_ENCODING_UNICODE); + + uint gid; + var charcode = FT_Get_First_Char(face, &gid); + + while (gid != 0) + { + Console.WriteLine($"Codepoint: {(char)charcode}, gid {gid}"); + charcode = FT_Get_Next_Char(face, charcode, &gid); + } + error = FT_Load_Char(face, 'F', FT_LOAD_NO_BITMAP); var metrics = face->glyph->metrics;