Compare commits

...

207 Commits

Author SHA1 Message Date
Dominik Röttsches 275b116b40 [sfnt] Support variable 'COLR' v1 `PaintVarSkew*`.
* src/sfnt/ttcolr.c (FT_PaintFormat_Internal): New enumeration values
`FT_COLR_PAINTFORMAT_INTERNAL_VAR_SKEW`,
`FT_COLR_PAINTFORMAT_INTERNAL_SKEW_CENTER`, and
`FT_COLR_PAINTFORMAT_INTERNAL_VAR_SKEW_CENTER`.
(read_paint): Handle new enumeration values.
2022-07-09 05:59:45 +02:00
Dominik Röttsches 44fd524ee4 [sfnt] Support variable 'COLR' v1 `PaintVarRotate*`.
* src/sfnt/ttcolr.c (FT_PaintFormat_Internal): New enumeration values
`FT_COLR_PAINTFORMAT_INTERNAL_VAR_ROTATE` and
`FT_COLR_PAINTFORMAT_INTERNAL_VAR_ROTATE_CENTER`.
(read_paint): Handle new enumeration values.
2022-07-09 05:59:45 +02:00
Dominik Röttsches 603fef28a6 [sfnt] Support 'COLR' v1 variable `PaintVarScale*`.
* src/sfnt/ttcolr.c: (FT_PaintFormatInternal): New enumeration values
`FT_COLR_PAINTFORMAT_INTERNAL_VAR_SCALE`,
`FT_COLR_PAINTFORMAT_INTERNAL_VAR_SCALE_CENTER`,
`FT_COLR_PAINTFORMAT_INTERNAL_VAR_SCALE_UNIFORM`, and
`FT_COLR_PAINTFORMAT_INTERNAL_VAR_SCALE_UNIFORM_CENTER`.
(read_paint): Handle new enumeration values.
2022-07-09 05:59:41 +02:00
Dominik Röttsches d134b9e37b [sfnt] Support for 'COLR' v1 variable translate.
* src/sfnt/ttcolr.c (FT_PaintFormat_Internal): New enumeration value
`FT_COLR_PAINTFORMAT_INTERNAL_VAR_TRANSLATE`.
(read_paint): Handle new enumeration value.
2022-07-09 05:44:58 +02:00
Dominik Röttsches 8ec531c26c [sfnt] Support for 'COLR' v1 variable transforms.
* src/sfnt/ttcolr.c (FT_PaintFormat_Internal): New enumeration value
`FT_COLR_PAINTFORMAT_INTERNAL_VAR_TRANSFORM`.
(read_paint): Handle new enumeration value.
2022-07-09 05:43:28 +02:00
Dominik Röttsches 9c4ad2a901 [sfnt] Deltas for 'COLR' v1 gradient coordinates.
* src/sfnt/ttcolr.c (read_paint) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Read and
apply deltas to radial, linear, and sweep gradient coordinates such as 'p0',
'p1', 'p2', 'center', 'radii', and 'angles'.
2022-07-09 05:41:27 +02:00
Dominik Röttsches 3414fef74f [sfnt] Support variable 'COLR' v1 color lines.
* include/freetype/ftcolor.h (FT_ColorStopIterator): Add field
`read_variable` to indicate whether a variation index base should be read.

* src/sfnt/ttcolr.c: (FT_PaintFormat_Internal): New enumerations
`FT_COLR_PAINTFORMAT_INTERNAL_VAR_LINEAR_GRADIENT`
`FT_COLR_PAINTFORMAT_INTERNAL_VAR_RADIAL_GRADIENT`, and
`FT_COLR_PAINTFORMAT_INTERNAL_VAR_SWEEP_GRADIENT`.
(read_color_line): New parameter `read_variable`; update callers.
(read_paint): Handle new enumerations.
2022-07-08 11:51:07 +02:00
Dominik Röttsches 7c151abb69 [sfnt] Apply variation deltas to `PaintVarSolid`.
* src/sfnt/ttcolr.c (FT_PaintFormat_Internal_): New enumeration
`FT_COLR_PAINTFORMAT_INTERNAL_VAR_SOLID`.

(get_deltas_for_var_index_base) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: New
function to retrieve an array of delta values, which will be used for most
of 'COLR' v1 variation formats (in follow-up commits).

(read_paint): Add `face` parameter; update caller.
Handle `FT_COLR_PAINTFORMAT_INTERNAL_VAR_SOLID`.
2022-07-07 19:48:19 +02:00
Dominik Röttsches 8a9192f68e [sfnt] Check safety of cast to `TT_Driver` before accessing member.
* src/sfnt/ttcolr.c (VARIABLE_COLRV1_ENABLED): Access
`enable_variable_colrv1` only if driver class matches.
2022-07-07 19:36:49 +02:00
Stephen Holdaway d5d048bbfe doc: Clarify description of `FT_Stream_IoFunc`.
The existing documentation comments on `FT_Stream_IoFunc` hinted at the dual
seek/read behavior required for custom stream implementations to work, but
it didn't explicitly explain it.  Without looking at the internals of
FreeType, it was easy for someone to assume their implementation should
handle both seek and read operations all the time.  If this is done, you get
a variety of errors, but mostly just `Unknown_File_Format` (error code
0x02).
2022-07-06 12:55:40 +02:00
Dominik Röttsches 31b14fd4dc [sfnt] Load variation store for 'COLR' v1.
* src/sfnt/ttcolr.c: Include `ttobjs.h` temporarily.
(VARIABLE_COLRV1_ENABLED): New temporary macro to detect whether variable
COLRv1 is enabled.
(Colr): New fields `var_store` and `delta_set_idx_map`.
(tt_face_load_colr, tt_face_free_colr) [VARIABLE_COLRV1_ENABLED]: Load and
free variation store data using the functions from the Multiple Masters
service.
2022-07-04 16:34:02 +02:00
Chris Liddell 1a242558be [base] Improve error handling in `FT_GlyphLoader_CheckPoints`.
If `FT_GlyphLoader_CreateExtra` returns an error (and a couple of other
places), `FT_GlyphLoader_CheckPoints` would propagate the error immediately,
rather than cleaning up the partially set up `FT_GlyphLoader`.  As a
consequence, a subsequent attempt to create a glyph could result in a crash.

* src/base/ftgloadr.c (FT_GlyphLoader_CheckPoints): Ensure all the error
conditions exits are consistent, eventually calling `FT_GlyphLoader_Reset`.
2022-07-03 06:58:23 +02:00
Thomas Sondergaard 55a97b0cb1 CMakeLists.txt: Provide both 'freetype' and 'Freetype::Freetype' targets.
FreeType can be located by consuming projects that use
`find_package(Freetype)` either via the old `MODULE` path (which uses
`FindFreetype.cmake` supplied by CMake), or via the new `CONFIG` path (which
uses `freetype-config.cmake` as supplied by this project).  Up to this point
the CMake module has supplied the target `Freetype::Freetype` and the config
file provided by this project the target `freetype`.  Now we supply both
`freetype` and `Freetype::Freetype` so that consuming projects can always
use the target `Freetype::Freetype` regardless of what path was taken by
`find_package(Freetype)`.

Fixes #1165.
2022-07-03 06:48:15 +02:00
Werner Lemberg 31005d98a4 include/freetype/ftmm.h: Improve documentation. 2022-07-02 09:34:13 +02:00
Dominik Röttsches bec4ef415e [base] Round values in `FT_MulAdd_Fix`.
This avoids regressing Blink layout tests and makes `FT_MulAdd_Fix` delta
retrieval implementation consistent with the previous implementation, which
used `FT_fixedToInt` and included rounding.

* src/base/ftcalc.c (FT_MulAdd_Fix): Implement it.
Also fix remaining `temp` initialization compilation issue.

Fixes #1169.
2022-07-01 14:01:08 +02:00
Werner Lemberg de27955c2a Minor formatting. 2022-07-01 06:33:50 +02:00
Dominik Röttsches 0607e0e959 Fix initialisation of temp variable in new FT_MulAddFix
src/truetype/ttgxvar.c (FT_MulAddFix): Initialise `temp`.
2022-06-30 10:55:50 +03:00
Dominik Röttsches dece953516 [truetype] Perform variation store delta computation with 64-bit precision.
* include/freetype/internal/ftmmtypes.h (FT_ItemVarDelta): Make type
explicitly 32-bit.
* include/freetype/internal/services/svmm.h
(FT_Var_Get_Item_Delta_Func): Change return type to `FT_ItemVarDelta`
* truetype/ttgxvar.h (tt_var_get_item_delta): Change return type to
`FT_ItemVarDelta`.
* truetype/ttgxvar.c (tt_var_get_item_delta): Store scalars and deltas
to intermediate array, perform computation using new method
`FT_MulAddFix`.
2022-06-29 20:27:11 +02:00
Dominik Röttsches 15fef219d6 New function `FT_MulAddFix` to compute the sum of fixed-point products.
This function, based on the code of `FT_MulFix`, uses 64-bit precision
internally for intermediate computations.

* include/freetype/internal/ftcalc.h, base/ftcalc.c (FT_MulAddFix):
Implement it.
2022-06-29 20:12:04 +02:00
Werner Lemberg 2db58e061e CMakeLists.txt: Move inclusion of `FindPkgConfig` down.
It must come after `CMAKE_TOOLCHAIN_FILE`.

Fixes #1167.
2022-06-22 12:16:00 +02:00
Dominik Röttsches 117df36b4c [sfnt] Upgrade stop_offset to FT_Fixed from FT_F2Dot14 2022-06-22 09:33:20 +00:00
Alexei Podtelezhnikov 5e48c88d57 * docs/CHANGES: Announce impending Infinality removal. 2022-06-21 17:34:29 +00:00
Alexei Podtelezhnikov 9006ff7d10 * ttgload.c (TT_Process_Composite_Glyph): Fix a signedness warning. 2022-06-21 17:10:56 +00:00
Werner Lemberg 2848378be5 s/fixed point/fixed-point/ 2022-06-21 17:08:04 +02:00
Werner Lemberg 40c6f97326 .gitlab-ci.yml: Correctly upgrade `meson`. 2022-06-21 14:45:42 +02:00
Dominik Röttsches 4b6f92e6b3 Proposal: Feature control for variable COLRv1
* include/freetype/ftdriver.h (variable-color-v1 property): Add documentation
for variable-colr-v1 property.
* src/truetype/ttdriver.c (tt_property_set): Ingest variable-control property
when called, set to enable_variable_colrv1 driver flag.
* src/truetype/ttobjs.h (TT_DriverRec): Add enable_variable_colrv1 flag.
2022-06-21 12:25:46 +03:00
Xavier Claessens b861b24157 [meson] Disable FreeType in HarfBuzz fallback.
This avoids cyclic subproject configuration when the 'harfbuzz' feature is
enabled, or `--wrap-mode=forcefallback` is used, but HarfBuzz is built as a
subproject.  HarfBuzz does the same and disables HarfBuzz support when
configuring FreeType as a subproject.

* meson.build (harfbuzz_dep): Implement it.

* subprojects/harfbuzz.wrap: New file.

* .gitlab-ci.yml [windows meson]: Use latest version of the meson 0.59
  series, which has a necessary bug fix to make CI work.
2022-06-21 08:09:16 +02:00
Alexei Podtelezhnikov 47103b2f19 [truetype] Clean up phantom point accounting.
This formalizes that the phantom points appended in the outline
do not increase its point count, nor are they tagged or included
in any additional contours.  Only their coordinates are stored.
They are counted in the glyph zone, however.

* src/truetype/ttgxvar.c (TT_Vary_Apply_Glyph_Deltas): Infer `n_points`
from the outline size plus four phantom points.
* src/truetype/ttgxvar.h (TT_Vary_Apply_Glyph_Deltas): Remove this
argument.
* src/truetype/ttgload.c (tt_prepare_zone): Add phantom four.
(TT_Process_Simple_Glyph, load_truetype_glyph): Update all callers.
2022-06-18 23:09:17 -04:00
Alexei Podtelezhnikov 705f416184 [truetype/GX] Clean up phantom point adjustment.
This moves phantom point and advance variation adjustment next to
calculations. The logic stays the same, HVAR and VVAR take priority.

* src/truetype/ttgload.c (load_truetype_glyph): Move it from here...
* src/truetype/ttgxvar.c (TT_Vary_Apply_Glyph_Deltas): ... to here
and check for HVAR and VVAR presence outside the main loop.
2022-06-18 23:02:26 -04:00
Ben Wagner f7daf9d293 [stream] Fix reading s32 when long is s64
`FT_READ_LONG`, `FT_GET_LONG`, and related macros did not return
negative values when `long` is more than 32 bits. `FT_Stream_ReadULong`
would read four bytes into the LSB of an `FT_ULong` and return that.
Since this can never set the MSb of the `FT_ULong` when `FT_ULong` is
more than 32 bits the cast to `FT_Long` never resulted in a negative
value.

Fix this by modifying `FT_Stream_Read*` to return a type of the same
size as the bytes it is reading and changing the `FT_READ_*` and
`FT_GET_*` macros to cast to the same type returned by `FT_Stream_Read*`
but with the correctly signed type (instead of casting to what is
assumed to be the type of `var` which will happen automatically anyway).

There exist a few cases like with the `OFF3` variants where there isn't
generally a type with the correct size. `FT_PEEK_OFF3` works around this
loading the bytes into the three most significant bits and then doing a
signed shift down. `FT_NEXT_OFF3` also already worked correctly by
casting this signed value to another signed type. `FT_Stream_GetUOffset`
works correctly but one must be careful not to attempt to cast the
returned value to a signed type. Fortunately there is only
`FT_GET_UOFF3` and no `FT_GET_OFF3`.

All of these cases are handled correctly when reading values through
`FT_Stream_ReadFields` since it generically computes the signed value
through an `FT_Int32`. This change is essentially doing the same for
these macros.

* include/freetype/internal/ftstream.h (FT_NEXT_*, FT_GET_*, FT_READ*):
Update macros and return types to use fixed size types for fixed size
values.

* src/base/ftstream.c (FT_StreamGet*, FT_StreamRead*): Dito.

Issue: #1161
2022-06-18 12:58:23 -04:00
Alexei Podtelezhnikov d9b8a69e9a [truetype/GX] Fix an old typo.
* src/truetype/ttgxvar.c (TT_Vary_Apply_Glyph_Deltas): Vertical
advance is measured along y-coordinate.
2022-06-16 22:13:25 -04:00
Alexei Podtelezhnikov 9c706dcca7 [truetype/GX] Clean up advance adjustment (Brrr).
* src/truetype/ttgload.c (load_truetype_glyph): Remove remaining code.
2022-06-16 16:11:51 +00:00
Ben Wagner 9079521002 [type1] Directly search for eexec in private dict
This code originally just searched for `eexec`. This was later modified
to check that the `eexec` found is valid (not in a string or comment).
This was done by searching for `eexec` as before and then, for each
`eexec` found, searching from the beginning using the correct parsing to
see if the `eexec` was still found. If the private dictionary is large
and contains many copies of `eexec` which are not valid, the initial
part of the private dictionary is scanned once for each, potentially
leading to n^2 parsing time.

Instead of finding an initial `eexec` and then re-parsing to discover if
it is valid, drop the initial search for `eexec` and just parse to find
a valid `eexec`. This is strictly faster since the validation must
happen anyway and avoids restarting from the beginning each time an
`eexec` is found in the data.

* src/type1/t1parse.c (T1_Get_Private_Dict): avoid n^2 parsing

Bug: https://bugs.chromium.org/p/chromium/issues/detail?id=1328883
2022-06-16 14:51:57 +00:00
Alexei Podtelezhnikov d6fc8c6ba0 [truetype/GX] Clean up advance adjustment.
* src/truetype/ttgload.c (TT_Process_Simple_Glyph, load_truetype_glyph):
Move the advance adjustment from here...
* src/truetype/ttgxvar.c (TT_Vary_Apply_Glyph_Deltas): ... to here and
simplify arguments.
* src/truetype/ttgxvar.h (TT_Vary_Apply_Glyph_Deltas): Update prototype
with fewer arguments.
2022-06-15 18:28:50 -04:00
Ben Wagner 8bb7722a53 [gzip] Handle inflate returning Z_NEED_DICT
When `inflate` returns `Z_NEED_DICT` this is currently not reported as
an error and callers may assume that the decompression succeeded when it
did not. In particular, a compressed table in a woff file may not
actually be decompressed and written as expected, leaving the backing
memory for the expanded table uninitialized.

* src/gzlip/ftgzip.c (FT_Gzip_Uncompress): treat `Z_NEED_DICT` as
indicating invalid data since there is no means to provide a dictionary.

