#include <X11/X.h>#include <X11/Xlib.h>Include dependency graph for xfonts.c:

Go to the source code of this file.
Data Structures | |
| struct | gs_point_s |
| struct | gs_int_point_s |
| struct | gs_int_rect_s |
Typedefs | |
| typedef gs_point_s | gs_point |
| typedef gs_int_point_s | gs_int_point |
| typedef gs_int_rect_s | gs_int_rect |
Functions | |
| int | x_char_metrics (XFontStruct *x11font, char chr, gs_point *pwidth, gs_int_rect *pbbox) |
| int | x_render_char (Display *dpy, XFontStruct *x11font, char chr, int xo, int yo) |
| typedef struct gs_int_point_s gs_int_point |
| typedef struct gs_int_rect_s gs_int_rect |
| typedef struct gs_point_s gs_point |
| int x_char_metrics | ( | XFontStruct * | x11font, | |
| char | chr, | |||
| gs_point * | pwidth, | |||
| gs_int_rect * | pbbox | |||
| ) |
Definition at line 14 of file xfonts.c.
References i, int, NULL, gs_int_rect_s::p, gs_int_rect_s::q, gs_int_point_s::x, gs_point_s::x, gs_int_point_s::y, and gs_point_s::y.
Referenced by x_render_char().
00015 { 00016 if (x11font->per_char == NULL) { 00017 pwidth->x = x11font->max_bounds.width; 00018 pwidth->y = 0; 00019 pbbox->p.x = x11font->max_bounds.lbearing; 00020 pbbox->q.x = x11font->max_bounds.rbearing; 00021 pbbox->p.y = -x11font->max_bounds.ascent; 00022 pbbox->q.y = x11font->max_bounds.descent; 00023 } else { 00024 int i = (int)chr - x11font->min_char_or_byte2; 00025 00026 pwidth->x = x11font->per_char[i].width; 00027 pwidth->y = 0; 00028 00029 pbbox->p.x = x11font->per_char[i].lbearing; 00030 pbbox->q.x = x11font->per_char[i].rbearing; 00031 pbbox->p.y = -x11font->per_char[i].ascent; 00032 pbbox->q.y = x11font->per_char[i].descent; 00033 } 00034 return 0; 00035 }
Here is the caller graph for this function:

Definition at line 39 of file xfonts.c.
References b, code, h, i, NULL, gs_int_rect_s::p, gs_int_rect_s::q, w, gs_int_point_s::x, x, x_char_metrics(), gs_int_point_s::y, and y.
00040 { 00041 gs_int_rect bbox; 00042 int x, y, w, h; 00043 00044 00045 /* Display on an intermediate bitmap, then copy the bits. */ 00046 int i; 00047 XImage *xim; 00048 Pixmap xpm; 00049 GC fgc; 00050 gs_point wxy; 00051 int code; 00052 00053 code = x_char_metrics(x11font, chr, &wxy, &bbox); 00054 00055 w = bbox.q.x - bbox.p.x; 00056 h = bbox.q.y - bbox.p.y; 00057 00058 00059 xpm = XCreatePixmap(dpy, InputOnly, w, h, 1); 00060 fgc = XCreateGC(dpy, xpm, None, NULL); 00061 XSetForeground(dpy, fgc, 0); 00062 XFillRectangle(dpy, xpm, fgc, 0, 0, w, h); 00063 XSetForeground(dpy, fgc, 1); 00064 XSetFont(dpy, fgc, x11font->fid); 00065 XDrawString(dpy, xpm, fgc, -bbox.p.x, -bbox.p.y, &chr, 1); 00066 xim = XGetImage(dpy, xpm, 0, 0, w, h, 1, ZPixmap); 00067 i = 0; 00068 for (y = 0; y < h; y++) { 00069 char b; 00070 00071 for (x = 0; x < w; x++) { 00072 b = XGetPixel(xim, x, y); 00073 /* if ((x & 7) == 7) 00074 bits[i++] = b;*/ 00075 } 00076 } 00077 XFreePixmap(dpy, xpm); 00078 XFreeGC(dpy, fgc); 00079 XDestroyImage(xim); 00080 return; 00081 00082 }
Here is the call graph for this function:

1.5.1