Commit Graph

549 Commits

Author SHA1 Message Date
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 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 40db4a9954 Allow (again) encoding vectors with more than 256 elements (#52464).
In version 2.6.1, this has been disallowed to better reject
malformed fonts; however, this restriction was too strong.  This
time, we only take the first 256 elements into account, since
encoding arrays are always accessed with a 8bit integer, according
to the PostScript Language Reference.

* src/type1/t1load.c (parse_encoding): Implement it.
2017-11-27 22:17:41 +01:00
Ewald Hew 7e23568b16 [type1, cid] Add hinting engine switch.
Implement property service in `type1' and `cid' drivers to allow
switching between FreeType or Adobe hinting engine when both are
available.

* src/cid/cidriver.c (cid_property_{set,get}, cid_services),
src/type1/t1driver.c (t1_property_{set,get}, t1_services): Add
Properties service.

* src/cid/cidobjs.c (cid_driver_init), src/type1/t1objs.c
(T1_Driver_Init): Add default property values.
2017-10-12 18:32:50 +08: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 e9ef538a4f Make `FT_Set_Named_Instance' work.
* src/cff/cffdrivr.c (cff_set_instance): New function.
(cff_service_multi_masters): Register it.

* src/truetype/ttgxvar.c (TT_Set_Named_Instance): New function.
* src/truetype/ttgxvar.h: Updated.
* src/truetype/ttdriver.c (tt_service_gx_multi_masters): Register
it.

* src/type1/t1load.c (T1_Reset_MM_Blend): New function.
* src/type1/t1load.h: Updated.
* src/type1/t1driver.c (t1_service_multi_masters): Register it.
2017-10-07 12:57:11 +02:00
Werner Lemberg 8c92f7622c Make `FT_FACE_FLAG_VARIATION' work.
* include/freetype/internal/tttypes.h (TT_Face): Remove
`is_default_instance'; this can be replaced with a combination of
`FT_IS_VARIATION' and `FT_IS_INSTANCE'.

* src/cff/cffdrivr.c (cff_get_advances): Updated.

* src/sfnt/sfdriver.c (sfnt_get_ps_name), src/sfnt/sfobjs.c
(sfnt_init_face): Updated.

* src/truetype/ttdriver.c (tt_get_advances), src/truetype/ttgload.c
(TT_Process_Simple_Glyph, load_truetype_glyph, IS_DEFAULT_INSTANCE),
src/truetype/ttgxvar.c (tt_set_mm_blend): Updated.
* src/truetype/ttgxvar.c (TT_Set_MM_Blend, TT_Set_Var_Design):
Handle `FT_FACE_FLAG_VARIATION'.

* src/type1/t1load.c (T1_Set_MM_Blend, T1_Set_MM_Design): Handle
`FT_FACE_FLAG_VARIATION'.
2017-10-07 12:12:49 +02:00
Werner Lemberg e23fe2adbc Add framework for setting named instance in MM service.
* include/freetype/internal/services/svmm.h (FT_Set_Instance_Func):
New function typedef.
(MultiMasters): Add `set_instance' member.
(FT_DEFINE_SERVICE_MULTIMASTERSREC): Updated.

* src/cff/cffdrivr.c (cff_service_multi_masters),
src/truetype/ttdriver (tt_service_gx_multi_masters),
src/type1/t1driver.c (t1_service_multi_masters): Updated.
2017-10-07 11:25:04 +02:00
Werner Lemberg f06456a82d [type1] Minor code shuffling.
* src/type1/t1load.c (T1_Set_MM_Blend): Make it a wrapper of...
(t1_set_mm_blend): ...this new function.
(T1_Set_MM_Design): Use `t1_set_mm_blend'.
2017-10-07 10:35:11 +02:00
Werner Lemberg af03d1eaa1 [smooth,type1] Formatting, whitespace. 2017-10-01 09:23:42 +02:00
Ewald Hew 6e7da50bc3 Documentation fixes. 2017-09-25 09:26:59 +02:00
Ewald Hew ebb1735aa7 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 (PSAux_ServiceRec): Update
`ps_decoder_init' 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 (_sources), src/psaux/rules.mk (PSAUX_DRV_SRC):
Update file references.
2017-09-25 09:26:59 +02:00
Ewald Hew 93e3cffddf 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-09-25 09:26:59 +02:00
Ewald Hew e28550af18 Switch to Adobe engine.
* src/type1/t1objs.c (T1_Driver_Init): Set default to Adobe engine.
2017-09-25 09:26:59 +02:00
Ewald Hew 283ef28505 Fixes for rendering.
The Type 1 advance width calculation passes null for glyph slot,
etc, which can cause null pointer access in the new interpreter.
Fall back to the old one for now.

Fix the large glyph retry code and ensure hinting and scaling flags
are set properly.

* src/type1/t1gload.c (T1_Parse_Glyph_And_Get_Char_String): Add a
check for metrics_only.
Set the `force_scaling' flag.
(T1_Parse_Glyph): Updated.
(T1_Load_Glyph): Add `hinting' and `scaled' flags.
2017-09-25 09:26:59 +02:00
Ewald Hew 6eb03f8f5a 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: Include FT_INTERNAL_CFF_TYPES_H.
(T1_Parse_Glyph_And_Get_Char_String): Add the call.
2017-09-25 09:26:59 +02:00
Ewald Hew 7e185dcd79 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 (T1_Decoder_FuncsRec): Register the
callbacks.

* src/psaux/psobjs.c (ps_builder_add_point): Add conditionals for
number conversion.

* src/type1/t1gload.c (T1_Parse_Glyph_And_Get_Char_String): Add code
to choose which renderer to use.

* src/cid/cidgload.c (cid_load_glyph): Update call.
* src/base/ftobjs.c, src/psaux/psobjs.c, src/type1/t1gload.c: Update
includes.
2017-09-25 09:26:59 +02:00
Ewald Hew 97704b158e Add Adobe engine configuration.
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 (FT_TYPE1_DRIVER_H): New macro.

* src/type1/t1driver.c (t1_driver_class): Update declaration.
* src/type1/t1objs.c: Include FT_TYPE1_DRIVER_H.
(T1_Driver_Init): Update code.
2017-09-25 09:26:59 +02:00
Ewald Hew d23affe1ef 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 (ps_builder_init, ps_builder_add_point):
Updated with above changes.
2017-09-25 09:26:59 +02: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 1ea343228d [cff, truetype] Integer overflows.
Reported as

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

* src/cff/cf2hints.c (cf2_hintmap_map): Use OVERFLOW_SUB_INT32.

* src/truetype/ttinterp.c (Ins_ADD): Use OVERFLOW_ADD_LONG.
(Ins_SUB): Use OVERFLOW_SUB_LONG.
(Ins_NEG): Use NEG_LONG.
2017-06-03 06:52:13 +02:00
Werner Lemberg 5412d8869b Introduce `FT_Size_InternalRec' structure.
We are going to extend this later on.

* include/freetype/internal/ftobjs.h (FT_Size_InternalRec): New
structure with a single field `module_data'.

* src/base/ftobjs.c (FT_New_Size): Allocate `internal' field of
`FT_Size' structure.

* src/cff/cffgload.c (cff_builder_init, cff_decoder_prepare): Use
`size->internal->module_data' instead of `size->internal'.

* src/cff/cffobjs.c (cff_size_done): Deallocate `module_data'.
(cff_size_init, cff_size_select, cff_size_request): Use
`size->internal->module_data' instead of `size->internal'.

* src/cif/cidobjs.c (cid_size_done, cid_size_init,
cid_size_request): Use `size->internal->module_data' instead of
`size->internal'.

* src/psaux/psobjs.c (t1_builder_ini): Use
`size->internal->module_data' instead of `size->internal'.

* src/type1/t1objs.c (T1_Size_Done, T1_Size_Init, T1_Size_Request):
Use `size->internal->module_data' instead of `size->internal'.
2017-04-22 12:48:50 +02:00
Werner Lemberg 9931175dcc Improve `make multi'.
* src/autofit/aflatin2.c: Guard file with FT_OPTION_AUTOFIT2.

* src/base/ftmac.c: Guard more parts of the file with FT_MACINTOSH.

* src/psaux/afmparse.c: Guard file with T1_CONFIG_OPTION_NO_AFM.

* src/sfnt/pngshim.c: Guard file with
TT_CONFIG_OPTION_EMBEDDED_BITMAPS also.

* src/sfnt/ttbdf.c: Avoid empty source file.
* src/sfnt/ttpost.c: Guard file with
TT_CONFIG_OPTION_POSTSCRIPT_NAMES.
* src/sfnt/ttsbit.c: Guard file with
TT_CONFIG_OPTION_EMBEDDED_BITMAPS.

* src/truetype/ttgxvar.c, src/truetype/ttinterp.c: Avoid empty
source file.

* src/truetype/ttsubpix.c: Guard file with
TT_USE_BYTECODE_INTERPRETER also.

* src/type1/t1afm.c: Guard file with T1_CONFIG_OPTION_NO_AFM.

* src/autofit/autofit.c, src/base/ftbase.c, src/cache/ftcache.c,
src/cff/cff.c, src/cid/type1cid.c, src/gxvalid/gxvalid.c,
src/pcf/pcf.c, src/pfr/pfr.c, src/psaux/psaux.c,
src/pshinter/pshinter.c, src/psnames/psnames.c, src/raster/raster.c,
src/sfnt/sfnt.c, src/smooth/smooth.c, src/truetype/truetype.c,
src/type1/type1.c, src/type42/type42.c: Remove conditionals; sort
entries.
2017-03-18 07:06:49 +01:00
Werner Lemberg 563ae78022 Update copyright year. 2017-01-04 20:16:34 +01:00
Werner Lemberg e5e3556fa2 [truetype, type1] Implement `FT_Get_Var_Design_Coordinates'.
* src/truetype/ttgxvar.c (TT_Get_Var_Design): Implement.
(TT_Set_Var_Design): Fix tracing.

* src/type1/t1load.c (T1_Get_Var_Design): Implement.
2016-12-27 06:49:37 +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 6949797d60 More code formatting. 2016-12-17 21:05:54 +01:00
Werner Lemberg 8b174b4b96 [truetype, type1] Add `get_var_blend' to MM service.
For internal use; we want to share code between the forthcoming CFF2
support and TrueType.

* include/freetype/internal/services/svmm.h (FT_Get_Var_Blend_Func):
New typedef.
(MultiMasters): Add `get_var_blend'.
(FT_Service_MultiMasters): Updated.

* src/truetype/ttgxvar.c (tt_get_var_blend): New function.
* src/truetype/ttgxvar.h: Updated.

* src/truetype/ttdriver.c (tt_service_gx_multi_masters): Updated.
* src/type1/t1driver.c (t1_service_multi_masters): Updated.
2016-12-11 09:16:52 +01:00
Werner Lemberg 27bdb36cbe [truetype, type1] Add `done_blend' to MM service.
For internal use; we want to share code between the forthcoming CFF2
support and TrueType.

* include/freetype/internal/services/svmm.h (FT_Done_Blend_Func):
New typedef.
(MultiMasters): Add `done_blend'.
(FT_Service_MultiMasters): Updated.

* src/truetype/ttgxvar.c (tt_done_blend): Use `TT_Face' as argument.
* src/truetype/ttgxvar.h: Updated.

* src/truetype/ttobjs.c (TT_Face_Done): Updated.

* src/truetype/ttdriver.c (tt_service_gx_multi_masters): Updated.
* src/type1/t1driver.c (t1_service_multi_masters): Updated.
2016-12-10 09:56:03 +01:00
Dave Arnold bcae657482 Add `FT_Get_Var_Design_Coordinates' function.
Note that the low-level functions aren't implemented yet.

* include/freetype/ftmm.h: Declare.

* include/freetype/internal/services/svmm.h
(FT_Get_Var_Design_Func): New typedef.
(MultiMasters): New MM service function `get_var_design'.
(FT_DEFINE_SERVICE_MULTIMASTERSREC): Updated.
Update all callers.

* src/base/ftmm.c (FT_Get_Var_Design_Coordinates): Implement.

* src/truetype/ttdriver.c: Updated.

* src/truetype/ttgxvar.c (TT_Get_Var_Design): New dummy function to
handle `get_var_design' service.
* src/truetype/ttgxvar.h: Updated.

* src/type1/t1driver.c: Updated.

* src/type1/t1load.c (T1_Get_Var_Design): New dummp function to
handle `get_var_design' service.
* src/type1/t1load.h: Updated.
2016-12-06 11:49:15 +01:00
Werner Lemberg c0fae7da5a * src/type1/t1load.c (parse_subrs): Fix memory leak.
The `subrs' keyword might erroneously occur multiple times.

Reported as

  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=231
2016-12-06 11:13:19 +01:00
Werner Lemberg 9c45ac3966 Add `FT_Get_{MM,Var}_Blend_Coordinates' functions.
* include/freetype/ftmm.h: Declare.

* include/freetype/internal/services/svmm.h (FT_Get_MM_Blend_Func):
New typedef.
(MultiMasters): New MM service function `get_mm_blend'.
(FT_DEFINE_SERVICE_MULTIMASTERSREC): Updated.
Update all callers.

* src/base/ftmm.c (FT_Get_MM_Blend_Coordinates,
FT_Get_Var_Blend_Coordinates): Implement.

* src/truetype/ttdriver.c: Updated.

* src/truetype/ttgxvar.c (TT_Get_MM_Blend): New function to handle
`get_mm_blend' service.
* src/truetype/ttgxvar.h: Updated.

* src/type1/t1driver.c: Updated.

* src/type1/t1load.c (T1_Get_MM_Blend): New function to handle
`get_mm_blend' service.
* src/type1/t1load.h: Updated.

* docs/CHANGES: Document.
2016-10-26 16:00:00 +02:00
Werner Lemberg 5614090725 * src/type1/t1load.c (parse_subrs): Fix limit check.
Reported as

  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=81
2016-10-26 08:10:59 +02:00
Werner Lemberg 2ecf89b481 */*: s/FT_MEM_ZERO/FT_ZERO/ where appropriate. 2016-09-28 19:06:21 +02:00
Werner Lemberg c95b7652d8 s/0/NULL/ for function pointers; comments, formatting. 2016-09-17 17:12:50 +02:00
Werner Lemberg ebbb8b2e19 [type1] MM fonts support exactly zero named instances (#48748).
* src/type1/t1load.c (T1_Get_MM_Var): Set `num_namedstyles' to zero.
2016-09-06 16:28:57 +02:00
Werner Lemberg a660e3de42 [type1] Fix heap buffer overflow.
Reported as

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

* src/type1/t1load.c (parse_charstrings): Reject fonts that don't
contain glyph names.
2016-08-26 00:23:27 +02:00
Werner Lemberg d583561e1d Minor clang++ fixes.
* src/base/ftobjs.c (FT_Add_Module), src/psaux/psobjs.c
(ps_parser_load_field), src/type1/t1load.c (parse_subrs): Add
initializer.

* src/cache/ftccache.h (FTC_CACHE_TRYLOOP_END): Avoid implicit
conversion from NULL to boolean.
2016-05-21 11:20:42 +02:00
Werner Lemberg 3295039107 Whitespace. 2016-02-15 12:54:40 +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
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 9c1a2b0439 * src/type1/t1load.c (parse_subrs): Fix memory leak (#46744). 2015-12-22 12:05:46 +01:00
Werner Lemberg 7ce6c43c3e [base] Make hash interface symmetric.
Use `num' and `str' infixes everywhere.

* src/base/fthash.c (ft_hash_init): Renamed to...
(hash_init): ... This.
(ft_hash_str_init, ft_hash_num_init): New functions.
(ft_hash_free): Renamed to...
(ft_hash_str_free): ... This.

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

* src/bdf/bdflib.c, src/type1/t1load.c, src/type1/t1objs.c: Updated.
2015-12-22 05:39:58 +01:00
Werner Lemberg 60d13bd432 [type1] Avoid shift of negative numbers (#46732).
* src/type1/t1load.c (parse_subrs): Do it.
2015-12-21 17:27:17 +01:00
Werner Lemberg bd4b8976a3 [type1, psaux] Handle large values of num_subrs correctly (#46692).
We now use a hash to map from subr indices to array elements holding
the subroutines, if necessary.

* include/freetype/internal/t1types.h: Include FT_INTERNAL_HASH_H.
(T1_FontRec): Add `subrs_hash' field.

* include/freetype/internal/psaux.h: Include FT_INTERNAL_HASH_H.
(T1_DecoderRec): Add `subrs_hash' field.

* src/type1/t1load.h (T1_LoaderRec): Add `subrs_hash' field.

* src/type1/t1driver.c: Include FT_INTERNAL_HASH_H.
(t1_ps_get_font_value) [PS_DICT_SUBR]: Look up hash if necessary.

* src/type1/t1load.c: Include FT_INTERNAL_HASH_H.
(parse_subrs): Use hash for subr indices that exceed the allocated
number of subr slots.
(t1_init_loader): Remove unnecessary code.
(t1_done_loader, T1_Open_Face): Updated.

* src/type1/t1gload.c (T1_Compute_Max_Advance, T1_Get_Advances,
T1_Load_Glyph): Updated.

* src/type1/t1objs.c (T1_Face_Done): Updated.

* src/psaux/t1decode.c: Include FT_INTERNAL_HASH_H.
(t1_decoder_parse_charstrings) [op_callsubr]: Look up hash if
necessary.

* src/cid/cidgload.c (cid_load_glyph): Updated.
2015-12-20 19:36:04 +01:00
Werner Lemberg 5b05bc6638 [type1] Avoid dangling pointer (#46572).
* src/type1/t1afm.c (T1_Read_Metrics): Properly reset
`face->afm_data'.
2015-12-01 12:09:02 +01:00
Werner Lemberg 4188deacf3 Comments. 2015-10-30 08:07:56 +01:00
Werner Lemberg 3c582060b2 * src/type1/t1afm.c (T1_Read_Metrics): Fix memory leak (#46229). 2015-10-20 06:57:28 +02:00
Werner Lemberg 5179c89f61 Comments. 2015-10-19 08:49:25 +02:00
Werner Lemberg 8539915d18 [type1] Correctly handle missing MM axis names (#46202).
* src/type1/t1load.c (T1_Get_MM_Var): Implement it.
2015-10-13 20:43:19 +02:00
Werner Lemberg 121122416d [type1] Protect against invalid number of subroutines (#46150).
* src/type1/t1load.c (parse_subrs): Check number of
`Subrs' dictionary entries against size of data stream.
2015-10-08 08:55:15 +02:00
Werner Lemberg 2439c515a7 [type1] Protect against invalid number of glyphs (#46029).
* src/type1/t1load.c (parse_charstrings): Check number of
`CharStrings' dictionary entries against size of data stream.
2015-09-25 16:54:28 +02:00
Werner Lemberg 19cb1127d4 [type1, type42] Fix memory leaks (#45966).
* src/type1/t1load.c (parse_blend_axis_types): Handle multiple axis
names.
(parse_blend_design_map): Allow only a single design map.
(parse_encoding): Handle multiple encoding vectors.

* src/type42/t42parse.c (t42_parse_encoding): Handle multiple
encoding vectors.
2015-09-15 08:52:36 +02:00
Werner Lemberg 581c7e2a51 [type1, type42] Check encoding array size (#45961).
* src/type1/t1load.c (parse_encoding), src/type42/t42parse.c
(t42_parse_encoding): Do it.
2015-09-15 06:49:06 +02:00
Werner Lemberg 7962a15d64 [type1] Fix another potential buffer overflow (#45955).
* src/type1/t1parse (T1_Get_Private_Dict): Assure that check for
`eexec' doesn't exceed `limit'.
2015-09-14 00:38:26 +02:00
Werner Lemberg e3058617f3 [type1] Fix potential buffer overflow (#45923).
* src/type1/t1parse.c (T1_Get_Private_Dict): Assure `cur' doesn't
point to end of file buffer.
2015-09-13 08:41:43 +02:00
Werner Lemberg 55fed89e3b Remove obsolete comment.
Found by Akira Kakuto <kakuto@fuk.kindai.ac.jp>.
2015-08-24 06:00:49 +02:00
Werner Lemberg 14d6b5d748 [truetype] Introduce named instance access to GX fonts.
For functions querying a face, bits 16-30 of the face index can hold
the named instance index if we have a GX font.  The indices start
with value 1; value 0 indicates font access without GX variation
data.

* include/freetype/freetype.h (FT_FaceRec): Update documentation.
* include/freetype/internal/sfnt.h: Ditto.

* src/sfnt/sfobjs.c (sfnt_init_face)
[TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Get number of named instances and
do argument checks.
(sfnt_load_face): Updated.

* src/truetype/ttobjs.c (tt_face_init)
[TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Use named instance, overwriting
the style name.

* src/base/ftobjs.c (open_face_from_buffer,
open_face_PS_from_sfnt_stream): Updated.
* src/bdf/bdfdrivr.c (BDF_Face_Init): Updated.
* src/cff/cffload.c (cff_font_load): Updated.

* src/cff/cffobjs.c (cff_face_init): Make function exit early for
pure CFF fonts if `font_index < 0'.
Updated.

* src/cid/cidobjs.c (cid_face_init): Updated.
* src/pcf/pcfdrivr.c (PCF_Face_Init): Updated.
* src/pfr/pfrobjs.c (pfr_face_init): Updated.
* src/type1/t1objs.c (T1_Face_Init): Updated.
* src/type42/t42objs.c (T42_Face_Init): Updated.
* src/winfonts/winfnt.c (fnt_face_get_dll_font, FNT_Face_Init):
Updated.

* docs/CHANGES: Updated.
2015-08-13 15:22:17 +02:00
Alexei Podtelezhnikov 4afc0a54ed Comment typos. 2015-08-12 23:51:02 -04:00
Alexei Podtelezhnikov 4a46686508 [type1,cff,cid] Streamline font matrix application.
* src/type1/t1gload.c (T1_Load_Glyph): Directly modify advances only
if font matrix is not trivial.
* src/cff/cffgload.c (cff_slot_load): Ditto.
* sff/cid/cidgload.c (cid_slot_load_glyph): Ditto for advances and the
entire outline.
2015-08-12 23:45:40 -04:00
Alexei Podtelezhnikov a37da21a49 [type1,cid,type42] Minor improvements.
* src/type1/t1load.c (t1_parse_font_matrix): Scale units per EM only
when necessary. Refresh comments.
* src/cid/cidload.c (cid_parse_font_matrix): Ditto.
* src/type42/t42parse.c (t42_parse_font_matrix): Refresh comments.
2015-08-10 23:05:02 -04:00
Werner Lemberg 31d97df99f Make Jam support work again.
This is just very basic stuff and just a little bit tested on
GNU/Linux only.  I won't delve into this since I'm not a Jam user.

* Jamfile: Call `HDRMACRO' for `ftserv.h' also.
(DEFINES): Replace with...
(CCFLAGS): ... this.

* src/Jamfile: Don't call `HDRMACRO' for `internal.h'; this is
already handled in the top-level Jamfile.

* src/autofit/Jamfile (DEFINES): Replace with...
(CCFLAGS): ... this.
(_sources): Add missing files.

* src/cache/Jamfile: Don't call `HDRMACRO' for `ftcache.h'; it no
longer contains macro header definitions.

* src/base/Jamfile, src/cff/Jamfile, src/sfnt/Jamfile,
src/truetype/Jamfile (_sources): Add missing files.
2015-06-21 19:12:12 +02:00
Alexei Podtelezhnikov eabc8d72e0 [psaux,psnames,type1,type42] NULL. 2015-04-12 23:16:48 -04:00
Werner Lemberg 10e2bb8b3d [type1, truetype] Make the MM API more flexible w.r.t. `num_coords'.
This commit allows `num_coords' to be larger or smaller than the
number of available axes while selecting a design instance, either
ignoring excess data or using defaults if data is missing.

* src/truetype/ttgxvar.c (TT_Set_MM_Blend, TT_Set_Var_Design):
Implement it.

* src/type1/t1load.c (T1_Set_MM_Blend, T1_Set_MM_Design,
T1_Set_Var_Design): Ditto.
2015-03-29 13:32:47 +02:00
Werner Lemberg dd5d6d7a80 [type1] Minor.
* src/type1/t1load.c (T1_Set_MM_Blend, T1_Set_MM_Design): Use
FT_THROW.
(T1_Set_Var_Design): Use T1_MAX_MM_AXIS and FT_THROW.
2015-03-29 10:04:22 +02:00
Werner Lemberg a451638ec5 Rename `svxf86nm.h' to `svfntfmt.h'; update related symbols.
* include/internal/ftserv.h (FT_SERVICE_XFREE86_NAME_H): Renamed
to...
(FT_SERVICE_FONT_FORMAT_H): This.

* include/internal/services/svfntfmt.h (FT_XF86_FORMAT_*): Renamed
to ...
(FT_FONT_FORMAT_*): This.

src/base/ftfntfmt.c, src/bdf/bdfdrivr.c, src/cff/cffdrivr.c,
src/cid/cidriver.c, src/pcf/pcfdrivr.c, src/pfr/pfrdrivr.c,
src/truetype/ttdriver.c, src/type1/t1driver.c,
src/type42/t42drivr.c, src/winfonts/winfnt.c: Updated.
2015-03-11 08:55:12 +01:00
Werner Lemberg 851e815127 Various compiler warning fixes for `make multi'.
* src/autofit/afcjk.c (af_cjk_hints_compute_blue_edges),
src/autofit/aflatin.c (af_latin_hint_compute_blue_edges,
af_latin_hint_edges), src/autofit/aflatin2.c
(af_latin2_hints_compute_blue_edges, af_latin2_hint_edges): Declare
as `static'.

* src/cache/ftccmap.c (FTC_CMAP_QUERY_HASH, FTC_CMAP_NODE_HASH):
Removed.  Unused.
* src/cache/ftcimage.c: Include FT_INTERNAL_OBJECTS_H.
* src/cache/ftcmanag.c (FTC_LRU_GET_MANAGER): Removed.  Unused.

* src/cff/cf2intrp.c: Include `cf2intrp.h'.
* src/cff/cffdrivr.c (PAIR_TAG): Removed.  Unused.

* src/gzip/ftgzip.c (NO_DUMMY_DECL): Removed.  Unused.

* src/psaux/afmparse.c (afm_parser_read_int): Declare as `static'.

* src/pshinter/pshalgo.c (STRONGER, PSH_ZONE_MIN, PSH_ZONE_MAX):
Removed.  Unused.

* src/raster/ftraster.c (Render_Glyph): Declare as `static'.

* src/sfnt/ttpost.c (load_format_20): Fix signedness warning.

* src/truetype/ttdriver.c (PAIR_TAG): Removed.  Unused.
* src/truetype/ttsubpix.c (is_member_of_family_class,
is_member_of_style_class): Declare as `static'.

* src/type1/t1gload.c (T1_Parse_Glyph_And_Get_Char_String): Declare
as `static'.
* src/type1/t1load.c (mm_axis_unmap, mm_weights_unmap): Declare as
`static'.
(T1_FIELD_COUNT): Removed.  Unused.
* src/type1/t1parse.h (T1_Done_Table): Removed.  Unused.

* src/type42/t42parse.c (T1_Done_Table): Removed.  Unused.
2015-03-01 19:27:09 +01:00
Werner Lemberg 3b5f332c5b [type1] Fix signedness issues.
* include/internal/psaux.h, include/internal/t1types.h,
src/psaux/psobjs.c, src/psaux/psobjs.h, src/psaux/t1decode.c,
src/type1/t1gload.c, src/type1/t1load.c, src/type1/t1parse.c: Apply.
2015-02-18 11:45:22 +01:00
Werner Lemberg 272e3cd077 [psaux, type1] Fix minor AFM issues.
* include/internal/t1types.h (AFM_KernPairRec): Make indices
unsigned.
Update users.
(AFM_FontInfoRec): Make element counters unsigned.
Update users.
* src/psaux/afmparse.h (AFM_ValueRec): Add union member for unsigned
int.

* src/psaux/afmparse.c (afm_parse_track_kern, afm_parse_kern_pairs):
Reject negative values for number of kerning elements.

* src/type1/t1afm.c, src/tools/test_afm.c: Updated.
2015-02-18 11:38:46 +01:00
Werner Lemberg 6bd7d28fc7 Don't use `FT_PtrDist' for lengths.
Use FT_UInt instead.

* include/internal/psaux.h (PS_Table_FuncsRec, PS_TableRec,
T1_DecoderRec): Do it.

* include/internal/t1types.h (T1_FontRec): Ditto.

* src/cid/cidload.c (cid_parse_dict): Updated.
* src/pfr/pfrload.c (pfr_extra_item_load_font_id): Ditto.
* src/psaux/psobjs.c (ps_table_add), src/psaux/psobjs.h: Ditto.
* src/type1/t1load.c (parse_blend_axis_types, parse_encoding,
parse_chharstrings, parse_dict): Ditto.
* src/type42/t42parse.c (t42_parse_encoding, t42_parse_charstrings,
t42_parse_dict): Ditto.
2015-02-18 09:22:06 +01:00
Werner Lemberg 6a0ded7641 * src/type1/t1driver.c (t1_ps_get_font_value): Clean up.
This handles negative values better, avoiding many casts.
2015-02-18 08:51:22 +01:00
Werner Lemberg f57fc59e01 Run `src/tools/update-copyright'. 2015-01-17 20:41:43 +01:00
Werner Lemberg 36d03c9f58 Fix Savannah bug #43976.
Assure that FreeType's internal include directories are found before
`CPPFLAGS' (which might be set by the user in the environment), and
`CPPFLAGS' before `CFLAGS'.

* builds/freetype.mk (FT_CFLAGS): Don't add `INCLUDE_FLAGS'.
(FT_COMPILE): Make this a special variable for compiling only the
files handled in `freetype.mk'.
(.c.$O): Removed, unused.

* src/*/rules.mk (*_COMPILE): Fix order of include directories.
2015-01-12 11:26:30 +01:00
Werner Lemberg b24e8ba28a [Savannah bug #43682] Add/remove `void' casts to some functions.
We use a cast to indicate that we intentionally ignore a function's
return value.  However, this doesn't apply to API functions where
errors can only happen for trivially invalid input.

* src/base/ftstroke.c (FT_Glyph_Stroke, FT_Glyph_StrokeBorder),
src/base/ftsynth.c (FT_GlyphSlot_Embolden), src/cff/cffgload.c
(cff_slot_load), src/pfr/pfrdrivr.c (pfr_get_kerning),
src/type1/t1load.c (parse_encoding), src/type42/t42parse.c
(t42_parse_encoding): Do it.
2014-11-25 08:30:49 +01:00
Werner Lemberg 73be9f9ab6 [type1, type42] Another fix for Savannah bug #43655.
* src/type1/t1load.c (parse_charstrings), src/type42/t42parse.c
(t42_parse_charstrings): Add another boundary testing.
2014-11-24 07:30:05 +01:00
Werner Lemberg dd89710f0f [type1, type42] Fix Savannah bug #43655.
* src/type1/t1load.c (parse_charstrings), src/type42/t42parse.c
(t42_parse_charstrings): Fix boundary testing.
2014-11-21 22:19:28 +01:00
Sean McBride 87628724a9 Fix clang warnings.
* src/autofit/aflatin.c (af_latin_metrics_init_blues): Initialize
some variables.

* src/base/ftcalc.c (FT_MulFix): Only use code if
`FT_MULFIX_INLINED' is not defined.

* src/bdf/bdfdrivr.c (bdf_cmap_class), src/cache/ftcbasic.c
(ftc_basic_image_family_class, ftc_basic_image_cache_class,
ftc_basic_sbit_family_class, ftc_basic_sbit_cache_class),
src/cache/ftccmap.c (ftc_cmap_cache_class), src/cache/ftcmanag.c
(ftc_size_list_class, ftc_face_list_class), src/pcf/pcfdrivr.c
(pcf_cmap_class), src/pfr/pfrdrivr.c (pfr_metrics_service_rec): Make
function static.

* src/type1/t1driver.c (t1_ps_get_font_value): Remove redundant
code.
2014-03-18 08:39:35 +01:00
Werner Lemberg 7ac76b50da Fix several clang static analyzer dead store warnings.
* src/autofit/afhints.c (af_glyph_hints_reload,
af_glyph_hints_align_weak_points): Remove unnecessary assignments.

* src/bdf/bdflib.c (bdf_font_load): Ditto.

* src/pshinter/pshalgo.c (psh_glyph_compute_extrema,
psh_glyph_interpolate_other_points): Ditto.

* src/type1/t1load.c (T1_Set_MM_Blend): Ditto.
2014-03-04 04:29:17 +01:00
Werner Lemberg 6b290fd21c Fix Savannah bug #32902.
Patch taken from

  https://code.google.com/p/sumatrapdf/source/browse/trunk/ext/_patches/freetype2.patch?spec=svn8620&r=8620#87

with slight modifications.

* src/type1/t1parse.c (T1_Get_Private_Dict): Add heuristic test to
handle fonts that incorrectly use \r at the beginning of an eexec
block.
2014-02-19 09:31:24 +01:00
Simon Bünzli df14e6c0b9 Fix Savannah bug #41590.
* src/type1/t1load.c (parse_encoding): Protect against invalid
number.
2014-02-19 09:31:23 +01:00
Sean McBride 7be2a94a50 Fix clang static analyzer and compiler warnings.
* src/autofit/afhints.c (af_glyph_hints_align_weak_points),
src/autofit/afloader (af_loader_load_g) <FT_GLYPH_FORMAT_COMPOSITE>,
src/base/ftcalc.c (FT_MSB), src/base/ftoutln.c
(FT_Outline_Decompose), src/bdf/bdfdrivr.c (bdf_interpret_style),
src/cff/cffparse.c (cff_parse_integer), src/cid/cidparse.c
(cid_parser_new), src/pfr/pfrload.c (pfr_phy_font_load),
src/raster/ftraster.c (Decompose_Curve), src/sfnt/sfdriver.c
(sfnt_get_ps_name), src/sfnt/ttcmap.c (tt_cmap12_next,
tt_cmap13_next), src/smooth/ftgrays.c (gray_hline): Remove dead
code.

* src/autofit/afmodule.c (af_property_get_face_globals,
af_property_set, af_property_get), src/base/ftbitmap.c
(ft_gray_for_premultiplied_srgb_bgra): Make functions static.

* src/base/ftobjs.c (ft_remove_renderer): Protect against
library == NULL.
(ft_property_do): Make function static.

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

* src/sfnt/ttsbit.c (tt_face_load_sbix_image)
[!FT_CONFIG_OPTION_USE_PNG], src/type1/t1gload.c
(T1_Compute_Max_Advance): Avoid compiler warning.

* src/truetype/ttinterp.c (TT_New_Context): Reduce scope of
variable.
2014-02-08 13:55:38 +01:00
Werner Lemberg 8b281f83e8 Fix Savannah bug #41309.
* src/type1/t1load.c (t1_parse_font_matrix): Properly handle result
of `T1_ToFixedArray'.

* src/cid/cidload.c (cid_parse_font_matrix): Synchronize with
`t1_parse_font_matrix'.

* src/type42/t42parse.c (t42_parse_font_matrix): Synchronize with
`t1_parse_font_matrix'.
(t42_parse_encoding): Synchronize with `t1_parse_encoding'.

* src/psaux/psobjs.c (ps_parser_load_field) <T1_FIELD_TYPE_BBOX>,
<T1_FIELD_TYPE_MMOX>: Properly handle result of `ps_tofixedarray'.
2014-01-23 08:14:53 +01:00
Werner Lemberg 5f577462bd Fix Savannah bug #40997.
* src/bdf/bdfdrivr.c (BDF_Face_Init): Only use OR operator to
adjust face flags since FT_FACE_FLAG_EXTERNAL_STREAM might already
be set.
* src/cff/cffobjs.c (cff_face_init): Ditto.
* src/cid/cidobjs.c (cid_face_init): Ditto.
* src/pcf/pcfread.c (pcf_load_font): Ditto.
* src/pfr/pfrobjs.c (pfr_face_init): Ditto.
* src/type1/t1objs.c (T1_Face_Init): Ditto.
* src/type42/t42objs.c (T42_Face_Init): Ditto.
* src/winfonts/winfnt.c (FNT_Face_Init): Ditto.
2013-12-25 08:50:50 +01:00
Werner Lemberg ffee64afb8 Better tracing of loaded glyphs.
Previously, the loading of a glyph was traced at level 4, if at all.
With this change, all font loading routines emit a tracing message
at level 1, making it easier to select tracing output (for example
using F2_DEBUG="any:1 afhints:7 aflatin:7").

* src/bdf/bdfdrivr.c (BDF_Glyph_Load): Add tracing message.
* src/cff/cffdrivr.c (cff_glyph_load): Ditto.
* src/cff/cffgload.c (cff_decoder_prepare): Improve tracing
messages.
* src/cid/cidgload.c (cid_load_glyph): Use level 1 for tracing
message.
* src/pcf/pcfdrivr.c (PCF_Glyph_Load): Ditto.
* src/pfr/pfrobjs.c (pfr_slot_load): Add tracing message.
* src/truetype/ttgload.c (TT_Load_Glyph): Ditto.
* src/type1/t1gload.c (T1_Load_Glyph): Ditto.
* src/type42/t42objs.c (T42_GlyphSlot_Load): Ditto.
* src/winfonts/winfnt.c (FNT_Load_Glyph): Ditto.
2013-08-26 12:55:48 +02:00
Werner Lemberg e8ed2d621e Another round of cppcheck nitpicks.
The call was (from the top-level of the FreeType tree):

  cppcheck --force \
           --enable=all \
           -I /usr/include \
           -I /usr/local/include \
           -I /usr/lib/gcc/i586-suse-linux/4.7/include \
           -I include \
           -I include/freetype \
           -I include/freetype/config \
           -I include/freetype/internal \
           -DFT2_BUILD_LIBRARY \
           . &> cppcheck.log

using cppcheck git commit f7e93f99.

Note that cppcheck still can't handle `#include FOO' (with `FOO' a
macro).

*/* Improve variable scopes.
*/* Remove redundant initializations which get overwritten.

* src/gxvalid/*: Comment out redundant code or guard it with
FT_DEBUG_LEVEL_TRACE.
2013-08-01 12:20:20 +02:00
Werner Lemberg c06889eb2c More compiler warning fixes.
*/*: Use cast to `FT_Bool' (or `Bool') where appropriate.
2013-06-12 10:58:06 +02:00
Werner Lemberg badf317840 Next round of compiler fixes.
* builds/win32/ftdebug.c, builds/wince/ftdebug.c (ft_debug_init):
Add proper cast.

* include/freetype/internal/ftserv.h (FT_SERVICE_UNAVAILABLE): Fix
cast.
* include/freetype/internal/ftstream.h: Decorate stream and frame
macros with `FT_Long' and `FT_ULong' as appropriate.

* src/base/ftrfork.c (raccess_guess_darwin_hfsplus,
raccess_guess_darwin_newvfs): Use cast.

* src/bdf/bdflib.c (_bdf_set_default_spacing): Use cast.

* src/cache/ftcmanag.c (FTC_Manager_Check): Fix cast.
* src/cache/ftcmanag.h (FTC_ManagerRec): Ditto.

* src/cff/cf2arrst.c (cf2_arrstack_setNum_Elements): Use cast.
* src/cff/cf2ft.c (cf2_freeSeacComponent): Ditto.
* src/cff/cffobjs.c (remove_subset_prefix, remove_style): Ditto.

* src/cid/cidparse.c (cid_parser_new): Use cast.

* src/pcf/pcfdrivr.c (PCF_Glyph_Load): Use cast.

* src/psaux/psobjs.c (reallocate_t1_table): Fix argument type.

* src/raster/ftraster.c (ft_black_reset): Use cast.

* src/truetype/ttgxvar.c (FT_Stream_FTell): Use cast.
(ALL_POINTS): Fix cast.

* src/type1/t1driver.c (t1_ps_get_font_value): Add casts.
* src/type1/t1parse.c (T1_Get_Private_Dict): Add cast.
2013-06-06 09:16:38 +02:00
Werner Lemberg 45392b77a8 Fix compiler warnings.
* include/freetype/internal/ftmemory.h: Decorate memory allocation
macros with `FT_Long' where appropriate.
Remove duplicate of FT_MEM_QRENEW_ARRAY definition.

* src/base/ftbitmap.c (ft_gray_for_premultiplied_srgb_bgra): Use
cast.

* src/base/ftobjs.c: Add warning disabling pragma for MSVC while
including `md5.c'.

* src/cff/cf2intrp.c (cf2_interpT2CharString) <cf2_cmdESC>: Add
cast.

* src/sfnt/ttsbit.c (tt_sbit_decoder_load_compound): Fix casts.
(tt_sbit_decoder_load_bitmap): Beautification.

* src/smooth/ftsmooth.c (ft_smooth_render_generic): Initialize
variables (earlier).

* src/truetype/ttgload.c (TT_Process_Simple_Glyph): Pacify compiler.

* src/truetype/ttgxvar.c (TT_Get_MM_Var): Use unsigned constants
where appropriate.

* src/type1/t1load.c (T1_Get_MM_Var): Ditto.
2013-06-05 13:43:20 +02:00
Werner Lemberg dc624ca4dc Apply fixes for cppcheck nitpicks.
http://cppcheck.sourceforge.net/

Note that the current version heavily chokes on FreeType, delivering
even wrong results.  I will report those issues to the cppcheck team
so that a newer version gives improved results hopefully.

*/* Improve variable scopes.
*/* Remove redundant initializations which get overwritten.

* src/base/ftmac.c ,builds/mac/ftmac.c (count_faces_scalable):
Remove unused variable.

* src/base/ftdbgmem.c (ft_mem_table_destroy): `table' can't be zero.

* src/gxvalid/gxvkern.c (gxv_kern_subtable_fmt1_entry_validate):
Remove functionless code.

* src/tools/ftrandom.c (main): Fix memory leak.
2013-06-04 10:30:48 +02:00
Werner Lemberg f6aa089f12 */* [FT_CONFIG_OPTION_OLD_INTERNALS]: Remove macro and guarded code. 2013-05-10 07:58:47 +02:00
Werner Lemberg 89f5064765 */*: Use FT_ERR_EQ, FT_ERR_NEQ, and FT_ERR where appropriate.
FT_Err_XXX and friends are no longer directly used in the source
code.
2013-03-14 17:50:49 +01:00
Werner Lemberg e3c9301581 */*: Use FT_Err_Ok only.
This is a purely mechanical conversion.
2013-03-14 11:21:17 +01:00
Werner Lemberg 059bc335ce */*: Use `FT_THROW'.
This is essentially a mechanical conversion, adding inclusion of
`FT_INTERNAL_DEBUG_H' where necessary, and providing the macros for
stand-alone compiling modes of the rasterizer modules.

To convert the remaining occurrences of FT_Err_XXX and friends it is
necessary to rewrite the code.  Note, however, that it doesn't harm
if some cases are not handled since FT_THROW is a no-op.
2013-03-14 10:27:35 +01:00
Werner Lemberg d6bc524bdc Always use module related error codes.
* src/cff/cffobjs.c (cff_face_init), src/type1/t1objs.c
(T1_Face_Init), src/type42/t42objs.c (T42_Face_Init): Use
`FT_ERROR_BASE'.

* src/type1/t1load.c (parse_encoding): Use
T1_Err_Unknown_File_Format.
2013-03-11 09:50:53 +01:00
Werner Lemberg f44f3f0e43 Formatting, minor internal documentation improvement. 2012-12-23 18:30:34 +01:00
Werner Lemberg a9f6f85e77 Various compiler warning fixes.
* include/freetype/internal/ftserv.h (FT_SERVICE_UNAVAILABLE): Use
`logical not' operator instead of negation.  The idea is that `~'
returns exactly the data type enforced by the cast to a pointer (be
it 32bit or 64bit or whatever), while a negative integer has not
this flexibility.
* src/cache/ftccmap.c (FTC_CMAP_UNKNOWN): Ditto.
* src/truetype/ttgxvar.c (ALL_POINTS, TT_Get_MM_Var): Ditto.
* src/type/t1load.c (T1_Get_MM_Var): Ditto.
(parse_blend_axis_types): Use cast.
* src/bdf/bdflib.c (_bdf_readstream): Use cast.
2012-12-17 09:08:09 +01:00