Merge branch 'master' of git://git.netsurf-browser.org/netsurf

This commit is contained in:
Chris Young 2016-01-16 00:08:54 +00:00
commit 8c31752f3a
2 changed files with 11 additions and 11 deletions

View File

@ -94,11 +94,11 @@ static void ami_font_bm_close(struct TextFont *bmfont)
CloseFont(bmfont); CloseFont(bmfont);
} }
static size_t ami_font_bm_convert_local_to_utf8_offset(const char *utf8string, int length, size_t offset) static size_t ami_font_bm_convert_local_to_utf8_offset(const char *utf8string, size_t length, UWORD offset)
{ {
size_t chr = 0; size_t chr = 0;
for(size_t i = 0; i < offset; i++) { for(UWORD i = 0; i < offset; i++) {
chr = utf8_next(utf8string, length, chr); chr = utf8_next(utf8string, length, chr);
} }
@ -123,7 +123,7 @@ static bool amiga_bm_nsfont_width(const plot_font_style_t *fstyle,
return false; return false;
} }
*width = TextLength(glob->rp, localtext, strlen(localtext)); *width = (int)TextLength(glob->rp, localtext, (UWORD)strlen(localtext));
free(localtext); free(localtext);
ami_font_bm_close(bmfont); ami_font_bm_close(bmfont);
@ -150,7 +150,7 @@ static bool amiga_bm_nsfont_position_in_string(const plot_font_style_t *fstyle,
struct TextExtent extent; struct TextExtent extent;
struct TextFont *bmfont; struct TextFont *bmfont;
char *localtext = NULL; char *localtext = NULL;
size_t co = 0; UWORD co = 0;
if((glob == NULL) || (glob->rp == NULL)) return false; if((glob == NULL) || (glob->rp == NULL)) return false;
@ -162,7 +162,7 @@ static bool amiga_bm_nsfont_position_in_string(const plot_font_style_t *fstyle,
return false; return false;
} }
co = TextFit(glob->rp, localtext, strlen(localtext), co = TextFit(glob->rp, localtext, (UWORD)strlen(localtext),
&extent, NULL, 1, x, 32767); &extent, NULL, 1, x, 32767);
*char_offset = ami_font_bm_convert_local_to_utf8_offset(string, length, co); *char_offset = ami_font_bm_convert_local_to_utf8_offset(string, length, co);
*actual_x = extent.te_Extent.MaxX; *actual_x = extent.te_Extent.MaxX;
@ -202,7 +202,7 @@ static bool amiga_bm_nsfont_split(const plot_font_style_t *fstyle,
int x, size_t *char_offset, int *actual_x) int x, size_t *char_offset, int *actual_x)
{ {
struct TextExtent extent; struct TextExtent extent;
size_t co, offset; UWORD co, offset;
char *charp; char *charp;
char *localtext; char *localtext;
@ -216,7 +216,7 @@ static bool amiga_bm_nsfont_split(const plot_font_style_t *fstyle,
return false; return false;
} }
offset = TextFit(glob->rp, localtext, strlen(localtext), offset = TextFit(glob->rp, localtext, (UWORD)strlen(localtext),
&extent, NULL, 1, x, 32767); &extent, NULL, 1, x, 32767);
co = offset; co = offset;
@ -237,8 +237,8 @@ static bool amiga_bm_nsfont_split(const plot_font_style_t *fstyle,
} }
} }
if((co > 0) && (co <= strlen(localtext))) { if((co > 0) && (co < strlen(localtext))) {
*actual_x = TextLength(glob->rp, localtext, co); *actual_x = (int)TextLength(glob->rp, localtext, co);
*char_offset = ami_font_bm_convert_local_to_utf8_offset(string, length, co); *char_offset = ami_font_bm_convert_local_to_utf8_offset(string, length, co);
} else { } else {
*actual_x = x; *actual_x = x;
@ -263,7 +263,7 @@ static ULONG amiga_bm_nsfont_text(struct RastPort *rp, const char *string, ULONG
if(bmfont == NULL) return 0; if(bmfont == NULL) return 0;
if(utf8_to_local_encoding(string, length, &localtext) == NSERROR_OK) { if(utf8_to_local_encoding(string, length, &localtext) == NSERROR_OK) {
Move(rp, dx, dy); Move(rp, dx, dy);
Text(rp, localtext, strlen(localtext)); Text(rp, localtext, (UWORD)strlen(localtext));
free(localtext); free(localtext);
} }

View File

@ -4996,7 +4996,7 @@ static void gui_window_set_status(struct gui_window *g, const char *text)
if(utf8text == NULL) return; if(utf8text == NULL) return;
GetAttr(GA_Width, g->shared->objects[GID_STATUS], (ULONG *)&size); GetAttr(GA_Width, g->shared->objects[GID_STATUS], (ULONG *)&size);
chars = TextFit(&scrn->RastPort, utf8text, strlen(utf8text), chars = TextFit(&scrn->RastPort, utf8text, (UWORD)strlen(utf8text),
&textex, NULL, 1, size - 4, scrn->RastPort.TxHeight); &textex, NULL, 1, size - 4, scrn->RastPort.TxHeight);
utf8text[chars] = 0; utf8text[chars] = 0;