Commit Graph

69 Commits

Author SHA1 Message Date
Alexei Podtelezhnikov 47574f7ea4 Update all copyright notices. 2024-01-27 11:11:22 -05:00
Werner Lemberg 65f8523706 Update all copyright notices. 2023-01-17 09:18:25 +01:00
Werner Lemberg d0cfb4e1b2 Update all copyright notices. 2022-01-11 10:54:10 +01:00
Alexei Podtelezhnikov 857038399a Use FT_INT64 instead of FT_LONG64.
* include/freetype/config/integer-types.h: Remove synonymous FT_LONG64.
* include/freetype/internal/ftcalc.h: s/FT_LONG64/FT_INT64/.
* src/base/ftcalc.c: Ditto.
* src/base/fttrigon.c: Ditto.
* src/smooth/ftgrays.c: Ditto.
2021-08-18 23:05:51 -04:00
Werner Lemberg b6e8a71266 Update all copyright notices. 2021-01-17 07:18:48 +01: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
Werner Lemberg e5038be704 Update all copyright notices. 2020-01-19 17:05:19 +01:00
Werner Lemberg 7585997024 Update all copyright notices. 2019-02-23 10:07:09 +01:00
Werner Lemberg f686ad46a3 Update copyright years. 2019-01-22 20:31:44 +01:00
Alexei Podtelezhnikov 1fc776b5f1 * src/base/fttrigon.c (FT_Tan): Improve accuracy.
(FT_Vector_Rotate): Simplify.
2018-06-28 21:42:26 -04:00
Werner Lemberg 9ac9060df0 [GSoC] src/*.*: Convert block comments to `light' style.
This 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 09:08:41 +02:00
Werner Lemberg 0a0c22569d Update copyright year. 2018-01-02 09:33:57 +01:00
Werner Lemberg 563ae78022 Update copyright year. 2017-01-04 20:16:34 +01:00
Werner Lemberg fc11af1ea2 Various minor clang fixes.
* src/autofit/afcjk.c (af_cjk_metrics_init_widths),
src/autofit/aflatin.c (af_latin_metrics_init_widths): Initialize
`ch'.

* src/base/ftcalc.c (FT_MulFix) [FT_LONG64]: Add cast.

* src/base/ftdbgmem.c (ft_mem_table_destroy): Add cast.

* src/base/fthash.c (hash_num_lookup): Add cast.

* src/base/fttrigon.c (ft_trig_downscale) [FT_LONG64]: Fix cast.

* src/gxvalid/gxvcommn.c (gxv_EntryTable_validate): Comment out
redundant code.

* src/type1/t1driver.c (t1_get_ps_font_value) <PS_DICT_SUBR>: Add
cast.

* src/type1/t1load.c (parse_subrs): Fix type of `count'.
2016-01-19 19:15:54 +01:00
Werner Lemberg 9adeab6452 Update copyright year. 2016-01-13 11:54:10 +01:00
Alexei Podtelezhnikov dac5644cea [base] Optimize `FT_Angle_Diff'.
Under normal circumstances we are usually close to the desired range
of angle values, so that the remainder is not really necessary.

* src/base/fttrigon.c (FT_Angle_Diff): Use loops instead of remainder.

* src/autofit/aftypes.h (AF_ANGLE_DIFF): Ditto in the unused macro.
2015-03-21 23:30:16 -04:00
Alexei Podtelezhnikov 2d7284e962 * src/base/fttrigon.c (FT_Vector_Rotate): Minor refactoring. 2015-03-20 21:34:19 -04:00
Alexei Podtelezhnikov 6a17172687 Fix Savannah bug #44412 (part 2).
* src/base/fttrigon.c (FT_Sin, FT_Cos, FT_Tan): Call `FT_Vector_Unit'.
2015-03-17 22:43:08 -04:00
Werner Lemberg 2e814fc045 More minor signedness warning fixes.
* src/base/ftbbox.c, src/base/ftbitmap.c, src/base/fttrigon.c,
src/base/ftutil.c: Apply.
2015-02-16 20:05:08 +01:00
Werner Lemberg f57fc59e01 Run `src/tools/update-copyright'. 2015-01-17 20:41:43 +01:00
Alexei Podtelezhnikov 7024155328 [base] Formatting and nanooptimizations.
* src/base/ftcalc.c,
* src/base/fttrigon.c: Revise sign restoration.
2014-12-24 12:11:46 -05:00
Werner Lemberg 9870d6dacf */*: Decorate hex constants with `U' and `L' where appropriate. 2014-12-07 09:40:47 +01:00
Werner Lemberg f34f192535 * src/*: Add checks for parameters of API functions where missing.
`API functions' are functions tagged with `FT_EXPORT_DEF'.

Besides trivial fixes, the following changes are included, too.

* src/base/ftbdf.c (FT_Get_BDF_Charset_ID, FT_Get_BDF_Property): Set
error code if no service is available.

* src/base/ftinit.c (FT_Done_FreeType): Change return value for
invalid `library' parameter to `Invalid_Library_Handle'.

* src/base/ftobjs.c (FT_New_Size): Change return value for invalid
`asize' parameter to `Invalid_Argument'.

* src/base/ftoutln.c (FT_Outline_Copy): Change return value for
invalid `source' and `target' parameters to `Invalid_Outline'.
(FT_Outline_Done_Internal): Change return value for invalid
`outline' parameter to `Invalid_Outline'.
2014-11-26 21:59:21 +01:00
Alexei Podtelezhnikov f841ad3ec2 * src/base/fttrigon.c: Use dedicated `FT_Angle' for arctan table. 2014-11-19 21:19:06 -05:00
Alexei Podtelezhnikov 2e73a1b4fd [base] CORDIC improvements.
The scaling between the hypotenuse and its CORDIC approximation is
based on regression analysis. The smaller padding for `theta' is
justifed by its maximum error of less than 6.

* src/base/fttrigon.c (ft_trig_downscale): Borrow code from
./ftcalc.c (ft_multo64), change linear intercept.
(ft_trig_pseudo_polarize): Decrease `theta' padding.
2014-11-09 23:22:43 -05:00
Alexei Podtelezhnikov d2935e2969 * src/base/fttrigon.c (ft_trig_prenorm): Comment on undefined behavior. 2014-08-12 00:41:04 -04:00
Werner Lemberg d135e27c23 Fix 64bit compilation issues.
* include/freetype/config/ftconfig.h [FT_LONG64]: Typedef
`FT_Int64' here.

* src/base/ftcalc.c: Remove typedef of `FT_Int64'.
(FT_DivFix): Fix cast.
* src/base/fttrigon.c: Remove typedef of `FT_Int64'.
2013-05-05 10:44:21 +02:00
Werner Lemberg e6e8362728 Fix clang fixes.
* src/base/fttrigon.c (ft_trig_prenorm, FT_Vector_Rotate): Use
correct types.

* src/cff/cf2intrp.c (cf2_interpT2CharString) <default>: Force
unsigned for computations.
* src/cff/cffgload.c (cff_decoder_parse_charstrings): Ditto.
* src/cff/cffparse.c (cff_parse_integer): Ditto.

* src/psaux/t1decode.c (t1_decoder_parse_charstrings): Ditto.
2013-05-04 18:57:56 +02:00
Werner Lemberg 94152819b0 More fixes for clang's `sanitize' feature.
* src/base/ftcalc.c (FT_DivFix): Use unsigned values for
computations which use the left shift operator and convert to signed
as the last step.
* src/base/fttrigon.c (ft_trig_prenorm, FT_Vector_Rotate,
FT_Vector_Length, FT_Vector_Polarize): Ditto.

* src/cff/cffgload.c (cff_decoder_parse_charstrings): Simplify.
* src/cff/cffload.c (cff_subfont_load): Fix constant.
* src/cff/cffparse.c (cff_parse_integer, cff_parse_real, do_fixed,
cff_parse_fixed_dynamic): Use unsigned values for computations which
use the left shift operator and convert to signed as the last step.

* src/cid/cidload.c (cid_get_offset): Ditto.

* src/psaux/psconv.c (PS_Conv_ToFixed): Ditto.
* src/psaux/t1decode.c (t1_decoder_parse_charstrings): Ditto.

* src/truetype/ttinterp.c (TT_MulFix14, TT_DotFix14): Ditto.
2013-05-04 16:40:12 +02:00
Werner Lemberg 817caa9f4f Fix `make multi'
* src/base/ftoutln.c, src/base/fttrigon.c: Include
FT_INTERNAL_CALC_H.
2013-01-25 00:40:56 +01:00
Werner Lemberg e9f330adf6 [base] Make `FT_Hypot' really internal.
* include/freetype/fttrigon.h (FT_Hypot): Move to...
* include/freetype/internal/ftcalc.h: This file.

* src/base/fttrigon.c (FT_Hypot): Move to...
* src/base/ftcalc.c: This file.
Include FT_TRIGONOMETRY_H.

* src/truetype/ttgload.c: Don't include FT_TRIGONOMETRY_H.
2013-01-24 09:12:56 +01:00
Alexei Podtelezhnikov b6de8e6612 [base, truetype] New internal FT_Hypot function.
* include/freetype/fttrigon.h (FT_Hypot): Declare it.
* src/base/fttrigon.c (FT_Hypot): Define it.
* src/truetype/ttgload.c (TT_Process_Composite_Component): Use it
instead of explicit expressions.
* src/truetype/ttinterp.c (Current_Ratio, Normalize): Use it instead
of TT_VecLen.
(TT_VecLen): Removed.
2013-01-23 23:31:41 -05:00
Alexei Podtelezhnikov 869fb8c49d [base] Split out MSB function.
* src/base/fttrigon.c (ft_trig_prenorm): Borrow from here.
* include/freetype/internal/ftcalc.h (FT_MSB): Declare here.
* src/base/ftcalc.c (FT_MSB): Define here.
2013-01-23 19:43:28 -05:00
Werner Lemberg 7190098098 Minor. 2013-01-16 20:08:35 +01:00
Werner Lemberg 53c0cb59ed Typos, whitespace. 2013-01-11 08:29:22 +01:00
Alexei Podtelezhnikov ad9d5c9726 [base] Update the overflow protection bit.
The recent optimizations of CORDIC iterations drastically reduce
the expansion factor. The vector components with MSB of 29 are now
safe from overflow.

* src/base/fttrigon.c (FT_TRIG_SAFE_MSB): New macro.
(ft_trig_prenorm): Use it and remove dead code.
2013-01-10 22:29:07 -05:00
Werner Lemberg 4412e74de7 Minor comment improvements. 2013-01-10 20:16:20 +01:00
Alexei Podtelezhnikov 6b83a3674c [base, pshinter] Use FT_ABS, FT_MIN, and FT_MAX for readability.
* src/base/ftbbox.c: Updated.
* src/base/ftobjs.c: Updated.
* src/base/fttrigon.c: Updated.
* src/pshinter/pshalgo.c: Updated.
* src/pshinter/pshrec.c: Updated.
2013-01-09 00:25:32 -05:00
Alexei Podtelezhnikov 09dbb059e1 [base] Clean up trigonometric core.
* src/base/fttrigon.c: Document the algorithm in a large comment.
(FT_TRIG_COSCALE): Remove macro.
(FT_Tan: Use `FT_TRIG_SCALE' instead.
(FT_Cos, FT_Vector_Unit): Ditto and round the return values.
2013-01-08 23:29:44 -05:00
Alexei Podtelezhnikov 5dd9657fe8 [base] Use rounding in CORDIC iterations.
* src/base/fttrigon.c (ft_trig_pseudo_rotate,
ft_trig_pseudo_polarize): Improve accuracy by rounding.
2013-01-02 23:45:14 -05:00
Alexei Podtelezhnikov b4ac30b0ed [base] Reduce trigonometric algorithms.
After we get within 45 degrees by means of true 90-degree rotations,
we can remove initial 45-degree CORDIC iteration and start from
atan(1/2) pseudorotation, reducing expansion factor thereby.

* src/base/fttrigon.c (FT_TRIG_SCALE, FT_TRIG_COSCALE): Update macros.
(ft_trig_pseudo_rotate, ft_trig_pseudo_polarize): Update.

* src/tools/cordic.py: Bring up to date with trigonometric core.

* docs/CHANGES: Old typo.
2013-01-02 22:21:37 -05:00
Alexei Podtelezhnikov d7383b7b86 [base] Improve trigonometric core.
FreeType used to rely on a 24-step iteration CORDIC algorithm to
calculate trigonometric functions and rotate vectors. It turns out
that once the vector is in the right half-plane, the initial rotation
by 63 degrees is not necessary. The algorithm is perfectly capable
to converge to any angle starting from the second 45 degree rotation.
This patch removes the first rotation and makes it a 23-step CORDIC
algorithm.

* src/base/fttrigon.c (FT_TRIG_SCALE, FT_TRIG_COSCALE): Update macro
values.
(ft_trig_pseudo_rotate, ft_trig_pseudo_polarize): Remove initial
rotation.
2012-12-20 01:03:22 -05:00
Alexei Podtelezhnikov 06174dbb20 [base] Clean up trigonometric core.
* src/base/fttrrigon.c (ft_trig_pseudo_polarize): Align algorithm
with `ft_trig_pseudo_rotate'.
2012-12-19 22:46:27 -05:00
Alexei Podtelezhnikov 8ac5c5c8a5 [base] Fix 11-year old bug.
Since the initial commit (ebe85f59) the value of FT_TRIG_SCALE has
always been slightly less than the correct value, which has been
given in the comment as a hexadecimal. As a result, vector lengths
were underestimated and rotated vectors were shortened.
2012-12-15 23:33:55 -05:00
Werner Lemberg fa22ec1cfb * src/base/fttrigon.c (ft_trig_downscale): Make 64bit version work. 2012-11-17 11:45:24 +01:00
suzuki toshiya 0d226c31c5 base: Prevent some overflows on LP64 systems. 2009-08-01 00:30:24 +09:00
David Turner f7cc181425 * src/base/fttrigon.c (ft_trig_prenorm): fixed a bug that created
invalid computations, resulting in very weird bugs in TrueType
	bytecode hinted fonts

	* src/truetype/ttinterp.c: redefined FT_UNUSED_EXEC to not perform
	a structure copy each time. Wooot. !
2005-11-15 17:30:56 +00:00
Werner Lemberg cee37a3b0a Clean-up. 2005-11-12 07:34:40 +00:00
David Turner 9fbd2ab884 - various performance enhancements
- fixing apinames.c, adding support for Watcom and Borland compilers
- adding generation of exported symbols list to the build system, including the Unix one !!

sorry Werner, I have no time to document this in ChangeLog at the moment
2005-10-28 16:14:14 +00:00