{"id":13307241,"url":"https://github.com/4as/heaps-msdf-text","last_synced_at":"2026-03-19T06:52:08.451Z","repository":{"id":87797367,"uuid":"526774007","full_name":"4as/heaps-msdf-text","owner":"4as","description":"Simple extension of the Heaps' Text class that supports outlines using multi-channel SDF.","archived":false,"fork":false,"pushed_at":"2022-08-21T01:15:42.000Z","size":7731,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-31T04:44:46.311Z","etag":null,"topics":["haxe","heapsio","msdf","sdf"],"latest_commit_sha":null,"homepage":"","language":"Haxe","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/4as.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-08-19T23:05:27.000Z","updated_at":"2022-08-21T21:39:57.000Z","dependencies_parsed_at":null,"dependency_job_id":"e478a45a-a473-4e0d-a428-8e8fba3852a5","html_url":"https://github.com/4as/heaps-msdf-text","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/4as/heaps-msdf-text","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/4as%2Fheaps-msdf-text","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/4as%2Fheaps-msdf-text/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/4as%2Fheaps-msdf-text/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/4as%2Fheaps-msdf-text/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/4as","download_url":"https://codeload.github.com/4as/heaps-msdf-text/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/4as%2Fheaps-msdf-text/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28802063,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-27T03:44:14.111Z","status":"ssl_error","status_checked_at":"2026-01-27T03:43:33.507Z","response_time":168,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["haxe","heapsio","msdf","sdf"],"created_at":"2024-07-29T18:00:15.109Z","updated_at":"2026-01-27T04:32:59.652Z","avatar_url":"https://github.com/4as.png","language":"Haxe","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Introduction\nSimple extension of the Heaps' Text class that supports outlines using multi-channel SDF. Should work as a drop-in replacement for any Text instance you're using. Tested in HashLink, Flash, and HTML5.  \n  \n# Usage  \n##### 1. Creating an SDF texture  \nRendering a font with SDF for Heaps can be a little tricky since not only you need it to be compatible with the shading logic I'm using, you also need to export it in a proper format. Of all the tools I've tried [msdf-gdx-gen](https://github.com/maltaisn/msdf-gdx-gen) gave the best results, however it requires Java to run.  \nHere's an example of a command you can use to create a compatible font:  \n`java -jar msdfgen.jar -t msdf -a sdf -s 64 -r 22 -c latin-9 yourfont.ttf -p 2 -d 2048 2048`  \n  \n##### 2. Instantiating the MSDF font in your application  \nOnce you have your *.fnt* and *.png* files exported, put them somewhere in your project's folder, and then instantiate the related Font object using the `toSdfFont` method.  \n`var fnt:Font = Res.yourfont.toSdfFont(48, SDFChannel.MultiChannel);`  \nNote: Non-multichannel fonts are also supported, but you need to export them using a different set of *msdfgen.jar* export options.  \n  \n##### 3. Create an OutlinedText object and configure it to display the outlines  \nDownload all the classes located in the *src* folder and place them in your project's source folder.  \nFinally you can create the `OutlinedText` object and pass into it the previously instantiated Font:  \n`var txt:OutlinedText = new OutlinedText( fnt );`  \nBy default `OutlinedText` does not display any outlines, so you need to enable them by setting the `outline` property to `true`. Now only thing left to do is to mess around with `OutlinedText`'s properties to create the desired look.  \n  \n*Thickness* controls the cut off point for the font rendering. It's the same value as `alphaCutoff` passed to the `toSdfFont` method but used with reversed logic (ie. `alphaCutoff = 0.2` will result in `thickness = 0.8`).  \n![Thickness example!](/docs/thickness.png)  \n  \n*Smoothness* controls the blur on the edges of the rendered font. It's the same value as `smoothing` passed to the `toSdfFont` method.  \n![Smoothness example!](/docs/smoothness.png)  \n  \n*Outline thickness* controls the cut off point for the outlines. The outlines will be rendered in between this value and the *thickness* value.  \n![Outline thickness example!](/docs/outlineThickness.png)  \n  \n*Outline smoothness* controls the blur on the edges of the rendered outlines.  \n![Outline smoothness example!](/docs/outlineSmoothness.png)  \n  \n##### 4. Miscellaneous stuff  \nSetting the `font` property will instantly reset all outline properties on the `OutlinedText` object. This allows `OutlinedText` to directly replace any `Text` without (hopefully) any changes.  \nIf you want to see some examples on how to use `OutlinedText` check out the *src-example* folder.  \nYou can also check out the results live over here: [4as.github.io/heaps-msdf-text](https://4as.github.io/heaps-msdf-text/)  ","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F4as%2Fheaps-msdf-text","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F4as%2Fheaps-msdf-text","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F4as%2Fheaps-msdf-text/lists"}