summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* [sdf] Fix compiler warnings.GSoC-2020-anujAnuj Verma2020-08-242-4/+12
| | | | | | | | | | * src/sdf/ftsdf.c (get_control_box): Use goto instead of letting the next case statement execute to avoid compiler warning [-Wimplicit-fallthrough=]. * src/sdf/ftsdf.c (sdf_generate_bounding_box): Fix compiler warning due to signed unsigned mismatch. * src/sdf/ftsdfrend.c (ft_sdf_done): The function must have a return type of `void' to match the signature of `FT_Module_Destructor'.
* [sdf, bsdf] Fix compiler warnings.Anuj Verma2020-08-232-9/+12
| | | | * src/sdf/ftsdf.c, src/sdf/ftbsdf.c (*): Fix compiler warnings caused due to signed unsigned mismatch (-Wsign-compare).
* Be more explicit about the output of the SDF rasterizers.Anuj Verma2020-08-233-3/+19
| | | | | | | | | | * include/freetype/fttypes.h (FT_F6Dot10): Add a new data type which can be\ used to convert the output buffer appropriately. * include/freetype/freetype.h (FT_Render_Mode): Add information about the output while using `FT_RENDER_MODE_SDF'. * include/freetype/ftimage.h (FT_Pixel_Mode): Add more information about the `FT_PIXEL_MODE_GRAY16' pixel mode.
* [sdf] Added debugging function.Anuj Verma2020-08-211-0/+108
| | | | * src/sdf/ftsdf.c (sdf_shape_dump): Added a debugging function which can be used to debug issues with the outline, contours, edges etc.
* [sdf] Bug fix.Anuj Verma2020-08-211-1/+4
| | | | | | * src/sdf/ftsdf.c (*): Only track memory when `FT_DEBUG_MEMORY' is defined. Some variables used internally by the freetype memory debugger are only defined when we are tracking memory. If `FT_DEBUG_MEMORY' is not defined those variable are not defined and we get undefined reference error.
* [sdf] Added brief technical overview of both the rasterizers.Anuj Verma2020-08-212-0/+166
| | | | | | * src/sdf/ftsdf.c (*): Added a technical overview of the working of the `sdf' rasterizer. * src/sdf/ftbsdf,c (*) : Added a technical overview of the working of the `bsdf' rasterizer.
* [sdf] Added the `bsdf' renderer to the `sdf' module.Anuj Verma2020-08-201-0/+141
| | | | | | | * src/sdf/ftsdfrend.c (ft_bsdf_render): Added the `bsdf' renderer, render function which is essentially what is called from the FreeType core to render a glyph. * src/sdf/ftsdfrend.c (ft_bitmap_sdf_renderer_class): Added the `bsdf' renderer definition.
* [bsdf] Added forward declaration of the `bsdf' rasterizer.Anuj Verma2020-08-201-0/+3
| | | | | * src/sdf/ftsdf.h (ft_bitmap_sdf_raster): Added forward declaration of the rasterizer so that it can be added to the renderer.
* [bsdf] Added the interface functions for the `bsdf' rasterizer.Anuj Verma2020-08-201-0/+167
| | | | * src/sdf/ftsdf.c (bsdf_raster_): Added interface functions which are called from the FreeType core library to rasterize and do various other stuff with the rasterizer.
* [bsdf] Added function to copy the SDF data into the output bitmap.Anuj Verma2020-08-201-0/+97
| | | | | * src/sdf/ftbsdf.c (finalize_sdf): The function uses the final data present in the distance map and copies is to the output bitmap. It also converts our data into the desired format.
* [bsdf] Added the 8SED algorithm.Anuj Verma2020-08-201-0/+261
| | | | | | | | | | | * src/sdf/ftbsdf.c (edt8): Added function to do the euclidean transform to the distance map. The function basically does the 8SED algorithm on the distance map to compute the distance transform of the bitmap. * src/sdf/ftbsdf.c (first_pass, second_pass): The first and the second pass of the 8SED algorithm. * src/sdf/ftbsdf.c (compare_neighbor): Helper function to compare the neighbor of a pixel which is required in the 8SED algorithm.
* [bsdf] Added function to copy source bitmap to the distance map.Anuj Verma2020-08-201-0/+190
| | | | * src/sdf/ftbsdf.c (bsdf_init_distance_map): The function copies the source bitmap to the intermediate distance map which is present within the `worker'.
* [bsdf] Added function to approximate edge distances.Anuj Verma2020-08-201-0/+245
| | | | | | | | | * src/sdf/ftbsdf.c (compute_edge_distance): Added function to approximate edges given only the array of alpha values representing pixel coverage. This function uses the Gustavson's algorithm for approximating. * src/sdf/ftbsdf.c (bsdf_approximate_edge): This function loops through the entire bitmap and for edge pixel (found using `bsdf_is_edge') compute approximate edge distances (using `compute_edge_distance').
* [bsdf] Added function to find edge pixels given a grid of alpha values.Anuj Verma2020-08-201-0/+111
| | | | | * src/sdf/ftbsdf.c (bsdf_is_edge): The function find the edge pixel in a distance map which is basically a 2D array of alpha values which represent coverage in the original input bitmap.
* [bsdf] Added essential structures required by the `bsdf' rasterizer.Anuj Verma2020-08-201-0/+124
| | | | * src/sdf/ftbsdf.c (*): Added all the essential structures required internally by the `bsdf' rasterizer as well as the initializer for the `ED' struct.
* [sdf] Added `sdf' module to non gnumake build systems.Anuj Verma2020-08-202-0/+3
| | | | | | | * include/freetype/config/ftmodule.h (*): Add both the renderers to the list of modules. This allows build systems other than GNU Make to use the renderers. * CMakeLists.txt (BASE_SRCS): Add the `sdf' module single object to the list of source files.
* [sdf] Added basic overlapping contour support.Anuj Verma2020-08-201-0/+244
| | | | | * src/sdf/ftsdf.c (sdf_generate_with_overlaps): Added another `sdf_generate_' function which can generate SDF for glyphs with overlapping contour. Note that it cannot generate proper SDF for glyphs with self intersecting contours.
* [sdf] Add the `sdf' module to `modules.cg' and fix makefiles.Anuj Verma2020-08-195-69/+74
| | | | | | | | | | | * src/sdf/module.mk, src/sdf/rules.mk: Fix file names, they were reversed. * include/freetype/ftmoderr.h (FT_MODERRDEF): Add error definition for the `sdf' module. * include/freetype/internal/fttrace.h (FT_TRACE_DEF): Add trace definition for the `sdf' module. * modules.cfg (RASTER_MODULES): Add the `sdf' module to the list of rasterizers.
* [sdf] Added makefiles to build the `sdf' module.Anuj Verma2020-08-193-0/+82
| | | | | * src/sdf/ftsdf.c (module.mk, rules.mk): Added makefiled to build the `sdf' module. * src/sdf/ftsdf.c (ft_sdf_raster): Added forward declaration of the `sdf' rasterizer.
* [sdf] Added the interface functions for the `sdf' rasterizer.Anuj Verma2020-08-191-0/+180
| | | | * src/sdf/ftsdf.c (sdf_raster_): Added interface functions which are called from the FreeType core library to rasterize and do various other stuff with the rasterizer.
* [sdf] Added the subdivision and bounding box optimization.Anuj Verma2020-08-191-0/+292
| | | | | | | | * src/sdf/ftsdf.c (sdf_generate_bounding_box): Added function to generate SDF by only checking grid point around the bounding box of any edge. * src/sdf/ftsdf.c (sdf_generate_subdivision): Added function to generate SDF by splitting the shape into a number of line segments and then only checking grid points around the neighborhood of the lines.
* [sdf] Added function to generate SDF.Anuj Verma2020-08-191-0/+152
| | | | * src/sdf/ftsdf.c (sdf_generate): Added function to generate SDF. This one doesn't use any optimization, it simply check all grid point against all contours.
* [sdf] Added functions to get shortest distance from any edge/contour.Anuj Verma2020-08-191-0/+143
| | | | | | | | * src/sdf/ftsdf,c (sdf_edge_get_min_distance): Added function to get shortest distance from any arbitary edge. * src/sdf/ftsdf.c (sdf_contour_get_min_distance): Added function to get shortest distance from a contour. It basically returns the shortest distance from the nearest edge.
* [sdf] Added shortest distance finding functions.Anuj Verma2020-08-181-0/+937
| | | | | * src/sdf/ftsdf.c (get_min_distance_): Added function to find the closest distance from a point to a curves of all three different types (i.e. line segment, conic bezier and cubic bezier).
* [sdf] Added function to resolve corner distances.Anuj Verma2020-08-181-0/+94
| | | | * src/sdf/ftsdf.c (resolve_corner): Added function to resolve corner distances because at corner two equal distance can have opposite sign.
* [sdf] Added essential math functions.Anuj Verma2020-08-181-0/+224
| | | | | | | * src/sdf/ftsdf.c (cube_root, arc_cos): Added functions to compute cube root and cosine inverse of a 16.16 fixed point number. * src/sdf/ftsdf.c (solve_quadratic_equation, solve_cubic_equation): Added functions to find roots of quadratic and cubic polynomial equations.
* [sdf] Added utility functions for contours.Anuj Verma2020-08-181-0/+454
| | | | | | | * src/sdf/ftsdf.c (get_control_box, get_contour_orientation): Added functions to get control box and orientation of any `SDF_Contour'. * src/sdf/ftsdf.c (split_sdf_shape): Added function to split a complete shape (i.e. a collection of contours) into a number of small lines.
* [sdf] Added functions to decompose `FT_Outline'.Anuj Verma2020-08-171-0/+195
| | | | | * src/sdf/ftsdf.c (sdf_outline_decompose): Added a function which decompose a `FT_Outline' using `FT_Outline_Decompose' and adds the outline data to a `SDF_Shape' for easier handling later on.
* [sdf] Added essential structs, enums and macros for `sdf' rasterizer.Anuj Verma2020-08-171-0/+602
| | | | | | | | | | | * src/sdf/ftsdf.c (SDF_): Added the essential structures and enums which will be used internally by the `sdf' rasterizer. Also added allocator and deallocator functions for the structs. * src/sdf/ftsdf.c (SDF_MemoryUser): Added a custom memory allocator which is used to track intermediate memory usage while generate SDF. * src/sdf/ftsdf.c (definations): Added various definitions which can be used to modify the `sdf' rasterizer and also added a few helper macros.
* [sdf] Added raster params struct.Anuj Verma2020-08-173-0/+69
| | | | | | | | | | * src/sdf/ftsdf.h (SDF_Raster_Params): Added struct which is used to pass params to both `sdf' and `bsdf' rasterizer. * src/sdf/sdf.c (*): Include source files in order to make a single object of the module. * src/sdf/ftsdfrend.h (SDF_Renderer_Module): Add a '*' to make the comment similar to the rest in the module.
* [sdf] Added the `sdf' renderer.Anuj Verma2020-08-171-0/+398
| | | | | * src/sdf/ftsdf.c (*): Added `sdf' renderer along with it's interface functions and functions to set and get properties.
* [sdf] Added common elements for `sdf' and `bsdf' renderers.Anuj Verma2020-08-173-0/+227
| | | | | | | | | * src/sdf/ftsdfrend.c (*): Added common renderer struct and declaration of both the renderers. * src/sdf/ftsdfcommon.h (*): Added common properties, typedefs, macros etc. * src/sdf/ftsdferrs.h (*): Error definitions for the module.
* [sdf] Added all the necessary filed required by the module.Anuj Verma2020-08-168-0/+44
| | | | | | | | | | | | | | | | | | Added the necessary files required by the `sdf' module. These include files for both the `sdf' and the `bsdf' renderers. Here is breakdown of what the specific files will contain: * src/sdf/ftsdfrend.*: Both the renderers. * src/sdf/ftsdf.*: The rasterizer for the `sdf' renderer. * src/sdf/ftbsdf.c: The rasterizer for the `bsdf' renderer. * src/sdf/ftsdfcommon.h: Commmon properties and functions for both the rasterizers. * src/sdf/ftsdferrs.h: Common error define. * src/sdf/sdf.c: For building a single object of the entire module.
* Added render mode and data type required for the `sdf' module.Anuj Verma2020-08-162-4/+29
| | | | | | | | | | * include/freetype/freetype.h (FT_Render_Mode): Added a new render mode `FT_RENDER_MODE_SDF', which will be used to generate SDF. * include/freetype/ftimage.h (FT_Pixel_Mode): Added a new pixel mode `FT_PIXEL_MODE_GRAY16', which will be the output of the `sdf' module. * include/freetype/ftimage.h (FT_RASTER_FLAG_SDF): Added a new raster flag to be used internally by the `sdf' module.
* [base] Make necessary changes to allow renderers of different formats.Anuj Verma2020-08-161-7/+2
| | | | | | | | | | * src/base/ftobjs.c (FT_Render_Glyph_Internal): Do not return if the glyph's slot format is `FT_GLYPH_FORMAT_BITMAP'. The `bsdf' renderer will require bitmaps for processing. * src/base/ftobjs.c (ft_add_renderer, ft_remove_renderer): Remove renderer's glyph format check before adding and removing them. The `bsdf' renderer will have a format of `FT_GLYPH_FORMAT_BITMAP'. So, if we do not remove this check it will not get initialized and will not work.
* [truetype] Retain OVERLAP_SIMPLE and OVERLAP_COMPOUND.Alexei Podtelezhnikov2020-08-054-4/+29
| | | | | | | | | | | | | For glyphs with OVERLAP_SIMPLE or OVERLAP_COMPOUND, set FT_OUTLINE_OVERLAP to render them with direct oversampling, which mitigates artifacts (see 3bb512bc9f62). * include/freetype/ftimage.h (FT_OUTLINE_OVERLAP): Redefine to rhyme with OVERLAP_SIMPLE. * src/base/ftgloadr.c (FT_GlyphLoader_Rewind): Reset outline flags. * src/truetype/ttgload.c (TT_Load_Simple_Glyph): Retain OVERLAP_SIMPLE. (load_truetype_glyph): Retain OVERLAP_COMPOUND.
* * src/truetype/ttgload.c (TT_Load_Glyph): More tracing.Alexei Podtelezhnikov2020-08-042-2/+13
|
* Minor typos, formatting.Werner Lemberg2020-08-047-8/+9
|
* Unbreak compilation.Alexei Podtelezhnikov2020-07-281-1/+0
|
* Hide internal functions with SunPro.Alexei Podtelezhnikov2020-07-282-0/+12
| | | | | * include/freetype/internal/compiler-macros.h (FT_INTERNAL_FUNCTION_ATTRIBUTE) <__SUNPRO_C>: Define as __hidden.
* Fix static compilation with Visual C.Anuj Verma2020-07-282-1/+15
| | | | | * include/freetype/internal/compiler-macros.h (FT_INTERNAL_FUNCTION_ATTRIBUTE) <_WIN32>: Define as empty.
* Formatting, improving comments.Werner Lemberg2020-07-282-154/+203
|
* Fix `-Wformat' compiler warnings.Priyesh Kumar2020-07-2838-167/+175
| | | | | | * src/*: Fix format specifiers. * builds/unix/ftsystem.c (FT_Stream_Open): Ditto.
* Fix `-Wformat' compiler warnings.Werner Lemberg2020-07-257-13/+42
| | | | | | | | | | | | | | | | | | | | Problem reported by Priyesh kumar <priyeshkkumar@gmail.com> * src/base/ftoutln.c (FT_Outline_Decompose): Fix number of arguments to tracing macro. * src/bdf/bdfdrivr.c (bdf_cmap_char_next, bdf_get_bdf_property): Ditto. * src/cache/ftcbasic.c (ftc_basic_family_get_count): Ditto. Reformulate message. * src/pcf/pcfdrivr.c (pcf_get_bdf_property): Ditto. * src/sfnt/sfwoff2.c (woff2_open_font): Ditto. Trace table offset, too. * src/truetype/ttgxvar.c (ft_var_apply_tuple): Ditto.
* * src/sfnt/sfwoff2.c (woff2_decompress): Fix compiler warning.Werner Lemberg2020-07-232-1/+9
| | | | Reported by Hin-Tak.
* Add .clang-format fileDavid Turner2020-07-161-0/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This file can be used to reformat FreeType sources and commits using one of these methods: - Direct formatting of a whole file: clang-format -i path/to/file For example, to reformat all sources at once: echo builds/unix/ftconfig.h.in $(git ls-files *.[hc]) | xargs clang-format -i - Only reformat the changed lines in the current work directoy: git clang-format The style settings in this file are very close to the FreeType formatting style, with the following exceptions which are not supported here: - Mminimal 2-space margin on each non-empty line. (no left margin instead). - 2 empty lines between variable declarations and statements in C blocks. (only 1 is kept). { int x = ...; foo(x); } becomes { int x = ...; foo(x); } - Aignment of declarations uses 2 spaces to separate types and variable names (only 1 space is kept). int x; => int x; int y; int y; - The start used for output parameters in function signature should be near the variable name (always near the type). void foo(int* input_ptr, int *output_ptr) => void foo(int* input_ptr, int* output_ptr)
* [doc] Stem darkening is off by default for CFF driver.Werner Lemberg2020-07-152-5/+1
| | | | Bug reported by Ishi Tatsuyuki <ishitatsuyuki@gmail.com>.
* freetype.h (FT_Set_Transform): Minor documentation update.David Turner2020-07-141-0/+6
| | | | | | In order to mention the limited accuracy of `FT_Matrix' coefficients and encourage client code to perform the transform themselves with floating point values instead.
* README: Add information on contributing patches.Werner Lemberg2020-07-141-0/+12
|
* * builds/unix/configure.raw: Fix inclusion of `ftoption.h'.Werner Lemberg2020-07-122-1/+5
|