Commit Graph

1537 Commits

Author SHA1 Message Date
Ewald Hew fd7441a3b7 Documentation fixes. 2017-08-21 14:17:44 +08:00
Ewald Hew 480b026b72 Move `psdecode' into `psobjs'.
As the former only contains a single procedure, move it into `psobjs' for
simplicity. Also change the parameter order to the conventional one.

* src/psaux/psdecode.c (ps_decoder_init): Moved to...
* src/psaux/psobjs.c: ...Here.
* src/psaux/psdecode.h, src/psaux/psobjs.h: Ditto.

* include/freetype/internal/psaux.h: Update function signature.
* src/cff/cffgload.c, src/cid/cidgload.c, src/type1/t1gload.c: Update calls.
* src/psaux/psaux.c, src/psaux/psauxmod.c: Update includes.
* src/psaux/Jamfile, src/psaux/rules.mk: Update file references.
2017-08-21 14:17:44 +08:00
Ewald Hew 76e9d80adc [psaux] Change subfont synthesis for CID fonts.
Change t1_make_subfont to take in the Private dict record as an argument.
This is because Type 1 and CID font records in FreeType have this in different
places.

* src/psaux/psobjs.c (t1_make_subfont): Change T1_Face to FT_Face so that
CID is also accepted.
Take PS_Private as an argument and let caller figure out where the Private
dict actually is.
Update references.

* include/freetype/internal/psaux.h, src/psaux/psobjs.h: Update declaration.
* src/type1/t1gload.c (T1_Parse_Glyph_And_Get_Char_String): Update call.
2017-08-21 14:17:43 +08:00
Ewald Hew f92a449f6f [psaux] Add missing objects. (2/2)
Synthesize a SubFont object for Type 1 fonts. This is used in the interpreter
to access Private dict data, which are stored in different places for Type 1
and CFF. This allows the same data to be used in either mode.

* src/psaux/psobjs.c (t1_make_subfont): New procedure to copy required values
to a dummy CFF_SubFont object. This is similar to cff_make_private_dict.

* src/psaux/psobjs.h: Add the new declaration.
* include/freetype/internal/psaux.h, src/psaux/psauxmod.c: Ditto.
Add this to the PSAux Service for future use with CID fonts.

* src/type1/t1gload.c: Add the call.
2017-08-21 14:17:42 +08:00
Ewald Hew b55214c820 [psaux] Add missing objects for Type 1. (1/2)
Move CF2_Font instance to PS_Decoder. This is the context for the interpreter
and since it is currently stored in CFF_Font, is unavailable in Type 1 mode.

* include/freetype/internal/psaux.h (T1_Decoder, PS_Decoder): Add the
cf2_instance field.

* src/psaux/psdecode.c (ps_decoder_init): Copy cf2_instance to PS_Decoder.
Remove unused line.
* src/psaux/t1decode.c (t1_decoder_done): Add finalization code.

* src/psaux/psft.c: Update accesses.
2017-08-21 14:17:42 +08:00
Ewald Hew e6d81a03fa Allow type1 module to use the Adobe engine.
Add the callback and some conditionals to switch between the two
engines.

* include/freetype/internal/psaux.h (T1_Decoder_FuncsRec): Change
function declarations.
* src/psaux/psauxmod.c: Register the callbacks.

* src/psaux/psobjs.c: Add conditionals for number conversion.
* src/type1/t1gload.c: Add code to choose which renderer to use.

* src/cid/cidgload.c: Update call.
* src/base/ftobjs.c, src/psaux/psobjs.c, src/type1/t1gload.c: Update
includes.
2017-08-21 14:17:42 +08:00
Ewald Hew 212eb4602f [type1] Add Adobe engine config.
Use the previously changed PS_Driver in type1 module to store hinting
engine configuration.

* include/freetype/ftt1drv.h: New file.
Duplicate and rename config options from CFF.
* include/freetype/config/ftheader.h: Define the new file.

* src/type1/t1driver.c: Update declaration.
* src/type1/t1objs.c (T1_Driver_Init): Added.
2017-08-21 14:17:42 +08:00
Ewald Hew 27f91fd54f [cff] Move and rename CFF_Driver
This is so that we can use the same hinting engine parameters for Type 1.

* include/freetype/internal/cffotypes.h (CFF_Driver): Renamed to PS_Driver...
* include/freetype/internal/psaux.h: ...and moved to here.

* src/cff/cffdrivr.c, src/cff/cffgload.c, src/cff/cffload.c, src/cff/cffobjs.c,
src/cff/cffobjs.h, src/psaux/psft.c, src/psaux/psobjs.c: Updated references.
2017-08-21 14:17:42 +08:00
Ewald Hew de3647c83f [psaux, type1] Reorganize object fields.
Make some fields more generic, so that we can access them the same way
regardless of Type 1 or CFF.

* include/freetype/internal/psaux.h (PS_Builder): Change TT_Face to FT_Face.
Remove unused fields.

* src/psaux/psft.c: Update all accesses of PS_Builder.face.
Add some asserts to guard against casting T1_Face as TT_Face.

* src/type1/t1objs.h (T1_GlyphSlot): Reorder fields to follow CFF_GlyphSlot,
so that we can pretend they are the same in the interpreter.

* src/psaux/psobjs.c: Updated with above changes.
2017-08-21 14:17:42 +08:00
Ewald Hew f5b20fa4bf [psaux, cff] Use the new objects.
* include/freetype/internal/psaux.h, src/psaux/psauxmod.c: Fix switching
between new and old engines.

* src/cff/cffgload.c, src/cff/cffparse.c: Update calls.

* src/psaux/psblues.c, src/psaux/psfont.c, src/psaux/psfont.h,
src/psaux/psft.c, src/psaux/psft.h, src/psaux/psintrp.c: Update all
to use new objects.
2017-08-21 14:17:42 +08:00
Ewald Hew 84636c58dc [psaux] Objects for new interpreter (part 2)
Make the new objects copy over values. They are essentially wrapper types
for the different decoders/builders.

* include/freetype/internal/psaux.h: Update declarations.
Add is_t1 flag to PS_Builder.
* src/psaux/psdecode.h, src/psaux/psobjs.h: Update declarations.

* src/psaux/psdecode.c, src/psaux/psobjs.c: Implement copy with two modes.

* src/psaux/psauxmod.c: Add builder and decoder functions to PSAux service.
2017-08-21 14:17:42 +08:00
Ewald Hew 71c3ce153f [psaux] Add objects for new interpreter
Introduce PS_Decoder and PS_Builder which include all fields from either
Type 1 or CFF decoders/builders.

* include/freetype/internal/psaux.h: Added new structs.

* src/psaux/psobjs.c, src/psaux/psobjs.h: Added PS_Builder functions.
* src/psaux/psdecode.c, src/psaux/psdecode.h: New file to hold decoder
initialization functions.

* src/psaux/psaux.c, src/psaux/Jamfile, src/psaux/rules.mk: Updated.
2017-08-21 14:17:42 +08:00
Ewald Hew 01eda73954 [psaux, cff] Move cff_random into psaux service.
NOTE: Does not compile!

Minor fix to allow both `cff' and `psaux' to use cff_random.

