Commit Graph

6953 Commits

Author SHA1 Message Date
Werner Lemberg b0f86752a5 .gitattributes: New file.
We use this to handle ChangeLog files with the `git-merge-changelog`
program.
2021-01-16 09:13:44 +01:00
Werner Lemberg 89184195b4 README, README.git: First updates due to freedesktop.org migration. 2021-01-16 07:53:09 +01:00
Dominik Röttsches 268bdd7764 CHANGES: Mention 'COLR' v1 support. 2021-01-15 14:49:32 +01:00
Werner Lemberg ba1a6acf28 [sfnt] Additional checks for 'colr' table presence.
* sfnt/ttcolr.c (tt_face_get_colr_glyph_paint,
tt_face_get_colorline_stops, tt_face_get_paint): Additional checks
for whether colr table is present.  Prevents crashes when these
methods are called on non-COLR fonts.
2021-01-15 10:09:00 +01:00
Dominik Röttsches 53fea87745 Add config option to test for 'COLR' v1 support in headers.
* include/freetype/config/ftoption.h (TT_SUPPORT_COLRV1): New macro
so that clients can test whether the FreeType checkout that they are
building against supports the 'COLR' v1 API.  This is intended to be
a temporary solution until 'COLR' v1 support is released in a
FreeType version and such a check can be made by using the version
number instead.
2021-01-14 16:06:03 +01:00
Dominik Röttsches 4b58cf47cc [base] Fill 'COLR' v1 API templates to make them work (#59703).
* src/base/ftobjs.c (FT_Get_Color_Glyph_Paint, FT_Get_Paint_Layers,
FT_Get_Paint, FT_Get_Colorline_Stops): Add basic sanity checks,
check for existence of `FT_Face`, check arguments and delegate calls
for the respective 'COLR' v1 API to the SFNT driver.
2021-01-14 15:56:04 +01:00
Dominik Röttsches d3e95d97a0 [sfnt] Register 'COLR' v1 API in driver (#59703).
* include/freetype/internal/sfnt.h (TT_Get_Color_Glyph_Paint_Func,
TT_Get_Paint_Layers_Func, TT_Get_Colorline_Stops_Func,
TT_Get_Paint_Func): New function pointer types.
(SFNT_Interface): Add them.
(FT_DEFINE_SFNT_INTERFACE): Updated.

* src/sfnt/sfdriver.c (PUT_COLOR_LAYERS_V1): New macro.
(sfnt_interface): Add new function pointers.
2021-01-14 15:56:04 +01:00
Dominik Röttsches 6260b4901c [sfnt] Add 'COLR' v1 API to retrieve color layers (#59703).
* src/sfnt/ttcolr.c (tt_face_get_paint_layers): New function to get
the layers of a `PaintColrLayers` table in the font, using an
`FT_LayerIterator` from an `FT_PaintColrLayers` object retrieved via
`tt_face_get_paint`.

* src/sfnt/ttcolr.h: Updated.
2021-01-14 15:56:04 +01:00
Dominik Röttsches be06a9d002 [sfnt] Add 'COLR' v1 API to iterate color stops (#59703).
* src/sfnt/ttcolr.c (tt_face_get_colorline_stops): New function to
return the current `FT_ColorStop` object from `FT_ColorStopIterator`.
Also increment the iterator.

* src/sfnt/ttcolr.h: Updated.
2021-01-14 15:56:04 +01:00
Dominik Röttsches cdad4db424 [sfnt] Add API to get actual paint from `FT_OpaquePaint` (#59703).
* src/sfnt/ttcolr.c (tt_face_get_paint): New function to resolve an
`FT_OpaquePaint` paint reference into an `FT_COLR_Paint` object of a
certain format, which contains the detailed information stored in a
paint of the respective format.
(read_paint): New function to provide the format specific parsing
and to populate the data members of each specific `FT_COLR_Paint`
subtype.
(read_color_line): New function to parse retrieved color line
information into an `FT_ColorLine` object, which has information
about the color line extend mode as well as an
`FT_ColorStopIterator` object.

* src/sfnt/ttcolr.h: Updated.
2021-01-14 15:56:04 +01:00
Dominik Röttsches 9e422b67c8 [sfnt] Add API to retrieve 'COLR' v1 root paint (#59703).
* src/sfnt/ttcolr.c (BaseGlyphV1Record): New structure.
(tt_face_load_colr): Handle version 1 table header.
(find_base_glyph_v1_record): New auxiliary function.
(tt_face_get_colr_glyph_paint): New function to find the root
`FT_OpaquePaint` object for a given glyph ID.

* src/sfnt/ttcolr.h: Updated.
2021-01-14 15:56:03 +01:00
Dominik Röttsches 08dba4dc35 Add new methods required for 'COLR' v1 to public API (#59703).
* include/freetype/freetype.h (FT_Get_Color_Glyph_Paint): New method
for retrieving the root paint object for a color glyph by specifying
a glyph ID.
(FT_Get_Paint_Layers): New method for retrieving the layers of a
`PaintColorGlyph`.
(FT_Get_ColorLine_Stops): New method for retrieving the stops of a
color.
(FT_Get_Paint): New method for resolving an `FT_OpaquePaint` into an
`FT_COLR_Paint` object.
2021-01-14 15:50:37 +01:00
Dominik Röttsches f57c24db63 Add types required for 'COLR' v1 to public API (#59703).
* include/freetype/freetype.h (FT_PaintFormat, FT_ColorStopIterator,
FT_ColorIndex, FT_ColorStop, FT_PaintExtend, FT_ColorLine,
FT_Affine23, FT_CompositeMode, FT_OpaquePaint, FT_PaintColrLayers,
FT_PaintSolid, FT_PaintLinearGradient, FT_PaintRadialGradient,
FT_PaintGlyph, FT_PaintColrGlyph, FT_PaintTransformed,
FT_PaintTranslate, FT_PaintRotate, FT_PaintSkew, FT_PaintComposite,
FT_COLR_Paint): Adding structs and enum to represent paint format,
color stop information, gradient extend information, structs to
reference paint offsets, and to define transforms and compositions.
Adding a union type to represent the union of the structs,
distinguished by `FT_PaintFormat`.
2021-01-14 15:47:34 +01:00
Werner Lemberg 03ceda9701 * builds/*: s/BUILD_DIR/PLATFORM_DIR/.
The old variable name caused confusion.
2021-01-10 15:34:46 +01:00
Alexei Podtelezhnikov 3431553836 [builds] Revert `FTMODULE_H' changes.
* builds/toplevel.mk, builds/freetype.mk: Revert changes.
2021-01-08 13:22:34 -05:00
Alexei Podtelezhnikov 0901a6f74c Tweak .gitignore. 2021-01-07 19:43:15 -05:00
Alexei Podtelezhnikov 6f24bab68c [builds/windows] Fix up DLG build with VC++.
* builds/windows/vc2010/script.bat: Copy headers to include/.
* builds/windows/vc2010/freetype.vcxproj: Remove DLG paths.
2021-01-07 16:57:13 -05:00
Alexei Podtelezhnikov 576403f22b [builds] Relocate `FTMODULE_H'.
* builds/toplevel.mk: Place `FTMODULE_H' in include/.
* builds/freetype.mk: Simplify included path.
2021-01-07 16:02:32 -05:00
Werner Lemberg cbc14b10e6 Fix ABI incompatibility.
* include/freetype/ftimage.h (FT_Pixel_Mode): Don't insert
`FT_PIXEL_MODE_GRAY16' but append it.

* src/base/ftobjs.c (pixel_modes): Updated.
2021-01-07 10:13:15 +01:00
Werner Lemberg 8afc185433 Fix typos from last commit. 2021-01-07 10:04:24 +01:00
Alexei Podtelezhnikov 6369058eee [dlg] Move the headers to include/dlg to simplify their use.
* autogen.sh, builds/toplevel.mk: Copy headers to incluide/dlg.
* builds/freetype.mk, builds/windows/vc2010/freetype.vcxproj:
Simplify included path.
* include/freetype/internal/ftdebug.h: Simplify #include.
* src/dlg/rules.mk, .gitignore: Updated.
2021-01-07 00:13:23 -05:00
Werner Lemberg f88c00e45a * meson.build: Add summary.
Based on a patch from Vincent Torri <vincent.torri@gmail.com>.
2021-01-06 19:19:29 +01:00
Torsten Hilbrich c6345ca36d * meson.build: Fix 'png' build option (#59458).
Without this patch, 'png' is always required.
2021-01-06 08:55:16 +01:00
Alexei Podtelezhnikov 74f1b6be4a [builds/windows] Add SDF to VC2010 project.
* builds/windows/vc2010/freetype.vcxproj: Updated;
AfterBuild conveniences.
2021-01-04 23:35:01 -05:00
Werner Lemberg c6ff2556c8 [sdf] Use 'counter-clockwise', not 'anti-clockwise'.
We prefer US nomenclature.

* src/sdf/ftsdf.c (SDF_Contour_Orientation):
s/SDF_ORIENTATION-ACW/SDF_ORIENTATION_CCW/.
Update all users.
2020-12-26 10:50:21 +01:00
Werner Lemberg bca740d566 Typo. 2020-12-26 08:55:49 +01:00
Werner Lemberg b6c8542dfc * src/base/ftobjs.c (pixel_modes): Updated. 2020-12-26 08:51:46 +01:00
Anuj Verma 10a5dfec7f [sdf] Remove custom memory tracker.
The internal FreeType memory tracker is sufficient.

* src/sdf/ftsdf.c (FT_DEBUG_INNER, FT_ASSIGNP_INNER, SDF_MemoryUser,
sdf_alloc, sdf_free, SDF_ALLOC, SDF_FREE,
SDF_MEMORY_TRACKER_DECLARE, SDF_MEMORY_TRACKER_SETUP,
SDF_MEMORY_TRACKER_DONE): Removed.

s/SDF_ALLOC/FT_ALLOC/.
s/SDF_FREE/FT_FREE/.

Other updates.
2020-12-26 08:34:38 +01:00
Werner Lemberg a8d3ad3539 .mailmap: Updated and synchronized with 'freetype2-demos' repository. 2020-12-24 08:43:55 +01:00
Werner Lemberg 286e9e0d72 [sdf] Two more copyright notices. 2020-12-24 08:41:12 +01:00
Werner Lemberg 3c983eb84a [sdf] Fix `make multi`.
* src/sdf/ftsdf.c: Include `ftoutln.h`.
2020-12-24 08:36:09 +01:00
Werner Lemberg aa1b5362d3 [sdf] Fix tracing.
* include/freetype/internal.fttrace.h: Add 'bsdf' component.

* src/sdf/ftbsdf.c, src/sdf/ftsdf.c (FT_COMPONENT): Define.
2020-12-24 08:32:04 +01:00
Werner Lemberg 04a6443254 [sdf] Add copyright notices. 2020-12-24 08:29:05 +01:00
Werner Lemberg eb2b5bb107 docs/CHANGES: Mention new SDF module. 2020-12-24 07:44:16 +01:00
Anuj Verma b298a64464 [sdf] Add debugging function.
* src/sdf/ftsdf.c (sdf_shape_dump): New function.
2020-12-24 07:23:48 +01:00
Anuj Verma 6444875f68 [sdf] Add brief technical overview of both rasterizers. 2020-12-24 07:23:48 +01:00
Anuj Verma 6cd6df55c9 [sdf] Add 'bsdf' renderer to 'sdf' module.
* src/sdf/ftsdfrend.c (ft_bsdf_render): New function.

(ft_bitmap_sdf_renderer_class): New structure.
2020-12-24 07:23:48 +01:00
Anuj Verma d27d107f15 [sdf] Add interface functions for the 'bsdf' rasterizer.
* src/sdf/ftsdf.c (bsdf_raster_new, bsdf_raster_reset,
bsdf_raster_set_mode, bsdf_raster_render, bsdf_raster_done): New
functions.

(ft_bitmap_sdf_raster): New variable.

* src/sdf/ftsdf.h: Updated.
2020-12-24 07:23:48 +01:00
Anuj Verma a21134751c [sdf] Add function to copy SDF data into output bitmap.
* src/sdf/ftbsdf.c (finalize_sdf): New function.
2020-12-24 07:23:48 +01:00
Anuj Verma e2ae96b978 [sdf] Add '8-point sequential Euclidean distance mapping' algorithm.
* src/sdf/ftbsdf.c (compare_neighbor, first_pass, second_pass,
edt8): New functions.
2020-12-24 07:23:48 +01:00
Anuj Verma 6b9a8044be [sdf] Add function to copy source bitmap to distance map.
* src/sdf/ftbsdf.c (bsdf_init_distance_map): New function.
2020-12-24 07:23:48 +01:00
Anuj Verma 0f644f38e9 [sdf] Add functions to compute pixel edge distances.
* src/sdf/ftbsdf.c (compute_edge_distance, bsdf_approximate_edge):
New functions.
2020-12-24 07:23:48 +01:00
Anuj Verma c576176461 [sdf] Add function to find edge pixels in a grid of alpha values.
* src/sdf/ftbsdf.c (bsdf_is_edge): New function.
2020-12-24 07:23:48 +01:00
Anuj Verma 9bbb3611b3 [sdf] Add essential structures for the 'bsdf' rasterizer.
* src/sdf/ftbsdf.c (ONE): New macro.
(BSDF_TRaster, ED, BSDF_Worker): New structures.
(zero_ed): New constant.
2020-12-24 07:23:48 +01:00
Anuj Verma c6f394bf7d [sdf] Add 'sdf' module to non-gnumake build systems.
* include/freetype/config/ftmodule.h: Add both the 'sfd' and 'bsfd'
renderers to the list of modules.

* CMakeLists.txt (BASE_SRCS): Add 'sdf' single-object module.
2020-12-24 07:23:48 +01:00
Anuj Verma 05f6088df3 [sdf] Added basic overlapping contour support.
* src/sdf/ftsdf.c (sdf_generate_with_overlaps): New function.
(sdf_raster_render): Enable it.
2020-12-24 07:23:48 +01:00
Anuj Verma 879ca87f0b [sdf] Add build infrastructure.
* src/sdf/module.mk, src/sfd/rules.mk: New files.

* src/sdf/ftsdf.h (ft_sdf_raster): New forward declaration.

* 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.
2020-12-24 07:23:48 +01:00
Anuj Verma 665ac96792 [sdf] Add interface functions for the 'sdf' rasterizer.
* src/sdf/ftsdf.c (sdf_raster_new, sdf_raster_reset,
sdf_raster_set_mode, sdf_raster_render, sdf_raster_done): New
functions.
(ft_sdf_raster): New structure.
2020-12-24 07:23:48 +01:00
Anuj Verma 1010f2c39c [sdf] Add subdivision and bounding box optimization.
* src/sdf/ftsdf.c (sdf_generate_bounding_box): New function, which
is an optimized version of `sdf_generate`.
(sdf_generate_subdivision): New function.
2020-12-24 07:23:48 +01:00
Anuj Verma 986d3108ac [sdf] Add function to generate SDF.
* src/sdf/ftsdf.c (sdf_generate): New function, currently disabled.
This is a proof-of-concept implementation: It doesn't use any
optimization, it simply checks all grid points against all contours.
2020-12-24 07:23:48 +01:00