Commit Graph

198 Commits

Author SHA1 Message Date
Ankit Dhankhar 939bbee1c0 [docmaker] Make it work with python3.
* src/tools/docmaker (*.py): Use parentheses around arguments of `print'.
Remove unused imports.
2018-04-15 22:35:40 +02:00
Alexei Podtelezhnikov b1e0209829 [apinames] Anonymous version map for GNU linker.
* src/tools/apinames.c (PROGRAM_VERSION): Set to 0.3.
(OutputFormat): Add `OUTPUT_GNU_VERMAP'.
(names_dump): Handle it.
(usage): Updated.
(main): Handle new command line flag `-wL'.
2018-01-23 22:29:45 -05:00
Werner Lemberg 0a0c22569d Update copyright year. 2018-01-02 09:33:57 +01:00
Werner Lemberg ea68f1c8d3 [docmaker] Fix code section parsing.
Stuff like

  {
    <bla>
  }

confused the parser, which incorrectly treated `<bla>' as a markup
tag.

* src/tools/docmaker/content.py (ContentProcessor::process_content):
Apply `re_markup_tags' only outside of code sections.
2017-12-08 20:15:15 +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 87ddad2007 Update or fix links to use the https protocol instead of http. 2017-12-04 20:43:30 +01:00
Werner Lemberg 17eb240698 Update fuzzer-bot URL. 2017-09-14 22:39:51 +02:00
Werner Lemberg c87fec0299 [psnames] Really fix issue #49949.
We now use a separate preprocessor macro to handle both definition
and declaration of the glyph name arrays.

* src/psnames/psmodule.c (DEFINE_PS_TABLE_DATA): New macro.

* src/tools/glnames.py (StringTable::dump,
StringTable::dump_sublist): Use `DEFINE_PS_TABLE_DATA'.
(dump_encoding): Ditto.
(main): Use `wb' mode for writing the output file, which works on
Windows also.

* src/psnames/pstables.h: Regenerated.
2017-08-09 07:45:12 +02:00
Werner Lemberg 04e00b8a3d [ftfuzzer] Fix clang warnings.
* src/tools/ftfuzzer/ftfuzzer.cc (LLVMFuzzerTestOneInput): Add
casts.
2017-04-07 17:13:38 +02:00
Werner Lemberg ab840e6a4c [ftfuzzer] Minor improvement.
* src/tools/ftfuzzer/ftfuzzer.cc: Don't set intermediate axis if
bitmap strikes are active.
2017-03-18 08:50:42 +01:00
Werner Lemberg 3f92048ab1 [ftfuzzer] Limit number of tested faces and instances.
This is inspired by the discussion in and analysis of

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

* src/tools/ftfuzzer/ftfuzzer.cc (LLVMFuzzerTestOneInput): Use only
up to 20 face indices.
Use only up to 20 instance indices.
2017-03-15 09:18:22 +01:00
Werner Lemberg f87269c35c * src/tools/ftfuzzer/ftfuzzer.cc: Improve readability; formatting. 2017-03-15 08:03:16 +01:00
Alexei Podtelezhnikov ca472220a4 Typos. 2017-01-17 23:45:08 -05:00
Werner Lemberg 563ae78022 Update copyright year. 2017-01-04 20:16:34 +01:00
Werner Lemberg 248eaa4f60 Various fixes for clang's undefined behaviour sanitizer.
* src/cff/cffload.c (FT_fdot14ToFixed): Fix casting.
(cff_blend_doBlend): Don't left-shift negative numbers.
Handle 5-byte numbers byte by byte to avoid alignment issues.

* src/cff/cffparse.c (cff_parse): Handle 5-byte numbers byte by byte
to avoid alignment issues.

* src/cid/cidload (cid_read_subrs): Do nothing if we don't have any
subrs.

* src/psaux/t1decode.c (t1_decode_parse_charstring): Fix tracing.

* src/tools/glnames.py (main): Put `DEFINE_PSTABLES' guard around
definition of `ft_get_adobe_glyph_index'.

* src/psnames/pstables.h: Regenerated.

* src/psnames/psmodule.c: Inlude `pstables.h' twice to get both
declaration and definition.

