Repository navigation
Fit images to their aspect ratio; app icons on Windows and Linux - #9
Merged
Merged
Conversation
…nd Linux El::pixels_fit letterboxes (SurfaceFit::Fit) or crops (Fill) an image inside its rect. ImageCache::app_icon now reads an executable's first icon on Windows and a .desktop entry's hicolor or pixmaps icon (PNG or SVG) on Linux.
kitlangton
force-pushed
the
raster-images
branch
from
October 23, 2026 18:16
0525428 to
654c4a2
Compare
Hona
added a commit
that referenced
this pull request
Nov 12, 2026
… fields and fonts (#725) - El::isolate and rune::text::ltr_units: runs that keep their own order (paths, URLs, calls, flags, file names, references, signed numbers); static pills are Auto isolates. - Kit Markdown: per-block direction (paragraphs, headings, one per list, quotes, tables), code and diffs left to right, neutral blocks follow the block before, Markdown::dir_tentative. - dir(Auto) with no strong character takes its parent's direction; by-paragraph lines with none follow the line before; an empty right-to-left line's caret at its right; Left/Right collapse a selection to the end drawn that way; truncate_fade fades the text's own end. - Fonts: Arabic comma after Latin no longer tofu; Windows script fallbacks load whole families; monospace Arabic and Hebrew (Courier New, DejaVu Sans Mono) in code. - vendor/parley_engine: UAX #9 L1 at a paragraph's end; BidiTest.txt 770,241/770,241.
Hona
added a commit
that referenced
this pull request
Nov 12, 2026
Three caches in Rune's vendored parley_engine (vendor/parley_engine.patch, beside the UAX #9 L1 fix), each for work shaping repeated from identical inputs: - Analyzer keeps the ICU line and word segmenters it made (analysis.rs Segmenters). Making one looked up its rules and, with complex-scripts, loaded the dictionaries, for every text. The segmenters are 'static and Copy, so a kept one is the value a new one would be. - Shaper keeps each run's font metrics per font instance and size (run_metrics_cache, an LRU of 16 beside its shaper caches), instead of skrifa::Metrics::new for every run. - FontMetrics::from_font_instance, which parley's style metrics call once per style per layout, keeps its answers per thread (64 entries, keyed by blob id, index, synthesis, size and variations). Proof, every layout of 7 screens x 11 UI languages (en ar he ja zh ko th km my hi ru; 5,933 texts), a digest of each finished layout (line boxes, runs, fonts, sizes, coordinates, every glyph's id and position, clusters, inline boxes): 0 differ, each cache alone and together. Warm cost per Parley build, the three variants interleaved in one batch: 25.8 us a text -> 24.4 (segmenters) -> 22.1 (and metrics), 14.3% less. A returning user's launch (tabs10, release, visible desktop, n=9): the texts shaped between the first frame and live content 9,433 -> 7,254 us p50, those before the first frame 1,897 -> 1,689.
This was referenced Nov 17, 2026
This was referenced Dec 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What it does
El::pixels_fit(&pixels, SurfaceFit::Fit | Fill)draws an image at its own aspect ratio:Fitletterboxes on whole device pixels and rounds the image's own corners,Fillcovers the rect and crops the centre.El::pixelsstill stretches.ImageCache::app_iconnow works on Windows (an executable's or.ico's first icon viaPrivateExtractIconsW) and Linux (a.desktopentry'sIcon=from hicolor, closest size at or above, then scalable SVG via resvg, thenpixmaps). Paths without an icon still resolve toImage::error.How it works
pixels::fitmaps the image size and element rect to a draw rect and a uv window; the runtime picks the mip for the uncropped drawn size. No shader change.Risk
Apps that relied on
app_iconerroring on Windows/Linux now draw icons. Addsresvg(no default features) as a Linux-only dependency.Proof
fit_letterboxes_on_whole_pixels_and_fill_crops_the_centre,gpu_pixels_fit_letterboxes_and_fill_crops(headless GPU readback),desktop_entries_resolve_the_closest_theme_size_then_scalable_then_pixmaps, and a Windowsnotepad.exeicon test.cargo check --target x86_64-pc-windows-msvcpasses.