{"id":13496632,"url":"https://github.com/servo/font-kit","last_synced_at":"2025-03-28T19:30:44.608Z","repository":{"id":37852151,"uuid":"137397940","full_name":"servo/font-kit","owner":"servo","description":"A cross-platform font loading library written in Rust","archived":false,"fork":false,"pushed_at":"2025-03-16T23:01:16.000Z","size":1511,"stargazers_count":718,"open_issues_count":52,"forks_count":111,"subscribers_count":18,"default_branch":"main","last_synced_at":"2025-03-24T08:55:35.403Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/servo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE-APACHE","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":"2018-06-14T19:04:42.000Z","updated_at":"2025-03-21T11:10:38.000Z","dependencies_parsed_at":"2024-06-18T15:59:21.006Z","dependency_job_id":"dc70ffc6-3f15-4352-a89c-4a4abb896454","html_url":"https://github.com/servo/font-kit","commit_stats":{"total_commits":247,"total_committers":48,"mean_commits":5.145833333333333,"dds":0.5546558704453441,"last_synced_commit":"e402aa2905e7f4e5bfe2d0618e497205a3b252a1"},"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/servo%2Ffont-kit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/servo%2Ffont-kit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/servo%2Ffont-kit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/servo%2Ffont-kit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/servo","download_url":"https://codeload.github.com/servo/font-kit/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246088363,"owners_count":20721668,"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-07-31T19:01:53.709Z","updated_at":"2025-03-28T19:30:44.009Z","avatar_url":"https://github.com/servo.png","language":"Rust","funding_links":[],"categories":["Rust"],"sub_categories":[],"readme":"# font-kit\n\n[![Build Status](https://github.com/servo/font-kit/actions/workflows/ci.yml/badge.svg)](https://github.com/servo/font-kit/actions)\n[![crates.io](https://img.shields.io/crates/v/font-kit.svg)](https://crates.io/crates/font-kit)\n[![Documentation](https://docs.rs/font-kit/badge.svg)](https://docs.rs/font-kit)\n\n`font-kit` provides a common interface to the various system font libraries and provides\nservices such as finding fonts on the system, performing nearest-font matching, and rasterizing\nglyphs.\n\n## Synopsis\n\n```rust\nlet font = SystemSource::new()\n    .select_by_postscript_name(\"ArialMT\")\n    .unwrap()\n    .load()\n    .unwrap();\n\nlet glyph_id = font.glyph_for_char('A').unwrap();\nlet mut canvas = Canvas::new(\u0026Size2D::new(32, 32), Format::A8);\n\nfont.rasterize_glyph(\n    \u0026mut canvas,\n    glyph_id,\n    32.0,\n    \u0026Point2D::new(0.0, 32.0),\n    HintingOptions::None,\n    RasterizationOptions::GrayscaleAa,\n)\n.unwrap();\n```\n\n## Backends\n\n`font-kit` delegates to system libraries to perform tasks. It has two types of backends: a *source*\nand a *loader*. Sources are platform font databases; they allow lookup of installed fonts by name\nor attributes. Loaders are font loading libraries; they allow font files (TTF, OTF, etc.) to be\nloaded from a file on disk or from bytes in memory. Sources and loaders can be freely intermixed at\nruntime; fonts can be looked up via DirectWrite and rendered via FreeType, for example.\n\nAvailable loaders:\n\n* Core Text (macOS): The system font loader on macOS. Does not do hinting except when bilevel\n  rendering is in use.\n\n* DirectWrite (Windows): The newer system framework for text rendering on Windows. Does vertical\n  hinting but not full hinting.\n\n* FreeType (cross-platform): A full-featured font rendering framework.\n\nAvailable sources:\n\n* Core Text (macOS): The system font database on macOS.\n\n* DirectWrite (Windows): The newer API to query the system font database on Windows.\n\n* Fontconfig (cross-platform): A technically platform-neutral, but in practice Unix-specific, API\n  to query and match fonts.\n\n* Filesystem (cross-platform): A simple source that reads fonts from a path on disk. This is the\n  default on Android.\n\n* Memory (cross-platform): A source that reads from a fixed set of fonts in memory.\n\n* Multi (cross-platform): A source that allows multiple sources to be queried at once.\n\nOn Windows and macOS, the FreeType loader and the Fontconfig source are not built by default.\nTo build them, use the `loader-freetype` and `source-fontconfig` Cargo features respectively. If\nyou want them to be the default, instead use the `loader-freetype-default` and\n`source-fontconfig-default` Cargo features respectively. Beware that `source-fontconfig-default` is\nrarely what you want on those two platforms!\n\nIf you don't need to locate fonts on the system at all—for example, if all your fonts are stored\nwith your app—then you can omit the default `source` feature and none of that code will be\nincluded.\n\n## Features\n\n`font-kit` is capable of doing the following:\n\n* Loading fonts from files or memory.\n\n* Determining whether files on disk or in memory represent fonts.\n\n* Interoperating with native font APIs.\n\n* Querying various metadata about fonts.\n\n* Doing simple glyph-to-character mapping. (For more complex use cases, a shaper is required;\n  proper shaping is beyond the scope of `font-kit`.)\n\n* Reading unhinted or hinted vector outlines from glyphs.\n\n* Calculating glyph and font metrics.\n\n* Looking up glyph advances and origins.\n\n* Rasterizing glyphs using the native rasterizer, optionally using hinting. (Custom rasterizers,\n  such as Pathfinder, can be used in conjunction with the outline API.)\n\n* Looking up all fonts on the system.\n\n* Searching for specific fonts by family or PostScript name.\n\n* Performing font matching according to the [CSS Fonts Module Level 3] specification.\n\n## Dependencies\n\n**Ubuntu**\n\n`sudo apt install pkg-config libfreetype6-dev libfontconfig1-dev`\n\n## License\n\n`font-kit` is licensed under the same terms as Rust itself.\n\n[CSS Fonts Module Level 3]: https://drafts.csswg.org/css-fonts-3/#font-matching-algorithm\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fservo%2Ffont-kit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fservo%2Ffont-kit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fservo%2Ffont-kit/lists"}