* src/truetype/ttgxvar.c (FT_fdot14ToFixed, FT_intToFixed): Fix
casting.
2017-01-03 00:27:07 +01:00
Werner Lemberg 8fb9d22a6b [ftfuzzer] Replace `rand' with an xorshift algorithm.
* src/tools/ftfuzzer/ftfuzzer.cc: Don't include `stdlib.h'.
(Random): Implement and use a 32bit `xorshift' algorithm.
2016-12-30 19:51:37 +01:00
Werner Lemberg 6b21d1281e [ftfuzzer] Restrict number of tested bitmap strikes.
Malformed fonts often have large values for the number of bitmap
strikes, and FreeType doesn't check the validity of all bitmap
strikes in advance.

Reported as

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

* src/tools/ftfuzzer/ftfuzzer.cc: Include `stdlib.h' for `rand'.
(Random): Small class to provide n randomly selected numbers
(without repitition) out of the value set [0,N].
(LLVMFuzzerTestOneInput): Use it to test only up to 10 bitmap
strikes.
2016-12-30 10:00:54 +01:00
Werner Lemberg 6fb549ddab [psnames] Only declare, not define, data in `pstables.h' (#49949).
Pdfium includes `pstables.h' a second time; moving the definition
from `pstables.h' to `psmodule.c' saves more than 60kByte data
segment space for this case.

* src/tools/glnames.py (StringTable::dump,
StringTable::dump_sublist, dump_encoding, dump_array): Emit
additional code to only define tables if `DEFINE_PS_TABLES' is set.

* src/psnames/pstables.h: Regenerated.
* src/psnames/psmodule.c (DEFINE_PS_TABLES): Define.
2016-12-28 22:23:33 +01:00
Werner Lemberg f80c4473b6 Replace `++foo' and `--foo' with `foo++' and `foo--', resp. 2016-12-26 23:57:45 +01:00
Werner Lemberg 4441f7b246 Replace `foo == NULL' and `foo != NULL' with `!foo' and `foo', resp.
Other minor formatting.
2016-12-26 17:08:17 +01:00
Werner Lemberg ada8297175 [ftfuzzer] Always use Adobe CFF engine.
* src/tools/ftfuzzer/ftfuzzer.cc (FT_Global::FT_Global): Implement
it.
2016-12-22 08:25:42 +01:00
Alexei Podtelezhnikov 8370295755 URL updates. 2016-10-13 22:52:40 -04:00
Werner Lemberg 71b617d8b7 [ftfuzzer] Speed up.
* src/tools/ftfuzzer/ftfuzzer.cc (LLVMFuzzerTestOneInput): Don't
check for embedded bitmaps if we have a non-default instance.
2016-09-29 19:53:39 +02:00
Werner Lemberg d11e8b6e6d * src/tools/ftfuzzer/ftfuzzer.cc (LLVMFuzzerTestOneInput): Fix typo. 2016-09-25 15:32:04 +02:00
Werner Lemberg deb261556a [ftfuzzer] Minor improvements.
* src/tools/ftfuzzer/ftfuzzer.cc (LLVMFuzzerTestOneInput): Ignore
invalid strikes.
Use better values for call to `FT_Set_Char_Size'.
2016-09-09 22:13:33 +02:00
Werner Lemberg 1c8bb63299 [ftrandom] Minor improvements.
* src/tools/ftrandom/ftrandom.c (_XOPEN_SOURCE): New macro, set to
500.

* src/tools/ftrandom/Makefile (CFLAGS): Split off include
directories to ...
(INCLUDES): ... this new variable.
(LDFLAGS): New variable.
(ftrandom.o, ftrandom): Updated.
2016-09-05 08:13:42 +02:00
Werner Lemberg 4b28f6ac42 [ftrandom] Improve Makefile.
It now supports both a normal build (`./configure && make') and a
development build (`make devel').

* src/tools/ftrandom/Makefile (VPATH): Set it so that
`libfreetype.a' gets searched in both `objs' (for the development
build) and `objs/.libs' (for a normal build which uses libtool).
(LIBS): Add missing libraries.
(ftrandom.o): New rule.
(ftrandom): Use automatic variables.
2016-09-04 19:05:45 +02:00
Werner Lemberg ca8e98d94a [ftrandom] Various fixes.
* src/tools/ftrandom/ftrandom.c (GOOD_FONTS_DIR): Provide better
default.
(error_fraction): Make it of type `double' to work as advertized –
this was completely broken.
Update all related code.
(error_count, fcnt): Make it unsigned to fix compiler warnings.
Update all related code.
(fontlist): Change `len' member to `long' to fix compiler warnings.
(FT_MoveTo, FT_LineTo, FT_ConicTo, FT_CubicTo, abort_test): Tag
unused variables.
(TestFace, FindFonts, copyfont, do_test): Fix compiler warnings.
(ExecuteTest): Ditto.
Call `FT_Done_FreeType'.
(getErrorCnt): Replace `ceil' with an ordinary cast to `unsigned
int'.
(usage): Improve output.
(main): Fix compiler warnings.

