1
0
mirror of https://github.com/emilk/egui.git synced 2026-09-01 14:20:04 -04:00

Pixel-perfect fonts

This commit is contained in:
Emil Ernerfeldt
2019-01-19 10:10:28 -06:00
parent cd8ca47e76
commit c2c94ddda5
14 changed files with 207 additions and 212 deletions

View File

@@ -143,7 +143,12 @@ impl Painter {
self.current_texture_id = Some(texture.id);
}
pub fn paint(&mut self, frame: &Frame, texture: &Texture) -> Result<(), JsValue> {
pub fn paint(
&mut self,
frame: &Frame,
texture: &Texture,
pixels_per_point: f32,
) -> Result<(), JsValue> {
self.upload_texture(texture);
let gl = &self.gl;
@@ -280,8 +285,8 @@ impl Painter {
.unwrap();
gl.uniform2f(
Some(&u_screen_size_loc),
self.canvas.width() as f32,
self.canvas.height() as f32,
self.canvas.width() as f32 / pixels_per_point,
self.canvas.height() as f32 / pixels_per_point,
);
let u_tex_size_loc = gl