Compare commits

...

290 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
Alexei Podtelezhnikov 012b00f3e6 [truetype] Reduce Infinality footprint again.
* src/truetype/ttgload.c (compute_glyph_metrics): Streamline and
prioritize the Infinality checks to use `hdmx`.
2021-12-07 10:19:06 -05:00
Cameron Cawley 1f95189875 [builds/windows] Guard some non-ancient API.
We can support Windows 98 and NT 4.0 in principle...

* builds/windows/ftdebug.c, builds/windows/ftsystem.c: Check for the
ancient SDK using _WIN32_WINDOWS, _WIN32_WCE, or _WIN32_WINNT.
2021-12-06 23:08:46 -05:00
Cameron Cawley 9a533aa27f * builds/windows/visualc/freetype.vcproj: Add missing file. 2021-12-06 21:46:47 -05:00
Werner Lemberg 3f83daeecb * Version 2.11.1 released.
==========================

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

* docs/VERSION.TXT: Add entry for version 2.11.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.11.0/2.11.1/, s/2110/2111/.

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

* builds/unix/configure.raw (version_info): Set to 24:1:18.
* CMakeLists.txt (VERSION_PATCH): Set to 1.

* builds/toplevel.mk (version_tag, CHANGELOG_SCRIPT): New variables.
(do-dist): Generate `ChangeLog` file with all commits since last release.
2021-12-02 13:33:12 +01:00
Alexei Podtelezhnikov 03380482ce [builds/windows] Improve debugging.
* builds/windows/ftdebug.c (FT_Message, FT_Panic): Buffer output
and call `OutputDebugStringA` only if `IsDebuggerPresent`.
[_WIN32_WCE] (OutputDebugStringA): Implement the missing API.
2021-11-29 20:45:07 -05:00
Seigo Nonaka 3b45f564e9 * src/base/ftobjs.c (FT_Request_Metrics): Fix build warning on Android.
Use casts since `FT_USHORT_MAX` is unsigned short in bionic (libc used in
Android).
2021-11-29 18:21:27 +01:00
Alexei Podtelezhnikov 64e26ad3a2 * builds/windows/vc2010/freetype.vcxproj (DlgCopy): Minor tweak. 2021-11-27 22:31:17 -05:00
Alexei Podtelezhnikov 36a905e174 * src/truetype/ttpload.c (tt_face_load_hdmx): Added comments. 2021-11-26 09:15:46 -05:00
Alexei Podtelezhnikov 32f13c11a4 [truetype] Quietly reject out-of-spec `hdmx` tables.
The `hdmx` table is optional and can be safely rejected without
an error if it does not follow specifications. The record size
must be equal to the number of glyphs + 2 + 32-bit padding.

* src/truetype/ttpload.c (tt_face_load_hdmx): Thoroughly check
the record size and improve tracing.
2021-11-25 22:38:40 -05:00
Alexei Podtelezhnikov cff026d415 [truetype] Partly revert 5b626281.
Fixes #1118.

* src/truetype/ttpload.c (tt_face_load_hdmx): Do not assume that
`record_size` is rounded even though the records are padded.
2021-11-23 16:05:12 -05:00
Alexei Podtelezhnikov 99086bf224 * builds/windows/vc2010/freetype.vcxproj (DlgCopy): Use transforms. 2021-11-23 16:02:02 -05:00
Werner Lemberg 3cabd142ce Update `CHANGES` files, other minor whitespace and documentation issues. 2021-11-22 19:58:21 +01:00
Werner Lemberg 81912a1385 formats.txt: Add info about WOFF and WOFF2. 2021-11-21 18:31:53 +01:00
Werner Lemberg 407f31ff87 meson.build: Initialize `common_ldflags`. 2021-11-21 11:01:59 +01:00
Lukas Oberhuber 896630bed6 * meson.build: Fix compatibility version on MacOS.
Fixes #1117.
2021-11-21 10:41:53 +01:00
Werner Lemberg a11650d7fa * src/truetype/ttinterp.c (Ins_MD): Avoid `FT_ABS`.
Reported as

  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=38562
2021-11-21 07:54:49 +01:00
Alexei Podtelezhnikov f8a4163a45 * include/freetype/fttypes.h (FT_MAKE_TAG): Remove the same casting. 2021-11-20 07:01:26 -05:00
Werner Lemberg 6da5f95fcf [gxvalid] Fix minor compilation warning.
* src/gxvalid/gxvmort5.c (gxv_mort_subtable_type5_subtable_setup): Declare
as static.
2021-11-20 09:29:09 +01:00
Werner Lemberg f5ce182420 [smooth] Fix stand-alone compilation.
* src/smooth/ftgrays.c (FT_Trace_Enable, FT_Trace_Disable)[STANDALONE_]:
Define.
2021-11-20 07:58:40 +01:00
Werner Lemberg 8c8f51c558 Avoid undefined left-shifts.
We really have to use double casts to avoid issues with C's and C++'s
signedness propagation rules in implicit casts.

Reported as

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

* include/freetype/config/public-macros.h (FT_STATIC_CAST,
FT_REINTERPRET_CAST): Modify macro to take two arguments.
Update all callers.
(FT_STATIC_BYTE_CAST): New macro.

* include/freetype/freetype.h (FT_ENC_TAG): Use `FT_STATIC_BYTE_CAST`.
* include/freetype/ftimage.h (FT_IMAGE_TAG): Ditto.
* include/freetype/fttypes.h (FT_MAKE_TAG): Ditto.
Use `FT_Tag` for casting.

* src/ftraster/ftmisc.h (FT_MAKE_TAG): Removed, no longer needed.
(FT_STATIC_BYTE_CAST): New macro.

* src/smooth/ftgrays.c (FT_STATIC_CAST): Replace with...
(FT_STATIC_BYTE_CAST): ... this.
2021-11-20 07:58:31 +01:00
Werner Lemberg 9079c5d91a Provide C++ versions for public macros with casts.
Many FreeType clients use C++.  However `g++ -Wold-style-cast` warns for
macros with C-style casts even for system header files; this also affects
directories included with `-isystem`.  While this could be seen as a problem
with g++, the problem is more a philosophical one: Over the time, C and C++
diverged more and more, and some features of C are no longer the 'right'
solution in C++.

* include/freetype/config/public-macros.h (FT_STATIC_CAST,
FT_REINTERPRET_CAST): New macros.

* include/freetype/freetype.h (FT_ENC_TAG, FT_LOAD_TARGET_,
FT_LOAD_TARGET_MODE): Use `FT_STATIC_CAST`.
Correctly handle negative 'signed char' input.
* include/freetype/ftimage.h (FT_IMAGE_TAG): Ditto.
* include/freetype/fttypes.h (FT_MAKE_TAG, FT_BOOL): Ditto.
* include/freetype/ftmodapi.h (FT_FACE_DRIVER_NAME): Use
`FT_REINTERPRET_CAST`.

* src/smooth/ftgrays.c (FT_STATIC_CAST)[STANDALONE_]: New macro.
[!STANDALONE]: Include `FT_CONFIG_CONFIG_H`.

