diff options
| author | No author <no_author@ocaml.org> | 1995-06-15 16:08:54 +0000 |
|---|---|---|
| committer | No author <no_author@ocaml.org> | 1995-06-15 16:08:54 +0000 |
| commit | 77b1c8b89fd8940a63b17c41eb37161e5d159831 (patch) | |
| tree | 43dbfb3982d9166b717199cb8faa97bdce30add7 /otherlibs/graph/text.c | |
| parent | ba79d4bd1f01a70b892c69f6a5e6e86714a023d6 (diff) | |
| download | ocaml-unlabeled-1.2.2.tar.gz | |
This commit was manufactured by cvs2svn to create branchunlabeled-1.2.2
'unlabeled-1.2.2'.
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/unlabeled-1.2.2@37 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Diffstat (limited to 'otherlibs/graph/text.c')
| -rw-r--r-- | otherlibs/graph/text.c | 67 |
1 files changed, 0 insertions, 67 deletions
diff --git a/otherlibs/graph/text.c b/otherlibs/graph/text.c deleted file mode 100644 index 22961f5281..0000000000 --- a/otherlibs/graph/text.c +++ /dev/null @@ -1,67 +0,0 @@ -#include "libgraph.h" - -XFontStruct * grfont = NULL; - -static void gr_font(fontname) - char * fontname; -{ - XFontStruct * font = XLoadQueryFont(grdisplay, fontname); - if (font == NULL) gr_fail("cannot find font %s", fontname); - if (grfont != NULL) XFreeFont(grdisplay, grfont); - grfont = font; - XSetFont(grdisplay, grwindow.gc, grfont->fid); - XSetFont(grdisplay, grbstore.gc, grfont->fid); -} - -value gr_set_font(fontname) - value fontname; -{ - gr_check_open(); - gr_font(String_val(fontname)); - return Val_unit; -} - -static void gr_draw_text(txt, len) - char * txt; - int len; -{ - if (grfont == NULL) gr_font(DEFAULT_FONT); - XDrawString(grdisplay, grwindow.win, grwindow.gc, - grx, Wcvt(gry) - grfont->descent + 1, txt, len); - XDrawString(grdisplay, grbstore.win, grbstore.gc, - grx, Bcvt(gry) - grfont->descent + 1, txt, len); - grx += XTextWidth(grfont, txt, len); - XFlush(grdisplay); -} - -value gr_draw_char(chr) - value chr; -{ - char str[1]; - gr_check_open(); - str[0] = Int_val(chr); - gr_draw_text(str, 1); - return Val_unit; -} - -value gr_draw_string(str) - value str; -{ - gr_check_open(); - gr_draw_text(String_val(str), string_length(str)); - return Val_unit; -} - -value gr_text_size(str) - value str; -{ - int width; - value res; - gr_check_open(); - if (grfont == NULL) gr_font(DEFAULT_FONT); - width = XTextWidth(grfont, String_val(str), string_length(str)); - res = alloc_tuple(2); - Field(res, 0) = Val_int(width); - Field(res, 1) = Val_int(grfont->ascent + grfont->descent); - return res; -} |
