{"id":17654048,"url":"https://github.com/tomchen/bdfparser","last_synced_at":"2025-04-07T08:15:44.342Z","repository":{"id":39866974,"uuid":"239890011","full_name":"tomchen/bdfparser","owner":"tomchen","description":"BDF (Glyph Bitmap Distribution) format bitmap font file parser library in Python 🔤🔣","archived":false,"fork":false,"pushed_at":"2025-01-07T16:31:13.000Z","size":11730,"stargazers_count":43,"open_issues_count":2,"forks_count":5,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-31T07:04:45.822Z","etag":null,"topics":["bdf","bdf-font","bdf-fonts","bdf-format","bitmap-font","bitmap-fonts","font","parser"],"latest_commit_sha":null,"homepage":"https://font.tomchen.org/bdfparser_py","language":"Python","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/tomchen.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}},"created_at":"2020-02-11T23:59:08.000Z","updated_at":"2025-03-23T04:51:37.000Z","dependencies_parsed_at":"2025-01-15T17:38:31.389Z","dependency_job_id":"ce38f838-349a-4efd-8765-6286d87e6dcf","html_url":"https://github.com/tomchen/bdfparser","commit_stats":{"total_commits":38,"total_committers":2,"mean_commits":19.0,"dds":0.02631578947368418,"last_synced_commit":"b00f392604d8923b6dde0a444a4d78f8e85c787e"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomchen%2Fbdfparser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomchen%2Fbdfparser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomchen%2Fbdfparser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomchen%2Fbdfparser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tomchen","download_url":"https://codeload.github.com/tomchen/bdfparser/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247615377,"owners_count":20967184,"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":["bdf","bdf-font","bdf-fonts","bdf-format","bitmap-font","bitmap-fonts","font","parser"],"created_at":"2024-10-23T12:08:28.350Z","updated_at":"2025-04-07T08:15:44.305Z","avatar_url":"https://github.com/tomchen.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"# BDF Parser Python library\n\n[![PyPI package](https://img.shields.io/badge/pip%20install-bdfparser-brightgreen)](https://pypi.org/project/bdfparser/) [![version number](https://img.shields.io/pypi/v/bdfparser?color=green\u0026label=version)](https://github.com/tomchen/bdfparser/releases) [![Actions Status](https://github.com/tomchen/bdfparser/workflows/Test/badge.svg)](https://github.com/tomchen/bdfparser/actions) [![codecov](https://codecov.io/gh/tomchen/bdfparser/branch/master/graph/badge.svg?token=IMVVQEC04H)](https://codecov.io/gh/tomchen/bdfparser) [![License](https://img.shields.io/github/license/tomchen/bdfparser)](https://github.com/tomchen/bdfparser/blob/master/LICENSE)\n\nBDF (Glyph Bitmap Distribution; [Wikipedia](https://en.wikipedia.org/wiki/Glyph_Bitmap_Distribution_Format); [Spec](https://font.tomchen.org/bdf_spec/)) format bitmap font file parser library in Python. It has [`Font`](https://font.tomchen.org/bdfparser_py/font), [`Glyph`](https://font.tomchen.org/bdfparser_py/glyph) and [`Bitmap`](https://font.tomchen.org/bdfparser_py/bitmap) classes providing more than 30 chainable API methods of parsing BDF fonts, getting their meta information, rendering text in any writing direction, adding special effects and manipulating bitmap images. It works seamlessly with [PIL / Pillow](https://pillow.readthedocs.io/en/stable/) and [NumPy](https://numpy.org/), and has detailed documentation / tutorials / API reference.\n\n**BDF Parser TypeScript (JavaScript) library** ([documentation](https://font.tomchen.org/bdfparser_js/); [GitHub page](https://github.com/tomchen/bdfparser-js); [npm page](https://www.npmjs.com/package/bdfparser); `npm i bdfparser`) is a port of **BDF Parser Python library** ([documentation](https://font.tomchen.org/bdfparser_py/); [GitHub page](https://github.com/tomchen/bdfparser); [PyPI page](https://pypi.org/project/bdfparser/); `pip install bdfparser`). Both are written by [Tom Chen](https://github.com/tomchen/) and under the MIT License.\n\nThe BDF Parser TypeScript (JavaScript) library has a [**Live Demo \u0026 Editor**](https://font.tomchen.org/bdfparser_js/editor) you can try.\n\nBelow I'll show you some quick examples, but it is still strongly recommended you go to [**BDF Parser Python Library's official website to read the detailed documentation / tutorials / API reference**](https://font.tomchen.org/bdfparser_py/).\n\nInstall bdfparser Python library with [pip](https://pip.pypa.io/en/stable/installing/#do-i-need-to-install-pip):\n\n```bash\npip install bdfparser\n```\n\nThen:\n\n```python\nfrom bdfparser import Font\nfont = Font('tests/fonts/unifont-13.0.04.bdf')\nprint(f\"This font's global size is \"\n      f\"{font.headers['fbbx']} x {font.headers['fbby']} (pixel), \"\n      f\"it contains {len(font)} glyphs.\")\n\n# =================================\n\nac = font.glyph(\"a\").draw().crop(6, 8, 1, 2).concat(\n    font.glyph(\"c\").draw().crop(6, 8, 1, 2)\n    ).shadow()\nac_8x8 = ac * 8\n\nfrom PIL import Image\nim_ac = Image.frombytes('RGBA',\n                        (ac_8x8.width(), ac_8x8.height()),\n                        ac_8x8.tobytes('RGBA'))\nim_ac.save(\"ac.png\", \"PNG\")\n\n# =================================\n\nhello = font.draw('Hello!', direction='rl').glow()\nprint(hello)\n\nimport numpy\nimport matplotlib.pyplot as plt\nnparr = numpy.array(hello.todata(2))\nplt.imshow(nparr, 'Blues')\nplt.show()\n\n# =================================\n\nfont_preview = font.drawall()\nim_ac = Image.frombytes('1',\n                        (font_preview.width(), font_preview.height()),\n                        font_preview.tobytes('1'))\nim_ac.save(\"font_preview.png\", \"PNG\")\n```\n\nYou probably understand what I did in these examples. Whether you do or not, go to [**bdfparser's documentation website**](https://font.tomchen.org/bdfparser_py/).\n\n\u003cp align=\"center\"\u003e\n\u003ca href=\"https://font.tomchen.org/bdfparser_py/\"\u003e\n\u003cimg src=\"https://font.tomchen.org/img/bdfparser_py/ac.png\" /\u003e\u003cbr\u003e\n\u003cimg src=\"https://font.tomchen.org/img/bdfparser_py/plot.png\" /\u003e\u003cbr\u003e\n\u003cimg src=\"https://font.tomchen.org/img/bdfparser_py/font_preview_part.png\" /\u003e\n\u003c/a\u003e\n\u003ca href=\"https://font.tomchen.org/bdfparser_js/editor\" title=\"BDF Parser Live Demo \u0026 Code Editor\"\u003e\u003cimg src=\"https://font.tomchen.org/img/bdfparser_js/bdfparser_live_editor_demo.gif\" width=\"700\" alt=\"BDF Parser Live Demo \u0026 Code Editor\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftomchen%2Fbdfparser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftomchen%2Fbdfparser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftomchen%2Fbdfparser/lists"}