Fixes #1116.
2021-11-18 19:28:07 +00:00
Werner Lemberg 238245cd66 Fix clang++ warnings.
* src/*: Initialize some variables to NULL.
2021-11-16 22:08:47 +01:00
Werner Lemberg e4f7673e46 [truetype] Updates for the forthcoming OpenType 1.9 standard (2/2).
* src/truetype/ttgxvar.c (ft_var_load_item_variation_store):
s/shortDeltaCount/wordDeltaCount/ (as done in the specification, too).
Recognize new format and reject it for now.
2021-11-16 20:13:58 +00:00
Werner Lemberg 93e6b3e8e9 [truetype] Updates for the forthcoming OpenType 1.9 standard (1/2).
This is in preparation for implementing `DeltaSetIndexMap` format 1, which
is used by `COLR` v1 tables, and which allows 32bit indices.

  https://docs.microsoft.com/en-us/typography/opentype/otspec190/delta/otvarcommonformats_delta.html

* src/truetype/ttgxvar.h (GX_DeltaSetIdxMapRec): Change type of `mapCount`
to `FT_ULong`.

* src/truetype/ttgxvar.c (ft_var_load_delta_set_index_mapping): Add argument
for passing the table size; update caller.
Implement new format.
2021-11-16 20:13:58 +00:00
Werner Lemberg d31bafcb9c Fix clang warnings.
* src/gxvalid/gxvcmmn.h (GXV_SET_ERR_IF_PARANOID): Use 'do' block.
* src/gxvalid/gxvmod.c (GXV_TABLE_LOAD, GXV_TABLE_VALIDATE): Ditto.

* src/smooth/ftgrays.c (gray_convert_glyph): Add cast.

* src/type1/t1gload.c (T1_Parse_Glyph_And_Get_Char_String): Remove cast.
* src/type1/t1load.c (read_binay_data): Use `FT_ULong` for `size` parameter.
(parse_subrs, parse_charstrings, parse_dict): Ditto; also add some casts.
2021-11-14 11:02:54 +01:00
Dominik Röttsches 9597fd7b40 [sfnt] Avoid undefined shifts in `COLR` v1 paint parsing
* src/sfnt/ttcolr.c (read_paint, tt_face_get_paint): Tighten shift
behavior by using multiplication, mostly using macros from ftcalc.h.

Fixes: https://bugs.chromium.org/p/chromium/issues/detail?id=1269168
2021-11-13 06:48:23 +00:00
Alexei Podtelezhnikov cf55313650 [builds/windows] Improve `DlgCopy` target.
Fixes #1113.

* builds/windows/vc2010/freetype.vcxproj: Run `DlgCopy` conditionally
and decouple it from `Build`.
2021-11-12 22:27:18 -05:00
Alexei Podtelezhnikov 42e617238a Explicitly define `FT_MSB` for Clang.
* include/freetype/internal/ftcalc.h [__clang__] (FT_MSB): Updated.
2021-11-11 23:06:36 -05:00
Alexei Podtelezhnikov c5cd2a3db4 * src/truetype/ttgxvar.c (ft_var_to_normalized): Edge optimization. 2021-11-10 08:46:26 -05:00
Alexei Podtelezhnikov 188c7d6670 Additional `FT_MSB` macro definitions.
Better macros for Windoes CE and ARM in general, based on !109
from metarutaiga.

* include/freetype/internal/ftcalc.h [_MSC_VER] (FT_MSB): Updated.
2021-11-09 22:47:26 -05:00
Alexei Podtelezhnikov 05089e8a07 [build/windows] Remove logging from default debug configurations.
DLG is rather costly for performance and should be used judiciously.
This removes it from the default configurations but gives an example
how to enable it using the `UserDefines` property.

* builds/windows/vc2010/freetype.vcxproj: Hide FT_DEBUG_LOGGING.
2021-11-08 22:33:12 -05:00
Werner Lemberg d899b200f6 * src/sfnt/sfobjs.c (sfnt_open_font): Fix typo. 2021-11-08 12:27:04 +01:00
Werner Lemberg b86f96bce6 * src/gxvalid.*, src/otvalid.*: Fix `-Wformat` warnings. 2021-11-08 11:44:02 +01:00
Werner Lemberg cce782281b [pshinter] Fix C++ compilation.
* src/pshinter/pshalgo.c (psh_compute_dir): Fix type of `result`.
(psh_hint_table_find_strong_points): Add cast.
2021-11-08 09:41:54 +01:00
Werner Lemberg 7ef266045f [sfnt] Reduce footprint if WOFF and WOFF2 support is not needed.
Based on a patch from metarutaiga (MR !106).  The gist of this commit is
that it doesn't make sense to support WOFF without compression (which would
be only possible in WOFF 1.0 anyway).

* src/sfnt/sfobjs.c (sfnt_open_font): Guard WOFF code with
`FT_CONFIG_OPTION_USE_ZLIB` block.
Guard WOFF2 code with `FT_CONFIG_OPTION_USE_BROTLI` block.

* src/sfnt/sfwoff.c, src/sfnt/sfwoff.h: Guard files with
`FT_CONFIG_OPTION_USE_ZLIB` blocks, not parts of the code.

* src/sfnt/sfwoff2.c, src/sfnt/sfwoff2.h, src/sfnt/woff2tags.c,
src/sfnt/woff2tags.h: Guard files with `FT_CONFIG_OPTION_USE_BROTLI` blocks,
not parts of the code.

Fixes #1111.
2021-11-08 08:56:37 +01:00
Werner Lemberg bb4e049abe [truetype] Make trickyness checks depend on TT_USE_BYTECODE_INTERPRETER.
Based on a patch from metarutaiga (MR !106).

* src/truetype/ttobjs.c (tt_skip_pdffont_random_tag,
tt_check_trickyness_family, tt_synth_sfnt_checksum, tt_get_sfnt_checksum,
tt_check_trickyness_sfnt_ids, tt_check_trickyness): Put functions into a
`TT_USE_BYTECODE_INTERPRETER` block.
(tt_face_init): Put trickyness checks into a `TT_USE_BYTECODE_INTERPRETER`
block.

Fixes #1111.
2021-11-08 08:22:13 +01:00
Alexei Podtelezhnikov 9ebdc9cb1b * src/sfnt/ttload.c (tt_face_load_gasp): Fix a type mismatch warning. 2021-11-07 23:21:40 -05:00
Alexei Podtelezhnikov 7f4b9bfbc9 [dlg] Define DLG_STATIC explicitly.
DLG_STATIC is intended to disable Windows DLL linking attributes.
It does not hurt to define it explicitly when we wrap DLG code.
This fixes tons of LNK4286 and C4273 warnings from MSVC if we
forget to define DLG_STATIC as a compiler option.

* builds/windows/vc2010/freetype.vcxproj: Remove DLG_STATIC option.
* src/dlg/dlgwrap.c [FT_DEBUG_LOGGING]: Define DLG_STATIC.
* include/freetype/internal/ftdebug.h [FT_DEBUG_LOGGING]: Ditto.
2021-11-07 10:20:16 -05:00
Alexei Podtelezhnikov c693377ed3 [dlg] Lighten up the inclusions.
The DLG wrapper needs to know if FT_DEBUG_LOGGING is defined in
`ftoption.h`. It does not need entire FreeType.

* src/dlg/dlgwrap.c: Include FT_CONFIG_OPTIONS_H directly.
2021-11-07 10:05:05 -05:00
Alexei Podtelezhnikov cb9e7b7aac [truetype] Avoid some memory zeroing in variations.
* src/truetype/ttgxvar.c (ft_var_readpackeddeltas, ft_var_load_avar,
ft_var_load_item_variation_store, ft_var_load_gvar): Use FT_QNEW_ARRAY
if memory immediately initialized or discarded otherwise.
2021-11-06 22:59:31 -04:00
Jany Belluz fc55291b1c [truetype] Fix handling of packed deltas in Variation Fonts.
* src/truetype/ttgxvar (ft_var_readpackeddeltas): Don't expect the number of
bytes used to encode the deltas to be higher than the number of encoded
values.  The specification allows a very compact encoding; for example, a
list of 200 zeros can be encoded with just a couple of bytes.

We now count the consumed bytes to make sure to not read more than expected.
2021-11-05 13:53:45 +01:00
Jany Belluz 9ed5332fe6 [truetype] Fix CVAR handling of tuples for all points.
* src/truetype/ttgxvar (tt_face_vary_cvt): Function
`ft_var_readpackedpoints`, when it returns `ALL_POINTS`, also sets
`point_count` to value 0.  However, the CVAR code was incorrectly expecting
that `point_count` would be set to match the length of the CVT table.
2021-11-04 12:09:01 +01:00
Jany Belluz 23d1d8ada8 * src/truetype/ttgxvar.c: Fix typos in macros that guard CVAR code. 2021-11-04 12:07:47 +01:00
Alexei Podtelezhnikov 5d651faa70 * docs/INSTALL: Mention Meson and MSBuild more prominently. 2021-11-03 22:43:22 -04:00
Gabor Kertesz e6e6cbf164 [libpng] Update Meson wrap for win-arm64
1.6.37-5 released patches for win-arm64 to successfully build
libpng with Meson:
https://github.com/mesonbuild/wrapdb/pull/205
https://github.com/mesonbuild/wrapdb/pull/216

Updated by the following command:
meson wrap update libpng

Tested on win-arm64 and x64.
2021-11-03 10:25:12 +01:00
Dominik Röttsches d3d3ff76d1 [sfnt] Clarify `COLR` v1 FT_Paint* format representations
* include/freetype/ftcolor.h (FT_PaintLinearGradient,
FT_PaintRadialGradient, FT_PaintSweepGradient, FT_PaintTransform,
FT_PaintTranslate, FT_PaintScale, FT_PaintRotate, FT_PaintSkew): Clarify
16.16 fixed point representation of struct fields.
* src/sfnt/ttcolr.c (read_paint): Shift coordinates for
FT_PaintLinearGradient, FT_PaintRadialGradient, FT_PaintSweepGradient
accordingly.

Fixes: https://gitlab.freedesktop.org/freetype/freetype/-/issues/1110
2021-11-03 08:28:10 +00:00
Alexei Podtelezhnikov 588a058d9b [builds/windows] Let MSBuild handle DLG copy.
* builds/windows/vc2010/freetype.vcxproj: Specify DlgCopy target.
* builds/windows/vc2010/script.bat: Deleted.
2021-11-02 22:51:51 -04:00
Alexei Podtelezhnikov 94cb3a2eb9 * src/truetype/ttgload.c (load_truetype_glyph): Fix MSVC warning C4312. 2021-10-29 10:31:59 -04:00
Alexei Podtelezhnikov 31fd054701 [builds/windows] Separate MSVC linker and librarian.
MSVC uses LIB for static and LINK for dynamic libraries. They are
related but the former has much smaller set of options.

* builds/windows/vc2010/freetype.vcxproj: Updated.
2021-10-29 10:13:47 -04:00
Alexei Podtelezhnikov 79b28d3781 [builds/windows] Revise MSVC linking optimizations.
* builds/windows/vc2010/freetype.vcxproj: Optimize DLL linking only.
* builds/windows/visualc/freetype.dsp: Ditto.
* builds/windows/visualc/freetype.vcproj: Ditto.
2021-10-28 22:51:15 -04:00
Alexei Podtelezhnikov 793c012635 [woff] Optimize table tagging.
* include/freetype/internal/wofftypes.h (WOFF_TableRec): Use
32-bit tag.
* src/sfnt/sfwoff.c (woff_open_font): Use 32-bit tag.
2021-10-27 22:36:11 -04:00
Alexei Podtelezhnikov a577bbcb5b [woff2] Optimize table tagging.
Fixes #1107.

* include/freetype/internal/wofftypes.h (WOFF2_TableRec): Use
32-bit tag.
* src/sfnt/sfwoff2.c (compare_tags, find_table, woff2_open_font):
Use 32-bit tag.
* src/sfnt/woff2tags.[ch] (woff2_known_tags): Use static storage and
return 32-bit tag.
2021-10-27 22:24:27 -04:00
Werner Lemberg 80b13f5732 Formatting. 2021-10-26 10:57:17 +02:00
Ben Wagner 535c67dda7 [mm] Tolerate missing Blend dictionary entries
In a Multiple Master font, the Blend dictionary must contain valid
Private, FontInfo, and FontBBox. The current code will error if any of
these are present and invalid, but will not error and will provide
uninitialized data if the Blend dictionary exists but does not contain
one of these entries. This change reverts to the older behavior of
treating any missing entries as containing all zero data and not
returning an error.

In the future it may be best to keep track of when these are actually
initialized and error if they are not.

* src/type1/t1load.c (t1_allocate_blend): Zero initiailize.
2021-10-25 22:38:05 -04:00
Alexei Podtelezhnikov f091e60c48 [builds/windows] Add MSVC linker optimazations.
We continue to build static libraries with statically linked C run-
time and add options to optimize references.

* builds/windows/vc2010/freetype.vcxproj: Sort entries, add options.
2021-10-25 22:31:09 -04:00
Alexei Podtelezhnikov 92f5e15f4f * builds/windows/vc2010/freetype.vcxproj: Use MachineARM64. 2021-10-23 09:43:46 -04:00
Alexei Podtelezhnikov 5e6efd6a4c [builds/windows] Prioritize x64.
* builds/windows/vc2010/freetype.sln: Sort entries.
2021-10-22 15:25:10 -04:00
Gabor Kertesz 80bd4cba7e [builds/windows] Add ARM64 platform.
* builds/windows/vc2010/freetype.sln: Updated
* builds/windows/vc2010/freetype.vcxproj: Updated.
* builds/windows/vc2010/freetype.vcxproj.filters: Minor fix.
2021-10-22 10:56:42 -04:00
Ben Wagner 65be4b2112 [mm] Delay setting blend weight and design position.
Previously the `blend->weight_vector`, `blend->default_weight_vector`,
and `blend->design_pos` were set early to allocated but uninitialized
memory under the assumption that the memory would eventually be
initialized. However, it is possible that some of the required
keywords may not actually be present, leaving the memory uninitialized.
This is different from a present but invalid table, which would produce
an error.

Reported as
  https://bugs.chromium.org/p/chromium/issues/detail?id=1261762

* src/type1/t1load.c (t1_allocate_blend): Remove early allocation and
initialization.
(parse_blend_design_positions, parse_weight_vector): Parse into local
and assign to blend if valid.
(T1_Open_Face): Check that if a blend exists that it has the weight
vector and design positions.
2021-10-21 09:55:28 -04:00
Ben Wagner b5e003f1f2 [cff] Commit vstore data and regions on allocation.
The vstore->regionCount and vstore->dataCount were read directly
from the data. However, vstore->varRegionList and vstore->varData
would still contain uninitialized entries with uninitialized
pointers in the event of an error, leading to issues when attempting
to clean up.

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

* src/cff/cffload.c (cff_vstore_load): Read the region and data counts
into locals and update the vstore counts immediately after each entry
becomes free-able.
2021-10-21 09:48:38 -04:00
Ben Wagner fde91ab8f1 [sfnt] Delay setting gasp ranges and count until computed.
Previously, the gasp.numRanges was set and gasp.gaspRanges was
allocated and assigned before a possible early exit if the frame could
not be entered. It is also possible that the gaspRanges allocation
could fail but the numRanges still be set to non-zero. In such cases
an error would be returned, but the face would have a gasp in an
inconsistent state which may still be accessed.

Reported as
  https://bugs.chromium.org/p/chromium/issues/detail?id=1261450

* src/sfnt/ttload.c (tt_face_load_gasp): Delay setting gasp.numRanges
and gasp.gaspRanges until after the ranges are initialized.
2021-10-20 11:45:15 -04:00
Ben Wagner 6d12e3a0ca [sfnt] Delay setting names and langTags until computed.
Previously, the table->names and table->langTags fields were created
pointing to uninitialized memory and an early exit could happen if the
frame could not be entered. The caller would then be unable to properly
dispose of the memory as the string fields had not been initialized.

Reported as
  https://bugs.chromium.org/p/chromium/issues/detail?id=1261343

* src/sfnt/ttload.c (tt_face_load_name): delay setting table->langTags
and table->names until after the memory they will point to is fully
initialized.
2021-10-20 11:38:16 -04:00
Alexei Podtelezhnikov e990c33f21 * tests/issue-1063/main.c: s/PATH_MAX/FILENAME_MAX/.
Closes !97 for Windows by using a standard macro.
2021-10-20 11:27:03 -04:00
Werner Lemberg 8ef8072ba1 [bdf, cid, pfr, winfonts] Improve rejection of other font formats.
This is mainly for better diagnostics of malformed fonts.

* src/bdf/bdflib.c (_bfd_readstream): Stop font format testing if the first
input line is too long or doesn't end with `\r` or `\n`.

* src/cid/cidparse.c (cid_parser_new): Don't handle too short input as an
error but as an unknown format.

* src/pfr/pfrobjs.c (pfr_face_init): Ditto.

* src/winfonts/winfnt.c (fnt_font_load, fnt_face_get_dll_font): Ditto.
2021-10-19 22:59:46 +02:00
Alexei Podtelezhnikov 38b349c41b [pcf] Zero out the allocated properties.
Fallout reported as
  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=40033

* src/pcf/pcfread.c (pcf_get_properties): Use FT_NEW_ARRAY and zero
out `properties` in case of failure.
2021-10-18 20:35:28 -04:00
Werner Lemberg de9faa53ed configure: Use string comparison for directory inodes.
Inode values might be larger than integers supported by the shell.

Fixes #1105.
2021-10-18 21:05:04 +02:00
Alexei Podtelezhnikov 986d503f4a * src/sfnt/ttload.c (tt_face_load_name): NULL-initialize langTag.
Another attempt to fix fallout reported as
  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=40024
2021-10-17 09:14:27 -04:00
Alexei Podtelezhnikov 30ca63d4fb [bdf] Fix up user properties.
Fallout reported as
  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=40027

* src/bdf/bdflib.c (_bdf_add_property): Cosmetic NULL.
(bdf_create_property): Limit allocations to customary signed
FT_Long and NULL-initialize unused storage.
(bdf_free_font): Do not free unused storage.
2021-10-16 23:02:47 -04:00
Alexei Podtelezhnikov afd1cb2881 * src/sfnt/ttload.c (tt_face_load_name): Accounting fix.
Fallout reported as
  https://crbug.com/40024
2021-10-16 20:25:11 -04:00
Ben Wagner c71eb22dde Fix typos in memory macros.
FT_QNEW_ARRAY and FT_QRENEW_ARRAY were using the non-Q
FT_MEM_NEW_ARRAY and FT_MEM_RENEW_ARRAY. Change these to use the Q
versions. Also fix the one issue discovered in tt_face_load_name
where table->names is created with FT_QNEW_ARRAY but the extra
string member is not initialized to NULL.

* include/freetype/internal/ftmemory.h (FT_Q(RE)NEW_ARRAY):
Use FT_MEM_Q(RE)NEW_ARRAY as needed.

* src/sfnt/ttload.c (tt_face_load_name): Initialize `entry->string`.
2021-10-15 22:18:38 -04:00
Ben Wagner 8406ae5324 [truetype] Reload context after re-executing `prep`.
When a different hinting mode from the current is selected, the `prep` table
must be re-executed with the new mode.  After this happens the context must
be re-loaded in preparation for the glyph program to be run.

Fixes #1104.

* truetype/ttgload.c (tt_loader_init): Add call to `TT_Load_Context`.
2021-10-15 22:37:31 +02:00
Werner Lemberg 0b92c56c34 [truetype] Minor documentation improvements. 2021-10-15 19:02:41 +02:00
Anurag Thakur 943a6bf7e6 Add clang build to linux CI 2021-10-14 02:00:10 +00:00
Anurag Thakur ede96b239b CI: Add macOS CI, including a clang build 2021-10-12 21:06:41 +05:30
Alexei Podtelezhnikov e294a95ca8 * src/cid/cidload.c (parse_fd_array): Protect against trancation. 2021-10-11 23:25:29 -04:00
Alexei Podtelezhnikov 1029eb9377 [type1] Revert to signed size for binary data.
Recently introduced and reported as
  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=39838

* src/type1/t1load.c (read_binary_data): Reject negative size.
(parse_subrs, parse_charstrings): Use customary signed size.
2021-10-11 22:25:14 -04:00
Alexei Podtelezhnikov 77bd46e959 [psaux] Signedness revisions.
Unsigned indexes are easier to check.

* src/psaux/cffdecode.c (cff_decoder_parse_charstrings): Updated.
* src/psaux/psintrp.c (cf2_interpT2CharString): Ditto.
* src/psaux/t1decode.c (t1_decoder_parse_charstrings): Ditto.
* src/type1/t1load.c (read_binary_data): Ditto.
2021-10-10 23:12:12 -04:00
Alexei Podtelezhnikov 3b036820d6 [cid] Signedness revisions.
Unsigned checks are simpler.

* include/freetype/t1tables.h (CID_FaceInfoRec): Change to unsignd
`num_dicts`.
* src/cid/cidparse.h (CID_Parser): Change to unsigned `num_dict`.

* src/cid/cidgload.c (cid_load_glyph): Updated.
* src/cid/cidload.c (cid_load_keyword, parse_fd_array,
parse_expansion_factor, parse_font_name, cid_read_subrs,
cid_face_open): Updated.
* src/cid/cidobjs.c (cid_face_done): Updated.
* src/cid/cidparse.c (cid_parser_new): Updated.
2021-10-10 23:11:10 -04:00
Alexei Podtelezhnikov 012b4f2d48 * src/cid/cidload.c (cid_face_open): Streamline CIDCount check. 2021-10-08 22:14:12 -04:00
Alexei Podtelezhnikov 946df22165 * src/cid/cidload.c (cid_face_open): Streamline SubrCount check. 2021-10-07 22:44:53 -04:00
Alexei Podtelezhnikov 0313a11c4c * src/cid/cidgload.c (cid_load_glyph): Fortify incremental loading. 2021-10-07 22:43:12 -04:00
Alexei Podtelezhnikov 22befeef82 Signedness revisions.
This eliminates explicit casting by switching to unsigned fields.
The revisions mostly impact the handling of CID fonts.

* include/freetype/fttypes.h (FT_Data): Change to unsigned `length`.
* include/freetype/t1tables.h (CID_FaceDictRec): Ditto for `sd_bytes`.
(CID_FaceInfoRec): Ditto for `gd_bytes` and `gd_bytes`.
* include/freetype/internal/tttypes.h (TT_LoaderRec): Ditto for
`byte_len`.

* src/cid/cidgload.c (cid_load_glyph): Updated.
* src/cid/cidload.h (cid_get_offset): Update argument.
* src/cid/cidload.c (cid_get_offset, cid_read_subrs, cid_face_open):
Updated.
* src/cff/cffgload.c (cff_get_glyph_data, cff_free_glyph_data):
Updated.
* src/psaux/psft.c (cf2_getT1SeacComponent): Updated.
* src/truetype/ttgload.c (TT_Process_Composite_Glyph,
load_truetype_glyph): Updated.
2021-10-07 22:41:56 -04:00
Jan Alexander Steffens (heftig) 842ec5ed62 meson.build (gen_docs): Use `current_source_dir` instead of `source_root`.
These two are not equal when FreeType is used as a subproject, such as in
`freetype-demos`.  In that case, `source_root` points at the root project,
causing the docs build to fail.
2021-10-07 12:29:23 +02:00
639 changed files with 23848 additions and 5334 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'
@ -23,56 +25,86 @@ variables:
image: 'registry.freedesktop.org/freetype/docker-images/debian:latest'
stage: 'build'
.build macos common:
stage: 'build'
tags:
- 'gst-macos-11.1'
.build windows meson:
extends: '.build windows common'
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: |
@ -81,7 +113,8 @@ linux autotools:
--with-bzip2=no \
--with-harfbuzz=no \
--with-png=no \
--with-zlib=no
--with-zlib=no \
CC=gcc
make -j$(nproc) && make install
@ -93,14 +126,29 @@ linux autotools libs:
--with-bzip2=yes \
--with-harfbuzz=yes \
--with-png=yes \
--with-zlib=yes
--with-zlib=yes \
CC=gcc
make -j$(nproc) && make install
linux autotools libs clang:
extends: '.build linux common'
script: |
./autogen.sh
./configure --with-brotli=yes \
--with-bzip2=yes \
--with-harfbuzz=yes \
--with-png=yes \
--with-zlib=yes \
CC=clang
make -j$(nproc) && make install
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 \
@ -112,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 \
@ -142,3 +191,40 @@ linux cmake libs:
-D FT_REQUIRE_ZLIB=TRUE
cmake --build build --target install
# MacOS jobs.
macos autotools:
extends: '.build macos common'
before_script:
- '/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"'
script:
- brew install autoconf automake libtool
- ./autogen.sh
- ./configure
- 'make -j$(sysctl -n hw.logicalcpu)'
- make install
macos autotools clang:
extends: '.build macos common'
before_script:
- '/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"'
script:
- brew install autoconf automake libtool
- ./autogen.sh
- './configure CC=clang'
- 'make -j$(sysctl -n hw.logicalcpu)'
- make install
macos meson:
extends: '.build macos common'
script:
- pip3 install --upgrade pip
- pip3 install -U meson
- pip3 install --upgrade certifi
- pip3 install -U ninja
- 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,8 +161,8 @@ endif ()
project(freetype C)
set(VERSION_MAJOR "2")
set(VERSION_MINOR "11")
set(VERSION_PATCH "0")
set(VERSION_MINOR "12")
set(VERSION_PATCH "1")
# Generate LIBRARY_VERSION and LIBRARY_SOVERSION.
set(LIBTOOL_REGEX "version_info='([0-9]+):([0-9]+):([0-9]+)'")
@ -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.0
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.0.tar.xz
freetype-doc-2.11.0.tar.gz
ftdoc2110.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,
@ -226,6 +226,7 @@ patch := $(firstword $(patch))
# else
version := $(major).$(minor).$(patch)
winversion := $(major)$(minor)$(patch)
version_tag := VER-$(major)-$(minor)-$(patch)
# endif
@ -282,6 +283,10 @@ dist:
CONFIG_GUESS = ~/git/config/config.guess
CONFIG_SUB = ~/git/config/config.sub
# We also use this repository to access the gnulib script that converts git
# commit messages to a ChangeLog file.
CHANGELOG_SCRIPT = ~/git/config/gitlog-to-changelog
# Don't say `make do-dist'. Always use `make dist' instead.
#
@ -299,11 +304,19 @@ do-dist: distclean refdoc
cp $(CONFIG_GUESS) builds/unix
cp $(CONFIG_SUB) builds/unix
@# Generate `ChangeLog' file with commits since release 2.11.0
@# (when we stopped creating this file manually).
$(CHANGELOG_SCRIPT) \
--format='%B%n' \
--no-cluster \
-- VER-2-11-0..$(version_tag) \
> ChangeLog
@# Remove intermediate files created by the `refdoc' target.
rm -rf docs/markdown
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:0: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.0 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.0 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,
@ -93,28 +93,60 @@
#ifdef FT_DEBUG_LEVEL_ERROR
#include <stdarg.h>
#include <stdlib.h>
#include <string.h>
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#ifdef _WIN32_WCE
FT_LOACAL_DEF( void )
OutputDebugStringA( LPCSTR lpOutputString )
{
int len;
LPWSTR lpOutputStringW;
/* allocate memory space for converted string */
len = MultiByteToWideChar( CP_ACP, MB_ERR_INVALID_CHARS,
lpOutputString, -1, NULL, 0 );
lpOutputStringW = (LPWSTR)_alloca( len * sizeof ( WCHAR ) );
if ( !len || !lpOutputStringW )
return;
/* now it is safe to do the translation */
MultiByteToWideChar( CP_ACP, MB_ERR_INVALID_CHARS,
lpOutputString, -1, lpOutputStringW, len );
OutputDebugStringW( lpOutputStringW );
}
#endif /* _WIN32_WCE */
/* documentation is in ftdebug.h */
FT_BASE_DEF( void )
FT_Message( const char* fmt,
... )
{
static char buf[8192];
va_list ap;
va_list ap;
va_start( ap, fmt );
vfprintf( stderr, fmt, ap );
/* send the string to the debugger as well */
vsprintf( buf, fmt, ap );
OutputDebugStringA( buf );
#if ( defined( _WIN32_WINNT ) && _WIN32_WINNT >= 0x0400 ) || \
( defined( _WIN32_WCE ) && _WIN32_WCE >= 0x0600 )
if ( IsDebuggerPresent() )
{
static char buf[1024];
vsnprintf( buf, sizeof buf, fmt, ap );
OutputDebugStringA( buf );
}
#endif
va_end( ap );
}
@ -125,13 +157,22 @@
FT_Panic( const char* fmt,
... )
{
static char buf[8192];
va_list ap;
va_list ap;
va_start( ap, fmt );
vsprintf( buf, fmt, ap );
OutputDebugStringA( buf );
vfprintf( stderr, fmt, ap );
#if ( defined( _WIN32_WINNT ) && _WIN32_WINNT >= 0x0400 ) || \
( defined( _WIN32_WCE ) && _WIN32_WCE >= 0x0600 )
if ( IsDebuggerPresent() )
{
static char buf[1024];
vsnprintf( buf, sizeof buf, fmt, ap );
OutputDebugStringA( buf );
}
#endif
va_end( ap );
exit( EXIT_FAILURE );

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 */
@ -233,10 +291,15 @@
dwFlagsAndAttributes, hTemplateFile );
}
#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 );
@ -248,7 +311,7 @@
return TRUE;
}
#endif /* _WIN32_WCE */
#endif
/* documentation is in ftobjs.h */

