|
|
|
@ -33,34 +33,40 @@ |
|
|
|
|
#include "hb-utf.hh" |
|
|
|
|
|
|
|
|
|
static void |
|
|
|
|
move_to (hb_draw_funcs_t *dfuncs, |
|
|
|
|
cairo_t *cr, |
|
|
|
|
hb_draw_state_t *st, |
|
|
|
|
hb_cairo_move_to (hb_draw_funcs_t *dfuncs HB_UNUSED, |
|
|
|
|
void *draw_data, |
|
|
|
|
hb_draw_state_t *st HB_UNUSED, |
|
|
|
|
float to_x, float to_y, |
|
|
|
|
void *) |
|
|
|
|
void *user_data HB_UNUSED) |
|
|
|
|
{ |
|
|
|
|
cairo_t *cr = (cairo_t *) draw_data; |
|
|
|
|
|
|
|
|
|
cairo_move_to (cr, (double) to_x, (double) to_y); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static void |
|
|
|
|
line_to (hb_draw_funcs_t *dfuncs, |
|
|
|
|
cairo_t *cr, |
|
|
|
|
hb_draw_state_t *st, |
|
|
|
|
hb_cairo_line_to (hb_draw_funcs_t *dfuncs HB_UNUSED, |
|
|
|
|
void *draw_data, |
|
|
|
|
hb_draw_state_t *st HB_UNUSED, |
|
|
|
|
float to_x, float to_y, |
|
|
|
|
void *) |
|
|
|
|
void *user_data HB_UNUSED) |
|
|
|
|
{ |
|
|
|
|
cairo_t *cr = (cairo_t *) draw_data; |
|
|
|
|
|
|
|
|
|
cairo_line_to (cr, (double) to_x, (double) to_y); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static void |
|
|
|
|
cubic_to (hb_draw_funcs_t *dfuncs, |
|
|
|
|
cairo_t *cr, |
|
|
|
|
hb_draw_state_t *st, |
|
|
|
|
hb_cairo_cubic_to (hb_draw_funcs_t *dfuncs HB_UNUSED, |
|
|
|
|
void *draw_data, |
|
|
|
|
hb_draw_state_t *st HB_UNUSED, |
|
|
|
|
float control1_x, float control1_y, |
|
|
|
|
float control2_x, float control2_y, |
|
|
|
|
float to_x, float to_y, |
|
|
|
|
void *) |
|
|
|
|
void *user_data HB_UNUSED) |
|
|
|
|
{ |
|
|
|
|
cairo_t *cr = (cairo_t *) draw_data; |
|
|
|
|
|
|
|
|
|
cairo_curve_to (cr, |
|
|
|
|
(double) control1_x, (double) control1_y, |
|
|
|
|
(double) control2_x, (double) control2_y, |
|
|
|
@ -68,11 +74,13 @@ cubic_to (hb_draw_funcs_t *dfuncs, |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static void |
|
|
|
|
close_path (hb_draw_funcs_t *dfuncs, |
|
|
|
|
cairo_t *cr, |
|
|
|
|
hb_draw_state_t *st, |
|
|
|
|
void *) |
|
|
|
|
hb_cairo_close_path (hb_draw_funcs_t *dfuncs HB_UNUSED, |
|
|
|
|
void *draw_data, |
|
|
|
|
hb_draw_state_t *st HB_UNUSED, |
|
|
|
|
void *user_data HB_UNUSED) |
|
|
|
|
{ |
|
|
|
|
cairo_t *cr = (cairo_t *) draw_data; |
|
|
|
|
|
|
|
|
|
cairo_close_path (cr); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -84,10 +92,10 @@ get_cairo_draw_funcs (void) |
|
|
|
|
if (!funcs) |
|
|
|
|
{ |
|
|
|
|
funcs = hb_draw_funcs_create (); |
|
|
|
|
hb_draw_funcs_set_move_to_func (funcs, (hb_draw_move_to_func_t) move_to, nullptr, nullptr); |
|
|
|
|
hb_draw_funcs_set_line_to_func (funcs, (hb_draw_line_to_func_t) line_to, nullptr, nullptr); |
|
|
|
|
hb_draw_funcs_set_cubic_to_func (funcs, (hb_draw_cubic_to_func_t) cubic_to, nullptr, nullptr); |
|
|
|
|
hb_draw_funcs_set_close_path_func (funcs, (hb_draw_close_path_func_t) close_path, nullptr, nullptr); |
|
|
|
|
hb_draw_funcs_set_move_to_func (funcs, hb_cairo_move_to, nullptr, nullptr); |
|
|
|
|
hb_draw_funcs_set_line_to_func (funcs, hb_cairo_line_to, nullptr, nullptr); |
|
|
|
|
hb_draw_funcs_set_cubic_to_func (funcs, hb_cairo_cubic_to, nullptr, nullptr); |
|
|
|
|
hb_draw_funcs_set_close_path_func (funcs, hb_cairo_close_path, nullptr, nullptr); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return funcs; |
|
|
|
@ -96,12 +104,12 @@ get_cairo_draw_funcs (void) |
|
|
|
|
#ifdef HAVE_CAIRO_USER_FONT_FACE_SET_RENDER_COLOR_GLYPH_FUNC |
|
|
|
|
|
|
|
|
|
static void |
|
|
|
|
push_transform (hb_paint_funcs_t *funcs, |
|
|
|
|
hb_cairo_push_transform (hb_paint_funcs_t *pfuncs HB_UNUSED, |
|
|
|
|
void *paint_data, |
|
|
|
|
float xx, float yx, |
|
|
|
|
float xy, float yy, |
|
|
|
|
float dx, float dy, |
|
|
|
|
void *user_data) |
|
|
|
|
void *user_data HB_UNUSED) |
|
|
|
|
{ |
|
|
|
|
cairo_t *cr = (cairo_t *) paint_data; |
|
|
|
|
cairo_matrix_t m; |
|
|
|
@ -114,9 +122,9 @@ push_transform (hb_paint_funcs_t *funcs, |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static void |
|
|
|
|
pop_transform (hb_paint_funcs_t *funcs, |
|
|
|
|
hb_cairo_pop_transform (hb_paint_funcs_t *pfuncs HB_UNUSED, |
|
|
|
|
void *paint_data, |
|
|
|
|
void *user_data) |
|
|
|
|
void *user_data HB_UNUSED) |
|
|
|
|
{ |
|
|
|
|
cairo_t *cr = (cairo_t *) paint_data; |
|
|
|
|
|
|
|
|
@ -124,11 +132,11 @@ pop_transform (hb_paint_funcs_t *funcs, |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static void |
|
|
|
|
push_clip_glyph (hb_paint_funcs_t *funcs, |
|
|
|
|
hb_cairo_push_clip_glyph (hb_paint_funcs_t *pfuncs HB_UNUSED, |
|
|
|
|
void *paint_data, |
|
|
|
|
hb_codepoint_t glyph, |
|
|
|
|
hb_font_t *font, |
|
|
|
|
void *user_data) |
|
|
|
|
void *user_data HB_UNUSED) |
|
|
|
|
{ |
|
|
|
|
cairo_t *cr = (cairo_t *) paint_data; |
|
|
|
|
|
|
|
|
@ -140,10 +148,10 @@ push_clip_glyph (hb_paint_funcs_t *funcs, |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static void |
|
|
|
|
push_clip_rectangle (hb_paint_funcs_t *funcs, |
|
|
|
|
hb_cairo_push_clip_rectangle (hb_paint_funcs_t *pfuncs HB_UNUSED, |
|
|
|
|
void *paint_data, |
|
|
|
|
float xmin, float ymin, float xmax, float ymax, |
|
|
|
|
void *user_data) |
|
|
|
|
void *user_data HB_UNUSED) |
|
|
|
|
{ |
|
|
|
|
cairo_t *cr = (cairo_t *) paint_data; |
|
|
|
|
|
|
|
|
@ -155,9 +163,9 @@ push_clip_rectangle (hb_paint_funcs_t *funcs, |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static void |
|
|
|
|
pop_clip (hb_paint_funcs_t *funcs, |
|
|
|
|
hb_cairo_pop_clip (hb_paint_funcs_t *pfuncs HB_UNUSED, |
|
|
|
|
void *paint_data, |
|
|
|
|
void *user_data) |
|
|
|
|
void *user_data HB_UNUSED) |
|
|
|
|
{ |
|
|
|
|
cairo_t *cr = (cairo_t *) paint_data; |
|
|
|
|
|
|
|
|
@ -165,9 +173,9 @@ pop_clip (hb_paint_funcs_t *funcs, |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static void |
|
|
|
|
push_group (hb_paint_funcs_t *funcs, |
|
|
|
|
hb_cairo_push_group (hb_paint_funcs_t *pfuncs HB_UNUSED, |
|
|
|
|
void *paint_data, |
|
|
|
|
void *user_data) |
|
|
|
|
void *user_data HB_UNUSED) |
|
|
|
|
{ |
|
|
|
|
cairo_t *cr = (cairo_t *) paint_data; |
|
|
|
|
|
|
|
|
@ -176,10 +184,10 @@ push_group (hb_paint_funcs_t *funcs, |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static void |
|
|
|
|
pop_group (hb_paint_funcs_t *funcs, |
|
|
|
|
hb_cairo_pop_group (hb_paint_funcs_t *pfuncs HB_UNUSED, |
|
|
|
|
void *paint_data, |
|
|
|
|
hb_paint_composite_mode_t mode, |
|
|
|
|
void *user_data) |
|
|
|
|
void *user_data HB_UNUSED) |
|
|
|
|
{ |
|
|
|
|
cairo_t *cr = (cairo_t *) paint_data; |
|
|
|
|
|
|
|
|
@ -191,11 +199,11 @@ pop_group (hb_paint_funcs_t *funcs, |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static void |
|
|
|
|
paint_color (hb_paint_funcs_t *funcs, |
|
|
|
|
hb_cairo_paint_color (hb_paint_funcs_t *pfuncs HB_UNUSED, |
|
|
|
|
void *paint_data, |
|
|
|
|
hb_bool_t use_foreground, |
|
|
|
|
hb_color_t color, |
|
|
|
|
void *user_data) |
|
|
|
|
void *user_data HB_UNUSED) |
|
|
|
|
{ |
|
|
|
|
cairo_t *cr = (cairo_t *) paint_data; |
|
|
|
|
|
|
|
|
@ -208,7 +216,7 @@ paint_color (hb_paint_funcs_t *funcs, |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static hb_bool_t |
|
|
|
|
paint_image (hb_paint_funcs_t *funcs, |
|
|
|
|
hb_cairo_paint_image (hb_paint_funcs_t *pfuncs HB_UNUSED, |
|
|
|
|
void *paint_data, |
|
|
|
|
hb_blob_t *blob, |
|
|
|
|
unsigned width, |
|
|
|
@ -216,7 +224,7 @@ paint_image (hb_paint_funcs_t *funcs, |
|
|
|
|
hb_tag_t format, |
|
|
|
|
float slant, |
|
|
|
|
hb_glyph_extents_t *extents, |
|
|
|
|
void *user_data) |
|
|
|
|
void *user_data HB_UNUSED) |
|
|
|
|
{ |
|
|
|
|
cairo_t *cr = (cairo_t *) paint_data; |
|
|
|
|
|
|
|
|
@ -224,13 +232,13 @@ paint_image (hb_paint_funcs_t *funcs, |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static void |
|
|
|
|
paint_linear_gradient (hb_paint_funcs_t *funcs, |
|
|
|
|
hb_cairo_paint_linear_gradient (hb_paint_funcs_t *pfuncs HB_UNUSED, |
|
|
|
|
void *paint_data, |
|
|
|
|
hb_color_line_t *color_line, |
|
|
|
|
float x0, float y0, |
|
|
|
|
float x1, float y1, |
|
|
|
|
float x2, float y2, |
|
|
|
|
void *user_data) |
|
|
|
|
void *user_data HB_UNUSED) |
|
|
|
|
{ |
|
|
|
|
cairo_t *cr = (cairo_t *)paint_data; |
|
|
|
|
|
|
|
|
@ -238,12 +246,12 @@ paint_linear_gradient (hb_paint_funcs_t *funcs, |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static void |
|
|
|
|
paint_radial_gradient (hb_paint_funcs_t *funcs, |
|
|
|
|
hb_cairo_paint_radial_gradient (hb_paint_funcs_t *pfuncs HB_UNUSED, |
|
|
|
|
void *paint_data, |
|
|
|
|
hb_color_line_t *color_line, |
|
|
|
|
float x0, float y0, float r0, |
|
|
|
|
float x1, float y1, float r1, |
|
|
|
|
void *user_data) |
|
|
|
|
void *user_data HB_UNUSED) |
|
|
|
|
{ |
|
|
|
|
cairo_t *cr = (cairo_t *)paint_data; |
|
|
|
|
|
|
|
|
@ -251,12 +259,12 @@ paint_radial_gradient (hb_paint_funcs_t *funcs, |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static void |
|
|
|
|
paint_sweep_gradient (hb_paint_funcs_t *funcs, |
|
|
|
|
hb_cairo_paint_sweep_gradient (hb_paint_funcs_t *pfuncs HB_UNUSED, |
|
|
|
|
void *paint_data, |
|
|
|
|
hb_color_line_t *color_line, |
|
|
|
|
float x0, float y0, |
|
|
|
|
float start_angle, float end_angle, |
|
|
|
|
void *user_data) |
|
|
|
|
void *user_data HB_UNUSED) |
|
|
|
|
{ |
|
|
|
|
cairo_t *cr = (cairo_t *) paint_data; |
|
|
|
|
|
|
|
|
@ -272,18 +280,18 @@ get_cairo_paint_funcs () |
|
|
|
|
{ |
|
|
|
|
funcs = hb_paint_funcs_create (); |
|
|
|
|
|
|
|
|
|
hb_paint_funcs_set_push_transform_func (funcs, push_transform, nullptr, nullptr); |
|
|
|
|
hb_paint_funcs_set_pop_transform_func (funcs, pop_transform, nullptr, nullptr); |
|
|
|
|
hb_paint_funcs_set_push_clip_glyph_func (funcs, push_clip_glyph, nullptr, nullptr); |
|
|
|
|
hb_paint_funcs_set_push_clip_rectangle_func (funcs, push_clip_rectangle, nullptr, nullptr); |
|
|
|
|
hb_paint_funcs_set_pop_clip_func (funcs, pop_clip, nullptr, nullptr); |
|
|
|
|
hb_paint_funcs_set_push_group_func (funcs, push_group, nullptr, nullptr); |
|
|
|
|
hb_paint_funcs_set_pop_group_func (funcs, pop_group, nullptr, nullptr); |
|
|
|
|
hb_paint_funcs_set_color_func (funcs, paint_color, nullptr, nullptr); |
|
|
|
|
hb_paint_funcs_set_image_func (funcs, paint_image, nullptr, nullptr); |
|
|
|
|
hb_paint_funcs_set_linear_gradient_func (funcs, paint_linear_gradient, nullptr, nullptr); |
|
|
|
|
hb_paint_funcs_set_radial_gradient_func (funcs, paint_radial_gradient, nullptr, nullptr); |
|
|
|
|
hb_paint_funcs_set_sweep_gradient_func (funcs, paint_sweep_gradient, nullptr, nullptr); |
|
|
|
|
hb_paint_funcs_set_push_transform_func (funcs, hb_cairo_push_transform, nullptr, nullptr); |
|
|
|
|
hb_paint_funcs_set_pop_transform_func (funcs, hb_cairo_pop_transform, nullptr, nullptr); |
|
|
|
|
hb_paint_funcs_set_push_clip_glyph_func (funcs, hb_cairo_push_clip_glyph, nullptr, nullptr); |
|
|
|
|
hb_paint_funcs_set_push_clip_rectangle_func (funcs, hb_cairo_push_clip_rectangle, nullptr, nullptr); |
|
|
|
|
hb_paint_funcs_set_pop_clip_func (funcs, hb_cairo_pop_clip, nullptr, nullptr); |
|
|
|
|
hb_paint_funcs_set_push_group_func (funcs, hb_cairo_push_group, nullptr, nullptr); |
|
|
|
|
hb_paint_funcs_set_pop_group_func (funcs, hb_cairo_pop_group, nullptr, nullptr); |
|
|
|
|
hb_paint_funcs_set_color_func (funcs, hb_cairo_paint_color, nullptr, nullptr); |
|
|
|
|
hb_paint_funcs_set_image_func (funcs, hb_cairo_paint_image, nullptr, nullptr); |
|
|
|
|
hb_paint_funcs_set_linear_gradient_func (funcs, hb_cairo_paint_linear_gradient, nullptr, nullptr); |
|
|
|
|
hb_paint_funcs_set_radial_gradient_func (funcs, hb_cairo_paint_radial_gradient, nullptr, nullptr); |
|
|
|
|
hb_paint_funcs_set_sweep_gradient_func (funcs, hb_cairo_paint_sweep_gradient, nullptr, nullptr); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return funcs; |
|
|
|
|