Fix Amiga build following recent API change
This commit is contained in:
parent
cae22b17ac
commit
e5a05f1c0e
|
@ -20,6 +20,7 @@
|
|||
#define AMIGA_FONT_H
|
||||
|
||||
#include "desktop/plotters.h"
|
||||
#include "utils/errors.h"
|
||||
#include <graphics/rastport.h>
|
||||
#include <graphics/text.h>
|
||||
|
||||
|
@ -37,15 +38,15 @@ void ami_font_close_disk_font(struct TextFont *tfont);
|
|||
|
||||
/* Font engine tables */
|
||||
struct ami_font_functions {
|
||||
bool (*width)(const plot_font_style_t *fstyle,
|
||||
nserror (*width)(const plot_font_style_t *fstyle,
|
||||
const char *string, size_t length,
|
||||
int *width);
|
||||
|
||||
bool (*posn)(const plot_font_style_t *fstyle,
|
||||
nserror (*posn)(const plot_font_style_t *fstyle,
|
||||
const char *string, size_t length,
|
||||
int x, size_t *char_offset, int *actual_x);
|
||||
|
||||
bool (*split)(const plot_font_style_t *fstyle,
|
||||
nserror (*split)(const plot_font_style_t *fstyle,
|
||||
const char *string, size_t length,
|
||||
int x, size_t *char_offset, int *actual_x);
|
||||
|
||||
|
|
|
@ -155,7 +155,7 @@ static inline uint32 amiga_nsfont_decode_surrogate(const uint16 *char1)
|
|||
}
|
||||
}
|
||||
|
||||
static bool amiga_nsfont_width(const plot_font_style_t *fstyle,
|
||||
static nserror amiga_nsfont_width(const plot_font_style_t *fstyle,
|
||||
const char *string, size_t length,
|
||||
int *width)
|
||||
{
|
||||
|
@ -163,7 +163,7 @@ static bool amiga_nsfont_width(const plot_font_style_t *fstyle,
|
|||
|
||||
if(*width <= 0) *width == length; // fudge
|
||||
|
||||
return true;
|
||||
return NSERROR_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -178,7 +178,7 @@ static bool amiga_nsfont_width(const plot_font_style_t *fstyle,
|
|||
* \return true on success, false on error and error reported
|
||||
*/
|
||||
|
||||
static bool amiga_nsfont_position_in_string(const plot_font_style_t *fstyle,
|
||||
static nserror amiga_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)
|
||||
{
|
||||
|
@ -191,9 +191,9 @@ static bool amiga_nsfont_position_in_string(const plot_font_style_t *fstyle,
|
|||
ULONG emwidth = (ULONG)NSA_FONT_EMWIDTH(fstyle->size);
|
||||
int32 tempx;
|
||||
|
||||
if(utf8_to_enc(string,"UTF-16",length,(char **)&utf16) != NSERROR_OK) return false;
|
||||
if(utf8_to_enc(string,"UTF-16",length,(char **)&utf16) != NSERROR_OK) return NSERROR_INVALID;
|
||||
outf16 = utf16;
|
||||
if(!(ofont = ami_open_outline_font(fstyle, 0))) return false;
|
||||
if(!(ofont = ami_open_outline_font(fstyle, 0))) return NSERROR_INVALID;
|
||||
|
||||
*char_offset = 0;
|
||||
*actual_x = 0;
|
||||
|
@ -226,7 +226,7 @@ static bool amiga_nsfont_position_in_string(const plot_font_style_t *fstyle,
|
|||
*char_offset = utf8_pos;
|
||||
}
|
||||
free(outf16);
|
||||
return true;
|
||||
return NSERROR_OK;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -234,7 +234,7 @@ static bool amiga_nsfont_position_in_string(const plot_font_style_t *fstyle,
|
|||
*char_offset = length;
|
||||
|
||||
free(outf16);
|
||||
return true;
|
||||
return NSERROR_OK;
|
||||
}
|
||||
|
||||
|
||||
|
@ -261,7 +261,7 @@ static bool amiga_nsfont_position_in_string(const plot_font_style_t *fstyle,
|
|||
* Returning char_offset == length means no split possible
|
||||
*/
|
||||
|
||||
static bool amiga_nsfont_split(const plot_font_style_t *fstyle,
|
||||
static nserror amiga_nsfont_split(const plot_font_style_t *fstyle,
|
||||
const char *string, size_t length,
|
||||
int x, size_t *char_offset, int *actual_x)
|
||||
{
|
||||
|
@ -277,11 +277,11 @@ static bool amiga_nsfont_split(const plot_font_style_t *fstyle,
|
|||
/* Get utf16 conversion of string for glyph measuring routines */
|
||||
if (utf8_to_enc(string, "UTF-16", length, (char **)&utf16_str) !=
|
||||
NSERROR_OK)
|
||||
return false;
|
||||
return NSERROR_INVALID;
|
||||
|
||||
utf16 = utf16_str;
|
||||
if (!(ofont = ami_open_outline_font(fstyle, 0)))
|
||||
return false;
|
||||
return NSERROR_INVALID;
|
||||
|
||||
*char_offset = 0;
|
||||
*actual_x = 0;
|
||||
|
@ -317,7 +317,7 @@ static bool amiga_nsfont_split(const plot_font_style_t *fstyle,
|
|||
/* Reached available width, and a space was found;
|
||||
* split there. */
|
||||
free(utf16_str);
|
||||
return true;
|
||||
return NSERROR_OK;
|
||||
}
|
||||
|
||||
utf16 = utf16next;
|
||||
|
@ -331,7 +331,7 @@ static bool amiga_nsfont_split(const plot_font_style_t *fstyle,
|
|||
|
||||
*char_offset = length;
|
||||
*actual_x = tx;
|
||||
return true;
|
||||
return NSERROR_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -111,21 +111,21 @@ static size_t ami_font_bm_convert_local_to_utf8_offset(const char *utf8string, s
|
|||
}
|
||||
|
||||
|
||||
static bool amiga_bm_nsfont_width(const plot_font_style_t *fstyle,
|
||||
static nserror amiga_bm_nsfont_width(const plot_font_style_t *fstyle,
|
||||
const char *string, size_t length,
|
||||
int *width)
|
||||
{
|
||||
char *localtext = NULL;
|
||||
|
||||
if((glob == NULL) || (glob->rp == NULL)) return false;
|
||||
if((glob == NULL) || (glob->rp == NULL)) return NSERROR_INVALID;
|
||||
*width = length;
|
||||
|
||||
struct TextFont *bmfont = ami_font_bm_open(glob->rp, fstyle);
|
||||
if(bmfont == NULL) return false;
|
||||
if(bmfont == NULL) return NSERROR_INVALID;
|
||||
|
||||
if(utf8_to_local_encoding(string, length, &localtext) != NSERROR_OK) {
|
||||
ami_font_bm_close(bmfont);
|
||||
return false;
|
||||
return NSERROR_INVALID;
|
||||
}
|
||||
|
||||
*width = TextLength(glob->rp, localtext, (UWORD)strlen(localtext));
|
||||
|
@ -133,7 +133,7 @@ static bool amiga_bm_nsfont_width(const plot_font_style_t *fstyle,
|
|||
|
||||
ami_font_bm_close(bmfont);
|
||||
|
||||
return true;
|
||||
return NSERROR_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -148,7 +148,7 @@ static bool amiga_bm_nsfont_width(const plot_font_style_t *fstyle,
|
|||
* \return true on success, false on error and error reported
|
||||
*/
|
||||
|
||||
static bool amiga_bm_nsfont_position_in_string(const plot_font_style_t *fstyle,
|
||||
static nserror 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)
|
||||
{
|
||||
|
@ -157,14 +157,14 @@ static bool amiga_bm_nsfont_position_in_string(const plot_font_style_t *fstyle,
|
|||
char *localtext = NULL;
|
||||
UWORD co = 0;
|
||||
|
||||
if((glob == NULL) || (glob->rp == NULL)) return false;
|
||||
if((glob == NULL) || (glob->rp == NULL)) return NSERROR_INVALID;
|
||||
|
||||
bmfont = ami_font_bm_open(glob->rp, fstyle);
|
||||
if(bmfont == NULL) return false;
|
||||
if(bmfont == NULL) return NSERROR_INVALID;
|
||||
|
||||
if(utf8_to_local_encoding(string, length, &localtext) != NSERROR_OK) {
|
||||
ami_font_bm_close(bmfont);
|
||||
return false;
|
||||
return NSERROR_INVALID;
|
||||
}
|
||||
|
||||
co = TextFit(glob->rp, localtext, (UWORD)strlen(localtext),
|
||||
|
@ -175,7 +175,7 @@ static bool amiga_bm_nsfont_position_in_string(const plot_font_style_t *fstyle,
|
|||
free(localtext);
|
||||
ami_font_bm_close(bmfont);
|
||||
|
||||
return true;
|
||||
return NSERROR_OK;
|
||||
}
|
||||
|
||||
|
||||
|
@ -202,7 +202,7 @@ static bool amiga_bm_nsfont_position_in_string(const plot_font_style_t *fstyle,
|
|||
* Returning char_offset == length means no split possible
|
||||
*/
|
||||
|
||||
static bool amiga_bm_nsfont_split(const plot_font_style_t *fstyle,
|
||||
static nserror 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)
|
||||
{
|
||||
|
@ -211,14 +211,14 @@ static bool amiga_bm_nsfont_split(const plot_font_style_t *fstyle,
|
|||
char *charp;
|
||||
char *localtext;
|
||||
|
||||
if((glob == NULL) || (glob->rp == NULL)) return false;
|
||||
if((glob == NULL) || (glob->rp == NULL)) return NSERROR_INVALID;
|
||||
|
||||
struct TextFont *bmfont = ami_font_bm_open(glob->rp, fstyle);
|
||||
if(bmfont == NULL) return false;
|
||||
if(bmfont == NULL) return NSERROR_INVALID;
|
||||
|
||||
if(utf8_to_local_encoding(string, length, &localtext) != NSERROR_OK) {
|
||||
ami_font_bm_close(bmfont);
|
||||
return false;
|
||||
return NSERROR_INVALID;
|
||||
}
|
||||
|
||||
offset = TextFit(glob->rp, localtext, (UWORD)strlen(localtext),
|
||||
|
@ -253,7 +253,7 @@ static bool amiga_bm_nsfont_split(const plot_font_style_t *fstyle,
|
|||
free(localtext);
|
||||
ami_font_bm_close(bmfont);
|
||||
|
||||
return true;
|
||||
return NSERROR_OK;
|
||||
}
|
||||
|
||||
static ULONG amiga_bm_nsfont_text(struct RastPort *rp, const char *string, ULONG length,
|
||||
|
|
Loading…
Reference in New Issue