Git Product home page Git Product logo

kas-text's Introduction

KAS Text

kas Docs

A pure-Rust rich-text processing library suitable for KAS and other GUI tools.

What it does (or may in the future) do:

  • Font discovery (very limited; system configuration is ignored)
  • Font fallback for missing glyphs
  • Text layout: yield a sequence of positioned glyphs
  • Supports bi-directional text
  • Text shaping (optional) via rustybuzz or harfbuzz
  • Handle combining diacritics correctly
  • Support position navigation / lookup
  • Sub-ligature navigation
  • Visual-order BIDI text navigation
  • Emoticons
  • Rich text: choose font by style/weight/family for a sub-range
  • Text annotations: highlight range, underline
  • Raster glyphs (via ab_glyph or fontdue)
  • Fast-ish: good enough for snappy GUIs; further optimisation possible

What it does not do:

  • Draw: rastering glyphs yields a sequence of sprites. Caching these in a glyph atlas and rendering to a texture is beyond the scope of this project since it is dependent on the graphics libraries used.
  • Editing: mapping input actions (e.g. from a winit WindowEvent) to text edit operations is beyond the scope of this project. The API does cover replacing text ranges and finding the nearest glyph index to a coordinate.
  • Rich text: there is no packaged format for rich text. A FormattableText trait and a (limited) Markdown processor are included.
  • Full text layout: there is no support for custom inter-paragraph gaps, inter-line gaps, embedded images, or horizontal rules.

For more, see the initial design document and issue #1.

Examples

Since kas-text only concerns text-layout, all examples here are courtesy of KAS GUI. See the examples directory.

BIDI layout and editing Markdown

Alternatives

Pure-Rust alternatives for typesetting and rendering text:

  • Swash: font introspection, shaping, character and script analysis, rendering
  • fontdue: rastering and simple layout
  • glyph_brush: rendering and simple layout

Non-pure-Rust alternatives include font-kit and piet among others.

MSRV

The Minium Supported Rust Version is 1.65.0.

Contributing

Contributions are welcome. For the less straightforward contributions it is advisable to discuss in an issue before creating a pull-request.

Testing is currently done in a very ad-hoc manner via KAS examples. This is facilitated by tying KAS commits to kas-text commit hashes during development and allows testing editing as well as display. A comprehensive test framework must consider a huge number of cases and the test framework alone would constitute considerably more work than building this library, so for now user-testing and bug reports will have to suffice.

Copyright and License

The COPYRIGHT file includes a list of contributors who claim copyright on this project. This list may be incomplete; new contributors may optionally add themselves to this list.

The KAS library is published under the terms of the Apache License, Version 2.0. You may obtain a copy of this license from the LICENSE file or on the following web page: https://www.apache.org/licenses/LICENSE-2.0

kas-text's People

Contributors

dhardy 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.