diff options
author | Chris Young <chris@unsatisfactorysoftware.co.uk> | 2016-01-15 19:36:12 +0000 |
---|---|---|
committer | Chris Young <chris@unsatisfactorysoftware.co.uk> | 2016-01-15 19:37:21 +0000 |
commit | 6ad939b5a6e7807eaad78d5b2e0486c859740cf3 (patch) | |
tree | 6affc4a32a158ea63c14e1edbd03781753cd6cae /amiga/font_bitmap.c | |
parent | f831d81ab1895b4f9c19f53f08d9c8fccd69c96e (diff) | |
download | netsurf-6ad939b5a6e7807eaad78d5b2e0486c859740cf3.tar.gz netsurf-6ad939b5a6e7807eaad78d5b2e0486c859740cf3.tar.bz2 |
Make font engine selection bit more logical
Diffstat (limited to 'amiga/font_bitmap.c')
-rw-r--r-- | amiga/font_bitmap.c | 31 |
1 files changed, 24 insertions, 7 deletions
diff --git a/amiga/font_bitmap.c b/amiga/font_bitmap.c index eed43dbd2..d9459b029 100644 --- a/amiga/font_bitmap.c +++ b/amiga/font_bitmap.c @@ -1,5 +1,5 @@ /* - * Copyright 2008 - 2015 Chris Young <chris@unsatisfactorysoftware.co.uk> + * Copyright 2008 - 2016 Chris Young <chris@unsatisfactorysoftware.co.uk> * * This file is part of NetSurf, http://www.netsurf-browser.org/ * @@ -112,7 +112,7 @@ static size_t ami_font_bm_convert_local_to_utf8_offset(const char *utf8string, i } -bool amiga_bm_nsfont_width(const plot_font_style_t *fstyle, +static bool amiga_bm_nsfont_width(const plot_font_style_t *fstyle, const char *string, size_t length, int *width) { @@ -149,7 +149,7 @@ bool amiga_bm_nsfont_width(const plot_font_style_t *fstyle, * \return true on success, false on error and error reported */ -bool amiga_bm_nsfont_position_in_string(const plot_font_style_t *fstyle, +static bool amiga_bm_nsfont_position_in_string(const plot_font_style_t *fstyle, const char *string, size_t length, int x, size_t *char_offset, int *actual_x) { @@ -203,7 +203,7 @@ bool amiga_bm_nsfont_position_in_string(const plot_font_style_t *fstyle, * Returning char_offset == length means no split possible */ -bool amiga_bm_nsfont_split(const plot_font_style_t *fstyle, +static bool amiga_bm_nsfont_split(const plot_font_style_t *fstyle, const char *string, size_t length, int x, size_t *char_offset, int *actual_x) { @@ -243,7 +243,7 @@ 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); *char_offset = ami_font_bm_convert_local_to_utf8_offset(string, length, co); } else { @@ -257,9 +257,13 @@ bool amiga_bm_nsfont_split(const plot_font_style_t *fstyle, return true; } -ULONG ami_font_bm_text(struct RastPort *rp, const char *string, ULONG length, - const plot_font_style_t *fstyle, ULONG dx, ULONG dy) +static ULONG amiga_bm_nsfont_text(struct RastPort *rp, const char *string, ULONG length, + const plot_font_style_t *fstyle, ULONG dx, ULONG dy, bool aa) { + if(!string || string[0]=='\0') return 0; + if(!length) return 0; + if(rp == NULL) return 0; + struct TextFont *bmfont = ami_font_bm_open(rp, fstyle); char *localtext = NULL; if(bmfont == NULL) return 0; @@ -274,3 +278,16 @@ ULONG ami_font_bm_text(struct RastPort *rp, const char *string, ULONG length, return 0; } +const struct ami_font_functions ami_font_diskfont_table = { + amiga_bm_nsfont_width, + amiga_bm_nsfont_position_in_string, + amiga_bm_nsfont_split, + amiga_bm_nsfont_text +}; + +void ami_font_diskfont_init(void) +{ + /* Set up table */ + ami_nsfont = &ami_font_diskfont_table; +} + |