Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cosmic text refactor #91

Merged
merged 3 commits into from
Dec 20, 2023
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
8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -133,10 +133,10 @@ iced_accessibility = { version = "0.1", path = "accessibility" }
async-std = "1.0"
bitflags = "1.0"
bytemuck = { version = "1.0", features = ["derive"] }
cosmic-text = "0.10"
cosmic-text = { git = "https://github.com/pop-os/cosmic-text.git", branch = "refactor" }
futures = "0.3"
glam = "0.24"
glyphon = { git = "https://github.com/grovesNL/glyphon.git", rev = "2caa9fc5e5923c1d827d177c3619cab7e9885b85" }
glyphon = { git = "https://github.com/jackpot51/glyphon.git", branch = "refactor" }
guillotiere = "0.6"
half = "2.2"
image = "0.24"
Expand All @@ -152,7 +152,7 @@ ouroboros = "0.17"
palette = "0.7"
qrcode = { version = "0.12", default-features = false }
raw-window-handle = "0.5"
resvg = "0.36"
resvg = "0.37"
rustc-hash = "1.0"
sctk = { package = "smithay-client-toolkit", git = "https://github.com/smithay/client-toolkit", rev = "2e9bf9f" }
smol = "1.0"
Expand All @@ -174,4 +174,4 @@ winapi = "0.3"
window_clipboard = "0.3"
[workspace.dependencies.winit]
git = "https://github.com/pop-os/winit.git"
branch = "master"
branch = "master"
3 changes: 3 additions & 0 deletions core/src/renderer/null.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ impl text::Renderer for Null {
type Font = Font;
type Paragraph = ();
type Editor = ();
type Raw = ();

const ICON_FONT: Font = Font::DEFAULT;
const CHECKMARK_ICON: char = '0';
Expand Down Expand Up @@ -77,6 +78,8 @@ impl text::Renderer for Null {
) {
}

fn fill_raw(&mut self, _raw: Self::Raw) {}

fn fill_text(
&mut self,
_paragraph: Text<'_, Self::Font>,
Expand Down
6 changes: 6 additions & 0 deletions core/src/text.rs
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,9 @@
/// The [`Editor`] of this [`Renderer`].
type Editor: Editor<Font = Self::Font> + 'static;

/// The [`Raw`] of this [`Renderer`].

Check failure on line 176 in core/src/text.rs

View workflow job for this annotation

GitHub Actions / all

unresolved link to `Raw`

Check failure on line 176 in core/src/text.rs

View workflow job for this annotation

GitHub Actions / all

unresolved link to `Raw`
type Raw;

/// The icon font of the backend.
const ICON_FONT: Self::Font;

Expand Down Expand Up @@ -215,6 +218,9 @@
clip_bounds: Rectangle,
);

/// Draws the given [`Raw`]

Check failure on line 221 in core/src/text.rs

View workflow job for this annotation

GitHub Actions / all

unresolved link to `Raw`

Check failure on line 221 in core/src/text.rs

View workflow job for this annotation

GitHub Actions / all

unresolved link to `Raw`
fn fill_raw(&mut self, raw: Self::Raw);

/// Draws the given [`Text`] at the given position and with the given
/// [`Color`].
fn fill_text(
Expand Down
5 changes: 5 additions & 0 deletions graphics/src/renderer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ where
type Font = Font;
type Paragraph = text::Paragraph;
type Editor = text::Editor;
type Raw = text::Raw;

const ICON_FONT: Font = Font::with_name("Iced-Icons");
const CHECKMARK_ICON: char = '\u{f00c}';
Expand Down Expand Up @@ -189,6 +190,10 @@ where
});
}

fn fill_raw(&mut self, raw: Self::Raw) {
self.primitives.push(Primitive::RawText(raw));
}

fn fill_text(
&mut self,
text: Text<'_, Self::Font>,
Expand Down
Loading
Loading