Load Iced-Icons.ttf font in text::Pipeline::new
This commit is contained in:
parent
5a82fc654e
commit
d2825360a7
3 changed files with 10 additions and 4 deletions
|
|
@ -53,7 +53,7 @@ path = "../graphics"
|
||||||
[dependencies.glyphon]
|
[dependencies.glyphon]
|
||||||
version = "0.2"
|
version = "0.2"
|
||||||
git = "https://github.com/hecrj/glyphon.git"
|
git = "https://github.com/hecrj/glyphon.git"
|
||||||
rev = "bffca9b958af11d1bfd0c0d1a281fc8799cc5a5b"
|
rev = "4b5e5106f05332dc324bae2095468845a61f36b9"
|
||||||
|
|
||||||
[dependencies.tracing]
|
[dependencies.tracing]
|
||||||
version = "0.1.6"
|
version = "0.1.6"
|
||||||
|
|
|
||||||
|
|
@ -197,8 +197,8 @@ impl iced_graphics::Backend for Backend {
|
||||||
|
|
||||||
impl backend::Text for Backend {
|
impl backend::Text for Backend {
|
||||||
const ICON_FONT: Font = Font::Name("Iced-Icons");
|
const ICON_FONT: Font = Font::Name("Iced-Icons");
|
||||||
const CHECKMARK_ICON: char = '\u{e800}';
|
const CHECKMARK_ICON: char = '\u{f00c}';
|
||||||
const ARROW_DOWN_ICON: char = '\u{f00c}';
|
const ARROW_DOWN_ICON: char = '\u{e800}';
|
||||||
|
|
||||||
fn default_font(&self) -> Font {
|
fn default_font(&self) -> Font {
|
||||||
self.default_font
|
self.default_font
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,13 @@ impl Pipeline {
|
||||||
Pipeline {
|
Pipeline {
|
||||||
system: Some(
|
system: Some(
|
||||||
SystemBuilder {
|
SystemBuilder {
|
||||||
fonts: glyphon::FontSystem::new(),
|
fonts: glyphon::FontSystem::new_with_fonts(
|
||||||
|
[glyphon::fontdb::Source::Binary(Arc::new(
|
||||||
|
include_bytes!("../fonts/Iced-Icons.ttf")
|
||||||
|
.as_slice(),
|
||||||
|
))]
|
||||||
|
.into_iter(),
|
||||||
|
),
|
||||||
cache_builder: |fonts| glyphon::SwashCache::new(fonts),
|
cache_builder: |fonts| glyphon::SwashCache::new(fonts),
|
||||||
measurement_cache_builder: |_| RefCell::new(Cache::new()),
|
measurement_cache_builder: |_| RefCell::new(Cache::new()),
|
||||||
render_cache_builder: |_| Cache::new(),
|
render_cache_builder: |_| Cache::new(),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue