{"id":26926050,"url":"https://github.com/takwolf/bdffont-dotnet","last_synced_at":"2025-07-22T04:04:03.527Z","repository":{"id":284114072,"uuid":"953676758","full_name":"TakWolf/bdffont-dotnet","owner":"TakWolf","description":"A library for manipulating Glyph Bitmap Distribution Format (BDF) Fonts","archived":false,"fork":false,"pushed_at":"2025-07-13T07:37:56.000Z","size":4064,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-15T17:58:20.767Z","etag":null,"topics":["bdf","bitmap-font","bitmap-fonts","font","fonts"],"latest_commit_sha":null,"homepage":"https://www.nuget.org/packages/BdfFont","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/TakWolf.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,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-03-23T22:10:37.000Z","updated_at":"2025-07-13T07:38:00.000Z","dependencies_parsed_at":"2025-03-24T08:39:52.728Z","dependency_job_id":"02de0546-7b54-4307-8a0f-2f1f3d3b1428","html_url":"https://github.com/TakWolf/bdffont-dotnet","commit_stats":null,"previous_names":["takwolf/bdffont-dotnet"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/TakWolf/bdffont-dotnet","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TakWolf%2Fbdffont-dotnet","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TakWolf%2Fbdffont-dotnet/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TakWolf%2Fbdffont-dotnet/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TakWolf%2Fbdffont-dotnet/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TakWolf","download_url":"https://codeload.github.com/TakWolf/bdffont-dotnet/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TakWolf%2Fbdffont-dotnet/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266424023,"owners_count":23926124,"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","status":"online","status_checked_at":"2025-07-22T02:00:09.085Z","response_time":66,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["bdf","bitmap-font","bitmap-fonts","font","fonts"],"created_at":"2025-04-02T03:24:23.062Z","updated_at":"2025-07-22T04:04:03.515Z","avatar_url":"https://github.com/TakWolf.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# BdfFont.NET\n\n[![.NET](https://img.shields.io/badge/dotnet-8.0-mediumpurple)](https://dotnet.microsoft.com)\n[![NuGet](https://img.shields.io/nuget/v/BdfFont)](https://www.nuget.org/packages/BdfFont)\n\nBdfFont is a library for manipulating [Glyph Bitmap Distribution Format (BDF) Fonts](https://en.wikipedia.org/wiki/Glyph_Bitmap_Distribution_Format).\n\n## Installation\n\n```shell\ndotnet add package BdfFont\n```\n\n## Usage\n\n### Create\n\n```csharp\nusing BdfSpec;\n\nvar outputsDir = Path.Combine(\"build\");\nif (Directory.Exists(outputsDir))\n{\n    Directory.Delete(outputsDir, true);\n}\nDirectory.CreateDirectory(outputsDir);\n\nvar font = new BdfFont(\n    pointSize: 16,\n    resolution: (75, 75),\n    boundingBox: (16, 16, 0, -2));\n\nfont.Glyphs.Add(new BdfGlyph(\n    name: \"A\",\n    encoding: 65,\n    scalableWidth: (500, 0),\n    deviceWidth: (8, 0),\n    boundingBox: (8, 16, 0, -2),\n    bitmap: [\n        [0, 0, 0, 0, 0, 0, 0, 0],\n        [0, 0, 0, 0, 0, 0, 0, 0],\n        [0, 0, 0, 0, 0, 0, 0, 0],\n        [0, 0, 0, 0, 0, 0, 0, 0],\n        [0, 0, 0, 1, 1, 0, 0, 0],\n        [0, 0, 1, 0, 0, 1, 0, 0],\n        [0, 0, 1, 0, 0, 1, 0, 0],\n        [0, 1, 0, 0, 0, 0, 1, 0],\n        [0, 1, 0, 0, 0, 0, 1, 0],\n        [0, 1, 1, 1, 1, 1, 1, 0],\n        [0, 1, 0, 0, 0, 0, 1, 0],\n        [0, 1, 0, 0, 0, 0, 1, 0],\n        [0, 1, 0, 0, 0, 0, 1, 0],\n        [0, 1, 0, 0, 0, 0, 1, 0],\n        [0, 0, 0, 0, 0, 0, 0, 0],\n        [0, 0, 0, 0, 0, 0, 0, 0]\n    ]));\n\nfont.Properties.Foundry = \"Pixel Font Studio\";\nfont.Properties.FamilyName = \"My Font\";\nfont.Properties.WeightName = \"Medium\";\nfont.Properties.Slant = \"R\";\nfont.Properties.SetWidthName = \"Normal\";\nfont.Properties.AddStyleName = \"Sans Serif\";\nfont.Properties.PixelSize = font.PointSize;\nfont.Properties.PointSize = font.PointSize * 10;\nfont.Properties.ResolutionX = font.ResolutionX;\nfont.Properties.ResolutionY = font.ResolutionY;\nfont.Properties.Spacing = \"P\";\nfont.Properties.AverageWidth = Convert.ToInt32(font.Glyphs.Average(glyph =\u003e glyph.DeviceWidthX * 10));\nfont.Properties.CharsetRegistry = \"ISO10646\";\nfont.Properties.CharsetEncoding = \"1\";\nfont.GenerateNameAsXlfd();\n\nfont.Properties.DefaultChar = -1;\nfont.Properties.FontAscent = 14;\nfont.Properties.FontDescent = 2;\nfont.Properties.XHeight = 7;\nfont.Properties.CapHeight = 10;\nfont.Properties.UnderlinePosition = -2;\nfont.Properties.UnderlineThickness = 1;\n\nfont.Properties.FontVersion = \"1.0.0\";\nfont.Properties.Copyright = \"Copyright (c) TakWolf\";\n\nfont.Save(Path.Combine(outputsDir, \"my-font.bdf\"));\n```\n\n### Load\n\n```csharp\nusing BdfSpec;\n\nvar outputsDir = Path.Combine(\"build\");\nif (Directory.Exists(outputsDir))\n{\n    Directory.Delete(outputsDir, true);\n}\nDirectory.CreateDirectory(outputsDir);\n\nvar font = BdfFont.Load(Path.Combine(\"assets\", \"unifont\", \"unifont-16.0.04.bdf\"));\nConsole.WriteLine($\"name: {font.Name}\");\nConsole.WriteLine($\"size: {font.PointSize}\");\nConsole.WriteLine($\"ascent: {font.Properties.FontAscent}\");\nConsole.WriteLine($\"descent: {font.Properties.FontDescent}\");\nConsole.WriteLine();\nforeach (var glyph in font.Glyphs)\n{\n    Console.WriteLine($\"char: {char.ConvertFromUtf32(glyph.Encoding)} ({glyph.Encoding:X4})\");\n    Console.WriteLine($\"glyphName: {glyph.Name}\");\n    Console.WriteLine($\"advanceWidth: {glyph.DeviceWidthX}\");\n    Console.WriteLine($\"dimensions: {glyph.Dimensions}\");\n    Console.WriteLine($\"offset: {glyph.Offset}\");\n    foreach (var bitmapRow in glyph.Bitmap)\n    {\n        var text = string.Join(\"\", bitmapRow).Replace(\"0\", \"  \").Replace(\"1\", \"██\");\n        Console.WriteLine($\"{text}*\");\n    }\n    Console.WriteLine();\n}\nfont.Save(Path.Combine(outputsDir, \"unifont-16.0.04.bdf\"));\n```\n\n## References\n\n- [X11 - Bitmap Distribution Format - Version 2.1](https://www.x.org/docs/BDF/bdf.pdf)\n- [Adobe - Glyph Bitmap Distribution Format (BDF) Specification - Version 2.2](https://adobe-type-tools.github.io/font-tech-notes/pdfs/5005.BDF_Spec.pdf)\n- [X Logical Font Description Conventions - X Consortium Standard](https://www.x.org/releases/current/doc/xorg-docs/xlfd/xlfd.html)\n\n## License\n\n[MIT License](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftakwolf%2Fbdffont-dotnet","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftakwolf%2Fbdffont-dotnet","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftakwolf%2Fbdffont-dotnet/lists"}