Merge pull request #2902 from edwloef/iced_logo_ttf
add iced logo to Iced-Icons.ttf
This commit is contained in:
commit
a66f848f4c
7 changed files with 37 additions and 18 deletions
|
|
@ -45,6 +45,7 @@ impl text::Renderer for () {
|
||||||
const ICON_FONT: Font = Font::DEFAULT;
|
const ICON_FONT: Font = Font::DEFAULT;
|
||||||
const CHECKMARK_ICON: char = '0';
|
const CHECKMARK_ICON: char = '0';
|
||||||
const ARROW_DOWN_ICON: char = '0';
|
const ARROW_DOWN_ICON: char = '0';
|
||||||
|
const ICED_LOGO: char = '0';
|
||||||
|
|
||||||
fn default_font(&self) -> Self::Font {
|
fn default_font(&self) -> Self::Font {
|
||||||
Font::default()
|
Font::default()
|
||||||
|
|
|
||||||
|
|
@ -312,6 +312,11 @@ pub trait Renderer: crate::Renderer {
|
||||||
/// [`ICON_FONT`]: Self::ICON_FONT
|
/// [`ICON_FONT`]: Self::ICON_FONT
|
||||||
const ARROW_DOWN_ICON: char;
|
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`].
|
/// Returns the default [`Self::Font`].
|
||||||
fn default_font(&self) -> Self::Font;
|
fn default_font(&self) -> Self::Font;
|
||||||
|
|
||||||
|
|
|
||||||
Binary file not shown.
|
|
@ -97,6 +97,7 @@ where
|
||||||
const ICON_FONT: Self::Font = A::ICON_FONT;
|
const ICON_FONT: Self::Font = A::ICON_FONT;
|
||||||
const CHECKMARK_ICON: char = A::CHECKMARK_ICON;
|
const CHECKMARK_ICON: char = A::CHECKMARK_ICON;
|
||||||
const ARROW_DOWN_ICON: char = A::ARROW_DOWN_ICON;
|
const ARROW_DOWN_ICON: char = A::ARROW_DOWN_ICON;
|
||||||
|
const ICED_LOGO: char = A::ICED_LOGO;
|
||||||
|
|
||||||
fn default_font(&self) -> Self::Font {
|
fn default_font(&self) -> Self::Font {
|
||||||
delegate!(self, renderer, renderer.default_font())
|
delegate!(self, renderer, renderer.default_font())
|
||||||
|
|
|
||||||
|
|
@ -254,6 +254,7 @@ impl core::text::Renderer for Renderer {
|
||||||
const ICON_FONT: Font = Font::with_name("Iced-Icons");
|
const ICON_FONT: Font = Font::with_name("Iced-Icons");
|
||||||
const CHECKMARK_ICON: char = '\u{f00c}';
|
const CHECKMARK_ICON: char = '\u{f00c}';
|
||||||
const ARROW_DOWN_ICON: char = '\u{e800}';
|
const ARROW_DOWN_ICON: char = '\u{e800}';
|
||||||
|
const ICED_LOGO: char = '\u{e801}';
|
||||||
|
|
||||||
fn default_font(&self) -> Self::Font {
|
fn default_font(&self) -> Self::Font {
|
||||||
self.default_font
|
self.default_font
|
||||||
|
|
|
||||||
|
|
@ -721,6 +721,7 @@ impl core::text::Renderer for Renderer {
|
||||||
const ICON_FONT: Font = Font::with_name("Iced-Icons");
|
const ICON_FONT: Font = Font::with_name("Iced-Icons");
|
||||||
const CHECKMARK_ICON: char = '\u{f00c}';
|
const CHECKMARK_ICON: char = '\u{f00c}';
|
||||||
const ARROW_DOWN_ICON: char = '\u{e800}';
|
const ARROW_DOWN_ICON: char = '\u{e800}';
|
||||||
|
const ICED_LOGO: char = '\u{e801}';
|
||||||
|
|
||||||
fn default_font(&self) -> Self::Font {
|
fn default_font(&self) -> Self::Font {
|
||||||
self.default_font
|
self.default_font
|
||||||
|
|
|
||||||
|
|
@ -1849,34 +1849,44 @@ where
|
||||||
///
|
///
|
||||||
/// Useful for showing some love to your favorite GUI library in your "About" screen,
|
/// Useful for showing some love to your favorite GUI library in your "About" screen,
|
||||||
/// for instance.
|
/// for instance.
|
||||||
#[cfg(feature = "svg")]
|
|
||||||
pub fn iced<'a, Message, Theme, Renderer>(
|
pub fn iced<'a, Message, Theme, Renderer>(
|
||||||
text_size: impl Into<core::Pixels>,
|
text_size: impl Into<core::Pixels>,
|
||||||
) -> Element<'a, Message, Theme, Renderer>
|
) -> Element<'a, Message, Theme, Renderer>
|
||||||
where
|
where
|
||||||
Message: 'a,
|
Message: 'a,
|
||||||
Renderer: core::Renderer
|
Renderer: core::Renderer + core::text::Renderer<Font = core::Font> + 'a,
|
||||||
+ core::text::Renderer<Font = core::Font>
|
Theme: text::Catalog + container::Catalog + 'a,
|
||||||
+ core::svg::Renderer
|
<Theme as container::Catalog>::Class<'a>:
|
||||||
+ 'a,
|
From<container::StyleFn<'a, Theme>>,
|
||||||
Theme: text::Catalog + crate::svg::Catalog + 'a,
|
<Theme as text::Catalog>::Class<'a>: From<text::StyleFn<'a, Theme>>,
|
||||||
{
|
{
|
||||||
use crate::core::{Alignment, Font};
|
use crate::core::border;
|
||||||
use crate::svg;
|
use crate::core::color;
|
||||||
use std::sync::LazyLock;
|
use crate::core::gradient;
|
||||||
|
use crate::core::{Alignment, Color, Font, Radians};
|
||||||
static LOGO: LazyLock<svg::Handle> = LazyLock::new(|| {
|
|
||||||
svg::Handle::from_memory(include_bytes!("../assets/iced-logo.svg"))
|
|
||||||
});
|
|
||||||
|
|
||||||
let text_size = text_size.into();
|
let text_size = text_size.into();
|
||||||
|
|
||||||
row![
|
row![
|
||||||
svg(LOGO.clone()).width(text_size * 1.3),
|
container(
|
||||||
text("iced")
|
text(Renderer::ICED_LOGO)
|
||||||
.size(text_size)
|
.line_height(1.0)
|
||||||
.font(Font::MONOSPACE)
|
.size(text_size)
|
||||||
.shaping(text::Shaping::Advanced)
|
.font(Renderer::ICON_FONT)
|
||||||
|
.color(Color::WHITE)
|
||||||
|
)
|
||||||
|
.padding(text_size * 0.15)
|
||||||
|
.style(move |_| container::Style {
|
||||||
|
background: Some(
|
||||||
|
gradient::Linear::new(Radians::PI / 4.0)
|
||||||
|
.add_stop(0.0, color!(0x0033ff))
|
||||||
|
.add_stop(1.0, color!(0x1177ff))
|
||||||
|
.into()
|
||||||
|
),
|
||||||
|
border: border::rounded(border::radius(text_size * 0.4)),
|
||||||
|
..container::Style::default()
|
||||||
|
}),
|
||||||
|
text("iced").size(text_size).font(Font::MONOSPACE)
|
||||||
]
|
]
|
||||||
.spacing(text_size.0 / 3.0)
|
.spacing(text_size.0 / 3.0)
|
||||||
.align_y(Alignment::Center)
|
.align_y(Alignment::Center)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue