{"id":18041627,"url":"https://github.com/katyo/msdfgen-rs","last_synced_at":"2025-04-09T19:21:33.931Z","repository":{"id":40560461,"uuid":"242827204","full_name":"katyo/msdfgen-rs","owner":"katyo","description":"Rust bindings to msdfgen library","archived":false,"fork":false,"pushed_at":"2024-04-05T03:23:03.000Z","size":137,"stargazers_count":23,"open_issues_count":3,"forks_count":9,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-23T21:11:37.553Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/katyo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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}},"created_at":"2020-02-24T19:43:09.000Z","updated_at":"2024-09-22T15:04:13.000Z","dependencies_parsed_at":"2024-04-05T04:26:09.882Z","dependency_job_id":"e8a9c885-ffce-4e78-9861-2748bf136593","html_url":"https://github.com/katyo/msdfgen-rs","commit_stats":{"total_commits":45,"total_committers":6,"mean_commits":7.5,"dds":0.2666666666666667,"last_synced_commit":"d649c025cb76ac200124b65810d6c0515fd64e9f"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/katyo%2Fmsdfgen-rs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/katyo%2Fmsdfgen-rs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/katyo%2Fmsdfgen-rs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/katyo%2Fmsdfgen-rs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/katyo","download_url":"https://codeload.github.com/katyo/msdfgen-rs/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248095237,"owners_count":21046814,"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":[],"created_at":"2024-10-30T16:11:06.141Z","updated_at":"2025-04-09T19:21:33.896Z","avatar_url":"https://github.com/katyo.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Safe bindings to msdfgen library\n\n[![github](https://img.shields.io/badge/github-katyo/msdfgen--rs-8da0cb.svg?style=for-the-badge\u0026logo=github)](https://github.com/katyo/msdfgen-rs)\n[![crate](https://img.shields.io/crates/v/msdfgen.svg?style=for-the-badge\u0026color=fc8d62\u0026logo=rust)](https://crates.io/crates/msdfgen)\n[![docs](https://img.shields.io/badge/docs.rs-msdfgen-66c2a5?style=for-the-badge\u0026logo=data:image/svg+xml;base64,PHN2ZyByb2xlPSJpbWciIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgdmlld0JveD0iMCAwIDUxMiA1MTIiPjxwYXRoIGZpbGw9IiNmNWY1ZjUiIGQ9Ik00ODguNiAyNTAuMkwzOTIgMjE0VjEwNS41YzAtMTUtOS4zLTI4LjQtMjMuNC0zMy43bC0xMDAtMzcuNWMtOC4xLTMuMS0xNy4xLTMuMS0yNS4zIDBsLTEwMCAzNy41Yy0xNC4xIDUuMy0yMy40IDE4LjctMjMuNCAzMy43VjIxNGwtOTYuNiAzNi4yQzkuMyAyNTUuNSAwIDI2OC45IDAgMjgzLjlWMzk0YzAgMTMuNiA3LjcgMjYuMSAxOS45IDMyLjJsMTAwIDUwYzEwLjEgNS4xIDIyLjEgNS4xIDMyLjIgMGwxMDMuOS01MiAxMDMuOSA1MmMxMC4xIDUuMSAyMi4xIDUuMSAzMi4yIDBsMTAwLTUwYzEyLjItNi4xIDE5LjktMTguNiAxOS45LTMyLjJWMjgzLjljMC0xNS05LjMtMjguNC0yMy40LTMzLjd6TTM1OCAyMTQuOGwtODUgMzEuOXYtNjguMmw4NS0zN3Y3My4zek0xNTQgMTA0LjFsMTAyLTM4LjIgMTAyIDM4LjJ2LjZsLTEwMiA0MS40LTEwMi00MS40di0uNnptODQgMjkxLjFsLTg1IDQyLjV2LTc5LjFsODUtMzguOHY3NS40em0wLTExMmwtMTAyIDQxLjQtMTAyLTQxLjR2LS42bDEwMi0zOC4yIDEwMiAzOC4ydi42em0yNDAgMTEybC04NSA0Mi41di03OS4xbDg1LTM4Ljh2NzUuNHptMC0xMTJsLTEwMiA0MS40LTEwMi00MS40di0uNmwxMDItMzguMiAxMDIgMzguMnYuNnoiPjwvcGF0aD48L3N2Zz4K)](https://docs.rs/msdfgen)\n[![MIT](https://img.shields.io/badge/License-MIT-brightgreen.svg?style=for-the-badge)](https://opensource.org/licenses/MIT)\n[![CI](https://img.shields.io/github/actions/workflow/status/katyo/msdfgen-rs/ci.yml?branch=master\u0026style=for-the-badge\u0026logo=github-actions\u0026logoColor=white)](https://github.com/katyo/msdfgen-rs/actions?query=workflow%3ARust)\n\n## Crates\n\n- [msdfgen-sys](https://crates.io/crates/msdfgen-sys) Low-level unsafe bindings generated using bindgen.\n- [msdfgen](https://crates.io/crates/msdfgen) High-level safe bindings which should be used by applications.\n\n## Features\n\n- __ttf-parse__ Enables [ttf-parser](https://crates.io/crates/ttf-parser) crate integration which allows create shapes for glyphs of specific font.\n- __font__ Enables [font](https://crates.io/crates/font) crate integration which allows create shapes for glyphs of specific font.\n- __freetype-rs__ Enables [freetype-rs](https://crates.io/crates/freetype-rs) crate integration which allows create shapes for glyphs of specific font.\n- __png__ Enables [png](https://crates.io/crates/png) crate integration which allows load and save bitmaps from/as PNG images.\n- __all__ Meta-feature which enables all supported features.\n\n## Usage\n\n```no_run\nuse std::fs::File;\nuse notosans::REGULAR_TTF as FONT;\nuse ttf_parser::Face;\nuse msdfgen::{FontExt, Bitmap, Gray, Range, MsdfGeneratorConfig, FillRule, MID_VALUE};\n\nlet font = Face::from_slice(\u0026FONT, 0).unwrap();\n\nlet glyph = font.glyph_index('A').unwrap();\n\nlet mut shape = font.glyph_shape(glyph).unwrap();\n\nlet width = 32;\nlet height = 32;\n\nlet bound = shape.get_bound();\nlet framing = bound.autoframe(width, height, Range::Px(4.0), None).unwrap();\nlet fill_rule = FillRule::default();\n\nlet mut bitmap = Bitmap::new(width, height);\n\nshape.edge_coloring_simple(3.0, 0);\n\nlet config = MsdfGeneratorConfig::default();\n\nshape.generate_msdf(\u0026mut bitmap, \u0026framing, \u0026config);\n\n// optionally\nshape.correct_sign(\u0026mut bitmap, \u0026framing, fill_rule);\nshape.correct_msdf_error(\u0026mut bitmap, \u0026framing, \u0026config);\n\nlet error = shape.estimate_error(\u0026mut bitmap, \u0026framing, 5, Default::default());\n\nprintln!(\"Estimated error: {}\", error);\n\nbitmap.flip_y();\n\nlet mut output = File::create(\"A-letter-msdf.png\").unwrap();\nbitmap.write_png(\u0026mut output).unwrap();\n\nlet mut preview = Bitmap::\u003cGray\u003cf32\u003e\u003e::new(width * 10, height * 10);\nbitmap.render(\u0026mut preview, Default::default(), MID_VALUE);\n\nlet mut output = File::create(\"A-letter-preview.png\").unwrap();\npreview.write_png(\u0026mut output).unwrap();\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkatyo%2Fmsdfgen-rs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkatyo%2Fmsdfgen-rs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkatyo%2Fmsdfgen-rs/lists"}