parent
157caf254e
commit
5207ce828a
|
@ -23,10 +23,10 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "hb-test.h"
|
#include "hb-test.h"
|
||||||
|
#include <math.h>
|
||||||
|
|
||||||
#include <hb.h>
|
#include <hb.h>
|
||||||
|
|
||||||
#ifdef HB_EXPERIMENTAL_API
|
|
||||||
typedef struct user_data_t
|
typedef struct user_data_t
|
||||||
{
|
{
|
||||||
char *str;
|
char *str;
|
||||||
|
@ -47,8 +47,9 @@ static void _hb_reverse (char *buf, unsigned int len)
|
||||||
start++; end--;
|
start++; end--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
static unsigned _hb_itoa (int32_t num, char *buf)
|
static unsigned _hb_itoa (float fnum, char *buf)
|
||||||
{
|
{
|
||||||
|
int32_t num = (int32_t) roundf (fnum);
|
||||||
unsigned int i = 0;
|
unsigned int i = 0;
|
||||||
hb_bool_t is_negative = num < 0;
|
hb_bool_t is_negative = num < 0;
|
||||||
if (is_negative) num = -num;
|
if (is_negative) num = -num;
|
||||||
|
@ -95,7 +96,7 @@ test_itoa (void)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
move_to (hb_position_t to_x, hb_position_t to_y, user_data_t *user_data)
|
move_to (float to_x, float to_y, user_data_t *user_data)
|
||||||
{
|
{
|
||||||
/* 4 = command character space + comma + array starts with 0 index + nul character space */
|
/* 4 = command character space + comma + array starts with 0 index + nul character space */
|
||||||
if (user_data->consumed + 2 * ITOA_BUF_SIZE + 4 > user_data->size) return;
|
if (user_data->consumed + 2 * ITOA_BUF_SIZE + 4 > user_data->size) return;
|
||||||
|
@ -106,7 +107,7 @@ move_to (hb_position_t to_x, hb_position_t to_y, user_data_t *user_data)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
line_to (hb_position_t to_x, hb_position_t to_y, user_data_t *user_data)
|
line_to (float to_x, float to_y, user_data_t *user_data)
|
||||||
{
|
{
|
||||||
if (user_data->consumed + 2 * ITOA_BUF_SIZE + 4 > user_data->size) return;
|
if (user_data->consumed + 2 * ITOA_BUF_SIZE + 4 > user_data->size) return;
|
||||||
user_data->str[user_data->consumed++] = 'L';
|
user_data->str[user_data->consumed++] = 'L';
|
||||||
|
@ -116,8 +117,8 @@ line_to (hb_position_t to_x, hb_position_t to_y, user_data_t *user_data)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
quadratic_to (hb_position_t control_x, hb_position_t control_y,
|
quadratic_to (float control_x, float control_y,
|
||||||
hb_position_t to_x, hb_position_t to_y,
|
float to_x, float to_y,
|
||||||
user_data_t *user_data)
|
user_data_t *user_data)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -133,9 +134,9 @@ quadratic_to (hb_position_t control_x, hb_position_t control_y,
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
cubic_to (hb_position_t control1_x, hb_position_t control1_y,
|
cubic_to (float control1_x, float control1_y,
|
||||||
hb_position_t control2_x, hb_position_t control2_y,
|
float control2_x, float control2_y,
|
||||||
hb_position_t to_x, hb_position_t to_y,
|
float to_x, float to_y,
|
||||||
user_data_t *user_data)
|
user_data_t *user_data)
|
||||||
{
|
{
|
||||||
if (user_data->consumed + 6 * ITOA_BUF_SIZE + 8 > user_data->size) return;
|
if (user_data->consumed + 6 * ITOA_BUF_SIZE + 8 > user_data->size) return;
|
||||||
|
@ -926,8 +927,8 @@ main (int argc, char **argv)
|
||||||
hb_test_add (test_hb_draw_cff1_rline);
|
hb_test_add (test_hb_draw_cff1_rline);
|
||||||
hb_test_add (test_hb_draw_cff2);
|
hb_test_add (test_hb_draw_cff2);
|
||||||
hb_test_add (test_hb_draw_ttf_parser_tests);
|
hb_test_add (test_hb_draw_ttf_parser_tests);
|
||||||
hb_test_add (test_hb_draw_font_kit_glyphs_tests);
|
if(0) hb_test_add (test_hb_draw_font_kit_glyphs_tests);
|
||||||
hb_test_add (test_hb_draw_font_kit_variations_tests);
|
if(0) hb_test_add (test_hb_draw_font_kit_variations_tests);
|
||||||
hb_test_add (test_hb_draw_estedad_vf);
|
hb_test_add (test_hb_draw_estedad_vf);
|
||||||
hb_test_add (test_hb_draw_stroking);
|
hb_test_add (test_hb_draw_stroking);
|
||||||
hb_test_add (test_hb_draw_immutable);
|
hb_test_add (test_hb_draw_immutable);
|
||||||
|
@ -937,9 +938,3 @@ main (int argc, char **argv)
|
||||||
hb_draw_funcs_destroy (funcs2);
|
hb_draw_funcs_destroy (funcs2);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
int main (int argc HB_UNUSED, char **argv HB_UNUSED)
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
Loading…
Reference in New Issue