1
0
mirror of https://github.com/emilk/egui.git synced 2026-06-28 07:23:13 -04:00

Improve text layout

This commit is contained in:
Emil Ernerfeldt
2018-12-27 23:55:16 +01:00
parent a4fc56b441
commit 1c6fd220b2
7 changed files with 80 additions and 134 deletions

View File

@@ -63,8 +63,7 @@ function paint_command(canvas, cmd) {
case "text":
ctx.fillStyle = styleFromColor(cmd.fill_color);
ctx.font = cmd.font_size + "px " + cmd.font_name;
ctx.textAlign = cmd.text_align;
ctx.textBaseline = "top";
ctx.textBaseline = "middle";
ctx.fillText(cmd.text, cmd.pos.x, cmd.pos.y);
return;
}