{"id":21945260,"url":"https://github.com/ardaku/fonterator","last_synced_at":"2025-12-12T15:01:55.232Z","repository":{"id":38277379,"uuid":"131918275","full_name":"ardaku/fonterator","owner":"ardaku","description":"Load fonts as vector graphics in pure Rust with advanced text layout.","archived":false,"fork":false,"pushed_at":"2023-03-08T11:07:45.000Z","size":6605,"stargazers_count":43,"open_issues_count":5,"forks_count":4,"subscribers_count":1,"default_branch":"stable","last_synced_at":"2025-04-22T21:14:09.742Z","etag":null,"topics":["font","font-collections","footile","opentype","rust","text-layout","truetype","vector-graphics"],"latest_commit_sha":null,"homepage":"https://libcala.github.io/fonterator","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ardaku.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE-APACHE","code_of_conduct":"CODE_OF_CONDUCT.md","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":"2018-05-03T00:00:09.000Z","updated_at":"2025-03-09T11:55:50.000Z","dependencies_parsed_at":"2024-11-29T04:18:10.655Z","dependency_job_id":"80936881-08a6-4731-a346-01c1d7d66fe5","html_url":"https://github.com/ardaku/fonterator","commit_stats":null,"previous_names":["libcala/fonterator"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ardaku%2Ffonterator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ardaku%2Ffonterator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ardaku%2Ffonterator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ardaku%2Ffonterator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ardaku","download_url":"https://codeload.github.com/ardaku/fonterator/tar.gz/refs/heads/stable","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250324709,"owners_count":21411946,"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":["font","font-collections","footile","opentype","rust","text-layout","truetype","vector-graphics"],"created_at":"2024-11-29T04:18:06.635Z","updated_at":"2025-12-12T15:01:54.591Z","avatar_url":"https://github.com/ardaku.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# fonterator\n\n#### Load fonts as vector graphics in pure Rust with advanced text layout.\n\n[![Build Status](https://api.travis-ci.org/ardaku/fonterator.svg?branch=master)](https://travis-ci.org/ardaku/fonterator)\n[![Docs](https://docs.rs/fonterator/badge.svg)](https://docs.rs/fonterator)\n[![crates.io](https://img.shields.io/crates/v/fonterator.svg)](https://crates.io/crates/fonterator)\n\nWhen you want to render text, fonterator gives you an iterator over\n[footile](https://crates.io/crates/footile) `PathOp`s, which you can easily\npass right into footile.\n\n- Loads TTF/OTF fonts and font collections.\n- Automatic kerning and font layout.\n- Horizontal and vertical text layout.\n- Left-to-right and right-to-left text layout.\n- Uses fallback fonts if a character is not available from one font.\n- Can Align text left/center/right/vertical\n- Line Wrapping\n\n### Todo\n- [Arabic and other script text shaping](https://github.com/plopgrizzly/fonterator/issues/3)\n- Better interoperability for monospace when mixing scripts.\n\n## Table of Contents\n- [Getting Started](#getting-started)\n   - [Example](#example)\n   - [API](#api)\n   - [Features](#features)\n- [Upgrade](#upgrade)\n- [License](#license)\n   - [Contribution](#contribution)\n\n## Getting Started\nAdd the following to your `Cargo.toml`.\n\n```toml\n[dependencies]\nfonterator = \"0.8\"\n```\n\n### Example\n```rust,no_run\nuse fonterator as font; // For parsing font file.\n// For rendering text\nuse footile::{FillRule, Plotter, PathOp, Transform};\nuse png_pong::Encoder; // For saving PNG\nuse pix::{\n    Raster,\n    rgb::{Rgba8p, SRgba8},\n    matte::{Matte8},\n    ops::{SrcOver}\n};\n\nconst FONT_SIZE: f32 = 32.0;\n\nfn main() {\n    // Example Text\n    let english = \"Raster Text With Font\";\n    let korean = \"글꼴로 래스터 텍스트 사용\";\n    let japanese = \"フォント付きラスタテキスト\";\n\n    // Init font, and paths.\n    let font = font::monospace_font();\n\n    // Render English Left Aligned.\n    let mut p = Plotter::new(Raster::with_clear(512, 512));\n    let mut r = Raster::with_clear(512, 512);\n    p.set_transform(Transform::with_scale(FONT_SIZE, FONT_SIZE));\n    let path = font.render(\n        english,\n        (512.0 - 64.0) / FONT_SIZE,\n        font::TextAlign::Left\n    ).0;\n    r.composite_matte(\n        (64, 0, 512, 512),\n        p.fill(FillRule::NonZero, path, Matte8::new(255)),\n        (),\n        Rgba8p::new(0, 0, 0, 255),\n        SrcOver,\n    );\n\n    // Render Korean Vertically\n    let mut pr = p.raster();\n    pr.clear();\n    p = Plotter::new(pr);\n    p.set_transform(Transform::with_scale(FONT_SIZE, FONT_SIZE));\n    let path = font.render(\n        korean,\n        512.0 / FONT_SIZE,\n        font::TextAlign::Vertical\n    ).0;\n    r.composite_matte(\n        (0, 0, 512, 512),\n        p.fill(FillRule::NonZero, path, Matte8::new(255)),\n        (),\n        Rgba8p::new(0, 0, 0, 255),\n        SrcOver,\n    );\n\n    // Render Japanese Vertically\n    let mut pr = p.raster();\n    pr.clear();\n    p = Plotter::new(pr);\n    p.set_transform(Transform::with_scale(FONT_SIZE, FONT_SIZE));\n    let path = font.render(\n        japanese,\n        (512.0 - 32.0 * 7.0) / FONT_SIZE,\n        font::TextAlign::Vertical\n    ).0;\n    r.composite_matte(\n        (32, 0, 512, 512),\n        p.fill(FillRule::NonZero, path, Matte8::new(255)),\n        (),\n        Rgba8p::new(0, 0, 0, 255),\n        SrcOver,\n    );\n\n    // Save PNG\n    let raster = Raster::\u003cSRgba8\u003e::with_raster(\u0026r);\n    let mut out_data = Vec::new();\n    let mut encoder = Encoder::new(\u0026mut out_data).into_step_enc();\n    encoder.still(\u0026raster).expect(\"Failed to add frame\");\n    std::fs::write(\"out.png\", out_data).expect(\"Failed to save image\");\n}\n```\n\n### API\nAPI documentation can be found on [docs.rs](https://docs.rs/fonterator).\n\n### Features\n#### `monospace-font`\nEmbeds a monospace font accessible with the `monospace_font()` public API in\nthe root of the crate.\n\n#### `normal-font`\nEmbeds a variable-width font accessible with the `normal_font()` public API in\nthe root of the crate.\n\n## Upgrade\nYou can use the\n[changelog](https://github.com/ardaku/fonterator/blob/stable/CHANGELOG.md)\nto facilitate upgrading this crate as a dependency.\n\n## License\nLicensed under either of\n - Apache License, Version 2.0,\n   ([LICENSE-APACHE](https://github.com/ardaku/fonterator/blob/stable/LICENSE-APACHE) or\n   [https://www.apache.org/licenses/LICENSE-2.0](https://www.apache.org/licenses/LICENSE-2.0))\n - Zlib License,\n   ([LICENSE-ZLIB](https://github.com/ardaku/fonterator/blob/stable/LICENSE-ZLIB) or\n   [https://opensource.org/licenses/Zlib](https://opensource.org/licenses/Zlib))\n\nat your option.\n\n### Contribution\nUnless you explicitly state otherwise, any contribution intentionally submitted\nfor inclusion in the work by you, as defined in the Apache-2.0 license, shall be\ndual licensed as above, without any additional terms or conditions.\n\nContributors are always welcome (thank you for being interested!), whether it\nbe a bug report, bug fix, feature request, feature implementation or whatever.\nDon't be shy about getting involved.  I always make time to fix bugs, so usually\na patched version of the library will be out a few days after a report.\nFeatures requests will not complete as fast.  If you have any questions, design\ncritques, or want me to find you something to work on based on your skill level,\nyou can email me at [jeronlau@plopgrizzly.com](mailto:jeronlau@plopgrizzly.com).\nOtherwise,\n[here's a link to the issues on GitHub](https://github.com/ardaku/fonterator/issues).\nBefore contributing, check out the\n[contribution guidelines](https://github.com/ardaku/fonterator/blob/stable/CONTRIBUTING.md),\nand, as always, make sure to follow the\n[code of conduct](https://github.com/ardaku/fonterator/blob/stable/CODE_OF_CONDUCT.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fardaku%2Ffonterator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fardaku%2Ffonterator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fardaku%2Ffonterator/lists"}