fix RISC OS font layout routines to return the correct error codes

During the font layout table refactor the return type was changed to
nserror and the risc os code was not updated correctly.
This commit is contained in:
Vincent Sanders 2016-04-28 11:31:31 +01:00
parent d6b6dafe50
commit cae22b17ac
1 changed files with 29 additions and 21 deletions

View File

@ -221,7 +221,7 @@ ro_font_width(const plot_font_style_t *fstyle,
nsfont_read_style(fstyle, &font_family, &font_size, &font_style);
if (font_size == 0) {
*width = 0;
return true;
return NSERROR_OK;
}
code = rufl_width(font_family, font_style, font_size,
@ -234,11 +234,11 @@ ro_font_width(const plot_font_style_t *fstyle,
LOG("rufl_width: 0x%x", code);
/* ro_warn_user("MiscError", "font error"); */
*width = 0;
return false;
return NSERROR_INVALID;
}
*width /= 2;
return true;
return NSERROR_OK;
}
@ -267,7 +267,7 @@ ro_font_position(const plot_font_style_t *fstyle,
if (font_size == 0) {
*char_offset = 0;
*actual_x = 0;
return true;
return NSERROR_OK;
}
code = rufl_x_to_offset(font_family, font_style, font_size,
@ -281,11 +281,12 @@ ro_font_position(const plot_font_style_t *fstyle,
/* ro_warn_user("MiscError", "font error"); */
*char_offset = 0;
*actual_x = 0;
return false;
return NSERROR_INVALID;
}
*actual_x /= 2;
return true;
return NSERROR_OK;
}
@ -325,21 +326,23 @@ ro_font_split(const plot_font_style_t *fstyle,
if (font_size == 0) {
*char_offset = 0;
*actual_x = 0;
return true;
return NSERROR_OK;
}
code = rufl_split(font_family, font_style, font_size,
string, length,
x * 2, char_offset, actual_x);
if (code != rufl_OK) {
if (code == rufl_FONT_MANAGER_ERROR)
LOG("rufl_split: rufl_FONT_MANAGER_ERROR: ""0x%x: %s", rufl_fm_error->errnum, rufl_fm_error->errmess);
else
if (code == rufl_FONT_MANAGER_ERROR) {
LOG("rufl_split: rufl_FONT_MANAGER_ERROR: ""0x%x: %s",
rufl_fm_error->errnum, rufl_fm_error->errmess);
} else {
LOG("rufl_split: 0x%x", code);
}
/* ro_warn_user("MiscError", "font error"); */
*char_offset = 0;
*actual_x = 0;
return false;
return NSERROR_INVALID;
}
if (*char_offset != length) {
@ -347,34 +350,38 @@ ro_font_split(const plot_font_style_t *fstyle,
size_t orig = *char_offset;
/* ensure a space at <= the split point we found */
while (*char_offset && string[*char_offset] != ' ')
while (*char_offset && string[*char_offset] != ' ') {
(*char_offset)--;
}
/* nothing valid found <= split point, advance to next space */
if (*char_offset == 0) {
*char_offset = orig;
while (*char_offset != length &&
string[*char_offset] != ' ')
while ((*char_offset != length) &&
(string[*char_offset] != ' ')) {
(*char_offset)++;
}
}
}
code = rufl_width(font_family, font_style, font_size,
string, *char_offset,
actual_x);
if (code != rufl_OK) {
if (code == rufl_FONT_MANAGER_ERROR)
LOG("rufl_width: rufl_FONT_MANAGER_ERROR: 0x%x: %s", rufl_fm_error->errnum, rufl_fm_error->errmess);
else
if (code == rufl_FONT_MANAGER_ERROR) {
LOG("rufl_width: rufl_FONT_MANAGER_ERROR: 0x%x: %s",
rufl_fm_error->errnum, rufl_fm_error->errmess);
} else {
LOG("rufl_width: 0x%x", code);
}
/* ro_warn_user("MiscError", "font error"); */
*char_offset = 0;
*actual_x = 0;
return false;
return NSERROR_INVALID;
}
*actual_x /= 2;
return true;
return NSERROR_OK;
}
@ -407,11 +414,12 @@ bool nsfont_paint(const plot_font_style_t *fstyle, const char *string,
code = rufl_paint(font_family, font_style, font_size,
string, length, x, y, flags);
if (code != rufl_OK) {
if (code == rufl_FONT_MANAGER_ERROR)
if (code == rufl_FONT_MANAGER_ERROR) {
LOG("rufl_paint: rufl_FONT_MANAGER_ERROR: 0x%x: %s", rufl_fm_error->errnum, rufl_fm_error->errmess);
else
} else {
LOG("rufl_paint: 0x%x", code);
}
}
return true;
}