{"id":13835897,"url":"https://github.com/Blatko1/wgpu-text","last_synced_at":"2025-07-10T13:30:43.349Z","repository":{"id":42446372,"uuid":"464183479","full_name":"Blatko1/wgpu-text","owner":"Blatko1","description":"📜A simple 2D text renderer for wgpu📜","archived":false,"fork":false,"pushed_at":"2025-04-11T18:44:23.000Z","size":1685,"stargazers_count":108,"open_issues_count":2,"forks_count":11,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-19T05:17:55.417Z","etag":null,"topics":["2d","font","glyph","graphics","render","rust","text","wgpu"],"latest_commit_sha":null,"homepage":"https://docs.rs/wgpu_text","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/Blatko1.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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-02-27T16:00:50.000Z","updated_at":"2025-06-18T18:33:59.000Z","dependencies_parsed_at":"2024-01-13T16:50:24.520Z","dependency_job_id":"d7490b67-c8cf-4b7f-b3c2-1bd8686be365","html_url":"https://github.com/Blatko1/wgpu-text","commit_stats":{"total_commits":168,"total_committers":5,"mean_commits":33.6,"dds":"0.19047619047619047","last_synced_commit":"2a6af5bbbd1e5be1ff2f6e913c7aaf35fd201deb"},"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/Blatko1/wgpu-text","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Blatko1%2Fwgpu-text","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Blatko1%2Fwgpu-text/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Blatko1%2Fwgpu-text/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Blatko1%2Fwgpu-text/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Blatko1","download_url":"https://codeload.github.com/Blatko1/wgpu-text/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Blatko1%2Fwgpu-text/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264585372,"owners_count":23632645,"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":["2d","font","glyph","graphics","render","rust","text","wgpu"],"created_at":"2024-08-04T15:00:22.179Z","updated_at":"2025-07-10T13:30:43.344Z","avatar_url":"https://github.com/Blatko1.png","language":"Rust","funding_links":[],"categories":["Font/Text Library"],"sub_categories":["Rust 2D renderer"],"readme":"# wgpu-text\n\n[![Build Status](https://img.shields.io/github/actions/workflow/status/blatko1/wgpu-text/rust.yml?logo=github)](https://github.com/Blatko1/wgpu-text/actions)\n[![Licence](https://img.shields.io/github/license/Blatko1/wgpu-text?color=%23537aed)](https://github.com/Blatko1/wgpu-text/blob/master/LICENSE)\n[![crates.io](https://img.shields.io/crates/v/wgpu_text?logo=rust\u0026logoColor=%23bf7d36)](https://crates.io/crates/wgpu_text)\n[![Documentation](https://img.shields.io/docsrs/wgpu_text)](https://docs.rs/wgpu_text)\n\n**`wgpu-text`** is a wrapper over **[`glyph-brush`](https://github.com/alexheretic/glyph-brush)** for **fast** and **easy** text rendering by **_[`wgpu`](https://github.com/gfx-rs/wgpu)_**. It supports **.otf** and **.ttf** fonts.\n\n\u003cimg src=\"showcase.png\" align=\"right\" style=\"padding: 0px 0px 5px 4px; margin-top: -10px\" alt=\"Library Lorem Ipsum Showcase\" width=\"300vw\"\u003e\n\nThis project was inspired by and is similar to **[`wgpu_glyph`](https://github.com/hecrj/wgpu_glyph)** but has additional features and is more straightforward. Also, there is no need to include **glyph-brush** in your project.\n\nSince the **glyph-brush** crate is *reexported* and being heavily dependent on, it's recommended to go through [Section docs](https://docs.rs/glyph_brush/latest/glyph_brush/struct.Section.html) and [Section examples](https://github.com/alexheretic/glyph-brush/tree/master/gfx-glyph/examples) for better understanding of managing and adding text.\n\n## **Installation**\n\nAdd the following to your `Cargo.toml` file:\n\n```toml\n[dependencies]\nwgpu_text = \"0.9.3\"\n```\n\n## **Usage**\n\n```rust\nuse wgpu_text::{glyph_brush::{Section as TextSection, Text}, BrushBuilder, TextBrush};\n\nlet brush = BrushBuilder::using_font_bytes(font).unwrap()\n /* .initial_cache_size((16_384, 16_384))) */ // use this to avoid resizing cache texture\n    .build(\u0026device, config.width, config.height, config.format);\n\n// Directly implemented from glyph_brush.\nlet section = TextSection::default().add_text(Text::new(\"Hello World\"));\n\n// on window resize:\n        brush.resize_view(config.width as f32, config.height as f32, \u0026queue);\n\n// window event loop:\n    winit::event::Event::RedrawRequested(_) =\u003e {\n        // Before are created Encoder and frame TextureView.\n\n        // Crashes if inner cache exceeds limits.\n        brush.queue(\u0026device, \u0026queue, [\u0026section, ...]).unwrap();\n\n        {\n            let mut rpass = encoder.begin_render_pass(...);\n            brush.draw(\u0026mut rpass);\n        }\n\n        queue.submit([encoder.finish()]);\n        frame.present();\n    }\n```\n\n## **Examples**\n\nFor more detailed examples, look through [examples](https://github.com/Blatko1/wgpu_text/tree/master/examples).\n\n* `cargo run --example \u003cexample-name\u003e`\n\nRun examples with `--release` for accurate performance.\n\n## **Features**\n\nBesides basic text rendering and **glyph-brush** features, some features add customization:\n\n- **builtin matrix** - default matrix for orthographic projection (feel free to use it for creating custom matrices)\n- **custom matrix** - grants the ability to provide a custom matrix for purposes of custom view, rotation, etc. (the downside is that it applies to all rendered text)\n- **depth testing** - by adding a *z* coordinate, text can be set on top or below other text (if enabled). Watch out for the queueing order when queueing *text sections*. You should queue them from the furthest to the closest (according to the *z* coordinate, bigger the *z*, more further it is).\n\n## **Contributing**\n\nAll kinds of contributions are welcome.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FBlatko1%2Fwgpu-text","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FBlatko1%2Fwgpu-text","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FBlatko1%2Fwgpu-text/lists"}