/* * Generalized low level routine to get the bitmap associated * with a character. Handles fixed and proportional fonts. */ void gen_gettextbits(PMWFONT pfont, int ch, const MWIMAGEBITS **retmap, MWCOORD *pwidth, MWCOORD *pheight, MWCOORD *pbase) { PMWCFONT pf = ((PMWCOREFONT)pfont)->cfont; int count, width; const MWIMAGEBITS * bits; /* if char not in font, map to first character by default*/ if(ch < pf->firstchar || ch >= pf->firstchar+pf->size) ch = pf->firstchar; ch -= pf->firstchar; /* get font bitmap depending on fixed pitch or not*/ bits = pf->bits + (pf->offset? pf->offset[ch]: (pf->height * ch)); width = pf->width ? pf->width[ch] : pf->maxwidth; count = MWIMAGE_WORDS(width) * pf->height; *retmap = bits; /* return width depending on fixed pitch or not*/ *pwidth = width; *pheight = pf->height; *pbase = pf->ascent; }
/* * Set the cursor size and bitmaps. */ void GdSetCursor(PMWCURSOR pcursor) { int bytes; GdHideCursor(&scrdev); curmaxx = curminx + pcursor->width - 1; curmaxy = curminy + pcursor->height - 1; curfg = GdFindColor(pcursor->fgcolor); curbg = GdFindColor(pcursor->bgcolor); bytes = MWIMAGE_WORDS(pcursor->width) * pcursor->height * sizeof(MWIMAGEBITS); memcpy(cursorcolor, pcursor->image, bytes); memcpy(cursormask, pcursor->mask, bytes); GdShowCursor(&scrdev); }