[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[freetype2] gsoc-anurag-2023 168eace51 1/3: Close contour with line segm
From: |
Werner Lemberg |
Subject: |
[freetype2] gsoc-anurag-2023 168eace51 1/3: Close contour with line segment and render glyph |
Date: |
Thu, 28 Sep 2023 16:17:26 -0400 (EDT) |
branch: gsoc-anurag-2023
commit 168eace51c266c01044264a467dadfbe0e0f9f2b
Author: Anurag Thakur <anurag105csec21@bpitindia.edu.in>
Commit: Anurag Thakur <anurag105csec21@bpitindia.edu.in>
Close contour with line segment and render glyph
---
include/freetype/freetype.h | 1 +
src/base/ftobjs.c | 17 +++++++++++++++++
src/dense/ftdense.c | 15 +++++++++------
3 files changed, 27 insertions(+), 6 deletions(-)
diff --git a/include/freetype/freetype.h b/include/freetype/freetype.h
index b58f8d82b..dd5706de8 100644
--- a/include/freetype/freetype.h
+++ b/include/freetype/freetype.h
@@ -1045,6 +1045,7 @@ FT_BEGIN_HEADER
typedef struct FT_PreLineRec_
{
int x1, x2, y1, y2;
+ int ismove;
FT_PreLine next;
} FT_PreLineRec;
diff --git a/src/base/ftobjs.c b/src/base/ftobjs.c
index ed491dd41..effb565eb 100644
--- a/src/base/ftobjs.c
+++ b/src/base/ftobjs.c
@@ -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;
}
diff --git a/src/dense/ftdense.c b/src/dense/ftdense.c
index 90f0dc3c2..4d3bc386a 100644
--- a/src/dense/ftdense.c
+++ b/src/dense/ftdense.c
@@ -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;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [freetype2] gsoc-anurag-2023 168eace51 1/3: Close contour with line segment and render glyph,
Werner Lemberg <=