Bug: https://bugs.chromium.org/p/chromium/issues/detail?id=1335712
2022-06-14 04:49:29 +00:00
Ben Wagner 58395dd200 [woff] Don't allocate table entries until needed
* src/sfnt/sfwoff.c (woff_open_font): delay allocating space for the
table entries until they are actually written out with the data.
2022-06-13 15:32:28 -04:00
Alexei Podtelezhnikov 8b6bcc92c5 * src/sfnt/sfwoff2.c (woff2_open_font): Partial revert.
Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=47981.
2022-06-12 09:04:13 -04:00
Alexei Podtelezhnikov e7482ff4c2 * src/lzw/ftzopen.c (ft_lzwstate_stack_grow): Cosmetic macro change. 2022-06-11 23:47:19 -04:00
Alexei Podtelezhnikov 73631b9530 [woff, woff2] Avoid buffer zeroing.
* src/sfnt/sfwoff.c (woff_open_font): Use Q-macros.
* src/sfnt/sfwoff2.c: Ditto.
(reconstruct_font): Allocate table_entry on stack.
2022-06-11 16:10:40 -04:00
Alexei Podtelezhnikov 4fef1fcede [smooth] Fix GCC LTO crashes on Windows.
Fixes #1164 by using a volatile variable around `setjmp`.  It is hard to
say how this fixes crashes related to certain link-time optimizations.
This does not decrease the rendering performance.

* src/smooth/ftgrays.c (gray_convert_glyph_inner): Use volatile `error`.
2022-06-10 11:34:56 -04:00
bruvzg 9acefc4f51 * src/smooth/ftgrays.c [FT_STATIC_RASTER]: Fix compilation. 2022-06-09 10:51:07 -04:00
Ben Wagner b11074cf6d [svg] Set linear advances when loading SVG glyphs
* include/freetype/freetype.h (FT_GlyphSlotRec_): update doc
* src/cff/cffgload.c (cff_slot_load): do it
* src/truetype/ttgload.c (TT_Load_Glyph): do it

Fixes: #1156
2022-06-06 16:55:17 -04:00
Ben Wagner c26872ed59 [svg] Clear correct flags for doc ownership
This issue was discovered with an SVG based font with some documents
compressed and other uncompressed. After loading the first compressed
document the ownership flag on the glyph slot was set to true but never
set to false. As a result after loading a compressed document a glyph
from an uncompressed document would load fine, but when this glyph slot
was cleared it would try to free its document resulting in a wild free.

* src/base/ftobjs.c (ft_glyphslot_clear): clear correct flags

Fixes: #1162
2022-06-01 17:27:38 +00:00
Alexei Podtelezhnikov d685798123 [docs] Correct favicon. 2022-05-31 22:40:55 -04:00
Alexei Podtelezhnikov 8addad6065 [docs] Use hinted favicon. 2022-05-31 22:38:24 -04:00
Alexei Podtelezhnikov c26f0d0d7e [docs] Update favicon. 2022-05-26 23:48:26 -04:00
Behdad Esfahbod (بهداد اسفهبد) b98dd169a1 * src/sfnt/ttmtx.c (tt_face_get_metrics): Apply variations unconditionally.
This causes a speed-up of approx. 20% for getting advance widths.
2022-05-25 14:49:37 +02:00
Dominik Röttsches 7838c78f53 [truetype] Support reading 32bit/16bit VarStore deltas
* include/freetype/internal/ftmmtypes.h (FT_ItemVarDelta): Define type
to be used for delta arrays, upgrade to FT_long.
* src/truetype/ttgxvar.c: Adhere to long_words bit and read either
Short/Byte pairs or Long/Short pairs, as defined by spec. For better
readability, define macro for repetitive read code.
2022-05-23 16:18:28 +03:00
Dominik Röttsches 9aa99f2262 [truetype] Handle 0xFFFF special value inside delta retrieval function
* truetype/ttgxvar.c (tt_hvadvance_adjust, tt_apply_mvar,
tt_var_get_item_delta): Remove special 0xFFFF handling in favor of less
redundant handling inside the tt_var_get_item_delta function, as it is
equivalent to returning a 0 delta. Avoids code-duplication checking for
special value 0xFFFF.
2022-05-20 17:20:08 +03:00
Dominik Röttsches a4c4566b6d [truetype, snft] Add service methods for `DeltaSetIdxMap` and `VarStore`.
This will be needed for 'COLR' v1 variation support.

* src/truetype/ttgxvar.h (GX_ItemVarData, GX_AxisCoords, GX_VarRegion,
GX_VarItemStore, GX_DeltaSetIdxMap): Move structures to...
* include/freetype/internal/ftmmtypes.h: ... this new file.

* include/freetype/internal/service/svmm.h (MultiMasters): Include
`ftmmtypes.h`.
(FT_Var_Load_Delta_Set_Idx_Map_Func, FT_Var_Load_Item_Var_Store_Func,
FT_Var_Get_Item_Delta_Func, FT_Var_Done_Item_Var_Store_Func,
FT_Var_Done_Delta_Set_Idx_Map_Func): New function typedefs.
(MultiMasters): Add them.
(FT_DEFINE_SERVICE_MULTIMASTERSREC): Updated.

* src/cff/cffdrivr.c (cff_load_item_variation_store,
cff_load_delta_set_index_mapping, cff_get_item_delta,
cff_done_item_variation_store, cff_done_delta_set_index_map): New wrapper
methods calling into mm service.
(cff_service_multi_masters): Updated.

* src/truetype/ttgxvar.c (ft_var_load_item_variation_store,
ft_var_load_delta_set_index_mapping, ft_var_get_item_delta,
ft_var_done_item_variation_store, ft_var_done_delta_set_index_map): Renamed
to ...
(tt_var_load_item_variation_store, tt_var_load_delta_set_index_mapping,
tt_var_get_item_delta, tt_var_done_item_variation_store,
tt_var_done_delta_set_index_map): ... this for consistency.
Mark them as non-static.
* src/truetype/ttgxvar.h: Add corresponding prototypes.

* src/truetype/ttdriver.c (tt_service_gx_multi_masters): Updated.

* src/type1/t1driver.c (t1_service_multi_masters): Updated.
2022-05-19 07:14:05 +02:00
Dominik Röttsches 5f19f49c81 [truetype] Move deallocation of `DeltaSetIdxMap` into own function.
This is a preparation for handling `DeltaSetIdxMap` and `VarStore` as a
FreeType service.

* src/truetype/ttgxvar.c (ft_var_done_delta_set_index_map): New function.
(tt_done_blend): Use it.
2022-05-19 06:09:17 +02:00
Werner Lemberg e3ac7bb64a * builds/toplevel.mk (do-dist): Don't remove meson wrap files.
Fixes #1157.
2022-05-18 16:12:19 +02:00
Werner Lemberg b4b7c3f607 * subprojects/zlib.wrap: Update to zlib version 1.2.12. 2022-05-18 16:02:21 +02:00
Werner Lemberg c8a9c88975 REAMDE: Mention that gitlab's 'download' button doesn't work.
This is because the `git archive` command doesn't preserve submodules.

