Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ All notable changes to CPUI are recorded here. The format follows [Keep a Change

### Changed

- Lines break where the Unicode line breaking rules allow, also after hyphens and at zero-width spaces, and never inside numbers such as `1,000.5` or at no-break spaces; Chinese and Japanese keep their strict rules for punctuation and small kana. (#230)
- Emoji follow Unicode 18: newer emoji show in color, and a skin tone joins only an emoji that takes one. (#230)
- `Bitmap::from_png` and `ClipboardImage::from_bitmap` no longer need the `png` feature, which now does nothing: PNG images are decoded and encoded without another dependency. (#230)
- Text is shaped by the full OpenType and Apple layout rules: Indic, Sinhala, Khmer, Myanmar, Thai and other scripts join and place their marks as the system does, Thai on macOS uses the system's own font, and the `hello` executable grows from 2.4 MB to 2.8 MB. (#230)
- In a scroll area or list inside another, a wheel, trackpad or touch gesture that reaches its edge stops there, and the next one moves the area around it; scrolling inside a popup or dialog still never moves the page under it. (#225)
- Blending a capture, as a dialog does while it fades and zooms, no longer allocates each frame. (#212)
- Wrapped labels keep their measured widths and lines from one frame to the next until their text, font or width changes, so a frame of 2,000 unchanged ones takes 0.4 ms instead of 6.4, and scrolling a feed of cards takes a third of the time. (#210)
Expand All @@ -60,6 +64,8 @@ All notable changes to CPUI are recorded here. The format follows [Keep a Change

### Fixed

- Devanagari text with a reph, such as `र्क`, no longer drops the reph or panics, and emoji joined into one, such as families, show as one picture on Windows. (#230)
- Variable fonts with an optical-size axis are drawn at the size the font maps each text size to, instead of past the end of the axis for text smaller than the font's smallest optical size. (#230)
- On Windows and Linux, text keeps an even weight from size to size at scales such as 125% and 175%, and in large Chinese, Japanese and Korean text: glyphs are hinted only at whole pixel sizes where the font asks for it. (#228)
- Alert dialogs keep the chosen button focused after a click on the backdrop or empty padding, so Enter and Space continue to activate it. (#213)
- Checkerboards draw squares at least a pixel and at most the whole area wide, opaque or translucent, instead of panicking on very large squares or stalling on very small ones. (#213)
Expand Down
124 changes: 35 additions & 89 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 10 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,16 @@ cpui-render = { path = "crates/cpui-render", version = "0.1.3" }
cpui-icons = { path = "crates/cpui-icons", version = "0.1.3", default-features = false }
cpui-notify = { path = "crates/cpui-notify", version = "0.1.3" }
winit = { version = "0.30", features = ["android-native-activity"] }
swash = "0.2"
# Text shaping.
harfrust = "0.16.2"
# Font tables, glyph outlines with hinting, color and bitmap glyphs.
skrifa = "0.50"
# Path rasterization.
zeno = "0.3.3"
# General categories and emoji properties of characters.
unicode-properties = { version = "0.1.5", default-features = false, features = ["general-category", "emoji"] }
# Inflates the PNG images of emoji bitmap glyphs.
miniz_oxide = "0.8"
memmap2 = "0.9"
libc = "0.2"
fontconfig = { version = "0.11", features = ["dlopen"] }
Expand All @@ -46,7 +55,6 @@ fluent-langneg = "0.13"
unic-langid = "0.9"
softbuffer = "0.4"
ndk = { version = "0.9", default-features = false }
png = "0.18"
zune-jpeg = { version = "0.5", default-features = false, features = ["std", "neon", "x86"] }
image-webp = "0.2"
accesskit = "0.25"
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ CPUI would not have been possible without these projects:
- [shadcn/ui](https://ui.shadcn.com)
- [SwiftUI](https://developer.apple.com/swiftui/)
- [Tailwind CSS](https://tailwindcss.com)
- [swash](https://github.com/dfrg/swash), [winit](https://github.com/rust-windowing/winit), [softbuffer](https://github.com/rust-windowing/softbuffer) and [AccessKit](https://accesskit.dev).
- [HarfRust](https://github.com/harfbuzz/harfrust), [Skrifa](https://github.com/googlefonts/fontations), [zeno](https://github.com/dfrg/zeno), [winit](https://github.com/rust-windowing/winit), [softbuffer](https://github.com/rust-windowing/softbuffer) and [AccessKit](https://accesskit.dev).

## Friends

Expand Down
2 changes: 1 addition & 1 deletion README.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ CPUI 的诞生离不开以下项目:
- [shadcn/ui](https://ui.shadcn.com)
- [SwiftUI](https://developer.apple.com/swiftui/)
- [Tailwind CSS](https://tailwindcss.com)
- [swash](https://github.com/dfrg/swash)、[winit](https://github.com/rust-windowing/winit)、[softbuffer](https://github.com/rust-windowing/softbuffer) 和 [AccessKit](https://accesskit.dev)。
- [HarfRust](https://github.com/harfbuzz/harfrust)、[Skrifa](https://github.com/googlefonts/fontations)、[zeno](https://github.com/dfrg/zeno)、[winit](https://github.com/rust-windowing/winit)、[softbuffer](https://github.com/rust-windowing/softbuffer) 和 [AccessKit](https://accesskit.dev)。

## 友链

Expand Down
8 changes: 6 additions & 2 deletions crates/cpui-render/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "cpui-render"
description = "The rendering layer of CPUI: text shaping and glyph rasterization with swash, and CPU compositing into the window surface."
description = "The rendering layer of CPUI: text shaping, glyph rasterization and CPU compositing into the window surface."
version.workspace = true
edition.workspace = true
rust-version.workspace = true
Expand All @@ -15,7 +15,11 @@ categories = ["gui", "rendering"]

[dependencies]
winit.workspace = true
swash.workspace = true
harfrust.workspace = true
skrifa.workspace = true
zeno.workspace = true
unicode-properties.workspace = true
miniz_oxide.workspace = true
# Unicode bidirectional algorithm.
unicode-bidi.workspace = true
# Grapheme caret positions in simple text.
Expand Down
5 changes: 2 additions & 3 deletions crates/cpui-render/README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
# cpui-render

The rendering layer of [CPUI](https://github.com/DEEIX-AI/cpui): text shaping and glyph
rasterization with swash, and CPU composition into a window or an offscreen image. No GPU context
is created.
The rendering layer of [CPUI](https://github.com/DEEIX-AI/cpui): text shaping, glyph
rasterization and CPU composition into a window or an offscreen image. No GPU context is created.

Applications use the [`cpui`](https://crates.io/crates/cpui) crate, which re-exports the types
needed for custom drawing. Depend on this crate directly only to draw without the widget layer.
Expand Down
4 changes: 2 additions & 2 deletions crates/cpui-render/src/draw/frame.rs
Original file line number Diff line number Diff line change
Expand Up @@ -690,7 +690,7 @@ impl Frame<'_> {
/// Paints the path `data` moved by `offset` logical pixels.
pub(crate) fn draw_path(
&mut self,
data: (&[swash::zeno::Point], &[swash::zeno::Verb]),
data: (&[zeno::Point], &[zeno::Verb]),
offset: (f32, f32),
paint: Paint<'_>,
color: Color,
Expand All @@ -703,7 +703,7 @@ impl Frame<'_> {
}
let s = self.scale;
let (clip_px, shift) = (self.clip(clip), self.shift);
let transform = swash::zeno::Transform::new(s, 0.0, 0.0, s, offset.0 * s, offset.1 * s);
let transform = zeno::Transform::new(s, 0.0, 0.0, s, offset.0 * s, offset.1 * s);
let vector = &mut self.scratch.vector;
let style = paint.to_zeno(s, &mut vector.dashes, data.0);
let Some(bounds) = raster_bounds(data, style, transform, &mut vector.zeno) else {
Expand Down
Loading
Loading