open X11
(*let font = font_load "Times New Roman:pixelsize=14"*)
-let font = font_load "Liberation Mono:pixelsize=14"
+let font = font_load "Helvetica:pixelsize=48"
let onfocus focused =
print_endline "onfocus"
print_endline "onmousemove"
let onupdate width height =
+ let text = "FooBarBazYay" in
Printf.printf "onupdate: %d %d\n" width height;
draw_rect { x = 2; y = 2; w = width; h = height; c = Cfg.Color.palette.(0) };
- draw_string font Cfg.Color.palette.(5) "FooBarBaz\tYay\r\n" (2,2);
- draw_string font Cfg.Color.palette.(5) "FooBarBaz\tYay\r\n" (2,2+font.height);
+ draw_string font Cfg.Color.palette.(5) text (2,2);
+ draw_string font Cfg.Color.palette.(5) text (2,2+font.height);
draw_rect { x = 2; y = 2; w = 1; h = font.height; c = Cfg.Color.palette.(3) };
flip ()
XftGlyphFontSpec spec = {
.font = font,
.glyph = intfield(glyph,1),
- .x = intfield(coord,0),
+ .x = intfield(coord,0) + intfield(glyph,4),
.y = intfield(coord,1) + font->ascent
};
- //printf("x: %d y: %d xoff: %d yoff: %d\n", spec.x, spec.y, intfield(glyph,6), intfield(glyph,7));
+ printf("c: '%c' w: %d x: %d y: %d xoff: %d yoff: %d\n",
+ intfield(glyph,2),
+ intfield(glyph,3),
+ intfield(glyph,4),
+ intfield(glyph,5),
+ intfield(glyph,6),
+ intfield(glyph,7));
XftColor fgc;
xftcolor(&fgc, Int_val(color));
XftDrawGlyphFontSpec(X.xft, &fgc, &spec, 1);