{"id":23007451,"url":"https://github.com/xor-bits/fontsdf","last_synced_at":"2025-08-14T03:31:37.769Z","repository":{"id":44414105,"uuid":"490033364","full_name":"xor-bits/fontsdf","owner":"xor-bits","description":"Fonts =\u003e Signed Distance Fields","archived":false,"fork":false,"pushed_at":"2023-04-21T15:56:20.000Z","size":264,"stargazers_count":8,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-08-12T17:34:38.858Z","etag":null,"topics":["font","game-development","rust","sdf-2d"],"latest_commit_sha":null,"homepage":"","language":"Rust","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/xor-bits.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","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-05-08T19:12:58.000Z","updated_at":"2025-04-11T00:02:40.000Z","dependencies_parsed_at":"2024-12-15T08:15:48.436Z","dependency_job_id":"bb426533-10a3-4d0d-a1a9-6974eb471365","html_url":"https://github.com/xor-bits/fontsdf","commit_stats":null,"previous_names":["overpeek/fontsdf"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/xor-bits/fontsdf","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xor-bits%2Ffontsdf","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xor-bits%2Ffontsdf/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xor-bits%2Ffontsdf/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xor-bits%2Ffontsdf/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xor-bits","download_url":"https://codeload.github.com/xor-bits/fontsdf/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xor-bits%2Ffontsdf/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270220167,"owners_count":24547514,"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","status":"online","status_checked_at":"2025-08-13T02:00:09.904Z","response_time":66,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["font","game-development","rust","sdf-2d"],"created_at":"2024-12-15T08:15:39.466Z","updated_at":"2025-08-14T03:31:37.446Z","avatar_url":"https://github.com/xor-bits.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n\n# fontsdf\n\n[![dependency status](https://deps.rs/repo/github/Overpeek/fontsdf/status.svg)](https://deps.rs/repo/github/Overpeek/fontsdf)\n[![build status](https://github.com/Overpeek/fontsdf/actions/workflows/rust.yml/badge.svg)](https://github.com/Overpeek/fontsdf/actions)\n[![crates.io](https://img.shields.io/crates/v/fontsdf.svg?label=fontsdf)](https://crates.io/crates/fontsdf)\n[![docs.rs](https://docs.rs/fontsdf/badge.svg)](https://docs.rs/fontsdf/)\n\n\u003c/div\u003e\n\nSigned Distance Field (SDF) textures can be used to render text\nor other vector art more flexibly[1], with higher quality while\nusing less video memory (for the texture).\n\nThis `no_std` library renders SDF:s **directly** and not by downscaling a higher resolution rasters.\n\n[1] For example:\n\n- It is possible to use single a 64px glyph to render both 14px\n  and 200px glyphs.\n- It is easy to add glow, outlines and such.\n\n### Comparisons:\n\n#### NOTE: Use fontdue for simple glyphs instead. It is a lot faster.\n\n| Task                         | SDF     | regular  |\n|-----------------------------:|:-------:|:--------:|\n| High resolution glyphs       | \u0026check; | \u0026check;  |\n| Medium resolution glyphs     | \u0026check; | \u0026check;  |\n| Low resolution glyphs        |         | \u0026check;  |\n| Stretched or squished glyphs | \u0026check; |          |\n| Shadows borders and effects  | \u0026check; |          |\n| GUI:s                        |         | \u0026check;  |\n| 3D game worlds               | \u0026check; |          |\n\n* :white_check_mark: means it is good at\n\n### Example usage with `image`:\n\n```rust\nlet font = fontsdf::Font::from_bytes(..).unwrap();\n\nlet (metrics, sdf) = font.rasterize('x', 64.0, true);\nimage::GrayImage::from_raw(metrics.width as _, metrics.height as _, sdf)\n\t.unwrap()\n\t.save(\"sdf_x.png\")\n\t.unwrap();\n```\n\n### Example output:\n\n#### Normal\n\n\u003cdiv style=\"display: flex; align-items: center;\"\u003e\n\t\u003cimg src=\"/.github/hash_norm.png\"/\u003e\n\t\u003cimg src=\"/.github/a_norm.png\"/\u003e\n\u003c/div\u003e\n\n#### SDF\n\n\u003cdiv style=\"display: flex; align-items: center;\"\u003e\n\t\u003cimg src=\"/.github/hash_sdf.png\"/\u003e\n\t\u003cimg src=\"/.github/a_sdf.png\"/\u003e\n\u003c/div\u003e\n\n### Example results:\n\n#### Normal\n\n- 128x156\n- 80px font size\n\n\u003cdiv style=\"display: flex; align-items: center;\"\u003e\n\t\u003cimg src=\"/.github/norm_glyphs.png\"/\u003e\n\t\u003cimg src=\"/.github/norm_text.png\"/\u003e\n\u003c/div\u003e\n\n#### SDF\n\n- 128x128\n- 48px (+radius) font size (32px input size should be enough for any output size)\n- 'free' shadow\n\n\u003cdiv style=\"display: flex; align-items: center;\"\u003e\n\t\u003cimg src=\"/.github/sdf_glyphs.png\"/\u003e\n\t\u003cimg src=\"/.github/sdf_text.png\"/\u003e\n\u003c/div\u003e\n\n### TODO:\n\n- dual distance field (https://steamcdn-a.akamaihd.net/apps/valve/2007/SIGGRAPH2007_AlphaTestedMagnification.pdf)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxor-bits%2Ffontsdf","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxor-bits%2Ffontsdf","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxor-bits%2Ffontsdf/lists"}