forked from minhngoc25a/freetype2
485 lines
15 KiB
Plaintext
485 lines
15 KiB
Plaintext
2020-07-10 Anuj Verma <anujv@iitbhilai.ac.in>
|
|
|
|
[sdf] Remove use of `FT_List'.
|
|
|
|
Simply use a `next' pointer inside `SDF_Edge' and
|
|
`SDF_Contour' to create a linked list. This reduces
|
|
the number of allocations due to `FT_ListNode', also
|
|
we don't need a doubly linked list.
|
|
|
|
* src/sdf/ftsdf.c (SDF_Edge, SDF_Contour): Remove the
|
|
`FT_List' and use a `next' pointer to create the
|
|
linked list.
|
|
|
|
* src/sdf/ftsdf.c(sdf_edge_destructor, sdf_contour_destructor):
|
|
Removed, not needed any more.
|
|
|
|
* src/sdf/ftsdf.c (*): Remove the use of `FT_List_'
|
|
functions wherever necessary and sync with the new
|
|
list.
|
|
|
|
2020-07-09 Anuj Verma <anujv@iitbhilai.ac.in>
|
|
|
|
[sdf] Added subdivision optimization.
|
|
|
|
* src/sdf/ftsdf.c (sdf_generate_subdivision): The
|
|
function generate SDF just like the `sdf_generate'
|
|
function, but subdivide the curve into a number of
|
|
lines and then use the `sdf_generate_bounding_box'
|
|
function to generate SDF.
|
|
|
|
2020-07-09 Anuj Verma <anujv@iitbhilai.ac.in>
|
|
|
|
[sdf] Added functions to subdivide a cubic curve.
|
|
|
|
* src/sdf/ftsdf.c (split_cubic, split_sdf_cubic):
|
|
These functions can be used to subdivide a
|
|
cubic bezier curve into line segments which can
|
|
then be used to generate the SDF.
|
|
|
|
* src/sdf/ftsdf.c (split_sdf_shape): Added function
|
|
to split a cubic into a line segments.
|
|
|
|
* src/sdf/ftsdf.c (sdf_shape_done): No need to pass
|
|
`FT_Memory' as a parameter, it can be accessed
|
|
from the `shape' struct.
|
|
|
|
2020-07-09 Anuj Verma <anujv@iitbhilai.ac.in>
|
|
|
|
* src/sdf/ftsdf.c (split_sdf_shape): Typo.
|
|
|
|
2020-07-08 Anuj Verma <anujv@iitbhilai.ac.in>
|
|
|
|
* src/sdf/ftsdf.c (split_sdf_shape): Memory leak.
|
|
After recursion the edges variable becomes `NULL'
|
|
so reassign it to deallocate the list completely.
|
|
|
|
2020-07-08 Anuj Verma <anujv@iitbhilai.ac.in>
|
|
|
|
[sdf] Added functions to subdivide a conic curve.
|
|
|
|
* src/sdf/ftsdf.c (split_conic, split_sdf_conic):
|
|
These functions can be used to subdivide a
|
|
conic bezier curve into line segments which can
|
|
then be used to generate the SDF.
|
|
|
|
* src/sdf/ftsdf.c (split_sdf_shape): Added function
|
|
to split a outline into a line segments.
|
|
|
|
2020-07-06 Anuj Verma <anujv@iitbhilai.ac.in>
|
|
|
|
* [GSoC]ChangLog: Fixed typos.
|
|
|
|
2020-07-06 Anuj Verma <anujv@iitbhilai.ac.in>
|
|
|
|
* src/sdf/ftsdfrend.c (sdf_generate_bounding_box): Due to
|
|
the way we use the bounding box, we need to keep a track
|
|
of signed distances of each pixel so later the sign can
|
|
be determined properly. The method is certainly faster
|
|
then checking all the pixels against all the edges,
|
|
but also require a decent amount of memory to work.
|
|
|
|
2020-07-06 Anuj Verma <anujv@iitbhilai.ac.in>
|
|
|
|
[sdf] Precompute the orthogonality.
|
|
|
|
* src/sdf/ftsdf.c (SDF_Signed_Distance): Remove unused
|
|
fields.
|
|
|
|
* src/sdf/ftsdf.c (resolve_corner): The function can be
|
|
simplified to a single line. Instead of computing
|
|
orthogonality here, we precompute it in the corresponding
|
|
`get_min_distance_' functions more efficiently.
|
|
|
|
* src/sdf/ftsdf.c (get_min_distance_): Precompute orthogonality/
|
|
cross product of direction and the distance vector. Since
|
|
in these function we know that weather the distance vector
|
|
and the direction are perpendicular, we can simply set
|
|
the cross to 1 (sin(90) = 1) in case they are perpendicular.
|
|
This can reduce the number of `FT_Vector_NormLen' calls.
|
|
|
|
2020-07-05 Anuj Verma <anujv@iitbhilai.ac.in>
|
|
|
|
[sdf] Added bounding box optimization.
|
|
|
|
* src/sdf/ftsdfrend.c (sdf_generate_bounding_box): The
|
|
function generate SDF just like the `sdf_generate'
|
|
function, but uses bounding box to check pixels
|
|
efficiently.
|
|
|
|
* src/sdf/ftsdfrend.c (get_control_box): Added function
|
|
to get control box of a `SDF_Edge'.
|
|
|
|
2020-07-04 Anuj Verma <anujv@iitbhilai.ac.in>
|
|
|
|
* src/sdf/ftsdfrend.c (sdf_shape_dump): Use `%ld' to
|
|
printf `signed long' otherwise it gives wrong output.
|
|
|
|
2020-07-04 Anuj Verma <anujv@iitbhilai.ac.in>
|
|
|
|
* src/sdf/ftsdfrend.c (ft_sdf_render): Don't negate
|
|
unsigned integers.
|
|
|
|
2020-07-03 Anuj Verma <anujv@iitbhilai.ac.in>
|
|
|
|
* src/sdf/ftsdf.c: Use ASCII single quote (') instead
|
|
of back tick (`) for derivatives. Looks cleaner.
|
|
|
|
2020-07-03 Anuj Verma <anujv@iitbhilai.ac.in>
|
|
|
|
[sdf] Added function to find shortest distance from a
|
|
point to a cubic bezier. Now the sdf module can render
|
|
all types of fonts, but still has some issues.
|
|
|
|
* src/sdf/ftsdf.c (get_min_distance_cubic): The function
|
|
calculates shortest distance from a point to a cubic
|
|
bezier curve.
|
|
|
|
* src/sdf/ftsdf.c (sdf_edge_get_min_distance): Add the
|
|
`get_min_distance_cubic' function call.
|
|
|
|
2020-07-03 Anuj Verma <anujv@iitbhilai.ac.in>
|
|
|
|
* src/sdf/ftsdf.c (resolve_corner): [Bug] Remove the
|
|
nearest_point check. Two distances can be same and
|
|
can give opposite sign, but they may not have a
|
|
common nearest_point. Also remove distance check
|
|
because due to precision errors the two distances can
|
|
be really really close. Therefore use epsilon instead.
|
|
|
|
* src/sdf/ftsdf.c (sdf_contour_get_min_distance): Use
|
|
epsilon for comparing distances.
|
|
|
|
2020-07-03 Anuj Verma <anujv@iitbhilai.ac.in>
|
|
|
|
* src/sdf/ftsdf.c (sdf_shape_dump): Add more info
|
|
to the debug output.
|
|
|
|
2020-07-03 Anuj Verma <anujv@iitbhilai.ac.in>
|
|
|
|
* src/sdf/ftsdf.c (MAX_NEWTON_ITERATION => MAX_NEWTON_DIVISIONS):
|
|
Renamed to avoid confusion.
|
|
|
|
2020-07-02 Anuj Verma <anujv@iitbhilai.ac.in>
|
|
|
|
[sdf] Added Newton's method for shortest distance
|
|
from a point to a conic.
|
|
|
|
* src/sdf/ftsdf.c (get_min_distance_conic): Created
|
|
a new function with same name which uses Newton's
|
|
iteration for finding shortest distance from a point
|
|
to a conic curve. This doesn't causes underflow.
|
|
|
|
* src/sdf/ftsdf.c (USE_NEWTON_FOR_CONIC): This macro
|
|
can be used to toggle between Newton or analytical
|
|
cubic solving method.
|
|
|
|
2020-07-01 Anuj Verma <anujv@iitbhilai.ac.in>
|
|
|
|
* src/sdf/ftsdf.c (get_min_distance_conic): Add more
|
|
details to why we clamp the roots.
|
|
|
|
* src/sdf/ftsdf.c: Make sure preprocessor # is always
|
|
on the first line.
|
|
|
|
2020-07-01 Anuj Verma <anujv@iitbhilai.ac.in>
|
|
|
|
[sdf] Make squared distances toggleable.
|
|
|
|
* src/sdf/ftsdf.c (SDF_Signed_Distance): Renamed
|
|
squared_distance to distance. It can now represent
|
|
both squared as well as actual distances.
|
|
|
|
* src/sdf/ftsdf.c (USE_SQUARED_DISTANCES): Added macro
|
|
which control weather to do computation is squared
|
|
distances or actual distances. This can be used to
|
|
avoid overflow when generating large SDF bitmaps.
|
|
|
|
* src/sdf/ftsdf.c: Make sure not to exceed line length
|
|
of 78.
|
|
|
|
2020-07-01 Anuj Verma <anujv@iitbhilai.ac.in>
|
|
|
|
* src/sdf/ftsdf.c (get_min_distance_conic): In case
|
|
the cubic equation returns zero root, use endpoints
|
|
for calculating the shortest distance.
|
|
|
|
2020-07-01 Anuj Verma <anujv@iitbhilai.ac.in>
|
|
|
|
[sdf] Added function to find shortest distance from a
|
|
point to a conic bezier. Now the sdf module can render
|
|
ttf fonts or fonts with line and conic segments.
|
|
|
|
* src/sdf/ftsdf.c (get_min_distance_conic): The function
|
|
calculates shortest distance from a point to a conic
|
|
bezier curve.
|
|
|
|
* src/sdf/ftsdf.c (sdf_edge_get_min_distance): Add the
|
|
`get_min_distance_conic' function call.
|
|
|
|
2020-07-01 Anuj Verma <anujv@iitbhilai.ac.in>
|
|
|
|
* src/sdf/ftsdf.c (get_min_distance_line): First check
|
|
pointer before using or dereferencing them.
|
|
|
|
2020-06-30 Anuj Verma <anujv@iitbhilai.ac.in>
|
|
|
|
* src/sdf/ftsdf.c: Avoid parentheses if there is only
|
|
one statement inside a control-flow statement.
|
|
|
|
2020-06-30 Anuj Verma <anujv@iitbhilai.ac.in>
|
|
|
|
[sdf] Added functions to solve polynomial equations.
|
|
|
|
* src/sdf/ftsdf.c (solve_quadratic_equation,
|
|
solve_cubic_equation): Added functions to solve
|
|
quadratic and cubic equations. These will be used for
|
|
conic bezier curves only.
|
|
|
|
2020-06-30 Anuj Verma <anujv@iitbhilai.ac.in>
|
|
|
|
* src/sdf/ftsdf.c (square_root, cube_root, arc_cos):
|
|
Use FT_16D16 instead of FT_Fixed to avoid confusion.
|
|
|
|
2020-06-30 Anuj Verma <anujv@iitbhilai.ac.in>
|
|
|
|
* src/sdf/ftsdf.c (cube_root, arc_cos): Added a few
|
|
essential math functions.
|
|
|
|
2020-06-30 Anuj Verma <anujv@iitbhilai.ac.in>
|
|
|
|
[sdf] Fixed compilation under gnumake.
|
|
|
|
* src/sdf/rules.mk (DRV_OBJ_ => DRV_OBJS_): Fixed variable
|
|
name so that the sdf can compile.
|
|
|
|
* src/sdf/module.mk: Fixed spacing.
|
|
|
|
* src/sdf/*.c: Fixed all compiler warnings.
|
|
|
|
* [GSoC]ChangLog: Fixed dates.
|
|
|
|
2020-06-29 Anuj Verma <anujv@iitbhilai.ac.in>
|
|
|
|
[sdf] Added function to resolve corners in case of
|
|
ambiguity.
|
|
|
|
* src/sdf/ftsdf.c (resolve_corner): Added function
|
|
to determine the correct sign in case there are
|
|
two sign for the same shortest distance (happens
|
|
around corners).
|
|
|
|
* src/sdf/ftsdf.c: Typo neartest_point -> nearest_point.
|
|
|
|
2020-06-29 Anuj Verma <anujv@iitbhilai.ac.in>
|
|
|
|
[sdf] The module can now generate signed distance
|
|
fields for outline with only lines.
|
|
|
|
* src/sdf/ftsdf.c (get_min_distance_line): Calculation
|
|
mistake.
|
|
|
|
* src/sdf/ftsdf.c (square_root): Added function to calculate
|
|
square root of a 16.16 fixed point integer.
|
|
|
|
* src/sdf/ftsdf.c (sdf_generate): Assign values to the output
|
|
bitmap, currently the output is 6.10 fixed point which can
|
|
contain values from [-32, 32]. Also fixed a bug which was
|
|
causing upside down images.
|
|
|
|
* src/sdf/ftsdfrend.c (ft_sdf_render): Fixed alignment issues.
|
|
|
|
2020-06-28 Anuj Verma <anujv@iitbhilai.ac.in>
|
|
|
|
[sdf] Added function to find shortest distance from
|
|
a point to a line.
|
|
|
|
* src/sdf/ftsdf.c (get_min_distance_line): The function
|
|
calculate the shortest signed distance from a point
|
|
to a line segment.
|
|
|
|
* src/sdf/ftsdf.c (sdf_contour_get_min_distance): Typo.
|
|
|
|
* src/sdf/ftsdf.c (SDF_Signed_Distance): Use squared
|
|
distance instead of actual distance for performance.
|
|
|
|
2020-06-28 Anuj Verma <anujv@iitbhilai.ac.in>
|
|
|
|
* src/sdf/ftsdf.c (SDF_Iterator_IO): Removed.
|
|
|
|
* src/sdf/ftsdf.c (sdf_edge_iterator_func => sdf_edge_get_min_distance
|
|
sdf_contour_iterator_func => sdf_contour_get_min_distance): Renamed.
|
|
Manually iterate through the lists instead of `FT_List_Iterate' to
|
|
avoid io structs and looks a bit cleaner.
|
|
|
|
2020-06-28 Anuj Verma <anujv@iitbhilai.ac.in>
|
|
|
|
[sdf] Added basic outline of the functions required to
|
|
generate sdf.
|
|
|
|
* src/sdf/ftsdf.c (SDF_Signed_Distance): Added struct which
|
|
represent a complete signed distance and can be used to
|
|
get cross, dot, sign etc.
|
|
|
|
* src/sdf/ftsdf.c (SDF_Iterator_IO): This struct will be used
|
|
while `FT_List_Iterate'.
|
|
|
|
* src/sdf/ftsdf.c (sdf_generate): Added function which generate
|
|
SDF from `SDF_Shape'.
|
|
|
|
* src/sdf/ftsdf.c (sdf_edge_iterator_func,
|
|
sdf_contour_iterator_func): Added functions
|
|
which iterate through contours and edges and return the shortest
|
|
distance.
|
|
|
|
|
|
2020-06-27 Anuj Verma <anujv@iitbhilai.ac.in>
|
|
|
|
[sdf] Added `SDF_Raster_Params' struct which extends
|
|
`FT_Raster_Params' and has a few extra fields. This is done
|
|
to pass extra data to the sdf rasterizer which is required
|
|
while rasterizing.
|
|
|
|
* src/sdf/ftsdf.h (SDF_Raster_Params): Added a struct which
|
|
extends `FT_Raster_Params' and has the `spread' parameter.
|
|
Also moved the max, min and default spread values to this
|
|
header file.
|
|
|
|
* src/sdf/ftsdf.c (sdf_raster_render): Added parameter and
|
|
attribute checking in order to pick errors and return
|
|
early.
|
|
|
|
* src//sdf/ftsdfrend.c (ft_sdf_render): Setup the `SDF_Raster_Params'
|
|
and pass it to the rasterizer instead of `FT_Raster_Params'.
|
|
|
|
2020-06-27 Anuj Verma <anujv@iitbhilai.ac.in>
|
|
|
|
* include/freetype/ftimage.h (FT_RASTER_FLAG_): Added
|
|
a new raster flag `FT_RASTER_FLAG_SDF'. The `ftsdf'
|
|
rasterizer will only render if this flag is set.
|
|
|
|
* src/sdf/ftsdfrend.c (ft_sdf_render): Set the `flags' field
|
|
of `FT_Raster_Params' to `FT_RASTER_FLAG_SDF'.
|
|
|
|
2020-06-26 Anuj Verma <anujv@iitbhilai.ac.in>
|
|
|
|
* src/sdf/ftsdf.c (sdf_shape_dump): Use `FT_TRACEX'
|
|
instead of `printf'.
|
|
|
|
2020-06-26 Anuj Verma <anujv@iitbhilai.ac.in>
|
|
|
|
* src/sdf/ftsdf.c (sdf_shape_dump): Added function to
|
|
dump the `SDF_Shape' on the console for debugging.
|
|
|
|
2020-06-26 Anuj Verma <anujv@iitbhilai.ac.in>
|
|
|
|
[sdf] Added functions to de-allocate `SDF_' structs.
|
|
|
|
* src/sdf/ftsdf.c (SDF_Contour, SDF_Shape): Use `FT_ListRec'
|
|
instead of `FT_List' to avoid a few extra allocations.
|
|
|
|
* src/sdf/ftsdf.c (SDF_Edge, SDF_Contour, SDF_Shape): Added
|
|
functions to de-allocate these structs and their members.
|
|
|
|
* src/sdf/ftsdfrenc.c: Typo.
|
|
|
|
2020-06-25 Anuj Verma <anujv@iitbhilai.ac.in>
|
|
|
|
[sdf] Decompose outline and store it in a temporary
|
|
`SDF_Shape' object for easy iteration and pre-computing
|
|
some variables.
|
|
|
|
* src/sdf/ftsdf.c (sdf_outline_decompose): Added function
|
|
to decompost outline and store it in a `SDF_Shape' object.
|
|
This allows us to pre-compute some variable.
|
|
|
|
2020-06-25 Anuj Verma <anujv@iitbhilai.ac.in>
|
|
|
|
[sdf] Added essential enums and structs required.
|
|
|
|
* src/freetype/internal/fttrace.h: Remove tabs.
|
|
|
|
* src/sdf/ftsdfrend.c (ft_sdf_render): Calculate padding
|
|
using the `spread'.
|
|
|
|
* src/sdf/ftsdf.c (SDF_Edge_Type, SDF_Edge, SDF_Contour,
|
|
SDF_Shape): Added structures and their initializer
|
|
functions.
|
|
|
|
2020-06-23 Anuj Verma <anujv@iitbhilai.ac.in>
|
|
|
|
[sdf] Added functionality to set and get module properties.
|
|
Also added a `spread' property.
|
|
|
|
* src/freetype/internal/fttrace.h: Added sdf module trace
|
|
define.
|
|
|
|
* src/sdf/ftsdf.c (sdf_TRaster => SDF_TRaster): Use capital
|
|
character for structs.
|
|
|
|
* src/sdf/ftsdfrend.h (SDF_Renderer_Module): Added a struct
|
|
which extends the `FT_RendererRec' and added the `spread'
|
|
property.
|
|
|
|
* src/sdf/ftsdfrend.c: Synchronized the code to use the new
|
|
`SDF_Renderer_Module' and added functions to get/set the
|
|
properties.
|
|
|
|
|
|
2020-06-20 Anuj Verma <anujv@iitbhilai.ac.in>
|
|
|
|
[sdf] Implemented a few functions required by a renderer
|
|
module.
|
|
|
|
* src/sdf/ftsdf.c (sdf_TRaster_): Added new structure to hold
|
|
the memory allocator `FT_Memory'.
|
|
|
|
* src/sdf/ftsdf.c (ft_sdf_raster): Implemented a few essential
|
|
functions required by `FT_Raster'.
|
|
|
|
* src/sdf/ftsdfrend.c (ft_sdf_renderer_class): Implemented a few
|
|
essential functions required by `FT_Renderer'.
|
|
|
|
* src/sdf/ftsdfrend.c (ft_sdf_render): Added functionality to
|
|
compute shift and padding before rendering the outline.
|
|
|
|
2020-06-19 Anuj Verma <anujv@iitbhilai.ac.in>
|
|
|
|
* include/freetype/ftimage.h (FT_Render_Mode_): Added new
|
|
pixel mode `FT_PIXEL_MODE_GRAY16' which will be used
|
|
to represent signed values while rendering to SDF bitmap.
|
|
|
|
2020-06-19 Anuj Verma <anujv@iitbhilai.ac.in>
|
|
|
|
* include/freetype/freetype.h (FT_Render_Mode_): Added new
|
|
rendermode `FT_RENDER_MODE_SDF' which will be used by the
|
|
`sdf' module to generate signed distance fields from glyph's
|
|
outline.
|
|
|
|
* src/sdf/ftsdfrend.h, src/sdf/module.mk, src/sdf/rules.mk:
|
|
Add a new line at the end of files.
|
|
|
|
2020-06-18 Anuj Verma <anujv@iitbhilai.ac.in>
|
|
|
|
[sdf] Added the structure of a new module to render
|
|
signed distance fields.
|
|
|
|
* src/sdf/sdf.c, src/sdf/ftsdfrend.c, src/sdf/ftsdf.c,
|
|
src/sdf/ftsdfrend.h, src/sdf/ftsdf.h, src/sdf/ftsdferrs.h:
|
|
Added files required by the `sdf' renderer module and added
|
|
the basic structure and functions required.
|
|
|
|
* src/sdf/rules.mk, src/sdf/module.mk: Added files required to
|
|
build the `sdf' module using the default build system.
|
|
|
|
* CMakeLists.txt (BASE_SRCS): Add `src/sdf/sdf.c' to the variable.
|
|
|
|
* include/freetype/config/ftmodule.h: Added `sdf' module
|
|
declaration so that the module can be compiled when not compiling
|
|
with GNU make.
|
|
|
|
* modules.cfg (RASTER_MODULES): Include `sdf' module to the default
|
|
rasterizer module list.
|
|
|
|
* include/freetype/ftmoderr.h: sdf module error define
|