diff options
author | Joseph Hunkeler <jhunkeler@gmail.com> | 2015-07-08 20:46:52 -0400 |
---|---|---|
committer | Joseph Hunkeler <jhunkeler@gmail.com> | 2015-07-08 20:46:52 -0400 |
commit | fa080de7afc95aa1c19a6e6fc0e0708ced2eadc4 (patch) | |
tree | bdda434976bc09c864f2e4fa6f16ba1952b1e555 /vendor/x11iraf/obm/ObmW/DrawString.c | |
download | iraf-linux-fa080de7afc95aa1c19a6e6fc0e0708ced2eadc4.tar.gz |
Initial commit
Diffstat (limited to 'vendor/x11iraf/obm/ObmW/DrawString.c')
-rw-r--r-- | vendor/x11iraf/obm/ObmW/DrawString.c | 45 |
1 files changed, 45 insertions, 0 deletions
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 <X11/Intrinsic.h> +#include <X11/StringDefs.h> +#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; + } + } +} |