v2 / vlib / gg / text_rendering.js.v
20 lines · 17 sloc · 361 bytes · 3d60410b605d001e54f280070d5f952da9de1112
Raw
1module gg
2
3pub enum HorizontalAlign {
4 left
5 center
6 right
7}
8
9pub enum VerticalAlign {
10 top
11 middle
12 bottom
13 baseline
14}
15
16pub fn (mut ctx Context) draw_text(x int, y int, text_ string, cfg TextCfg) {
17 ctx.context.fillStyle = cfg.color.to_css_string().str
18 ctx.context.font = cfg.to_css_string().str
19 ctx.context.fillText(text_.str, JS.Number(x), JS.Number(y))
20}
21