mirror of
https://github.com/griffi-gh/hUI.git
synced 2024-11-25 08:28:42 -06:00
fix builtin font handle thingy
This commit is contained in:
parent
f9ea777954
commit
f7366b9bbb
|
@ -15,8 +15,7 @@ include = [
|
|||
]
|
||||
|
||||
[dependencies]
|
||||
#hack: hui doesn't compile without the builtin_font feature due to a bug
|
||||
hui = { version = "=0.1.0-alpha.4", path = "../hui", default-features = false, features = ["builtin_font"] }
|
||||
hui = { version = "=0.1.0-alpha.4", path = "../hui", default-features = false }
|
||||
glium = { version = "0.34", default-features = false }
|
||||
glam = "0.25"
|
||||
log = "0.4"
|
||||
|
|
|
@ -1,13 +1,10 @@
|
|||
use std::borrow::Cow;
|
||||
use glam::{vec2, Vec4};
|
||||
use crate::{
|
||||
draw::UiDrawCommand,
|
||||
element::{MeasureContext, ProcessContext, UiElement},
|
||||
measure::Response,
|
||||
text::{FontHandle, BUILTIN_FONT},
|
||||
layout::UiSize
|
||||
draw::UiDrawCommand, element::{MeasureContext, ProcessContext, UiElement}, layout::UiSize, measure::Response, text::{FontHandle, DEFAULT_FONT}
|
||||
};
|
||||
|
||||
|
||||
//TODO: text fit
|
||||
// pub enum TextSize {
|
||||
// FitToWidthRatio(f32),
|
||||
|
@ -29,7 +26,7 @@ impl Default for Text {
|
|||
text: "".into(),
|
||||
size: (UiSize::Auto, UiSize::Auto),
|
||||
color: Vec4::new(1., 1., 1., 1.),
|
||||
font: BUILTIN_FONT,
|
||||
font: DEFAULT_FONT,
|
||||
text_size: 16,
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,7 +4,10 @@ mod font;
|
|||
mod ftm;
|
||||
|
||||
use font::FontManager;
|
||||
pub use font::{FontHandle, BUILTIN_FONT};
|
||||
pub use font::FontHandle;
|
||||
#[cfg(feature="builtin_font")]
|
||||
pub use font::BUILTIN_FONT;
|
||||
pub(crate) use font::DEFAULT_FONT;
|
||||
use fontdue::{Font, FontSettings};
|
||||
use ftm::FontTextureManager;
|
||||
pub use ftm::{FontTextureInfo, GlyphCacheEntry};
|
||||
|
|
|
@ -6,6 +6,12 @@ pub struct FontHandle(pub(crate) usize);
|
|||
#[cfg(feature = "builtin_font")]
|
||||
pub const BUILTIN_FONT: FontHandle = FontHandle(0);
|
||||
|
||||
|
||||
pub(crate) const DEFAULT_FONT: FontHandle = {
|
||||
#[cfg(feature = "builtin_font")] { BUILTIN_FONT }
|
||||
#[cfg(not(feature = "builtin_font"))] { FontHandle(0) }
|
||||
};
|
||||
|
||||
#[cfg(feature = "builtin_font")]
|
||||
const BUILTIN_FONT_DATA: &[u8] = include_bytes!("../../assets/font/ProggyTiny.ttf");
|
||||
|
||||
|
|
Loading…
Reference in a new issue