Close contour with line segment and render glyph

gsoc-anurag-2023
Anurag Thakur 1 year ago
parent c41d05e8a2
commit 168eace51c
  1. 1
      include/freetype/freetype.h
  2. 17
      src/base/ftobjs.c
  3. 15
      src/dense/ftdense.c

@ -1045,6 +1045,7 @@ FT_BEGIN_HEADER
typedef struct FT_PreLineRec_
{
int x1, x2, y1, y2;
int ismove;
FT_PreLine next;
} FT_PreLineRec;

@ -2639,6 +2639,7 @@
pl->x2 = v_start.x/64;
pl->y2 = v_start.y/64;
pl->next = NULL;
pl->ismove = 1;
if((*slot)->prelines == NULL){
ptr = (*slot)->prelines = pl;
@ -2667,12 +2668,16 @@
FT_TRACE5(( " line to (%.2f, %.2f)\n",
(double)vec.x / 64, (double)vec.y / 64 ));
//error = func_interface->line_to( &vec, user );
if((*slot)->glyph_index == 37)
printf( " line to (%.2f, %.2f)\n",
(double)vec.x / 64, (double)vec.y / 64 );
FT_PreLine pl = malloc(sizeof(FT_PreLineRec));
pl->x1 = ptr->x2;
pl->y1 = ptr->y2;
pl->x2 = vec.x/64;
pl->y2 = vec.y/64;
pl->next = NULL;
pl->ismove = 0;
ptr->next = pl;
ptr = ptr->next;
continue;
@ -2685,6 +2690,18 @@
// FT_TRACE5(( " line to (%.2f, %.2f)\n",
// (double)v_start.x / 64, (double)v_start.y / 64 ));
// error = func_interface->line_to( &v_start, user );
if((*slot)->glyph_index == 37)
printf( " line to (%.2f, %.2f)\n",
(double)v_start.x / 64, (double)v_start.y / 64 );
FT_PreLine pl2 = malloc(sizeof(FT_PreLineRec));
pl2->x1 = ptr->x2;
pl2->y1 = ptr->y2;
pl2->x2 = v_start.x/64;
pl2->y2 = v_start.y/64;
pl2->next = NULL;
pl->ismove = 0;
ptr->next = pl2;
ptr = ptr->next;
}

@ -433,19 +433,22 @@ dense_render_glyph( dense_worker* worker, const FT_Bitmap* target, FT_PreLine pl
{
// FT_Error error = FT_Outline_Decompose( &( worker->outline ),
// &dense_decompose_funcs, worker );
FT_Vector point1 = {100, 100};
FT_Vector point1 = {pl->x1, pl->y1};
FT_Vector point2 = {100, 100};
FT_Error error = dense_move_to(&point1, worker);
while (pl!=NULL)
{
point1.x = pl->x1;
point1.y = pl->y1;
point2.x = pl->x2;
point2.y = pl->y2;
point1.x = pl->x1/4;
point1.y = pl->y1/4;
point2.x = pl->x2/4;
point2.y = pl->y2/4;
if(pl->ismove){
dense_move_to(&point2, worker);
}else{
dense_line_to2(&point1, &point2, worker);
}
pl= pl->next;
}
// point.x = 100;

Loading…
Cancel
Save