* src/cff/cffload.c (cff_random): Moved to...
* src/psaux/psobjs.c: Here.
* src/cff/cffload.h: Move corresponding declaration to src/psaux/psobjs.h.

* include/freetype/internal/psaux.h (PSAux_ServiceRec): Register the function here...
* src/psaux/psauxmod.c: And here.

* src/cff/cffload.c, src/psaux/cf2intrp.c: Updated code.
2017-08-21 14:17:42 +08:00
Ewald Hew 3fabdc08e9 [cff] Move struct declarations to freetype/internal
NOTE: Does not compile!

This is so that the CFF functions moved to `psaux' can access the same
structs that they need.

* src/cff/cfftypes.h: Moved to...
* include/freetype/internal/cfftypes.h: Here.

* src/cff/cffobjs.h: Moved the struct declarations to...
* include/freetype/internal/cffotypes.h: Here.

* include/freetype/internal/internal.h: Added defines for cfftypes.h and
cffotypes.h

* src/cff/cffcmap.h, src/cff/cffdrivr.c, src/cff/cffgload.c,
src/cff/cffgload.h, src/cff/cffload.h, src/cff/cffobjs.c,
src/cff/cffobjs.h, src/cff/cffparse.h, src/psaux/psobjs.h,
include/freetype/internal/psaux.h,
include/freetype/internal/services/svcfftl.h: Update includes.

* src/cff/rules.mk: Updated.
2017-08-21 14:17:42 +08:00
Ewald Hew 44dce28f96 [psaux, cff] Add new service for inter-module calls.
NOTE: Does not compile!

This is to allow CFF functions moved to `psaux' to call functions declared in src/cff/cffload.h.

