Git Product home page Git Product logo

cosmic-text's Introduction

COSMIC Text

crates.io docs.rs license Rust workflow

Pure Rust multi-line text handling.

COSMIC Text provides advanced text shaping, layout, and rendering wrapped up into a simple abstraction. Shaping is provided by rustybuzz, and supports a wide variety of advanced shaping operations. Rendering is provided by swash, which supports ligatures and color emoji. Layout is implemented custom, in safe Rust, and supports bidirectional text. Font fallback is also a custom implementation, reusing some of the static fallback lists in browsers such as Chromium and Firefox. Linux, macOS, and Windows are supported with the full feature set. Other platforms may need to implement font fallback capabilities.

Screenshots

Arabic translation of Universal Declaration of Human Rights Arabic screenshot

Hindi translation of Universal Declaration of Human Rights Hindi screenshot

Simplified Chinese translation of Universal Declaration of Human Rights Simplified Chinses screenshot

Roadmap

The following features must be supported before this is "ready":

  • Font loading (using fontdb)
    • Preset fonts
    • System fonts
  • Text styles (bold, italic, etc.)
    • Per-buffer
    • Per-span
  • Font shaping (using rustybuzz)
    • Cache results
    • RTL
    • Bidirectional rendering
  • Font fallback
    • Choose font based on locale to work around "unification"
    • Per-line granularity
    • Per-character granularity
  • Font layout
    • Click detection
    • Simple wrapping
    • Wrapping with indentation
    • No wrapping
    • Ellipsize
  • Font rendering (using swash)
    • Cache results
    • Font hinting
    • Ligatures
    • Color emoji
  • Text editing
    • Performance improvements
    • Text selection
    • Can automatically recreate https://unicode.org/udhr/ without errors (see below)
    • Bidirectional selection
    • Copy/paste
  • no_std support (with default-features = false)
    • no_std font loading
    • no_std shaping
    • no_std layout
    • no_std rendering

The UDHR (Universal Declaration of Human Rights) test involves taking the entire set of UDHR translations (almost 500 languages), concatenating them as one file (which ends up being 8 megabytes!), then via the editor-test example, automatically simulating the entry of that file into cosmic-text per-character, with the use of backspace and delete tested per character and per line. Then, the final contents of the buffer is compared to the original file. All of the 106746 lines are correct.

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

cosmic-text's People

Contributors

jackpot51 avatar hojjatabdollahi avatar geieredgar avatar rhelmot avatar hecrj avatar grovesnl avatar genusistimelord avatar tarkah avatar notgull avatar xorgy avatar jasper-bekkers avatar whynothugo avatar ids1024 avatar kettle11 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.