From 2565a37a52a5c714e7c6bbd1808db0d6d37c6ea3 Mon Sep 17 00:00:00 2001 From: John Mark Bell Date: Tue, 21 Jul 2009 10:59:53 +0000 Subject: Refactor text plotter and other font functions to remove dependency on CSS. svn path=/trunk/netsurf/; revision=8641 --- framebuffer/framebuffer.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'framebuffer/framebuffer.c') diff --git a/framebuffer/framebuffer.c b/framebuffer/framebuffer.c index 8885d1fe0..fe3fe12e2 100644 --- a/framebuffer/framebuffer.c +++ b/framebuffer/framebuffer.c @@ -42,7 +42,6 @@ /* netsurf framebuffer library handle */ static nsfb_t *nsfb; -#ifdef FB_USE_FREETYPE static bool framebuffer_plot_disc(int x, int y, int radius, const plot_style_t *style) @@ -75,8 +74,9 @@ static bool framebuffer_plot_polygon(const int *p, unsigned int n, const plot_st } -static bool framebuffer_plot_text(int x, int y, const struct css_style *style, - const char *text, size_t length, colour bg, colour c) +#ifdef FB_USE_FREETYPE +static bool framebuffer_plot_text(int x, int y, const char *text, size_t length, + const plot_font_style_t *fstyle) { uint32_t ucs4; size_t nxtchr = 0; @@ -88,7 +88,7 @@ static bool framebuffer_plot_text(int x, int y, const struct css_style *style, ucs4 = utf8_to_ucs4(text + nxtchr, length - nxtchr); nxtchr = utf8_next(text, length, nxtchr); - glyph = fb_getglyph(style, ucs4); + glyph = fb_getglyph(fstyle, ucs4); if (glyph == NULL) continue; @@ -106,13 +106,13 @@ static bool framebuffer_plot_text(int x, int y, const struct css_style *style, &loc, bglyph->bitmap.buffer, bglyph->bitmap.pitch, - c); + fstyle->foreground); } else { nsfb_plot_glyph8(nsfb, &loc, bglyph->bitmap.buffer, bglyph->bitmap.pitch, - c); + fstyle->foreground); } } x += glyph->advance.x >> 16; @@ -122,10 +122,10 @@ static bool framebuffer_plot_text(int x, int y, const struct css_style *style, } #else -static bool framebuffer_plot_text(int x, int y, const struct css_style *style, - const char *text, size_t length, colour bg, colour c) +static bool framebuffer_plot_text(int x, int y, const char *text, size_t length, + const plot_font_style_t *fstyle) { - const struct fb_font_desc* fb_font = fb_get_font(style); + const struct fb_font_desc* fb_font = fb_get_font(fstyle); const uint32_t *chrp; char *buffer = NULL; int chr; @@ -152,7 +152,7 @@ static bool framebuffer_plot_text(int x, int y, const struct css_style *style, loc.y1 = loc.y0 + fb_font->height; chrp = fb_font->data + ((unsigned char)buffer[chr] * fb_font->height); - nsfb_plot_glyph1(nsfb, &loc, (uint8_t *)chrp, 32, c); + nsfb_plot_glyph1(nsfb, &loc, (uint8_t *)chrp, 32, fstyle->foreground); x+=fb_font->width; -- cgit v1.2.3