* include/freetype/internal/services/svcfftl.h: Create new FT_Service_CFFLoad service.

* include/freetype/internal/ftserv.h: Added new macro FT_DEFINE_SERVICEDESCREC10.
Added define for new service header.

* src/cff/cffdrivr.c, src/cff/cffpic.h: Register the new service.

* src/cff/cfftypes.h (CFF_FontRec), src/psaux/cf2font.h (CF2_FontRec): Add service interface.

* src/cff/cffobjs.c, src/psaux/cf2font.c, src/psaux/cf2ft.c, src/psaux/cf2intrp.c, src/psaux/cffdecode.c: Use the new service.
2017-08-21 14:17:42 +08:00
Ewald Hew 2955c65535 [psaux, cff] Add callbacks for inter-module calls.
NOTE: Does not compile!

* include/freetype/internal/psaux.h: Add function pointer declarations.

* src/psaux/cffdecode.c (cff_decoder_init): Updated to take in callbacks.
* src/psaux/cffdecode.h: Ditto.

* src/cff/cffgload.c (cff_compute_max_advance, cff_slot_load): Update calls to pass in callbacks.
* src/psaux/cf2ft.c, src/psaux/cffdecode.c: Use them.
2017-08-21 14:17:42 +08:00
Ewald Hew e2ca0a446f [psaux, cff] Create new PSAux service interface entries
NOTE: Does not compile!

* include/freetype/internal/psaux.h: Add declarations for new function tables.
Minor fix for forward declaration of CFF_Builder.
* src/psaux/psauxmod.c: Update the interface.

* include/freetype/internal/tttypes.h (TT_FaceRec): Add service interface to CFF_Face(TT_Face).

* src/cff/cffgload.c, src/cff/cffobjs.c, src/cff/cffparse.c: Update function calls to use psaux service.
2017-08-21 14:17:42 +08:00
Ewald Hew 1676377bbf [psaux, cff] Move CFF builder components into `psaux' module.
NOTE: Does not compile!

* src/cff/cffgload.c (cff_builder_{init,done,add_point,add_point1,add_contour,start_point,close_contour}, cff_check_points): Moved to...
* src/psaux/psobjs.c: Here.
* src/cff/cffgload.h: Moved corresponding declarations to src/psaux/psobjs.h.

* src/cff/cffgload.h (CFF_Builder): Moved struct declaration to...
* include/freetype/internal/psaux.h: Here.
2017-08-21 14:17:42 +08:00
Ewald Hew 75356e79ce [psaux, cff] Move CFF decoder components into `psaux' module.
NOTE: Does not compile!

* src/cff/cffgload.c (CFF_Operator,
CFF_COUNT_{CHECK_WIDTH,EXACT,CLEAR_STACK}, cff_argument_counts,
cff_operator_seac, cff_compute_bias, cff_lookup_glyph_by_stdcharcode,
cff_decoder_{parse_charstrings,init,prepare}): Moved to...
* src/psaux/cffdecode.c: This new file.
* src/cff/cffgload.h: Moved corresponding declarations to...
* src/psaux/cffdecode.h: This new file.

* src/cff/cffgload.h (CFF_MAX_{OPERANDS,SUBRS_CALLS,TRANS_ELEMENTS},
CFF_Decoder_Zone, CFF_Decoder): Moved declarations to...
* include/freetype/internal/psaux.h: Here.

