/* * gcc -Wall -o 28801 28801.c -lX{render,ext,11} * * Author: Adam Jackson * * Hacked up from libXrender/src/Glyphs.c, which is: * * Copyright © 2000 SuSE, Inc. * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of SuSE not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. SuSE makes no representations about the * suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * * Author: Keith Packard, SuSE, Inc. */ #define NEED_EVENTS #define NEED_REPLIES #include #include #include #include #include /* * cheating */ typedef struct _XRenderExtDisplayInfo { struct _XRenderExtDisplayInfo *next; /* keep a linked list */ Display *display; /* which display this is */ XExtCodes *codes; /* the extension protocol codes */ #if 0 XRenderInfo *info; /* extra data for the extension to use */ #endif } XRenderExtDisplayInfo; extern XRenderExtDisplayInfo *XRenderFindDisplay(Display *); void XRenderMisAddGlyphs(Display *dpy, GlyphSet glyphset, Glyph *gids, XGlyphInfo *glyphs, int nglyphs, char *images, int nbyte_images) { xRenderAddGlyphsReq *req; long len; int major, event, error; if (nbyte_images & 3) nbyte_images += 4 - (nbyte_images & 3); XQueryExtension(dpy, "RENDER", &major, &event, &error); LockDisplay(dpy); GetReq(RenderAddGlyphs, req); req->reqType = major; req->renderReqType = X_RenderAddGlyphs; req->glyphset = glyphset; req->nglyphs = nglyphs; #if 0 len = (nglyphs * (SIZEOF (xGlyphInfo) + 4) + nbyte_images) >> 2; SetReqLen(req, len, len); Data32 (dpy, (long *) gids, nglyphs * 4); Data16 (dpy, (short *) glyphs, nglyphs * SIZEOF (xGlyphInfo)); Data (dpy, images, nbyte_images); #endif UnlockDisplay(dpy); SyncHandle(); } int main(void) { Display *dpy; GlyphSet gs; setbuf(stdout, NULL); dpy = XOpenDisplay(NULL); if (!dpy) { printf("Couldn't open display\n"); return 1; } XSynchronize(dpy, 1); XRenderQueryFormats(dpy); /* create glyphset */ gs = XRenderCreateGlyphSet(dpy, XRenderFindStandardFormat(dpy, PictStandardA8)); XRenderMisAddGlyphs(dpy, gs, NULL, NULL, 500, NULL, 0); return 0; }