{"id":15195637,"url":"https://github.com/bryik/aframe-bmfont-text-component","last_synced_at":"2025-10-02T11:31:22.094Z","repository":{"id":57174137,"uuid":"61664041","full_name":"bryik/aframe-bmfont-text-component","owner":"bryik","description":"A-Frame component for rendering bitmap fonts.","archived":true,"fork":false,"pushed_at":"2018-10-26T20:23:03.000Z","size":704,"stargazers_count":62,"open_issues_count":0,"forks_count":15,"subscribers_count":6,"default_branch":"master","last_synced_at":"2024-09-28T23:42:44.562Z","etag":null,"topics":["aframe","sdf","text","threejs"],"latest_commit_sha":null,"homepage":"https://bryik.github.io/aframe-bmfont-text-component/","language":"JavaScript","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/bryik.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}},"created_at":"2016-06-21T20:13:52.000Z","updated_at":"2023-01-28T14:32:39.000Z","dependencies_parsed_at":"2022-08-24T14:40:47.745Z","dependency_job_id":null,"html_url":"https://github.com/bryik/aframe-bmfont-text-component","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/bryik%2Faframe-bmfont-text-component","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bryik%2Faframe-bmfont-text-component/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bryik%2Faframe-bmfont-text-component/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bryik%2Faframe-bmfont-text-component/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bryik","download_url":"https://codeload.github.com/bryik/aframe-bmfont-text-component/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":234983164,"owners_count":18917426,"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":["aframe","sdf","text","threejs"],"created_at":"2024-09-27T23:42:54.517Z","updated_at":"2025-10-02T11:31:16.686Z","avatar_url":"https://github.com/bryik.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"**This is an old component!** A-Frame 0.5.0 and up includes SDF text as [a standard component](https://aframe.io/docs/0.5.0/components/text.html). Use that instead!\n\n\u003chr\u003e\n\n## aframe-bmfont-text-component\n\n**Works with A-Frame version 0.3.0.**\n\nThis component is useful for rendering bitmap and signed distance field font text in [A-Frame](https://aframe.io). Basically, it wraps Matt DesLauriers' [three-bmfont-text](https://github.com/Jam3/three-bmfont-text) and [load-bmfont](https://github.com/Jam3/load-bmfont).\n\n![screenshot](http://i.imgur.com/pDDlzAX.png)\n\n## Properties\n\n|    Property   |          Description         |     Default Value     |\n|:-------------:|:----------------------------:|:---------------------:|\n|      text     |  the text you want to appear |          None         |\n|     width     |     width of the text box    |          None         |\n|     align     |   'left', 'center', 'right'  |          left         |\n| letterSpacing | the letter spacing in pixels |           0           |\n|   lineHeight  |   the line height in pixels  |           38          |\n|      fnt      |      path to 'fnt' file      | https://... |\n|    fntImage   |    path to font image file   | https://... |\n|      mode     |      'pre' and 'nowrap'      |        'normal'       |\n|     color     |     by RGB, hex, or name     |          #000         |\n|    opacity    |    Extent of transparency.   |          1.0          |\n\nMore details on these properties [here](https://github.com/Jam3/three-bmfont-text#usage).\n\nExplanation of 'mode' property [here](https://github.com/mattdesl/word-wrapper).\n\n## Usage\n\nWrite some text:\n\n```html\n\u003ca-entity bmfont-text=\"text: Hello World;\"\u003e\u003c/a-entity\u003e\n```\n\nTo change the size of the text, use the [scale](https://aframe.io/docs/0.2.0/components/scale.html) component or position the text closer or further away.\n\nText can be wrapped by specifying width, but I'm not sure what units three-bmfont-text uses. You will have to play around a bit.\n\n## Custom Fonts\n\nA guide for generating SDF fonts can be found [here](https://github.com/libgdx/libgdx/wiki/Distance-field-fonts); here is an example comparing [Arial Black and DejaVu](http://i.imgur.com/iWtXHm5.png). Bitmap fonts also work, but do not look nearly as good.\n\nDifferent fonts can be specified with the 'fnt' and 'fntImage' properties.\n\n```html\n\u003ca-entity bmfont-text=\"text: Hello World; fnt:../fonts/DejaVu-sdf.fnt; fntImage:../fonts/DejaVu-sdf.png\"\u003e\n\u003c/a-entity\u003e\n```\n\nThanks to [jsDelivr](https://www.jsdelivr.com), these default to hosted \"DejaVu-sdf.fnt\" and \"DejaVu-sdf.png\" files.\n\n## Limitations\n\nThis component does not make use of all of the features of [three-bmfont-text](https://github.com/Jam3/three-bmfont-text) and its sister modules, if you require more advanced functionality such as tabSize and start and end indices, I recommend forking this component and modifying it. Pull requests are welcome, but please include a test example.\n\nBitmap font rendering limits you to the characters included in the font (Unicode this is not). SDF font (in particular) tends to smooth sharp edges though [there are ways around this](https://lambdacube3d.wordpress.com/2014/11/12/playing-around-with-font-rendering/).\n\n#### Additional Information\n\nIf you are interested in text rendering in WebGL/ThreeJS/A-Frame and want to learn more, I recommend reading the documentation for [three-bmfont-text](https://github.com/Jam3/three-bmfont-text). \n\nHere are some additional resources:\n\n- ['It’s 2015 and drawing text is still hard (WebGL, ThreeJS)' by Parris Khachi](https://www.eventbrite.com/engineering/its-2015-and-drawing-text-is-still-hard-webgl-threejs/)\n- [Valve's original paper](http://www.valvesoftware.com/publications/2007/SIGGRAPH2007_AlphaTestedMagnification.pdf)\n- ['Hacking with THREE.js' by Matt DesLauriers](http://slides.com/mattdeslauriers/hacking-with-three-js#/13)\n\n## Installation\n\n#### Browser\n\nInstall and use by directly including the [browser files](dist):\n\n```html\n\u003chead\u003e\n  \u003ctitle\u003eMy A-Frame Scene\u003c/title\u003e\n  \u003cscript src=\"https://aframe.io/releases/0.3.0/aframe.min.js\"\u003e\u003c/script\u003e\n  \u003cscript src=\"https://cdn.jsdelivr.net/gh/bryik/aframe-bmfont-text-component@e041ead91a309c924408087a0f7aef0cb870e2f9/dist/aframe-bmfont-text-component.min.js\"\u003e\u003c/script\u003e\n\u003c/head\u003e\n\n\u003cbody\u003e\n  \u003ca-scene\u003e\n    \u003ca-entity bmfont-text=\"text: Hello world\"\u003e\u003c/a-entity\u003e\n  \u003c/a-scene\u003e\n\u003c/body\u003e\n```\n\n#### NPM\n\nInstall via NPM:\n\n```bash\nnpm install aframe-bmfont-text-component\n```\n\nThen register and use.\n\n```js\nrequire('aframe');\nrequire('aframe-bmfont-text-component');\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbryik%2Faframe-bmfont-text-component","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbryik%2Faframe-bmfont-text-component","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbryik%2Faframe-bmfont-text-component/lists"}