* src/psaux/cf2ft.h: Updated include.

* src/psaux/psaux.c, src/psaux/rules.mk: Updated with the new file.
2017-08-21 14:17:41 +08:00
Werner Lemberg f53ccf6f8f Minor comment fix. 2017-08-16 05:46:10 +02:00
Werner Lemberg b45043c440 [sfnt, truetype] Improve handling of missing sbits.
Requested by Behdad.

Modern bitmap-only SFNTs like `NotoColorEmoji.ttf' don't contain
entries in the bitmap strike(s) for empty glyphs.  Instead, they
rely that a space glyph gets created from the font's metrics data.
This commit makes FreeType behave accordingly.

* include/freetype/fterrdef.h (FT_Err_Missing_Bitmap): New error
code.

* src/sfnt/ttsbit.c (tt_sbit_decoder_load_image): Change error codes
to make a distinction between a missing bitmap in a composite and a
simple missing bitmap.

* src/truetype/ttgload.c (TT_Load_Glyph): For a missing bitmap (in a
bitmap-only font), synthesize an empty bitmap glyph if metrics are
available.
2017-08-11 09:34:20 +02:00
Werner Lemberg f2e121ab11 [base] Minor API improvement for default variation axis setting.
* src/base/ftmm.c (FT_Set_MM_Design_Coordinates,
FT_Set_Var_Design_Coordinates, FT_Set_MM_Blend_Coordinates,
FT_Set_Var_Blend_Coordinates): Allow coords==NULL if num_coords==0.

* docs/CHANGES: Updated.
2017-08-10 12:56:50 +02:00
Alexei Podtelezhnikov 410f3799b6 [smooth] Harmony LCD rendering.
This is a new technology for LCD-optimized rendering. It capitalizes
on the fact that each color channel grid is shifted by a third of a
pixel.  Therefore it is logical to render 3 separate monochrome
bitmaps shifting the outline by 1/3 pixel, and then combine them.
Importantly, the resulting output does not require additional LCD
filtering.

* src/smooth/ftsmooth.c (ft_smooth_render_generic)
[!FT_CONFIG_OPTION_SUBPIXEL_RENDERING]: Implement new LCD-optimized
rendering.

* include/freetype/ftlcdfil.h, include/freetype/freetype.h,
include/freetype/config/ftoption.h, devel/ftoption.h: Updated
documentation.
2017-08-08 22:29:51 -04:00
Werner Lemberg f43b3094ef [base, truetype] New function `FT_Get_Var_Axis_Flags'.
The reserved `flags' field got a value in OpenType version 1.8.2;
unfortunately, the public `FT_Var_Axis' structure misses the
corresponding element.  Since we can't add a new field, we add an
access function.

* src/base/ftmm.c (FT_Get_Var_Axis_Flags): New function.

* include/freetype/ftmm.h (FT_VAR_AXIS_FLAG_HIDDEN): New macro.
Updated.

