1
0
mirror of https://github.com/emilk/egui.git synced 2026-08-31 22:00:03 -04:00

Non-monospaced fonts

This commit is contained in:
Emil Ernerfeldt
2019-01-05 21:23:53 +01:00
parent ad352e4a1e
commit fafc802ffd
11 changed files with 167 additions and 101 deletions

View File

@@ -96,8 +96,6 @@ impl GuiSettings for emgui::LayoutOptions {
if gui.button("Reset LayoutOptions").clicked {
*self = Default::default();
}
gui.slider_f32("char_size.x", &mut self.char_size.x, 0.0, 20.0);
gui.slider_f32("char_size.y", &mut self.char_size.y, 0.0, 20.0);
gui.slider_f32("item_spacing.x", &mut self.item_spacing.x, 0.0, 10.0);
gui.slider_f32("item_spacing.y", &mut self.item_spacing.y, 0.0, 10.0);
gui.slider_f32("window_padding.x", &mut self.window_padding.x, 0.0, 10.0);

View File

@@ -9,7 +9,7 @@ extern crate emgui;
use std::sync::Mutex;
use emgui::{Emgui, Frame, RawInput};
use emgui::{Emgui, Font, Frame, RawInput};
use wasm_bindgen::prelude::*;
@@ -42,9 +42,13 @@ mod webgl;
// serde_json::to_string(&commands).unwrap()
// }
fn font() -> Font {
Font::new(20) // TODO: don't create this multiple times
}
#[wasm_bindgen]
pub fn new_webgl_painter(canvas_id: &str) -> Result<webgl::Painter, JsValue> {
let emgui_painter = emgui::Painter::new(); // TODO: don't create this twice
let emgui_painter = emgui::Painter::new(font()); // TODO: don't create this twice
webgl::Painter::new(canvas_id, emgui_painter.texture())
}
@@ -58,8 +62,8 @@ impl State {
fn new() -> State {
State {
app: Default::default(),
emgui: Emgui::new(),
emgui_painter: emgui::Painter::new(),
emgui: Emgui::new(font()),
emgui_painter: emgui::Painter::new(font()),
}
}

View File

@@ -64,7 +64,8 @@ impl Painter {
.unwrap();
gl.tex_parameteri(Gl::TEXTURE_2D, Gl::TEXTURE_WRAP_S, Gl::CLAMP_TO_EDGE as i32);
gl.tex_parameteri(Gl::TEXTURE_2D, Gl::TEXTURE_WRAP_T, Gl::CLAMP_TO_EDGE as i32);
gl.tex_parameteri(Gl::TEXTURE_2D, Gl::TEXTURE_MIN_FILTER, Gl::NEAREST as i32);
// gl.tex_parameteri(Gl::TEXTURE_2D, Gl::TEXTURE_MIN_FILTER, Gl::NEAREST as i32);
gl.tex_parameteri(Gl::TEXTURE_2D, Gl::TEXTURE_MIN_FILTER, Gl::LINEAR as i32);
// --------------------------------------------------------------------