]> git.mdlowis.com Git - archive/tide-ocaml.git/commitdiff
tweak glyph drawing
authorMichael D. Lowis <mike@mdlowis.com>
Mon, 16 Oct 2017 01:36:48 +0000 (21:36 -0400)
committerMichael D. Lowis <mike@mdlowis.com>
Mon, 16 Oct 2017 01:36:48 +0000 (21:36 -0400)
edit.ml
lib/x11_prims.c

diff --git a/edit.ml b/edit.ml
index 82251549649a67543c2116c7665600d2c5ddc10e..0e1159f8f7ec82d09568ca21b016fc802cb502e4 100644 (file)
--- a/edit.ml
+++ b/edit.ml
@@ -1,7 +1,10 @@
 open X11
 
-(*let font = font_load "Times New Roman:size=12"*)
+let font = font_load "Times New Roman:size=12"
+(*
 let font = font_load "Monaco:size=10::antialias=true:autohint=true"
+*)
+
 let tags_buf = ref Buf.create
 let edit_buf = ref Buf.create
 
@@ -56,9 +59,9 @@ let draw_buffer pos width height =
     | 0x0A -> newline ()
     | 0x0D -> ()
     | _    -> begin
-        if (!x + glyph.width) > width then (newline ());
-        let _ = X11.draw_glyph Cfg.Color.palette.(5) glyph (!x, !y) in
-        x := !x + glyph.xoff
+        if (!x + glyph.xoff) > width then (newline ());
+        let off = X11.draw_glyph Cfg.Color.palette.(5) glyph (!x, !y) in
+        x := !x + off
     end);
     ((!y + font.height) < height)
   in
index 5daf87a40769a973e2e64ba7782c1a3cfe95ad6f..7dd1881fbd663320e33b72e16e05bb889c6ffb4d 100644 (file)
@@ -252,13 +252,14 @@ CAMLprim value x11_font_glyph(value font, value rune) {
     CAMLreturn(glyph);
 }
 
+
 CAMLprim value x11_draw_glyph(value color, value glyph, value coord) {
     CAMLparam3(color, glyph, coord);
     XftFont* font = (XftFont*)Field(glyph,0);
     XftGlyphFontSpec spec = {
         .font  = font,
         .glyph = intfield(glyph,1),
-        .x     = intfield(coord,0) + intfield(glyph,4),
+        .x     = intfield(coord,0), // - intfield(glyph,4),
         .y     = intfield(coord,1) + font->ascent
     };
 //    printf("c: '%c' w: %d x: %d y: %d xoff: %d yoff: %d\n",