The format is based on Keep a Changelog and this project adheres to Semantic Versioning.
- Add
Direction::AutoRtl
,text_is_rtl
(#80) - Set the default font size to 16px (#80)
Text
API: do not exposeprepare_runs
,required_action
(#81); more tweaks (#84)- Move status tracking and
Env
fields intoText
(#82) - Remove
TextApi
,TextApiExt
andEditableTextApi
traits (#85) - Revise
fonts
module: renameselector::Database
toResolver
, separate outfontdb::Database
, reviseinit
(#87, #88) - Bump MSRV to 1.80.0 (#87)
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).
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
tonew_env
,Text::new_multi
toText::new
and removeText::new_single
. Note: in usage, theEnvironment::wrap
flag is usually set anyway. Environment
is nowCopy
Text::env
returnsEnvironment
by copy not referenceText::env_mut
replaced withText::set_env
, which sets required actionsEnvironment::dir
renamed todirection
- Enum
Direction
adjusted to include bidi and non-bidi modes. Environment::flags
and its typeEnvFlags
removed.Environment::wrap: bool
added andDirection
adjusted (see above).PX_PALIGN
option removed (behaviour is now always enabled).- Parameters
dpp
andpt_size
ofEnvironment
,TextDisplay::prepare_runs
andFormattableText::font_tokens
are replaced with the singledpem
.
Text preparation:
- Add
Action::VAlign
requiring onlyTextDisplay::vertically_align
action - Remove
TextDisplay::prepare
(butTextApi::prepare
remains) TextDisplay::resize_runs
is no longer a public methodTextDisplay::prepare_runs
may callresize_runs
automatically depending on preparation status- Remove
TextApi::resize_runs
andTextApi::prepare_lines
- All
TextApi
andTextApiExt
methods doing any preparation now do all required preparation, and avoid unnecessary steps.
Text measurements (#68):
- Add
TextDisplay::bounding_box
andTextApiExt::bounding_box
(#68, #69) - Add
TextDisplay::measure_width
andTextDisplay::vertically_align
- Add
TextApi::measure_width
andTextApi::measure_height
- Remove
TextDisplay::line_is_ltr
andTextApiExt::line_is_ltr
- Add
TextApiExt::text_is_rtl
TextDisplay::line_is_rtl
andTextApiExt::line_is_rtl
now return typeResult<Option<bool>, NotReady>
, returningOk(None)
if text is emptyTextDisplay::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
andface_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
: removeline_runs
(#71) - Replace
highlight_lines
withhighlight_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)
- Spellcheck documentation (#62)
- Fix selection of best font from a family (#63)
- Document loading order requirements (#59)
- Additional logging of loaded fonts (#59)
This is a minor release (mostly non-breaking). The primary motivation is to
enable resvg
to access the loaded font database. See PR #58:
- Breaking: update dependencies:
bitflags = 1.3.1
,fontdb = 0.6.0
,harfbuzz_rs = 2.0
,rustybuzz = 0.4.0
- Make
fontdb::Database
externally readable and set font families - Additional control over loading fonts
- Performance improvements for alias lookups (trim and capitalise earlier)
- Fix sub-pixel positioning (#57)
- Document
raster
module andMarkdown
formatter (#56) - Export
DPU
(#56) Default
,Debug
andPartialEq
impls for someraster
types (#56)
- Minor optimisations to
SpriteDescriptor::new
(#53)
- Make all families fall back to "sans-serif" fonts.
- Cache
FontLibrary::face_for_char
glyph lookups.
This release replaces all non-Rust dependencies allowing easier build/deployment (though HarfBuzz is kept as an optional dependency). There is also direct support for glyph rastering and some tweaks to improve raster quality making even very small font sizes quite legible.
- Add
Effect::default
method anddefault_aux
param toglyphs_with_effects
(#45) - Replace
font-kit
dependency with the pure-Rustfontdb
using custom font-family lists (#46), with support for run-time configuration (#48) - Support font fallbacks (#47)
- Support rustybuzz for pure-Rust shaping (#47)
- Vertical pixel alignment (#49)
- Extend public API relating to fonts (#49)
- Add (glyph)
raster
module withConfig
struct andSpriteDescriptor
cache key (#50) - Use pixels-per-Em (dpem) for most glyph sizing, not pixels-per-font-unit (DPU) or height (#50)
- Add
Option<Vec2>
return value toTextDisplay::prepare
andTextApi::prepare
(#41) - Fix missing run for empty text lines
- Fix justified text layout (#44)
- Explicitly avoid justifying last line of justified text (#44)
- Update
smallvec
to 0.6.1 - Update
ttf-parser
to 0.12.0
This release changes a very large part of the API. Both prepared
and rich
modules are removed/hidden; three new modules conv
, fonts
and format
are added/exposed. Formatted text traits are added. The API around the main
Text
type changes massively.
- Export
prepared::Text
directly and hide theprepared
module (#30) - Split what was
prepared::Text
intoTextDisplay
(which excludes the text, environment and formatting data but includes positioned glyph information), andText
struct which wrapsTextDisplay
along with text and environment (#32) - Add
TextApi
trait for run-time polymorphism overFormattableText
texts (#32, #33) - Add
TextApiExt
auto-implemented extension-trait (#33) - Add
EditableTextApi
trait (#33) - Replace
prepared::Prepare
withAction
(#30, #33) - Rename
Text::positioned_glyphs
→glyphs
(#31) - Add
Text::glyphs_with_effects
for glyph-drawing with underline/strikethrough (#31, #32) - Make
TextDisplay::prepare_runs
andprepare_lines
functions public (#33) - Support indentation with tab character
\t
(#34)
- Add
Markdown
parser (#29 - #37) - Add
FontToken
struct,FormattableText
andEditableText
traits with impls for&str
,String
andMarkdown
; these allow custom representations of formatted text (#32) - Add
FormattableTextDyn
for run-time polymorphism (#33) - Add
FormattableText::effect_tokens
for custom underlike/strikethrough effects (#34)
- All font API is moved into the public
fonts
module (#28) - Add
FontSelector
andFontLibrary::load_font
,load_pathbuf
functions (#28) - Adjust how loaded fonts are exposed; instead of an
ab_glyph
font we expose the font file data and font index (#30, #31) - Adjust use of font-size units and add documentation (#31, #33)
- Switch dependency from
ab_glyph
tottf-parser
, but keep compatibility withab_glyph
(#31) - Remove
FontScale
data type (unused; #30)
- Add type-conversion helpers
conv::to_32
andto_usize
(#31) - Add
Effect
andEffectFlags
types used for underline and strikethrough (#31) - Add
gat
(Generic Associated Types) experimental feature (#33) - Move
Environment::bidi
andwrap
fields to newflags
field; combinehalign
andvalign
to intoalign
field (#33) - Update
xi-unicode
dependency, allowing cleaner code (#34)
- Rewrite line-wrapping code, supporting must-not-wrap-at-end runs and resulting in much cleaner code (#24)
- Do not allow selection of the position after a space causing a line-wrap (#25)
- Fix alignment for wrapped RTL text with multiple spaces at wrap point (#26)
- Fixes for empty RTL lines (#21, #23)
- When wrapping text against paragraph's direction, do not force a line break (#22)
- Fix re-ordering of runs on a line (#18)
- Add embedding level to result of
Text::text_glyph_pos
(#17) - Fix start offset for wrapped RTL text (#17)
- Fix
Text::line_index_nearest
for right-most position in line (#17)
prepared::Text::positioned_glyphs
now takes anFnMut
closure and emits glyphs in logical order (#13)
Initial release version, comprising:
- basic font loading and font metrics
Environment
specifying font and layout propertiesrich::Text
struct (mostly placeholder around a rawString
)prepared::Text
struct with state tracking required preparation steps
Text preparation includes:
- run-breaking with BIDI support
- glyph shaping via internal algorithm or via HarfBuzz
- line wrapping and alignment
- generating a vec of positioned glyphs
- cursor position lookup (index→coord and coord→index)
- generating highlighting rects for a range