* src/tools/ftrandom/README: Updated.
2016-09-03 13:06:16 +02:00
Werner Lemberg ee6b4115d2 [ftfuzzer] Improve coverage of rasterfuzzer.
* src/tools/ftfuzzer/rasterfuzzer.cc (LLVMFuzzerTestOneInput): Use
input data for `tags' array also.
Trim input data to get more positive hits.
2016-03-12 23:48:13 +01:00
Werner Lemberg a8b956227b [ftfuzzer] Add unit for testing smooth and black rasterizers.
* src/tools/ftfuzzer/rasterfuzzer.cc: New file.
2016-03-01 09:37:12 +01:00
Werner Lemberg 015c6e08a1 Fix clang warnings.
* src/autofit/aflatin.c (af_latin_hints_compute_segments): Use
FT_UShort for `min_flags' and `max_flags'.
Initialize `prev_*' variables.

* src/cff/cffobjs.c (cff_face_init) [FT_DEBUG_LEVEL_TRACE]: Fix
types of local variables.

* src/smooth/ftgrays.c (gray_dump_cells) [FT_DEBUG_LEVEL_TRACE]:
Update `printf' format string.

* src/tools/ftfuzzer/ftfuzzer.cc (setIntermediateAxis): Add cast.
(LLVMFuzzerTestOneInput): Fix loop type.
2016-03-01 06:45:52 +01:00
Werner Lemberg 4b3ea5ca8f [docmaker] Don't emit trailing newlines.
* src/tools/docmaker/tohtml.py (HtmlFormatter::make_html_code):
Use `rstrip'.
2016-02-09 08:08:17 +01:00
Werner Lemberg 9cc2d46785 Minor. 2016-02-05 11:52:50 +01:00
Werner Lemberg 9adeab6452 Update copyright year. 2016-01-13 11:54:10 +01:00
Werner Lemberg 453722db8e * src/tools/afblue.pl (convert_ascii_chars): Don't ignore spaces.
Instead, reduce multiple spaces to a single one.  We need this later
for supporting character clusters in `afblue.dat'.
2015-12-05 13:20:30 +01:00
Werner Lemberg 98afe3f5c8 [docmaker] Allow references to section names.
In the reference, we show the section's title enclosed in single
quotes.

* src/tools/docmaker/formatter.py (Formatter::__init__): Collect
section names as identifiers.

* src/tools/docmaker/tohtml.py (section_title_header): Split into...
(section_title_header1, section_title_header2): ... these two
strings.
(HtmlFormatter::make_block_url, make_html_word, html_source_quote):
Handle sections.
(HtmlFormatter::section_enter): Updated to add `id' HTML attribute.
2015-11-28 11:58:49 +01:00
Werner Lemberg 97b808fdad [docmaker] Allow `foo[bar]' as identifier.
We need this to handle equally named properties in different
modules.

