{"id":16694256,"url":"https://github.com/roy-t/truetype","last_synced_at":"2026-03-04T18:03:00.882Z","repository":{"id":80518911,"uuid":"138006870","full_name":"roy-t/TrueType","owner":"roy-t","description":"A TrueType parser for reading, glyphIds, names, descriptions, and kerning information from TrueType fonts","archived":false,"fork":false,"pushed_at":"2023-05-07T19:42:23.000Z","size":92,"stargazers_count":39,"open_issues_count":0,"forks_count":10,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-18T04:12:41.687Z","etag":null,"topics":["font","opentype","parser","truetype","ttf"],"latest_commit_sha":null,"homepage":null,"language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/roy-t.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2018-06-20T09:01:57.000Z","updated_at":"2024-12-12T21:39:01.000Z","dependencies_parsed_at":"2023-06-09T00:45:38.953Z","dependency_job_id":null,"html_url":"https://github.com/roy-t/TrueType","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roy-t%2FTrueType","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roy-t%2FTrueType/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roy-t%2FTrueType/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roy-t%2FTrueType/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/roy-t","download_url":"https://codeload.github.com/roy-t/TrueType/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244855336,"owners_count":20521621,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["font","opentype","parser","truetype","ttf"],"created_at":"2024-10-12T16:44:50.065Z","updated_at":"2026-03-04T18:03:00.822Z","avatar_url":"https://github.com/roy-t.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Roy-T.TrueType\n\n*Current version: 0.2.0*\n\nA TrueType parser for reading, glyphIds, names, descriptions, and kerning information from TrueType fonts. Supports `.NetStandard 2.0`, `.Net 4.6.1` and higher.\n\n\nYou can directly add this library to your project using [NuGet](https://www.nuget.org/packages/RoyT.TrueType/):\n\n```\nInstall-Package RoyT.TrueType\n```\n\n\n\nFor more information please visit my blog at http://roy-t.nl.\n\nTo learn more about the TrueType font format and terminology used here see the [Open Type specification](https://docs.microsoft.com/en-us/typography/opentype/spec/).\n\n\n## Why choose this library?\n- It can read the following tables of all fonts that exist in a standard Windows 10 installation:\n    - [CMAP](https://learn.microsoft.com/en-us/typography/opentype/spec/cmap), character to glyph index mapping table\n    - [KERN](https://learn.microsoft.com/en-us/typography/opentype/spec/kern), inter character spacing (kerning)\n    - [NAME](https://learn.microsoft.com/en-us/typography/opentype/spec/name), multilingual strings for font names, styles, ...\n    - [MAXP](https://learn.microsoft.com/en-us/typography/opentype/spec/maxp), memory requirements\n    - [HMTX](https://learn.microsoft.com/en-us/typography/opentype/spec/hmtx), horizontal metrics table\n    - [VMTX](https://learn.microsoft.com/en-us/typography/opentype/spec/vmtx), vertical metrics table\n    - [HHEA](https://learn.microsoft.com/en-us/typography/opentype/spec/hhea), horizontal header table\n    - [VHEA](https://learn.microsoft.com/en-us/typography/opentype/spec/vhea), vertical header table\n    - [OS2](https://learn.microsoft.com/en-us/typography/opentype/spec/os2) OS/2 and Windows Metric Table\n\n- It exposes both an easy to use API to directly get useful information from these tables, but also exposes the tables themselves so you add your own interpretation of the data\n- It works on both `.Net Core 1.0` and `.Net 4.6.1` and higher by targetting `.Net standard 1.6`\n\n## Limitations\n- This library aims to read meta-information from .ttf files, it does not give you enough information to render glyphs yourself. For that you need OpenType and HarfBuzz.\n\n\n\n## Supported Cmap formats\n[Reference](https://docs.microsoft.com/en-us/typography/opentype/spec/cmap)\n\n| Subtable format | supported/unsupported | remarks |\n|--- | --- | --- |\n| Segmented mapping to delta values | supported | Most common |\n| Trimmed table mapping | supported | |\n| Segmented coverage | supported | |\n| Byte encoding table | supported | Least common |\n| High-byte mapping through table | unsupported | I have not seeen a font that uses this yet, samples welcome |\n| Mixed 16-bit and 32-bit coverage | unsupported | I have not seeen a font that uses this yet, samples welcome |\n| Trimmed array | unsupported | I have not seeen a font that uses this yet, samples welcome |\n| Many-to-one range mappings | unsupported | I have not seeen a font that uses this yet, samples welcome |\n| Unicode Variation Sequences | unsupported | Specifies variations of a single glyph |\n\n\n## Usage example\n\n```csharp\nvar font = TrueTypeFont.FromFile(@\"C:\\Windows\\Fonts\\arial.ttf\");\n\n// Using the helper functions\nvar glyphIndex = GlyphHelper.GetGlyphIndex('A', font);  // 36\nvar horizontalKerning = KerningHelper.GetHorizontalKerning('A', 'W', font);   // -76\nvar name = NameHelper.GetName(NameId.FontSubfamilyName, new CultureInfo(\"nl-NL\"), font); // Standaard\n\n// Diving in deep yourself to get some specific information is also possible\nif (font.KernTable.SubtableCount \u003e 0)\n{\n    var leftCode = GlyphHelper.GetGlyphIndex(left, font);\n    var rightCode = GlyphHelper.GetGlyphIndex(right, font);\n\n    foreach (var subTable in font.KernTable.Subtables)\n    {\n        if (subTable.Format0 != null \u0026\u0026 subTable.Direction == Direction.Vertical\n            \u0026\u0026 subTable.Values == Values.Kerning)\n        {\n            var pair = new KerningPair((ushort)leftCode, (ushort)rightCode);\n\n            if (subTable.Format0.Map.TryGetValue(pair, out var value))\n            {\n                // Do something\n            }\n        }\n    }\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Froy-t%2Ftruetype","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Froy-t%2Ftruetype","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Froy-t%2Ftruetype/lists"}