Skip to main content
Topic: [patch] Glitch of non-standard font (Read 2350 times) previous topic - next topic

[patch] Glitch of non-standard font

Some Chinese players prefer to use wenquanyi_9pt.bdf instead of the standard font as some characters can't be properly displayed.

However, the font height of wenquanyi_9pt is actually 14px, resulting in some garbage pixels underneath the characters as in the attached image. Those garbage pixels are caused by the text-displaying routine trying to read beyond the boundary of image data.

The attached patch fixes this problem.



Re: [patch] Glitch of non-standard font

Reply #1
The reading of the BDF character seems strange: Why ignoring characters with negative offset completely? The should not happen; but moving those characters one pixel down or ignoring top rows would achieve still a readab le charecter (mostly).

Re: [patch] Glitch of non-standard font

Reply #2
I think you are referring to this block of code :
Quote
// read for height times
for (y = top; y < h; y++) {
   fgets(str, sizeof(str), fin);
   if(  y>=0  ) {
      dsp_decode_bdf_data_row(data + char_nr*CHARACTER_LEN, y, xoff, g_width, str);
   }
}

If y is negative, calling dsp_decode_bdf_data_row() with such value will cause the previous character's data be overwritten partially. This should not be allowed.

Edit :

Forgot to say, that this problem does happen in wenquanyi_9pt.bdf. An example will be character with encoding 594 (height=12, desc=2).

Edit :

Just want to make it clear : my fix above ignores the top (negative) rows only, but not ignoring the character completely as you think.


 

Re: [patch] Glitch of non-standard font

Reply #3
The display routines are fixed anyway. I will try this for the reader.