{"id":18446375,"url":"https://github.com/misterhat/bdf","last_synced_at":"2025-04-15T02:38:37.898Z","repository":{"id":74314866,"uuid":"565641700","full_name":"misterhat/bdf","owner":"misterhat","description":"library for reading and drawing Adobe Glyph Bitmap Distribution font files","archived":false,"fork":false,"pushed_at":"2022-11-14T06:46:21.000Z","size":12,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-16T12:57:33.053Z","etag":null,"topics":["bdf","bitmap-font","canvas"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/misterhat.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":"2022-11-14T02:04:34.000Z","updated_at":"2024-07-28T07:25:03.000Z","dependencies_parsed_at":null,"dependency_job_id":"0fcbab14-ed9e-4bdb-a851-8b09ff4bfefb","html_url":"https://github.com/misterhat/bdf","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/misterhat%2Fbdf","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/misterhat%2Fbdf/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/misterhat%2Fbdf/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/misterhat%2Fbdf/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/misterhat","download_url":"https://codeload.github.com/misterhat/bdf/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248995488,"owners_count":21195558,"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","bitmap-font","canvas"],"created_at":"2024-11-06T07:09:08.985Z","updated_at":"2025-04-15T02:38:37.878Z","avatar_url":"https://github.com/misterhat.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# BDF.js\n\nLibrary for reading and drawing Adobe Glyph Bitmap Distribution font files.\nRead more about this format on\n[Wikipedia](https://en.wikipedia.org/wiki/Glyph_Bitmap_Distribution_Format).\n\n## Example\n```javascript\n// TODO\n```\nAn example Commodore 64 8x8 point font is included.\n\n## API\n\n* **`bdf = new BDF(data)`**__\n\nInitializes a BDF font instance and optionally loads font data string.\n\n* __**`bdf.load(data)`**__\n\nLoads font data string. Throws if unable to parse.\n\n* __**`bdf.meta`**__ (property)\n\nAn object containing metadata about the font once loaded. This includes the font version, name, size and several other properties.\n\nExample meta object:\n```javascript\n{\n  version: '2.1',\n  name: 'c64',\n  size: { points: 8, resolutionX: 75, resolutionY: 75 },\n  boundingBox: { width: 8, height: 8, x: 0, y: -2 },\n  properties: { fontDescent: 2, fontAscent: 6, defaultChar: 0 },\n  totalChars: 95\n}\n```\n\n* __**`bdf.glyphs`**__ (property)\n\nAn object containing data for every glyph in the font. Each key in this object\nrepresents the character encoding.\n\nExample glyphs object:\n```javascript\n{\n  ...\n  '64': { ... }\n  '65': {\n    name: 'C0001',\n    bytes: [Object],\n    bitmap: [Object],\n    code: 65,\n    char: 'A',\n    scalableWidthX: 666,\n    scalableWidthY: 0,\n    deviceWidthX: 8,\n    deviceWidthY: 0,\n    boundingBox: { x: 0, y: -2, width: 8, height: 8 }\n  }\n  '66': { ... }\n  ...\n}\n```\nThe `bitmap` object corresponding to each glyph contains a matrix of\n`1`s and `0`s defining the shape of the glyph in the bounding box.\nExample bitmap object, for the character `'A'` with code `65`:\n(the spaces are `0`s, left out in the example below to make it clearer)\n```javascript\n[\n  [       1 1       ],\n  [     1 1 1 1     ],\n  [   1 1     1 1   ],\n  [   1 1 1 1 1 1   ],\n  [   1 1     1 1   ],\n  [   1 1     1 1   ],\n  [   1 1     1 1   ],\n  [                 ]\n]\n```\nThe `bytes` object corresponding to each glyph is similar to the bitmap\nobject, but each series of eight `1`s and `0`s on a row is encoded in a byte,\ninstead of being laid out as `1`s and `0`s in an array.\nExample bytes object, for the character `'A'` with code `65`:\n`[ 24, 60, 102, 126, 102, 102, 102, 0 ]`\n\n* __**`bdf.writeText(text, options)`**__\n\nConvenient way of creating a matrix concatenating bitmap information for\nseveral glyphs in this font.\n\n`text` is a string containing the text to convert to a bitmap.\n\nThe optional `options` object contains the properties:\n\n* `kerningBias` a number consistently added to the glyph width when building the\nbitmap.\n\nThis method returns an object with a property called `grid`, containing\nbitmap rows, which are arrays of bits. It also contains `width` and `height`\nproperties defining the bitmap bounds.\n\n* __**`bdf.drawText(text, canvas, options)`**__\nRenders a string of text to a canvas.\n\n`text` is a string containing the text to convert to a bitmap.\n\n`canvas` is the desired `Canvas` element or shim to render to.\n\nThe optional `options` object contains the properties:\n\n* `colour` a CSS colour string. default is '#000'.\n* `x` a number describing x offset to draw at. default is 0.\n* `y` a number describing y offset to draw at. default is 0.\n* `scale` a number describing the scale multiplier to apply to each glyph.\ndefault is 1.0.\n* `kerningBias` a number consistently added to the glyph width when building the\nbitmap.\n\n## License\nThis Source Code Form is subject to the terms of the Mozilla Public License, v.\n2.0. If a copy of the MPL was not distributed with this file, You can obtain one\nat http://mozilla.org/MPL/2.0/.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmisterhat%2Fbdf","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmisterhat%2Fbdf","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmisterhat%2Fbdf/lists"}