The format is based on Keep a Changelog and this project adheres to Semantic Versioning.
- Fix: allow font formatting tokens to break text runs (#128)
- Fix: break text runs after horizontal tabs (
\t) (#128)
- Fix: do not match chars which are not not by default presented as emojis as emojis (#125)
- Use ICU4X instead of Swash for text analysis (#119, #122)
- Support Emojis (#121, #122)
- Bump MSRV to 1.88 (#104)
- Bump fontique to 0.7.0 (#106, #107)
- Remove
Rangefrom pub API (#105) - Remove fn
TextDisplay::line_range(#105) - Add fns
{TextDisplay, Text}::{get_line, lines}(#105) - Add fns
Line::{text_range, top, bottom}(#105) - Add parameter
max_linesto fnmeasure_height(#105) - Add fns
FaceStore::{read_name, name_family, name_subfamily, name_full}(#110) - Add struct
LineIterator(#112) - Support
serdeforFamilySelectorandFontSelector(#113) - Fixes for run-breaking and font selection (#104, #106, #107, #110)
- Fix sizing of empty lines by prefering to match some font than nothing (#102)
- Remove
rastermodule (#91) - Removed
FontLibrary::initandText::configure(#94) - Remove support for
harfbuzz_rsandfontdue(#95) - Remove trait
EditableText(#98) - Replace
fontdbwithfontique, replacing usage of hard-coded font families and removing configuration of font aliases (#93, #94) - Revise
FontSelectortype: make into a smallCopytype and embed inTextobjects. Replaces usage of pre-resolvedFontId, allowing font selection to be delayed until run-breaking and to use inferred script. (#94) - Replace field
Effect::auxwithEffect::e(#99) - Support Swash in font library (#91) and use for text analysis (#94)
- Support font synthesis (#95)
- Add
GlyphRuntype, replacing fnsText{,Display}::glyphs{,_with_effects}withruns(#96, #99) - Add fn
TextDisplay::apply_offset(#98, #100) - Fix behaviour of
Align::Stretchin some cases (#100)
- Add
Direction::AutoRtl,text_is_rtl(#80) - Set the default font size to 16px (#80)
TextAPI: do not exposeprepare_runs,required_action(#81); more tweaks (#84)- Move status tracking and
Envfields intoText(#82) - Remove
TextApi,TextApiExtandEditableTextApitraits (#85) - Revise
fontsmodule: renameselector::DatabasetoResolver, 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
NotReadyerror type - Most methods now return
Result<T, NotReady>instead of panicking
Text environment (#68):
- Remove
UpdateEnvtype - Rename
Text::newtonew_env,Text::new_multitoText::newand removeText::new_single. Note: in usage, theEnvironment::wrapflag is usually set anyway. Environmentis nowCopyText::envreturnsEnvironmentby copy not referenceText::env_mutreplaced withText::set_env, which sets required actionsEnvironment::dirrenamed todirection- Enum
Directionadjusted to include bidi and non-bidi modes. Environment::flagsand its typeEnvFlagsremoved.Environment::wrap: booladded andDirectionadjusted (see above).PX_PALIGNoption removed (behaviour is now always enabled).- Parameters
dppandpt_sizeofEnvironment,TextDisplay::prepare_runsandFormattableText::font_tokensare replaced with the singledpem.
Text preparation:
- Add
Action::VAlignrequiring onlyTextDisplay::vertically_alignaction - Remove
TextDisplay::prepare(butTextApi::prepareremains) TextDisplay::resize_runsis no longer a public methodTextDisplay::prepare_runsmay callresize_runsautomatically depending on preparation status- Remove
TextApi::resize_runsandTextApi::prepare_lines - All
TextApiandTextApiExtmethods doing any preparation now do all required preparation, and avoid unnecessary steps.
Text measurements (#68):
- Add
TextDisplay::bounding_boxandTextApiExt::bounding_box(#68, #69) - Add
TextDisplay::measure_widthandTextDisplay::vertically_align - Add
TextApi::measure_widthandTextApi::measure_height - Remove
TextDisplay::line_is_ltrandTextApiExt::line_is_ltr - Add
TextApiExt::text_is_rtl TextDisplay::line_is_rtlandTextApiExt::line_is_rtlnow return typeResult<Option<bool>, NotReady>, returningOk(None)if text is emptyTextDisplay::prepare_linesreturns the bottom-right corner of the bounding box around content instead of the size of content.
Font fallback:
FontLibrary::face_for_charandface_for_char_or_firsttake 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_glyphsfeature flag (#69) - Memory optimisations for
TextDisplay: removeline_runs(#71) - Replace
highlight_lineswithhighlight_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_boundfor 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::Databaseexternally 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
rastermodule andMarkdownformatter (#56) - Export
DPU(#56) Default,DebugandPartialEqimpls for somerastertypes (#56)
- Minor optimisations to
SpriteDescriptor::new(#53)
- Make all families fall back to "sans-serif" fonts.
- Cache
FontLibrary::face_for_charglyph 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::defaultmethod anddefault_auxparam toglyphs_with_effects(#45) - Replace
font-kitdependency with the pure-Rustfontdbusing 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)
rastermodule withConfigstruct andSpriteDescriptorcache 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::prepareandTextApi::prepare(#41) - Fix missing run for empty text lines
- Fix justified text layout (#44)
- Explicitly avoid justifying last line of justified text (#44)
- Update
smallvecto 0.6.1 - Update
ttf-parserto 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::Textdirectly and hide thepreparedmodule (#30) - Split what was
prepared::TextintoTextDisplay(which excludes the text, environment and formatting data but includes positioned glyph information), andTextstruct which wrapsTextDisplayalong with text and environment (#32) - Add
TextApitrait for run-time polymorphism overFormattableTexttexts (#32, #33) - Add
TextApiExtauto-implemented extension-trait (#33) - Add
EditableTextApitrait (#33) - Replace
prepared::PreparewithAction(#30, #33) - Rename
Text::positioned_glyphs→glyphs(#31) - Add
Text::glyphs_with_effectsfor glyph-drawing with underline/strikethrough (#31, #32) - Make
TextDisplay::prepare_runsandprepare_linesfunctions public (#33) - Support indentation with tab character
\t(#34)
- Add
Markdownparser (#29 - #37) - Add
FontTokenstruct,FormattableTextandEditableTexttraits with impls for&str,StringandMarkdown; these allow custom representations of formatted text (#32) - Add
FormattableTextDynfor run-time polymorphism (#33) - Add
FormattableText::effect_tokensfor custom underlike/strikethrough effects (#34)
- All font API is moved into the public
fontsmodule (#28) - Add
FontSelectorandFontLibrary::load_font,load_pathbuffunctions (#28) - Adjust how loaded fonts are exposed; instead of an
ab_glyphfont 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_glyphtottf-parser, but keep compatibility withab_glyph(#31) - Remove
FontScaledata type (unused; #30)
- Add type-conversion helpers
conv::to_32andto_usize(#31) - Add
EffectandEffectFlagstypes used for underline and strikethrough (#31) - Add
gat(Generic Associated Types) experimental feature (#33) - Move
Environment::bidiandwrapfields to newflagsfield; combinehalignandvalignto intoalignfield (#33) - Update
xi-unicodedependency, 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_nearestfor right-most position in line (#17)
prepared::Text::positioned_glyphsnow takes anFnMutclosure and emits glyphs in logical order (#13)
Initial release version, comprising:
- basic font loading and font metrics
Environmentspecifying font and layout propertiesrich::Textstruct (mostly placeholder around a rawString)prepared::Textstruct 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