Skip to content

Releases: kas-gui/kas-text

0.7.0

02 Dec 14:57
c1c0f2a
Compare
Choose a tag to compare

What's Changed

  • Add Direction::AutoRtl, text_is_rtl (#80)
  • Set the default font size to 16px (#80)
  • Text API: do not expose prepare_runs, required_action (#81); more tweaks (#84)
  • Move status tracking and Env fields into Text (#82)
  • Remove TextApi, TextApiExt and EditableTextApi traits (#85)
  • Revise fonts module: rename selector::Database to Resolver, separate out fontdb::Database, revise init (#87, #88)
  • Bump MSRV to 1.80.0 (#87)

Full Changelog: 0.6.0...0.7.0

0.6.0

13 Dec 16:08
077f315
Compare
Choose a tag to compare

Stabilise support for Generic Associated Types (GATs). This requires Rust 1.65.0, removes the gat feature flag and affects the FormattableText trait. #75

Bump dependency versions: ttf-parser v0.17.1, rustybuzz v0.6.0 (#76), fontdb v0.10.0 (#77).

0.5.0

20 Aug 10:50
e4a66fd
Compare
Choose a tag to compare

Error handling (#65):

  • Add NotReady error type
  • Most methods now return Result<T, NotReady> instead of panicking

Text environment (#68):

  • Remove UpdateEnv type
  • Rename Text::new to new_env, Text::new_multi to Text::new and
    remove Text::new_single. Note: in usage, the Environment::wrap flag
    is usually set anyway.
  • Environment is now Copy
  • Text::env returns Environment by copy not reference
  • Text::env_mut replaced with Text::set_env, which sets required actions
  • Environment::dir renamed to direction
  • Enum Direction adjusted to include bidi and non-bidi modes.
  • Environment::flags and its type EnvFlags removed.
    Environment::wrap: bool added and Direction adjusted (see above).
    PX_PALIGN option removed (behaviour is now always enabled).
  • Parameters dpp and pt_size of Environment, TextDisplay::prepare_runs
    and FormattableText::font_tokens are replaced with the single dpem.

Text preparation:

  • Add Action::VAlign requiring only TextDisplay::vertically_align action
  • Remove TextDisplay::prepare (but TextApi::prepare remains)
  • TextDisplay::resize_runs is no longer a public method
  • TextDisplay::prepare_runs may call resize_runs automatically depending
    on preparation status
  • Remove TextApi::resize_runs and TextApi::prepare_lines
  • All TextApi and TextApiExt methods doing any preparation now do all
    required preparation, and avoid unnecessary steps.

Text measurements (#68):

  • Add TextDisplay::bounding_box and TextApiExt::bounding_box (#68, #69)
  • Add TextDisplay::measure_width and TextDisplay::vertically_align
  • Add TextApi::measure_width and TextApi::measure_height
  • Remove TextDisplay::line_is_ltr and TextApiExt::line_is_ltr
  • Add TextApiExt::text_is_rtl
  • TextDisplay::line_is_rtl and TextApiExt::line_is_rtl now return type
    Result<Option<bool>, NotReady>, returning Ok(None) if text is empty
  • TextDisplay::prepare_lines returns the bottom-right corner of the bounding
    box around content instead of the size of content.

Font fallback:

  • FontLibrary::face_for_char and face_for_char_or_first take an extra
    parameter: last_face_id: Option<FaceId>. This allows the font fallback
    mechanism to avoid switching the font unnecessarily. In usage, letters and
    numbers are selected as before while other characters are selected from the
    last font face used if possible, resulting in longer runs being passed to
    the shaper when using fallback fonts.

Misc:

  • CI: test stable and check Clippy lints (#69).
  • Add Range::is_empty
  • Add num_glyphs feature flag (#69)
  • Memory optimisations for TextDisplay: remove line_runs (#71)
  • Replace highlight_lines with highlight_range (#72)
  • Add fonts::any_loaded (#73)

Fixes:

  • Do not add "line gap" before first line. (In practice this is often 0 anyway.)
  • Do not vertically align text too tall for the input bounds.
  • Markdown formatter: use heading level sizes as defined by CSS
  • Fix position of text highlights on vertically aligned text (#67).
  • Fix r_bound for trailing space (#71)

0.4.3

20 Aug 11:40
Compare
Choose a tag to compare
  • Revert API-breaking spelling change: Align::CentreAlign::Center