* src/tools/docmaker/content.py (re_identifier),
src/tools/docmaker/sources.py (re_crossref): Allow `foo[bar]'.

* src/tools/docmaker/tohtml.py (HtmlFormatter::make_html_word,
HtmlFormatter::index_exit, HtmlFormatter::section_enter,
HtmlFormatter::block_enter): Handle `foo[bar]'.
2015-11-26 14:29:17 +01:00
Werner Lemberg 7363414b9d [ftfuzzer] Add copyright notices; do some formatting. 2015-11-07 06:32:46 +01:00
Werner Lemberg 6bda921da0 [ftfuzzer] Update README file. 2015-11-02 06:53:48 +01:00
Werner Lemberg bcf618b256 [ftfuzzer] Add support for multiple files (patch #8779).
Currently, libFuzzer only supports mutation of a single file.  We
circumvent this problem by using an uncompressed tar archive as
multiple-file input for the fuzzer.

This patch enables tests of `FT_Attach_Stream' and AFM/PFM parsing;
a constructed tarball should contain a font file as the first
element, and files to be attached as further elements.

* src/tools/ftfuzzer/ftfuzzer.cc: Include libarchive headers.
(archive_read_entry_data, parse_data): New functions.
(LLVMFuzzerTestOneInput): Updated.

* src/tools/ftfuzzer/ftmutator.cc: New file, providing a custom
mutator for libFuzzer that can mutate tarballs in a sensible way.
2015-11-02 06:50:49 +01:00
Werner Lemberg 3066f5f53d Revert erroneously applied commits. 2015-10-21 14:05:41 +02:00
Werner Lemberg e6593389cf [sfnt] Avoid unnecessarily large allocation for WOFFs (#46257).
* src/sfnt/sfobjs.c (woff_open_font): Use WOFF's `totalSfntSize'
only after thorough checks.
Add tracing messages.
2015-10-21 08:04:29 +02:00
Kostya Serebryany 266976b163 add src/tools/ftfuzzer/README 2015-10-15 22:15:53 -07:00
Werner Lemberg 8b76eaf092 * src/tools/ftfuzzer/ftfuzzer.cc: Handle fixed sizes (#46211). 2015-10-15 18:28:43 +02:00
Werner Lemberg bdb56bba86 [ftfuzzer] Handle TTCs and MM/GX variations.
This patch also contains various other improvements.

* src/tools/ftfuzzer/ftfuzzer.cc: Add preprocessor guard to reject
pre-C++11 compilers.
(FT_Global): New class.  Use it to provide a global constructor and
destructor for the `FT_Library' object.
(setIntermediateAxis): New function to select an (arbitrary)
instance.
(LLVMFuzzerTestOneInput): Loop over all faces and named instances.
Also call `FT_Set_Char_Size'.
2015-10-13 11:51:13 +02:00
Kostya Serebryany dde84f2539 [ftfuzzer] Add support for LLVM's LibFuzzer.
* src/tools/ftfuzzer/ftfuzzer.cc, src/tools/runinput.cc: New files.
2015-10-07 22:18:22 +02:00
Werner Lemberg e5a27a7596 [docmaker] Allow `-' in bold and italic markup.
* src/tools/docmaker/sources.py (re_italic, re_bold): Adjust
accordingly.
2015-09-10 07:44:11 +02:00
Werner Lemberg 802f6a9abd * src/tools/docmaker/utils.py (check_output): Add missing `\n'. 2015-06-27 07:12:42 +02:00
Werner Lemberg 392cf22f8a Another adjustment to header locations.
This change is a result of a discussion thread on freetype-devel

  http://lists.nongnu.org/archive/html/freetype-devel/2015-06/msg00041.html

Re-introduce the `freetype2' subdirectory for all FreeType header
files after installation, and rename the `freetype2' subdirectory in
the git repository to `freetype'.

* include/freetype2: Renamed to...
* include/freetype: This.

* CMakeLists.txt (PUBLIC_HEADERS, PUBLIC_CONFIG_HEADERS,
PRIVATE_HEADERS): Updated.
Update creation of `ftconfig.h'.
Install generated `ftconfig.h'.

* Jamfile (HDRMACRO, RefDoc), autogen.sh: Updated.

* builds/amiga/include/config/ftconfig.h, builds/freetype.mk
(PUBLIC_DIR), builds/symbian/bld.inf, builds/toplevel.mk (work),
builds/unix/freetype2.in: Updated.

* builds/unix/freetype-config.in: Updated.
* builds/unix/configure.raw: Don't check for `rmdir'.
* builds/unix/unix-def.in (DELDIR): Use `rm -rf', which is portable
according to the autoconf info manual.
* builds/unix/install.mk (install, uninstall,
distclean_project_unix): Update and simplify.

* builds/wince/*, builds/windows/*: Updated.

* devel/ft2build.h, include/ft2build.h: Updated.

* include/freetype2/config/ftheader.h,
include/freetype2/internal/ftserv.h,
include/freetype2/internal/internal.h: Update all header file
macros.

* src/tools/chktrcmp.py (TRACE_DEF_FILES): Updated.

* docs/*: Updated.
2015-06-26 06:48:00 +02:00
Werner Lemberg 8502c98b15 Fix Savannah bug #45097.
We no longer `pollute' the namespace of possible header file names;
instead we move `ft2build.h' up by one level so that it gets
installed in the default include directory (e.g.,
/usr/local/include).  After this commit, only `ft2build.h' stays in
the compiler's include path.

No visible changes for the user who follows the standard FreeType
header inclusion rules.

* include/*: Move to ...
* include/freetype2/*: This directory, except `ft2build.h'.

* CMakeLists.txt (PUBLIC_HEADERS, PUBLIC_CONFIG_HEADERS,
PRIVATE_HEADERS), Jamfile (HDRMACRO, RefDoc), autogen.sh: Updated.

* builds/amiga/include/config/ftconfig.h, builds/freetype.mk
(PUBLIC_DIR), builds/symbian/bld.inf, builds/toplevel.mk (work),
builds/unix/install.mk (install, uninstall),
builds/unix/freetype2.in: Updated.

* builds/unix/freetype-config.in: Updated.
Emit -I directory only if it is not `/usr/include'.

* builds/wince/*, builds/windows/*: Updated.

* devel/ft2build.h, include/ft2build.h: Updated.

* include/freetype2/config/ftheader.h,
include/freetype2/internal/ftserv.h,
include/freetype2/internal/internal.h: Update all header file
macros.

* src/tools/chktrcmp.py (TRACE_DEF_FILES): Updated.

* docs/*: Updated.
2015-06-22 06:35:23 +02:00