add iced logo to Iced-Icons.ttf

This commit is contained in:
edwloef 2025-04-25 15:45:36 +02:00 committed by Héctor Ramón Jiménez
parent 0563ee8375
commit 1305d3c00f
No known key found for this signature in database
GPG key ID: 7CC46565708259A7
7 changed files with 36 additions and 14 deletions

View file

@ -45,6 +45,7 @@ impl text::Renderer for () {
const ICON_FONT: Font = Font::DEFAULT;
const CHECKMARK_ICON: char = '0';
const ARROW_DOWN_ICON: char = '0';
const ICED_LOGO: char = '0';
fn default_font(&self) -> Self::Font {
Font::default()

View file

@ -312,6 +312,11 @@ pub trait Renderer: crate::Renderer {
/// [`ICON_FONT`]: Self::ICON_FONT
const ARROW_DOWN_ICON: char;
/// The 'char' representing the iced logo in the built-in ['ICON_FONT'].
///
/// ['ICON_FONT']: Self::ICON_FONT
const ICED_LOGO: char;
/// Returns the default [`Self::Font`].
fn default_font(&self) -> Self::Font;

Binary file not shown.

View file

@ -97,6 +97,7 @@ where
const ICON_FONT: Self::Font = A::ICON_FONT;
const CHECKMARK_ICON: char = A::CHECKMARK_ICON;
const ARROW_DOWN_ICON: char = A::ARROW_DOWN_ICON;
const ICED_LOGO: char = A::ICED_LOGO;
fn default_font(&self) -> Self::Font {
delegate!(self, renderer, renderer.default_font())

View file

@ -254,6 +254,7 @@ impl core::text::Renderer for Renderer {
const ICON_FONT: Font = Font::with_name("Iced-Icons");
const CHECKMARK_ICON: char = '\u{f00c}';
const ARROW_DOWN_ICON: char = '\u{e800}';
const ICED_LOGO: char = '\u{e801}';
fn default_font(&self) -> Self::Font {
self.default_font

View file

@ -721,6 +721,7 @@ impl core::text::Renderer for Renderer {
const ICON_FONT: Font = Font::with_name("Iced-Icons");
const CHECKMARK_ICON: char = '\u{f00c}';
const ARROW_DOWN_ICON: char = '\u{e800}';
const ICED_LOGO: char = '\u{e801}';
fn default_font(&self) -> Self::Font {
self.default_font

View file

@ -1836,7 +1836,6 @@ where
///
/// Useful for showing some love to your favorite GUI library in your "About" screen,
/// for instance.
#[cfg(feature = "svg")]
pub fn iced<'a, Message, Theme, Renderer>(
text_size: impl Into<core::Pixels>,
) -> Element<'a, Message, Theme, Renderer>
@ -1846,24 +1845,38 @@ where
+ core::text::Renderer<Font = core::Font>
+ core::svg::Renderer
+ 'a,
Theme: text::Catalog + crate::svg::Catalog + 'a,
Theme: text::Catalog + container::Catalog + 'a,
<Theme as container::Catalog>::Class<'a>:
From<container::StyleFn<'a, Theme>>,
<Theme as text::Catalog>::Class<'a>: From<text::StyleFn<'a, Theme>>,
{
use crate::core::{Alignment, Font};
use crate::svg;
use std::sync::LazyLock;
static LOGO: LazyLock<svg::Handle> = LazyLock::new(|| {
svg::Handle::from_memory(include_bytes!("../assets/iced-logo.svg"))
});
use crate::core::{
Alignment, Color, Font, Radians, border, border::radius, color,
gradient::Linear,
};
let text_size = text_size.into();
row![
svg(LOGO.clone()).width(text_size * 1.3),
text("iced")
.size(text_size)
.font(Font::MONOSPACE)
.shaping(text::Shaping::Advanced)
container(
text(Renderer::ICED_LOGO)
.line_height(1.0)
.size(text_size)
.font(Renderer::ICON_FONT)
.color(Color::WHITE)
)
.padding(text_size * 0.15)
.style(move |_| container::Style {
background: Some(
Linear::new(Radians::PI / 4.0)
.add_stop(0.0, color!(0x3300ff))
.add_stop(1.0, color!(0x00a3ff))
.into()
),
border: border::rounded(radius(text_size * 0.4)),
..container::Style::default()
}),
text("iced").size(text_size).font(Font::MONOSPACE)
]
.spacing(text_size.0 / 3.0)
.align_y(Alignment::Center)