Am Mittwoch, den 29.09.2010, 15:15 +0200 schrieb Rob Kendrick
<rjek(a)netsurf-browser.org>:
I doubt it; I suspect colour-reducing FreeType's
256-shades-of-gray
output to nearest colour in your colour set will still be quicker than
the second pass. I suspect removing this option rather than fixing any
possible problem with it would be a better choice.
I got it working, but I'm not sure if it really renders 100% correct...
the output is really not that pretty at many font sizes, it's even so
buggy that the C looks more like an O... so I expect there is some error
in my code..., or maybe it is caused by the hinting settings...? Here is
an screenshot:
http://img545.imageshack.us/img545/2453/nsscreenmonorendering.png
and this is the glyph1 routine that I use:
static bool
glyph1(nsfb_t *nsfb,
nsfb_bbox_t *loc,
const uint8_t *pixel,
int pitch,
nsfb_colour_t c)
{
PLOT_TYPE *pvideo;
PLOT_TYPE fgcol;
int xloop, yloop;
int xoff, yoff; /* x and y offset into image */
int x = loc->x0;
int y = loc->y0;
int width = loc->x1 - loc->x0;
int height = loc->y1 - loc->y0;
uint8_t bitm;
const uint8_t *fntd;
if (!nsfb_plot_clip_ctx(nsfb, loc))
return true;
if (height > (loc->y1 - loc->y0))
height = (loc->y1 - loc->y0);
if (width > (loc->x1 - loc->x0))
width = (loc->x1 - loc->x0);
xoff = loc->x0 - x;
yoff = loc->y0 - y;
fgcol = colour_to_pixel(nsfb, c);
for (yloop = yoff; yloop <height; yloop++) {
fntd = pixel + (pitch * yloop);
for ( xloop = xoff, bitm = 128; xloop < width; xloop++, bitm =
bitm>>1 ) {
pvideo = get_xy_loc(nsfb, loc->x0 + xloop, loc->y0 + yloop);
if( *fntd & bitm )
*pvideo = fgcol;
if( bitm == 1 ) {
fntd++;
bitm = 128;
}
}
}
return true;
}
Btw.: I'm just posting because I'm interested in this, I know it's not
urgent. Maybe someone also is interested in this. I don't have attitude
like: "could you fix this fast,..." ;)
Greets,
m