From 41d2eca3b12de0c23f18d8f54918d4e71c1a8b56 Mon Sep 17 00:00:00 2001 From: John Mark Bell Date: Tue, 17 Feb 2009 23:44:17 +0000 Subject: Port our UTF-8 routines to parserutils (only enabled when building against Hubbub). Sync our temporary internal copies of these functions with parserutils (which is rather better tested and fixes a number of known bugs in NetSurf's previous UTF-8 handling). Ideally, this will be the only place in NetSurf that has any dependency on parserutils, so port the amiga font code to our internal APIs. svn path=/trunk/netsurf/; revision=6550 --- amiga/font.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'amiga') diff --git a/amiga/font.c b/amiga/font.c index 48a232ff7..7d1da082b 100644 --- a/amiga/font.c +++ b/amiga/font.c @@ -33,8 +33,6 @@ #include #include #include "amiga/options.h" -#include -#include #include static struct OutlineFont *of[CSS_FONT_FAMILY_NOT_SET]; @@ -123,7 +121,7 @@ bool nsfont_position_in_string(const struct css_style *style, uint8 *utf8; uint32 co = 0; - parserutils_charset_utf8_length(string, length, &len); + len = utf8_bounded_length(string, length); if(utf8_to_enc(string,"UTF-16",length,&utf16) != UTF8_CONVERT_OK) return; outf16 = utf16; @@ -143,7 +141,7 @@ bool nsfont_position_in_string(const struct css_style *style, { *actual_x = tx; if(utf8_from_enc(utf16,"UTF-16",4,&utf8) != UTF8_CONVERT_OK) return; - parserutils_charset_utf8_char_byte_length(utf8,&utf8len); + utf8len = utf8_char_byte_length(utf8); free(utf8); if(xglm_X1) @@ -235,7 +233,7 @@ bool nsfont_split(const struct css_style *style, uint32 tx=0,i=0; size_t len; - parserutils_charset_utf8_length(string, length, &len); + len = utf8_bounded_length(string, length); if(utf8_to_enc(string,"UTF-16",length,&utf16) != UTF8_CONVERT_OK) return; outf16 = utf16; if(!(ofont = ami_open_outline_font(style))) return 0; @@ -472,7 +470,7 @@ ULONG ami_unicode_text(struct RastPort *rp,char *string,ULONG length,struct css_ if(!string || string[0]=='\0') return 0; if(!length) return 0; - parserutils_charset_utf8_length(string, length, &len); + len = utf8_bounded_length(string, length); if(utf8_to_enc(string,"UTF-16",length,&utf16) != UTF8_CONVERT_OK) return 0; outf16 = utf16; if(!(ofont = ami_open_outline_font(style))) return 0; -- cgit v1.2.3