static MRealizedFont *xfont_select (MFrame *, MFont *, MFont *, int);
static int xfont_open (MRealizedFont *);
static void xfont_close (MRealizedFont *);
-static void xfont_find_metric (MRealizedFont *, MGlyph *);
+static void xfont_find_metric (MRealizedFont *, MGlyphString *, int, int);
static unsigned xfont_encode_char (MRealizedFont *, int, unsigned);
static void xfont_render (MDrawWindow, int, int, MGlyphString *,
MGlyph *, MGlyph *, int, MDrawRegion);
/* The X font driver function FIND_METRIC. */
static void
-xfont_find_metric (MRealizedFont *rfont, MGlyph *g)
+xfont_find_metric (MRealizedFont *rfont, MGlyphString *gstring,
+ int from, int to)
{
- XCharStruct *pcm = NULL;
MXFontInfo *xfont = (MXFontInfo *) rfont->info;
XFontStruct *f = xfont->f;
- int byte1, byte2;
+ MGlyph *g = MGLYPH (from), *gend = MGLYPH (to);
- if (g->code == MCHAR_INVALID_CODE)
+ for (; g != gend; g++)
{
- g->lbearing = f->max_bounds.lbearing;
- g->rbearing = f->max_bounds.rbearing;
- g->width = f->max_bounds.width;
- g->ascent = f->ascent;
- g->descent = f->descent;
- return;
- }
-
- byte1 = g->code >> 8;
- byte2 = g->code & 0xFF;
-
- if (f->per_char != NULL)
- {
- if (f->min_byte1 == 0 && f->max_byte1 == 0)
+ if (g->code == MCHAR_INVALID_CODE)
{
- if (byte1 == 0
- && byte2 >= f->min_char_or_byte2
- && byte2 <= f->max_char_or_byte2)
- pcm = f->per_char + byte2 - f->min_char_or_byte2;
+ g->lbearing = f->max_bounds.lbearing;
+ g->rbearing = f->max_bounds.rbearing;
+ g->width = f->max_bounds.width;
+ g->ascent = f->ascent;
+ g->descent = f->descent;
}
else
{
- if (byte1 >= f->min_byte1
- && byte1 <= f->max_byte1
- && byte2 >= f->min_char_or_byte2
- && byte2 <= f->max_char_or_byte2)
+ int byte1 = g->code >> 8, byte2 = g->code & 0xFF;
+ XCharStruct *pcm = NULL;
+
+ if (f->per_char != NULL)
{
- pcm = (f->per_char
- + ((f->max_char_or_byte2-f->min_char_or_byte2 + 1)
- * (byte1 - f->min_byte1))
- + (byte2 - f->min_char_or_byte2));
+ if (f->min_byte1 == 0 && f->max_byte1 == 0)
+ {
+ if (byte1 == 0
+ && byte2 >= f->min_char_or_byte2
+ && byte2 <= f->max_char_or_byte2)
+ pcm = f->per_char + byte2 - f->min_char_or_byte2;
+ }
+ else
+ {
+ if (byte1 >= f->min_byte1
+ && byte1 <= f->max_byte1
+ && byte2 >= f->min_char_or_byte2
+ && byte2 <= f->max_char_or_byte2)
+ {
+ pcm = (f->per_char
+ + ((f->max_char_or_byte2-f->min_char_or_byte2 + 1)
+ * (byte1 - f->min_byte1))
+ + (byte2 - f->min_char_or_byte2));
+ }
+ }
}
- }
- }
- if (pcm)
- {
- g->lbearing = pcm->lbearing;
- g->rbearing = pcm->rbearing;
- g->width = pcm->width;
- g->ascent = pcm->ascent;
- g->descent = pcm->descent;
- }
- else
- {
- /* If the per_char pointer is null, all glyphs between the first
- and last character indexes inclusive have the same
- information, as given by both min_bounds and max_bounds. */
- g->lbearing = 0;
- g->rbearing = f->max_bounds.width;
- g->width = f->max_bounds.width;
- g->ascent = f->ascent;
- g->descent = f->descent;
+ if (pcm)
+ {
+ g->lbearing = pcm->lbearing;
+ g->rbearing = pcm->rbearing;
+ g->width = pcm->width;
+ g->ascent = pcm->ascent;
+ g->descent = pcm->descent;
+ }
+ else
+ {
+ /* If the per_char pointer is null, all glyphs between
+ the first and last character indexes inclusive have
+ the same information, as given by both min_bounds and
+ max_bounds. */
+ g->lbearing = 0;
+ g->rbearing = f->max_bounds.width;
+ g->width = f->max_bounds.width;
+ g->ascent = f->ascent;
+ g->descent = f->descent;
+ }
+ }
}
}
void
mwin__draw_points (MFrame *frame, MDrawWindow win, MRealizedFace *rface,
- int intensity, MDrawPoint *points, int num, int pixmap)
-{
- GCInfo *info = rface->info;
-
- if (! pixmap && intensity)
- intensity = 7;
- if (! info->gc[intensity])
- info->gc[intensity] = get_gc_for_anti_alias (frame->device, info,
- intensity);
- XDrawPoints (FRAME_DISPLAY (frame), (Window) win, info->gc[intensity],
- (XPoint *) points, num, CoordModeOrigin);
-}
-
-
-void
-mwin__draw_bitmap (MFrame *frame, MDrawWindow win, MRealizedFace *rface,
- int reverse, int x, int y,
- int width, int height, int row_bytes, unsigned char *pmp,
- MDrawRegion region, int pixmap)
+ int intensity, MDrawPoint *points, int num,
+ MDrawRegion region)
{
- Display *display = FRAME_DISPLAY (frame);
GCInfo *info = rface->info;
- int i, j;
+ GC gc;
- for (i = 0; i < height; i++, pmp += row_bytes)
- for (j = 0; j < width; j++)
- if (pmp[j])
- {
- int intensity;
- GC gc;
+ if (! (gc = info->gc[intensity]))
+ gc = info->gc[intensity] = get_gc_for_anti_alias (frame->device, info,
+ intensity);
+ if (region)
+ gc = set_region (frame, gc, region);
- if (pixmap)
- intensity= reverse ? (7 - (pmp[j] >> 5)) : (pmp[j] >> 5);
- else
- intensity = 7;
- gc = info->gc[intensity];
- if (! gc)
- gc = info->gc[intensity]
- = get_gc_for_anti_alias (frame->device, info, intensity);
- if (region)
- gc = set_region (frame, gc, region);
- XDrawPoint (display, (Window) win, gc, x + j, y + i);
- }
+ XDrawPoints (FRAME_DISPLAY (frame), (Window) win, gc,
+ (XPoint *) points, num, CoordModeOrigin);
}