Commit Graph

2008 Commits

Author SHA1 Message Date
Anuj Verma 879ca87f0b [sdf] Add build infrastructure.
* src/sdf/module.mk, src/sfd/rules.mk: New files.

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

* include/freetype/ftmoderr.h (FT_MODERRDEF): Add error definition
for the 'sdf' module.

* include/freetype/internal/fttrace.h (FT_TRACE_DEF): Add trace
definition for the `sdf' module.

* modules.cfg (RASTER_MODULES): Add the `sdf' module to the list of
rasterizers.
2020-12-24 07:23:48 +01:00
Anuj Verma ec9b6c314d Add data types required for the forthcoming 'sdf' module.
* include/freetype/freetype.h (FT_Render_Mode): Add new render mode
`FT_RENDER_MODE_SDF`, which will be used to generate SDF.

* include/freetype/ftimage.h (FT_Pixel_Mode): Add new pixel mode
`FT_PIXEL_MODE_GRAY16`, which will be the output of the 'sdf'
module.
(FT_RASTER_FLAG_SDF): New raster flag to be used internally by the
'sdf' module.

* include/freetype/fttypes.h (FT_F6Dot10): New data type.
2020-12-24 07:23:47 +01:00
Werner Lemberg 7bdf386e75 ftmodapi.h: Replace 0xA0 characters with spaces. 2020-12-17 22:47:05 +01:00
Alexei Podtelezhnikov c948df52e4 * include/freetype/ftmodapi.h (FT_FACE_DRIVER_NAME): New public macro.
The driver name is needed for `FT_Property_Set' and `FT_Property_Get'.
2020-12-17 15:53:51 -05:00
Alexei Podtelezhnikov 84b3616c94 Documentation edits. 2020-12-16 22:07:57 -05:00
Chris Liddell f6be92767d [truetype] Fix incremental metrics (#59503).
* src/truetype/ttgload.c (tt_get_metrics, load_truetype_glyph):
Previously, the code would populate the phantom points before
calling the `get_glyph_metrics` callback.  For formats like PCL XL
format 1, class 2 downloaded fonts (where metrics are removed from
the TTF header), this causes problems when the hinting program uses
the phantom points (misplaced and distorted glyphs) due to the
metrics being unset (all zeros).
(tt_get_metrics_incr_overrides): Renamed to...
(tt_get_metrics_incremental): ... this.  Updated caller

* include/freetype/ftincrem.h: Update the documentation to make it
clearer that `get_glyph_metrics` is to retrieve metrics from a
non-standard source, but *not* for the purpose of imposing custom
metrics.
2020-12-16 06:08:54 +01:00
Alexei Podtelezhnikov 9cc89717be Documentation edits. 2020-12-15 22:36:19 -05:00
Werner Lemberg 015a9b8d8f */*: s/FT_LOGGING/FT_DEBUG_LOGGING/. 2020-12-07 10:27:42 +01:00
Werner Lemberg a6adb25626 * src/*: Don't use more than one '\n' in `FT_TRACE` and `FT_ERROR`.
This ensures good logging output, with all lines having a proper
prefix (if requested).
2020-12-05 09:43:45 +01:00
Werner Lemberg fcdab61ed1 [build] Use gcc (and clang) in C99 mode.
Other compilers are unchanged.

* builds/compiler/gcc-dev.mk, builds/compiler/gcc.mk (ANSIFLAGS):
s/-ansi/-std=c99/.

* builds/freetype.mk (FT_CFLAGS): Remove `-std=c99`.

* builds/unix/configure.raw: Handle C99.
Remove no longer needed test for gcc 4.6 and earlier.
2020-12-05 09:43:42 +01:00
Werner Lemberg ce43d808dc [base] Implement vertical alignment of log printing.
Based on a patch by Priyesh.

* include/freetype/internal/fttrace.h (FT_MAX_TRACE_LEVEL_LENGTH):
New macro.

* src/base/ftdebug.c, builds/windows/ftdebug.c (ft_log_handler):
Print logs after a fixed width to handle different lengths of
`FT_COMPONENT` entries.
Use `ft_strrchr` to check for final newline character.
2020-12-04 16:19:42 +01:00
Priyesh Kumar 2a46d1f04e [base] Add public API to change log handling function.
* include/freetype/ftlogging.h (FT_Custom_Log_Handler): New function
typedef to store the custom callback logging function.
(FT_Set_Log_Handler, FT_Set_Default_Log_Handler): New functions to
set and reset custom log handler.

* include/freetype/internal/ftdebug.h (custom_output_handler): New
variable to support a custom callback logging function.
(FT_Logging_Callback): A new function typedef to print log using
custom callback logging function, which is set using
`FT_Set_Log_Handler`.
(FT_Log): Use it.

* src/base/ftdebug.c (FT_Set_Log_Handler,
FT_Set_Default_Log_Handler, FT_Logging_Callback): Add function
definitions.
2020-12-04 16:19:36 +01:00
Priyesh Kumar 5fea76cf0f [base] Add public API to change the levels of tracing components.
* include/freetype/ftlogging.h: New header file.

* include/freetype/internal/ftdebug.h [FT_LOGGING]: Include
`ftlogging.h`.

* src/base/ftdebug.c (ft_custom_trace_level): New variable.
(ft_debug_init): Update to support change of levels of tracing
components of FreeType at run-time.
(FT_Trace_Set_Level): New function to change the levels of tracing
components at run-time.
(FT_Trace_Set_Default_Level): New function to reset the levels of
tracing components back to default.
2020-12-01 09:25:53 +01:00
Priyesh Kumar d00cbc3f90 [base] Updates to print timestamp and name of `FT_COMPONENT` in logs.
* include/freetype/internal/ftdebug.h (FT_LOGGING_TAG,
FT_LOGGING_TAG_): New macros to resolve the value of `FT_COMPONENT'
into a string.
(ft_add_tag, ft_remove_tag): New functions to add and remove dlg tags.

* src/base/ftdebug.c: Add new variables to control the logging of
timestamp and name of `FT_COMPONENT` along with actual logs.
(ft_add_tag, ft_remove_tag): Add function definitions.
(ft_log_handler): Updates to print timestamp and name of
`FT_COMPONENT`.
(ft_debug_init) [FT_LOGGING]: Users can now control the logging of
timestamp and name of `FT_COMPONENT` by adding tags in the
`FT2_DEBUG` environment variable.
2020-12-01 09:25:53 +01:00
Priyesh Kumar d46bada285 [base] Add functions and variables to print logs to a file.
* include/freetype/internal/ftdebug.h: Added dlg's header files.
(FT_LOG): New macro to redirect trace logs to dlg's API's whenever
`FT_LOGGING' is defined.
(ft_logging_init, ft_logging_deinit): New functions to handle
initialization and uninitialization of logging related variables.
(ft_log_handler): New function to handle logs of FreeType.

* src/base/ftdebug.c: Add necessary logging related variables.
(ft_logging_init, ft_logging_deinit, ft_log_handler): Add function
definitions.

* src/base/ftinit.c (FT_Init_FreeType) [FT_LOGGING]: Call
`ft_logging_init`.
(FT_Done_FreeType) [FT_LOGGING]: Call `ft_logging_deinit`.

* src/base/ftobjs.c (FT_New_Library): Call `ft_debug_init` only if
`FT_LOGGING` is not defined.
2020-12-01 09:25:39 +01:00
Priyesh Kumar 34b1c897c1 [builds] Necessary changes to make 'dlg' compile.
* autogen.sh (copy_submodule_files): New script to copy all the
necessary source and include files from `submodules/dlg` to
`src/dlg`.

* src/dlg/dlgwrap.c: New wrapper file for `src/dlg.c`.  It enables
the build of 'dlg' if the `FT_LOGGING` macro is defined.

* src/dlg/rules.mk: New sub-Makefile.

* builds/freetype.mk (DLG_DIR): New variable to include the
header files of the 'dlg' library.
(INCLUDES): Add `DLG_DIR`.
(FT_CFLAGS): Add `-std=c99' flag.
Include `src/dlg/rules.mk` file to build 'dlg' library.
(OBJ_S, OBJ_M): Add `DLG_OBJS_M` and `DLG_OBJS_S`.

* builds/toplevel.mk: For builds directly from the git repository
we need to copy files from `submodule/dlg` to `src/dlg`.

* include/freetype/config/ftoption.h, devel/ftoption.h (FT_LOGGING):
New macro to enable or disable the logging facility in FreeType.
2020-12-01 09:20:32 +01:00
Jan Alexander Steffens (heftig) 22bb0660a3 Fix documentation build.
The empty line after `* @description:` caused the refdoc build to fail,
see

  https://github.com/freetype/docwriter/issues/77
2020-11-03 22:36:29 +01:00
Alexei Podtelezhnikov b049cadeb1 Mention external modules. 2020-11-02 14:26:44 -05:00
Werner Lemberg 6fca2e5b1b Minor clean-ups of last commit. 2020-10-31 06:52:18 +01:00
Alexei Podtelezhnikov 681c7e2387 Better scan converter documentation. 2020-10-30 23:03:12 -04:00
Alexei Podtelezhnikov 5cbd052dfb Add preamble. 2020-10-30 13:53:17 -04:00
Werner Lemberg e9a7015ec8 Avoid non-ASCII character in public header file. 2020-10-30 08:29:38 +01:00
Werner Lemberg 101e62a286 ftimage.h: Improve description of `FT_Span`.
From Piotr Grochowski <piotrunio-2004@wp.pl>.
2020-10-30 08:07:53 +01:00
Werner Lemberg 6a2b3e4007 * Version 2.10.4 released.
==========================

Tag sources with `VER-2-10-4'.

* docs/VERSION.TXT: Add entry for version 2.10.4.
* docs/CHANGES: 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.10.3/2.10.4/, s/2103/2104/.

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

* builds/unix/configure.raw (version_info): Set to 23:4:17.
* CMakeLists.txt (VERSION_PATCH): Set to 4.
2020-10-20 07:13:33 +02:00
Alexei Podtelezhnikov 82d331556c Unnest markdown. 2020-10-11 21:56:50 -04:00
Werner Lemberg 337670af0a * Version 2.10.3 released.
==========================

Tag sources with `VER-2-10-3'.

* docs/VERSION.TXT: Add entry for version 2.10.3.

* 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.10.2/2.10.3/, s/2102/2103/.

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

* builds/unix/configure.raw (version_info): Set to 23:3:17.
* CMakeLists.txt (VERSION_PATCH): Set to 3.
2020-10-10 18:14:57 +02:00
Werner Lemberg c9f588be56 Document changes to last release. 2020-10-10 12:48:18 +02:00
Alexei Podtelezhnikov ab6a21b733 Documentation updates. 2020-09-18 22:32:20 -04:00
Alexei Podtelezhnikov d8228a0070 Improve FT_Outline_Render docs. 2020-08-28 22:28:47 -04:00
Alexei Podtelezhnikov f9f6adb625 [truetype] Retain OVERLAP_SIMPLE and OVERLAP_COMPOUND.
For glyphs with OVERLAP_SIMPLE or OVERLAP_COMPOUND, set
FT_OUTLINE_OVERLAP to render them with direct oversampling, which
mitigates artifacts (see 3bb512bc9f).

* include/freetype/ftimage.h (FT_OUTLINE_OVERLAP): Redefine to rhyme
with OVERLAP_SIMPLE.
* src/base/ftgloadr.c (FT_GlyphLoader_Rewind): Reset outline flags.
* src/truetype/ttgload.c
(TT_Load_Simple_Glyph): Retain OVERLAP_SIMPLE.
(load_truetype_glyph): Retain OVERLAP_COMPOUND.
2020-08-05 08:24:15 -04:00
Werner Lemberg 8b3601324f Minor typos, formatting. 2020-08-04 10:48:42 +02:00
Alexei Podtelezhnikov 986a340dd5 Unbreak compilation. 2020-07-28 23:20:59 -04:00
Alexei Podtelezhnikov f76f7fdecd Hide internal functions with SunPro.
* include/freetype/internal/compiler-macros.h
(FT_INTERNAL_FUNCTION_ATTRIBUTE) <__SUNPRO_C>: Define as __hidden.
2020-07-28 23:13:51 -04:00
Anuj Verma 3273521f40 Fix static compilation with Visual C.
* include/freetype/internal/compiler-macros.h
(FT_INTERNAL_FUNCTION_ATTRIBUTE) <_WIN32>: Define as empty.
2020-07-28 18:34:37 +02:00
Werner Lemberg fffc303a7f Formatting, improving comments. 2020-07-28 18:33:15 +02:00
Werner Lemberg b7c467b6ef [doc] Stem darkening is off by default for CFF driver.
Bug reported by Ishi Tatsuyuki <ishitatsuyuki@gmail.com>.
2020-07-15 09:15:25 +02:00
David Turner 5fe7c044c2 freetype.h (FT_Set_Transform): Minor documentation update.
In order to mention the limited accuracy of `FT_Matrix' coefficients
and encourage client code to perform the transform themselves with
floating point values instead.
2020-07-14 16:25:59 +02:00
Ben Wagner b1286b32a9 Document `FT_Face_Rec_::box' with variable fonts (#54969).
As pointed out in the "Note:" in the section of

  https://docs.microsoft.com/en-us/typography/opentype/spec/otvaroverview#variation-data-tables-and-miscellaneous-requirements

  ... the xMin, yMin, xMax, yMax, macStyle and lowestRecPPEM fields in
  the font header ('head') table are not supported by variation data and
  should only be used in relation to the default instance for the font.

Document that `FT_Face_Rec_::box' does not vary with OpenType variable
fonts.
2020-07-10 18:07:11 +02:00
Werner Lemberg 96fb73efd5 Fix clang warnings.
* include/freetype/internal/autohint.h
(FT_DECLARE_AUTOHINTER_INTERFACE): New macro.
* src/autofit/afmodule.h: Use it to declare
`af_autofitter_interface'.

* include/freetype/internal/ftobjs.h (FT_DECLARE_GLYPH): New macro.
* src/base/ftbase.h: Use it to declare `ft_bitmap_glyph_class' and
`ft_outline_glyph_class'.

* src/base/ftglyph.c: Include `ftbase.h'.

* src/cff/cffparse.c (cff_parser_run): Fix type of `t2_size'.

* src/pcf/pcfdrivr.c (pcf_cmap_char_next): Fix type of `result'.

* src/psaux/psauxmod.c (psaux_module_class): Use `FT_DEFINE_MODULE'.
* src/psaux/psauxmod.h: Declare `afm_parser_funcs',
`t1_cmap_classes', `cff_decoder_funcs', and `psaux_module_class'.

* src/pshinter/pshmod.c: Include `pshmod.h'.

* src/sfnt/sfwoff2.c (ROUND4, WRITE_SHORT): Fix implicit sign
conversion.
(compute_ULong_sum): Fix return type.
Fix implicit sign conversion.
(store_points): Fix type of `last_flag', `repeat_count', and `flag'.
Use casts to avoid warnings.
(reconstruct_glyf): Fix implicit sign conversion.
Use cast to avoid warning.
(get_x_mins): Fix implicit sign conversion.
* src/sfnt/ttcmap.c: Undef `TTCMAPCITEM'.
* src/sfnt/ttcmap.h: Define `TTCMAPCITEM' and include `ttcmapc.h' to
declare cmap classes.

* src/smooth/ftsmooth.c (ft_smooth_overlap_spans): Use cast.

* src/truetype/ttinterp.c (Ins_MIAP): Fix typo.
2020-07-07 16:58:14 +02:00
David Turner 0f35b042e0 [build] Really fix multi and C++ builds.
The following builds were still failing due to previous changes:

  make multi
  make multi CC="c++"
  make CC="c++"

This patch fixes the issues, which were missing includes to get the
right macro definitions in multi-build mode.

Also, `FT_UNUSED' is actually used by third-party code, so move it
back to `public-macros.h' to avoid breaking it.

* include/freetype/config/public-macros.h (FT_EXPORT): Remove
special definition for C++.
(FT_UNUSED): Define here instead of...
* include/freetype/config/compiler-macros.h: ... here.
(FT_FUNCTION_DECLARATION): Remove special definition for C++.
(FT_LOCAL_ARRAY_DEF): Fix definition.

* src/cache/ftccback.h, src/lzw/ftzopen.h, src/gxvalid/gxvmort.h,
src/gxvalid/gxvmorx.h: Add `FT_BEGIN_HEADER' and `FT_END_HEADER'.
2020-07-07 06:51:09 +02:00
David Turner cb4a943bc4 [build] Fix multi and C++ builds.
The following builds were failing due to previous changes:

  make multi
  make multi CC="c++"

* include/freetype/config/ftconfig.h: Remove `FT_END_HEADER'.

* include/freetype/config/ftheader.h (FT_BEGIN_HEADER,
FT_END_HEADER): Protect against redefinition.

* src/cache/ftccache.h, src/cache/ftcmru.h, src/pcf/pcfutil.h,
src/psaux/pserror.h, src/psaux/psft.h, src/psaux/psstack.h,
src/sfnt/woff2tags.h: Include `compiler-macros.h'.

* src/sfnt/woff2tags.c: Include `woff2tags.h'.
2020-07-06 11:49:00 +02:00
David Turner b0667d2d36 [build] Improve visibility support of library function names.
* include/freetype/config/public-macros.h
(FT_PUBLIC_FUNCTION_ATTRIBUTE): New macro to tag functions as
public (and thus exportable).
(FT_EXPORT): Use it.

* include/freetype/config/compiler-macros.h
(FT_INTERNAL_FUNCTION_ATTRIBUTE): New macro to tag functions as
internal to the library (and thus hidden).  Note that on ELF
systems, all internal functions have hidden visibility, which avoids
the need to enforce this when invoking the compiler (e.g., with an
option like `-fvisibility=hidden').

(FT_FUNCTION_DECLARATION, FT_FUNCTION_DEFINITION): New base macros
to deal with C and C++ linkage issues at the same time.

(FT_LOCAL, FT_LOCAL_DEF, FT_LOCAL_ARRAY, FT_LOCAL_ARRAY_DEF,
FT_BASE, FT_BASE_DEF, FT_EXPORT_VAR, FT_BASE_CALLBACK,
FT_BASE_CALLBACK_DEF): Redefined using new macros.
2020-07-05 11:03:23 +02:00
David Turner bb66c8d8cf [build] Split off more stuff from `ftconfig.h'.
* builds/unix/ftconfig.h.in, builds/vms/ftconfig.h,
include/freetype/config/ftconfig.h: Split off macro definitions
required by the FreeType API headers to...
* include/freetype/config/public-macros.h: ...this new file.

* builds/unix/ftconfig.h.in, builds/vms/ftconfig.h,
include/freetype/config/ftconfig.h: Split off macro definitions used
by the library but not to be exposed to clients to...
* include/freetype/config/compiler-macros.h: ...this new file.

* include/freetype/internal/*.h, src/raster/ftraster.h: Include
`compiler-macros.h' where needed.
2020-07-05 10:42:23 +02:00
David Turner 0322efb5e5 [build] Move mac support code to `mac-support.h'.
* builds/unix/ftconfig.h.in, builds/vms/ftconfig.h,
include/freetype/config/ftconfig.h: Split off mac-specific stuff
to...
* include/freetype/config/mac-support.h: ...this new file.

* CMakeLists.txt, builds/unix/configure.raw: Remove `/undef ->
#undef' string replacement; the affected code is no longer part of
the `ftconfig.h' template.
2020-07-05 09:59:29 +02:00
David Turner bd7251ac97 [build] Put integer type definitions into `integer-types.h'.
Refactor some of the `ftconfig.h' headers and template to move the
definition of the FreeType integer types (e.g., `FT_Int16') to a
common header file `freetype/config/integer-types.h'.

* builds/unix/ftconfig.h.in, builds/vms/ftconfig.h,
include/freetype/config/ftconfig.h: Split off integer type
definition stuff to...
* include/freetype/config/integer-types.h: ...this new file.

* builds/unix/ftconfig.h.in: Control the definition of
`FT_SIZEOF_INT' and `FT_SIZEOF_LONG' with macro
`FT_USE_AUTOCONF_SIZEOF_TYPES'.  If these are not defined, auto
detection happens in `integer-types.h' as usual based on `INTXX_MAX'
values.  Otherwise the autoconf-detected values are used.

* builds/unix/configure.raw (CPPFLAGS): Don't include path to
`config' directory.  Instead, ...
(FT_CONFIG_STANDARD_LIBRARY_H): Use complete path.
2020-07-05 09:52:23 +02:00
Alexei Podtelezhnikov 3bb512bc9f [smooth] Introduce direct oversampling for overlaps.
This implements oversampling to metigate artifacts in pixels partially
covered by overlapping contours.  It turns out that the 4x4
oversampling is sufficient but, at least, quadruples the rendering
time.  The outline has to set FT_OUTLINE_OVERLAP to use this method.

* include/freetype/ftimage.h (FT_OUTLINE_OVERLAP): New flag.
* src/smooth/ftsmooth.c (ft_smooth_render): Check it to...
(ft_smooth_raster_overlap): ... inflate outline and set up direct
rendering for oversampling with...
(ft_smooth_overlap_spans): ... new span function that integrates them.
2020-07-03 22:29:34 -04:00
Alexei Podtelezhnikov de088b1dfd Simplify unused macro. 2020-06-19 22:46:30 -04:00
Werner Lemberg 1658685967 Remove redundant inclusion of `ft2build.h'.
* */*: Remove `#include <ft2build.h>' where possible.

* include/freetype/freetype.h: Remove cpp error about missing
inclusion of `ft2build.h'.
2020-06-13 21:15:45 +02:00
David Turner e13391333f Make macros for header file names optional.
We no longer have to take care of the 8.3 file name limit; this
allows us (a) to introduce longer, meaningful file names, and (b) to
avoid macro names in `#include' lines altogether since some
compilers (most notably Visual C++) doesn't support this properly.

*/*: Replace

   #include FOO_H

with

   #include <freetype/foo.h>

or something similar.  Also update the documentation.
2020-06-08 13:31:55 +02:00
David Turner 4eee13404d Remove Jamfile files from the tree.
These have not been used in a very, very long time, so better remove
them.  A corresponding patch will be submitted to the
`freetype2-demos' repository.

* src/Jamfile, src/*/Jamfile, Jamrules: Delete.
2020-05-18 17:56:06 +02:00
Alexei Podtelezhnikov 3f70e6d20c [smooth] Turn on LCD filtering during FreeType initialization.
* src/smooth/ftsmooth.c (ft_smooth_init): Enable LCD filtering.

* include/freetype/ftlcdfil.h: Document it, remove patent warnings.
* include/freetype/freetype.h (FT_Render_Mode): Updated.
* include/freetype/config/ftoption.h, devel/ftoption.h
[FT_CONFIG_OPTION_SUBPIXEL_RENDERING]: Do not mention patents.
2020-05-12 00:38:46 -04:00
Alexei Podtelezhnikov 652f886319 [smooth] Stop using dedicated LCD modules and classes.
The LCD modules were never truly independent. They mostly served as
a way to disable patented LCD rendering, which is no longer necessary.
The `smooth' module now handles LCD modes as well.

* src/smooth/ftsmooth.c (ft_smooth_lcd_renderer_class.
ft_smooth_lcdv_renderer_class): Deleted.
(ft_render_smooth): Reworked from `ft_render_smooth_generic'.
* src/smooth/ftsmooth.h: Remove dedicated LCD classes.
* src/smooth/module.mk: Remove dedicated LCD modules.
* include/freetype/config/ftmodule.h: Ditto.
* builds/amiga/include/config/ftmodule.h: Ditto.
* include/freetype/ftmodapi.h: Do not mention LCD modules.
2020-05-11 23:30:37 -04:00
Werner Lemberg 132f19b779 * Version 2.10.2 released. ==========================
Tag sources with `VER-2-10-2'.

* docs/VERSION.TXT: Add entry for version 2.10.2.

* README, Jamfile (RefDoc), 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.10.1/2.10.2/, s/2101/2102/.

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

* builds/unix/configure.raw (version_info): Set to 23:2:17.
* CMakeLists.txt (VERSION_PATCH): Set to 2.

* docs/CHANGES: Updated.
2020-05-09 07:09:40 +02:00
Werner Lemberg 141da02816 Make `FT_HAS_*' and `FT_IS_*' really return true (#57906).
* include/freetype/freetype.h (FT_HAS_*, FT_IS_*): Implement it.
2020-02-27 09:49:06 +01:00
Werner Lemberg e5038be704 Update all copyright notices. 2020-01-19 17:05:19 +01:00
Werner Lemberg 26d0f579c0 * include/freetype/internal/ftmemory.h (FT_OFFSET): New macro.
Use this for `base + offset' pointer calculations where `base' can
be NULL (triggering a sanitizer warning even if the resulting
pointer gets never dereferenced since it is undefined behaviour
in C).

Suggested by Ben Wagner.
2019-11-23 10:28:37 +01:00
Filip Filmar 0a3d2bb99b [doc] FT_Open_Args: Clarify the ownership of `pathname'.
Don't expect the function to deallocate the buffer.  This may be obvious
in C, but it is not so obvious in FFI bindings for FreeType 2.
2019-10-22 17:23:52 +02:00
Werner Lemberg 5a1a79c0e8 [woff2] Fix SFNT table checks.
Also reduce number of SFNT table lookups.

Reported as

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

* include/freetype/internal/wofftypes.h (WOFF2_InfoRec): Add fields
`glyf_table', `loca_table', and `head_table'.

* src/sfnt/sfwoff2.c (reconstruct_glyf): Update signature.
Use table pointers in `info' parameter.
(get_x_mins): Check `maxp_table'
Use table pointers in `info' parameter.
(reconstruct_font):  Use and set table pointers in `info' parameter.
Fix check for `glyf' and `loca' tables.
Update call to `reconstruct_glyf'.
(woff2_open_font): Updated.
2019-10-08 11:12:18 +02:00
Werner Lemberg 0fcf486e0d Improve memory debugging.
* include/freetype/internal/ftmemory.h (FT_MEM_FREE): Use
`FT_DEBUG_INNER' to set source code file name and line.

* src/base/ftdbgmem.c (ft_mem_table_remove): Better formatting of
tracing message.
2019-10-06 21:12:42 +02:00
Alexei Podtelezhnikov b39576f984 * src/base/ftstroke.c (ft_stroker_cap): Speed up caps. 2019-09-27 19:18:49 -04:00
Alexei Podtelezhnikov 432efa25b3 * src/base/ftstroke.c (ft_stroker_outside): Speed up clipped miter.
* include/freetype/ftstroke.h: Wordsmith miter docs.
2019-09-25 21:50:16 -04:00
Avi Halachmi (:avih) cc17f852d5 [cmake] Don't fail if brotli is missing (#56894).
The libs which cmake controls are commented out at

  include/freetype/config/ftoption.h

and cmake un-comment each enabled library, but the brotli option was
not commented out, therefore `FT_CONFIG_OPTION_USE_BROTLI' remained
defined even if brotli was missing/disabled/etc.

Comment it such that cmake can control it, which means leaving it
undefined if brotli is missing.

* include/freetype/config/ftoption.h: Fix typo.
2019-09-15 18:52:13 +02:00
Werner Lemberg 87f5225256 Fix handling of `AF_CONFIG_OPTION_INDIC'.
* devel/ftoption.h, include/freetype/config/ftoption.h:
`AF_CONFIG_OPTION_INDIC' needs `AF_CONFIG_OPTION_CJK'.
2019-09-05 12:14:03 +02:00
Werner Lemberg 60c52f0edb [woff2] Formatting; some comments. 2019-08-27 10:29:59 +02:00
Nikhil Ramakrishnan d2681a4977 [woff2] More formatting and documentation.
* include/freetype/internal/wofftypes.h, src/sfnt/sfwoff2.c: Implement
formatting changes suggested as

  https://lists.nongnu.org/archive/html/freetype-devel/2019-08/msg00052.html
2019-08-27 10:03:19 +02:00
Nikhil Ramakrishnan 1e02076815 [woff2] Avoid too many calls to `FT_REALLOC'.
We do this by using `totalSfntSize' as an initial reference, and
extending the buffer when required.  This reduces rendering time
considerably.

* include/freetype/internal/wofftypes.h (WOFF2_HeaderRec): Add
`totalSfntSize', rename `total_sfnt_size' to `actual_sfnt_size'.

* src/sfnt/sfwoff2.c (write_buf): Add parameter `dst_size' to keep
track of and update total size of stream.

(WRITE_SFNT_BUF, WRITE_SFNT_BUF_AT): Modify macros accordingly.

(pad4, store_loca, reconstruct_glyf, reconstruct_hmtx,
reconstruct_font): Update parameters to accept `sfnt_size'.

(woff2_open_font): Add variable `sfnt_size'.  Use WOFF2 header field
`totalSfntSize' as initial reference (if value makes sense) and
allocate `totalSfntSize' bytes for the sfnt stream.  `write_buf'
handles reallocation if and when required.  Also resize the stream
to `actual_sfnt_size' after reconstruction.
2019-08-27 09:50:48 +02:00
Nikhil Ramakrishnan 4d9b3d1d50 [woff2] Reconstruct `loca', `hmtx', and swap out stream.
Add necessary functions to reconstruct loca and hmtx tables (the two
remaining tables that can have a transform).  `woff2_open_font' is
now capable of loading a woff2 font face.  This code may still need
more refining and better memory management.

* include/freetype/internal/wofftypes.h (WOFF2_HeaderRec): Add total
(final) size of sfnt stream.

(WOFF2_InfoRec): Add header checksum value.

* src/sfnt/sfobjs.c (sfnt_open_font): Change `face_instance_index'
parameter to its pointer so its value can be modified by
`woff2_open_font'.

* src/sfnt/sfwoff2.c: (WRITE_SFNT_BUF_AT): New macro to write into
sfnt buffer at given position.

(write_buf): Add parameter `extend_buf' which allows caller to
specify whether buffer should be reallocated before copying data.

(WRITE_SFNT_BUF): Updated.

(pad4, store_loca, reconstruct_htmx): New functions.

(reconstruct_glyf): Calculate loca values and store them.

(reconstruct_font): Call `reconstruct_hmtx', write table record
entries, and calculate table checksums.  Also calculate font
checksum and update `checksumAdjustment' entry in head table.

(woff2_open_font): Open stream for sfnt buffer, swap out input
stream and return.

* src/sfnt/sfwoff2.h (woff2_open_font): Modify parameter to accept
pointer to `face_index'.
2019-08-27 09:46:47 +02:00
Nikhil Ramakrishnan e3953e5410 [woff2] Reconstruct transformed `glyf' table.
Reconstruct `glyf' table if it is transformed in the uncompressed
table stream.  Also add necessary structures, macros and functions.

* include/freetype/internal/wofftypes.h (WOFF2_InfoRec,
WOFF2_SubstreamRec, WOFF2_PointRec): New structures.
(WOFF2_TableRec): s/OrigLength/dst_length/.

* src/sfnt/sfwoff2.c (READ_255USHORT, READ_BASE128): Use
`FT_SET_ERROR' to set implicit `error' variable.

(WRITE_SHORT): New macro.

(N_CONTOUR_STREAM, N_POINTS_STREAM, FLAG_STREAM, GLYPH_STREAM,
COMPOSITE_STREAM, BBOX_STREAM, INSTRUCTION_STREAM): New macros to
refer to substreams of the transformed `glyf' tables.

(Read255UShort, ReadBase128): Return errors set by `FT_READ_XXX'
macros.

(with_sign, safe_int_addition): New functions to add sign to values
based on a flag and perform safe addition respectively.

(triplet_decode): Decode variable-length (flag, xCoordinate,
yCoordinate) triplet for a simple glyph.   See

  https://www.w3.org/TR/WOFF2/#triplet_decoding

(store_points, compute_bbox, composteGlyph_size, reconstruct_glyf):
New functions.

(reconstruct_font): Call `reconstruct_glyf'.

* src/sfnt/sfwoff2.h: Add required constants.

* src/sfnt/woff2tags.h: Move out constants to `sfwoff2.h'.
2019-08-27 09:39:18 +02:00
Nikhil Ramakrishnan 9443a1bc3e Add Brotli dependency and required checks.
Brotli is required for decompressing WOFF2 font directory streams.
The library is thus being added as an optional dependency for
FreeType.

* builds/unix/configure.raw: Add checks for `libbrotlidec'.
(REQUIRES_PRIVATE, LIBS_PRIVATE, LIBSSTATIC_CONFIG): Updated.

* devel/ftoption.h, include/freetype/config/ftoption.h
(FT_CONFIG_OPTION_USE_BROTLI): New macro.
2019-08-27 09:09:48 +02:00
Nikhil Ramakrishnan e496cb2980 [woff2] Read table and collection directory.
* include/freetype/internal/wofftypes.h (WOFF2_TtcFontRec): New
structure.
(WOFF2_HeaderRec): Add more fields.

* src/sfnt/sfwoff2.c (READ_255USHORT, READ_BASE128, ROUND4): New
macros.
(Read255UShort, CollectionHeaderSize, compute_first_table_offset):
New functions.
(ReadBase128): Use `FT_READ_BYTE'.
(woff2_open_font): Add functionality to read table directory and
collection directory (if present).
2019-08-27 09:02:33 +02:00
Nikhil Ramakrishnan 2fa573c1b0 [sfnt] Read WOFF 2 header.
Check for WOFF2 tag, call `woff2_open_font', and implement it to read
header according to specification.

* include/freetype/internal/fttrace.h: Add `sfwoff2.c'.

* src/sfnt/rules.mk (SFNT_DRV_SRC): Add `sfwoff2.c'.

* src/sfnt/sfnt.c: Include `sfwoff2.c'.

* src/sfnt/sfobjs.c (sfnt_open_font): Check for `wOF2' tag and call
`woff2_open_font'.

* src/sfnt/sfwoff2.c, src/sfnt/sfwoff2.h: New files.
2019-08-27 08:53:51 +02:00
Nikhil Ramakrishnan 83dba0e9ec Add structures for WOFF2.
Add structures and macro for WOFF 2 header and table directory.

* include/freetype/internal/wofftypes.h (WOFF2_HeaderRec,
WOFF2_TableRec_): New structures.

* include/freetype/tttags.h (TTAG_wOF2): New macro.
2019-08-27 08:48:53 +02:00
Werner Lemberg 734d60f63c Another minor documentation improvement. 2019-08-06 20:38:17 +02:00
Werner Lemberg ad3443c931 Minor documentation improvement. 2019-08-05 10:00:41 +02:00
Werner Lemberg 8cf046c38d * Version 2.10.1 released.
==========================

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

* docs/VERSION.TXT: Add entry for version 2.10.1.

* README, Jamfile (RefDoc), src/base/ftver.rc,
builds/windows/vc2010/freetype.vcxproj,
builds/windows/vc2010/index.html,
builds/windows/visualc/freetype.dsp,
builds/windows/visualc/freetype.vcproj,
builds/windows/visualc/index.html,
builds/windows/visualce/freetype.dsp,
builds/windows/visualce/freetype.vcproj,
builds/windows/visualce/index.html,
builds/wince/vc2005-ce/freetype.vcproj,
builds/wince/vc2005-ce/index.html,
builds/wince/vc2008-ce/freetype.vcproj,
builds/wince/vc2008-ce/index.html: s/2.10.0/2.10.1/, s/2100/2101/.

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

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

* include/freetype/fterrors.h (FT_Error_String): Fix C++ compilation.
2019-07-01 15:56:34 +02:00
Alexei Podtelezhnikov 81445c034a Doc polishing. 2019-06-22 22:54:57 -04:00
Alexei Podtelezhnikov a41e560b21 Minor. 2019-06-19 22:29:55 -04:00
Werner Lemberg 8acd9800ed Add memory access macro summary. 2019-06-13 11:12:26 +02:00
Alexei Podtelezhnikov 59e0c6f92e * include/freetype/ftmodapi.h (FT_DebugHook_Func): Return error.
Fix a warning by adding a return value as in `TT_RunIns',
which should not be a compatibility issue.
2019-06-12 22:30:21 -04:00
Alexei Podtelezhnikov 78c02bc110 [type1,type42] Use `const' for string literals.
* include/freetype/internal/psaux.h (PS_Table_FuncsRec): Updated.
* include/freetype/internal/t1types.h (T1_EncodingRec): Updated.
* src/psaux/psobjs.[ch] (ps_table_add): Updated.
* src/type1/t1load.c (T1_Open_Face, parse_encoding): Updated.
* src/type42/t42objs.c (T42_Open_Face): Updated.
* src/type42/t42parse.c (t42_parse_encoding): Updated.

* src/cff/cffobjs.c (cff_face_init): Minor.
2019-06-10 23:09:49 -04:00
Alexei Podtelezhnikov e13c1f46dc Solidify VC2005 builds.
* include/freetype/internal/ftcalc.h (FT_MSB) [_MSC_VER]: Explicitly
declare `_BitScanReverse' intrinsic.
* builds/windows/visualc/freetype.vcproj [Debug]: Disable intrinsics.
2019-05-31 22:31:47 -04:00
Nikhil Ramakrishnan 7b275a5af1 [sfnt] Separate WOFF sources and headers.
Move WOFF sources and headers to separate files.

* include/freetype/internal/wofftypes.h, src/sfnt/sfwoff.c,
src/sfnt/sfwoff.h: New files.

* include/freetype/internal/fttrace.h: Register `sfwoff.c'.

* include/freetype/internal/internal.h: Define
FT_INTERNAL_WOFF_TYPES_H.

* include/freetype/internal/sfnt.h: Include FT_INTERNAL_WOFF_TYPES_H.

* include/freetype/internal/tttypes.h: Move out WOFF structures.

* src/sfnt/rules.mk: Add `sfwoff.c'.

* src/sfnt/sfnt.c: Include `sfwoff.c'.

* src/sfnt/sfobjs.c: Include `sfwoff.h', move out WOFF sources.
2019-05-30 23:57:34 +05:30
Werner Lemberg 37580053b4 [truetype] Use 26.6 format for storing unscaled CVT values.
If `CVAR' data is applied to variation fonts, fractional values are
possible.

* include/freetype/internal/tttypes.h (TT_FaceRec): Change type of
`cvt' from `FT_Short' to `FT_Int32'.

* src/truetype/ttgxvar.c (FT_fdot6ToFixed): New macro.
(tt_face_vary_cvt): Use it to update code to 26.6 format.

* src/truetype/ttobjs.c (tt_size_run_prep): Update code to 26.6
format.

* src/truetype/ttpload.c (tt_face_load_cvt): Stora data in 26.6
format.
2019-05-16 12:15:54 +02:00
Werner Lemberg 1178227b39 [truetype] Increase precision of font variation (#54371).
This patch make FreeType use font units in 26.6 format internally
instead of integers.

* src/truetype/ttgxvar.c (FT_fixedToFdot6): New macro.
(TT_Vary_Apply_Glyph_Deltas): Add argument to output unrounded font
coordinates.
* src/truetype/ttgxvar.h: Updated.

* src/truetype/ttgload.c (TT_Process_Simple_Glyph): Use
`extra_points2' array to temporarily hold unrounded point
coordinates; use them to compute scaled coordinates and linear
advance width and height.
(load_truetype_code): Adjust similarly.
2019-05-11 10:01:57 +02:00
Alexei Podtelezhnikov 65f9516bc7 Tweak LCD filtering.
* src/base/ftlcdfil.c (ft_lcd_filter_fir, _ft_lcd_filter_legacy):
Choose direction from bitmap's pixel_mode.
* include/freetype/internal/ftobjs.c (FT_Bitmap_LcdFilterFunc):
Updated.
* src/smooth/ftsmooth.c (ft_smooth_render_generic): Updated.
2019-05-02 23:06:55 -04:00
Alexei Podtelezhnikov 432bb50ff5 Clarify docs. 2019-04-23 21:51:42 -04:00
Werner Lemberg 01aed76c68 Minor. 2019-04-14 09:39:28 +02:00
Antony Lee 3ad1c93ac1 Make `glyph_name' parameter to `FT_Get_Name_Index' a `const'.
* include/freetype/freetype.h (FT_Get_Name_Index),
include/freetype/internal/ftobjs.h (FT_Face_GetGlyphNameIndexFunc),
include/freetype/internal/services/svgldict.h
(FT_GlyphDict_NameIndexFunc), src/base/ftobjs.c (FT_Get_Name_Index),
src/cff/cffdrivr.c (cff_get_name_index), src/sfnt/sfdriver.c
(sfnt_get_name_index), src/type1/t1driver.c (t1_get_name_index),
src/type42/t42drivr.c (t42_get_name_index): Add `const' to second
argument.
2019-04-06 06:38:16 +02:00
Werner Lemberg fdb10e8b50 Improve link. 2019-03-21 13:53:43 +01:00
Werner Lemberg fbbcf50367 * Version 2.10.0 released.
==========================

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

* docs/VERSION.TXT: Add entry for version 2.10.0.
* docs/CHANGES: Updated.

* README, Jamfile (RefDoc), src/base/ftver.rc,
builds/windows/vc2010/freetype.vcxproj,
builds/windows/vc2010/index.html,
builds/windows/visualc/freetype.dsp,
builds/windows/visualc/freetype.vcproj,
builds/windows/visualc/index.html,
builds/windows/visualce/freetype.dsp,
builds/windows/visualce/freetype.vcproj,
builds/windows/visualce/index.html,
builds/wince/vc2005-ce/freetype.vcproj,
builds/wince/vc2005-ce/index.html,
builds/wince/vc2008-ce/freetype.vcproj,
builds/wince/vc2008-ce/index.html: s/2.9.1/2.10.0/, s/291/2100/.

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

* builds/unix/configure.raw (version_info): Set to 23:0:17.
* CMakeLists.txt (VERSION_MINOR): Set to 10.
(VERSION_PATCH): Set to 0.

* builds/toplevel.mk (version, winversion): Since the minor version
number has two digits now, never omit the patch number.  We would
get ambiguous zip file names otherwise.
(dist): Remove remnants of `docmaker' tool.
(do-dist): Remove unused intermediate files.

* src/cff/cffparse.c (destrict_c2s_item): Guard function with
CFF_CONFIG_OPTION_OLD_ENGINE macro.
2019-03-15 07:56:49 +01:00
Andrei Alexeyev 2f4b740ce4 Fix invalid function pointer casts.
This change should allow Freetype to work on WASM/Emscripten without
needing `-s EMULATE_FUNCTION_POINTER_CASTS=1'.

* src/autofit/afdummy.c (af_dummy_hints_apply): Fix signature.

* src/cid/cidload.c (cid_parse_font_matrix, parse_fd_array,
parse_expansion_factor, parse_font_name): Return `void', not
`FT_Error'.

* include/freetype/internal/ftobjs.h (FT_CMap_CharVarIsDefaultFunc):
Fix signature.
2019-03-07 09:43:05 +01:00
Nikhil Ramakrishnan 6d65c60fca Minor formatting. 2019-03-02 16:05:51 +05:30
Werner Lemberg bf04c59249 Minor doc fixes. 2019-02-25 06:32:26 +01:00
Werner Lemberg 4d51f78de9 More documentation updates.
In particular, mark the new behaviour of `FT_LOAD_COLOR' as experimental.
2019-02-23 11:21:48 +01:00
Werner Lemberg 6ab36880ce * src/base/ftbitmap.c (FT_Bitmap_Blend): No fractional offsets.
The function only provided a framework without an actual
implementation, which this commits removes.
2019-02-23 11:18:39 +01:00
Werner Lemberg 7585997024 Update all copyright notices. 2019-02-23 10:07:09 +01:00
Werner Lemberg a346abc093 s/`....`/'....'/ for SFNT table tags in documentation. 2019-02-21 09:19:47 +01:00
Werner Lemberg 8de11f3def s/NULL/`NULL`/ in documentation. 2019-02-20 16:19:19 +01:00
Werner Lemberg f92fa39341 Minor documentation fixes. 2019-02-20 16:04:48 +01:00
Werner Lemberg f686ad46a3 Update copyright years. 2019-01-22 20:31:44 +01:00
Nikhil Ramakrishnan 2875ada197 Minor documentation fix. 2018-12-30 20:02:08 +05:30
Werner Lemberg afa043de9c Fix links (mostly http -> https). 2018-12-25 22:44:05 +01:00
Werner Lemberg e8bbef85c0 Fix documentation of TrueType bytecode interpreter debug hook. 2018-12-12 14:05:47 +01:00
Werner Lemberg 0c83ba6d61 Minor documentation updates and fixes. 2018-12-10 12:14:13 +01:00
Alexei Podtelezhnikov d01e28f41f Important doc fix. 2018-12-06 08:12:27 -05:00
Nikhil Ramakrishnan c1e58b4d93 * include/freetype/ftmm.h: Minor. 2018-11-29 12:57:35 +05:30
Chris Liddell 78a1e69517 [type1,cff] Add FT_{Set,Get}_MM_WeightVector API calls.
For multiple master fonts, common usage (in Postscript) is to modify
the WeightVector of an existing font instance, this addition
supports that use.

* include/freetype/ftmm.h, src/base/ftmm.c (FT_Set_MM_WeightVector,
FT_Get_MM_WeightVector): New API functions.

* include/freetype/internalservices/svmm.h
(FT_Set_MM_WeightVector_Func, FT_Get_MM_WeightVector_Func): New
function types.
(MultiMasters): Add `set_mm_weightvector' and `get_mm_weightvector'
members.
(FT_DEFINE_SERVICE_MULTIMASTERSREC): Updated.

* src/cffcffdrivr.c (cff_set_mm_weightvector,
cff_get_mm_weightvector): New functions.
(cff_service_multi_masters): Register them.

* src/truetype/ttdriver.c (tt_service_gx_multi_masters): Updated.
This driver doesn't use the new interface.

* src/type1/t1load.c (T1_Set_MM_WeightVector,
T1_Get_MM_WeightVector): New functions.
* src/type1/t1driver.c (t1_service_multi_masters): Register them.
* src/type1/t1load.h: Updated.
2018-11-27 22:24:06 +01:00
Alexei Podtelezhnikov 8d517e679b Clarification. 2018-11-10 15:47:48 -05:00
Alexei Podtelezhnikov acb19ed4e9 Comment on timestamp storage. 2018-10-28 14:19:33 -04:00
Alexei Podtelezhnikov 3e8ec291ff [sfnt] Make `head' timestamps unsigned.
It's been more than 2^31 seconds since 1904.

* include/freetype/tttables.h (TT_Header): Change field types.
* src/sfnt/ttload.c (tt_face_load_generic_header): Updated.
2018-10-26 23:23:48 -04:00
Alexei Podtelezhnikov d71f2bc159 Revert "Align FreeType with standard C memory management."
This reverts commit 877aa1b2cc.
2018-10-26 22:52:25 -04:00
Werner Lemberg 428854931e Minor. 2018-10-10 12:21:10 +02:00
Alexei Podtelezhnikov 877aa1b2cc Align FreeType with standard C memory management.
* include/freetype/ftsystem.h: Include FT_TYPES_H.
(*FT_Alloc_Func, *FT_Realloc_Func): Use size_t for the size arguments.
* src/raster/ftmisc.h: Ditto.

* builds/amiga/src/base/ftsystem.c, builds/unix/ftsystem.c,
* builds/vms/ftsystem.c, src/base/ftsystem.c (ft_alloc, ft_realloc):
Use size_t for the size arguments.

* src/base/ftdbgmem.c (ft_mem_debug_alloc, ft_mem_debug_realloc): Use
FT_Offset, aka size_t, for the size arguments.
2018-09-27 21:17:36 -04:00
Werner Lemberg a9af691481 Fix handing of `FT_Bool'.
Before this commit we had code like

  (FT_Bool)( globals->glyph_styles[gindex] & 0x8000)

Since `FT_Bool' is defined to be an `unsigned char', the code
evaluated to something like

  (unsigned char)( 0x8532 & 0x8000)

which in turn expanded to

  (unsigned char)( 0x8000)

and finally yielded 0x00 – i.e., false – not as expected.

Problem reported and analyzed by Tony Smith <tony.smith@macro4.com>.

* include/freetype/fttypes.h (FT_BOOL): Add a comparison against
zero so that we always have a Boolean expression.

*/*: Replace castings to `FT_Bool' with calls to `FT_BOOL' where
possible.
2018-09-25 09:10:09 +02:00
Werner Lemberg abd997aa7c Improve documentation of `FT_LOAD_NO_RECURSE'. 2018-09-21 12:50:32 +02:00
Werner Lemberg 8e95068053 [base] Remove unused function `FT_GlyphLoader_CopyPoints'.
* include/freetype/internal/ftgloadr.h, src/base/ftgloadr.c
(FT_GlyphLoader_CopyPoints): Do it.
2018-09-20 06:26:34 +02:00
Werner Lemberg b8dd404d13 freetype.h: Add warning w.r.t. B/W hinting and rendering (#54589). 2018-09-16 07:22:23 +02:00
Werner Lemberg 97c7944f9e Synchronize `ftconfig' files. 2018-09-05 11:45:05 +02:00
Werner Lemberg c485bece6b Typo (#54618). 2018-09-04 21:05:06 +02:00
Werner Lemberg 9789c75b1a More '...' vs. `...` fixes in API documentation. 2018-09-04 10:37:44 +02:00
Werner Lemberg 01a5d326bb Make `/****...' comments in public headers uniformly end on column 77. 2018-09-04 08:00:58 +02:00
Werner Lemberg 1061748256 include/freettype/config:*.*: Convert comments to Markdown syntax.
Also some minor documentation fixes.
2018-09-03 10:37:57 +02:00
Werner Lemberg 76a52465c1 */*: s/PSNames/psnames/.
Only tracing messages are affected.
2018-09-03 09:08:47 +02:00
Werner Lemberg 9be656bb0c Remove `FT_Outline_{New,Done}_Internal'.
These public API functions(!) were always undocumented and have
escaped all clean-up efforts until now.

* include/freetype/ftoutln.h (FT_Outline_New_Internal,
FT_Outline_Done_Internal): Removed.

* src/base/ftoutln.h (FT_Outline_New_Internal,
FT_Outline_Done_Internal): Merge into...
(FT_Outline_New, FT_Outline_Done): ... these functions.

* docs/README: Updated.
2018-09-01 11:04:58 +02:00
Armin Hasitzka 4b49a8079f [errors] Refine the macro logic surrounding `FT_Error_String'.
* include/freetype/fterrors.h (FT_INCLUDE_ERR_PROTOS,
FT_ERR_PROTOS_DEFINED): Undefine `FT_INCLUDE_ERR_PROTOS' after
checking it and introduce a new macro that takes proper care of
multiple-inclusion protection.
2018-08-31 20:26:46 +01:00
Werner Lemberg 83525bdd10 Minor comments. 2018-08-31 07:37:15 +02:00
Werner Lemberg 423fce2e3e Add link to OpenType's composite glyph description. 2018-08-31 06:59:44 +02:00
Alexei Podtelezhnikov 1dacbd893d Consolidate bitmap presetting and size assessment.
* include/freetype/internal/ftobjs.h (ft_glyphslot_preset_bitmap):
Change return type.
* src/base/ftobjs.c (ft_glyphslot_preset_bitmap): Return the bitmap
size assessment.

* src/raster/ftrend1.c (ft_raster1_render): Use it to refuse the
rendering of enourmous or far-fetched outlines.
* src/smooth/ftsmooth.c (ft_smooth_render_generic): Ditto.
2018-08-30 23:28:30 -04:00
Armin Hasitzka 35efb103fe [errors] Introduce a macro to control `FT_Error_String'.
* devel/ftoption.h (FT_CONFIG_OPTION_ERROR_STRINGS),
include/freetype/config/ftoption.h (FT_CONFIG_OPTION_ERROR_STRINGS):
New macro.
2018-08-30 14:30:46 +02:00
Armin Hasitzka d20dc3928b [errors] Introduce `FT_Error_String'.
* include/freetype/fterrors.h (FT_Error_String),
src/base/fterrors.c (FT_Error_String): Implement `FT_Error_String'.

* src/base/ftbase.c, src/base/Jamfile (_source),
src/base/rules.mk (BASE_SRC): Add `fterrors.c' to the build logic.

* src/base/ftdebug.c (FT_Throw): Use `FT_Error_String'.
2018-08-30 14:09:04 +02:00
Werner Lemberg 19be8620ec Doc fix. 2018-08-29 18:15:03 +02:00
Werner Lemberg 14dff08f37 ftoption.h: s/precendence/precedence/ in documentation (#54586). 2018-08-29 06:56:21 +02:00
Werner Lemberg 2c8e6279a7 Minor doc fix. 2018-08-28 08:02:13 +02:00
Werner Lemberg b287c80b6a Various minor clean-ups.
* src/base/ftapi.c: Remove.  Unused.
* src/base/Jamfile (_sources): Updated.

* src/base/ftstream.c (FT_Stream_ReleaseFrame): Remove redundant
code.
2018-08-26 06:39:43 +02:00
Nikhil Ramakrishnan ae5d1a4cec * include/*.*: Convert comments to markdown.
This commit was created by applying scripts `markify.py' and
`markdown-format.bash' to all C header files, followed by minor
clean-up.

No change in functionality, of course.

Scripts used:
https://github.com/nikramakrishnan/freetype-docs.git: Commit dfce31e.

http://lists.nongnu.org/archive/html/freetype-devel/2018-08/msg00013.html:
With patches applied.
2018-08-25 16:16:56 +05:30
Werner Lemberg 77f0814a31 Add macros for handling over-/underflowing `FT_Int64' values.
* include/freetype/internal/ftcalc.h (ADD_INT64, SUB_INT64,
MUL_INT64, DIV_INT64) [FT_LONG64]: New macros.

* src/base/ftcalc.c (ft_corner_orientation) [FT_LONG64]: Use
`SUB_INT64' and `MUL_INT64'.

Reported as

  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=10028
2018-08-23 17:53:54 +02:00
Werner Lemberg c90cc6443b ftbitmap.h: Improve documentation. 2018-08-23 13:13:20 +02:00
Werner Lemberg a3e842f9c6 Minor formatting and documentation fixes. 2018-08-22 10:30:08 +02:00
Werner Lemberg 4873eb1d31 Update `CHANGES' file. 2018-08-19 07:27:21 +02:00
Werner Lemberg a0dd16fb3d Don't use `trace_' prefix for FT_COMPONENT arguments.
* include/freetype/internal/ftdebug.h (FT_TRACE_COMP,
FT_TRACE_COMP_): New auxiliary macros to add `trace_' prefix.
(FT_TRACE): Use `FT_TRACE_COMP'.

*/* (FT_COMPONENT): Updated.
2018-08-15 18:13:17 +02:00
Armin Hasitzka 37c7b81794 Remove deprecated constant in documentation.
* include/freetype/ftdriver.h: Suggest using `FT_HINTING_ADOBE' since
`FT_CFF_HINTING_ADOBE' is deprecated.
2018-08-12 01:42:00 +02:00
Werner Lemberg 5b904409fc * src/base/ftcalc.c (FT_Matrix_Check): Fix integer overflow.
Reported as

  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=9811
2018-08-11 06:41:35 +02:00
Nikhil Ramakrishnan 1a21ca7b91 Minor formatting. 2018-08-10 19:32:31 +05:30
Werner Lemberg c9bbc2419a Add internal functions `FT_Trace_Disable' and `FT_Trace_Enable'.
It sometimes makes sense to suppress tracing informations, for
example, if it outputs identical messages again and again.

* include/freetype/internal/ftdebug.h: Make `ft_trace_levels' a
pointer.
(FT_Trace_Disable, FT_Trace_Enable): New declarations.

* src/base/ftdebug.c (ft_trace_levels): Rename to...
(ft_trace_levels_enabled): ... this.
(ft_trace_levels_disabled): New array.
(ft_trace_levels): New pointer.
(FT_Trace_Disable, FT_Trace_Enable): Implement.
(ft_debug_init): Updated.
2018-08-08 18:12:31 +02:00
Werner Lemberg 7ec9598f47 More comment formattings.
This helps in the forthcoming transition to markdown syntax.
2018-08-06 17:35:14 +02:00
Werner Lemberg b09e773591 * devel/ftoption.h: Synchronize with main `ftoption.h'. 2018-08-06 11:02:51 +02:00
Werner Lemberg 86e7385342 Minor comment formatting. 2018-08-06 10:24:08 +02:00
Werner Lemberg 85e8bea4fd Minor documentation improvement. 2018-07-31 10:42:21 +02:00
Werner Lemberg 6e6acdcb0e Document FT_Module_Class's `module_interface' field. 2018-07-26 07:22:43 +02:00
Alexei Podtelezhnikov 4b97ab98a8 [build] Fortify dllexport/dllimport attributes (#53969,#54330).
We no longer use predefined _DLL, which can be defined for static
builds too with /MD. We use DLL_EXPORT and DLL_IMPORT instead,
following libtool convention.

* CMakeLists.txt [WIN32], builds/windows/vc2010/freetype.vcxproj:
Define DLL_EXPORT manually.

* include/freetype/config/ftconfig.h, builds/unix/ftconfig.in,
builds/vms/ftconfig.h, builds/windows/vc2010/index.html,
src/base/ftver.rc: /_DLL/d, s/FT2_DLLIMPORT/DLL_IMPORT/.
2018-07-24 23:01:34 -04:00
Werner Lemberg 5434faadf4 Fix links.
Reported by Ankit and Nikhil.
2018-07-22 07:34:53 +02:00
Werner Lemberg 9395558533 Minor comment improvement. 2018-07-21 23:46:19 +02:00
Werner Lemberg a2370f21b5 Improve stream extraction macro documentation. 2018-07-21 07:38:13 +02:00
Werner Lemberg 8f09eb5ce0 Allow FT_ENCODING_NONE for `FT_Select_Charmap'.
This is a valid encoding tag for BDF, PCF, and Windows FNT, and
there is no reason to disallow it for these formats.

* src/base/ftobjs.c (FT_Select_Charmap): Implement it.
2018-07-17 21:45:24 +02:00
Armin Hasitzka fda356b742 * include/freetype/internal/ftcalc.h: Add macros for handling
harmless over-/underflowing `FT_Int' values.

* src/sfnt/sfdriver.c (fixed2float): Fix negation of
`(int)(-2147483648)'.

Reported as

  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=9423
2018-07-16 18:45:23 +02:00
Werner Lemberg 396051daee s/xxx specific foo/xxx-specific foo/. 2018-07-02 15:52:36 +02:00
Werner Lemberg 7edc937fe6 s/palette_types/palette_flags/.
Suggested by Behdad.
2018-07-02 11:50:04 +02:00
Werner Lemberg 4e3b2473d8 Make `FT_Get_Color_Glyph_Layer' return FT_Bool.
* include/freetype/freetype.h, src/base/ftobjs.c
(FT_Get_Color_Glyph_Layer, FT_Render_Glyph_Internal): Updated.

* include/freetype/internal/sfnt.h (TT_Get_Colr_Layer_Func),
src/sfnt/ttcolr.h, src/sfnt/ttcolr.c (tt_face_get_colr_layer):
Updated.
2018-07-02 11:41:44 +02:00
Werner Lemberg cc3333902b New base function `FT_Matrix_Check' (#54019).
* src/base/ftcalc.c (FT_Matrix_Check): New base function to properly
reject degenerate font matrices.

* include/freetype/internal/ftcalc.h: Updated.

* src/cff/cffparse.c (cff_parse_font_matrix), src/cid/cidload.c
(cid_parse_font_matrix), src/type1/t1load.c (t1_parse_font_matrix),
src/type42/t42parse.c (t42_parse_font_matrix): Use
`FT_Matrix_Check'.
2018-06-24 06:26:09 +02:00
Werner Lemberg 9027233f75 s/FT_PALETTE_USABLE_WITH_/FT_PALETTE_FOR_/.
* include/freetype/ftcolor.h, include/freetype/internal/sfnt.h,
src/sfnt/ttcolr.c: Do it.
2018-06-21 00:21:09 +02:00
Werner Lemberg a56e4bf7a2 Oops! 2018-06-18 23:18:07 +02:00
Nikhil Ramakrishnan 779c8c4050 Some more minor doc fixes. 2018-06-18 15:17:13 +05:30
Werner Lemberg 95f7341d81 More minor doc fixes. 2018-06-18 11:10:14 +02:00
Werner Lemberg ce8517b474 Minor documentation fixes. 2018-06-18 10:22:42 +02:00
Werner Lemberg 877d80944b Introduce `@example:' subsections. 2018-06-18 10:08:17 +02:00
Werner Lemberg fc40469a6f Add example for `FT_Get_Color_Glyph_Layer'. 2018-06-18 09:23:18 +02:00
Alexei Podtelezhnikov b1a3c59f8d [base] Introduce `FT_New_Glyph'.
This function facilitates access to full capabilities of FreeType
rendering engine for custom glyphs. This can be quite useful for
consistent rendering of mathematical and chemical formulas, e.g.

  https://bugs.chromium.org/p/chromium/issues/detail?id=757078

* include/freetype/ftglyph.h, src/base/ftglyph.c (FT_New_Glyph): New
function.
2018-06-17 22:33:29 -04:00
Nikhil Ramakrishnan e13599a036 Change documentation markup tags to lowercase.
Implemented as per discussion in

  http://lists.nongnu.org/archive/html/freetype-devel/2018-06/msg00073.html

No change in functionality, of course.
2018-06-18 03:40:29 +05:30
Werner Lemberg 19d8687f0b Fix documentation indentation; s/@const/@enum/; harmonize doc keywords. 2018-06-17 11:22:37 +02:00
Werner Lemberg da84691914 [base] Add tracing for `FT_Bitmap_Blend'.
* include/freetype/internal/fttrace.h (trace_bitmap): New
enumeration.

* src/base/ftbitmap.c (FT_COMPONENT): Define.
(FT_Bitmap_Blend): Add `FT_TRACE5' calls.
2018-06-17 09:30:05 +02:00
Werner Lemberg e361cc6a75 s/trace_bitmap/trace_checksum/.
* include/freetype/internal/fttrace.h: s/bitmap/checksum/.

* src/base/ftobjs.c (FT_COMPONENT): s/trace_bitmap/trace_checksum/.
Adjust code.
2018-06-17 09:13:37 +02:00
Nikhil Ramakrishnan a150b5ab53 Minor formatting. 2018-06-16 15:53:15 +05:30
Werner Lemberg 68bc56f864 Add `FT_Bitmap_Blend' API.
Still missing: Support for negative bitmap pitch and subpixel offset
of source bitmap.

* include/freetype/ftbitmap.h, src/base/ftbitmap.c
(FT_Bitmap_Blend): New function.
2018-06-16 09:39:29 +02:00
Werner Lemberg 9b31c44620 Replace `FT_Get_GlyphLayers' with `FT_Get_Color_Glyph_Layer'.
This avoids any additional allocation of COLR related structures in
a glyph slot.

* include/freetype/freetype.h (FT_Glyph_Layer, FT_Glyph_LayerRec,
FT_Get_GlyphLayers): Removed.

* include/freetype/internal/ftobjs.h (FT_Colr_InternalRec): Removed.
(FT_Slot_InternalRec): Remove `color_layers'.

* include/freetype/internal/sfnt.h (TT_Load_Colr_Layer_Func):
Removed.
(SFNT_Interface, FT_DEFINE_SFNT_INTERFACE): Remove
`load_colr_layer'.

* src/base/ftobjs.c (ft_glyph_slot_done): Updated.
(FT_Render_Glyph_Internal): Use `FT_Get_Color_Glyph_Layer'.
(FT_Get_GlyphLayers): Removed.

* src/sfnt/sfdriver.c (sfnt_interface): Updated.

* src/sfnt/ttcolr.c (tt_face_load_colr_layers): Removed.
* src/sfnt/ttcolr.h: Updated.

* src/truetype/ttgload.c (TT_Load_Glyph): Updated.
2018-06-14 21:30:43 +02:00
Werner Lemberg f9d05eb326 Provide iterative API to access `COLR' data.
This solution doesn't store any data in an `FT_GlyphSlot' object.

* include/freetype/freetype.h (FT_LayerIterator): New structure.
(FT_Get_Color_Glyph_Layer): New function.

* include/freetype/internal/sfnt.h (TT_Get_Colr_Layer_Func): New
function type.
(SFNT_Interface, FT_DEFINE_SFNT_INTERFACE): Add it.

* src/base/ftobjs.c (FT_Get_Color_Glyph_Layer): Implement it.

* src/sfnt/ttcolr.c (tt_face_get_colr_layer): New function.
* src/sfnt/ttcolr.h: Updated.

* src/sfnt/sfdriver.c (sfnt_interface): Updated.
2018-06-14 21:17:17 +02:00
Werner Lemberg 33ac83e376 Add glyph index and glyph load flags to glyph slot.
* include/freetype/freetype.h (FT_GlyphSlotRec): Rename unused
`reserved' field to `glyph_index'.

* include/freetype/internal/ftobjs.h (FT_Slot_InternalRec): Add
`load_flags' field.

* src/base/ftobjs.c (FT_Load_Glyph): Set new fields.
2018-06-14 21:00:23 +02:00
Werner Lemberg a44e20879c [sfnt] Move `CPAL' stuff into separate files.
* src/sfnt/sfdriver.c: Include `ttcpal.h'.
* src/sfnt/sfnt.c: Include `ttcpal.c'.

* src/sfnt/ttcolr.c, src/sfnt/ttcolr.h: Move CPAL stuff to ...
* src/sfnt/ttcpal.c, src/sfnt/ttcpal.c: ... these new files.

* src/sfnt/Jamfile (_sources), src/sfnt/rules.mk (SFNT_DRV_SRC):
Updated.

* include/freetype/internal/fttrace.h: Add support for `colr' and
`cpal'.
Sort entries.
2018-06-14 11:32:47 +02:00
Werner Lemberg 54b332aaf9 [sfnt] Separate `CPAL' and `COLR' table handling.
Later on we want to support the `SVG' table also, which needs `CPAL'
(but not `COLR').

* include/freetype/internal/sfnt.h (SFNT_Interface): Add `load_cpal'
and `free_cpal' fields.
(FT_DEFINE_SFNT_INTERFACE): Updated.

* include/freetype/internal/tttypes.h (TT_FaceRec): Replace
`colr_and_cpal' fields with `cpal' and `colr'.

* src/sfnt/sfdriver.c (sfnt_interface): Updated.

* src/sfnt/sfobjs.c (sfnt_load_face, sfnt_done_face): Updated.

* src/sfnt/ttcolr.c (Colr, Cpal): Add `table' field.
(ColrCpal): Removed.
(tt_face_load_colr): Split off CPAL handling into...
(tt_face_load_cpal): ... this new function.
(tt_face_free_colr): Split off CPAL handling into...
(tt_face_free_cpal): ... this new function.
(tt_face_load_colr_layers, tt_face_palette_set): Updated.

* src/sfnt/ttcolr.h: Updated.

* src/truetype/ttgload.c (TT_Load_Glyph): Updated.
2018-06-13 08:46:27 +02:00
Werner Lemberg 45145d348f Finish CPAL/COLR support (3/4).
* src/base/ftcolor.c: Include FT_INTERNAL_SFNT_H.
(FT_Palette_Select, FT_Palette_Set_Foreground_Color): Implement
functions.
2018-06-13 06:11:28 +02:00
Werner Lemberg b85d4e8f04 Finish CPAL/COLR support (2/4).
* src/sfnt/ttcolr.c (tt_face_palette_set): New function.
(tt_face_load_colr): Allocate `face->palette' and call
`tt_face_palette_set'.
Adjust return error code in case of error.

* src/sfnt/ttcolr.h: Updated.

* include/freetype/internal/sfnt.h (TT_Set_Palette_Func): New
function type.
(SFNT_Interface, FT_DEFINE_SFNT_INTERFACE): Add it.

* src/sfnt/sfdriver.c (sfnt_interface), src/sfnt/sfobjs.c
(sfnt_done_face): Updated.
2018-06-13 06:11:28 +02:00
Werner Lemberg 7542f030ec Finish CPAL/COLR support (1/4).
* include/freetype/internal/tttypes.h (TT_FaceRec): New fields
`palette_index', `palette', `have_foreground_color' and
`foreground_color'.
2018-06-13 06:11:27 +02:00
Alexei Podtelezhnikov 04338a5e52 Doc fixes and improvements. 2018-06-12 21:59:15 -04:00
Werner Lemberg b18f5e7c62 Minor doc fixes. 2018-06-11 09:02:25 +02:00
Werner Lemberg d8b8b6e34e s/FT_Palette/FT_Palette_Data/, s/palette/palette_data/.
* include/freetype/ftcolor.h, include/freetype/internal/tttypes.h,
src/base/ftcolor.c, src/sfnt/sfobjs.c, src/sfnt/ttcolr.c: Updated.
2018-06-10 21:37:15 +02:00
Werner Lemberg c412de52fb [sfnt] Read `CPAL' version 1 tables.
* include/freetype/internal.tttypes.h: Include FT_COLOR_H.
(TT_FaceRec): Add `palette' field.

* src/sfnt/ttcolr.c: Include FT_COLOR_H.
(Cpal): Remove all data covered by the new `palette' field in
`TT_FaceRec'.
(tt_face_load_colr): Updated.
Read `CPAL' version 1 data.
(tt_face_load_colr_layers, tt_face_find_color): Updated.

* src/sfnt/sfobjs.c (sfnt_done_face): Free glyph color palette data.
2018-06-09 23:56:21 +02:00
Alexei Podtelezhnikov 8f1ed54877 [base] API for Harmony LCD rendering.
This introduces `FT_Library_SetLcdGeometry' for setting up arbitrary
LCD subpixel geometry including non-striped patterns.

* src/base/ftlcdfil.c (FT_Library_SetLcdGeometry): New function.
* include/freetype/ftlcdfil.h: Document it.
* include/freetype/freetype.h: Minor.
* include/freetype/ftchapters.h: Minor.
2018-06-07 02:48:48 -04:00
Werner Lemberg 44580515d8 Minor. 2018-06-07 06:49:44 +02:00
Werner Lemberg f87ced9dc9 ftcolor.h: Redesign API.
While going to implement it I noticed that I need access to most of
the `CPAL' elements; I thus plan to add a `cpal' field to
`TT_FaceRec', which makes most of the previously suggested API
functions obsolete because the fields will be directly accessable.
2018-06-06 17:49:17 +02:00
Werner Lemberg 7c7004d60c New `ftcolor.h' draft. 2018-06-06 17:37:51 +02:00
Nikhil Ramakrishnan 78d85b9c84 Restore missing comment lines and other minor fixes 2018-06-04 20:33:56 +05:30
Sender Ghost cc62677224 Restore accidentally removed, commented-out configuration options. 2018-06-04 10:49:23 +02:00
Werner Lemberg f999375a9a [GSoC] include/*.*, devel/*.*: Convert block comments to `light' style.
This second and final monster commit was created by applying Nikhil's
scripts `docconverter.py' and `markify.py' to all C header and source files,
followed up by minor manual clean-up.

No change in functionality, of course.

I used commit f7419907bc6044b9b7057f9789866426c804ba82 from
https://github.com/nikramakrishnan/freetype-docs.git.
2018-06-03 22:00:42 +02:00
Werner Lemberg dc170dea33 Typos. 2018-06-03 21:23:52 +02:00
Alexei Podtelezhnikov 250b0c624a Shorten LCD filtering docs. 2018-05-30 23:29:41 -04:00
Werner Lemberg db7c406084 ftcolor.h: Improve API design, fix typos (#54011, #54014).
* include/freetype/ftcolor.h (FT_Palette_Get_Names): Replace with...
(FT_Palette_Get_Name_IDs): ... this function.
(FT_Palette_Get_Entry_Names): Replace with...
(FT_Palette_Get_Entry_Name_IDs): ... this function
s/FT_Palette_Set_Foreground_COlor/FT_Palette_Set_Foreground_Color/.
2018-05-30 21:23:10 +02:00
Werner Lemberg ae2cd1b749 Various minor color fixes.
* include/freetype/config/ftheader.h (FT_COLOR_H): New macro.

* include/freetype/internal/ftobjs.h (FT_Colr_Internal): Change
type of `load_flags' to `FT_Int32'.

* include/freetype/internal/sfnt.h (TT_Load_Colr_Layer_Func): Change
type of `idx' to `FT_UInt'.
(TT_Blend_Colr_Func): Change type of `color_index' to `FT_UInt'.

* src/base/ftobjs.c (FT_Render_Glyph_Internal): Change type of
`load_flags' to `FT_Int32'.

* src/sfnt/ttcolr.c (find_base_glyph_record,
tt_face_load_colr_layers): Change type of `glyph_id' to `FT_UInt'.
(tt_face_find_color, tt_face_colr_blend_layer): Change type of
`color_index' to `FT_UInt'.
Fix signedness and type issues.

* src/sfnt/ttcolr.h: Updated.
2018-05-30 09:34:57 +02:00
Alexei Podtelezhnikov 7b73cb0707 [smooth] Formalize Harmony LCD rendering.
This generalizes magic outline shifts that make Harmony LCD
rendering work in terms of precise two-dimensional RGB subpixel
positions. These coordinates are now set in time of the `smooth'
module initialization and later used to shift a glyph outline for
rendering. FT_RENDER_MODE_LCD and FT_RENDER_MODE_LCD_V use the same
coordinates. The letter, however, rotates them before using.
The LCD bitmap padding is also calculated using these coordinates.

* include/freetype/internal/ftobjs.h (FT_LibraryRec): New array field
`lcd_geometry'.
* src/base/ftlcdfil.c (ft_lcd_padding): Reworked.
* src/base/ftobjs.c (ft_glyphslot_preset_bitmap): Updated accordingly.

* src/smooth/ftsmooth.c [!FT_CONFIG_OPTION_SUBPIXEL_RENDERING]
(ft_smooth_init): Initialize `lcd_geometry'.
(ft_smooth_render_generic): Formalize outline shifts.
2018-05-24 22:38:24 -04:00
Werner Lemberg 3fcb4cfa26 Oops! 2018-05-22 09:12:21 +02:00
Werner Lemberg 3360ca5853 [truetype] Reject elements of composites with invalid glyph indices.
Reported as

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

* src/truetype/ttgload.c (TT_Load_Composite_Glyph): Implement it.
2018-05-22 09:06:24 +02:00
Werner Lemberg 93363cd737 * include/freetype/ftcolor.h: New file.
This is an interface to the `CPAL' OpenType table.  No
implementation yet.
2018-05-20 22:50:36 +02:00
Alexei Podtelezhnikov 2f218a4c3a * include/freetype/internal/ftcalc.h (FT_MSB): Verified `_MSC_VER'.
Actually `_BitScanReverse' is available since VS2005.
2018-05-18 08:57:30 -04:00
Werner Lemberg 840b844301 * include/freetype/internal/ftcalc.h (FT_MSB): Use `_MSC_VER' value.
Older VC versions don't provide `_BitScanReverse'.  We test for VC
2013.

Reported by John Emmas <john@creativepost.co.uk>.
2018-05-18 10:57:51 +02:00
Werner Lemberg 3331b84fc2 Minor comment fixes. 2018-05-18 07:19:57 +02:00
Werner Lemberg 2cac1c3542 s/inline/__inline/ for MSVC.
Reported by John Emmas <john@creativepost.co.uk>.

* include/freetype/internal/ftcalc.h (FT_MSB) [_MSC_VER]: Do it.
2018-05-17 19:40:44 +02:00
Werner Lemberg 583dabf291 Add function `FT_Get_GlyphLayers' to access `COLR' table data.
* include/freetype/internal/ftobjs.h (FT_Glyph_LayerRec): Move this
structure to...
* include/freetype/freetype.h (FT_Glyph_LayerRec): ... this
header file.
(FT_Glyph_Layer): New typedef.
Update code to use it where appropriate.

* src/base/ftobjs.c (FT_Get_GlyphLayers): New function.
2018-05-16 21:21:18 +02:00
Werner Lemberg c5a8a5350a Provide dummy functions if `TT_CONFIG_OPTION_SFNT_NAMES' is not set.
* src/base/ftsnames.c [!TT_CONFIG_OPTION_SFNT_NAMES]: Implement it.
2018-05-14 09:43:38 +02:00
Werner Lemberg 78db8a2570 Typo. 2018-05-13 11:53:01 +02:00
Shao Yu Zhang f04d81751a [sfnt] Preliminary support of coloured layer outlines.
This commit enables OpenType's COLR/CPAL table handling; a typical
application are color emojis that can be scaled to any size.

If the color palette does not exist or is invalid, the rendering
step rasterizes the outline instead.  The current implementation
assumes that the foreground is black.

Enable this by defining option TT_CONFIG_OPTION_COLOR_LAYERS.

There are still some issues with metrics; additionally, an API to
fetch color layers is missing.

* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_OPTION_COLOR_LAYERS): New macro.

* include/freetype/internal/ftobjs.h (FT_Glyph_LayerRec,
FT_Colr_InternalRec): New structures.
(FT_Slot_InternalRec): Add `color_layers' field.

* include/freetype/internal/sfnt.h (TT_Load_Colr_Layer_Func,
TT_Blend_Colr_Func): New function types.
(SFNT_Interface): Add `load_colr', `free_colr', `load_colr_layer',
and `colr_blend' fields.

* include/freetype/internal/tttypes.h (TT_FaceRec): Add
`colr_and_cpal' field.

* include/freetype/internal/tttags. (TTAG_COLR, TTAG_CPAL): New
macros.

* src/sfnt/ttcolr.c, src/sfnt/ttcolr.h: New files.

* src/base/ftobjs.c (ft_glyphslot_done, FT_Render_Glyph_Internal):
Handle glyph color layers.

* src/sfnt/Jamfile (_sources), src/sfnt/rules.mk (SFNT_DRV_SRC): Add
`ttcolr.c'.

* src/sfnt/sfdriver.c: Include `ttcolr.h'.
(PUT_COLOR_LAYERS): New macro.
Update call to `FT_DEFINE_SFNT_INTERFACE'.

* src/sfnt/sfnt.c: Include `ttcolr.c'.

* src/sfnt/sfobjs.c (sfnt_load_face): Load `COLR' and `CPAL' tables.
(sfnt_done_face): Updated.

* src/truetype/ttgload.c (TT_Load_Glyph): Handle color layers.
2018-05-13 03:25:09 +02:00
Arkady Shapkin 84eebf4802 Use MS VC++'s _BitScanReverse to calculate MSB (patch #9636).
* include/freetype/internal/ftcalc.h (FT_MSB) [_MSC_VER]: Implement
it.
2018-05-12 06:18:07 +02:00
suzuki toshiya 2b3e0ef6c0 Support symbol visibility features of Sun / Oracle C compilers.
Reported by Kiyoshi Kanazawa:
https://lists.gnu.org/archive/html/freetype-devel/2018-05/msg00008.html
Thanks to the suggestions by Alexei and Alan Coopersmith.

* builds/unix/configure.raw: Check if "-xldscope=hidden" is
accepted, and if so, it is added to CFLAGS.  This is the option
making Sun / Oracle C compilers hide the symbols from global
scope.
* include/freetype/config/ftconfig.h: Use "__global" prefix
for FT_EXPORT() macro, if SunPro C is newer than Sun ONE
Studio 8 (2003).
* builds/unix/ftconfig.in: Ditto.
* builds/vms/ftconfig.h: Ditto.
2018-05-04 12:55:48 +09:00
Werner Lemberg 9514959241 Remove FT_CONFIG_OPTION_PIC and related code.
*/* [FT_CONFIG_OPTION_PIC]: Remove all code guarded by this
preprocessor symbol.

*/*: Replace `XXX_GET' macros (which could be either a function in
PIC mode or an array in non-PIC mode) with `xxx' arrays.

* include/freetype/internal/ftpic.h, src/autofit/afpic.c,
src/autofit/afpic.h, src/base/basepic.c, src/base/basepic.h,
src/base/ftpic.c, src/cff/cffpic.c, src/cff/cffpic.h,
src/pshinter/pshpic.c, src/pshinter/pshpic.h, src/psnames/pspic.c,
src/psnames/pspic.h, src/raster/rastpic.c, src/raster/rastpic.h,
src/sfnt/sfntpic.c, src/sfnt/sfntpic.h, src/smooth/ftspic.c,
src/smooth/ftspic.h, src/truetype/ttpic.c, src/truetype/ttpic.h:
Removed.
2018-05-02 20:27:48 +02:00
Werner Lemberg 86bc8a9505 * Version 2.9.1 released.
=========================

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

* docs/VERSION.TXT: Add entry for version 2.9.1.
* docs/CHANGES: Updated.

* README, Jamfile (RefDoc), builds/windows/vc2005/freetype.vcproj,
src/base/ftver.rc, builds/windows/vc2005/index.html,
builds/windows/vc2008/freetype.vcproj,
builds/windows/vc2008/index.html,
builds/windows/vc2010/freetype.vcxproj,
builds/windows/vc2010/index.html,
builds/windows/visualc/freetype.dsp,
builds/windows/visualc/freetype.vcproj,
builds/windows/visualc/index.html,
builds/windows/visualce/freetype.dsp,
builds/windows/visualce/freetype.vcproj,
builds/windows/visualce/index.html,
builds/wince/vc2005-ce/freetype.vcproj,
builds/wince/vc2005-ce/index.html,
builds/wince/vc2008-ce/freetype.vcproj,
builds/wince/vc2008-ce/index.html: s/2.9/2.9.1/, s/29/291/.

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

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

* include/freetype/ftgasp.h: Use FT_BEGIN_HEADER and FT_END_HEADER.
2018-05-01 20:37:24 +02:00
Alexei Podtelezhnikov 92e4662ba6 Documentation tweaks. 2018-04-19 17:57:42 -04:00
Werner Lemberg 578dafd6b4 Minor comment improvement. 2018-04-03 11:31:22 +02:00
Alexei Podtelezhnikov fa6da7bf6d Documentation improvement. 2018-03-26 21:40:18 -04:00
Werner Lemberg 61ee69a66e Typo. 2018-03-24 05:53:22 +01:00
Werner Lemberg 5955b77b1d Minor documentation improvement. 2018-03-03 09:21:59 +01:00
Werner Lemberg 63aaf89cec s/sub-pixel/subpixel/. 2018-02-17 10:34:47 +01:00
Alexei Podtelezhnikov f4a3255d45 [unix] Use -fvisibility=hidden.
It is now widely recommended that ELF shared libraries hide symbols
except those with explicit __attribute__((visibility("default"))).
This is supported by all major compilers and should rather be an
option in libtool.

* builds/unix/configure.raw: Add -fvisibility=hidden to CFLAGS.
* builds/unix/ftconfig.in, builds/vms/ftconfig.h,
include/freetype/config/ftconfig.h (FT_EXPORT): Use visibility
attribute.
2018-02-04 00:09:02 -05:00
Alexei Podtelezhnikov d2d1750e08 [build] Expand dllexport/dllimport to Cygwin/MinGW.
* include/freetype/config/ftconfig.h: Respect DLL_EXPORT,
s/_MSC_VER/_WIN32/.
* builds/unix/ftconfig.in: Replicate here.
* builds/vms/ftconfig.h: Replicate here.
2018-01-12 23:01:49 -05:00
Alexei Podtelezhnikov e8b38f899c [build] Improve and document MSVC build.
* include/freetype/config/ftconfig.h: Guard dllexport/dllimport
attributes with _DLL and FT2_DLLIMPORT.
* builds/windows/vc2010/index.html: Update documentation.
2018-01-12 08:57:08 -05:00
Werner Lemberg 67a42aa887 * Version 2.9 released.
=======================

Tag sources with `VER-2-9'.

* docs/VERSION.TXT: Add entry for version 2.9.

* README, Jamfile (RefDoc), builds/windows/vc2005/freetype.vcproj,
builds/windows/vc2005/index.html,
builds/windows/vc2008/freetype.vcproj,
builds/windows/vc2008/index.html,
builds/windows/vc2010/freetype.vcxproj,
builds/windows/vc2010/index.html,
builds/windows/visualc/freetype.dsp,
builds/windows/visualc/freetype.vcproj,
builds/windows/visualc/index.html,
builds/windows/visualce/freetype.dsp,
builds/windows/visualce/freetype.vcproj,
builds/windows/visualce/index.html,
builds/windows/ftver.rc,
builds/wince/vc2005-ce/freetype.vcproj,
builds/wince/vc2005-ce/index.html,
builds/wince/vc2008-ce/freetype.vcproj,
builds/wince/vc2008-ce/index.html: s/2.8.1/2.9/, s/281/29/.

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

* builds/unix/configure.raw (version_info): Set to 22:0:16.
* CMakeLists.txt (VERSION_PATCH): Set to 1.
2018-01-08 12:30:04 +01:00
Werner Lemberg 9e7b24f290 Next release will be 2.9. 2018-01-08 11:16:11 +01:00
Werner Lemberg 3758aed760 Add `FT_Done_MM_Var'.
This is necessary in case the application's memory routines differ
from FreeType.  A typical example is a Python application on Windows
that calls FreeType compiled as a DLL via the `ctypes' interface.

* include/freetype/ftmm.h, src/base/ftmm.c (FT_Done_MM_Var): Declare
and define.

* docs/CHANGES: Updated.
2018-01-06 08:39:36 +01:00
Werner Lemberg b720070988 Minor doc fixes. 2018-01-06 08:39:30 +01:00
Alexei Podtelezhnikov 20b3e34846 Move internal LCD-related declarations.
* include/freetype/ftlcdfil.h (ft_lcd_padding, ft_lcd_filter_fir):
Move from here...
* include/freetype/internal/ftobjs.h: ... to here.
2018-01-02 22:12:09 -05:00
Alexei Podtelezhnikov c94d042be6 * include/freetype/config/ftconfig.h (FT_EXPORT, FT_EXPORT_DEF)
[_MSC_VER]: Limit Visual C++ attributes.
2018-01-02 21:38:35 -05:00
Werner Lemberg 0a0c22569d Update copyright year. 2018-01-02 09:33:57 +01:00
Werner Lemberg 8470cee8aa Updated `CHANGES' file. 2017-12-30 20:50:50 +01:00
Werner Lemberg 3cc88e2e44 Fixes for `make multi'.
* include/freetype/internal/ftpsprop.h: Use `FT_BASE_CALLBACK'.
(ps_property_get): Harmonize declaration with corresponding
function typedef.

* include/freety[e/internal/fttrace.h: Add `trace_psprops'.

* src/base/ftpsprop.c: Include necessary header files.
(FT_COMPONENT): Define.
(ps_property_set): Tag with `FT_BASE_CALLBACK_DEF'.
(ps_property_get): Tag with `FT_BASE_CALLBACK_DEF'.
Harmonize declaration with corresponding function typedef.
2017-12-27 08:19:09 +01:00
Werner Lemberg 1063690174 Provide support for intra-module callback functions.
This is needed especially for `make multi' with C++.

* include/freetype/config/ftconfig.h (FT_BASE_CALLBACK,
FT_BASE_CALLBACK_DEF): New macros.
2017-12-27 08:13:13 +01:00
Werner Lemberg dd6330d74b Add missing ChangeLog entry, copyright notices, whitespace, formatting. 2017-12-27 08:06:47 +01:00
Ewald Hew a956e36c8d Move PostScript drivers' property handlers to `base'
This reduces the amount of duplicated code across PostScript drivers.

* src/cff/cffdrivr.c, src/cid/cidriver.c, src/type1/t1driver.c
({cff,cid,t1}_property_{get,set}): Moved to...
* include/freetype/internal/ftpsprop.h: ...this new file.
(ps_property_{get,set}): New functions to replace moved ones.
* src/base/ftpsprop.c: Implement above functions.

* include/freetype/internal/internal.h (FT_INTERNAL_POSTSCRIPT_PROPS_H):
New macro.
* src/cff/cffdrivr.c, src/cid/cidriver.c, src/type1/t1driver.c: Updated.

* src/base/Jamfile, src/base/rules.mk, src/base/ftbase.c: Updated.
2017-12-25 12:53:21 +08:00
Werner Lemberg 08cd62deed Speed up FT_Set_Var_{Design,Blend}_Coordinates if curr == new.
We exit early if the current design or blend coordinates are
identical to the new ones.

* src/truetype/ttgxvar.c (tt_set_mm_blend, TT_Set_Var_Design):
Implement it, returning internal error code -1 if there will be no
variation change.

* src/type1/t1load.c (t1_set_mm_blend): Ditto.

* src/base/ftmm.c (FT_Set_Var_Design_Coordinates,
FT_Set_MM_Blend_Coordinates, FT_Set_Var_Blend_Coordinates): Updated.
2017-12-20 22:06:19 +01:00
Werner Lemberg 81dea49321 Documentation fixes for the last few commits. 2017-12-08 20:32:23 +01:00
Werner Lemberg 98ba0c4a37 New `ftdriver.h' file, covering all driver modules.
This reduces redundancy and increases synergy; it also reduces the
number of header files.

* include/freetype/config/ftheader.h (FT_DRIVER_H): New macro.
(FT_AUTOHINTER_H, FT_CFF_DRIVER_H, FT_TRUETYPE_DRIVER_H,
FT_PCF_DRIVER_H, FT_TYPE1_DRIVER_H): Make them aliases to
FT_DRIVER_H.

* include/freetype/ftautoh.h, include/freetype/ftcffdrv.h,
include/freetype/ftpcfdrv.h, include/freetype/ftt1drv.h,
include/freetype/ftttdrv.h: Replaced with...
* include/freetype/ftdriver.h: ...this new file.
(FT_CFF_HINTING_ADOBE, FT_T1_HINTING_ADOBE): Renamed to...
(FT_HINTING_ADOBE): ... this new macro.
(FT_CFF_HINTING_FREETYPE, FT_T1_HINTING_FREETYPE): Renamed to...
(FT_HINTING_FREETYPE): ... this new macro.

* src/*/*: Updated accordingly.
2017-12-08 18:41:49 +01:00
Werner Lemberg bef8de2a85 Move `ftdriver.h' to `ftdrv.h'.
* include/freetype/internal/ftdriver.h: Renamed to...
* include/freetype/internal/ftdrv.h: ... this name.

* include/freetype/internal/internal.h (FT_INTERNAL_DRIVER_H):
Updated.
2017-12-08 10:02:12 +01:00
Werner Lemberg c3cbb440af Use ASCII only in public header files (#50858). 2017-12-07 16:26:36 +01:00
Werner Lemberg 63b91548e0 Fix `make multi'.
* include/freetype/internal/fttrace.h: Remove unused tracing macros.
s/pshalgo2/pshalgo/.
Add `trace_cffdecode'.
* src/pshinter/pshalgo.c (FT_COMPONENT): Updated.

* src/cff/cffload.c: Include FT_INTERNAL_POSTSCRIPT_AUX_H.
* src/cff/cffobjs.c: Include FT_SERVICE_METRICS_VARIATIONS_H and
FT_SERVICE_CFF_TABLE_LOAD_H.

* src/cid/cidriver.c: Include FT_INTERNAL_POSTSCRIPT_AUX_H.

* src/psaux/cffdecode.c: Include FT_FREETYPE_H and
FT_INTERNAL_DEBUG_H.
(FT_COMPONENT): Define.
* src/psaux/cffdecode.h: Include FT_INTERNAL_POSTSCRIPT_AUX_H.
* src/psaux/psauxmod.h: Include FT_INTERNAL_POSTSCRIPT_AUX_H.
Declare `cff_builder_funcs' and `ps_builder_funcs'.
* src/psaux/psft.c: Include `psobjs.h' and `cffdecode.h'.
* src/psaux/psobjs.c : Include `psauxmod.h'.
2017-12-07 14:33:44 +01:00
Werner Lemberg 7ec1345d13 * include/freetype/config/ftheader.h: Some clean-up.
This commit removes documentation of deprecated macros and does some
minor streamlining.
2017-12-07 14:21:39 +01:00
Werner Lemberg ed7f091323 New header file `ftparams.h' that collects all parameter tags.
* include/freetype/config/ftheader.h (FT_PARAMETER_TAGS_H): New
macro.
(FT_TRUETYPE_UNPATENTED_H, FT_UNPATENTED_HINTING_H): Define it to
`ftparams.h'.

* include/freetype/ftautoh.h, include/freetype/ftcffdrv.h,
include/freetype/ftincrem.h, include/freetype/ftlcdfil.h,
include/freetype/ftsnames.h, include/freetype/ftt1drv.h: Include
FT_PARAMETER_TAGS_H.
Move FT_PARAM_TAG_XXX definitions to...
* include/freetype/ftparams.h: ...this new file.

* include/freetype/ttunpat.h: Remove.  No longer needed.
2017-12-06 23:15:54 +01:00
Werner Lemberg 87ddad2007 Update or fix links to use the https protocol instead of http. 2017-12-04 20:43:30 +01:00
Werner Lemberg 8f4851997b [unix] Install a massaged `ftoption.h' file (#51780).
* builds/unix/configure.raw (ftoption_set, ftoption_unset): New
auxiliary functions to construct...
(FTOPTION_H_SED): ... this new variable.
Apply it as a sed argument while copying `ftoption.h' to the
`builds/unix' directory (using `AC_CONFIG_FILES').
Simplify code of test that checks cpp's computation of bit length
(the test previously created an empty `ftoption.h' file and deleted
it immediately afterwards); without this change, it can happen on my
GNU/Linux box that `configure's execution of `config.status' doesn't
create `ftoption.h' (no idea why this happens).

* builds/unix/install.mk (install): Install
`builds/unix/ftoption.h'.

* builds/unix/unix-def.in (DISTCLEAN): Updated.

* builds/unix/.gitignore: Updated.
2017-11-25 11:30:38 +01:00
Ewald Hew b9bd2d14e2 [psaux] Fix CFF advance widths. (#52466)
Glyph advance widths were being written to the new `PS_Decoder' but not
saved to the underlying format specific decoder. This caused pure CFF
fonts to have bad advance width.

* include/freetype/internal/psaux.h (PS_Decoder): Change `glyph_width'
field to pointer.
Remove unused fields.
* src/psaux/psobjs.c (ps_decoder_init): Change `glyph_width' from copy
to reference.
Remove unused.
* src/psaux/psft.c (cf2_setGlyphWidth): Update code.
2017-11-22 12:38:36 +08:00
Vlad Tsyrklevich 954710ddd7 * include/freetype/ftrender.h: Fix `FT_Renderer_RenderFunc' type. 2017-11-15 23:06:29 +01:00
Ewald Hew dff40d03df Add T1_CONFIG_OPTION_OLD_ENGINE configuration option.
This controls whether the old Type 1 engine gets compiled into FreeType.
It is disabled by default.

* devel/ftoption.h, include/freetype/config/ftoption.h
(T1_CONFIG_OPTION_OLD_ENGINE): New macro.

* include/freetype/internal/psaux.h (PS_Decoder): Remove unused field.
* include/freetype/internal/psaux.h, src/cid/cidgload.c
(cid_load_glyph), src/psaux/psauxmod.c, src/psaux/psobjs.c
(ps_builder_add_point), src/psaux/t1decode.c
(t1_lookup_glyph_by_stdcharcode, t1_decoder_parse_glyph,
t1operator_seac, t1_decoder_parse_charstrings), src/psaux/t1decode.h,
src/type1/t1gload.c (T1_Parse_Glyph_And_Get_Char_String): Surround
relevant code with macro.
Minor code changes.
2017-10-12 18:32:50 +08:00
Ewald Hew 78df3c27b6 Extract width parsing from Type 1 parser.
Duplicate the fast advance width calculations from the old parser. This
is to facilitate adding options for compiling out the old parser.

* src/psaux/t1decode.{c,h} (t1_decoder_parse_metrics): New function.
* include/freetype/internal/psaux.h (T1_Decoder_Funcs): New entry
`parse_metrics'.
* src/psaux/psauxmod.c: Set the new entry.

* src/type1/t1gload.c (T1_Parse_Glyph_And_Get_Char_String),
src/cid/cidgload.c (cid_load_glyph): Separate
conditional for selecting engine.
2017-10-12 18:32:50 +08:00
Werner Lemberg 08e2e311ef Document global size metrics needed for native bytecode hinting (#52165). 2017-10-08 10:37:50 +02:00
Werner Lemberg 91448669a2 Prevent creation of an incorrect documentation entry. 2017-10-08 10:23:47 +02:00
Werner Lemberg 7bfcaacaf5 [sfnt] Adjust behaviour of PS font names for variation fonts.
* src/sfnt/sfdriver.c (sfnt_get_var_ps_name): Use a named instance's
PS name only if no variation is applied.
2017-10-07 13:14:38 +02:00