diff options
author | John-Mark Bell <jmb@netsurf-browser.org> | 2021-08-15 13:27:30 +0100 |
---|---|---|
committer | John-Mark Bell <jmb@netsurf-browser.org> | 2021-08-15 13:49:06 +0100 |
commit | a4c41198bdcd21336f0921291c0e9a7b7da36fc3 (patch) | |
tree | 2d41ec8c97042eb3b627339b371d6d9f1e3a4c0f /src | |
parent | 421bacf56744d00db7ccef93daa119ab8ea4ac55 (diff) | |
download | librufl-a4c41198bdcd21336f0921291c0e9a7b7da36fc3.tar.gz librufl-a4c41198bdcd21336f0921291c0e9a7b7da36fc3.tar.bz2 |
Clean up types in public API
Diffstat (limited to 'src')
-rw-r--r-- | src/rufl_decompose.c | 2 | ||||
-rw-r--r-- | src/rufl_init.c | 4 | ||||
-rw-r--r-- | src/rufl_metrics.c | 16 | ||||
-rw-r--r-- | src/rufl_paint.c | 48 |
4 files changed, 39 insertions, 31 deletions
diff --git a/src/rufl_decompose.c b/src/rufl_decompose.c index 2085e8f..0e9f6ea 100644 --- a/src/rufl_decompose.c +++ b/src/rufl_decompose.c @@ -67,7 +67,7 @@ static int *process_path(int *path, struct rufl_decomp_funcs *funcs, rufl_code rufl_decompose_glyph(const char *font_family, rufl_style font_style, unsigned int font_size, - const char *string, size_t len, + const uint8_t *string, size_t len, struct rufl_decomp_funcs *funcs, void *user) { int *buf, *p, *ep; diff --git a/src/rufl_init.c b/src/rufl_init.c index 6cf0be6..e5ce5e5 100644 --- a/src/rufl_init.c +++ b/src/rufl_init.c @@ -29,7 +29,7 @@ struct rufl_font_list_entry *rufl_font_list = 0; size_t rufl_font_list_entries = 0; const char **rufl_family_list = 0; -unsigned int rufl_family_list_entries = 0; +size_t rufl_family_list_entries = 0; struct rufl_family_map_entry *rufl_family_map = 0; os_error *rufl_fm_error = 0; void *rufl_family_menu = 0; @@ -180,7 +180,7 @@ rufl_code rufl_init(void) xhourglass_off(); return code; } - LOG("%zu faces, %u families", rufl_font_list_entries, + LOG("%zu faces, %zu families", rufl_font_list_entries, rufl_family_list_entries); code = rufl_load_cache(); diff --git a/src/rufl_metrics.c b/src/rufl_metrics.c index 0637ddb..876ac53 100644 --- a/src/rufl_metrics.c +++ b/src/rufl_metrics.c @@ -19,10 +19,10 @@ static int rufl_unicode_map_search_cmp(const void *keyval, const void *datum); * Read a font's metrics (sized for a 1pt font) */ rufl_code rufl_font_metrics(const char *font_family, rufl_style font_style, - os_box *bbox, int *xkern, int *ykern, int *italic, - int *ascent, int *descent, - int *xheight, int *cap_height, - signed char *uline_position, unsigned char *uline_thickness) + os_box *bbox, int32_t *xkern, int32_t *ykern, int32_t *italic, + int32_t *ascent, int32_t *descent, + int32_t *xheight, int32_t *cap_height, + int8_t *uline_position, uint8_t *uline_thickness) { unsigned int font; font_f f; @@ -114,10 +114,10 @@ rufl_code rufl_font_metrics(const char *font_family, rufl_style font_style, */ rufl_code rufl_glyph_metrics(const char *font_family, rufl_style font_style, unsigned int font_size, - const char *string, size_t length, - int *x_bearing, int *y_bearing, - int *width, int *height, - int *x_advance, int *y_advance) + const uint8_t *string, size_t length, + int32_t *x_bearing, int32_t *y_bearing, + int32_t *width, int32_t *height, + int32_t *x_advance, int32_t *y_advance) { const char *font_encoding = NULL; unsigned int font, font1, u; diff --git a/src/rufl_paint.c b/src/rufl_paint.c index 360baec..06ed509 100644 --- a/src/rufl_paint.c +++ b/src/rufl_paint.c @@ -27,7 +27,7 @@ static const os_trfm trfm_oblique = static rufl_code rufl_process(rufl_action action, const char *font_family, rufl_style font_style, unsigned int font_size, - const char *string0, size_t length, + const uint8_t *string0, size_t length, int x, int y, unsigned int flags, int *width, int click_x, size_t *char_offset, int *actual_x, rufl_callback_t callback, void *context); @@ -58,7 +58,7 @@ static rufl_code rufl_process_not_available(rufl_action action, rufl_code rufl_paint(const char *font_family, rufl_style font_style, unsigned int font_size, - const char *string, size_t length, + const uint8_t *string, size_t length, int x, int y, unsigned int flags) { return rufl_process(rufl_PAINT, @@ -73,7 +73,7 @@ rufl_code rufl_paint(const char *font_family, rufl_style font_style, rufl_code rufl_width(const char *font_family, rufl_style font_style, unsigned int font_size, - const char *string, size_t length, + const uint8_t *string, size_t length, int *width) { return rufl_process(rufl_WIDTH, @@ -89,7 +89,7 @@ rufl_code rufl_width(const char *font_family, rufl_style font_style, rufl_code rufl_x_to_offset(const char *font_family, rufl_style font_style, unsigned int font_size, - const char *string, size_t length, + const uint8_t *string, size_t length, int click_x, size_t *char_offset, int *actual_x) { @@ -106,7 +106,7 @@ rufl_code rufl_x_to_offset(const char *font_family, rufl_style font_style, rufl_code rufl_split(const char *font_family, rufl_style font_style, unsigned int font_size, - const char *string, size_t length, + const uint8_t *string, size_t length, int width, size_t *char_offset, int *actual_x) { @@ -123,7 +123,7 @@ rufl_code rufl_split(const char *font_family, rufl_style font_style, rufl_code rufl_paint_callback(const char *font_family, rufl_style font_style, unsigned int font_size, - const char *string, size_t length, + const uint8_t *string, size_t length, int x, int y, rufl_callback_t callback, void *context) { @@ -139,11 +139,11 @@ rufl_code rufl_paint_callback(const char *font_family, rufl_style font_style, rufl_code rufl_font_bbox(const char *font_family, rufl_style font_style, unsigned int font_size, - int *bbox) + os_box *bbox) { return rufl_process(rufl_FONT_BBOX, font_family, font_style, font_size, 0, - 0, 0, 0, 0, bbox, 0, 0, 0, 0, 0); + 0, 0, 0, 0, (int *) bbox, 0, 0, 0, 0, 0); } @@ -154,7 +154,7 @@ rufl_code rufl_font_bbox(const char *font_family, rufl_style font_style, rufl_code rufl_process(rufl_action action, const char *font_family, rufl_style font_style, unsigned int font_size, - const char *string0, size_t length, + const uint8_t *string0, size_t length, int x, int y, unsigned int flags, int *width, int click_x, size_t *char_offset, int *actual_x, rufl_callback_t callback, void *context) @@ -168,7 +168,7 @@ rufl_code rufl_process(rufl_action action, size_t offset_u; size_t offset_map[rufl_PROCESS_CHUNK]; unsigned int slant; - const char *string = string0; + const uint8_t *string = string0; struct rufl_character_set *charset; rufl_code code; @@ -310,7 +310,9 @@ rufl_code rufl_process_span(rufl_action action, return code; if (action == rufl_FONT_BBOX) { - rufl_fm_error = xfont_read_info(f, &x[0], &x[1], &x[2], &x[3]); + os_box *bbox = (os_box *) x; + rufl_fm_error = xfont_read_info(f, &bbox->x0, &bbox->y0, + &bbox->x1, &bbox->y1); if (rufl_fm_error) return rufl_FONT_MANAGER_ERROR; return rufl_OK; @@ -385,7 +387,7 @@ rufl_code rufl_process_span_old(rufl_action action, int click_x, size_t *offset, rufl_callback_t callback, void *context) { - char s2[rufl_PROCESS_CHUNK]; + uint8_t s2[rufl_PROCESS_CHUNK]; char *split_point; int x_out, y_out; unsigned int i; @@ -394,12 +396,15 @@ rufl_code rufl_process_span_old(rufl_action action, rufl_code code; if (action == rufl_FONT_BBOX) { + os_box *bbox = (os_box *) x; + /* Don't need encoding for bounding box */ code = rufl_find_font(font, font_size, NULL, &f); if (code != rufl_OK) return code; - rufl_fm_error = xfont_read_info(f, &x[0], &x[1], &x[2], &x[3]); + rufl_fm_error = xfont_read_info(f, &bbox->x0, &bbox->y0, + &bbox->x1, &bbox->y1); if (rufl_fm_error) { LOG("xfont_read_info: 0x%x: %s", rufl_fm_error->errnum, @@ -462,7 +467,8 @@ rufl_code rufl_process_span_old(rufl_action action, return rufl_FONT_MANAGER_ERROR; } - rufl_fm_error = xfont_paint(f, s2, font_OS_UNITS | + rufl_fm_error = xfont_paint(f, (char *) s2, + font_OS_UNITS | (oblique ? font_GIVEN_TRFM : 0) | font_GIVEN_LENGTH | font_GIVEN_FONT | font_KERN | @@ -492,7 +498,7 @@ rufl_code rufl_process_span_old(rufl_action action, /* increment x by width of span */ if (action == rufl_X_TO_OFFSET || action == rufl_SPLIT) { - rufl_fm_error = xfont_scan_string(f, s2, + rufl_fm_error = xfont_scan_string(f, (char *) s2, font_GIVEN_LENGTH | font_GIVEN_FONT | font_KERN | ((action == rufl_X_TO_OFFSET) ? @@ -500,9 +506,9 @@ rufl_code rufl_process_span_old(rufl_action action, (click_x - *x) * 400, 0x7fffffff, 0, 0, i, &split_point, &x_out, &y_out, 0); - *offset += split_point - s2; + *offset += split_point - (char *) s2; } else { - rufl_fm_error = xfont_scan_string(f, s2, + rufl_fm_error = xfont_scan_string(f, (char *) s2, font_GIVEN_LENGTH | font_GIVEN_FONT | font_KERN, 0x7fffffff, 0x7fffffff, 0, 0, i, @@ -548,7 +554,7 @@ rufl_code rufl_process_not_available(rufl_action action, int click_x, size_t *offset, rufl_callback_t callback, void *context) { - char missing[] = "000000"; + uint8_t missing[] = "000000"; const int dx = 7 * font_size / 64; const int dx3 = 10.5 * font_size / 64; int top_y = y + 5 * font_size / 64; @@ -589,7 +595,8 @@ rufl_code rufl_process_not_available(rufl_action action, /* first two characters in top row */ if (action == rufl_PAINT) { - rufl_fm_error = xfont_paint(f, missing + offset, + rufl_fm_error = xfont_paint(f, + (char *) (missing + offset), font_OS_UNITS | font_GIVEN_LENGTH | font_GIVEN_FONT | font_KERN | ((flags & rufl_BLEND_FONT) ? @@ -605,7 +612,8 @@ rufl_code rufl_process_not_available(rufl_action action, /* last two characters underneath */ if (action == rufl_PAINT) { - rufl_fm_error = xfont_paint(f, missing + offset + step, + rufl_fm_error = xfont_paint(f, + (char *) (missing + offset + step), font_OS_UNITS | font_GIVEN_LENGTH | font_GIVEN_FONT | font_KERN | |