- Update twox-hash to 2.
- Fix conversions from OwnedSection -> Section with non-default extra type.
- Add
GlyphCruncher::glyphs
doc example of usingsection_index
&byte_index
. - Update rustc-hash to 2.
- Update ordered-float to 4.
- Allow
Text::new
to work with anyX
type. This may break usage, however it will hopefully be non-breaking in practice as the compiler should always be able to infer this. - Add
Section::builder
for more flexibleX
/"extra" type usage thanSection::default
& for owned text too. - Add more flexible
X
type usage toGlyphBrush::keep_cached
. - Add
Section::from(text)
&Section::from(vec![text])
conversions. - Update
GlyphCruncher::glyphs
,GlyphCruncher::glyph_bounds
docs.
- Removed log dependency.
- Implement
Eq
forBrushError
.
- Update ordered-float to 3.
- Add documentation of
GlyphBrush
generic types & workarounds when.build()
type inference fails. - wasm: Fix twox-hash compilation.
- Add
GlyphBrushBuilder::multithread
to allow setting the (default on) draw-cache multithreading.
- Update ordered-float to 2.
- OpenType (.otf) fonts are now supported in addition to .ttf fonts. They're just as fast as .ttf fonts too.
- Rework crate switching from rusttype to ab_glyph. ab_glyph is re-exported to
glyph_brush::ab_glyph
, rusttype types are gone, e.g. all usage ofrusttype::Scale
is replaced withab_glyph::PxScale
. - New
Section
struct redesign replacesVariedSection
& the oldSection
supporting generic extra data & builder syntax.// 0.7: Optional builder style, one API for simple & varied sections Section::default().add_text(Text::new("Hello").with_scale(25.0))
// 0.6 Section { text: "Hello", scale: Scale::uniform(25.0), ..<_>::default() }
- Section
color
&z
are now part of anExtra
struct which is the defaultextra
type. This allows previous usage to continue but also downstream users to use differentExtra
data. This data is provided to the vertex generator function. - To aid with refactoring from the previous version some equivalent versions of legacy structs are available
legacy::{VariedSection, Section, SectionText}
. So in some cases you can just slaplegacy::
in front of the old code and fix somePxScale
usages and away you go. I'll deprecate and eventually remove this module.// 0.7 legacy::Section { text: "Hello", scale: PxScale::from(25.0), ..<_>::default() }
pixel_bounds
has been removed, useglyph_bounds
instead. Pixel bound info is not available for OpenType glyphs without calculating outlines. I've found it's almost always better to useglyph_bounds
instead anyway, if not please open an issue with your use case.- Rename
gpu_cache_*
methods todraw_cache_*
. Also note, overriding the default position_tolerance may be less necessary as the new draw cache features subpixel position error correction.// 0.7 GlyphBrushBuilder::using_font(font).draw_cache_position_tolerance(0.1).build()
// 0.6 GlyphBrushBuilder::using_font(font).gpu_cache_position_tolerance(0.1).build()
- Rename
cache_glyph_drawing
tocache_redraws
for clarity. - New crate glyph_brush_draw_cache takes rusttype's
gpu_cache
module into the ab_glyph world and starts to improve upon it. - New glyph_brush_layout now providers
section_index
&byte_index
for all laid out glyphs. It no longer relies on any pixel bounding box info, which isn't fast to query with .otf fonts. This also means invisible glyphs, like ' ', are now generally included and hence will be returned byGlyphCruncher::glyphs
. - Add
GlyphBrush::is_draw_cached
which can be used to tell if a given queued & processed glyph is visible or not. - It's faster. ~1.07-1.64x faster than
0.6
(particularly in the worst case full-layout performance). Rasterization is also ~2-7x faster using ab_glyph_rasterizer.
- Fix section color & alpha frame to frame changes to be incorrectly optimised as alpha only changes.
- Add
GlyphBrushBuilder::without_fonts()
for creating a brush without any fonts.
- Require glyph_brush_layout 0.1.8 to help ensure rusttype dependency convergence.
GlyphBrushBuilder
removedinitial_cache_size
,gpu_cache_scale_tolerance
,gpu_cache_position_tolerance
,gpu_cache_align_4x4
public fields replaced bygpu_cache_builder
field. This change allows the following changes.- Add
GlyphBrush::to_builder
method to constructGlyphBrushBuilder
s fromGlyphBrush
. - Add
GlyphBrushBuilder::replace_fonts
,GlyphBrushBuilder::rebuild
methods. Along withto_builder
these may be used to rebuild aGlyphBrush
with different fonts more conveniently. - Replace
hashbrown
withrustc-hash
+std::collections
these are the same in 1.36. - Update rusttype ->
0.8
. Compatible with rusttype0.6.5
&0.7.9
.
- Semver trick re-export glyph_brush
0.6
withoutGlyphBrushBuilder
. - Export
GlyphBrushBuilderNext
returned byGlyphBrush::to_builder
.
- Fix
queue_pre_positioned
cache check for position & scale changes.
- Removed screen dimensions from
process_queued
arguments.to_vertex
function arguments also no longer include screen dimensions. Vertices should now be given pixel coordinates and use an appropriate projection matrix as a transform.
This approach simplifies glyph_brush code & allows the vertex cache to survive screen resolution changes. It also makes pre-projection custom transforms much easier to use. See usage changes in the opengl example & gfx_glyph. - Add
GlyphCruncher::glyph_bounds
&glyph_bounds_custom_layout
functions. These return section bounding boxes in terms of the font & glyph's size metrics, which can be more useful than the pixel rendering bounds provided bypixel_bounds
. - Add
GlyphBrushBuilder::gpu_cache_align_4x4
for rusttype gpu_cachealign_4x4
option.delegate_glyph_brush_builder_fns!
includes this for downstream builders. - Disallow
GlyphBrushBuilder
direct construction. - Update hashbrown ->
0.5
.
yanked
- Fix cached vertices erroneously remaining valid after screen dimension change.
- Update hashbrown ->
0.3
.
- Wasm32: Avoid using random state in the default hasher.
- Change default section hasher to xxHash as seahash has been shown to collide easily in 32bit environments.
-
Use queue call counting & fine grained hashing to match up previous calls with current calls figuring out what has changed allowing optimised use of
recalculate_glyphs
for fast layouts.- Compute if just geometry (ie section position) has changed ->
GlyphChange::Geometry
. - Compute if just color has changed ->
GlyphChange::Color
. - Compute if just alpha has changed ->
GlyphChange::Alpha
.
Provides much faster re-layout performance in these common change scenarios.
- Compute if just geometry (ie section position) has changed ->
-
GlyphBrush
now generates & caches vertices avoiding regeneration of individual unchanged sections, when another section change forces regeneration of the complete vertex array. The user vertex typeV
is now in the struct signature.pub struct DownstreamGlyphBrush<'font, H = DefaultSectionHasher> { // previously: glyph_brush::GlyphBrush<'font, H>, inner: glyph_brush::GlyphBrush<'font, DownstreamGlyphVertex, H>, ... }
These changes result in a big performance improvement for changes to sections amongst other unchanging sections, which is a fairly common thing to want to do. Fully cached (everything unchanging) & worst-case (everything changing/new) are not significantly affected.
- Add
GlyphCruncher::fonts()
to common trait, hoisted from direct implementations. Add something like the following if you implementGlyphCruncher
.impl GlyphCruncher for Foo { // new #[inline] fn fonts(&self) -> &[Font<'font>] { self.glyph_brush.fonts() } }
- Fix 2-draw style causing texture cache thrashing. Probably a very rare bug.
- Require log
0.4.4
to fix compile issue with older versions. - Improve documentation.
- Implement
PartialEq
for*Section
s - Implement
Clone
,PartialEq
forBrushError
- Implement
Debug
,Clone
for other public things. - Add
GlyphBrush::queue_pre_positioned
for fully custom glyph positioning.
- Add
GlyphBrush::keep_cached
.
- Use hashbrown map & sets improves some benchmarks by 1-4%.
- Add
GlyphCalculator::fonts
&GlyphCalculatorGuard::fonts
methods.
- Fix on-off single section cache clearing.
- Fix double initial draw.
- Add public
DefaultSectionHasher
. - Add
GlyphBrush::texture_dimensions
. - Remove leaked public
GlyphedSection
. - Remove
current
fromTextureTooSmall
, replaced by usingtexture_dimensions()
. - Improve some documentation using gfx-glyph specific terminology.
- Fix
pixel_bounds
returningNone
for some infinite bound + non-default layout cases. - Optimise calculate_glyph_cache trimming using intermediate fx-hashing.
name control ns/iter change ns/iter diff ns/iter diff % speedup render_100_small_sections_fully 25,412 20,844 -4,568 -17.98% x 1.22
- Add example usage using gl-rs.
- Initial release.