From 40e5a5811c6ffce9b0974e93cdd927cbcf60c157 Mon Sep 17 00:00:00 2001 From: Joe Hunkeler Date: Tue, 11 Aug 2015 16:51:37 -0400 Subject: Repatch (from linux) of OSX IRAF --- vendor/x11iraf/obm/ObmW/DrawString.c | 45 ++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 vendor/x11iraf/obm/ObmW/DrawString.c (limited to 'vendor/x11iraf/obm/ObmW/DrawString.c') diff --git a/vendor/x11iraf/obm/ObmW/DrawString.c b/vendor/x11iraf/obm/ObmW/DrawString.c new file mode 100644 index 00000000..280504e8 --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/DrawString.c @@ -0,0 +1,45 @@ +#include +#include +#include "TabString.h" + +/* + * Like DrawString, except it takes an additional "tabs" + * argument, used to specify what horizontal pixel position to + * move to when tab characters are present in the string. If + * the "tabs" argument is NULL, works exactly like its + * counterpart. + */ +void +XfwfDrawString(display, drawable, gc, x, y, string, length, tabs) + Display *display; + Drawable drawable; + GC gc; + int x; + int y; + String string; + int length; + int *tabs; +{ + register char *p, *ep; + register int tx, tab; + + tab = tx = 0; + for (p = string; length; ) + { + ep = strnchr(p, '\t', length); + if (ep && tabs) + { + XDrawString(display, drawable, gc, x+tx, y, + p, ep - p); + tx = tabs[tab++]; + length -= ep - p + 1; + p = ep + 1; + } + else + { + XDrawString(display, drawable, gc, x+tx, y, + p, length); + break; + } + } +} -- cgit