{"id":16965029,"url":"https://github.com/propensive/phoenicia","last_synced_at":"2026-05-19T03:49:08.693Z","repository":{"id":223857486,"uuid":"761734396","full_name":"propensive/phoenicia","owner":"propensive","description":"Read TrueType and OpenType fonts in Scala","archived":false,"fork":false,"pushed_at":"2025-01-26T12:14:20.000Z","size":807,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-19T23:34:40.819Z","etag":null,"topics":["font-metrics","fonts","opentype","opentype-fonts","scala","truetype"],"latest_commit_sha":null,"homepage":"","language":"Scala","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/propensive.png","metadata":{"files":{"readme":".github/readme.md","changelog":null,"contributing":".github/contributing.md","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,"publiccode":null,"codemeta":null}},"created_at":"2024-02-22T11:46:07.000Z","updated_at":"2025-01-26T12:14:23.000Z","dependencies_parsed_at":"2024-04-10T18:01:31.930Z","dependency_job_id":"0af82515-eb85-4dd8-af44-956897778f33","html_url":"https://github.com/propensive/phoenicia","commit_stats":null,"previous_names":["propensive/phoenicia"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/propensive%2Fphoenicia","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/propensive%2Fphoenicia/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/propensive%2Fphoenicia/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/propensive%2Fphoenicia/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/propensive","download_url":"https://codeload.github.com/propensive/phoenicia/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244837061,"owners_count":20518559,"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-metrics","fonts","opentype","opentype-fonts","scala","truetype"],"created_at":"2024-10-13T23:44:51.746Z","updated_at":"2026-05-19T03:49:03.670Z","avatar_url":"https://github.com/propensive.png","language":"Scala","funding_links":[],"categories":[],"sub_categories":[],"readme":"[\u003cimg alt=\"GitHub Workflow\" src=\"https://img.shields.io/github/actions/workflow/status/propensive/phoenicia/main.yml?style=for-the-badge\" height=\"24\"\u003e](https://github.com/propensive/phoenicia/actions)\n[\u003cimg src=\"https://img.shields.io/discord/633198088311537684?color=8899f7\u0026label=DISCORD\u0026style=for-the-badge\" height=\"24\"\u003e](https://discord.com/invite/MBUrkTgMnA)\n\u003cimg src=\"/doc/images/github.png\" valign=\"middle\"\u003e\n\n# Phoenicia\n\n__Read TrueType and OpenType fonts in Scala__\n\nTrueType and OpenType fonts have become a _de facto_ standard for describing\nhow character data, or _text_, should be visually rendered. As binary data,\nfont files are not as straightforward to read as many other files. This is\nparticularly true of `TrueType` and `OpenType` fonts, which can include a\nvariety of font-related data, not all of which is needed for all applications:\n_most_ of the data in a font file is exists to describe the shapes of each\nglyph, which is not easy to work with. So usually, reading font files is left\nto graphics software, web browsers or the operating system.\n\nBut there remains useful data (or _metadata_) in a font file which many\napplications can take advantage of. In particular this includes font metrics\ndata, essentially the widths of glyphs, and information about the font's weight\nor slant. _Phoenicia_ provides read-only access to this data.\n\n## Features\n\n- reads TrueType and OpenType font files\n- can read from any [Turbulence](https://github.com/propensive/turbulence/) source\n- access font metrics and calculate widths of individual glyphs or strings of text\n\n\n## Availability\n\n\n\n\n\n\n\n## Getting Started\n\nAll terms and types are defined in the `phoenicia` package:\n```scala\nimport phoenicia.*\n```\n\n### Reading a TTF font\n\nA TrueType font, which usually has the `.ttf` extension, can be loaded from any\nvalue [Turbulence](https://github.com/propensive/turbulence/) source that can\nbe read as `Bytes`, and includes files on disk (using\n[Galilei](https://github.com/propensive/galilei/)), classpath resources (using\n[Hellenism](https://github.com/propensive/hellenism/)) or URLs (using\n[Telekinesis](https://github.com/propensive/telekinesis/)).\n\nA new `Ttf` object can be created using the `Ttf` factory, like so:\n```scala\nval font = Ttf(url\"https://example.com/typography.ttf\")\n```\n\nThis will capture the binary data of the font, but will not interpret it; that\nwill be performed lazily on different parts of the, only when it is needed.\n\n#### Reading an OTF font\n\nCurrently, _Phoenicia_ does not provide any features that are unique to\nOpenType fonts; every feature is supported by both TrueType and OpenType fonts.\nSo it is sufficient to use the `Ttf` factory to load OTF files too. At a later\ntime, it may be necessary to provide an `Otf` factory as well.\n\n### Operations on `Ttf`s\n\nThe only useful operation currently implemented on `Ttf` instances is the\n`advanceWidth` method, which takes a `Char` value and returns its width as a\nnumber of font design units. This width is specifically its _advance width_,\nthe amount of horizontal distance traveled to accommodate the glyph before the\nnext glyph; typically a lower value for a narrow character like `l` than for a\nwide character like `w`.\n\nA related method, width, takes a `Text` value, and returns the sum of the\nadvance widths of its characters, when rendered at normal spacing. The result\nis specified in `ems`, with the type `Quantity[Ems[1]]`.\n\n\n\n## Status\n\nPhoenicia is classified as __embryotic__. For reference, Soundness projects are\ncategorized into one of the following five stability levels:\n\n- _embryonic_: for experimental or demonstrative purposes only, without any guarantees of longevity\n- _fledgling_: of proven utility, seeking contributions, but liable to significant redesigns\n- _maturescent_: major design decisions broady settled, seeking probatory adoption and refinement\n- _dependable_: production-ready, subject to controlled ongoing maintenance and enhancement; tagged as version `1.0.0` or later\n- _adamantine_: proven, reliable and production-ready, with no further breaking changes ever anticipated\n\nProjects at any stability level, even _embryonic_ projects, can still be used,\nas long as caution is taken to avoid a mismatch between the project's stability\nlevel and the required stability and maintainability of your own project.\n\nPhoenicia is designed to be _small_. Its entire source code currently consists\nof 240 lines of code.\n\n## Building\n\nPhoenicia will ultimately be built by Fury, when it is published. In the\nmeantime, two possibilities are offered, however they are acknowledged to be\nfragile, inadequately tested, and unsuitable for anything more than\nexperimentation. They are provided only for the necessity of providing _some_\nanswer to the question, \"how can I try Phoenicia?\".\n\n1. *Copy the sources into your own project*\n   \n   Read the `fury` file in the repository root to understand Phoenicia's build\n   structure, dependencies and source location; the file format should be short\n   and quite intuitive. Copy the sources into a source directory in your own\n   project, then repeat (recursively) for each of the dependencies.\n\n   The sources are compiled against the latest nightly release of Scala 3.\n   There should be no problem to compile the project together with all of its\n   dependencies in a single compilation.\n\n2. *Build with [Wrath](https://github.com/propensive/wrath/)*\n\n   Wrath is a bootstrapping script for building Phoenicia and other projects in\n   the absence of a fully-featured build tool. It is designed to read the `fury`\n   file in the project directory, and produce a collection of JAR files which can\n   be added to a classpath, by compiling the project and all of its dependencies,\n   including the Scala compiler itself.\n   \n   Download the latest version of\n   [`wrath`](https://github.com/propensive/wrath/releases/latest), make it\n   executable, and add it to your path, for example by copying it to\n   `/usr/local/bin/`.\n\n   Clone this repository inside an empty directory, so that the build can\n   safely make clones of repositories it depends on as _peers_ of `phoenicia`.\n   Run `wrath -F` in the repository root. This will download and compile the\n   latest version of Scala, as well as all of Phoenicia's dependencies.\n\n   If the build was successful, the compiled JAR files can be found in the\n   `.wrath/dist` directory.\n\n## Contributing\n\nContributors to Phoenicia are welcome and encouraged. New contributors may like\nto look for issues marked\n[beginner](https://github.com/propensive/phoenicia/labels/beginner).\n\nWe suggest that all contributors read the [Contributing\nGuide](/contributing.md) to make the process of contributing to Phoenicia\neasier.\n\nPlease __do not__ contact project maintainers privately with questions unless\nthere is a good reason to keep them private. While it can be tempting to\nrepsond to such questions, private answers cannot be shared with a wider\naudience, and it can result in duplication of effort.\n\n## Author\n\nPhoenicia was designed and developed by Jon Pretty, and commercial support and\ntraining on all aspects of Scala 3 is available from [Propensive\nO\u0026Uuml;](https://propensive.com/).\n\n\n\n## Name\n\nThe Phoenicians were responsible for creating the first recorded alphabet.\nTheir land, mostly modern-day Lebanon, was _Phoenicia_.\n\nIn general, Soundness project names are always chosen with some rationale,\nhowever it is usually frivolous. Each name is chosen for more for its\n_uniqueness_ and _intrigue_ than its concision or catchiness, and there is no\nbias towards names with positive or \"nice\" meanings—since many of the libraries\nperform some quite unpleasant tasks.\n\nNames should be English words, though many are obscure or archaic, and it\nshould be noted how willingly English adopts foreign words. Names are generally\nof Greek or Latin origin, and have often arrived in English via a romance\nlanguage.\n\n## Logo\n\nThe logo shows a close-up view of a character in a _serif_ font.\n\n## License\n\nPhoenicia is copyright \u0026copy; 2025 Jon Pretty \u0026 Propensive O\u0026Uuml;, and\nis made available under the [Apache 2.0 License](/license.md).\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpropensive%2Fphoenicia","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpropensive%2Fphoenicia","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpropensive%2Fphoenicia/lists"}