{"id":16965002,"url":"https://github.com/propensive/hieroglyph","last_synced_at":"2025-08-04T01:38:00.025Z","repository":{"id":80754927,"uuid":"598532627","full_name":"propensive/hieroglyph","owner":"propensive","description":"Calculate Unicode character display widths in Scala","archived":false,"fork":false,"pushed_at":"2025-02-11T21:56:19.000Z","size":1236,"stargazers_count":1,"open_issues_count":4,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-07-30T22:37:57.867Z","etag":null,"topics":["character-encodings","character-metadata","characters","encodings","scala","unicode","unicode-metadata"],"latest_commit_sha":null,"homepage":"https://soundness.dev/hieroglyph/","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":"2023-02-07T10:00:31.000Z","updated_at":"2025-02-11T21:56:23.000Z","dependencies_parsed_at":"2023-10-11T21:27:55.146Z","dependency_job_id":"121d3221-cb3b-4aec-b00f-43a090d83771","html_url":"https://github.com/propensive/hieroglyph","commit_stats":null,"previous_names":["propensive/hieroglyph"],"tags_count":24,"template":false,"template_full_name":null,"purl":"pkg:github/propensive/hieroglyph","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/propensive%2Fhieroglyph","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/propensive%2Fhieroglyph/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/propensive%2Fhieroglyph/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/propensive%2Fhieroglyph/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/propensive","download_url":"https://codeload.github.com/propensive/hieroglyph/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/propensive%2Fhieroglyph/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268638093,"owners_count":24282484,"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","status":"online","status_checked_at":"2025-08-03T02:00:12.545Z","response_time":2577,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["character-encodings","character-metadata","characters","encodings","scala","unicode","unicode-metadata"],"created_at":"2024-10-13T23:44:48.803Z","updated_at":"2025-08-04T01:37:59.961Z","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/hieroglyph/main.yml?style=for-the-badge\" height=\"24\"\u003e](https://github.com/propensive/hieroglyph/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# Hieroglyph\n\n__Tools for working with characters in Scala__\n\nHieroglyph provides facilities for working with characters, in particular, by providing typesafe\nsupport for different character encodings, and utilizing additional Unicode metadata.\n\n## Features\n\n- specification of character encodings\n- warnings issued if using an encoding which may not be available\n- provides additional character metadata from the Unicode database\n- facilitates accurate text width calculations, particularly for East Asian scripts\n\n\n## Availability\n\n\n\n\n\n\n\n## Getting Started\n\n### Character Display Width\n\nHieroglyph provides an extension method, `displayWidth`, on `Char` which will\nreturn the amount of space the glyph for that character will take up, when\nrendered in a mono-spaced font.\n\nUnsurprisingly, this will usually be `1`, but many characters in alphabets that\nare not based on the Latin Alphabet will need two normal character widths of\nspace when rendered.\n\nFor example, compare,\n```scala\n'x'.displayWidth   // returns 1\n'好'.displayWidth  // returns 2\n```\n\nHowever, calculating the width of a character (and, in particular a string of\ncharacters) will be much slower if every character must be checked individually,\nand totalled, when the `length` field of a string can provide the same value in\nconstant (and fast) time, for strings which are known not to contain any \"wide\"\ncharacters.\n\n[Gossamer](https://github.com/propensive/gossamer/) provides a corresponding\n`displayWidth` extension method on all text-like types, which calculates the\ndisplay width of the entire string by summing its character widths, or, with\n`textMetrics.uniform` in scope, simply returns the `length` value.\n\nTherefore, methods which need to perform text width calculations can use either\na `uniform` mode or an `eastAsianScripts` mode, depending on the contextual\nvalue imported from the `textMetrics` package.\n\n\n\n\n\n## Status\n\nHieroglyph is classified as __fledgling__. 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\nHieroglyph is designed to be _small_. Its entire source code currently consists\nof 393 lines of code.\n\n## Building\n\nHieroglyph 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 Hieroglyph?\".\n\n1. *Copy the sources into your own project*\n   \n   Read the `fury` file in the repository root to understand Hieroglyph'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 Hieroglyph 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 `hieroglyph`.\n   Run `wrath -F` in the repository root. This will download and compile the\n   latest version of Scala, as well as all of Hieroglyph'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 Hieroglyph are welcome and encouraged. New contributors may like\nto look for issues marked\n[beginner](https://github.com/propensive/hieroglyph/labels/beginner).\n\nWe suggest that all contributors read the [Contributing\nGuide](/contributing.md) to make the process of contributing to Hieroglyph\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\nHieroglyph 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\nHieroglyphics are elaborate characters, whose meaning requires interpretation, while _Hieroglyph_ is a library\nwhich provides encodings to translate between characters and their binary representations.\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 is a stylised rendering of the [Unicode](https://home.unicode.org/) logo.\n\n## License\n\nHieroglyph 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%2Fhieroglyph","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpropensive%2Fhieroglyph","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpropensive%2Fhieroglyph/lists"}