{"id":17654042,"url":"https://github.com/tomchen/bdfparser-js","last_synced_at":"2025-05-07T09:14:49.882Z","repository":{"id":62422312,"uuid":"334770906","full_name":"tomchen/bdfparser-js","owner":"tomchen","description":"BDF (Glyph Bitmap Distribution) format bitmap font file parser library in TypeScript (JavaScript) 🔣📜","archived":false,"fork":false,"pushed_at":"2025-01-07T16:32:38.000Z","size":2694,"stargazers_count":21,"open_issues_count":2,"forks_count":3,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-05-05T09:04:44.703Z","etag":null,"topics":["bdf","bdf-font","bdf-fonts","bdf-format","bitmap","bitmap-font","bitmap-fonts","browser","deno","font","node","parser","typescript"],"latest_commit_sha":null,"homepage":"https://font.tomchen.org/bdfparser_js/","language":"TypeScript","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":"2021-01-31T22:31:16.000Z","updated_at":"2025-04-28T14:48:32.000Z","dependencies_parsed_at":"2024-10-23T18:09:50.649Z","dependency_job_id":"b6657de0-10e1-4fc7-b1a6-841d3f3701f4","html_url":"https://github.com/tomchen/bdfparser-js","commit_stats":{"total_commits":21,"total_committers":1,"mean_commits":21.0,"dds":0.0,"last_synced_commit":"71a4ee35ddabe2dd6d2a060e03004e285e43e9c4"},"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomchen%2Fbdfparser-js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomchen%2Fbdfparser-js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomchen%2Fbdfparser-js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomchen%2Fbdfparser-js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tomchen","download_url":"https://codeload.github.com/tomchen/bdfparser-js/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252585815,"owners_count":21772205,"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","bitmap-font","bitmap-fonts","browser","deno","font","node","parser","typescript"],"created_at":"2024-10-23T12:08:26.527Z","updated_at":"2025-05-07T09:14:49.862Z","avatar_url":"https://github.com/tomchen.png","language":"TypeScript","readme":"# BDF Parser TypeScript (JavaScript) library\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 TypeScript (JavaScript). It has [`Font`](https://font.tomchen.org/bdfparser_js/font), [`Glyph`](https://font.tomchen.org/bdfparser_js/glyph) and [`Bitmap`](https://font.tomchen.org/bdfparser_js/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. 0 dependencies and tested in Node.js \u003cimg src=\"https://raw.githubusercontent.com/tomchen/fetchline/main/images/node.svg\" title=\"Node.js\" alt=\"Node.js\" width=\"26px\" height=\"26px\"\u003e, browsers \u003cimg src=\"https://raw.githubusercontent.com/tomchen/fetchline/main/images/chrome.svg\" title=\"Google Chrome\" alt=\"Google Chrome\" width=\"21px\" height=\"21px\"\u003e\u003cimg src=\"https://raw.githubusercontent.com/tomchen/fetchline/main/images/firefox.svg\" title=\"Firefox\" alt=\"Firefox\" width=\"21px\" height=\"21px\"\u003e\u003cimg src=\"https://raw.githubusercontent.com/tomchen/fetchline/main/images/safari.svg\" title=\"Safari\" alt=\"Safari\" width=\"21px\" height=\"21px\"\u003e\u003cimg src=\"https://raw.githubusercontent.com/tomchen/fetchline/main/images/edge.svg\" title=\"Microsoft Edge\" alt=\"Microsoft Edge\" width=\"21px\" height=\"21px\"\u003e\u003cimg src=\"https://raw.githubusercontent.com/tomchen/fetchline/main/images/opera.svg\" title=\"Opera\" alt=\"Opera\" width=\"21px\" height=\"21px\"\u003e\u003cimg src=\"https://raw.githubusercontent.com/tomchen/fetchline/main/images/samsung_internet.svg\" title=\"Samsung Internet\" alt=\"Samsung Internet\" width=\"21px\" height=\"21px\"\u003e (so you can use HTML Canvas) and Deno \u003cimg src=\"https://raw.githubusercontent.com/tomchen/fetchline/main/images/deno.svg\" title=\"Deno\" alt=\"Deno\" width=\"26px\" height=\"26px\"\u003e, it has detailed documentation / tutorials / API reference.\n\n[![npm package](https://img.shields.io/badge/npm%20i-bdfparser-brightgreen)](https://www.npmjs.com/package/bdfparser) [![version number](https://img.shields.io/npm/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) [![Node.js](https://img.shields.io/badge/node-%3E=12.0-brightgreen.svg?logo=node.js)](https://nodejs.org/) [![Deno](https://img.shields.io/badge/deno-%3E=1.13.0-white.svg?logo=deno)](https://deno.land/x/bdfparser) [![License](https://img.shields.io/github/license/tomchen/bdfparser)](https://github.com/tomchen/bdfparser/blob/main/LICENSE)\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\nYou can even try the [**Live Demo \u0026 Code Editor**](https://font.tomchen.org/bdfparser_js/editor)!\n\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\nBelow I'll show you some quick examples, but it is still strongly recommended you go to [**BDF Parser TypeScript (JavaScript) library's official website to read the detailed documentation / tutorials / API reference**](https://font.tomchen.org/bdfparser_js/).\n\nInstall bdfparser TypeScript (JavaScript) library with npm (or `yarn add ...`):\n\n```bash\nnpm install bdfparser readlineiter\n```\n\n`readlineiter` is used for Node.js to read local file. You can instead use `fetchline` for browsers/Deno to fetch remote file. See my [Fetch Line JavaScript packages](https://github.com/tomchen/fetchline).\n\nNon type checked CommonJS example (read [doc](https://font.tomchen.org/bdfparser_js/) for its strict TypeScript ES module code):\n\n```js\nconst { $Font } = require('bdfparser')\nconst getline = require('readlineiter')\n;(async () =\u003e {\n\nconst font = await $Font(getline('./test/fonts/unifont-13.0.04.bdf'))\nconsole.log(`This font's global size is \\\n${font.headers.fbbx} x ${font.headers.fbby} (pixel), \\\nit contains ${font.length} glyphs.`)\n\n# =================================\n\nconst a = font.glyph('a')\nconst c = font.glyph('c')\nconst ac = a\n  .draw()\n  .crop(6, 8, 1, 2)\n  .concat(c.draw().crop(6, 8, 1, 2))\n  .shadow()\nconst ac_8x8 = ac.enlarge(8, 8)\nac_8x8.draw2canvas(document.getElementById('mycanvas').getContext('2d'))\n\n# =================================\n\nconst hello = font.draw('Hello!', {direction: 'rl'}).glow()\nhello.draw2canvas(document.getElementById('mycanvas2').getContext('2d'))\n\n# =================================\n\nconst font_preview = font.drawall()\nfont_preview.draw2canvas(document.getElementById('mycanvas3').getContext('2d'))\n\n})()\n```\n\nIf you are using **Deno** instead of Node.js, you don't need to install the package with npm/yarn, and you should replace `const { $Font } = require('bdfparser'); const getline = require('readlineiter')` by:\n\n```ts\nimport { $Font } from \"https://raw.githubusercontent.com/tomchen/bdfparser-js/main/deno/mod.ts\"\nimport readlineiter from 'https://raw.githubusercontent.com/tomchen/fetchline/main/packages/readlineiter-deno/mod.ts'\n```\n","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftomchen%2Fbdfparser-js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftomchen%2Fbdfparser-js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftomchen%2Fbdfparser-js/lists"}