Welcome! Log In Create A New Profile

Advanced

st2205term/ax206term bug fix for version 0.11 and below

Posted by ax206geek 
st2205term/ax206term bug fix for version 0.11 and below
July 02, 2012 07:34AM
I reported this problem via email to petergunn:
For the 5x8 font defined in fonts.txt, the last column of # (column 5) along the width isn't used hence it is behaving more like 4x8. This results in truncated capital letter Y and letter w among the character set.

The bug fix created by petergunn in st2205term.c:
static font_t *load_font(char *file,int num)
{
    fprintf(stderr,"load_font(%s,%d) - loading font defintion\n",file,num);
    FILE *fd=fopen(file,"r");
    if (!fd) { perror("fopen"); fprintf(stderr,"ERROR: could not open file : %s\n",file); exit(1); }
    int font_size[4][2];
    if (fscanf(fd,"%d %d %d %d %d %d %d %d",
               &font_size[0][0],&font_size[0][1],&font_size[1][0],&font_size[1][1],
               &font_size[2][0],&font_size[2][1],&font_size[3][0],&font_size[3][1])!=8)
    { fprintf(stderr,"ERROR: could read font sizes from file : %s\n",file); exit(1); }
    fseek(fd,1,SEEK_CUR); 
    int f,sz;
    for (f=0;f<num;f++)
    {
        sz=95*(font_size[f][0]+1)*font_size[f][1];
        if (fseek(fd,sz,SEEK_CUR)<0)
        { perror("fseek "); fprintf(stderr,"ERROR: could read font %d (sz=%d) from file : %s\n",f,sz,file); exit(1); }
    }

    sz=95*(font_size[f][0]+1)*font_size[f][1];
    font_t *d=(font_t *)malloc(sizeof(font_t)+sz);
    d->w=font_size[f][0];
    d->h=font_size[f][1];
    
    if (fread(d->data,1,sz,fd)!=sz)
    { fprintf(stderr,"ERROR: could read font %d (sz=%d) from file : %s\n",f,sz,file); exit(1); }
    fclose(fd);

    return d;
}

The new code will be uploaded in due time in the meantime please apply the fix manually if you need it.
Author:

Your Email:


Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: