Commit Graph

24 Commits

Author SHA1 Message Date
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
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
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
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
Nikolaus Waxweiler 596157365a [truetype] New implementation of v38 bytecode interpreter [1/3].
This patch prepares data structures and the like.

See added comments in `ttinterp.h' for more information on this and
the following commits in the series.

* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_OPTION_SUBPIXEL_HINTING): Assign values to differentiate
between subpixel versions.
(TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY,
TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL): New macros.

* include/freetype/ftttdrv.h (TT_INTERPRETER_VERSION_40): New macro.

* include/freetype/internal/tttypes.h (TT_FaceRec): Updated.

* src/truetype/ttinterp.h (TT_ExecContextRec): Define new fields
`subpixel_hinting_lean', `vertical_lcd_lean',
`backwards_compatibility', `iupx_called', iupy_called', and
`grayscale_cleartype' for new hinting mode.

* src/truetype/ttdriver.c (tt_property_set): Handle v38 and v40
interpreters conditionally.

* src/truetype/ttgload.c (TT_Hint_Glyph): Save phantom points unless
in v38 backwards compatibility mode.
Updated.
(compute_glyph_metrics): Add v38 backwards compatibility mode
constraint for adjusting advance widths.
Updated.
(tt_loader_init): Handle new flags `subpixel_hinting_lean',
`grayscale_cleartype', and `vertical_lcd_lean'.
Updated.
(tt_get_metrics, TT_Process_Simple_Glyph, TT_LOADER_SET_PP):
Updated.

* src/truetype/ttobjs.c (tt_driver_init): Conditionally set
default interpreter version number.

* src/truetype/ttsubpix.c, src/truetype/ttsubpix.h: Updated.
2016-05-18 06:57:59 +02:00
Werner Lemberg 9adeab6452 Update copyright year. 2016-01-13 11:54:10 +01:00
Werner Lemberg 37412ff9f4 Don't use macro names that contain `__' [1/2].
Such macro names are reserved for both C and C++.

