Patch for X11 faces

Paul D. Smith (pds@lemming.webo.dg.com)
Wed, 15 Apr 1992 17:21:22 -0400

This is a small patch to faces 1.6.1 which moves the .xbm data over so
that it's in the middle of the image area instead of off to one side;
basically it tries to center the bitmap image horizontally in the
image area. I did this because (almost?) all the .xbm images are
48x48 while the image area is 64x64.

After applying the patch, 48x48 bitmaps will appear with upper-left
corner at 8,0 instead of 0,0.

Note it only moves bitmaps by chunks of 8 pixels, so images that
don't have widths which are multiples of 8 will not be perfectly
centered.

paul
-----
------------------------------------------------------------------
| Paul D. Smith | paul_smith@dg.com |
| Data General Corp. | pds@lemming.webo.dg.com |
| Network Systems Development Division | |
| Open Network Systems Development | "Pretty Damn S..." |
------------------------------------------------------------------
-------------------------------------------------------------------------------
*** get.c-dist Mon Nov 18 23:00:46 1991
--- get.c Wed Apr 15 17:02:09 1992
***************
*** 401,407 ****
unsigned short buf[256] ;
{
FILE *fin ;
! int hgt, i, j, wid ;
char c, *cptr ;
unsigned char vbuf[512] ;
unsigned int tmp ;
--- 401,407 ----
unsigned short buf[256] ;
{
FILE *fin ;
! int hgt, i, j, wid, offset ;
char c, *cptr ;
unsigned char vbuf[512] ;
unsigned int tmp ;
***************
*** 411,416 ****
--- 411,417 ----
if (sscanf(nextline, "#define %s %d", vbuf, &wid) != 2) goto err_end ;
if ((cptr = rindex((char *) vbuf, '_')) == NULL || strcmp(cptr, "_width"))
goto err_end ;
+ offset = ((iconwidth - wid) / 2) / 8;
wid = (wid + 7) / 8 ;

if (fgets(nextline, MAXLINE, fin) == NULL) goto err_end ;
***************
*** 426,437 ****
{
for (i = 0; i < sizeof(vbuf); vbuf[i++] = 0) continue ;
for (i = 0; i < hgt; i++)
! for (j = 0; j < wid; j++)
{
tmp = get_hex(fin) & 0xFF ;
if (j < (iconwidth / 8))
vbuf[i*8+j] = (unsigned char) tmp ;
}
for (i = 0; i < 256; i++)
buf[i] = (revtable[vbuf[(i*2)+1]] & 0xFF) +
((revtable[vbuf[i*2]] & 0xFF) << 8) ;
--- 427,442 ----
{
for (i = 0; i < sizeof(vbuf); vbuf[i++] = 0) continue ;
for (i = 0; i < hgt; i++)
! {
! for (j = 0; j < offset; j++)
! vbuf[i*8+j] = 0;
! for (; j < wid+offset; j++)
{
tmp = get_hex(fin) & 0xFF ;
if (j < (iconwidth / 8))
vbuf[i*8+j] = (unsigned char) tmp ;
}
+ }
for (i = 0; i < 256; i++)
buf[i] = (revtable[vbuf[(i*2)+1]] & 0xFF) +
((revtable[vbuf[i*2]] & 0xFF) << 8) ;