summaryrefslogtreecommitdiff
path: root/amiga/font.c
diff options
context:
space:
mode:
authorChris Young <chris@unsatisfactorysoftware.co.uk>2008-08-26 18:03:07 +0000
committerChris Young <chris@unsatisfactorysoftware.co.uk>2008-08-26 18:03:07 +0000
commitc7da20b4c16879c4ea08c164aafca0c9feb7d602 (patch)
tree1dc429bcb91cb91952ac94669f560fe945605505 /amiga/font.c
parente11fe86d73450d3f572e5b49ab0dc577ee9178b6 (diff)
downloadnetsurf-c7da20b4c16879c4ea08c164aafca0c9feb7d602.tar.gz
netsurf-c7da20b4c16879c4ea08c164aafca0c9feb7d602.tar.bz2
Improved text reflow more
svn path=/trunk/netsurf/; revision=5208
Diffstat (limited to 'amiga/font.c')
-rw-r--r--amiga/font.c43
1 files changed, 31 insertions, 12 deletions
diff --git a/amiga/font.c b/amiga/font.c
index 706d57d69..1ec5412e0 100644
--- a/amiga/font.c
+++ b/amiga/font.c
@@ -51,19 +51,23 @@ bool nsfont_width(const struct css_style *style,
int *width)
{
struct TextFont *tfont = ami_open_font(style);
+/*
char *buffer;
utf8_to_local_encoding(string,length,&buffer);
if(buffer)
{
- *width = TextLength(currp,buffer,strlen(buffer));
+*/
+ *width = TextLength(currp,string,length); //buffer,strlen(buffer));
+/*
}
else
{
*width=0;
}
+*/
ami_close_font(tfont);
- ami_utf8_free(buffer);
+// ami_utf8_free(buffer);
return true;
}
@@ -89,10 +93,18 @@ bool nsfont_position_in_string(const struct css_style *style,
char *buffer;
utf8_to_local_encoding(string,length,&buffer);
- *char_offset = TextFit(currp,buffer,strlen(buffer),
- &extent,NULL,1,x,32767);
+ if(buffer)
+ {
+ *char_offset = TextFit(currp,buffer,strlen(buffer),
+ &extent,NULL,1,x,32767);
- *actual_x = extent.te_Extent.MaxX;
+ *actual_x = extent.te_Extent.MaxX;
+ }
+ else
+ {
+ *char_offset = 0;
+ *actual_x = 0;
+ }
ami_close_font(tfont);
ami_utf8_free(buffer);
@@ -125,24 +137,31 @@ bool nsfont_split(const struct css_style *style,
ULONG co;
char *charp;
struct TextFont *tfont = ami_open_font(style);
- char *buffer;
- utf8_to_local_encoding(string,length,&buffer);
+// char *buffer;
+// utf8_to_local_encoding(string,length,&buffer);
- co = TextFit(currp,buffer,strlen(buffer),
+ co = TextFit(currp,string,length,
&extent,NULL,1,x,32767);
- charp = buffer+co;
- while((*charp != ' ') && (charp >= buffer))
+ charp = string+co;
+ while(((*charp != ' ')) && (charp > string))
{
charp--;
co--;
}
*char_offset = co;
- *actual_x = TextLength(currp,buffer,co);
+ if(string && co)
+ {
+ *actual_x = TextLength(currp,string,co);
+ }
+ else
+ {
+ *actual_x = 0;
+ }
ami_close_font(tfont);
- ami_utf8_free(buffer);
+// ami_utf8_free(buffer);
return true;
}