Skip to content
GitLab
Explore
Sign in
Register
FreeType
FreeType
Compare revisions
ec9b505f3cb1cb15355e39c6750116350a1ba6a9 to 579d9385ef9b934fb83bbe815722403ee99ac1e5
Commits on Source (3)
Close contour with line segment and render glyph
· 168eace5
Anurag Thakur
authored
Sep 28, 2023
168eace5
Fix render
· 382949cd
Anurag Thakur
authored
Sep 29, 2023
382949cd
First correct render
· 579d9385
Anurag Thakur
authored
Sep 29, 2023
579d9385
Hide whitespace changes
Inline
Side-by-side
include/freetype/freetype.h
View file @
579d9385
...
...
@@ -1045,6 +1045,7 @@ FT_BEGIN_HEADER
typedef
struct
FT_PreLineRec_
{
int
x1
,
x2
,
y1
,
y2
;
int
ismove
;
FT_PreLine
next
;
}
FT_PreLineRec
;
...
...
src/base/ftobjs.c
View file @
579d9385
...
...
@@ -2626,6 +2626,11 @@
tags
--
;
}
if
(((
*
slot
)
->
glyph_index
==
37
))
{
printf
(
"moveit
\n
"
);
}
FT_TRACE5
((
" move to (%.2f, %.2f)
\n
"
,
(
double
)
v_start
.
x
/
64
,
(
double
)
v_start
.
y
/
64
));
// error = func_interface->move_to( &v_start, user );
...
...
@@ -2634,16 +2639,18 @@
FT_PreLine
pl
=
malloc
(
sizeof
(
FT_PreLineRec
));
pl
->
x1
=
v_start
.
x
/
64
;
pl
->
y1
=
v_start
.
y
/
64
;
pl
->
x2
=
v_start
.
x
/
64
;
pl
->
y2
=
v_start
.
y
/
64
;
pl
->
x1
=
v_start
.
x
;
pl
->
y1
=
v_start
.
y
;
pl
->
x2
=
v_start
.
x
;
pl
->
y2
=
v_start
.
y
;
pl
->
next
=
NULL
;
pl
->
ismove
=
1
;
if
((
*
slot
)
->
prelines
==
NULL
){
ptr
=
(
*
slot
)
->
prelines
=
pl
;
}
else
{
ptr
->
next
=
pl
;
ptr
=
ptr
->
next
;
}
...
...
@@ -2667,13 +2674,17 @@
FT_TRACE5
((
" line to (%.2f, %.2f)
\n
"
,
(
double
)
vec
.
x
/
64
,
(
double
)
vec
.
y
/
64
));
//error = func_interface->line_to( &vec, user );
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
;
ptr
->
next
=
pl
;
if
((
*
slot
)
->
glyph_index
==
37
)
printf
(
" line to (%.2f, %.2f)
\n
"
,
(
double
)
vec
.
x
/
64
,
(
double
)
vec
.
y
/
64
);
FT_PreLine
pl3
=
malloc
(
sizeof
(
FT_PreLineRec
));
pl3
->
x1
=
ptr
->
x2
;
pl3
->
y1
=
ptr
->
y2
;
pl3
->
x2
=
vec
.
x
;
pl3
->
y2
=
vec
.
y
;
pl3
->
next
=
NULL
;
pl3
->
ismove
=
0
;
ptr
->
next
=
pl3
;
ptr
=
ptr
->
next
;
continue
;
}
...
...
@@ -2685,6 +2696,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
;
pl2
->
y2
=
v_start
.
y
;
pl2
->
next
=
NULL
;
pl2
->
ismove
=
0
;
ptr
->
next
=
pl2
;
ptr
=
ptr
->
next
;
}
...
...
src/dense/ftdense.c
View file @
579d9385
...
...
@@ -85,16 +85,6 @@ dense_line_to( const FT_Vector* to, dense_worker* worker )
return
0
;
}
static
int
dense_line_to2
(
const
FT_Vector
*
from
,
const
FT_Vector
*
to
,
dense_worker
*
worker
)
{
dense_move_to
(
from
,
worker
);
dense_render_line
(
worker
,
UPSCALE
(
to
->
x
),
UPSCALE
(
to
->
y
)
);
dense_move_to
(
to
,
worker
);
return
0
;
}
void
dense_render_line
(
dense_worker
*
worker
,
FT_Pos
tox
,
FT_Pos
toy
)
{
...
...
@@ -433,7 +423,7 @@ 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
);
...
...
@@ -444,8 +434,11 @@ dense_render_glyph( dense_worker* worker, const FT_Bitmap* target, FT_PreLine pl
point2
.
x
=
pl
->
x2
;
point2
.
y
=
pl
->
y2
;
dense_line_to2
(
&
point1
,
&
point2
,
worker
);
if
(
pl
->
ismove
){
dense_move_to
(
&
point2
,
worker
);
}
else
{
dense_line_to
(
&
point2
,
worker
);
}
pl
=
pl
->
next
;
}
// point.x = 100;
...
...