View File

@ -4,34 +4,49 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "freetype", "freetype.vcxpro
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Debug|x64 = Debug|x64
Debug Static|Win32 = Debug Static|Win32
Debug|ARM64 = Debug|ARM64
Debug|Win32 = Debug|Win32
Debug Static|x64 = Debug Static|x64
Release|Win32 = Release|Win32
Debug Static|ARM64 = Debug Static|ARM64
Debug Static|Win32 = Debug Static|Win32
Release|x64 = Release|x64
Release Static|Win32 = Release Static|Win32
Release|ARM64 = Release|ARM64
Release|Win32 = Release|Win32
Release Static|x64 = Release Static|x64
Release Static|ARM64 = Release Static|ARM64
Release Static|Win32 = Release Static|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Debug|Win32.ActiveCfg = Debug|Win32
{78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Debug|Win32.Build.0 = Debug|Win32
{78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Debug|x64.ActiveCfg = Debug|x64
{78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Debug|x64.Build.0 = Debug|x64
{78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Debug Static|Win32.ActiveCfg = Debug Static|Win32
{78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Debug Static|Win32.Build.0 = Debug Static|Win32
{78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Debug|ARM64.ActiveCfg = Debug|ARM64
{78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Debug|ARM64.Build.0 = Debug|ARM64
{78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Debug|Win32.ActiveCfg = Debug|Win32
{78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Debug|Win32.Build.0 = Debug|Win32
{78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Debug Static|x64.ActiveCfg = Debug Static|x64
{78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Debug Static|x64.Build.0 = Debug Static|x64
{78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Release|Win32.ActiveCfg = Release|Win32
{78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Release|Win32.Build.0 = Release|Win32
{78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Debug Static|ARM64.ActiveCfg = Debug Static|ARM64
{78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Debug Static|ARM64.Build.0 = Debug Static|ARM64
{78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Debug Static|Win32.ActiveCfg = Debug Static|Win32
{78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Debug Static|Win32.Build.0 = Debug Static|Win32
{78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Release|x64.ActiveCfg = Release|x64
{78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Release|x64.Build.0 = Release|x64
{78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Release Static|Win32.ActiveCfg = Release Static|Win32
{78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Release Static|Win32.Build.0 = Release Static|Win32
{78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Release|ARM64.ActiveCfg = Release|ARM64
{78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Release|ARM64.Build.0 = Release|ARM64
{78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Release|Win32.ActiveCfg = Release|Win32
{78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Release|Win32.Build.0 = Release|Win32
{78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Release Static|x64.ActiveCfg = Release Static|x64
{78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Release Static|x64.Build.0 = Release Static|x64
{78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Release Static|ARM64.ActiveCfg = Release Static|ARM64
{78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Release Static|ARM64.Build.0 = Release Static|ARM64
{78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Release Static|Win32.ActiveCfg = Release Static|Win32
{78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Release Static|Win32.Build.0 = Release Static|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {90811697-0889-4381-80BC-C3FE8FA4931F}
EndGlobalSection
EndGlobal

View File

@ -1,10 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!--
You can use this file to build FreeType with MSBuild as follows
MSBuild.exe -t:Rebuild
-p:Configuration=Debug
-p:Platform=x64
-p:UserDefines=FT_DEBUG_LOGGING
builds/windows/vc2010/freetype.vcxproj
or with different appropriate switches. It also works with Visual Studio.
Additional customization can be made in `freetype.user.props`.
-->
<Project DefaultTargets="DlgCopy;Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|ARM64">
<Configuration>Debug</Configuration>
<Platform>ARM64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
@ -13,6 +29,10 @@
<Configuration>Debug Static</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug Static|ARM64">
<Configuration>Debug Static</Configuration>
<Platform>ARM64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug Static|x64">
<Configuration>Debug Static</Configuration>
<Platform>x64</Platform>
@ -21,6 +41,10 @@
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|ARM64">
<Configuration>Release</Configuration>
<Platform>ARM64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
@ -29,6 +53,10 @@
<Configuration>Release Static</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release Static|ARM64">
<Configuration>Release Static</Configuration>
<Platform>ARM64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release Static|x64">
<Configuration>Release Static</Configuration>
<Platform>x64</Platform>
@ -46,6 +74,10 @@
<ConfigurationType>DynamicLibrary</ConfigurationType>
<CharacterSet>NotSet</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<CharacterSet>NotSet</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<CharacterSet>NotSet</CharacterSet>
@ -54,6 +86,10 @@
<ConfigurationType>StaticLibrary</ConfigurationType>
<CharacterSet>NotSet</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug Static|ARM64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<CharacterSet>NotSet</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug Static|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<CharacterSet>NotSet</CharacterSet>
@ -62,6 +98,10 @@
<ConfigurationType>DynamicLibrary</ConfigurationType>
<CharacterSet>NotSet</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<CharacterSet>NotSet</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<CharacterSet>NotSet</CharacterSet>
@ -70,6 +110,10 @@
<ConfigurationType>StaticLibrary</ConfigurationType>
<CharacterSet>NotSet</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release Static|ARM64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<CharacterSet>NotSet</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release Static|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<CharacterSet>NotSet</CharacterSet>
@ -90,7 +134,7 @@
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>$(UserOptionDirectory);..\..\..\include;$(UserIncludeDirectories);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;FT_DEBUG_LEVEL_ERROR;FT_DEBUG_LEVEL_TRACE;FT_DEBUG_LOGGING;FT2_BUILD_LIBRARY;DLL_EXPORT;$(UserDefines);%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;FT_DEBUG_LEVEL_ERROR;FT_DEBUG_LEVEL_TRACE;FT2_BUILD_LIBRARY;DLL_EXPORT;$(UserDefines);%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<DisableLanguageExtensions>false</DisableLanguageExtensions>
@ -106,20 +150,45 @@
<PreprocessorDefinitions>_DEBUG;DLL_EXPORT;$(UserDefines);%(PreprocessorDefinitions)</PreprocessorDefinitions>
<Culture>0x0409</Culture>
</ResourceCompile>
<Lib>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<TargetMachine>MachineX86</TargetMachine>
<AdditionalLibraryDirectories>$(UserLibraryDirectories);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>$(UserDependencies);%(AdditionalDependencies)</AdditionalDependencies>
</Lib>
<PreBuildEvent>
<Command>call $(SolutionDir)script.bat</Command>
</PreBuildEvent>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>$(UserOptionDirectory);..\..\..\include;$(UserIncludeDirectories);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;FT_DEBUG_LEVEL_ERROR;FT_DEBUG_LEVEL_TRACE;FT2_BUILD_LIBRARY;DLL_EXPORT;$(UserDefines);%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<DisableLanguageExtensions>false</DisableLanguageExtensions>
<WarningLevel>Level4</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<CompileAs>Default</CompileAs>
<DisableSpecificWarnings>4001</DisableSpecificWarnings>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<ProgramDataBaseFileName>$(OutDir)$(TargetName).pdb</ProgramDataBaseFileName>
<InlineFunctionExpansion>Disabled</InlineFunctionExpansion>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>_DEBUG;DLL_EXPORT;$(UserDefines);%(PreprocessorDefinitions)</PreprocessorDefinitions>
<Culture>0x0409</Culture>
</ResourceCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<TargetMachine>MachineARM64</TargetMachine>
<AdditionalLibraryDirectories>$(UserLibraryDirectories);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>$(UserDependencies);%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>$(UserOptionDirectory);..\..\..\include;$(UserIncludeDirectories);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;FT_DEBUG_LEVEL_ERROR;FT_DEBUG_LEVEL_TRACE;FT_DEBUG_LOGGING;FT2_BUILD_LIBRARY;DLL_EXPORT;$(UserDefines);%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;FT_DEBUG_LEVEL_ERROR;FT_DEBUG_LEVEL_TRACE;FT2_BUILD_LIBRARY;DLL_EXPORT;$(UserDefines);%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<DisableLanguageExtensions>false</DisableLanguageExtensions>
@ -135,20 +204,18 @@
<PreprocessorDefinitions>_DEBUG;DLL_EXPORT;$(UserDefines);%(PreprocessorDefinitions)</PreprocessorDefinitions>
<Culture>0x0409</Culture>
</ResourceCompile>
<Lib>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<TargetMachine>MachineX64</TargetMachine>
<AdditionalLibraryDirectories>$(UserLibraryDirectories);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>$(UserDependencies);%(AdditionalDependencies)</AdditionalDependencies>
</Lib>
<PreBuildEvent>
<Command>call $(SolutionDir)script.bat</Command>
</PreBuildEvent>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug Static|Win32'">
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>$(UserOptionDirectory);..\..\..\include;$(UserIncludeDirectories);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;FT_DEBUG_LEVEL_ERROR;FT_DEBUG_LEVEL_TRACE;FT_DEBUG_LOGGING;DLG_STATIC;FT2_BUILD_LIBRARY;$(UserDefines);%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;FT_DEBUG_LEVEL_ERROR;FT_DEBUG_LEVEL_TRACE;FT2_BUILD_LIBRARY;$(UserDefines);%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<DisableLanguageExtensions>false</DisableLanguageExtensions>
@ -169,15 +236,38 @@
<AdditionalLibraryDirectories>$(UserLibraryDirectories);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>$(UserDependencies);%(AdditionalDependencies)</AdditionalDependencies>
</Lib>
<PreBuildEvent>
<Command>call $(SolutionDir)script.bat</Command>
</PreBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug Static|ARM64'">
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>$(UserOptionDirectory);..\..\..\include;$(UserIncludeDirectories);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;FT_DEBUG_LEVEL_ERROR;FT_DEBUG_LEVEL_TRACE;FT2_BUILD_LIBRARY;$(UserDefines);%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<DisableLanguageExtensions>false</DisableLanguageExtensions>
<WarningLevel>Level4</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<CompileAs>Default</CompileAs>
<DisableSpecificWarnings>4001</DisableSpecificWarnings>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<ProgramDataBaseFileName>$(OutDir)$(TargetName).pdb</ProgramDataBaseFileName>
<InlineFunctionExpansion>Disabled</InlineFunctionExpansion>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>_DEBUG;$(UserDefines);%(PreprocessorDefinitions)</PreprocessorDefinitions>
<Culture>0x0409</Culture>
</ResourceCompile>
<Lib>
<TargetMachine>MachineARM64</TargetMachine>
<AdditionalLibraryDirectories>$(UserLibraryDirectories);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>$(UserDependencies);%(AdditionalDependencies)</AdditionalDependencies>
</Lib>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug Static|x64'">
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>$(UserOptionDirectory);..\..\..\include;$(UserIncludeDirectories);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;FT_DEBUG_LEVEL_ERROR;FT_DEBUG_LEVEL_TRACE;FT_DEBUG_LOGGING;DLG_STATIC;FT2_BUILD_LIBRARY;$(UserDefines);%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;FT_DEBUG_LEVEL_ERROR;FT_DEBUG_LEVEL_TRACE;FT2_BUILD_LIBRARY;$(UserDefines);%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<DisableLanguageExtensions>false</DisableLanguageExtensions>
@ -198,9 +288,6 @@
<AdditionalLibraryDirectories>$(UserLibraryDirectories);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>$(UserDependencies);%(AdditionalDependencies)</AdditionalDependencies>
</Lib>
<PreBuildEvent>
<Command>call $(SolutionDir)script.bat</Command>
</PreBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
@ -222,12 +309,41 @@
<PreprocessorDefinitions>NDEBUG;DLL_EXPORT;$(UserDefines);%(PreprocessorDefinitions)</PreprocessorDefinitions>
<Culture>0x0409</Culture>
</ResourceCompile>
<Lib>
<LinkTimeCodeGeneration>true</LinkTimeCodeGeneration>
<Link>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<TargetMachine>MachineX86</TargetMachine>
<AdditionalLibraryDirectories>$(UserLibraryDirectories);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>$(UserDependencies);%(AdditionalDependencies)</AdditionalDependencies>
</Lib>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">
<ClCompile>
<Optimization>MaxSpeed</Optimization>
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
<AdditionalIncludeDirectories>$(UserOptionDirectory);..\..\..\include;$(UserIncludeDirectories);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;FT2_BUILD_LIBRARY;DLL_EXPORT;$(UserDefines);%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<FunctionLevelLinking>true</FunctionLevelLinking>
<DisableLanguageExtensions>true</DisableLanguageExtensions>
<WarningLevel>Level4</WarningLevel>
<CompileAs>Default</CompileAs>
<DisableSpecificWarnings>4001</DisableSpecificWarnings>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<EnableEnhancedInstructionSet>NotSet</EnableEnhancedInstructionSet>
<IntrinsicFunctions>true</IntrinsicFunctions>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>NDEBUG;DLL_EXPORT;$(UserDefines);%(PreprocessorDefinitions)</PreprocessorDefinitions>
<Culture>0x0409</Culture>
</ResourceCompile>
<Link>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<TargetMachine>MachineARM64</TargetMachine>
<AdditionalLibraryDirectories>$(UserLibraryDirectories);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>$(UserDependencies);%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
@ -248,12 +364,13 @@
<PreprocessorDefinitions>NDEBUG;DLL_EXPORT;$(UserDefines);%(PreprocessorDefinitions)</PreprocessorDefinitions>
<Culture>0x0409</Culture>
</ResourceCompile>
<Lib>
<LinkTimeCodeGeneration>true</LinkTimeCodeGeneration>
<Link>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<TargetMachine>MachineX64</TargetMachine>
<AdditionalLibraryDirectories>$(UserLibraryDirectories);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>$(UserDependencies);%(AdditionalDependencies)</AdditionalDependencies>
</Lib>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release Static|Win32'">
<ClCompile>
@ -276,12 +393,37 @@
<Culture>0x0409</Culture>
</ResourceCompile>
<Lib>
<LinkTimeCodeGeneration>true</LinkTimeCodeGeneration>
<TargetMachine>MachineX86</TargetMachine>
<AdditionalLibraryDirectories>$(UserLibraryDirectories);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>$(UserDependencies);%(AdditionalDependencies)</AdditionalDependencies>
</Lib>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release Static|ARM64'">
<ClCompile>
<Optimization>MaxSpeed</Optimization>
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
<AdditionalIncludeDirectories>$(UserOptionDirectory);..\..\..\include;$(UserIncludeDirectories);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;FT2_BUILD_LIBRARY;$(UserDefines);%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<FunctionLevelLinking>true</FunctionLevelLinking>
<DisableLanguageExtensions>true</DisableLanguageExtensions>
<WarningLevel>Level4</WarningLevel>
<CompileAs>Default</CompileAs>
<DisableSpecificWarnings>4001</DisableSpecificWarnings>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<EnableEnhancedInstructionSet>NotSet</EnableEnhancedInstructionSet>
<IntrinsicFunctions>true</IntrinsicFunctions>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>NDEBUG;$(UserDefines);%(PreprocessorDefinitions)</PreprocessorDefinitions>
<Culture>0x0409</Culture>
</ResourceCompile>
<Lib>
<TargetMachine>MachineARM64</TargetMachine>
<AdditionalLibraryDirectories>$(UserLibraryDirectories);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>$(UserDependencies);%(AdditionalDependencies)</AdditionalDependencies>
</Lib>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release Static|x64'">
<ClCompile>
<Optimization>MaxSpeed</Optimization>
@ -302,7 +444,6 @@
<Culture>0x0409</Culture>
</ResourceCompile>
<Lib>
<LinkTimeCodeGeneration>true</LinkTimeCodeGeneration>
<TargetMachine>MachineX64</TargetMachine>
<AdditionalLibraryDirectories>$(UserLibraryDirectories);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>$(UserDependencies);%(AdditionalDependencies)</AdditionalDependencies>
@ -344,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" />
@ -359,6 +501,20 @@
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
<ItemGroup Condition="Exists('..\..\..\subprojects\dlg\.git')">
<DlgSrc Include="..\..\..\subprojects\dlg\include\dlg\output.h">
<DlgDst>..\..\..\include\dlg\output.h</DlgDst>
</DlgSrc>
<DlgSrc Include="..\..\..\subprojects\dlg\include\dlg\dlg.h">
<DlgDst>..\..\..\include\dlg\dlg.h</DlgDst>
</DlgSrc>
<DlgSrc Include="..\..\..\subprojects\dlg\src\dlg\dlg.c">
<DlgDst>..\..\..\src\dlg\dlg.c</DlgDst>
</DlgSrc>
</ItemGroup>
<Target Name="DlgCopy" Inputs="@(DlgSrc)" Outputs="@(DlgSrc->'%(DlgDst)')" Condition="Exists('..\..\..\subprojects\dlg\.git')">
<Copy SourceFiles="@(DlgSrc)" DestinationFiles="@(DlgSrc->'%(DlgDst)')" />
</Target>
<Target Name="AfterBuild">
<ItemGroup>
<TargetFiles Include="$(TargetDir)$(TargetName).*" />

View File

@ -23,9 +23,6 @@
<ClCompile Include="..\..\..\src\base\ftinit.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\base\ftsystem.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\bdf\bdf.c">
<Filter>Source Files</Filter>
</ClCompile>
@ -71,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>
@ -137,6 +137,9 @@
<ClCompile Include="..\..\..\src\dlg\dlgwrap.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\ftsystem.c">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="..\..\..\src\base\ftver.rc">

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.0 sources:</p>
from the FreeType 2.12.1 sources:</p>
<ul>
<li>freetype.dll using 'Release' or 'Debug' configurations</li>

View File

@ -1,11 +0,0 @@
@echo OFF
:: Move to Top Dir
cd ..\..\..\
:: Copy dlg's files from `subprojects\dlg' to `src\dlg'
IF NOT EXIST include\dlg (
mkdir include\dlg
COPY subprojects\dlg\include\dlg\dlg.h include\dlg
COPY subprojects\dlg\include\dlg\output.h include\dlg
COPY subprojects\dlg\src\dlg\dlg.c src\dlg\ )

View File

@ -58,7 +58,7 @@ BSC32=bscmake.exe
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
# ADD LINK32 /nologo /dll /machine:I386 /out:"$(OutDir)\freetype.dll"
# ADD LINK32 /nologo /dll /machine:I386 /opt:REF,ICF /out:"$(OutDir)\freetype.dll"
!ELSEIF "$(CFG)" == "freetype - Win32 Debug"

View File

@ -66,6 +66,8 @@
/>
<Tool
Name="VCLinkerTool"
OptimizeReferences="2"
EnableCOMDATFolding="2"
/>
<Tool
Name="VCALinkTool"
@ -432,10 +434,18 @@
/>
</FileConfiguration>
</File>
<File
RelativePath="..\..\..\src\sdf\sdf.c"
>
</File>
<File
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.0 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.0 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,

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