Anurag Thakur pushed to branch gsoc-anurag-2023 at FreeType / FreeType
Commits:
5 changed files:
Changes:
include/freetype/freetype.h
... |
... |
@@ -2298,6 +2298,7 @@ FT_BEGIN_HEADER |
2298
|
2298
|
|
2299
|
2299
|
void* other;
|
2300
|
2300
|
FT_PreLine prelines;
|
|
2301
|
+ int prel_shifted;
|
2301
|
2302
|
|
2302
|
2303
|
FT_Slot_Internal internal;
|
2303
|
2304
|
|
modules.cfg
... |
... |
@@ -100,7 +100,7 @@ HINTING_MODULES += pshinter |
100
|
100
|
####
|
101
|
101
|
|
102
|
102
|
# Dense Rasterizer
|
103
|
|
-RASTER_MODULES += dense
|
|
103
|
+#RASTER_MODULES += dense
|
104
|
104
|
|
105
|
105
|
# Anti-aliasing rasterizer.
|
106
|
106
|
RASTER_MODULES += smooth
|
src/base/ftobjs.c
... |
... |
@@ -579,6 +579,7 @@ |
579
|
579
|
{
|
580
|
580
|
/* free bitmap if needed */
|
581
|
581
|
ft_glyphslot_free_bitmap( slot );
|
|
582
|
+
|
582
|
583
|
|
583
|
584
|
/* clear all public fields in the glyph slot */
|
584
|
585
|
slot->glyph_index = 0;
|
... |
... |
@@ -1180,6 +1181,8 @@ |
1180
|
1181
|
|
1181
|
1182
|
}
|
1182
|
1183
|
|
|
1184
|
+
|
|
1185
|
+
|
1183
|
1186
|
#ifdef FT_DEBUG_LEVEL_TRACE
|
1184
|
1187
|
FT_TRACE5(( "FT_Load_Glyph: index %d, flags 0x%x\n",
|
1185
|
1188
|
glyph_index, load_flags ));
|
... |
... |
@@ -2645,7 +2648,7 @@ int conic_to2(FT_GlyphSlot* slot, FT_Vector *control, FT_Vector *from, FT_Vector |
2645
|
2648
|
}
|
2646
|
2649
|
|
2647
|
2650
|
|
2648
|
|
- static FT_Error ft_decompose_outline(FT_GlyphSlot* slot){
|
|
2651
|
+ FT_Error ft_decompose_outline(FT_GlyphSlot* slot){
|
2649
|
2652
|
FT_Vector v_last;
|
2650
|
2653
|
FT_Vector v_control;
|
2651
|
2654
|
FT_Vector v_start;
|
... |
... |
@@ -3138,7 +3141,7 @@ int conic_to2(FT_GlyphSlot* slot, FT_Vector *control, FT_Vector *from, FT_Vector |
3138
|
3141
|
face->garray = (FT_GlyphSlot*)malloc(
|
3139
|
3142
|
face->driver->clazz->slot_object_size * face->num_glyphs );
|
3140
|
3143
|
//error = FT_Set_Char_Size( face, 0, 160 * 64, 300, 300 );
|
3141
|
|
- error = FT_Set_Pixel_Sizes( face, 0, 500);
|
|
3144
|
+ error = FT_Set_Pixel_Sizes( face, 0, 100);
|
3142
|
3145
|
// int glyph_index = FT_Get_Char_Index( face, 'A' );
|
3143
|
3146
|
// error = FT_Load_Glyph( face, glyph_index, FT_LOAD_NO_HINTING );
|
3144
|
3147
|
|
... |
... |
@@ -3150,6 +3153,7 @@ int conic_to2(FT_GlyphSlot* slot, FT_Vector *control, FT_Vector *from, FT_Vector |
3150
|
3153
|
|
3151
|
3154
|
FT_ALLOC(face->garray[gindex], clazz->slot_object_size);
|
3152
|
3155
|
face->garray[gindex]->face = face;
|
|
3156
|
+ face->garray[gindex]->prel_shifted = 0;
|
3153
|
3157
|
face->garray[gindex]->glyph_index = gindex;
|
3154
|
3158
|
ft_glyphslot_init(face->garray[gindex]);
|
3155
|
3159
|
face->garray[gindex]->next = NULL;
|
src/smooth/ftgrays.c
... |
... |
@@ -1921,7 +1921,7 @@ typedef ptrdiff_t FT_PtrDist; |
1921
|
1921
|
|
1922
|
1922
|
static int
|
1923
|
1923
|
gray_convert_glyph_inner( RAS_ARG_
|
1924
|
|
- int continued )
|
|
1924
|
+ int continued , FT_PreLine pl)
|
1925
|
1925
|
{
|
1926
|
1926
|
volatile int error;
|
1927
|
1927
|
|
... |
... |
@@ -1930,7 +1930,28 @@ typedef ptrdiff_t FT_PtrDist; |
1930
|
1930
|
{
|
1931
|
1931
|
if ( continued )
|
1932
|
1932
|
FT_Trace_Disable();
|
1933
|
|
- error = FT_Outline_Decompose( &ras.outline, &func_interface, &ras );
|
|
1933
|
+ //error = FT_Outline_Decompose( &ras.outline, &func_interface, &ras );
|
|
1934
|
+ FT_Vector point1 = {pl->x1, pl->y1};
|
|
1935
|
+
|
|
1936
|
+ FT_Vector point2 = {100, 100};
|
|
1937
|
+
|
|
1938
|
+ error = gray_move_to(&point1, worker);
|
|
1939
|
+ while (pl!=NULL)
|
|
1940
|
+ {
|
|
1941
|
+ point1.x = pl->x1;
|
|
1942
|
+ point1.y = pl->y1;
|
|
1943
|
+ point2.x = pl->x2;
|
|
1944
|
+ point2.y = pl->y2;
|
|
1945
|
+
|
|
1946
|
+ if(pl->ismove){
|
|
1947
|
+ gray_move_to(&point2, worker);
|
|
1948
|
+ }else{
|
|
1949
|
+ gray_line_to(&point2, worker);
|
|
1950
|
+ }
|
|
1951
|
+ pl= pl->next;
|
|
1952
|
+ }
|
|
1953
|
+
|
|
1954
|
+
|
1934
|
1955
|
if ( continued )
|
1935
|
1956
|
FT_Trace_Enable();
|
1936
|
1957
|
|
... |
... |
@@ -1953,7 +1974,7 @@ typedef ptrdiff_t FT_PtrDist; |
1953
|
1974
|
|
1954
|
1975
|
|
1955
|
1976
|
static int
|
1956
|
|
- gray_convert_glyph( RAS_ARG )
|
|
1977
|
+ gray_convert_glyph( RAS_ARG , FT_PreLine pl)
|
1957
|
1978
|
{
|
1958
|
1979
|
const TCoord yMin = ras.min_ey;
|
1959
|
1980
|
const TCoord yMax = ras.max_ey;
|
... |
... |
@@ -2015,7 +2036,7 @@ typedef ptrdiff_t FT_PtrDist; |
2015
|
2036
|
ras.max_ey = band[0];
|
2016
|
2037
|
ras.count_ey = width;
|
2017
|
2038
|
|
2018
|
|
- error = gray_convert_glyph_inner( RAS_VAR_ continued );
|
|
2039
|
+ error = gray_convert_glyph_inner( RAS_VAR_ continued, pl );
|
2019
|
2040
|
continued = 1;
|
2020
|
2041
|
|
2021
|
2042
|
if ( !error )
|
... |
... |
@@ -2132,7 +2153,7 @@ typedef ptrdiff_t FT_PtrDist; |
2132
|
2153
|
if ( ras.max_ex <= ras.min_ex || ras.max_ey <= ras.min_ey )
|
2133
|
2154
|
return Smooth_Err_Ok;
|
2134
|
2155
|
|
2135
|
|
- return gray_convert_glyph( RAS_VAR );
|
|
2156
|
+ return gray_convert_glyph( RAS_VAR, params->prelines );
|
2136
|
2157
|
}
|
2137
|
2158
|
|
2138
|
2159
|
|
src/smooth/ftsmooth.c
... |
... |
@@ -501,8 +501,20 @@ |
501
|
501
|
}
|
502
|
502
|
|
503
|
503
|
/* translate outline to render it into the bitmap */
|
504
|
|
- if ( x_shift || y_shift )
|
505
|
|
- FT_Outline_Translate( outline, x_shift, y_shift );
|
|
504
|
+ if ( (x_shift || y_shift) && !slot->prel_shifted){
|
|
505
|
+ //FT_Outline_Translate( outline, x_shift, y_shift );
|
|
506
|
+ FT_PreLine pl = slot->prelines;
|
|
507
|
+ while (pl!=NULL)
|
|
508
|
+ {
|
|
509
|
+ pl->x1 += x_shift;
|
|
510
|
+ pl->y1 += y_shift;
|
|
511
|
+ pl->x2 += x_shift;
|
|
512
|
+ pl->y2 += y_shift;
|
|
513
|
+
|
|
514
|
+ pl = pl->next;
|
|
515
|
+ }
|
|
516
|
+ slot->prel_shifted = 1;
|
|
517
|
+ }
|
506
|
518
|
|
507
|
519
|
if ( mode == FT_RENDER_MODE_NORMAL ||
|
508
|
520
|
mode == FT_RENDER_MODE_LIGHT )
|
... |
... |
@@ -517,6 +529,8 @@ |
517
|
529
|
params.target = bitmap;
|
518
|
530
|
params.source = outline;
|
519
|
531
|
params.flags = FT_RASTER_FLAG_AA;
|
|
532
|
+ params.prelines = slot->prelines;
|
|
533
|
+
|
520
|
534
|
|
521
|
535
|
error = render->raster_render( render->raster, ¶ms );
|
522
|
536
|
}
|
... |
... |
@@ -568,8 +582,9 @@ |
568
|
582
|
slot->internal->flags &= ~FT_GLYPH_OWN_BITMAP;
|
569
|
583
|
}
|
570
|
584
|
|
571
|
|
- if ( x_shift || y_shift )
|
572
|
|
- FT_Outline_Translate( outline, -x_shift, -y_shift );
|
|
585
|
+ // if ( x_shift || y_shift ){
|
|
586
|
+ // FT_Outline_Translate( outline, -x_shift, -y_shift );
|
|
587
|
+ // }
|
573
|
588
|
|
574
|
589
|
return error;
|
575
|
590
|
}
|
|