Note that currently there is no support for disabling the 'download' button
in gitlab (https://gitlab.com/gitlab-org/gitlab/-/issues/17032).

Fixes issue #1158.
2022-05-18 07:06:58 +02:00
Werner Lemberg 5d49473f85 [truetype] Handle inner/outer index values 0xFFFF/0xFFFF.
This was introduced in OpenType 1.8.4.

* src/truetype/ttgxvar.c (ft_var_load_delta_set_index_mapping,
tt_hvadvance_adjust, ft_var_load_mvar, tt_apply_mvar): Handle special
inner/outer index values.
(ft_var_load_item_variation_store): Add test.

Fixes #1154.
2022-05-11 18:15:02 +02:00
Werner Lemberg e8ebfe988b * Version 2.12.1 released.
==========================

Tag sources with `VER-2-12-1'.

* docs/VERSION.TXT: Add entry for version 2.12.1.
* docs/CHANGES, docs/release: Updated.

* README, src/base/ftver.rc, builds/windows/vc2010/index.html,
builds/windows/visualc/index.html, builds/windows/visualce/index.html,
builds/wince/vc2005-ce/index.html, builds/wince/vc2008-ce/index.html,
docs/freetype-config.1: s/2.12.0/2.12.1/, s/2120/2121/.

* include/freetype/freetype.h (FREETYPE_PATCH): Set to 1.

* builds/unix/configure.raw (version_info): Set to 24:3:18.
* CMakeLists.txt (VERSION_PATCH): Set to 1.
2022-05-01 07:09:34 +02:00
Anuj Verma 7b3ebb9c12 [sdf] Do not throw errors for invisible glyphs.
* src/sdf/ftsdfrend.c (ft_sdf_render, ft_bsdf_render): Return `FT_Err_Ok` if
width or height is zero, since some glyphs do not generate visible bitmaps.

Fixes #1150.
2022-04-30 19:38:11 +02:00
Werner Lemberg 62bc04f4c5 * src/sfnt/sfobjs.c (sfnt_load_face): Set `FT_FACE_FLAG_COLOR` for SVG fonts.
Fixes #1151.
2022-04-30 15:37:14 +02:00
Brendan Shanks 6fb7b7a09d autogen.sh: Fix building when freetype is itself a git submodule.
There are situations where .git is not a directory, like when
freetype is a submodule in another repository.
2022-04-26 16:07:42 -07:00
Alexei Podtelezhnikov ed4d0710f1 [builds/windows] Simplify non-desktop UWP check.
Fixes mingw compilation described in !159.

* builds/windows/ftsystem.c: Do not use WINAPI_FAMILY_PARTITION macro.
2022-04-25 19:05:11 -04:00
Alexei Podtelezhnikov 581dd06405 [truetype] Reset IUP flags in `TT_RunIns`.
Fixes #1148 by moving the flag initialization back, partly reverting
7809007a and fd03dcc1.  Initializing these flags elsewhere skips 'cvt'.

* src/truetype/ttinterp.c (TT_RunIns): Initialize the IUP flag here...
(TT_Run_Context): ... instead of here.
2022-04-25 08:03:08 -04:00
Xavier Claessens d59c7ce1b9 [meson] Remove `default_library=both` from `default_options`.
It is inconsistent with what all other Meson projects do.

It also prevents static linking to FreeType when it is a subproject because
`default_options` in a subproject takes precedence on values set on the main
project.  For example, building 'GStreamer' with `-Ddefault_library=static`
would still dynamically link on FreeType unless the user also sets
`-Dfreetype2:default_library=static`.

* meson.build: Updated.

* .gitlab-ci.yml: Retain `both` option for testing.
2022-04-24 17:01:56 +02:00
Werner Lemberg 079a22da03 * src/truetype/ttgload.c (TT_Process_Simple_Glyph): Integer overflow.
Reported as

  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=46792
2022-04-19 09:34:10 +02:00
Georg Brandl 978eefee54 * src/cff/cffgload.c (cff_slot_load) [FT_CONFIG_OPTION_SVG]: Fix segfault.
This can happen if the function is called with `size` being `NULL`.

Fixes #1147.
2022-04-16 15:39:11 +02:00
Steve Lhomme 3100c8120e .gitlab-ci.yml: Add a Universal Windows build target
It's compiled for Windows 10 and up, ensuring UNICODE is set (default for UWP)
and selecting the proper WINAPI_FAMILY (WINAPI_FAMILY_APP).

Do not try to run the UWP exe in the Docker as it doesn't work.
2022-04-14 10:53:13 +00:00
Ben Wagner a1ca701023 [sfnt] Correct FT_ColorStopIterator documentation.
* include/freetype/ftcolor.h (FT_ColorStopIterator): the user should not
 set `p` to NULL before calling `FT_Get_Colorline_Stops`. `p` and
`num_color_stops` are set by `FT_Get_Paint`. `p` and
`current_color_stop` are updated by `FT_Get_Colorline_Stops`.
2022-04-04 15:28:54 -04:00
Werner Lemberg aee6b94727 * builds/unix/configure.raw: Add option `--with-librsvg`.
Since 'librsvg' is written in Rust, this option allows distributions to
avoid a dependency on the entire Rust toolchain to provide the FreeType demo
programs.

Suggested by Lars Wendler in !156.
2022-04-01 14:55:12 +02:00
Werner Lemberg fc08295650 * src/sfnt/sfwoff.c (reconstruct_glyf): Fix gcc 10 warning. 2022-04-01 14:50:44 +02:00
Werner Lemberg 1603378b91 [gzip] Update sources to zlib 1.2.12. 2022-04-01 10:47:23 +02:00
Eric Jing 89d5cce58d CMakeLists.txt: Fix `Info.plist` path.
When building a framework using CMake with `add_subdirectory`, CMake must be
able to find `freetype-Info.plist` when configuring the framework
properties.

Fixes #1145.
2022-04-01 08:55:22 +02:00
Werner Lemberg 695d606ae5 Whitespace. 2022-04-01 08:50:33 +02:00
Ben Wagner d247c56278 [truetype] Use SUB_LONG for component offset.
* src/truetype/ttgload.c (TT_Process_Composite_Component): do it.

Bug: https://crbug.com/1309429
2022-04-01 05:50:41 +00:00
Werner Lemberg 385345037e CMakeList.txt: Update code to handle recent changes for `freetype.pc`.
Fixes #1144.
2022-03-31 20:52:43 +02:00
Werner Lemberg 8a33164dad CMakeLists.txt: s/PKG_CONFIG/PKGCONFIG/, s/REQUIRED_/REQUIRES_/. 2022-03-31 20:51:58 +02:00
Werner Lemberg e50798b720 * Version 2.12.0 released.
==========================

Tag sources with `VER-2-12-0'.

* docs/VERSION.TXT: Add entry for version 2.12.0.
* docs/CHANGES, docs/release: Updated.

* README, src/base/ftver.rc, builds/windows/vc2010/index.html,
builds/windows/visualc/index.html, builds/windows/visualce/index.html,
builds/wince/vc2005-ce/index.html, builds/wince/vc2008-ce/index.html,
docs/freetype-config.1: s/2.11.1/2.12.0/, s/2111/2120/.

* include/freetype/freetype.h (FREETYPE_MINOR): Set to 12.
(FREETYPE_PATCH): Set to 0.

* builds/unix/configure.raw (version_info): Set to 24:2:18.
* CMakeLists.txt (VERSION_MINOR): Set to 12.
(VERSION_PATCH): Set to 0.

* builds/toplevel.mk (do-dist): Generate `ChangeLog` entries for all commits
since version 2.11.0 (when we stopped creating this file manually).
2022-03-31 13:55:50 +02:00
Werner Lemberg 87989a1435 Fix clang++ warnings.
* src/base/ftglyph.c (ft_svg_glyph_prepare), src/base/ftobj.c
(ft_glyphslot_init), src/cache/ftccmap.c (ftc_cmap_node_new),
src/cache/ftcimage.c (FTC_INode_New), src/lzw/ftlzw.c (FT_Stream_OpenLZW),
src/psaux/psobjs.c (ps_parser_load_field), src/pshinter/pshglob.c
(psh_globals_new), src/sfnt/ttsvg.c (tt_face_load_svg_doc): Initialize
variables used for allocation.

* src/sdf/ftsdf.c (split_sdf_conic, split_sdf_cubic): Change type of
`max_splits` to FT_UInt.
(sdf_generate_bounding_box): Add cast.
2022-03-31 07:49:35 +02:00
Werner Lemberg 97cdbb24f7 Whitespace. 2022-03-30 20:50:28 +02:00
Werner Lemberg 119e404b89 [builds] Fix creation of `freetype2.pc` for static-only builds.
We have to help `pkg-config` since it can't recognize that there is no
shared library installed.

Note that meson already does exactly the same.

* builds/unix/configure.raw (REQUIRES_PRIVATE, LIBS_PRIVATE): Rename to...
(PKGCONFIG_REQUIRES_PRIVATE, PKGCONFIG_LIBS_PRIVATE): This.  Adjust them
depending on `$enable_shared`.
(PKGCONFIG_REQUIRES, PKGCONFIG_LIBS): New variables.

* builds/unix/freetype2.in, builds/unix/unix-def.in: Use new and updated
variables.
2022-03-30 18:20:34 +00:00
Werner Lemberg a8e4563c34 Add `FT_FACE_FLAG_SBIX_OVERLAY` and `FT_HAS_SBIX_OVERLAY`.
* include/freetype/freetype.h (FT_FACE_FLAG_SBIX_OVERLAY,
FT_HAS_SBIX_OVERLAY): New macro.

* src/sfnt/ttsbit.c (tt_face_load_sbit): Handle `FT_FACE_FLAG_SBIX_OVERLAY`.
Remove obsolete tracing message.
2022-03-25 06:37:41 +00:00
Werner Lemberg 1949a7ec3a Add `FT_PARAM_TAG_IGNORE_SBIX`.
This is another bit to handle 'sbix' tables as described in the OpenType
specification.

* include/freetype/ftparams.h (FT_PARAM_TAG_IGNORE_SBIX): New macro.

* src/sfnt/sfobjc.c (is_apple_sbix): Rename to...
(has_sbix): ... this.
Check for more sbit tables.
Handle `FT_PARAM_TAG_IGNORE_SBIX` to eventually control `has_sbix`.
Only call sbit table loader if an sbit table is present.
2022-03-25 06:37:41 +00:00
Werner Lemberg ac4c1ebf7e [truetype] Fix 'sbix' table handling.
* src/sfnt/ttsbit.c (tt_face_load_sbix_image): Correct calculation of
'metrics->horiBearingY'.
Set vertical metrics.

* src/sfnt/sfobjs.c (sfnt_load_face): Adjust setting of `FT_FACE_FLAG_SBIX`.
Handle metrics of fonts with 'sbix' table.

* src/truetype/ttgload.c (TT_Load_Glyph): For 'sbix' embedded bitmaps, apply
bbox offset and bearing values of the corresponding glyph in the 'glyf'
table if it exists and has a contour.

* src/truetype/ttobjs.c (tt_face_init): Handle font with 'sbix' table.

Fixes issue #998.
2022-03-25 06:37:41 +00:00
Werner Lemberg 907715a6a2 Add `FT_FACE_FLAG_SBIX` and `FT_HAS_SBIX`.
Fonts with 'sbix' tables need special handling by the application.

* include/freetype/freetype.h (FT_FACE_FLAG_SBIX, FT_HAS_SBIX): New macros.

* src/sfnt/sfobjs.c (sfnt_load_face): Set `FT_FACE_FLAG_SBIX` if 'sbix'
table is present.
2022-03-25 06:37:41 +00:00
Werner Lemberg 06727a5257 * include/freetype/freetype.h (FT_LOAD_SBITS_ONLY): Tag macro as public. 2022-03-25 06:37:41 +00:00
Carlo Bramini 127c1e8331 [builds/windows] Fix WCE support.
* builds/windows/ftsystem.c [_WIN32_WCE]: Include <malloc.h> needed by
_alloca.
2022-03-23 22:53:07 -04:00
Steve Lhomme 0574692c6d [build/windows] Improve UWP support.
* builds/windows/ftsystem.c [UWP]: Wrap CreateFile2 into CreateFileA.
2022-03-23 22:46:15 -04:00
Werner Lemberg fc15ebe0a6 * src/sfnt/ttkern.c (tt_face_get_kerning): Exit early if no table.
Fixes #1141.
2022-03-21 11:17:28 +01:00
Ben Wagner a960be9e5e [woff2] Support overlap flag for simple glyphs.
In the woff2 spec it has been proposed to allow the OVERLAP_SIMPLE flag
to be retained through the woff2 format [0].

[0] https://www.w3.org/TR/WOFF2/#glyf_table_format

* src/sfnt/sfwoff2.h (GLYF_OVERLAP_SIMPLE): add glyf flag.

* src/sfnt/sfwoff2.c (reconstruct_glyf): parse optionFlags and
overlapSimpleBitmap[]. (store_points): set OVERLAP_SIMPLE on first point's
flag if the overlap bit is set.
2022-03-20 07:27:43 +00:00
Werner Lemberg d2c3bbcd8e [cff] Synchronize `cff_slot_load` with `TT_Load_Glyph`.
* src/cff/cffgload.c (IS_DEFAULT_INSTANCE): New macro.
(cff_slot_load): Use it.
2022-03-19 19:31:25 +01:00
Werner Lemberg 0c2bdb01a2 * src/base/ftobjs.c (FT_Request_Size): Guard `face->size`.
Fixes #1140.
2022-03-19 09:37:28 +01:00
Werner Lemberg d014387ad4 * src/base/ftobjs.c (ft_open_face_internal): Thinko. 2022-03-19 09:30:45 +01:00
Ben Wagner 7789f2bb79 [doc] FT_OUTLINE_OVERLAP was introduced in 2.10.3.
* include/freetype/ftimage.h (FT_OUTLINE_OVERLAP): Document when added.
2022-03-19 06:20:53 +00:00
Werner Lemberg 22a0cccb4d * src/base/ftobjs.c (ft_open_face_internal): Properly guard `face_index`.
We must ensure that the cast to `FT_Int` doesn't change the sign.

Fixes #1139.
2022-03-19 06:40:17 +01:00
Werner Lemberg 53dfdcd819 [sfnt] Avoid invalid face index.
Fixes #1138.

* src/sfnt/sfobjs.c (sfnt_init_face), src/sfnt/sfwoff2.c (woff2_open_font):
Check `face_index` before decrementing.
2022-03-17 19:24:16 +01:00
Werner Lemberg 1e2eb65048 Documentation, whitespace. 2022-03-07 10:13:44 +01:00
Anuj Verma 360e2507a3 [sdf] Fix corner checks and improve performance.
* src/sdf/ftsdf.c (sdf_generate_bounding_box): Always check for a corner if
two distances (for different curves) are very close.

(sdf_conic_to): Check whether the conic curve can be treated as a line
(which happens if the control point coincides with any end point).
2022-03-05 17:00:10 +01:00
Anuj Verma 2600ef637e [sdf] Implement deviation-based splitting for Bezier curves.
* src/sdf/ftsdf.c (split_sdf_cubic, split_sdf_shape): Add checks to figure
out the deviation of Bezier curves and stop splitting if the curve is flat
enough.

* src/sdf/ftsdfcommon.h (ONE_PIXEL): New macro.
2022-03-05 16:53:45 +01:00
Anuj Verma 5499d7bf81 * include/freetype/freetype.h: Improve SDF documentation. 2022-03-05 16:44:23 +01:00
Ben Wagner 335224beee [sfnt] Fix bounds check in SVG.
The `SVG_DOCUMENT_LIST_MINIMUM_SIZE` macro is non trivial and not
protected by parentheses. As a result, the expression
`table_size - SVG_DOCUMENT_LIST_MINIMUM_SIZE` expands to
`table_size - 2U + SVG_DOCUMENT_RECORD_SIZE` instead of the expected
`table_size - (2U + SVG_DOCUMENT_RECORD_SIZE)`. This causes an incorrect
bounds check which may lead to reading past the end of the `SVG ` table.

* src/sfnt/ttsvg.c (tt_face_load_svg): wrap macro definitions in
parentheses.

Bug: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=45179
2022-03-03 16:42:54 -05:00
Ben Wagner 034e5dbf92 [psaux] Full bounds check for OtherSubr 19.
It is possible for OtherSubr 19 to be invoked when `decoder->buildchar` is
NULL (so that `decoder->len_buildchar` is 0), the `blend` is non-NULL with
`blend->num_designs` set to 2, and the user supplied `idx` to be large (for
example 0xFFFFFFFE).  Since these are all `FT_UInt32` the existing bounds
check overflows in a well defined manner, allowing for an invalid call to
`memcpy`.

In addition, it is possible to call OtherSubr 19 with
`decoder->len_buildchar`, `blend->num_designs`, and `idx` all zero (implying
that `blend->weight_vector` and `decoder->buildchar` are NULL).  This passes
the bounds check (it is logically always fine to copy nothing starting at
index zero) but may invoke undefined behavior in `ft_memcpy` if it is backed
by `memcpy`.  Calling `memcpy` with either the `src` or `dst` NULL is
undefined behavior (even if `count` is zero).

* src/psaux/psintrp.c (cf2_interpT2CharString): Correctly check that
`blend->num_designs` can be copied to `decoder->buildchar[idx]`.
Also avoid passing NULL to `ft_memcpy`.

Bug: https://crbug.com/1299259
2022-02-23 17:42:55 +01:00
suzuki toshiya bcdfa38692 [cmake] Drop the support of CMake 2.x.
* CMakeLists.txt: Require CMake 3.0 (released on 2014) or newer.

The issue #1059 reports the difficulty to support both of
CMake 2.x and newer one by single CMakeLists.txt without
the inflation of cmake_policy() workarounds.

For better maintainability, the support of CMake 2.x is
dropped.
2022-02-21 10:44:42 +09:00
Werner Lemberg 6c5522c6f8 * src/bdf/README: Updated. 2022-02-19 13:37:07 +01:00
Werner Lemberg ca46bc0cf2 * builds/mac/ftmac.c, src/base/ftmac.c: s|FT_MAC_H|<freetype/ftmac.h>|. 2022-02-19 13:36:25 +01:00
Werner Lemberg 5b26e92a0f src/sfnt/ttkern.c (tt_face_load_kern): Micro-optimize.
A kerning table can be handled by binary search if it has equal entries.

Fixes #1132.
2022-02-19 07:20:24 +01:00
Steve Lhomme 20ec99be7e [builds/windows] Add support for legacy UWP builds.
* builds/windows/ftsystem.c: Add neccessary macro substitutions to
enable strict UWP builds.

See !141.

Co-authored-by: Alexei Podtelezhnikov <apodtele@gmail.com>
2022-02-17 13:35:52 -05:00
Werner Lemberg 01d4deb061 ftmm.h: Minor documentation improvement. 2022-02-16 14:51:44 +01:00
Alexei Podtelezhnikov 00ae29fcd2 [pshinter] Tune PSH_STRONG_THRESHOLD_MAXIMUM value.
Before the change, the hinting engine frequently confused horizontal
stem and serif hints making some stems too thin and some serifs too
thick. The value was tuned using serif fonts from the URW+ base 35
collection.

* src/pshinter/pshalgo.c [PSH_STRONG_THRESHOLD_MAXIMUM]: s/30/12/.
2022-02-12 23:42:08 -05:00
Werner Lemberg 5a53e51b5c t1tables.h: Documentation improvements. 2022-02-12 07:58:43 +01:00
Werner Lemberg c67ecb8c3a t1tables.h: Whitespace. 2022-02-12 07:52:57 +01:00
Werner Lemberg 338b4e8846 [type42] Fix `FT_Get_PS_Font_Private` for this format.
Since Type42 fonts don't have a 'Private' dictionary, the return value
should be `FT_Err_Invalid_Argument`.

* src/type42/t42drivr.c (t42_ps_get_font_private): Removed.
(t42_service_ps_info): Updated.
2022-02-11 19:32:49 +01:00
Alexei Podtelezhnikov 1680885aa5 [pshinter] Clear reused mask.
In PS hinter, memory allocations persist until the module is done.
Therefore, we have to clear reused masks.

* src/pshinter/pshrec.c (ps_mask_table_alloc): Clear reused mask.
2022-02-09 16:41:07 +00:00
Alexei Podtelezhnikov 0447df71e7 [pshinter] Use unsigned indices.
This reduces casting and eliminates some checks.

* src/pshinter/pshrec.c (ps_mask_test_bit, ps_mask_table_merge,
ps_dimension_add_t1stem, ps_hints_t1stem3): Updated.
(ps_dimension_add_counter): Updated, unnecessary checks removed.
2022-02-09 15:04:58 +00:00
Alexei Podtelezhnikov ed0e2e76d8 [pshinter] Fix mask merging.
We forgot to update the number of bits when merging a larger mask
into a smaller one.  This fix might have rendering effects.

* src/pshinter/pshrec.c (ps_mask_table_merge): Inherit the number
of bits from a larger mask. There is no need to zero unused bits,
already zeroed during allocation.
(ps_mask_clear_bit): Removed.
(ps_mask_ensure): Minor.
2022-02-08 16:35:14 -05:00
Alexei Podtelezhnikov 7c6b2f20b0 [pshinter] Revise the hint table handling.
* src/pshinter/pshrec.c (ps_hint_table_ensure): Remove redundant size
check; avoid array zeroing because it is fully initialized when used.
(ps_hint_table_alloc): Fix off-by-one comparison and remove another
zeroing of the array elements.
2022-02-08 14:37:34 +00:00
Werner Lemberg 24db55ecb8 Various minor doc fixes. 2022-02-06 21:06:52 +01:00
Alexei Podtelezhnikov a173aead31 [builds/windows] Add SVG to to project files.
* builds/windows/vc2010/freetype.vcxproj: Updated.
* builds/windows/vc2010/freetype.vcxproj.filters: Updated.
* builds/windows/visualc/freetype.vcproj: Updated.
2022-02-06 08:25:52 -05:00
Alexei Podtelezhnikov dd8676b277 * src/winfonts/winfnt.c (fnt_face_get_dll_font): Trace font resources. 2022-02-03 14:32:50 +00:00
Eric Jing 56d182a74d [cmake] Fix build on MacOS.
* CMakeLists.txt (CMAKE_OSX_ARCHITECTURES): Update value to fix the building
of a framework on MacOS.

* builds/mac/freetype-Info.plist (CFBundleExecutable): Make identifier
lowercase only.

Fixes #1127.
2022-02-02 18:15:28 +01:00
Alexei Podtelezhnikov 8e39e42ee9 [psaux] Revise `PS_Table` handling.
The old impleemntation was not using `FT_REALLOC`, buing too careful
with the offset rebasing.  It shoudl be safe to rely on the base
movements.

* src/psaux/psobjs.c (reallocate_t1_table, shift_elements): Combine
into...
(ps_table_realloc): ... this function based on `FT_REALLOC`.
(ps_table_done): Simplified.
(ps_table_add): Updated.
2022-02-02 11:35:14 -05:00
Alexei Podtelezhnikov c6dd509b99 * src/cache/ftcmru.c (FTC_MruList_New): Explain zeroing. 2022-02-02 11:32:58 -05:00
Alexei Podtelezhnikov 946e1353ea [cache] Partially revert 9870b6c07e.
Fix crashes reported by Werner.

* src/cache/ftcmru.c (FTC_MruList_New): Use `FT_ALLOC` again.
2022-01-31 14:19:07 +00:00
Werner Lemberg 36ee3160a0 freetype.h: Minor documentation improvement. 2022-01-31 10:37:56 +01:00
Alexei Podtelezhnikov 983d435865 [cache] Fix fallouts from edd4fedc54.
Reported by Werner.

* src/cache/ftcimage.c (FTC_INode_New): Always initialize FT_Glyph.
* src/cache/ftcsbits.c (FTC_SNode_New): Always initialize FT_SBit.
2022-01-30 22:13:51 -05:00
Alexei Podtelezhnikov bee8886408 Clean-up - do not doubt FT_FREE.
* src/base/ftobjs.c (memory_stream_close): Do not reassign zero
after `FT_FREE`.
* src/sfnt/sfwoff.c (sfnt_stream_close): Ditto.
* src/sfnt/sfwoff2.c (stream_close): Ditto.
* src/psaux/psobjs.c (ps_parser_load_field): Ditto.
* src/truetype/ttgxvar.c (ft_var_load_avar, tt_set_mm_blend,
tt_set_mm_blend): Ditto.
2022-01-30 21:55:21 -05:00
Werner Lemberg 7fd03a3e25 * CMakeLists.txt: Include 'FindPkgConfig' module.
Older cmake versions don't provide `pkg_check_modules` by default.

Fixes #1126.
2022-01-30 20:50:42 +01:00
Alexei Podtelezhnikov da877c8693 * src/psaux/psobjs.c (ps_parser_load_field): Reduce `string` scope. 2022-01-29 22:46:56 -05:00
suzuki toshiya 35740aa6a9 [cmake] Check the availability of `bzip2.pc'.
(CMakeLists.txt): Check the availability of `bzip2.pc'.

* If `bzip2.pc' is available, Requires.private should include
bzip2, but Libs.private should not include -lbz2.

* If `bzip2.pc' is unavailable, Requires.private cannot include
bzip2, but Libs.private should include -lbz2.

Fix #897.
2022-01-29 01:36:12 +00:00
Werner Lemberg fa226478b1 * unix/configure.raw: We need 'librsvg' version 2.46.0 or newer.
Older versions don't have function `rsvg_handle_get_intrinsic_dimensions`.
2022-01-28 15:20:12 +01:00
Alexei Podtelezhnikov b34741c1cc Minor clean-ups.
* src/base/ftrfork.c (raccess_make_file_name): Do not set error.
* src/sfnt/sfdriver.c (get_win_string, get_apple_string): Ditto.
* src/cff/cffobjs.c (cff_strcpy): Do not confuse about error.
* src/psaux/psobjs.c (ps_table_done): Ditto.
* src/truetype/ttgxvar.c (ft_var_readpacked*, ft_var_load_avar): Ditto.
2022-01-27 22:55:34 -05:00
Ben Wagner e34a860a07 Document `FT_Outline_Decompose` degenerate segments.
`FT_Outline_Decompose` does not filter out and can return degenerate
segments in an outline. This can be surprising when attemping to
stroke such an outline. Clarify the existing documentation on this
matter to cover all forms of degeneracy (without specifying exactly
how they will be reported), why they might arise, and better explain in
what cases they may be an issue.

* include/freetype/ftoutlin.h (FT_Outline_Decompose): update
documentation.

Fixes #952.
2022-01-27 21:49:47 +01:00
Anuj Verma ab1c98ac18 Fix sdf computation while `USE_SQUARED_DISTANCES`.
Function `map_fixed_to_sdf` expects spread to be absolute
and not squared.

* src/sdf/ftbsdf.c (finalize_sdf): Pass absolute spread
while `map_fixed_to_sdf`.

* src/sdf/ftsdf.c (sdf_generate_bounding_box): Ditto.
2022-01-27 18:01:08 +05:30
Tapish Ojha 3d77756e73 [sfnt] Improve sRGB constants.
* src/base/ftbitmap.c (ft_gray_for_premultiplied_srgb_bgra): Use slightly
more precise values.

Fixes #1018.
2022-01-27 08:43:19 +01:00
Werner Lemberg 9476cb7eb3 docs/release: Updated. 2022-01-27 08:32:42 +01:00
Alexei Podtelezhnikov 837f0345a9 * src/pfr/pfrload.c (pfr_phy_font_load): Use FT_QNEW_ARRAY. 2022-01-26 15:49:24 -05:00
Alexei Podtelezhnikov 0ac535900b * src/sdf/ftsdf.c (sdf_*_new): Use standard macro. 2022-01-26 14:02:27 -05:00
Alexei Podtelezhnikov 09223ef929 [pcf] Delay encoding allocation and avoid its zeroing.
* src/pcf/pcfread.c (pcf_get_encodings): Refactor and use FT_QNEW_ARRAY.
2022-01-26 11:23:38 -05:00
Werner Lemberg 267c6918d1 Aarg, typo. 2022-01-25 14:46:36 +01:00
Werner Lemberg 9af1127fbe freetype.h: More updates to `FT_LOAD_COLOR` description. 2022-01-25 14:45:10 +01:00
Werner Lemberg 8b7226bb43 * builds/unix/configure.raw (FT_DEMO_CFLAGS): Pass `-DHAVE-LIBRSVG`.
This helps in decoupling library support from `pkg-config` for other
platforms.
2022-01-25 14:28:45 +01:00
Werner Lemberg 6a8e95b7a0 Update documentation for `FT_LOAD_COLOR`. 2022-01-25 08:49:41 +01:00
Ben Wagner 5e9caaee78 [pshinter] Ensure all point flags are initialized.
Only off curve point flags were fully initialized.

* src/pshinter/pshalgo.c (psh_glyph_init): always initialize flags.

Fixes: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=43930
2022-01-24 12:24:59 -05:00
Werner Lemberg 657745212b .mailmap: Typo. 2022-01-24 07:57:20 +01:00
Werner Lemberg ef48a33271 * src/svg/ftsvg.c (ft_svg_property_set): Disallow NULL pointers. 2022-01-23 19:05:15 +01:00
Werner Lemberg cddfe6574b .mailmap: Updated. 2022-01-23 12:37:48 +01:00
Werner Lemberg 21d0fa3742 More documentation on handling OT-SVG. 2022-01-23 12:23:47 +01:00
Werner Lemberg 9c1538525b * src/svg/ftsvg.c: Rename `svg_hooks` to `svg-hooks` for consistency. 2022-01-23 08:56:17 +01:00
Werner Lemberg 112527dd44 [sfnt] Reject malformed SVG tables.
* src/sfnt/ttsvg.c (SVG_TABLE_HEADER_SIZE, SVG_DOCUMENT_RECORD_SIZE,
SVG_DOCUMENT_LIST_MINIMUM_SIZE, SVG_MINIMUM_SIZE): New macros.
(tt_face_load_svg): Check offsets.
Check table and record sizes.

Reported as

  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=43918
2022-01-22 12:09:08 +01:00
Alexei Podtelezhnikov 706c79a1da * src/psaux/psobjs.c (ps_table_new): Revert to zeroing. 2022-01-21 22:46:35 -05:00
Alexei Podtelezhnikov 0d2b4952a3 [psaux, type1, type42] Avoid annecessary zeroing.
* src/psaux/psobjs.c (ps_table_new): Use FT_QNEW_ARRAY.
* src/type1/t1load.c (parse_encoding): Ditto.
* src/type42/t42parse.c (t42_parse_encoding): Ditto.
2022-01-20 14:47:01 -05:00
Werner Lemberg 02fa26f4cd [builds/unix] Handle 'librsvg' for demo programs.
* builds/unix/configure.raw: Check for 'librsvg'.
(LIB_CLOCK_GETTIME): Don't call `AC_SUBST` on this but on...
(FT_DEMO_CFLAGS, FT_DEMO_LDFLAGS): ... these two new variables.

* builds/unix/unix-cc.in (LIB_CLOCK_GETTIME): Replaced by...
(FT_DEMO_CFLAGS, FT_DEMO_LDFLAGS): ... these two new variables.
2022-01-20 16:45:18 +00:00
Moazin Khatti 0bf49bd229 Add 'svg' module for OT-SVG rendering.
* CMakeLists.txt (BASE_SRCS): Add svg module file.
* meson.build (ft2_public_headers): Add `otsvg.h`.

* modules.cfg (RASTER_MODULES): Add `svg` module.

* builds/meson/parse_modules_cfg.py: Add svg module.

* include/freetype/config/ftmodule.h: Add `ft_svg_renderer_class`.
* include/freetype/fterrdef.h: Add `Invalid_SVG_Document` and
`Missing_SVG_Hooks` error codes.
* include/freetype/internal/fttrace.h: Add tracing for `otsvg`.
* include/freetype/internal/svginterface.h: New file.  It adds an interface
to enable the presetting hook from the `base` module.
* include/freetype/otsvg.h (SVG_Lib_Init_Func, SVG_Lib_Free_Func,
SVG_Lib_Render_Func, SVG_Lib_Preset_Slot_Func): New hooks for SVG rendering.
(SVG_RendererHooks): New structure to access them.

* src/base/ftobjs.c: Include `svginterface.h`.
(ft_glyphslot_preset_bitmap): Add code for presetting the slot for SVG
glyphs.
(ft_add_renderer): Updated.

* src/svg/*: New files.
2022-01-20 16:45:18 +00:00
Moazin Khatti 97c09a803e Add `FT_Glyph` support for OT-SVG glyphs.
* include/freetype/ftglyph.h (FT_SvgGlyphRec, FT_SvgGlyph): New structure.

* src/base/ftglyph.c: Include `otsvg.h`.
(ft_svg_glyph_init, ft_svg_glyph_done, ft_svg_glyph_copy,
ft_svg_glyph_transform, ft_svg_glyph_prepare): New function.
(ft_svg_glyph_class): New class.
(FT_New_Glyph, FT_Glyph_To_Bitmap): Updated to handle OT-SVG glyphs.
* src/base/ftglyph.h: Updated.
2022-01-20 16:45:18 +00:00
Moazin Khatti 5cf01aa2b2 [truetype, cff] Add code to load SVG document.
* src/cff/cffgload.c (cff_slot_load): Add code to load SVG doc.
* src/truetype/ttgload.c (TT_Load_Glyph): Add code to load SVG doc.
2022-01-20 16:45:18 +00:00
Moazin Khatti f93a897afe Add code to load OT-SVG glyph documents.
* include/freetype/config/ftheader.h (FT_OTSVG_H): New macro.
* include/freetype/freetype.h (FT_FACE_FLAG_SVG, FT_HAS_SVG): New macros.
(FT_LOAD_SVG_ONLY): New internal macro.
* include/freetype/ftimage.h (FT_Glyph_Format): New enumeration value
`FT_GLYPH_FORMAT_SVG`.
* include/freetype/internal/ftobjs.h (FT_GLYPH_OWN_GZIP_SVG): New macro.
* include/freetype/internal/fttrace.h: Add `ttsvg` for `ttsvg.c`.
* include/freetype/internal/sfnt.h(load_svg, free_svg, load_svg_doc): New
functions.
* include/freetype/internal/tttypes.h (TT_FaceRec): Add `svg` for
the SVG table.
* include/freetype/otsvg.h (FT_SVG_DocumentRec): New structure to hold the
SVG document and other necessary information of an OT-SVG glyph in a glyph
slot.
* include/freetype/tttags.h (TTAG_SVG): New macro.

* src/base/ftobjs.c: Include `otsvg.h`.
(ft_glyphslot_init): Allocate `FT_SVG_DocumentRec` in `slot->other`
if the SVG table exists.
(ft_glyphslot_clear): Free it upon clean-up if it is a GZIP compressed
glyph.
(ft_glyphslot_done): Free the document data if it is a GZIP compressed
glyph.
(FT_Load_Glyph): Don't auto-hint SVG documents.

* src/cache/ftcbasic.c (ftc_basic_family_load_glyph): Add support for
FT_GLYPH_FORMAT_SVG.

* src/sfnt/rules.mk (SFNT_DRV_SRC): Add `ttsvg.c`.
* src/sfnt/sfdriver.c: Include `ttsvg.h`.
(sfnt_interface): Add `tt_face_load_svg`, `tt_face_free_svg` and
`tt_face_load_svg_doc`.
* src/sfnt/sfnt.c: Include `ttsvg.c`.
* src/sfnt/sfobjs.c (sfnt_load_face, sfnt_done_face): Add code to load and
free data of the the SVG table.
* src/sfnt/ttsvg.c: New file, implementing `tt_face_load_svg`,
`tt_face_free_svg` and `tt_face_load_svg_doc`.
* src/sfnt/ttsvg.h: Declarations of the SVG functions in
`ttsvg.c`.
2022-01-20 16:45:18 +00:00
Moazin Khatti 06c1a25e63 Add flag `FT_CONFIG_OPTION_SVG`.
This flag is going to be used to conditionally compile support for OT-SVG
glyphs.  FreeType will do the parsing and rely on external hooks for
rendering of OT-SVG glyphs.

* devel/ftoption.h, include/freetype/config/ftoption.h
(FT_CONFIG_OPTION_SVG): New flag.
2022-01-20 16:45:18 +00:00
Alexei Podtelezhnikov 0b635b1eb2 [pshinter] Avoid unnecessary zeroing.
* src/pshinter/pshalgo.c (psh_hint_table_init,psh_glyph_init,
psh_glyph_interpolate_normal_points): Use FT_QNEW_ARRAY.
2022-01-20 15:06:25 +00:00
Alexei Podtelezhnikov 99a940f84a * include/freetype/freetype.h: Clarify `FT_Size` life cycle. 2022-01-20 15:06:09 +00:00
Alexei Podtelezhnikov 054782c48e [base] Undefined scale means no scale.
It might be surprising that FreeType does not have default ppem and
the size has to be set explicitly or face undefined behavior with
undefined variables and errors. This offers an alternative to
missing or zero scale by simply setting FT_LOAD_NO_SCALE.  Defined
behavior is bettr than undefined one.

This is alternative to !132 and discussed in
  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=43708

* src/base/ftobjs.c (FT_Load_Glyph): Deal with zero scale.
* include/freetype/freetype.h: Document it.
2022-01-19 22:14:06 -05:00
Alexei Podtelezhnikov 773e31c783 * src/autofit/afglobal.c (af_face_globals_new): Reduce zeroing.
Everything in AF_FaceGlobals is initialized except metrics.  Those
are zeroed here and initialized on demand later.
2022-01-18 14:05:46 -05:00
Alexei Podtelezhnikov d118bf8e35 [bdf,type1] Avoid unnecessary hash zeroing.
* src/bdf/bdflib.c (_bdf_parse_start): Use `FT_QALLOC`.
* src/type1/t1load.c (parse_subrs): Use `FT_QNEW`.
2022-01-15 23:09:53 -05:00
Ozkan Sezer 3f6497bdc5 Add Watcom C/C++ calling.
In the unlikely case the source is built with OpenWatcom's -ec?
switches to enforce a calling convention, the qsort() compare
function must still be set to __watcall.

* include/freetype/internal/compiler-macros.h (FT_COMPARE_DEF):
Updated.
2022-01-15 22:44:28 -05:00
Ben Wagner 5e227133c1 [pshinter] Avoid accessing uninitialized zone.
The `normal_top.count` may be 0, implying no `normal_top.zones` exist.
The code must not access these (non-existent) `normal_top.zones`.

* src/pshinter/pshalgo.c (ps_hints_apply): Do not assume that
`normal_top.zones[0]` is initialized. Test `normal_top.count`
before using `normal_top.zones[0]`. Do not rescale if there are no
`zones`.

Fixes: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=43675
2022-01-15 17:21:39 -05:00
Alexei Podtelezhnikov edd4fedc54 [cache] Avoid unnecessary zeroing.
* src/cache/ftccmap.c (ftc_cmap_node_new): Use `FT_QNEW`.
* src/cache/ftcimage.c (FTC_INode_New): Ditto.
* src/cache/ftcsbits.c (FTC_SNode_New): Ditto.
2022-01-14 22:53:57 -05:00
Ozkan Sezer 11ea89b51c Add Watcom C/C++ support.
* include/freetype/config/integer-types.h: Make sure `long long` is
used then available.
* include/freetype/internal/ftcalc.h (FT_MSB): Add Watcom C/C++ pragma.
2022-01-14 22:07:44 -05:00
Alexei Podtelezhnikov ba5d661f34 * src/sdf/ftbsdf.c (ED): s/near/prox/.
This works around the Watcom C definition of `near` as restricted
__near.
2022-01-14 21:54:17 -05:00
Alexei Podtelezhnikov 7f7bf6f0f0 * include/freetype/internal/compiler-macros.h [FT_COMPARE_DEF]: Tighten.
This works around Watcom C library using __watcall.
2022-01-14 20:33:28 -05:00
Alexei Podtelezhnikov 7eb9a9dbbe * src/pshinter/pshglob.c (psh_globals_new): Avoid zeroing.
This large allocation is followed by careful initialization. Whatever
is missed should be initialized manually.
2022-01-14 14:40:11 -05:00
Alexei Podtelezhnikov 81b81feb62 * src/base/fthash.c (hash_insert): Avoid unnecessary zeroing. 2022-01-14 18:22:23 +00:00
Alexei Podtelezhnikov 904ad21266 * src/bdf/bdflib.c (_bdf_parse_glyphs): Remove redundant assignment. 2022-01-13 23:38:56 -05:00
Alexei Podtelezhnikov ee52b57121 * src/lzw/ftlzw.c (FT_Stream_OpenLZW): Avoid unnecessary zeroing. 2022-01-13 09:45:48 -05:00
Ben Wagner 6ee8951956 [bzip2] Reset bzip stream on any error.
According to the bzip documentation it is undefined what will happen if
`BZ2_bzDecompress` is called on a `bz_stream` it has previously returned an
error against.  If `BZ2_bzDecompress` returns anything other than `BZ_OK`
the only valid next action is `BZ2_bzDecompressEnd`.

Reported as

  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=43564

* src/bzip2/ftbzip2.c (FT_BZip2FileRec_): Add `reset` to track the need to
reset the stream.
(ft_bzip2_file_init): Initialize `reset` to 0.
(ft_bzip2_file_reset): Set `reset` to 0 after resetting.
(ft_bzip2_file_fill_output): Set `reset` to 1 when `BZ2_bzDecompress`
returns anything other than `BZ_OK`.
2022-01-13 08:21:36 +01:00
Werner Lemberg b647dbdeb8 .gitlab-ci.yml: Minor comment cleanups. 2022-01-12 06:22:15 +01:00
Azamat H. Hackimov ca44a236a0 .gitlab-ci.yml: Add steps to `before_script` to ensure recent CA.
Fetch current list of valid CAs from Windows Update and manually import them
to trusted datastore.  This action is required to make downloads work from
sites that need recent Let's Encrypt ISRG Root X1 certificate.
2022-01-12 06:22:15 +01:00
Ben Wagner f1d3b9f10a Revert "[bzip2] Avoid use of uninitialized memory."
This reverts commit d276bcb7f0.

The original commit did avoid the use of uninitialized memory. However,
it appears that the original commit is no longer required. The
underlying issue was resolved by a change in freetype2-testing "Build
bzip2 correctly." [0]. Prior to [0] bzip2 was built without msan, so
bzip2 writes were not tracked or considered initialized. Clearing
`buffer` in the original commit allowed msan to see the `buffer` content
initialized once in FreeType code, but msan saw no writes into buffer
from bzip2.  With bzip2 now built with msan, the bzip2 writes are
properly instrumented and msan sees the bzip2 writes into the buffer. As
a result the original commit can be safely reverted to allow for better
detection of other uninitialized data scenarios.

* src/bzip2/ftbzip2.c (FT_Stream_OpenBzip2): Revert to using `FT_QNEW`.

[0] 3c052a837a
2022-01-11 17:15:35 -05:00
Ben Wagner e838c37c2c [type42] Track how much type42 ttf data is available.
Currently `T42_Open_Face` eagerly allocates 12 bytes for the ttf header
data which it expects `t42_parse_sfnts` to fill out from /sfnts data.
However, there is no guarantee that `t42_parse_sfnts` will actually be
called while parsing the type42 data as the /sfnts array may be missing
or very short. This is also confusing behavior as it means
`T42_Open_Face` is tightly coupled to the implementation of the very
distant `t42_parse_sfnts` code which requires at least 12 bytes to
already be reserved in `face->ttf_data`.

`t42_parse_sfnts` itself eagerly updates `face->ttf_size` to track how
much space is reserved for ttf data instead of traking how much data has
actually been written into `face->ttf_data`. It will also act strangely
in the presense of multiple /sfnts arrays.

* src/type42/t42objs.c (T42_Open_Face): ensure `ttf_data` is initialized
to NULL. Free `ttf_data` on error.

* src/type42/t42parse.c (t42_parse_sfnts): delay setting `ttf_size` and
set it to the actual number of bytes read. Ensure `ttf_data` is freed
if there are multiple /sfnts arrays or there are any errors.
2022-01-11 14:58:18 -05:00
Dominik Röttsches 3876846e26 [sfnt] Fix limit checks for `COLR` v1 ClipBoxes
* src/sfnt/ttcolr.c (tt_face_get_color_glyph_clipbox): Fix off-by-one in
limit checks.
2022-01-11 13:40:20 +02:00
Werner Lemberg d0cfb4e1b2 Update all copyright notices. 2022-01-11 10:54:10 +01:00
Werner Lemberg 947fddc8da * src/sfnt/ttcolr.c (read_paint): Fix undefined left-shift operation.
Reported as

  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=43151
2022-01-11 08:27:26 +00:00
Werner Lemberg 639a02154b * src/type42/t42objs.c (T42_Open_Face): Avoid use of uninitialized memory.
Reported as

  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=43508
2022-01-11 09:14:48 +01:00
Werner Lemberg 33626164e8 .gitlab-ci.yml: Fix typo in previous commit. 2022-01-11 08:01:30 +01:00
Werner Lemberg 4c0db60772 .gitlab-ci.yml: Update Windows image.
The old image produced errors like

```
Downloading zlib patch from
  https://wrapdb.mesonbuild.com/v2/zlib_1.2.11-5/get_patch
A fallback URL could be specified using patch_fallback_url key in the wrap file
WrapDB connection failed to
  https://wrapdb.mesonbuild.com/v2/zlib_1.2.11-5/get_patch
with error
  <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify
   failed: certificate has expired (_ssl.c:1122)>
```
2022-01-11 07:52:28 +01:00
Werner Lemberg 2e62b7446b * subprojects/zlib.wrap: Update from upstream. 2022-01-11 05:37:56 +01:00
Werner Lemberg 4a89112b2a * src/sfnt/ttcolr.c (tt_face_get_color_glyph_clipbox): Add limit checks.
Reported as

  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=40716
2022-01-10 18:31:17 +00:00
Werner Lemberg 3f9b78fc79 [zlib] Don't typedef `ptrdiff_t`.
While using zlib in 'solo' mode (via the `Z_SOLO` macro), we actually
include some standard header files, making the typedef fail on systems where
the native `ptrdiff_t` type differs.

Fixes #1124.

* src/zlib/zutil.h: Comment out definition; it doesn't work on Windows.

* src/zlib/patches/freetype-zlib.diff: Updated.
2022-01-10 18:24:56 +01:00
Werner Lemberg da8a8b8bcf [zlib] Some organizational changes.
We now first apply zlib's `zlib2ansi` script, then FreeType's patch file.

* src/gzip/README.freetype: Updated.

* patches/0001-zlib-Fix-zlib-sources-to-compile-for-FreeType.patch: Renamed
to...
* patches/freetype-zlib.diff: This.
Clean up description, then regenerate it as follows:

  - Copy unmodified files from `zlib` repository.
  - Run `zlib2ansi` script.
  - Run `git diff -R > patches/freetype-zlib.diff.new`.
  - Insert patch description of old diff file, then replace old diff with
    new diff file.
2022-01-10 18:13:10 +01:00
David Turner a25e85ed95 [gzip] Update sources to zlib 1.2.11
This can be tested by building with the Unix development build

  make setup devel
  make

or by building the freetype-demos programs with

  meson setup build -Dfreetype2:zlib=internal
  meson compile -C out

and trying to run `ftview` with a `.pcf.gz` font file.

* src/gzip/ftgzip.c, src/gzip/rules.mk: Update for new zlib sources.  Also
remove the temporary fix introduced in commit 6a431038 to work around the
fact that the internal sources were too old.

* src/gzip/README.freetype: New file describing the origin of the sources
and how they were modified.

* src/gzip/patches/*: Patch files applied to original sources.

* src/gzip/*: Updated zlib sources with the patch file(s) from
`src/gzip/patches/` applied, followed by a conversion with zlib's
`zlib2ansi` script.
2022-01-09 23:16:00 +01:00
David Turner 0d34386366 [meson] Change Zlib configuration option.
* meson_options.txt, meson.build: Change the format of the 'zlib' meson
build configuration option to be a combo with the following choices:

  - none: Do not support gzip-compressed streams at all.

  - internal: Support gzip-compressed streams using the copy of the gzip
    sources under `src/gzip/`; this should only be used during development
    to ensure these work properly.

  - external: Support gzip-compressed streams using the 'zlib' Meson
    subproject, linked as a static library.

  - system: Support gzip-compressed streams using a system-installed version
    of zlib.

  - auto: Support gzip-compressed streams using a system-installed version
    of zlib, if available, or using the 'zlib' subproject otherwise.  This
    is the default.

  - disabled: Backward-compatible alias for 'none'.

  - enabled: Backward-compatible alias for 'auto'.
2022-01-09 21:38:29 +01:00
Werner Lemberg d276bcb7f0 [bzip2] Avoid use of uninitialized memory.
* src/bzip2/ftbzip2.c (FT_Stream_OpenBzip2): Don't use `FT_QNEW` but
`FT_NEW` for setting up `zip` to avoid uninitialized memory access while
handling malformed PCF fonts later on.

Fixes

  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=42800
2022-01-09 07:48:59 +01:00
Alexei Podtelezhnikov ca01112894 [sfnt] Fix off-by-one error.
The 0-base index is equal to the number of previosly parsed entries.
It is an error to adjust it by one to get the number truncated by
a stream error.  This is probably inconsequential because valid
entries are correctly accounted for.

* src/sfnt/ttload.c (check_table_dir): Do not adjust the truncated
number of tables.
2022-01-08 22:28:44 -05:00
Werner Lemberg 7a493e3a40 [sfnt, type42] Correct previous commit.
Really fix https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=42773.

* src/sfnt/ttload.c (check_table_dir): Revert change.

* src/type42/t42.parse.c (t42_parse_sfnts): Don't use `FT_QREALLOC` but
`FT_REALLOC` for setting up `ttf_data` to avoid uninitialized memory access
while handling malformed TrueType fonts later on.
2022-01-08 10:28:19 +01:00
Werner Lemberg bf9b1ef905 * src/sfnt/ttload.c (check_table_dir): Initialize `table`.
Reported as

  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=42773
2022-01-07 10:25:52 +01:00
Werner Lemberg b5c2172f59 [sfnt] Avoid 'runtime error: applying zero offset to null pointer'.
* src/sfnt/ttsbit.c (tt_sbit_decoder_load_byte_aligned): Exit early if
`line` is NULL.
2022-01-07 06:53:44 +01:00
Werner Lemberg 5aa2a5c34a [autofit, pshinter] Use `FT_OFFSET`.
This avoids

```
runtime error: applying zero offset to null pointer
```

warnings of clang's undefined behaviour sanitizer.

* src/autofit/afcjk.c (af_cjk_hints_link_segments,
af_cjk_hints_compute_edges, af_cjk_hints_compute_blue_edges,
af_cjk_hint_edges, af_cjk_align_edge_points): Do it.

* src/autofit/afhints.c (af_glyph_hints_align_edge_points,
af_glyph_hints_align_strong_points): Ditto.

* src/autofit/aflatin.c (af_latin_metrics_init_widths,
af_latin_hints_link_segments, af_latin_hints_compute_edges,
af_latin_hints_compute_blue_edges, af_latin_hint_edges): Ditto.

* src/pshinter/pshalgo.c (psh_hint_table_init): Ditto.
2022-01-07 06:41:36 +01:00
Ben Wagner afb4ca0151 [truetype] Reset localpoints when varying cvt.
When iterating over the cvt tuples and reading in the points it is necessary
to set all of `localpoints`, `points`, and `point_count` in all cases.  The
existing code did not reset `localpoints` to `NULL` when there were no
private point numbers.  If the previous tuple did have private point numbers
and set `localpoints` to `ALL_POINTS` this would not be cleared and the
wrong branch would be taken later, leading to possible heap buffer overflow.

* src/truetype/ttgxvar.c (tt_face_vary_cvt): Reset `localpoints` to `NULL`
when it isn't valid.

Fixes: https://crbug.com/1284742
2022-01-06 19:13:00 +01:00
Werner Lemberg 2b672e7210 * builds/unix/configure.raw: Restore `SYSTEM_ZLIB` variable.
This was accidentally removed with commit 93ebcbd0 almost eight years ago.
2022-01-02 18:33:03 +01:00
Alexander Borsuk 4eb6cb8818 Fix warnings for CMake Unity builds.
* src/cache/ftcbasic.c (FT_COMPONENT): Undefine macro before redefinition.
* src/smooth/ftgrays.c (TRUNC, FRACT): Ditto.
2021-12-27 07:48:04 +01:00
Alexander Borsuk 4f35711844 Clang-Tidy warning fixes.
* src/base/ftobjs.c (FT_Get_Paint): Operator has equivalent nested operands.
* src/bdf/bdflib.c (_bdf_add_property): Value stored to `fp` is never read.
* src/sdf/ftbsdf.c (bsdf_init_distance_map): Value stored to `pixel` is
never read.
* src/sdf/ftsdf.c (split_sdf_shape): Value stored to `error` is never read.
2021-12-18 11:09:15 +01:00
Eli Schwartz d6a5c57727 * meson.build: Optimize lookup for `python3` program.
The python module's `find_installation` method is intended to provide
routines for compiling and installing python modules into the
`site-packages` directory.  It does a couple of slow things, including run
an introspection command to scrape sysconfig info from the detected
interpreter, which are not needed for the sole use case of invoking the
found installation as an executable.

Furthermore, when invoked without the name or path of a python binary, it is
hardcoded to always look for `python3` corresponding to the interpreter
meson itself uses to run.  So using `find_installation` did not even allow
detecting `python2` as a fallback.

Instead, switch to a simple `find_program` lookup that finishes as soon as
the program is found.
2021-12-17 10:47:13 +01:00
Eli Schwartz 57fd61805f * builds/meson/*.py: Fix name of python executable for auxiliary scripts.
The previous change to check the return code of `run_command` invocations
caused the CI to fail.  Although most scripts used `python_exe` as the
program command, the script to determine the project version did not.

But, all scripts used `python` as the shebang, and this is not available on
all systems.  Particularly Debian does not provide a `python` command,
though `python3` does exist.  This meant that formerly the version number
was lacking, and now the build simply fails.

Instead, rely on `python3` since it is guaranteed to exist when running
meson, and `python2` is end of life anyway.
2021-12-17 10:45:29 +01:00
Eli Schwartz e342f83c0b * meson.build: Check the return value of `run_command`.
By default, errors are not checked and a command that is somehow broken will
just capture incorrect output (likely an empty string).  Current development
versions of meson now raise a warning for this implicit behavior, and advise
explicitly setting the `check:` keyword argumend to determine whether a
failing return code should be considered an error.

Since none of the commands in this project are expected to fail, mark them
as required to succeed.
2021-12-17 10:38:57 +01:00
Alexei Podtelezhnikov 0da2a1155e [truetype] Upstream the hdmx binary search.
* src/truetype/ttobjs.h (TT_SizeRec): Add `widthp` for the hdmx
widths.
* src/truetype/ttobjs.c (tt_size_reset): Initialize `widthp` even
though it might never be used by the interpreter.
* src/truetype/ttgload.c (tt_loader_init): Avoid repeated searches
in the hdmx table.
2021-12-13 11:44:24 -05:00
Alexei Podtelezhnikov fd03dcc122 [truetype] Reset the IUP-called flags for each subglyph.
This fixes fall-out from 7809007a5b, where the composite
accents were no longer hinted.

* src/truetype/ttgload.c (ttloader_init): Move the IUP-called flag
initialization from here...
* src/truetype/ttinterp.c (TT_Run_Context): ... to here.
2021-12-12 12:29:04 -05:00
Alexei Podtelezhnikov 7add5b2bcb [truetype] Binary search through the `hdmx` records.
The `hdmx` table is supposed to be sorted by ppem size, which
enables binary search.  We also drop the check for the sufficient
length of the record because it is now enforced when the table
is loaded.

* include/freetype/internal/tttypes.h (TT_FaceRec): Store the `hdmx`
record pointers sorted by ppem instead of ppem's themselves.
* src/truetype/ttpload.c (tt_face_load_hdmx): Prudently sort records.
(tt_face_get_device_metrics): Implement binary search to retrieve
advances.
2021-12-11 22:54:06 -05:00
Alexei Podtelezhnikov a8ef33e3ae [truetype] Honor FT_LOAD_ADVANCE_ONLY if `hdmx` is usable.
This simply shortcuts the glyph loading if FT_LOAD_ADVANCE_ONLY
is specified by FT_Get_Advances and the `hdmx` data are located.
Particularly, the classic v35 interpreter or "verified" ClearType
fonts might see 100x speed up in retrieving the hdmx cache.

* src/truetype/ttgload.c (TT_Load_Glyph): Insert the shortcut.
2021-12-11 22:42:46 -05:00
Alexei Podtelezhnikov 6c831d658f [truetype] Initialize the loader with `hdmx` data.
The `hdmx` matching can be done before the glyph is loaded.

* include/freetype/internal/tttypes.h (TT_LoaderRec): Add a field.
* src/truetype/ttgload.c (compute_glyph_metrics): Relocate the `hdmx`
code from here...
(tt_loader_init): ... to here, before the glyph is loaded.
2021-12-11 22:34:27 -05:00
Alexei Podtelezhnikov 7809007a5b [truetype] Relocate subpixel flag setting.
`TT_RunIns` is too busy to deal with subpixel flags. It is better
to set them in `tt_loader_init`, which is executed before each
glyph program.

* src/truetype/ttinterp.c (TT_RunIns): Move the flag setting from
here...
* src/truetype/ttgload.c (tt_loader_init): ... to here.
2021-12-11 22:22:57 -05:00
Alexei Podtelezhnikov a35b081ebc [truetype] Limit INSTCTRL appication within specs.
* src/truetype/ttinterp.c (Ins_INSTCTRL): Limit its global effects
to the CVT program and local effects to the glyph program.

This also fixes an Infinality buglet. The `ignore_x_mode` should be
locally unset by the glyph program.
2021-12-11 22:12:25 -05:00
Ben Wagner bad92be927 [bdf] Fix use of uninitialized value.
In _bdf_readstream if the data contained no newline then the buffer
would continue to grow and uninitialized data read until either the
uninitialized data contained a newline or the buffer reached its
maxiumum size. The assumption was that the line was always too long and
the buffer had been filled, however this case can also happen when there
is not enough data to fill the buffer.

Correct this by properly setting the cursor to the end of the available
data, which may be different from the end of the buffer. This may still
result in one extra allocation, but only on malformed fonts.

* src/bdf/bdflib.c (_bfd_readstream): Correctly update cursor. Remove
unread set of `avail`.

Bug: https://lists.nongnu.org/archive/html/freetype-devel/2021-12/msg00001.html
2021-12-09 17:07:58 -05:00
632 changed files with 22572 additions and 4609 deletions

View File

@ -1,15 +1,17 @@
# CI setup for FreeType.
stages:
- build
# FIXME: Use --werror once warnings are fixed.
variables:
MESON_ARGS: --fatal-meson-warnings
MESON_ARGS: --fatal-meson-warnings --default-library=both
MESON_ARGS_WINDOWS: ${MESON_ARGS} --force-fallback-for=zlib
.build windows common:
# See
# https://gitlab.freedesktop.org/gstreamer/gst-ci/container_registry/213
image: 'registry.freedesktop.org/gstreamer/gst-ci/amd64/windows:v14-master'
image: 'registry.freedesktop.org/gstreamer/gst-ci/amd64/windows:2021-09-09.0-master'
stage: 'build'
tags:
- 'docker'
@ -34,50 +36,75 @@ variables:
# Make sure any failure in PowerShell scripts is fatal.
ErrorActionPreference: 'Stop'
WarningPreference: 'Stop'
# Uncomment the following key if need to pass custom args, as well with
# the `$env:MESON_ARGS` line in the `script:` blocks.
# Uncomment the following key if you need to pass custom args, as well
# with the `$env:MESON_ARGS` line in the `script:` blocks.
# MESON_ARGS: >-
# -Dfoo=enabled
# -Dbar=disabled
before_script:
# Make sure meson is up to date, so we don't need to rebuild the image
# Update RootCAs in order to access to some sites.
- certutil -generateSSTFromWU "C:\roots.sst"
- Import-Certificate -CertStoreLocation "Cert:\LocalMachine\Root" "C:\roots.sst"
# Make sure meson is up to date so we don't need to rebuild the image
# with each release.
- pip3 install meson==0.59.1
- pip3 install -U 'meson==0.59.*'
- pip3 install --upgrade certifi
- pip3 install -U ninja
# Generate a UWP cross-file in case it's used
- $PSDefaultParameterValues['Out-File:Encoding'] = 'ASCII'
- echo "[binaries]" > uwp-crossfile.meson
- echo "c = 'cl'" >> uwp-crossfile.meson
- echo "strip = ['true']" >> uwp-crossfile.meson
- echo "[built-in options]" >> uwp-crossfile.meson
- echo "c_args = ['-DWINAPI_FAMILY=WINAPI_FAMILY_APP', '-DUNICODE', '-D_WIN32_WINNT=0x0A00', '-we4013']" >> uwp-crossfile.meson
- echo "c_winlibs = ['windowsapp.lib']" >> uwp-crossfile.meson
script:
# For some reason, options are separated by newlines instead of spaces,
# so we have to replace them first.
#- $env:MESON_ARGS = $env:MESON_ARGS.replace("`n"," ")
#
# - $env:MESON_ARGS = $env:MESON_ARGS.replace("`n"," ")
#
# Gitlab executes PowerShell in docker, but `VsDevCmd.bat` is a batch
# script. Environment variables substitutions is done by PowerShell
# before calling `cmd.exe`, that's why we use `$env:FOO` instead of
# `%FOO%`.
- cmd.exe /C "C:\BuildTools\Common7\Tools\VsDevCmd.bat -host_arch=amd64 -arch=$env:ARCH &&
meson setup build $env:MESON_ARGS_WINDOWS &&
meson compile --verbose -C build &&
meson test -C build &&
meson test -C build --benchmark"
- cmd.exe /C "C:\BuildTools\Common7\Tools\VsDevCmd.bat -host_arch=amd64 -arch=$env:ARCH $env:VS_UWP &&
meson setup build $env:MESON_ARGS_WINDOWS $env:MESON_ARGS_UWP &&
meson compile --verbose -C build
$env:MESON_WINDOWS_TESTS"
# Format of job names:
# <OS> <Build-Tool> <Build-Params> <Architecture>
# Windows jobs
# Windows jobs.
windows meson vs2017 amd64:
extends: '.build windows meson'
variables:
ARCH: 'amd64'
MESON_WINDOWS_TESTS: '&& meson test -C build && meson test -C build --benchmark'
windows meson vs2017 x86:
extends: '.build windows meson'
variables:
ARCH: 'x86'
MESON_WINDOWS_TESTS: '&& meson test -C build && meson test -C build --benchmark'
windows meson vs2017 amd64 uwp:
extends: '.build windows meson'
variables:
ARCH: 'amd64'
VS_UWP: '-app_platform=UWP'
MESON_ARGS_UWP: '--cross-file uwp-crossfile.meson -Dc_winlibs="windowsapp.lib"'
# Linux Jobs.
#
# Jobs with "libs" in the name force-enable libraries.
# They are disabled for the remaining jobs.
# Linux Jobs
# Jobs with "libs" in the name force enable libraries.
# They are disabled in rest of the jobs.
linux autotools:
extends: '.build linux common'
script: |
@ -120,7 +147,8 @@ linux autotools libs clang:
linux meson:
extends: '.build linux common'
script: |
meson setup build -Dbrotli=disabled \
meson setup build ${MESON_ARGS} \
-Dbrotli=disabled \
-Dbzip2=disabled \
-Dharfbuzz=disabled \
-Dpng=disabled \
@ -132,7 +160,8 @@ linux meson:
linux meson libs:
extends: '.build linux common'
script: |
meson setup build -Dbrotli=enabled \
meson setup build ${MESON_ARGS} \
-Dbrotli=enabled \
-Dbzip2=enabled \
-Dharfbuzz=disabled \
-Dpng=disabled \
@ -163,6 +192,9 @@ linux cmake libs:
cmake --build build --target install
# MacOS jobs.
macos autotools:
extends: '.build macos common'
before_script:
@ -192,7 +224,7 @@ macos meson:
- pip3 install -U meson
- pip3 install --upgrade certifi
- pip3 install -U ninja
- meson setup build
- meson setup build ${MESON_ARGS}
- meson compile --verbose -C build
- sudo meson install -C build

View File

@ -1,7 +1,9 @@
Behdad Esfahbod (بهداد اسفهبد) <behdad@behdad.org> <behdad.esfahbod@gmail.com>
Behdad Esfahbod (بهداد اسفهبد) <behdad@behdad.org> <behdad@google.com>
Behdad Esfahbod (بهداد اسفهبد) <behdad@behdad.org>
Alexander Borsuk <me@alex.bio> <alexander.borsuk@qnective.com>
Ewald Hew (Hew Yih Shiuan 丘毅宣) <ewaldhew@gmail.com>
Moazin Khatti (موؤذن کھٹی) <moazinkhatri@gmail.com>
Priyesh Kumar (प्रियेश कुमार) <priyeshkkumar@gmail.com>
Alexei Podtelezhnikov (Алексей Подтележников) <apodtele@gmail.com>
Nikhil Ramakrishnan (निखिल रामकृष्णन) <ramakrishnan.nikhil@gmail.com>
@ -18,4 +20,5 @@ David Turner <david@freetype.org> <digit@google.com>
Anuj Verma (अनुज वर्मा) <anujv@iitbhilai.ac.in>
Ben Wagner <bungeman@gmail.com> Bungeman <bungeman@gmail.com>
Ben Wagner <bungeman@gmail.com> <bungeman@google.com>
Ben Wagner <bungeman@gmail.com> <bungeman@chromium.org>
Nikolaus Waxweiler <madigens@gmail.com> <nikolaus.waxweiler@daltonmaag.com>

View File

@ -1,6 +1,6 @@
# CMakeLists.txt
#
# Copyright (C) 2013-2021 by
# Copyright (C) 2013-2022 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# Written originally by John Cary <cary@txcorp.com>
@ -106,10 +106,9 @@
# (this is compatible with the same CMake variables in zlib's CMake
# support).
# FreeType explicitly marks the API to be exported and relies on the compiler
# to hide all other symbols. CMake supports a C_VISBILITY_PRESET property
# starting with 2.8.12.
cmake_minimum_required(VERSION 2.8.12)
# To minimize the number of cmake_policy() workarounds,
# CMake >= 3 is requested.
cmake_minimum_required(VERSION 3.0)
if (NOT CMAKE_VERSION VERSION_LESS 3.3)
# Allow symbol visibility settings also on static libraries. CMake < 3.3
@ -162,7 +161,7 @@ endif ()
project(freetype C)
set(VERSION_MAJOR "2")
set(VERSION_MINOR "11")
set(VERSION_MINOR "12")
set(VERSION_PATCH "1")
# Generate LIBRARY_VERSION and LIBRARY_SOVERSION.
@ -239,12 +238,14 @@ if (BUILD_FRAMEWORK)
message(FATAL_ERROR
"You should use Xcode generator with BUILD_FRAMEWORK enabled")
endif ()
set(CMAKE_OSX_ARCHITECTURES "$(ARCHS_STANDARD_32_64_BIT)")
set(CMAKE_OSX_ARCHITECTURES "$(ARCHS_STANDARD)")
set(BUILD_SHARED_LIBS ON)
endif ()
# Find dependencies
include(FindPkgConfig)
if (NOT FT_DISABLE_HARFBUZZ)
set(HARFBUZZ_MIN_VERSION "2.0.0")
if (FT_REQUIRE_HARFBUZZ)
@ -271,11 +272,16 @@ if (NOT FT_DISABLE_ZLIB)
endif ()
if (NOT FT_DISABLE_BZIP2)
# Genuine BZip2 does not provide bzip2.pc, but some platforms have it.
# For better dependency in freetype2.pc, bzip2.pc is searched
# regardless of the availability of libbz2. If bzip2.pc is found,
# Requires.private is used instead of Libs.private.
if (FT_REQUIRE_BZIP2)
find_package(BZip2 REQUIRED)
else ()
find_package(BZip2)
endif ()
pkg_check_modules(PC_BZIP2 bzip2)
endif ()
if (NOT FT_DISABLE_BROTLI)
@ -400,6 +406,7 @@ set(BASE_SRCS
src/sdf/sdf.c
src/sfnt/sfnt.c
src/smooth/smooth.c
src/svg/svg.c
src/truetype/truetype.c
src/type1/type1.c
src/type42/type42.c
@ -485,42 +492,55 @@ if (BUILD_FRAMEWORK)
)
set_target_properties(freetype PROPERTIES
FRAMEWORK TRUE
MACOSX_FRAMEWORK_INFO_PLIST builds/mac/freetype-Info.plist
MACOSX_FRAMEWORK_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/builds/mac/freetype-Info.plist
PUBLIC_HEADER "${PUBLIC_HEADERS}"
XCODE_ATTRIBUTE_INSTALL_PATH "@rpath"
)
endif ()
# 'freetype-interface' is an interface library, to be accessed with
# `EXPORT_NAME Freetype::Freetype`. This is the target name provided by
# CMake's `FindFreetype.cmake`, so we provide it for compatibility.
add_library(freetype-interface INTERFACE)
set_target_properties(freetype-interface PROPERTIES
EXPORT_NAME Freetype::Freetype
INTERFACE_LINK_LIBRARIES freetype)
set(PKG_CONFIG_REQUIRED_PRIVATE "")
set(PKG_CONFIG_LIBS_PRIVATE "")
set(PKGCONFIG_REQUIRES "")
set(PKGCONFIG_REQUIRES_PRIVATE "")
set(PKGCONFIG_LIBS "-L\${libdir} -lfreetype")
set(PKGCONFIG_LIBS_PRIVATE "")
if (ZLIB_FOUND)
target_link_libraries(freetype PRIVATE ${ZLIB_LIBRARIES})
target_include_directories(freetype PRIVATE ${ZLIB_INCLUDE_DIRS})
list(APPEND PKG_CONFIG_REQUIRED_PRIVATE "zlib")
list(APPEND PKGCONFIG_REQUIRES_PRIVATE "zlib")
endif ()
if (BZIP2_FOUND)
target_link_libraries(freetype PRIVATE ${BZIP2_LIBRARIES})
target_include_directories(freetype PRIVATE ${BZIP2_INCLUDE_DIR}) # not BZIP2_INCLUDE_DIRS
list(APPEND PKG_CONFIG_LIBS_PRIVATE "-lbz2")
if (PC_BZIP2_FOUND)
list(APPEND PKGCONFIG_REQUIRES_PRIVATE "bzip2")
else ()
list(APPEND PKGCONFIG_LIBS_PRIVATE "-lbz2")
endif ()
endif ()
if (PNG_FOUND)
target_link_libraries(freetype PRIVATE ${PNG_LIBRARIES})
target_compile_definitions(freetype PRIVATE ${PNG_DEFINITIONS})
target_include_directories(freetype PRIVATE ${PNG_INCLUDE_DIRS})
list(APPEND PKG_CONFIG_REQUIRED_PRIVATE "libpng")
list(APPEND PKGCONFIG_REQUIRES_PRIVATE "libpng")
endif ()
if (HarfBuzz_FOUND)
target_link_libraries(freetype PRIVATE ${HarfBuzz_LIBRARY})
target_include_directories(freetype PRIVATE ${HarfBuzz_INCLUDE_DIRS})
list(APPEND PKG_CONFIG_REQUIRED_PRIVATE "harfbuzz >= ${HARFBUZZ_MIN_VERSION}")
list(APPEND PKGCONFIG_REQUIRES_PRIVATE "harfbuzz >= ${HARFBUZZ_MIN_VERSION}")
endif ()
if (BROTLIDEC_FOUND)
target_link_libraries(freetype PRIVATE ${BROTLIDEC_LIBRARIES})
target_compile_definitions(freetype PRIVATE ${BROTLIDEC_DEFINITIONS})
target_include_directories(freetype PRIVATE ${BROTLIDEC_INCLUDE_DIRS})
list(APPEND PKG_CONFIG_REQUIRED_PRIVATE "libbrotlidec")
list(APPEND PKGCONFIG_REQUIRES_PRIVATE "libbrotlidec")
endif ()
@ -547,7 +567,7 @@ if (NOT SKIP_INSTALL_LIBRARIES AND NOT SKIP_INSTALL_ALL)
# Generate the pkg-config file
file(READ "${PROJECT_SOURCE_DIR}/builds/unix/freetype2.in" FREETYPE2_PC_IN)
string(REPLACE ";" ", " PKG_CONFIG_REQUIRED_PRIVATE "${PKG_CONFIG_REQUIRED_PRIVATE}")
string(REPLACE ";" ", " PKGCONFIG_REQUIRES_PRIVATE "${PKGCONFIG_REQUIRES_PRIVATE}")
string(REPLACE "%prefix%" ${CMAKE_INSTALL_PREFIX}
FREETYPE2_PC_IN ${FREETYPE2_PC_IN})
@ -559,10 +579,26 @@ if (NOT SKIP_INSTALL_LIBRARIES AND NOT SKIP_INSTALL_ALL)
FREETYPE2_PC_IN ${FREETYPE2_PC_IN})
string(REPLACE "%ft_version%" "${LIBTOOL_CURRENT}.${LIBTOOL_REVISION}.${LIBTOOL_AGE}"
FREETYPE2_PC_IN ${FREETYPE2_PC_IN})
string(REPLACE "%REQUIRES_PRIVATE%" "${PKG_CONFIG_REQUIRED_PRIVATE}"
FREETYPE2_PC_IN ${FREETYPE2_PC_IN})
string(REPLACE "%LIBS_PRIVATE%" "${PKG_CONFIG_LIBS_PRIVATE}"
FREETYPE2_PC_IN ${FREETYPE2_PC_IN})
if (BUILD_SHARED_LIBS)
string(REPLACE "%PKGCONFIG_REQUIRES%" "${PKGCONFIG_REQUIRES}"
FREETYPE2_PC_IN ${FREETYPE2_PC_IN})
string(REPLACE "%PKGCONFIG_REQUIRES_PRIVATE%" "${PKGCONFIG_REQUIRES_PRIVATE}"
FREETYPE2_PC_IN ${FREETYPE2_PC_IN})
string(REPLACE "%PKGCONFIG_LIBS%" "${PKGCONFIG_LIBS}"
FREETYPE2_PC_IN ${FREETYPE2_PC_IN})
string(REPLACE "%PKGCONFIG_LIBS_PRIVATE%" "${PKGCONFIG_LIBS_PRIVATE}"
FREETYPE2_PC_IN ${FREETYPE2_PC_IN})
else ()
string(REPLACE "%PKGCONFIG_REQUIRES%" "${PKGCONFIG_REQUIRES} ${PKGCONFIG_REQUIRES_PRIVATE}"
FREETYPE2_PC_IN ${FREETYPE2_PC_IN})
string(REPLACE "%PKGCONFIG_REQUIRES_PRIVATE%" ""
FREETYPE2_PC_IN ${FREETYPE2_PC_IN})
string(REPLACE "%PKGCONFIG_LIBS%" "${PKGCONFIG_LIBS} ${PKGCONFIG_LIBS_PRIVATE}"
FREETYPE2_PC_IN ${FREETYPE2_PC_IN})
string(REPLACE "%PKGCONFIG_LIBS_PRIVATE%" ""
FREETYPE2_PC_IN ${FREETYPE2_PC_IN})
endif ()
set(FREETYPE2_PC_IN_NAME "${PROJECT_BINARY_DIR}/freetype2.pc")
if (EXISTS "${FREETYPE2_PC_IN_NAME}")
@ -586,7 +622,7 @@ if (NOT SKIP_INSTALL_LIBRARIES AND NOT SKIP_INSTALL_ALL)
COMPATIBILITY SameMajorVersion)
install(
TARGETS freetype
TARGETS freetype freetype-interface
EXPORT freetype-targets
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}

View File

@ -3,7 +3,7 @@
#
# Copyright (C) 1996-2021 by
# Copyright (C) 1996-2022 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,

14
README
View File

@ -1,4 +1,4 @@
FreeType 2.11.1
FreeType 2.12.1
===============
Homepage: https://www.freetype.org
@ -16,7 +16,9 @@ Read the files `docs/INSTALL*` for installation instructions; see the
file `docs/LICENSE.TXT` for the available licenses.
For using FreeType's git repository instead of a distribution bundle,
please read file `README.git`.
please read file `README.git`. Note that you have to actually clone
the repository; using a snapshot will not work (in other words, don't
use gitlab's 'Download' button).
The FreeType 2 API reference is located in directory `docs/reference`;
use the file `index.html` as the top entry point. [Please note that
@ -30,9 +32,9 @@ sites. Go to
and download one of the following files.
freetype-doc-2.11.1.tar.xz
freetype-doc-2.11.1.tar.gz
ftdoc2111.zip
freetype-doc-2.12.1.tar.xz
freetype-doc-2.12.1.tar.gz
ftdoc2121.zip
To view the documentation online, go to
@ -92,7 +94,7 @@ Enjoy!
----------------------------------------------------------------------
Copyright (C) 2006-2021 by
Copyright (C) 2006-2022 by
David Turner, Robert Wilhelm, and Werner Lemberg.
This file is part of the FreeType project, and may only be used,

View File

@ -89,7 +89,7 @@ address:
----------------------------------------------------------------------
Copyright (C) 2005-2021 by
Copyright (C) 2005-2022 by
David Turner, Robert Wilhelm, and Werner Lemberg.
This file is part of the FreeType project, and may only be used,

View File

@ -1,6 +1,6 @@
#!/bin/sh
# Copyright (C) 2005-2021 by
# Copyright (C) 2005-2022 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,
@ -182,7 +182,7 @@ copy_submodule_files ()
cp $DLG_SRC_DIR/* src/dlg
}
if test -d ".git"; then
if test -e ".git"; then
DLG_INC_DIR=subprojects/dlg/include/dlg
DLG_SRC_DIR=subprojects/dlg/src/dlg

View File

@ -1,7 +1,7 @@
README for the builds/amiga subdirectory.
Copyright (C) 2005-2021 by
Copyright (C) 2005-2022 by
Werner Lemberg and Detlef Würkner.
This file is part of the FreeType project, and may only be used, modified,

View File

@ -4,7 +4,7 @@
/* */
/* Amiga-specific configuration file (specification only). */
/* */
/* Copyright (C) 2005-2021 by */
/* Copyright (C) 2005-2022 by */
/* Werner Lemberg and Detlef Würkner. */
/* */
/* This file is part of the FreeType project, and may only be used, */

View File

@ -4,7 +4,7 @@
/* */
/* Amiga-specific FreeType module selection. */
/* */
/* Copyright (C) 2005-2021 by */
/* Copyright (C) 2005-2022 by */
/* Werner Lemberg and Detlef Würkner. */
/* */
/* This file is part of the FreeType project, and may only be used, */

View File

@ -5,7 +5,7 @@
#
# Copyright (C) 2005-2021 by
# Copyright (C) 2005-2022 by
# Werner Lemberg and Detlef Würkner.
#
# This file is part of the FreeType project, and may only be used, modified,

View File

@ -4,7 +4,7 @@
#
# Copyright (C) 2005-2021 by
# Copyright (C) 2005-2022 by
# Werner Lemberg and Detlef Würkner.
#
# This file is part of the FreeType project, and may only be used, modified,

View File

@ -3,7 +3,7 @@
#
# Copyright (C) 2005-2021 by
# Copyright (C) 2005-2022 by
# Werner Lemberg and Detlef Würkner.
#
# This file is part of the FreeType project, and may only be used, modified,

View File

@ -4,7 +4,7 @@
*
* Debugging and logging component for amiga (body).
*
* Copyright (C) 1996-2021 by
* Copyright (C) 1996-2022 by
* David Turner, Robert Wilhelm, Werner Lemberg, and Detlef Wuerkner.
*
* This file is part of the FreeType project, and may only be used,

View File

@ -4,7 +4,7 @@
/* */
/* Amiga-specific FreeType low-level system interface (body). */
/* */
/* Copyright (C) 1996-2021 by */
/* Copyright (C) 1996-2022 by */
/* David Turner, Robert Wilhelm, Werner Lemberg and Detlef Würkner. */
/* */
/* This file is part of the FreeType project, and may only be used, */

View File

@ -3,7 +3,7 @@
#
# Copyright (C) 1996-2021 by
# Copyright (C) 1996-2022 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,

View File

@ -3,7 +3,7 @@
#
# Copyright (C) 1996-2021 by
# Copyright (C) 1996-2022 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,

View File

@ -5,7 +5,7 @@
#
# Copyright (C) 1996-2021 by
# Copyright (C) 1996-2022 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,

View File

@ -2,7 +2,7 @@
# FreeType 2 configuration rules for a BeOS system
#
# Copyright (C) 1996-2021 by
# Copyright (C) 1996-2022 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,

View File

@ -3,7 +3,7 @@
#
# Copyright (C) 1996-2021 by
# Copyright (C) 1996-2022 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,

View File

@ -1,6 +1,6 @@
# FindBrotliDec.cmake
#
# Copyright (C) 2019-2021 by
# Copyright (C) 2019-2022 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# Written by Werner Lemberg <wl@gnu.org>

View File

@ -1,6 +1,6 @@
# iOS.cmake
#
# Copyright (C) 2014-2021 by
# Copyright (C) 2014-2022 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# Written by David Wimsey <david@wimsey.us>

View File

@ -1,6 +1,6 @@
#!/bin/sh -e
# Copyright (C) 2015-2021 by
# Copyright (C) 2015-2022 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,

View File

@ -3,7 +3,7 @@
#
# Copyright (C) 1996-2021 by
# Copyright (C) 1996-2022 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,

View File

@ -3,7 +3,7 @@
#
# Copyright (C) 1996-2021 by
# Copyright (C) 1996-2022 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,

View File

@ -3,7 +3,7 @@
#
# Copyright (C) 1996-2021 by
# Copyright (C) 1996-2022 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,

View File

@ -3,7 +3,7 @@
#
# Copyright (C) 2003-2021 by
# Copyright (C) 2003-2022 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,

View File

@ -3,7 +3,7 @@
#
# Copyright (C) 1996-2021 by
# Copyright (C) 1996-2022 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,

View File

@ -3,7 +3,7 @@
#
# Copyright (C) 1996-2021 by
# Copyright (C) 1996-2022 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,

View File

@ -3,7 +3,7 @@
#
# Copyright (C) 1996-2021 by
# Copyright (C) 1996-2022 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,

View File

@ -3,7 +3,7 @@
#
# Copyright (C) 1996-2021 by
# Copyright (C) 1996-2022 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,

View File

@ -3,7 +3,7 @@
#
# Copyright (C) 1996-2021 by
# Copyright (C) 1996-2022 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,

View File

@ -3,7 +3,7 @@
#
# Copyright (C) 1996-2021 by
# Copyright (C) 1996-2022 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,

View File

@ -3,7 +3,7 @@
#
# Copyright (C) 1996-2021 by
# Copyright (C) 1996-2022 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,

View File

@ -3,7 +3,7 @@
#
# Copyright (C) 1996-2021 by
# Copyright (C) 1996-2022 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,

View File

@ -3,7 +3,7 @@
#
# Copyright (C) 1996-2021 by
# Copyright (C) 1996-2022 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,

View File

@ -3,7 +3,7 @@
#
# Copyright (C) 1996-2021 by
# Copyright (C) 1996-2022 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,

View File

@ -3,7 +3,7 @@
#
# Copyright (C) 1996-2021 by
# Copyright (C) 1996-2022 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,

View File

@ -3,7 +3,7 @@
#
# Copyright (C) 2003-2021 by
# Copyright (C) 2003-2022 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,

View File

@ -3,7 +3,7 @@
#
# Copyright (C) 1996-2021 by
# Copyright (C) 1996-2022 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,

View File

@ -3,7 +3,7 @@
#
# Copyright (C) 2003-2021 by
# Copyright (C) 2003-2022 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,

View File

@ -3,7 +3,7 @@
#
# Copyright (C) 2005-2021 by
# Copyright (C) 2005-2022 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,

View File

@ -3,7 +3,7 @@
#
# Copyright (C) 1996-2021 by
# Copyright (C) 1996-2022 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,

View File

@ -3,7 +3,7 @@
#
# Copyright (C) 1996-2021 by
# Copyright (C) 1996-2022 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,

View File

@ -3,7 +3,7 @@
#
# Copyright (C) 1996-2021 by
# Copyright (C) 1996-2022 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,

View File

@ -9,7 +9,7 @@
<string>English</string>
<key>CFBundleExecutable</key>
<string>FreeType</string>
<string>freetype</string>
<key>CFBundleGetInfoString</key>
<string>FreeType ${PROJECT_VERSION}</string>

View File

@ -5,7 +5,7 @@
/* Mac FOND support. Written by just@letterror.com. */
/* Heavily Fixed by mpsuzuki, George Williams and Sean McBride */
/* */
/* Copyright (C) 1996-2021 by */
/* Copyright (C) 1996-2022 by */
/* Just van Rossum, David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@ -97,7 +97,7 @@
#define FT_DEPRECATED_ATTRIBUTE
#include FT_MAC_H
#include <freetype/ftmac.h>
/* undefine blocking-macros in ftmac.h */
#undef FT_GetFile_From_Mac_Name

View File

@ -1,6 +1,6 @@
#!/usr/bin/env python
#!/usr/bin/env python3
#
# Copyright (C) 2020-2021 by
# Copyright (C) 2020-2022 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,

View File

@ -1,6 +1,6 @@
#!/usr/bin/env python
#!/usr/bin/env python3
#
# Copyright (C) 2020-2021 by
# Copyright (C) 2020-2022 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,

View File

@ -1,6 +1,6 @@
#!/usr/bin/env python
#!/usr/bin/env python3
#
# Copyright (C) 2020-2021 by
# Copyright (C) 2020-2022 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,

View File

@ -1,6 +1,6 @@
#!/usr/bin/env python
#!/usr/bin/env python3
#
# Copyright (C) 2020-2021 by
# Copyright (C) 2020-2022 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,
@ -87,6 +87,7 @@ def generate_ftmodule(lists):
name = {
"raster": "ft_raster1",
"smooth": "ft_smooth",
"svg": "ft_svg",
}.get(module)
result += (
"FT_USE_MODULE( FT_Renderer_Class, %s_renderer_class )\n" % name

View File

@ -1,6 +1,6 @@
#!/usr/bin/env python
#!/usr/bin/env python3
#
# Copyright (C) 2020-2021 by
# Copyright (C) 2020-2022 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,

View File

@ -3,7 +3,7 @@
#
# Copyright (C) 1996-2021 by
# Copyright (C) 1996-2022 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,

View File

@ -3,7 +3,7 @@
#
# Copyright (C) 1996-2021 by
# Copyright (C) 1996-2022 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,

View File

@ -3,7 +3,7 @@
#
# Copyright (C) 1996-2021 by
# Copyright (C) 1996-2022 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,

View File

@ -5,7 +5,7 @@
#
# Copyright (C) 1996-2021 by
# Copyright (C) 1996-2022 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,

View File

@ -3,7 +3,7 @@
#
# Copyright (C) 1996-2021 by
# Copyright (C) 1996-2022 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,

View File

@ -2,7 +2,7 @@
// FreeType 2 project for the symbian platform
//
// Copyright (C) 2008-2021 by
// Copyright (C) 2008-2022 by
// David Turner, Robert Wilhelm, and Werner Lemberg.
//
// This file is part of the FreeType project, and may only be used, modified,

View File

@ -2,7 +2,7 @@
// FreeType 2 makefile for the symbian platform
//
// Copyright (C) 2008-2021 by
// Copyright (C) 2008-2022 by
// David Turner, Robert Wilhelm, and Werner Lemberg.
//
// This file is part of the FreeType project, and may only be used, modified,

View File

@ -3,7 +3,7 @@
#
# Copyright (C) 1996-2021 by
# Copyright (C) 1996-2022 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,
@ -304,13 +304,12 @@ do-dist: distclean refdoc
cp $(CONFIG_GUESS) builds/unix
cp $(CONFIG_SUB) builds/unix
@# Generate `ChangeLog' file with commits since previous release.
@# Generate `ChangeLog' file with commits since release 2.11.0
@# (when we stopped creating this file manually).
$(CHANGELOG_SCRIPT) \
--format='%B%n' \
--no-cluster \
-- `git describe --tags \
--abbrev=0 \
$(version_tag)^`..$(version_tag) \
-- VER-2-11-0..$(version_tag) \
> ChangeLog
@# Remove intermediate files created by the `refdoc' target.
@ -318,6 +317,6 @@ do-dist: distclean refdoc
rm -f docs/mkdocs.yml
@# Remove more stuff related to git.
rm -rf subprojects
rm -rf subprojects/dlg
# EOF

View File

@ -2,7 +2,7 @@
#
# Process this file with autoconf to produce a configure script.
#
# Copyright (C) 2001-2021 by
# Copyright (C) 2001-2022 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,
@ -17,7 +17,7 @@ AC_CONFIG_SRCDIR([ftconfig.h.in])
# Don't forget to update `docs/VERSIONS.TXT'!
version_info='24:1:18'
version_info='24:3:18'
AC_SUBST([version_info])
ft_version=`echo $version_info | tr : .`
AC_SUBST([ft_version])
@ -317,6 +317,12 @@ if test x"$with_zlib" = xyes -a "$have_zlib" = no; then
AC_MSG_ERROR([external zlib support requested but library not found])
fi
SYSTEM_ZLIB=
if test "$have_zlib" != no; then
SYSTEM_ZLIB=yes
fi
AC_SUBST([SYSTEM_ZLIB])
# check for system libbz2
@ -508,19 +514,48 @@ if test x"$with_brotli" = xyes -a "$have_brotli" = no; then
fi
# check for librt
# Checks for the demo programs.
#
# We need `clock_gettime' for the `ftbench' demo program.
#
# The code is modeled after gnulib's file `clock_time.m4', ignoring
# very old Solaris systems.
# FreeType doesn't need this. However, since the demo program repository
# doesn't come with a `configure` script of its own, we integrate the tests
# here for simplicity.
# We need `clock_gettime` from 'librt' for the `ftbench` demo program.
#
# The code is modeled after gnulib's file `clock_time.m4`, ignoring
# very old Solaris systems.
LIB_CLOCK_GETTIME=
AC_SEARCH_LIBS([clock_gettime],
[rt],
[test "$ac_cv_search_clock_gettime" = "none required" \
|| LIB_CLOCK_GETTIME=$ac_cv_search_clock_gettime])
AC_SUBST([LIB_CLOCK_GETTIME])
FT_DEMO_CFLAGS=""
FT_DEMO_LDFLAGS="$LIB_CLOCK_GETTIME"
# 'librsvg' is needed to demonstrate SVG support.
AC_ARG_WITH([librsvg],
[AS_HELP_STRING([--with-librsvg=@<:@yes|no|auto@:>@],
[support OpenType SVG fonts in FreeType demo programs @<:@default=auto@:>@])],
[], [with_librsvg=auto])
have_librsvg=no
if test x"$with_librsvg" = xyes -o x"$with_librsvg" = xauto; then
PKG_CHECK_MODULES([LIBRSVG], [librsvg-2.0 >= 2.46.0],
[have_librsvg="yes (pkg-config)"], [:])
if test "$have_librsvg" != no; then
FT_DEMO_CFLAGS="$FT_DEMO_CFLAGS $LIBRSVG_CFLAGS -DHAVE_LIBRSVG"
FT_DEMO_LDFLAGS="$FT_DEMO_LDFLAGS $LIBRSVG_LIBS"
fi
fi
if test x"$with_librsvg" = xyes -a "$have_librsvg" = no; then
AC_MSG_ERROR([librsvg support requested but library not found])
fi
AC_SUBST([FT_DEMO_CFLAGS])
AC_SUBST([FT_DEMO_LDFLAGS])
# Some options handling SDKs/archs in CFLAGS should be copied
@ -962,32 +997,32 @@ fi
# entries in Requires.private are separated by commas
REQUIRES_PRIVATE="$zlib_reqpriv, \
$bzip2_reqpriv, \
$libpng_reqpriv, \
$harfbuzz_reqpriv, \
$brotli_reqpriv"
PKGCONFIG_REQUIRES_PRIVATE="$zlib_reqpriv, \
$bzip2_reqpriv, \
$libpng_reqpriv, \
$harfbuzz_reqpriv, \
$brotli_reqpriv"
# beautify
REQUIRES_PRIVATE=`echo "$REQUIRES_PRIVATE" \
| sed -e 's/^ *//' \
-e 's/ *$//' \
-e 's/, */,/g' \
-e 's/,,*/,/g' \
-e 's/^,*//' \
-e 's/,*$//' \
-e 's/,/, /g'`
PKGCONFIG_REQUIRES_PRIVATE=`echo "$PKGCONFIG_REQUIRES_PRIVATE" \
| sed -e 's/^ *//' \
-e 's/ *$//' \
-e 's/, */,/g' \
-e 's/,,*/,/g' \
-e 's/^,*//' \
-e 's/,*$//' \
-e 's/,/, /g'`
LIBS_PRIVATE="$zlib_libspriv \
$bzip2_libspriv \
$libpng_libspriv \
$harfbuzz_libspriv \
$brotli_libspriv \
$ft2_extra_libs"
PKGCONFIG_LIBS_PRIVATE="$zlib_libspriv \
$bzip2_libspriv \
$libpng_libspriv \
$harfbuzz_libspriv \
$brotli_libspriv \
$ft2_extra_libs"
# beautify
LIBS_PRIVATE=`echo "$LIBS_PRIVATE" \
| sed -e 's/^ *//' \
-e 's/ *$//' \
-e 's/ */ /g'`
PKGCONFIG_LIBS_PRIVATE=`echo "$PKGCONFIG_LIBS_PRIVATE" \
| sed -e 's/^ *//' \
-e 's/ *$//' \
-e 's/ */ /g'`
LIBSSTATIC_CONFIG="-lfreetype \
$zlib_libsstaticconf \
@ -1005,10 +1040,28 @@ LIBSSTATIC_CONFIG=`echo "$LIBSSTATIC_CONFIG" \
-e 's/ *$//' \
-e 's/ */ /g'`
# If FreeType gets installed with `--disable-shared', don't use
# 'private' fields. `pkg-config' only looks into `.pc' files and is
# completely agnostic to whether shared libraries are actually present
# or not. As a consequence, the user had to specify `--static' while
# calling `pkg-config', which configure scripts are normally not
# prepared for.
PKGCONFIG_REQUIRES=
PKGCONFIG_LIBS='-L${libdir} -lfreetype'
if test $enable_shared = "no"; then
PKGCONFIG_REQUIRES="$PKGCONFIG_REQUIRES $PKGCONFIG_REQUIRES_PRIVATE"
PKGCONFIG_REQUIRES_PRIVATE=
PKGCONFIG_LIBS="$PKGCONFIG_LIBS $PKGCONFIG_LIBS_PRIVATE"
PKGCONFIG_LIBS_PRIVATE=
fi
AC_SUBST([ftmac_c])
AC_SUBST([REQUIRES_PRIVATE])
AC_SUBST([LIBS_PRIVATE])
AC_SUBST([PKGCONFIG_REQUIRES])
AC_SUBST([PKGCONFIG_LIBS])
AC_SUBST([PKGCONFIG_REQUIRES_PRIVATE])
AC_SUBST([PKGCONFIG_LIBS_PRIVATE])
AC_SUBST([LIBSSTATIC_CONFIG])
AC_SUBST([hardcode_libdir_flag_spec])

View File

@ -3,7 +3,7 @@
#
# Copyright (C) 1996-2021 by
# Copyright (C) 1996-2022 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,

View File

@ -1,6 +1,6 @@
#! /bin/sh
#
# Copyright (C) 2000-2021 by
# Copyright (C) 2000-2022 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,

View File

@ -7,8 +7,8 @@ Name: FreeType 2
URL: https://freetype.org
Description: A free, high-quality, and portable font engine.
Version: %ft_version%
Requires:
Requires.private: %REQUIRES_PRIVATE%
Libs: -L${libdir} -lfreetype
Libs.private: %LIBS_PRIVATE%
Requires: %PKGCONFIG_REQUIRES%
Requires.private: %PKGCONFIG_REQUIRES_PRIVATE%
Libs: %PKGCONFIG_LIBS%
Libs.private: %PKGCONFIG_LIBS_PRIVATE%
Cflags: -I${includedir}/freetype2

View File

@ -1,7 +1,7 @@
# Configure paths for FreeType2
# Marcelo Magallon 2001-10-26, based on `gtk.m4` by Owen Taylor
#
# Copyright (C) 2001-2021 by
# Copyright (C) 2001-2022 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,

View File

@ -1,6 +1,6 @@
## FreeType specific autoconf tests
#
# Copyright (C) 2002-2021 by
# Copyright (C) 2002-2022 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,

View File

@ -4,7 +4,7 @@
*
* UNIX-specific configuration file (specification only).
*
* Copyright (C) 1996-2021 by
* Copyright (C) 1996-2022 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,

View File

@ -4,7 +4,7 @@
*
* Unix-specific FreeType low-level system interface (body).
*
* Copyright (C) 1996-2021 by
* Copyright (C) 1996-2022 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,

View File

@ -3,7 +3,7 @@
#
# Copyright (C) 1996-2021 by
# Copyright (C) 1996-2022 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,

View File

@ -2,7 +2,7 @@
# FreeType 2 template for Unix-specific compiler definitions
#
# Copyright (C) 1996-2021 by
# Copyright (C) 1996-2022 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,
@ -106,9 +106,7 @@ endif
# Linker flags.
#
LDFLAGS := @LDFLAGS@
LIB_CLOCK_GETTIME := @LIB_CLOCK_GETTIME@ # for ftbench
LDFLAGS := @LDFLAGS@
# export symbols
#
@ -118,11 +116,15 @@ EXPORTS_LIST := $(OBJ_DIR)/ftexport.sym
CCexe := $(CCraw_build) # used to compile `apinames' only
# Library linking
# Library linking.
#
LINK_LIBRARY = $(LIBTOOL) --mode=link $(CCraw) -o $@ $(OBJECTS_LIST) \
-rpath $(libdir) -version-info $(version_info) \
$(LDFLAGS) -no-undefined \
-export-symbols $(EXPORTS_LIST)
# For the demo programs.
FT_DEMO_CFLAGS := @FT_DEMO_CFLAGS@
FT_DEMO_LDFLAGS := @FT_DEMO_LDFLAGS@
# EOF

View File

@ -3,7 +3,7 @@
#
# Copyright (C) 1996-2021 by
# Copyright (C) 1996-2022 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,
@ -68,12 +68,14 @@ version_info := @version_info@
# Variables needed for `freetype-config' and `freetype.pc'.
#
PKG_CONFIG := @PKG_CONFIG@
REQUIRES_PRIVATE := @REQUIRES_PRIVATE@
LIBS_PRIVATE := @LIBS_PRIVATE@
LIBSSTATIC_CONFIG := @LIBSSTATIC_CONFIG@
build_libtool_libs := @build_libtool_libs@
ft_version := @ft_version@
PKG_CONFIG := @PKG_CONFIG@
PKGCONFIG_REQUIRES := @PKGCONFIG_REQUIRES@
PKGCONFIG_REQUIRES_PRIVATE := @PKGCONFIG_REQUIRES_PRIVATE@
PKGCONFIG_LIBS := @PKGCONFIG_LIBS@
PKGCONFIG_LIBS_PRIVATE := @PKGCONFIG_LIBS_PRIVATE@
LIBSSTATIC_CONFIG := @LIBSSTATIC_CONFIG@
build_libtool_libs := @build_libtool_libs@
ft_version := @ft_version@
# The directory where all library files are placed.
#
@ -137,15 +139,17 @@ prefix_x := $(subst $(space),\\$(space),$(prefix))
$(OBJ_BUILD)/freetype2.pc: $(TOP_DIR)/builds/unix/freetype2.in
rm -f $@ $@.tmp
sed -e 's|%REQUIRES_PRIVATE%|$(REQUIRES_PRIVATE)|' \
-e 's|%LIBS_PRIVATE%|$(LIBS_PRIVATE)|' \
-e 's|%build_libtool_libs%|$(build_libtool_libs)|' \
-e 's|%exec_prefix%|$(exec_prefix_x)|' \
-e 's|%ft_version%|$(ft_version)|' \
-e 's|%includedir%|$(includedir_x)|' \
-e 's|%libdir%|$(libdir_x)|' \
-e 's|%prefix%|$(prefix_x)|' \
$< \
sed -e 's|%PKGCONFIG_REQUIRES%|$(PKGCONFIG_REQUIRES)|' \
-e 's|%PKGCONFIG_REQUIRES_PRIVATE%|$(PKGCONFIG_REQUIRES_PRIVATE)|' \
-e 's|%PKGCONFIG_LIBS%|$(PKGCONFIG_LIBS)|' \
-e 's|%PKGCONFIG_LIBS_PRIVATE%|$(PKGCONFIG_LIBS_PRIVATE)|' \
-e 's|%build_libtool_libs%|$(build_libtool_libs)|' \
-e 's|%exec_prefix%|$(exec_prefix_x)|' \
-e 's|%ft_version%|$(ft_version)|' \
-e 's|%includedir%|$(includedir_x)|' \
-e 's|%libdir%|$(libdir_x)|' \
-e 's|%prefix%|$(prefix_x)|' \
$< \
> $@.tmp
chmod a-w $@.tmp
mv $@.tmp $@

View File

@ -6,7 +6,7 @@
#
# Copyright (C) 1996-2021 by
# Copyright (C) 1996-2022 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,

View File

@ -6,7 +6,7 @@
#
# Copyright (C) 1996-2021 by
# Copyright (C) 1996-2022 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,

View File

@ -3,7 +3,7 @@
#
# Copyright (C) 1996-2021 by
# Copyright (C) 1996-2022 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,

View File

@ -4,7 +4,7 @@
#
# Copyright (C) 1996-2021 by
# Copyright (C) 1996-2022 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,

View File

@ -4,7 +4,7 @@
*
* VMS-specific configuration file (specification only).
*
* Copyright (C) 1996-2021 by
* Copyright (C) 1996-2022 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,

View File

@ -4,7 +4,7 @@
/* */
/* VMS-specific FreeType low-level system interface (body). */
/* */
/* Copyright (C) 1996-2021 by */
/* Copyright (C) 1996-2022 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */

View File

@ -4,7 +4,7 @@
*
* Debugging and logging component for WinCE (body).
*
* Copyright (C) 1996-2021 by
* Copyright (C) 1996-2022 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,

View File

@ -21,7 +21,7 @@ the following targets:
<li>PPC/SP WM6 (Windows Mobile 6)</li>
</ul>
It compiles the following libraries from the FreeType 2.11.1 sources:</p>
It compiles the following libraries from the FreeType 2.12.1 sources:</p>
<ul>
<pre>

View File

@ -21,7 +21,7 @@ the following targets:
<li>PPC/SP WM6 (Windows Mobile 6)</li>
</ul>
It compiles the following libraries from the FreeType 2.11.1 sources:</p>
It compiles the following libraries from the FreeType 2.12.1 sources:</p>
<ul>
<pre>

View File

@ -3,7 +3,7 @@
#
# Copyright (C) 1996-2021 by
# Copyright (C) 1996-2022 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,

View File

@ -4,7 +4,7 @@
*
* Debugging and logging component for Win32 (body).
*
* Copyright (C) 1996-2021 by
* Copyright (C) 1996-2022 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,

View File

@ -4,7 +4,7 @@
*
* Windows-specific FreeType low-level system interface (body).
*
* Copyright (C) 2021 by
* Copyright (C) 2021-2022 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@ -196,19 +196,77 @@
}
#ifdef _WIN32_WCE
/* non-desktop Universal Windows Platform */
#if defined( WINAPI_FAMILY ) && WINAPI_FAMILY != WINAPI_FAMILY_DESKTOP_APP
#define PACK_DWORD64( hi, lo ) ( ( (DWORD64)(hi) << 32 ) | (DWORD)(lo) )
#define CreateFileMapping( a, b, c, d, e, f ) \
CreateFileMappingFromApp( a, b, c, PACK_DWORD64( d, e ), f )
#define MapViewOfFile( a, b, c, d, e ) \
MapViewOfFileFromApp( a, b, PACK_DWORD64( c, d ), e )
FT_LOCAL_DEF( HANDLE )
CreateFileA( LPCSTR lpFileName,
DWORD dwDesiredAccess,
DWORD dwShareMode,
LPSECURITY_ATTRIBUTES lpSecurityAttributes,
DWORD dwCreationDisposition,
DWORD dwFlagsAndAttributes,
HANDLE hTemplateFile )
CreateFileA( LPCSTR lpFileName,
DWORD dwDesiredAccess,
DWORD dwShareMode,
LPSECURITY_ATTRIBUTES lpSecurityAttributes,
DWORD dwCreationDisposition,
DWORD dwFlagsAndAttributes,
HANDLE hTemplateFile )
{
int len;
LPWSTR lpFileNameW;
int len;
LPWSTR lpFileNameW;
CREATEFILE2_EXTENDED_PARAMETERS createExParams = {
sizeof ( CREATEFILE2_EXTENDED_PARAMETERS ),
dwFlagsAndAttributes & 0x0000FFFF,
dwFlagsAndAttributes & 0xFFF00000,
dwFlagsAndAttributes & 0x000F0000,
lpSecurityAttributes,
hTemplateFile };
/* allocate memory space for converted path name */
len = MultiByteToWideChar( CP_ACP, MB_ERR_INVALID_CHARS,
lpFileName, -1, NULL, 0 );
lpFileNameW = (LPWSTR)_alloca( len * sizeof ( WCHAR ) );
if ( !len || !lpFileNameW )
{
FT_ERROR(( "FT_Stream_Open: cannot convert file name to LPWSTR\n" ));
return INVALID_HANDLE_VALUE;
}
/* now it is safe to do the translation */
MultiByteToWideChar( CP_ACP, MB_ERR_INVALID_CHARS,
lpFileName, -1, lpFileNameW, len );
/* open the file */
return CreateFile2( lpFileNameW, dwDesiredAccess, dwShareMode,
dwCreationDisposition, &createExParams );
}
#endif
#if defined( _WIN32_WCE )
/* malloc.h provides implementation of alloca()/_alloca() */
#include <malloc.h>
FT_LOCAL_DEF( HANDLE )
CreateFileA( LPCSTR lpFileName,
DWORD dwDesiredAccess,
DWORD dwShareMode,
LPSECURITY_ATTRIBUTES lpSecurityAttributes,
DWORD dwCreationDisposition,
DWORD dwFlagsAndAttributes,
HANDLE hTemplateFile )
{
int len;
LPWSTR lpFileNameW;
/* allocate memory space for converted path name */
@ -235,12 +293,13 @@
#endif
#if defined( _WIN32_WCE ) || defined ( _WIN32_WINDOWS ) || \
!defined( _WIN32_WINNT ) || _WIN32_WINNT <= 0x0400
FT_LOCAL_DEF( BOOL )
GetFileSizeEx( HANDLE hFile,
PLARGE_INTEGER lpFileSize )
GetFileSizeEx( HANDLE hFile,
PLARGE_INTEGER lpFileSize )
{
lpFileSize->u.LowPart = GetFileSize( hFile,
(DWORD *)&lpFileSize->u.HighPart );

View File

@ -485,6 +485,7 @@
<ClCompile Include="..\..\..\src\sfnt\sfnt.c" />
<ClCompile Include="..\..\..\src\smooth\smooth.c" />
<ClCompile Include="..\..\..\src\sdf\sdf.c" />
<ClCompile Include="..\..\..\src\svg\svg.c" />
<ClCompile Include="..\..\..\src\truetype\truetype.c" />
<ClCompile Include="..\..\..\src\type1\type1.c" />
<ClCompile Include="..\..\..\src\type42\type42.c" />

View File

@ -68,6 +68,9 @@
<ClCompile Include="..\..\..\src\smooth\smooth.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\svg\svg.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\truetype\truetype.c">
<Filter>Source Files</Filter>
</ClCompile>
@ -143,4 +146,4 @@
<Filter>Source Files</Filter>
</ResourceCompile>
</ItemGroup>
</Project>
</Project>

View File

@ -12,7 +12,7 @@
<p>This directory contains solution and project files for
Visual&nbsp;C++&nbsp;2010 or newer, named <tt>freetype.sln</tt>,
and <tt>freetype.vcxproj</tt>. It compiles the following libraries
from the FreeType 2.11.1 sources:</p>
from the FreeType 2.12.1 sources:</p>
<ul>
<li>freetype.dll using 'Release' or 'Debug' configurations</li>

View File

@ -442,6 +442,10 @@
RelativePath="..\..\..\src\smooth\smooth.c"
>
</File>
<File
RelativePath="..\..\..\src\svg\svg.c"
>
</File>
<Filter
Name="FT_MODULES"
>

View File

@ -12,7 +12,7 @@
<p>This directory contains project files <tt>freetype.dsp</tt> for
Visual C++ 6.0, and <tt>freetype.vcproj</tt> for Visual C++ 2002
through 2008, which you might need to upgrade automatically.
It compiles the following libraries from the FreeType 2.11.1 sources:</p>
It compiles the following libraries from the FreeType 2.12.1 sources:</p>
<ul>
<li>freetype.dll using 'Release' or 'Debug' configurations</li>

View File

@ -21,7 +21,7 @@ the following targets:
<li>PPC/SP WM6 (Windows Mobile 6)</li>
</ul>
It compiles the following libraries from the FreeType 2.11.1 sources:</p>
It compiles the following libraries from the FreeType 2.12.1 sources:</p>
<ul>
<pre>

View File

@ -3,7 +3,7 @@
#
# Copyright (C) 1996-2021 by
# Copyright (C) 1996-2022 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,

View File

@ -3,7 +3,7 @@
#
# Copyright (C) 1996-2021 by
# Copyright (C) 1996-2022 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,

View File

@ -5,7 +5,7 @@
#
# Copyright (C) 1996-2021 by
# Copyright (C) 1996-2022 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,

View File

@ -3,7 +3,7 @@
#
# Copyright (C) 1996-2021 by
# Copyright (C) 1996-2022 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,

View File

@ -3,7 +3,7 @@
#
# Copyright (C) 1996-2021 by
# Copyright (C) 1996-2022 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,

View File

@ -3,7 +3,7 @@
#
# Copyright (C) 1996-2021 by
# Copyright (C) 1996-2022 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,

View File

@ -3,7 +3,7 @@
#
# Copyright (C) 1996-2021 by
# Copyright (C) 1996-2022 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,

View File

@ -3,7 +3,7 @@
#
# Copyright (C) 1996-2021 by
# Copyright (C) 1996-2022 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,

View File

@ -3,7 +3,7 @@
#
# Copyright (C) 1996-2021 by
# Copyright (C) 1996-2022 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,

View File

@ -3,7 +3,7 @@
#
# Copyright (C) 1996-2021 by
# Copyright (C) 1996-2022 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,

View File

@ -3,7 +3,7 @@
#
# Copyright (C) 1996-2021 by
# Copyright (C) 1996-2022 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,

Some files were not shown because too many files have changed in this diff Show More