*/*: Replace macros of the form `__XXX_H__' with `XXX_H_'.
2016-01-12 21:37:13 +01:00
Werner Lemberg 1f7a4e1f40 [truetype] Finish compiler warning fixes for signedness issues.
* src/truetype/ttgxvar.c, src/truetype/ttsubpix.c,
src/truetype/ttsubpix.h: Apply.
2015-02-17 10:17:56 +01:00
Werner Lemberg f57fc59e01 Run `src/tools/update-copyright'. 2015-01-17 20:41:43 +01:00
Infinality 63bfa83257 [truetype] Simplify and improve subpixel function detection.
Some small enhancements have allowed the removal of many macros and
the simplification of existing rules in `ttsubpix.c'.

* src/truetype/ttsubpix.h (SPH_TWEAK_ALLOW_X_DMOVEX,
SPH_TWEAK_ALLOW_X_MOVE_ZP2,
SPH_TWEAK_DELTAP_SKIP_EXAGGERATED_VALUES,
SPH_TWEAK_SKIP_INLINE_DELTAS, SPH_TWEAK_MIRP_CVT_ZERO): Removed.
(SPH_TWEAK_SKIP_NONPIXEL_Y_MOVES_DELTAP): New rule macro.

* src/truetype/ttsubpix.c: Updated affected rules.

* src/truetype/ttinterp.c (Direct_Move_X): Updated.
(INS_FDEF): Add additional function detection.
(INS_ENDF): Set runtime flag.
(Ins_CALL): Skip the call under certain conditions.
Remove bad code.
(Ins_LOOPCALL): Skip the call under certain conditions.
Remove bad code.
(Move_Zp2_Point): Updated.
(Ins_SHPIX): Updated.
Skip the move under some situations.
(Ins_MIAP): Improve conditions.
(Ins_MIRP): Updated.
(Ins_DELTAP): Skip move under certain conditions.
Simplify conditions.
(TT_RunIns): Updated.
Add code to handle new function detection.
Trace messages.
2013-05-20 07:38:21 +02:00
Werner Lemberg 6b9034f0fd Formatting, comment improvements. 2013-01-28 13:56:23 +01:00
Infinality a5fe359596 [truetype] Align more to ClearType whitepaper for sph. 2013-01-26 12:29:52 -06:00
David 'Digit' Turner 72447195ce [truetype] Fix C++ compilation.
* src/truetype/ttsubpix.h: Updated.
(SPH_X_SCALING_RULES_SIZE): Moved and renamed to...
* src/truetype/ttsubpix.c (X_SCALING_RULES_SIZE): This.
(sph_X_SCALING_Rules): Removed.
(scale_test_tweak): Make function static.
(sph_test_tweak_x_scaling): New function.

* src/truetype/ttgload.c (TT_Process_Simple_Glyph): Updated.
2013-01-25 00:36:35 +01:00
Werner Lemberg 7190098098 Minor. 2013-01-16 20:08:35 +01:00
David Turner 3a40612723 [truetype] Improve sub-pixel code.
This patches fixes many issues with the ttsubpix implementation.

1. Data tables are defined, instead of declared, in the header, and
   thus copied into each source file that includes it.

2. These tables were defined as global, mutable, visible variables,
   and thus costing private RAM to every process that loads the
   library (> 50 KB / process, this is huge!).

   Additionally, this also made the library export the symbols
   completely needlessly.

3. Missing `sph_' and `SPH_' prefixes to some of the definitions.

Note that this doesn't try to fix the incredibly inefficient storage
format for the data tables used by the code.  This one will require
another pass in the future.

* src/truetype/ttinterp.h (MAX_NAME_SIZE, MAX_CLASS_MEMBERS):
Renamed to...
(SPH_MAX_NAME_SIZE, SPH_MAX_CLASS_MEMBERS): This.
Update all users.

(SPH_TweakRule, SPH_ScaleRule): Decorate with `const' where
appropriate.

(Font_Class): Rename to...
(SPH_Font_Class): This.  Decorate with `const' where appropriate.

* src/truetype/ttsubpix.h (scale_test_tweak, sph_test_tweak):
Decorate arguments with `const' where appropriate.

Move font tweaking tables to...

* src/truetype/ttsubpic.c: This file and decorate them with `static'
and `const' where appropriate.

(X_SCALING_Rules, X_SCALING_RULES_SIZE): Renamed to...
(spu_X_SCALING_Rules, SPH_X_SCALING_RULES_SIZE): This.
Update all users.
2013-01-16 19:48:31 +01:00
Infinality 71f242c26a [truetype ] Remove unusued code. Add minor fixes. 2012-12-16 19:52:01 -06:00
Infinality d0a827b340 [truetype] Fix various artifacts. 2012-06-28 20:34:26 -05:00
Infinality 79e36baebb [truetype] Support subpixel hinting.
This is the large, famous `Infinality' patch to support ClearType
bytecode which has been available from
http://www.infinality.net/blog/ for some time, and which has been
refined over the last years.  While still experimental, it is now
mature enough to be included directly into FreeType.

Most of the code is based on the ClearType whitepaper written by
Greg Hitchcock

  http://www.microsoft.com/typography/cleartype/truetypecleartype.aspx

which gives a detailed overview of the necessary changes to the
Microsoft rasterizer so that older fonts are supported.  However, a
lot of details are still missing, and this patches provides a
framework to easily handle rendering issues down to the glyph level
of certain fonts.

Note that ClearType support is not completely implemented!  In
particular, full support for the options `compatible_widths',
`symmetrical_smoothing, and `bgr' (via the GETINFO bytecode
instruction) is missing.

* src/truetype/ttsubpix.c: New file, providing code to handle
`tweaks', this is, rules for certain glyphs in certain fonts
(including wildcards) which need a special treatment.

* src/truetype/ttsubpix.h: New file, holding the tweaking rules.

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

* include/freetype/internal/ftobjs.h (FT_PIX_FLOOR_GRID,
FT_PIX_ROUND_GRID, FT_PIX_CEIL_GRID): New macros.

* src/truetype/truetype.c [TT_USE_BYTECODE_INTERPRETER]: Include
`ttsubpix.c'.

* src/truetype/ttgload.c: Include `ttsubpix.h'.
[All changes below are guarded by TT_CONFIG_OPTION_SUBPIXEL_HINTING.]

(tt_get_metrics): Set tweak flags.
(TT_Hint_Glyph): Call `FT_Outline_EmboldenXY' if necessary.
(TT_Process_Simple_Glyph): Compensate emboldening if necessary.
(compute_glyph_metrics): Handle `compatible widths' option.
(tt_loader_init): Handle ClearType GETINFO information bits.

* src/truetype/rules.mk (TT_DRC_SRC): Updated.

* src/truetype/ttinterp.c: Include `ttsubpix.h'.
[Where necessary, changes below are guarded by
TT_CONFIG_OPTION_SUBPIXEL_HINTING.]

(Direct_Move, Direct_Move_X): Extended.
(Round_None, Round_To_Grid, Round_To_Half_Grid, Round_Down_To_Grid,
Round_Up_To_Grid, Round_To_Double_Grid, Round_Super, Round_Super_45,
SetSuperRound): Add parameter to handle the number of grid lines per
pixel.
(SET_SuperRound, ROUND_None, CUR_Func_round): Updated.
(DO_SROUND, DOS45ROUND, DO_ODD, DO_EVEN): Updated.
(DO_ROUND, DO_NROUND): Updated.
(DO_RS): Take care of `Typeman' bytecode patterns.
(Ins_FDEF): Add some debugging code.  Commented out.
(Ins_ENDF): Restore state.
(Ins_CALL, Ins_LOOPCALL): Handle inline delta functions.
(Ins_MD): Handle `Vacuform' rounds.
(Move_Zp2_Point, Ins_SHPIX, Ins_MSIRP, Ins_MDAP, Ins_MIAP,
Ins_MDRP, Ins_MIRP): Handle tweaks.
(Ins_ALIGNRP): Add tweak guard.
(Ins_IUP, Ins_DELTAP): Handle tweaks.
(Ins_GETINFO): Handle new ClearType bits.
(TT_RunIns): Handle tweaks.

* src/truetype/ttinterp.h: Updated.
(SPH_TweakRule, SPH_ScaleRule): New structures for tweaks.
(TT_ExecContextRec): Add members for subpixel hinting support.

* src/truetype/ttobjs.h (TT_DefRecord): Add `inline_delta' member.
2012-06-18 10:36:06 +02:00