1
0
mirror of https://github.com/emilk/egui.git synced 2026-08-30 13:20:05 -04:00

Support multiple fonts

This commit is contained in:
Emil Ernerfeldt
2019-01-13 00:55:56 +01:00
parent 1b8a45a514
commit ca9333ec3e
13 changed files with 140 additions and 70 deletions

View File

@@ -1,4 +1,7 @@
use crate::math::{Rect, Vec2};
use crate::{
fonts::TextStyle,
math::{Rect, Vec2},
};
// ----------------------------------------------------------------------------
@@ -88,12 +91,6 @@ pub struct InteractInfo {
pub active: bool,
}
#[derive(Clone, Copy, Debug, Serialize)]
#[serde(rename_all = "snake_case")]
pub enum TextStyle {
Label,
}
#[derive(Clone, Debug, Serialize)]
pub enum GuiCmd {
PaintCommands(Vec<PaintCmd>),
@@ -130,7 +127,7 @@ pub enum GuiCmd {
/// The text should be vertically centered at the given position.
Text {
pos: Vec2,
style: TextStyle,
text_style: TextStyle,
text: String,
/// Start each character in the text, as offset from pos.
x_offsets: Vec<f32>,
@@ -179,6 +176,7 @@ pub enum PaintCmd {
/// Top left corner of the first character.
pos: Vec2,
text: String,
text_style: TextStyle,
/// Start each character in the text, as offset from pos.
x_offsets: Vec<f32>,
// TODO: font info