* src/truetype/ttgxvar.c (TT_Get_MM_Var): Increase allocated memory
of `mmvar' to hold axis flags.
Fill the axis flags array.

* docs/CHANGES: Updated.
2017-08-05 18:22:17 +02:00
Werner Lemberg 7e50824288 * src/truetype/ttgxvar.c (TT_Get_MM_Var): Fix thinko. 2017-08-01 12:44:35 +02:00
Behdad Esfahbod 55bbb98f5c [truetype] Fix loading of named instances.
* src/truetype/ttgxvar.c (TT_Get_MM_Var): Preserve file position
while loading the `avar' table.
2017-08-01 09:17:02 +02:00
Werner Lemberg b5cab5c9ca Document how to scale manually. 2017-07-12 21:58:35 +02:00
Alexei Podtelezhnikov 762de5e285 Tweak suggested use of `lsb_delta' and `rsb_delta'. 2017-07-06 22:31:57 -04:00
Ben Wagner 7819aeb622 Avoid Microsoft compiler warnings (#51331).
While clang's sanitizer recommends a cast to unsigned for safe
negation (to handle -INT_MIN), both MSVC and Visualc emit warning
C4146 if an unsigned value gets negated.

* include/freetype/internal/ftcalc.h (NEG_LONG, NEG_INT32),
src/base/ftcalc.c (FT_MOVE_SIGN): Replace negation with a
subtraction.
2017-06-28 22:57:41 +02:00
Alexei Podtelezhnikov 75cb071b3f [sfnt] Synthesize a Unicode charmap if one is missing.
* src/sfnt/ttcmap.h (tt_cmap_unicode_class_rec): Declare it.
* src/sfnt/ttcmap.c (tt_get_glyph_name, tt_cmap_unicode_init,
tt_cmap_unicode_done, tt_cmap_unicode_char_index,
tt_cmap_unicode_char_next, tt_cmap_unicode_class_rec): Implement
synthetic Unicode charmap class.
(tt_get_cmap_info): Make sure the callback is available.

* src/sfnt/sfobjs.c (sfnt_load_face)
[FT_CONFIG_OPTION_POSTSCRIPT_NAMES]: If Unicode charmap is missing,
synthesize one.

* include/freetype/config/ftoption.h: Document it.
* devel/ftoption.h: Ditto.
2017-06-21 22:52:37 -04:00
Werner Lemberg 79e3789f81 * src/winfonts/winfnt.c (FNT_Face_Init): Don't set active encoding.
FreeType only sets a default active encoding for Unicode.
2017-06-14 07:51:04 +02:00
Werner Lemberg 96d26926d1 Provide more macros for flooring, ceiling, and rounding.
These versions don't produce run-time errors due to integer
overflow.

* include/freetype/internal/ftobjs.h: Include FT_INTERNAL_CALC_H.
(FT_PAD_ROUND_LONG, FT_PAD_CEIL_LONG, FT_PIX_ROUND_LONG,
FT_PIX_CEIL_LONG): New macros.
(FT_PAD_ROUND_INT32, FT_PAD_CEIL_INT32, FT_PIX_ROUND_INT32,
FT_PIX_CEIL_INT32): New macros.
2017-06-09 20:34:28 +02:00
Werner Lemberg faf34d29e2 Remove unused macros.
* include/freetype/internal/ftcalc.h (ADD_INT, SUB_INT, MUL_INT,
NEG_INT): Deleted.
2017-06-09 20:31:24 +02:00
Werner Lemberg dcd8de272f */*: Remove `OVERFLOW_' prefix.
This increases readability.
2017-06-09 11:21:58 +02:00
Werner Lemberg c5a225413f ftcalc.h: Avoid left-shift of negative numbers.
Reported as

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

* include/freetype/internal/ftcalc.h (INT_TO_F26DOT6,
INT_TO_F2DOT14, INT_TO_FIXED, F2DOT14_TO_FIXED): Use multiplication.
2017-06-03 06:13:10 +02:00
Werner Lemberg a607e3919d Minor comment. 2017-06-01 17:03:07 +02:00
Werner Lemberg e66d7300fe [cff] 32bit integer overflow run-time errors 2/2 (#46149).
This commit handles the new engine.

* include/freetype/internal/ftcalc.h (OVERFLOW_ADD_INT32,
OVERFLOW_SUB_INT32, OVERFLOW_MUL_INT32, NEG_INT, NEG_LONG,
NEG_INT32): New macros.

* src/cff/cf2ft.c (cf2_getScaleAndHintFlag): Use OVERFLOW_ADD_INT32.

* src/cff/cf2hints.c (cf2_getWindingMomentum, cf2_hint_init,
cf2_hintmap_map, cf2_glyphpath_hintPoint,
cf2_glyphpath_computeIntersection, cf2_glyphpath_computeOffset,
cf2_glyphpath_lineTo, cf2_glyphpath_curveTo): Use
OVERFLOW_ADD_INT32, OVERFLOW_SUB_INT32, OVERFLOW_MUL_INT32, and
NEG_INT32 where appropriate.

* src/cff/cf2intrp.c (cf2_doFlex, cf2_doBlend,
cf2_interpT2CharString): Ditto.
Also add some other code where needed to avoid overflow.
2017-05-31 16:16:50 +02:00
Werner Lemberg fbe2fe4c75 Handle some integer overflow run-time errors (#46149, #48979).
This commit (mainly for 32bit CPUs) is the first of a series of
similar commits to handle known integer overflows.  Basically, all
of them are harmless, since they affect rendering of glyphs only,
not posing security threats.  It is expected that fuzzying will show
up more overflows, to be fixed in due course.

The idea is to mark places where overflows can occur, using macros
that simply cast to unsigned integers, because overflow arithmetic
is well defined in this case.  Doing so suppresses run-time errors
of sanitizers without adding computational overhead.

* include/freetype/internal/ftcalc.h (OVERFLOW_ADD_INT,
OVERFLOW_SUB_INT, OVERFLOW_MUL_INT, OVERFLOW_ADD_LONG,
OVERFLOW_SUB_LONG, OVERFLOW_MUL_LONG): New macros.

* src/base/ftcalc.c (FT_RoundFix, FT_CeilFix, FT_Matrix_Multiply,
FT_Matrix_Multiply_Scaled, FT_Vector_Transform_Scaled,
ft_corner_orientation): Use new macros.

* src/base/ftoutln.c (FT_Outline_Get_Orientation): Use new macros.
2017-05-29 13:29:28 +02:00
Werner Lemberg 9d04fa7015 * include/freetype/internal/ftcalc.h (FLOAT_TO_FIXED): Remove.
This macro is not used.
2017-05-28 07:57:24 +02:00
Alexei Podtelezhnikov ab2599ea3f [smooth] Implement minimal dynamic padding for LCD filtering.
Extra bitmap padding for LCD filtering depends on the filter.  The
default 5-tap filter needs 2 extra subpixels.  The light 3-tap filter
needs only 1 extra subpixel.  This space could be already available
due to rounding.  In order to optimize the padding, we now expand
CBox for the given filter weights before rounding.

This change breakes current Skia (and Firefox).

* include/freetype/internal/ftobjs.h (FT_LibraryRec)
[FT_CONFIG_OPTION_SUBPIXEL_RENDERING]: Remove `lcd_extra' field.

* src/base/ftlcdfil.c (FT_Library_SetLcdFilterWeights,
FT_Library_SetLcdFilter): Remove `lcd_extra' initializations.

* src/smooth/ftsmooth.c (ft_smooth_render_generic): Implement dymanic
LCD padding.
2017-05-20 00:35:21 -04:00
Werner Lemberg e99b26aada Remove remnants of raster pool.
* include/freetype/internal/ftobjs.h (FT_LibraryRec): Remove
`raster_pool' and `raster_pool_size' fields.

* src/base/ftobjs.c (FT_New_Library), src/raster/ftrend1.c
(ft_raster1_init), src/smooth/ftsmooth.c (ft_smooth_init): Updated.
2017-05-14 21:57:27 +02:00
Werner Lemberg a12a34451a * Version 2.8 released.
=======================

Tag sources with `VER-2-8'.

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

* 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/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.7.1/2.8/, s/271/28/.

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

* builds/unix/configure.raw (version_info): Set to 20:0:14.
* CMakeLists.txt (VERSION_MINOR): Set to 8.
(VERSION_PATCH): Set to 0.
2017-05-13 06:29:04 +02:00
Hin-Tak Leung 603121c050 Fix `FT_UINT_TO_POINTER' macro for Windows.
* builds/unix/ftconfig.in, builds/vms/ftconfig.h,
include/freetype/config/ftconfig.h (FT_UINT_TO_POINTER) [_WIN64]:
Fix definition.
2017-05-12 07:52:36 +02:00
Werner Lemberg 8cd31eb7b0 */*: s/backwards compatibility/backward compatibility/. 2017-05-03 23:54:29 +02:00
Werner Lemberg ba40054c2d [autofit] Remove `slight' auto-hint mode again.
A poll on freetype-devel favoured changes directly applied to
`light'.

* include/freetype/freetype.h (FT_LOAD_TARGET_SLIGHT,
FT_RENDER_MODE_SLIGHT): Removed.

* src/autofit/afcjk.c (af_cjk_hints_init), src/autofit/aflatin.c
(af_latin_hints_init), src/autofit/aflatin2.c
(af_latin2_hints_init): Revert change from 2017-04-22.

* src/autofit/afloader.c (af_loader_load_glyph) Remove references to
FT_RENDER_MODE_SLIGHT.
[AF_CONFIG_OPTION_TT_SIZE_METRICS]: Enable TrueType-like metrics
unconditionally.

* src/base/ftadvanc.c (LOAD_ADVANCE_FAST_CHECK): Revert change from
2017-04-22.

* src/base/ftobjs.c (FT_Load_Glyph): Revert change from 2017-04-22.

* src/pshinter/pshalgo.c (ps_hints_apply): Revert change from
2017-04-22.

* src/smooth/ftsmooth.c (ft_smooth_render): Revert change from
2017-04-22.

* docs/CHANGES: Updated.
2017-05-02 12:32:19 +02:00
Werner Lemberg 785833d96e * src/truetype/ttdriver.c (tt_size_request): Properly check `error'.
Reported by Earnestly <zibeon@googlemail.com> in

  http://lists.nongnu.org/archive/html/freetype/2017-04/msg00031.html
2017-04-29 06:47:14 +02:00
Werner Lemberg 0a5315d141 Introduce AF_CONFIG_OPTION_TT_SIZE_METRICS configuration option.
* include/freetype/config/ftoption.h
(AF_CONFIG_OPTION_TT_SIZE_METRICS): New option, commented out by
default.

* src/autofit/afloader.c (af_loader_load_glyph): Use
AF_CONFIG_OPTION_TT_SIZE_METRICS to guard the corresponding code.
2017-04-27 13:02:24 +02:00
Werner Lemberg ab10ffcdd5 * include/freetype/freetype.h (FT_Render_Mode): Fix order.
This retains backwards compatibility.

Noted by Alexei.
2017-04-26 13:41:40 +02:00
Werner Lemberg 5aa6716a5e Add new `slight' auto-hinting mode.
This mode uses fractional advance widths and doesn't scale glyphs
horizontally, only applying vertical scaling and hinting.

At the same time, the behaviour of the `light' auto-hinter gets
restored for backwards compatibility: Both vertical and horizontal
scaling is again based on rounded metrics values (this was changed
in a commit from 2017-03-30 as a side effect).  To be more precise,
the behaviour is restored for TrueType fonts only; for other font
formats like Type 1, this is a new feature of the `light' hinting
mode.

* include/freetype/freetype.h (FT_LOAD_TARGET_SLIGHT): New macro.
(FT_RENDER_MODE_SLIGHT): New render mode.

* include/freetype/internal/ftobjs.h (FT_Size_InternalRec): Add
`autohint_mode' and `autohint_metrics' fields.

* src/autofit/afcjk.c (af_cjk_hints_init), src/autofit/aflatin.c
(af_latin_hints_init), src/autofit/aflatin2 (af_latin2_hints_init):
Updated.

* src/autofit/afloader.c (af_loader_embolden_glyph_in_slot): Use
`autohint_metrics'.
(af_loader_load_glyph): s/internal/slot_internal/.
Initialize `autohint_metrics' and `autohint_mode' depending on
current auto-hint mode.
Use `autohint_metrics'.
Updated.

* src/base/ftadvanc.c (LOAD_ADVANCE_FAST_CHECK): Updated.

* src/base/ftobjs.c (FT_Load_Glyph): Updated.
(FT_New_Size): Allocate `internal' object.

* src/pshinter/pshalgo.c (ps_hints_apply): Updated.

* src/smooth/ftsmooth.c (ft_smooth_render): Updated.
2017-04-26 11:39:53 +02:00
Werner Lemberg 69da54cacc Document that some FT_Size_Metrics values are always rounded. 2017-04-26 09:58:28 +02:00