Commit Graph

378 Commits

Author SHA1 Message Date
Werner Lemberg 4aaadf4610 [truetype] More macro expansions.
* src/truetype/ttinterp.c (FT_UNUSED_EXEC): Remove macro by
expansion.
2015-01-11 08:42:28 +01:00
Werner Lemberg d03a67a12c [truetype] More macro expansions.
* src/truetype/ttinterp.c (INS_ARG): Remove macro by expansion,
adjusting funtion calls where necessary.
(FT_UNUSED_ARG): Removed, no longer needed.
2015-01-11 08:39:14 +01:00
Werner Lemberg 7e1db6d42d Formatting, typos. 2015-01-11 00:56:55 +01:00
Werner Lemberg eb3413684f [truetype] More macro expansions.
Based on a patch from Behdad.

* src/truetype/ttinterp.c (DO_*): Expand macros into corresponding
`Ins_*' functions.
(TT_RunIns): Replace `DO_*' macros with `Ins_*' function calls.
(ARRAY_BOUND_ERROR): Remove second definition, which is no longer
needed.
(Ins_SVTCA, Ins_SPVTCA, Ins_SFVTCA): Replaced with...
(Ins_SxyTCA): New function.
2015-01-11 00:23:27 +01:00
Werner Lemberg 01be130d73 [truetype] Remove TT_CONFIG_OPTION_INTERPRETER_SWITCH.
Behdad suggested this code simplification, and nobody objected...

* include/config/ftoption.h, devel/ftoption.h
(TT_CONFIG_OPTION_INTERPRETER_SWITCH): Remove.

* src/truetype/ttinterp.c [TT_CONFIG_OPTION_INTERPRETER_SWITCH]:
Remove related code.
(ARRAY_BOUND_ERROR): Use do-while loop.
2015-01-10 23:05:37 +01:00
Werner Lemberg 6cc1f123aa [truetype] More macro expansions.
* src/truetype/ttinterp.c, src/truetype/ttinterp.h (EXEC_ARG_,
EXEC_ARG): Remove by replacing with expansion.
2015-01-10 21:56:59 +01:00
Werner Lemberg 246814554f [truetype] More macro expansions.
Based on a patch from Behdad.

* src/truetype/ttinterp.c (SKIP_Code, GET_ShortIns, NORMalize,
SET_SuperRound, ROUND_None, INS_Goto_CodeRange, CUR_Func_move,
CUR_Func_move_orig, CUR_Func_round, CUR_Func_cur_ppem,
CUR_Func_read_cvt, CUR_Func_write_cvt, CUR_Func_move_cvt,
CURRENT_Ratio, INS_SxVTL, COMPUTE_Funcs, COMPUTE_Round,
COMPUTE_Point_Displacement, MOVE_Zp2_Point): Remove by replacing
with expansion.

(Cur_Func_project, CUR_Func_dualproj, CUR_fast_project,
CUR_fast_dualproj): Replace with macros `project', `dualproj',
`fast_project', `fast_dualproj'.
2015-01-10 21:53:48 +01:00
Werner Lemberg fae0c81f69 [truetype] More macro expansions.
* src/truetype/ttinterp.c (EXEC_OP_, EXEC_OP): Remove by replacing
with expansion.
2015-01-10 20:23:10 +01:00
Werner Lemberg 5a752f332c [truetype] Remove code for static TrueType interpreter.
This is a follow-up patch.

* src/truetype/ttinterp.c, src/truetype/ttinterp.h
[TT_CONFIG_OPTION_STATIC_INTERPRETER,
TT_CONFIG_OPTION_STATIC_RASTER]: Remove macros and related code.
2015-01-10 20:08:35 +01:00
Werner Lemberg 1b4d68cf90 * src/truetype/ttinterp.c (CUR): Remove by replacing with expansion.
This starts a series of patches that simplifies the code of the
bytecode interpreter.
2015-01-10 19:56:28 +01:00
Werner Lemberg 0098d5502d Uppercase all hex digits for orthogonality. 2014-12-07 11:03:57 +01:00
Werner Lemberg ed6a9df0f6 Whitespace. 2014-12-06 23:28:58 +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
Werner Lemberg ef439fd209 [Savannah bug #43682] Change some signatures to `void' return type.
* include/internal/pshints.h (PSH_Globals_SetScaleFunc),
include/internal/sfnt.h (TT_Get_Metrics_Func),
src/pshinter/pshglob.c (psh_globals_set_scale),
src/pshinter/pshrec.c (ps_hints_init), src/sfnt/ttmtx.c
(tt_face_get_metrics), src/truetype/ttinterp.c (TT_Goto_CodeRange,
TT_Set_CodeRange, TT_Clear_CodeRange, TT_Done_Context,
TT_Save_Context): Do it.

* src/pshinter/pshglob.h, src/pshinter/pshrec.h, src/sfnt/ttmtx.h,
src/truetype/ttgload.c (TT_Hint_Glyph), src/truetype/ttinterp.c
(TT_Run_Context), src/truetype/ttinterp.h, src/truetype/ttobjs.c
(tt_size_run_fpgm, tt_size_run_prep): Updated.
2014-11-25 08:14:15 +01:00
Werner Lemberg 706f752b5e * src/truetype/ttinterp.c (Ins_DELTAP): Fix subpixel hinting.
Before this patch, it was impossible to ever call DELTAP[123] in
subpixel hinting mode as described in the ClearType whitepaper; it
only worked if in `compatibility mode'.  However, compatibility mode
essentially disables SHPIX, completely ruining hinting of
ttfautohint output, for example.

We now follow the whitepaper more closely so that DELTAP[123]
instructions for touched points in the non-subpixel direction are
executed.
2014-11-03 07:20:57 +01:00
Alexei Podtelezhnikov 118e651b0b [truetype] Clean up bytecode rounding.
Zero distance does not have to be treated specially if you follow
specifications and check the sign as the very last step of rounding.

* src/truetype/ttinterp.c (Round_None, Round_To_Grid,
Round_Down_To_Grid, Round_Up_To_Grid, Round_To_Double_Grid): Use
macros when available, do not check for non-zero distance.
(Round_To_Half_Grid, Round_Super, Round_Super_45): Ditto, return phase
if sign changed.
2014-10-19 23:31:08 -04:00
Alexei Podtelezhnikov 7e83f06804 [truetype] Limit delta shift range.
The legal range for delta shift is zero through six. Negative values
are illegal according to
  https://developer.apple.com/fonts/TrueType-Reference-Manual/RM04/Chap4.html#delta%20shift

* src/truetype/ttobjs.h (delta_shift, delta_base): Make unsigned.
* src/truetype/ttinterp.h (DO_SDS): Throw an error if delta_shift
  out of range.
  (Ins_DELTAP, Ins_DELTAC): Optimize for legal delta_shift.
2014-10-14 23:03:56 -04:00
Alexei Podtelezhnikov 125c3ca8f0 [truetype] Shortcut ppem calculations for square pixels.
* src/truetype/ttinterp.h (TT_ExecContextRec): New field
`cur_ppem_func' with a function pointer.
* src/truetype/ttinterp.c (TT_RunIns): Initialize `cur_ppem_func'
depending on the pixel geometry to either...
(Current_Ppem_Stretched): ... this for stretched pixels.
(Current_Ppem): ... or this for square pixels.
(DO_MPPEM, DO_MPS, Ins_DELTAP, Ins_DELTAC): Use `cur_ppem_func'.
2014-09-02 22:38:59 -04:00
Behdad Esfahbod 1ec98b29ec Don't use `register' keyword. Fixes compiler warnings.
* src/base/ftcalc.c (FT_Add64) [!FT_LONG64]: Do it.
* src/gzip/inftrees.c (huft_build): Ditto.
* src/truetype/ttinterp.c (TT_MulFix14_arm): Ditto.
2014-08-31 08:47:11 +02:00
Alexei Podtelezhnikov a8bc49e141 [truetype] Optimize DELTAP and DELTAC.
* src/truetype/ttinterp.c (Ins_DELTAP, Ins_DELTAC): Move ppem
calculations outside of the loop.
2014-08-24 22:14:01 -04:00
Werner Lemberg 441b3f3898 [truetype] Improve handling of buggy `prep' tables.
In case of an error in the `prep' table, no longer try to execute it
again and again.  This makes FreeType handle endless loops in buggy
fonts much faster.

* src/truetype/ttobjs.h (TT_SizeRec): The fields `bytecode_ready'
and `cvt_ready' are now negative if not initialized yet, otherwise
they indicate the error code of the last run.

* src/truetype/ttobjs.c (tt_size_run_fpgm, tt_size_run_prep,
tt_size_done_bytecode, tt_size_init_bytecode,
tt_size_ready_bytecode, tt_size_init, tt_size_done, tt_size_reset):
Updated.

* src/truetype/ttgload.c (tt_loader_init): Updated.
* src/truetype/ttinterp.c (TT_RunIns): Force reexecution of `fpgm'
and `prep' only if we are in the `glyf' table.
2014-07-13 02:28:14 +09:00
Werner Lemberg 6497b9c5a5 Fix compiler warnings.
Reported by Wojciech Mamrak <wmamrak@gmail.com>.

* src/autofit/afglobal.c (af_face_globals_compute_style_coverage),
src/autofit/afmodule.c (af_property_set): Fix `signed' vs.
`unsigned' issues.

* src/autofit/aflatin.c (af_latin_metrics_init_blues): Make compiler
happy.

* src/base/ftlcdfil.c (_ft_lcd_filter_fir): Use only four elements
for `fir'.
Fix `signed' vs. `unsigned' issues.

* src/sfnt/sfobjs.c (WRITE_BYTE): Removed, unused.
(WRITE_USHORT, WRITE_ULONG): Add proper casts.

* src/truetype/ttgload.c (TT_Get_VMetrics): Add proper casts.

* src/truetype/ttinterp.c (Ins_DELTAP): Add proper casts for `B1'
and `B2'.
2014-06-13 09:28:00 +02: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
Chongyu Zhu 94c669448a [arm] Fix Savannah bug #41138, part 2.
* builds/unix/ftconfig.in (FT_MulFix_arm), include/config/ftconfig.h
(FT_MulFix_arm), src/truetype/ttinterp.c (TT_MulFix14_arm): Fix
preprocessor conditionals for `add.w'.
2014-01-08 08:52:59 +01:00
Werner Lemberg b337fa25cf Fix Savannah bug #40975 (sort of).
* src/truetype/ttinterp.c (Ins_IP): Fix sign typo to make FreeType
behave the same as the Windows TrueType engine for the invalid case.
2013-12-21 19:33:15 +01:00
Infinality 8bb09b0fe4 [truetype] Simplify logic of rendering modes.
This patch unifies the subpixel and non-subpixel cases.

* src/truetype/ttinterp.h (TT_ExecContextRec): Remove
`grayscale_hinting'; all code should refer to `grayscale' instead.
Remove unused `native_hinting' member.
Rename `subpixel_hinting' member to `subpixel.

* src/truetype/ttgload.c (TT_LOADER_SET_PP): Updated.
(tt_loader_init): Updated.

* src/truetype/ttinterp.c (Ins_GETINFO): Simplify.
Updated.
2013-12-11 09:01:13 +01:00
Werner Lemberg 7d449436e6 [truetype] Fix GETINFO opcode handling of subpixel hinting bits.
* src/truetype/ttinterp.c (Ins_GETINFO): Don't request bit 6 set to
get info on subpixel hinting.

* docs/CHANGES: Updated.
2013-11-02 11:36:37 +01:00
Werner Lemberg ebf52d6a90 [truetype] Minor code refactoring.
Two benefits: The allocated FDEF (and IDEF) array gets slightly
smaller, and the `ttdebug' demo program has access to function
numbers without additional costs.

Fortunately, no changes to FontForge are necessary – this is the
only external TrueType debugger I know of, but others may exist and
should check the code accordingly.

* src/truetype/ttinterp.h (TT_CallRec): Replace `Cur_Restart' and
`Cur_End' with a pointer to the corresponding `TT_DefRecord'
structure.

* src/truetype/ttinterp.c (DO_JROT, DO_JMPR, DO_JROF, Ins_ENDF,
Ins_CALL, Ins_LOOPCALL, Ins_UNKNOWN, TT_RunIns <Invalid_Opcode>):
Updated.
2013-11-01 13:26:28 +01:00
Chongyu Zhu 41632b58ef [arm] Fix thumb2 inline assembly under LLVM.
When using `ADD' with an immediate operand, the instruction is
actually `ADD Rd, Rn, #<imm12>', that is, the maximum of the
immediate operand cannot exceed 4095.  It will fail to compile with
LLVM.

However, in GCC, due to some legacy compatibility considerations,
`ADD.W' will be automatically emitted when the immediate operand is
larger than 4095.

* builds/unix/ftconfig.in, include/freetype/config/ftconfig.h
(FT_MulFix_arm) [__GNUC__]: Support clang compiler.

* src/truetype/ttinterp.c (TT_MulFix14_arm) [__GNUC__]: Ditto.
2013-10-15 11:40:34 +02:00
Werner Lemberg a32682f176 Fix gcc pragmas, part 2.
* src/truetype/ttinterp.c (TT_MulFix14_long_long,
TT_DotFix14_long_long): `#pragma gcc diagnostic {push,pop}' has been
introduced with gcc version 4.6.
2013-08-06 00:21:46 +02:00
Werner Lemberg 69e524d5fe Fix gcc pragmas.
* src/truetype/ttinterp.c (TT_MulFix14_long_long,
TT_DotFix14_long_long): Older gcc versions don't accept diagnostic
pragmas within a function body.
2013-08-05 23:38:32 +02:00
David Turner f66d48e923 Add assembler code for TT_MulFix14 and TT_DotFix14.
This patch provides slightly optimized versions for ARM, x86, and
x86_64 CPUs if built with GCC.

Also remove some dead code.

* src/truetype/ttinterp.c (TT_MulFix14_arm, TT_MulFix14_long_long,
TT_DotFix14_long_long): New functions.
2013-07-16 13:19:32 +02:00
Werner Lemberg 25b7da5348 * Version 2.5.0 released.
=========================

Tag sources with `VER-2-5-0'.

* docs/VERSION.DLL: Update documentation and bump version number to
2.5.0.

* README, Jamfile (RefDoc),
builds/win32/vc2005/freetype.vcproj, builds/win32/vc2005/index.html,
builds/win32/vc2008/freetype.vcproj, builds/win32/vc2008/index.html,
builds/win32/vc2010/freetype.vcxproj, builds/win32/vc2010/index.html,
builds/win32/visualc/freetype.dsp,
builds/win32/visualc/freetype.vcproj,
builds/win32/visualc/index.html, builds/win32/visualce/freetype.dsp,
builds/win32/visualce/freetype.vcproj,
builds/win32/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.4.12/2.5.0/, s/2412/250/.

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

* builds/unix/configure.raw (version_info): Set to 16:2:10.

* src/base/ftobjs.c (FT_Open_Face): Pacify compiler.
* src/truetype/ttinterp.c (Ins_MSIRP, Ins_MIRP): Ditto.
2013-06-19 10:23:36 +02:00
Werner Lemberg 99e60d840d Fix Savannah bug #39160.
* src/truetype/ttinterp.c (Ins_SDPVTL): Set projection vector too
for the degenerate case.
2013-06-10 01:44:37 +02:00
Behdad Esfahbod 2d6e1fbce7 Compilation fix.
* src/truetype/ttinterp.c (TT_RunIns)
[!TT_CONFIG_OPTION_SUBPIXEL_HINTING]: Make it work.
2013-05-23 08:01:20 +02:00
Infinality 3c783c1b70 [truetype] Formatting and an additional subpixel tweak. 2013-05-21 21:03:00 -05:00
Infinality 18f35ed15a [truetype] Adjust subpixel zp2 moves and tweak rules. 2013-05-21 20:51:15 -05: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 f04951af8d [truetype] Add `interpreter-version' property.
This makes the option TT_CONFIG_OPTION_SUBPIXEL_HINTING controllable
at runtime.

* src/truetype/ttdriver.c: Include FT_TRUETYPE_DRIVER_H.
(tt_property_set, tt_property_get): Fill templates.

* src/truetype/ttobjs.h (TT_DriverRec): Add `interpreter_version'
member.
Remove unused `extension_component' member.

* src/truetype/ttgload.c: Include FT_TRUETYPE_DRIVER_H.
(tt_get_metrics, TT_Hint_Glyph, TT_Process_Simple_Glyph,
compute_glyph_metrics, tt_loader_init): Use `interpreter_version'.

* src/truetype/ttinterp.c: Include FT_TRUETYPE_DRIVER_H.
(SUBPIXEL_HINTING): New macro to check `interpreter_version' flag.
Update all affected functions to use it.
Use TT_INTERPRETER_VERSION_XXX where appropriate.

* src/truetype/ttobjs.c: Include FT_TRUETYPE_DRIVER_H.
(tt_driver_init): Initialize `interpreter_version'.

* src/truetype/ttsubpix.c: Include FT_TRUETYPE_DRIVER_H.
Use TT_INTERPRETER_VERSION_XXX where appropriate.
2013-05-17 13:51:07 +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 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 00dfa3304e [truetype] A better fix for Savannah bug #38211.
* src/truetype/ttinterp.c (Ins_IP): Implement identical behaviour to
MS rasterizer if rp1 == rp2 (confirmed by Greg Hitchcock).
2013-02-05 19:23:16 +01:00
Werner Lemberg 4063320528 [truetype] Fix Savannah bug #38211.
* src/truetype/ttinterp.c (Ins_IP): Make FreeType behave identical
to other interpreters if rp1 == rp2 (which is invalid).
2013-02-01 12:55:44 +01:00
Werner Lemberg 6b9034f0fd Formatting, comment improvements. 2013-01-28 13:56:23 +01:00
Infinality c574d72ca8 [truetype] Minor formatting fix. 2013-01-26 17:40:44 -06:00
Infinality a5fe359596 [truetype] Align more to ClearType whitepaper for sph. 2013-01-26 12:29:52 -06: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 0e0fdc5dc8 [truetype] Improve accuracy of normalization of short vectors.
Unit vector components are stored as 2.14 fixed-point numbers. In
order to calculate all 14 bits accurately, a short vector to be
normalized has to be upscaled to at least 14 bits before its length
is calculated. This has been safe since accurate CORDIC algorithms
were adopted.

* src/truetype/ttinterp.c (Normalize): Scale short vectors by 0x4000.
2013-01-12 23:05:55 -05:00
Alexei Podtelezhnikov 081aba390a [truetype] Kill very old vector normalization hacks.
Back in the days, vector length calculations were not very accurate
and the vector normalization function, Normalize, had to meticulously
correct the errors for long vectors [commit b7ef2b0968]. It was no
longer necessary after accurate CORDIC algorithms were adopted, but
the code remained. It is time to kill it.

* src/truetype/ttinterp.c (Normalize): Remove error compensation.
(TT_VecLen): Remove any mention of old less accurate implementation.
2013-01-12 22:36:37 -05:00
Infinality 94b79e7453 [truetype] Remove unusued code and variables. 2012-12-17 19:17:30 -06:00
Infinality 461cc9365c Merge branch 'master' of ssh://git.sv.nongnu.org/srv/git/freetype/freetype2
Conflicts:
	src/truetype/ttinterp.c
2012-12-16 20:02:42 -06:00
Infinality 71f242c26a [truetype ] Remove unusued code. Add minor fixes. 2012-12-16 19:52:01 -06:00
Alexei Podtelezhnikov e2fa4a6c89 [truetype] Remove dead code. 2012-12-16 20:19:56 -05:00
Alexei Podtelezhnikov 65d6572105 [truetype] Scale F_dot_P down.
The dot product between freeVector and projVector or cosine of
the angle between these FT_F2Dot14 unit vectors used to be scaled up
by 4 and routinely occupied 32 bits in an FT_Long field F_dot_P.
This patch scales the value down by 2^14 instead, which simplifies
its use throughout the bytecode interpreter.

This does not lead to the loss of precision because the lower bits
are unreliable anyway. Consider two unit vectors (1,0) and (.6,.8)
for which the true value of F_dot_P is .6 * 0x40000000 = 0x26666666.
These vectors are stored as (0x4000,0) and (0x2666,0x3333) after
rounding and F_dot_P is assigned 0x26660000. The lower bits were
already lost while rounding the unit vector components.

Besides code simplification, this change can lead to better
performance when FT_MulDiv with the scaled-down F_dot_P is less
likely to use the costly 64-bit path. We are not changing the type
of F_dot_P to FT_F2Dot14 at this point.

* src/truetype/ttinterp.c (Compute_Funcs): Scale F_dot_P down by 14
bits and modify its use accordingly.
(Direct_Move, Direct_Move_Orig, Compute_Point_Displacement): Modify
the use of F_dot_P field.
* src/truetype/ttobjs.c (tt_size_run_fpgm): Change arbitrary
assignment of F_dot_P to its theoretical maximum in case we decide
to scale back its type later.
2012-12-10 06:59:29 -05:00
Alexei Podtelezhnikov 13e87e0426 Formatting. 2012-12-09 19:48:22 -05:00
Alexei Podtelezhnikov cece4d3b5d [truetype] Tweak the previous commit.
* src/truetype/ttinterp.c (Current_Ratio): Put unit vector
components as the second TT_MulFix14 arguments. This is required
on 16-bit systems.
2012-12-06 20:23:38 -05:00
Alexei Podtelezhnikov 5ad05f97b6 [truetype] Microoptimizations in bytecode interpreter.
* src/truetype/ttinterp.c (TT_DivFix14): New macro.
(Normalize): Use it here.
(Current_Ratio): Use TT_MulFix14 instead of FT_MulDiv.
(Ins_SHPIX): Cancel out two TT_MulFix14 calls.
2012-12-06 00:27:20 -05:00
Alexei Podtelezhnikov b50088bd9c [truetype] Cosmetic improvement in bytecode interpreter.
* src/truetype/ttinterp.c: Use explicit calls to FT_MulDiv,
FT_MulFix, and FT_DivFix instead of macros.
2012-12-05 23:05:47 -05:00
Alexei Podtelezhnikov 6a126e14c4 [truetype] Fix formatting and typo. 2012-11-28 23:32:02 -05:00
Alexei Podtelezhnikov 24e897db28 [truetype] Cheaper way to threshold angles between vectors.
* src/truetype/ttinterp.c (Ins_ISECT): Thresholding tangent is a lot
cheaper than thresholding sine.
2012-10-20 22:23:01 -04:00
Werner Lemberg 2df16761c9 [truetype] Fix Savannah bug #37572.
* src/truetype/ttinterp.c (Ins_ISECT): Use angle between vectors to
avoid grazing intersections.  The previous threshold was too coarse,
incorrectly rejecting short but valid vectors.
2012-10-17 11:34:22 +02:00
Werner Lemberg 83c0ebabc2 Fix conditional compilation.
* include/freetype/internal/ftcalc.h (FT_MulDiv_No_Round): Don't
enclose with `TT_USE_BYTECODE_INTERPRETER'; we now need the function
elsewhere also.

* src/autofit/afcjk.h: Use AF_CONFIG_OPTION_CJK.

* src/truetype/ttgload.c (tt_loader_init): Fix compiler warning.

* src/truetype/ttinterp.c (Ins_MSIRP): Fix compiler warning.

* src/truetype/ttinterp.h: Use
TT_CONFIG_OPTION_BYTECODE_INTERPRETER.
2012-06-27 08:16:06 +02:00
Infinality ed6508c41a [truetype] Remove unused rounding functionality. 2012-06-26 17:20:27 -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
Werner Lemberg f1ec084292 s/maximal/maximum/ everywhere, s/minimal/minimum/ where appropriate. 2012-03-11 13:48:25 +01:00
Werner Lemberg 1054bc298c [truetype] Improve comment. 2012-03-10 09:30:27 +01:00
Werner Lemberg e1899bcf6f [truetype] Fix SSW instruction.
* src/truetype/ttinterp.c (DO_SSW): SSW *does* use font units.  For
verification, it took some time to find a font which actually uses
this instruction.
2012-03-10 09:28:24 +01:00
Werner Lemberg a33c013fe2 [truetype] Fix Savannah bug #35646.
* src/truetype/ttinterp.c (Ins_MIRP): Typo, present since ages.  The
code is now in sync with the other operators (e.g. MSIRP) which
modify twilight points.
2012-03-01 14:04:30 +01:00
Werner Lemberg 5dddcc45a0 [truetype] Fix Savannah bug #35640.
* src/truetype/ttinterp.c (SkipCode, TT_RunIns): Fix boundary check
for NPUSHB and NPUSHW instructions.
2012-03-01 07:52:24 +01:00
Werner Lemberg 96cddb8d1d [truetype] Fix Savannah bug #35601.
* src/truetype/ttinterp.c (Ins_SHZ): Use number of points instead of
last point for loop.
Also remove redundant boundary check.
2012-02-29 17:58:57 +01:00
Werner Lemberg 9eacbb81bd [truetype] Make SHC instruction behave similar to MS rasterizer.
* src/truetype/ttinterp.c (Ins_SHC): Handle virtual contour in
twilight zone.
2012-02-29 14:47:47 +01:00
Werner Lemberg d74285d1dc [truetype] Improve comments. 2012-02-29 13:59:49 +01:00
Werner Lemberg 22fff25385 Whitespace. 2012-02-26 08:47:20 +01:00
Werner Lemberg b4e06818ed [truetype] Fix Savannah bug #35466.
Jump instructions are now bound to the current function.  The MS
Windows rasterizer behaves the same, as confirmed by Greg Hitchcock.

* src/truetype/ttinterp.h (TT_CallRec): Add `Cur_End' element.
* src/truetype/ttobjs.h (TT_DefRecord): Add `end' element.

* src/truetype/ttinterp.c (DO_JROT, DO_JMPR, DO_JROF): Check upper
bound of jump address.
(Ins_FDEF, Ins_CALL, Ins_LOOPCALL, Ins_UNKNOWN, TT_RunIns): Updated.
2012-02-11 20:56:10 +01:00
suzuki toshiya 1749d8bc6a Remove trailing spaces. 2012-01-17 02:00:24 +09:00
Tobias Ringström 21472de11d [truetype] Fix IP instruction if x_ppem != y_ppem.
* src/truetype/ttinterp.c (Ins_IP): Scale `orus' coordinates
properly.
2012-01-04 18:27:16 +01:00
Werner Lemberg f4ec60fdb8 [truetype] Fix MD instruction for twilight zone.
* src/truetype/ttinterp.c (Ins_MD): Without this fix, the MD
instruction applied to original coordinates of twilight points
always returns zero.
2011-10-25 20:25:32 +02:00
Werner Lemberg bad0160c16 [truetype] Fix degenerate case in S{P,F,DP}VTL opcodes.
* src/truetype/ttinterp.c (Ins_SxVTL): Handle p1 == p2 specially.
(Ins_SDPVTL): Handle v1 == v2 specially.
2011-08-12 19:50:13 +02:00
Werner Lemberg 22e44e067b [truetype] Remove incorrect comments. 2011-08-05 09:57:17 +02:00
Werner Lemberg f2573a0611 [truetype] Fix some comments in the bytecode interpreter.
Thanks to Greg Hitchcock!
2011-08-05 09:07:21 +02:00
Werner Lemberg f1a981b5ce [truetype] Protect jump instructions against endless loops.
* src/truetype/interp.c (DO_JROT, DO_JMPR, DO_JROF): Exit with error
if offset is zero.
2011-01-31 22:26:53 +01:00
Werner Lemberg d6a213f8ea [truetype] Improve handling of invalid references.
* src/truetype/interp.c: Set even more TT_Err_Invalid_Reference
error codes only if pedantic hinting is active.  At the same time,
try to provide sane values which hopefully allow useful
continuation.  Exception to this is CALL and LOOPCALL – due to
possible stack corruption it is necessary to bail out.
2011-01-31 18:51:07 +01:00
Werner Lemberg 96f0456483 [truetype] Improve handling of stack underflow.
* src/truetype/ttinterp.c (TT_RunIns, Ins_FLIPPT, Ins_DELTAP,
Ins_DELTAC): Exit with error only if `pedantic_hinting' is set.
Otherwise, try to do something sane.
2011-01-31 10:24:32 +01:00
Werner Lemberg 0682251e9f * src/sfnt/ttmtx.c (tt_face_load_hmtx): Fix tracing message. 2011-01-30 16:38:09 +01:00
LIU Sun-Liang c61b3596d4 [truetype]: Fix behaviour of MIAP for invalid arguments.
* src/truetype/ttinterp.c (Ins_MIAP): Set reference points even in
case of error.
2011-01-30 16:29:45 +01:00
Werner Lemberg dcdb3167dc [truetype] Fix handling of MIRP instruction.
Thanks to Greg Hitchcock who explained the issue.

* src/truetype/ttinterp.c (Ins_MIRP): Replace a `>=' operator with
`>' since the description in the specification is incorrect.
This fixes, for example, glyph `two' in font `Helvetica Neue LT Com
65 medium' at 15ppem.
2011-01-18 07:35:26 +01:00
Johnson Y. Yan 9073e7ceb6 [truetype] Better multi-threading support.
* src/truetype/ttinterp.c (TT_Load_Context): Reset glyph zone
references.
2010-11-26 11:58:08 +01:00
suzuki toshiya 46c371c2c7 Replace "%lx" for memory address by "%p", LLP64 platforms.
On LLP64 platforms (e.g. Win64), long (32-bit) cannot cover
the memory address (64-bit).  Also the casts from the pointer
type to long int should be removed to preserve the address
correctly.

* src/raster/ftraster.c (New_Profile): Replace "%lx" by "%p".
(End_Profile) Ditto.
* src/truetype/ttinterp.c (Init_Context): Ditto.
2010-10-25 00:14:13 +09:00
Werner Lemberg 0edf0986f3 [truetype] Improve error handling of `SHZ' bytecode instruction.
Problem reported by Chris Evans <scarybeasts@gmail.com>.

* src/truetype/ttinterp.c (Ins_SHZ): Check `last_point'.
2010-10-06 11:52:27 +02:00
suzuki toshiya 5edc2f339a Fix Savannah bug #31040.
* src/truetype/ttinterp.c (free_buffer_in_size): Remove.
(TT_RunIns): Updated.
2010-10-01 08:15:55 +02:00
suzuki toshiya db053ec9a5 [truetype] Don't duplicate size->twilight structure to be freed.
* src/truetype/ttinterp.c (free_buffer_in_size): Don't duplicate
FT_GlyphZoneRec size->twilight to be freed.  If duplicated,
FT_FREE() erases the duplicated pointers only and leave original
pointers.  They can cause the double-free crash when the burst
errors occur in TrueType interpreter and free_buffer_in_size()
is invoked repeatedly.  See Savannah bug #31040 for detail.
2010-09-17 23:20:00 +09:00
Werner Lemberg afd89d309d Make bytecode debugging with FontForge work again.
* src/truetype/ttinterp.c (TT_RunIns): Don't call
`free_buffer_in_size' in case of error if a debugger is active.
2010-09-15 13:02:35 +02:00
Werner Lemberg 6abb9232b6 Improve tracing messages.
* src/truetype/ttinterp.c (TT_RunIns): Improve wording of tracing
message.
* src/truetype/ttobjs.c (tt_size_run_fpgm, tt_size_run_prep): Add
tracing message.
* src/truetype/ttgload.c (tt_loader_init): Add tracing message.
* src/cache/ftcsbits.c (ftc_snode_load): Emit tracing message if
glyph doesn't fit into a small bitmap container.
2010-09-14 09:02:10 +02:00
Werner Lemberg 5220ef58c5 Fix minor issues reported by <muktha.narayan@wipro.com>.
* src/autofit/aflatin.c (af_latin_compute_stem_width): Remove
redundant conditional check.
* src/base/ftsynth.c (FT_GlyphSlot_Embolden): Ditto.
* src/cff/cffload.c (cff_encoding_load): Remove conditional check
which always evaluates to `true'.
* src/pshinter/pshalgo.c (ps_glyph_interpolate_strong_points):
Ditto.
* src/truetype/ttinterp.c (Ins_IUP): Ditto.
* src/cid/cidgload.c (cid_slot_load_glyph): Don't check for NULL if
value is already dereferenced.
* src/winfonts/winfnt.c (FNT_Load_Glyph): Fix check of `face'.
2010-09-13 07:32:22 +02:00
suzuki toshiya 0eb657b0aa [truetype] Decrease the trace level catching the interpreter error.
* src/truetype/ttinterp.c (TT_RunIns): Decrease the trace level
showing the error when the interpreter returns with an error,
from FT_TRACE7() to FT_TRACE1().
2010-08-31 13:29:05 +09:00
suzuki toshiya 29e044a4af [truetype] Prevent bytecode reuse after the interpretation error.
* src/truetype/ttinterp.c (free_buffer_in_size): New function to
free the buffer allocated during the interpretation of this glyph.
(TT_RunIns): Unset FT_Face->size->{cvt_ready,bytecode_ready} if
an error occurs in the bytecode interpretation.  The interpretation
of invalid bytecode may break the function definitions and referring
them in later interpretation is danger.  By unsetting these flags,
`fpgm' and `prep' tables are executed again in next interpretation.

Fix Savannah bug #30798, reported by Robert Swiecki.
2010-08-31 01:23:30 +09:00
Werner Lemberg 346f1867fd Fix Savannah bug #30657.
* src/truetype/ttinterp.c (BOUNDSL): New macro.
Change `BOUNDS' to `BOUNDSL' where appropriate.

* src/truetype/ttinterp.h (TT_ExecContextRec): Fix type of
`cvtSize'.
2010-08-06 00:47:57 +02:00
Werner Lemberg 888cd1843e Fix Savannah bug #30361.
* src/truetype/ttinterp.c (Ins_IUP): Fix bounds check.
2010-07-08 07:29:42 +02:00
Werner Lemberg a2d225e322 [truetype] Protect against code range underflow.
* src/truetype/ttinterp.c (DO_JROT, DO_JMPR, DO_JROF): Don't allow
negative IP values.
2010-07-01 11:37:09 +02:00
Werner Lemberg 462ddb4072 [truetype] Add rudimentary tracing for bytecode instructions.
* src/truetype/ttinterp.c (opcode_name) [FT_DEBUG_LEVEL_TRACE]: New
array.
(TT_RunIns): Trace opcodes.
2010-07-01 11:28:43 +02:00
Werner Lemberg 370aea802c Formatting. 2010-06-08 08:37:11 +02:00
Werner Lemberg 6da023d1ff TrueType: Make FreeType ignore maxSizeOfInstructions in `maxp'.
Acroread does the same.

* src/truetype/ttgload.c (TT_Process_Composite_Glyph): Call
`Update_Max' to adjust size of instructions array if necessary and
add a rough safety check.

(load_truetype_glyph): Save `loader->byte_len' before recursive
call.

* src/truetype/ttinterp.h, src/truetype/ttinterp.c (Update_Max):
Declare it as FT_LOCAL.
2010-05-20 15:38:00 +02:00
suzuki toshiya a115142057 truetype: Check invalid function number in IDEF instruction. 2009-08-01 00:32:18 +09:00
suzuki toshiya d1c23082b6 truetype: Check invalid function number in FDEF instruction. 2009-08-01 00:32:17 +09:00
suzuki toshiya 6dc27526a9 truetype: Cast the numerical operands to 32-bit for LP64 systems. 2009-08-01 00:32:15 +09:00
suzuki toshiya 3b56c4d390 truetype: Cast the project vector to 32-bit for LP64 system. 2009-08-01 00:32:15 +09:00
Werner Lemberg c6788a389d Fix some potential out-of-memory crashes.
* src/base/ftobjs.c (ft_glyphslot_done): Check `slot->internal'.
* src/base/ftstream.c (FT_Stream_ReleaseFrame): Check `stream'.
* src/truetype/ttinterp.c (TT_New_Context): Avoid double-free of
`exec' in case of failure.
2009-06-07 13:09:21 +02:00
Werner Lemberg 1e5e7aa073 Fix SCANCTRL handling in TTFs.
Problem reported by Alexey Kryukov <anagnost@yandex.ru>.

* src/truetype/ttinterp.c (Ins_SCANCTRL): Fix threshold handling.
2009-01-25 16:27:04 +00:00
Werner Lemberg 1a5d561dce * src/autofit/afcjk.c, src/base/ftoutln.c, src/base/ftrfork.c,
src/bdf/bdfdrivr.c, src/gxvalid/gxvmorx.c, src/otvalid/otvmath.c,
src/pcf/pcfdrivr.c, src/psnames/pstables.h, src/smooth/ftgrays.c,
src/tools/glnames.py, src/truetype/ttinterp.c, src/type1/t1load.c,
src/type42/t42objs.c, src/winfonts/winfnt.c: Fix compiler warnings
(Atari PureC).
2008-11-29 22:50:24 +00:00
Werner Lemberg 105721a5a6 * src/truetype/ttinterp.c (tt_default_graphics_state): The default
value for `scan_type' is zero, as confirmed by Greg Hitchcock from
Microsoft.  Problem reported by Michal Nowakowski
<miszka@limes.com.pl>.
2008-11-15 10:35:51 +00:00
Werner Lemberg ce8853af81 * src/truetype/ttinterp. (Ins_SCANTYPE): Don't check rendering mode.
* src/raster/ftraster.c (Render_Glyph, Render_Gray_Glyph,
Draw_Sweep): No-dropout mode is value 2, not value 0.
(Draw_Sweep): Really skip dropout handling for no-dropout mode.
2008-06-24 11:19:03 +00:00
Werner Lemberg 5df5dbb722 Enable access to the various dropout rules of the B&W rasterizer.
Pass dropout rules from the TT bytecode interpreter to the
rasterizer; temporarily this is enabled only if
`USE_SCAN_CONVERSION_RULES' is defined.

* include/freetype/ftimage.h (FT_OUTLINE_SMART_DROPOUTS,
FT_OUTLINE_EXCLUDE_STUBS): New flags for for FT_Outline.

* src/raster/ftraster.c (Vertical_Sweep_Drop, Horizontal_Sweep_Drop,
Horizontal_Gray_Sweep_Drop): Use same mode numbers as given in the
OpenType specification.
Fix mode 4 computation.
(Render_Glyph, Render_Gray_Glyph): Handle new outline flags.

* src/truetype/ttgload.c (TT_Load_Glyph)
[USE_SCAN_CONVERSION_RULES]: Convert scan conversion mode to
FT_OUTLINE_XXX flags.

* src/truetype/ttinterp.c (Ins_SCANCTRL): Enable ppem check.
2008-06-22 13:40:08 +00:00
Werner Lemberg 7cb9ec0f1c * src/type1/t1parse.h (T1_ParserRec): Make `base_len' and
`private_len' unsigned.

* src/type1/t1parse.c (read_pfb_tag): Make `asize' unsigned and read
it as such.
(T1_New_Parser, T1_Get_Private_Dict): Make `size' unsigned.


* src/base/ftstream.c (FT_Stream_Skip): Reject negative values.


* src/type1/t1load.c (parse_blend_design_positions): Check `n_axis'
for sane value.
Fix typo.


* src/psaux/psobjs.c (ps_table_add): Check `idx' correctly.


* src/truetype/ttinterp (Ins_SHC): Use BOUNDS() to check
`last_point'.


* src/sfnt/ttload.c (tt_face_load_max_profile): Limit
`maxTwilightPoints'.
2008-06-09 20:49:29 +00:00
Werner Lemberg d77e72295e * src/truetype/ttinterp.c (Ins_IP): Handle case `org_dist == 0'
correctly.  This fixes glyphs `t' and `h' of Arial Narrow at 12ppem.
2008-06-05 22:07:19 +00:00
Werner Lemberg 2b0b4221ab Cosmetic code changes. 2008-05-28 22:17:28 +00:00
Werner Lemberg c94fa6699c * src/truetype/ttinterp.c (Ins_MD): The MD instruction also uses
original, unscaled input values.  Confirmed by Greg Hitchcock from
Microsoft.
2008-05-27 23:24:07 +00:00
Werner Lemberg 28464c48a1 * src/truetype/ttinterp.c (Ins_IUP): Check number of points. Fix
from Savannah bug #22356.
2008-02-18 20:34:42 +00:00
David Turner 74cc0e9ee4 * src/truetype/ttinterp.c: add missing variable initialization,
gets rid of Valgrind fixes.

	* src/autofit/aflatin.c: get rid of an infinite loop in the case
	of degenerate fonts.
2007-06-30 22:54:12 +00:00
Werner Lemberg e12ed563d6 * src/tools/ftrandom.c (font_size): New global variable.
(TestFace): Use it.
(main): Handle new option `--size' to set `font_size'.
(Usage): Updated.

Formatting.
2007-06-17 05:31:23 +00:00
David Turner 815911ae2a * src/truetype/ttgload.c (TT_Load_Simple_Glyph): check the well-formedness
of the contours array when loading a glyph

	* src/truetype/ttinterp.c (Ins_IP): check argument ranges to reject
	bogus operations properly
2007-06-16 17:07:20 +00:00
Werner Lemberg c793d90fca * src/truetype/ttinterp.c (Null_Vector, NULL_Vector): Removed,
unused.
2007-06-01 20:51:11 +00:00
Werner Lemberg 94be20ea82 * src/truetype/ttinterp.c (Ins_IP), src/autofit/aflatin.c
(af_latin_metrics_scale_dim): Fix compiler warnings.
2007-05-09 20:02:55 +00:00
David Turner 3b242d3619 last (tiny) fix to the bytecode interpreter and code cleanup 2007-03-26 12:03:04 +00:00
Werner Lemberg c9f6c66f95 formatting 2007-03-21 13:30:14 +00:00
David Turner 64a9ef20d5 another bytecode regression fix. Hopefully, this should be the latest 2007-03-18 07:35:08 +00:00
David Turner 74c34eba39 another bytecode interpreter regression fix 2007-03-18 07:19:31 +00:00
David Turner 89020d9749 fixing TrueType bytecode interpreter regression for HLB_____.TTF, needs more testing with other fonts 2007-03-17 17:48:57 +00:00
Werner Lemberg a091517a04 * src/truetype/ttinterp.c (Ins_MD): Remove unused variable.
* src/autofit/aflatin.c (af_latin_hints_link_segments): Ditto.
2007-02-16 08:12:50 +00:00
Werner Lemberg 3cd6cc24f2 formatting 2007-02-16 08:10:17 +00:00
David Turner 2c4500e981 improving TrueType bytecode interpreter to better match Windows behaviour
on tricky cases... FIX_BYTECODE is now the default to allow large testing
2007-02-14 15:08:47 +00:00
Werner Lemberg c6a14086d2 * src/truetype/ttinterp.c (Project_x, Project_y): Remove compiler
warnings.

* src/pcf/pcfread.c (pcf_interpret_style), src/bdf/bdfdrivr.c
(bdf_interpret_style): Ditto.
2007-02-12 22:08:15 +00:00
Werner Lemberg 406d25f379 more formatting and copyright years 2007-02-12 22:01:18 +00:00
David Turner 72a0dd247d some simplifications of the TrueType interpreter projection code
(preliminaries to various interpreter fixes)
2007-02-12 15:24:51 +00:00
Werner Lemberg 6e87ed9f04 Spelling fixes from Alexei. 2007-01-26 22:18:56 +00:00
Werner Lemberg 555258fffe * docs/CHANGES: Document SHZ fix.
* src/truetype/ttinterp.c (Ins_SHZ): SHZ doesn't move phantom
points.
2007-01-21 09:46:37 +00:00
Werner Lemberg b4142d5126 Whitespace and spelling fixes from Alexei.
Formatting, copyright years.
2007-01-17 12:45:26 +00:00
David Turner 2212272992 * src/autofit/aflatin.c, src/cff/cffdriver.c, src/truetype/ttobjs.c,
src/truetype/ttinterp.c: fixing compiler warnings
2007-01-16 20:06:44 +00:00
Werner Lemberg 8c4120d0a3 Fix various compiler warnings.
* src/truetype/ttdriver.c (tt_size_select), src/cff/cffobjs.h,
src/cff/cffobjs.c (cff_size_request), src/type42/t42objs.h:
s/index/strike_index/.
* src/base/ftobjs.c (FT_Match_Size): s/index/size_index/.

* src/gxvalid/gxvmorx5.c
(gxv_morx_subtable_type5_InsertList_validate): s/index/table_index/.

* src/truetype/ttinterp.c (Compute_Point_Displacement),
src/pcf/pcfread.c (pcf_seek_to_table_type): Avoid possibly
uninitialized variables.
2007-01-15 06:42:40 +00:00
Werner Lemberg 27cf9de104 formatting, copyright years 2007-01-13 07:34:23 +00:00
David Turner e3654532ea * src/base/ftbitmap.c: fixing memory stomping bug in the
bitmap embolderner when the pitch of the source bitmap is
        *much* larger than its width

        * src/truetype/ttinterp.c: fixing aliasing-related compilation
        warning
2007-01-13 00:19:18 +00:00
Werner Lemberg 2bad8ffbdf cosmetics 2006-11-22 09:37:03 +00:00
Werner Lemberg 82ee38e585 formatting 2006-11-20 09:19:26 +00:00
David Turner 7bab6ae3e9 * src/truetype/ttinterp.c: undefined the FIX_BYTECODE macro,
since the interpreter "enhancements" are still too buggy for
      general use
2006-11-13 11:25:06 +00:00
David Turner 6aa260ce61 support for "automatic unpatented hinting" added
we still need to determine the list of "trick" CJK fonts
that are going to toggle the bytecode interpreter instead
of the auto-hinter
2006-08-25 22:45:13 +00:00
Werner Lemberg 1234299620 formatting 2006-08-19 11:18:09 +00:00
David Turner 33f5f24957 * include/freetype/internal/ftgloadr.h,
include/freetype/internal/tttypes.h, src/base/ftgloadr.c,
    src/base/ftobjs.c, src/truetype/ttgload.c, src/truetype/ttinterp.c,
    src/truetype/ttobjs.c: improvements to native TrueType hinting,
    this is a first try, controlled by the FIX_BYTECODE macro in
    src/truetype/ttinterp.c
2006-08-16 16:50:55 +00:00
Werner Lemberg a2da05c2c5 Fix two hinting bugs as reported in
http://lists.nongnu.org/archive/html/freetype-devel/2006-06/msg00057.html.

* include/freetype/internal/tttypes.h (TT_GlyphZoneRec): Add
`first_point' member.

* src/truetype/ttgload.c (tt_prepare_zone): Initialize
`first_point'.
(TT_Process_Composite_Glyph): Always untouch points.

* src/truetype/ttinterp.c (Ins_SHC): Fix computation of
`first_point' and `last_point' in case of composite glyphs.
(Ins_IUP): Fix computation of `end_point'.
2006-06-25 06:27:27 +00:00
Werner Lemberg 8e6f8c4d79 Formatting, copyright years, documentation improvements. 2006-02-17 08:07:09 +00:00
Wu, Chia-I (吳佳一) 0d565fdc1d * include/freetype/internal/ftobjs.h (FT_Face_InternalRec): Remove
unused `max_points' and `max_contours'.

* src/cid/cidobjs.c (cid_face_init), src/type1/t1objs.c
(T1_Face_Init), src/type42/t42objs.c (T42_Face_Init): Update.

* include/freetype/internal/tttypes.h (TT_FaceRec): Remove unused
`max_components'.

* src/truetype/ttinterp.h (TT_ExecContextRec): Remove unused
`loadSize' and `loadStack'.

* src/truetype/ttinterp.c (TT_Done_Context, TT_Load_Context),
src/sfnt/ttload.c (tt_face_load_maxp): Update.

* src/cff/cffobjs.h (cff_size_select), src/sfnt/sfdriver.c
(sfnt_interface), src/truetype/ttdriver.c (tt_size_request): Fix
compiler errors/warnings when TT_CONFIG_OPTION_EMBEDDED_BITMAPS is not
defined.

* src/sfnt/ttmtx.c (tt_face_load_hmtx, tt_face_get_metrics): Fix
possible segment faults for the non-FT_OPTIMIZE_MEMORY'ed versions.
(finally!)

For most OpenType tables, `tt_face_load_xxxx' simply loads the table
and `face->root' is set later in `sfnt_load_face'.  Here, we try to
make this work for _all_ tables.

* src/sfnt/ttsbit.c, src/sfnt/ttsbit0.c, src/sfnt/ttload.c,
src/sfnt/ttmtx.c: all `tt_face_load_xxxx' should load the table and
then exit.  Error handling or setting face->root is done later in
`sfnt_load_face'.
Pretty trace messages.

* src/sfnt/sfobjs.c (sfnt_load_face): Work harder.
Mac bitmap-only fonts are not scalable.
Check that `face->header.Units_Per_EM' is not zero.
(LOAD_, LOADM_): Pretty trace messages.

* src/sfnt/ttsbit0.c (tt_face_load_strike_metrics): Read metrics from
`eblc'.

* src/sfnt/ttcmap.c (tt_face_build_cmaps), src/sfnt/ttpost.c
(load_format_20, load_format_25, tt_face_get_ps_name): Use
face->max_profile.numGlyphs, instead of face->root.num_glyphs.
2006-02-15 07:44:31 +00:00
Wu, Chia-I (吳佳一) ce34d122ba * src/truetype/ttinterp.c (Update_Max): Set current size of buffer
correctly (so that memory debug system won't panic).
2005-12-17 13:12:49 +00:00
Werner Lemberg 674ba91f12 formatting 2005-11-16 18:09:27 +00: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
Wu, Chia-I (吳佳一) d6d73989b0 * src/truetype/ttinterp.c, src/truetype/ttinterp.h: Update copyright
messages.
2005-08-16 02:06:01 +00:00
Wu, Chia-I (吳佳一) 0142e6aff1 * src/truetype/ttinterp.c, src/truetype/ttinterp.h: Remove original
TT_Done_Context and rename TT_Destroy_Context to TT_Done_Context with
slight changes.

* src/truetype/ttobjs.h (tt_slot_init): New function.

* src/truetype/ttobjs.c (tt_driver_init): Initialize execution context
here.
(tt_slot_init): New function to create extra points for the internal
glyph loader. We then use it directly, instead of face's glyph loader,
when loading glyph.

* src/truetype/ttdriver.c: Use tt_slot_init for glyph slot
initialization.
(TT_Load_Glyph): Load flag dependencies are handled here.
Return error if size is NULL.

* src/truetype/ttgload.c: Heavy cleanup and refactor.
(TT_Hint_Glyph): New funcion to hint a zone, prepared by caller.
(TT_Process_Simple_Glyph): Use loader->pp's instead of recalculating.
Use TT_Hint_Glyph.
No need to save/restore loader->stream before/after
TT_Vary_Get_Glyph_Deltas now.
(TT_LOADER_SET_PP): New macro to calculate and set the four phantom points.
(TT_Process_Composite_Component, TT_Process_Composite_Glyph,
load_truetype_glyph): Refactor load_truetype_glyph into these three functions.
Never set exec->glyphSize to 0. (close #13107)
Forget glyph frame before calling TT_Process_Simple_Glyph.
(TT_Load_Glyph, load_sbit_image, tt_loader_init): Refactor TT_Load_Glyph into
these three functions.
Set various fields of `glyph' here, instead of in load_truetype_glyph
and compute_glyph_metrics.
2005-08-16 01:54:59 +00:00
Werner Lemberg 33febc0fb2 * docs/CHANGES: Updated.
Fix handling of NPUSHW if skipped in data stream.

* src/truetype/ttinterp.c (opcode_length): Set value for NPUSHW
to -2.
(SkipCode, TT_RunIns): Use opcode_length value for computation of
bytes to be skipped.
2004-10-09 07:07:43 +00:00
Werner Lemberg dea712b4eb `Activate' gray-scale specifing hinting within the TrueType
bytecode interpreter.  This is an experimental feature which
should probably be made optional.

* src/truetype/ttgload.c (TT_Process_Simple_Glyph,
load_truetype_glyph): Move the code to set the pedantic_hinting flag
to...
(TT_Load_Glyph): Here.
Set `grayscale' flag except for `FT_LOAD_TARGET_MONO'.

* src/truetyep/ttinterp.c (Ins_GETINFO): Return MS rasterizer
version 1.7.
Return rotation and stretching info only if glyph is rotated or
stretched, respectively.
Handle grayscale info.

* src/truetype/ttinterp.h (TT_ExecContextRec): Add `grayscale'
member.
2004-08-07 15:08:33 +00:00
David Turner 5ab4136317 * include/freetype/cache/ftcglyph.h, src/cache/ftcglyph.c:
fixed a dangling pointer bug that happened in very rare cases:
        i.e. when a new family object was destroyed by an out-of-memory
        condition during a glyph node initialization. The function
        FTC_Cache_Lookup would flush the cache and restart the lookup
        with a bad pointer.

        * src/cache/ftcmanag.c: fixed a cache flushing bug
2004-07-18 07:15:18 +00:00
Werner Lemberg dfa46199d2 * Jamfile, vms_make.com, builds/win32/visualc/freetype.dsp,
builds/win32/visualc/freetype/vcproj, include/freetype/ftmoderr.h:
Add LZW module.

* Jamfile.in: Removed.

* docs/CHANGES: Updated.

* include/freetype/internal/ftobjs.h: s/MIN/FT_MIN/, s/MAX/FT_MAX/,
s/ABS/FT_ABS/.  Updated all callers.

* src/type1/t1load.c (parse_dict), src/pcf/pcfdrivr.c
(PCF_Face_Init): Use FT_ERROR_BASE.



Add support for PCF fonts compressed with LZW (extension .pcf.Z,
created with `compress').

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

* include/freetype/ftlzw.h: New file.
* include/freetype/config/ftheader.h (FT_LZW_H): New macro for
ftlzw.h.

* src/lzw/*: New files.

* src/pcf/pcfdrivr.c: Include FT_LZW_H.
(PCF_Face_Init): Try LZW also.

* src/gzip/ftgzip.c: s/0/Gzip_Err_Ok/ where appropriate.
Beautify.
2004-03-05 09:26:24 +00:00
Werner Lemberg 6cda9c489d * include/freetype/ftcache.h: Delete duplicated definition of
FTC_FaceID.

* src/cff/cffdrivr.c (cff_get_cmap_info): Call sfnt module's TT CMap
Info service function if the cmap comes from sfnt.  Return 0 if the
cmap is sythesized in cff module.

Formatting; updating copyright.
2004-01-22 09:07:12 +00:00
David Turner 4632fccb1b * include/freetype/internal/ftmemory.h,
src/autohint/ahhint.c, src/base/ftgloadr.c,
        src/base/ftglyph.c, src/base/ftoutln.c,
        src/base/ftstroke.c, src/cff/cffload.c, src/truetype/ttgload.c,
        src/truetype/ttinterp.c:

          introducing the new FT_ARRAY_COPY and FT_ARRAY_MOVE macros
          to make copying arrays easier
2004-01-15 19:07:44 +00:00
David Turner 87c0d30fc5 * include/freetype/fttypes.h
src/autofit/afangles.c
        src/autofit/aflatin.c
        src/autohint/ahglyph.c
        src/autohint/ahhint.c
        src/base/ftcalc.c
        src/base/ftgloadr.c
        src/base/ftglyph.c
        src/base/ftobjs.c
        src/base/ftsynth.c
        src/base/fttrigon.c
        src/cff/cffgload.c
        src/cid/cidgload.c
        src/cid/cidload.c
        src/pfr/pfrgload.c
        src/pfr/pfrload.c
        src/pfr/pfrsbit.c
        src/psaux/psobjs.c
        src/pshinter/pshalgo.c
        src/pshinter/pshglob.c
        src/pshinter/pshrec.c
        src/raster/ftrend1.c
        src/sfnt/ttcmap0.c
        src/smooth/ftsmooth.c
        src/truetype/ttdriver.c
        src/truetype/ttgload.c
        src/truetype/ttinterp.c
        src/truetype/ttobjs.c
        src/type1/t1gload.c
        src/winfonts/winfnt.c:

          use of the FT_PAD_XXX and FT_PIX_XXX macros to avoid compiler
          warnings with very pedantic compilers. Hints:  (x) & -64 will
          warn if (x) is not signed.. use (x) & ~63 instead !
2003-12-24 01:10:46 +00:00
Werner Lemberg d90b67384d Documentation fix. 2003-11-28 22:47:26 +00:00
Werner Lemberg 9f051a7fa4 * src/base/ftcalc.c (FT_MulDiv_No_Round): New function (32 and
64 bit version).
* include/freetype/internal/ftcalc.h: Updated.

* src/truetype/ttinterp.c (TT_MULDIV_NO_ROUND): New macro.
(TT_INT64): Removed.
(DO_DIV): Use TT_MULDIV_NO_ROUND.

* src/pfr/pfrdrivr.c (pfr_get_metrics): Directly use
metrics->x_scale and metrics->y_scale.
2003-11-25 18:15:56 +00:00
Werner Lemberg be67c4ef33 * src/truetype/ttinterp.c (CUR_Func_move_orig): New macro.
(Direct_Move_Orig, Direct_Move_Orig_X, Direct_Move_Orig_Y): New
functions.  Similar to Direct_Move, Direct_Move_X, and
Direct_Move_Y but without touching.
(Compute_Funcs): Use new functions.

(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): Fix rounding of value zero.

(DO_DIV): Don't use TT_MULDIV.

(Ins_SHC): This instruction actually touches the points.
(Ins_MSIRP): Fix undocumented behaviour.

* src/truetype/ttinterp.h (TT_ExecContextRec): Updated.

* docs/VERSION.DLL: Updated.

* src/base/ftobjs.c (FT_Set_Char_Size): Make metrics->x_scale and
metrics->y_scale really precise.

(FT_Load_Glyph): Update computation of linearHoriAdvance and
linearVertAdvance.

* src/true/type/ttinterp.c (Update_Max): Use FT_REALLOC.
2003-11-24 22:54:58 +00:00
David Turner 8b6db86b05 * include/freetype/config/ftoption.h, devel/ftoption.h,
include/freetype/internal/ftobjs.h, include/freetype/internal/tttypes.h,
        src/truetype/ttinterp.c, src/truetype/ttobjs.c, src/truetype/ttobjs.h:

        changed the name of TT_CONFIG_OPTION_COMPILE_UNPATENTED_HINTING to
        the simpler TT_CONFIG_OPTION_UNPATENTED_HINTING

        removed the macro TT_CONFIG_OPTION_FORCE_UNPATENTED_HINTING. Instead,
        the same effect can be used by setting a debug-hook with
        FT_DEBUG_HOOK_UNPATENTED_HINTING globally with FT_Set_Debug_Hook()
2003-08-17 22:09:14 +00:00
Werner Lemberg 6e9b3186b0 * src/truetype/ttinterp.c (SetSuperRound) <0x30>: Follow Apple's
TrueType specification.
(Ins_MDRP, Ins_MIRP): Fix single width cut-in test.
2003-06-10 10:54:33 +00:00
Werner Lemberg 9a8e321129 * src/truetype/ttinterp.c (Free_Project, CUR_Func_freeProj):
Removed.  Unused.
Updated all callers.
2003-06-03 15:03:16 +00:00
Werner Lemberg f79a7ae0b0 * src/gzip/ftgzip.c (ft_gzip_fil_io): Revert change from yesterday;
it has already been fixed differently.

* src/truetype/ttinterp.c (DO_SFVTL): Add missing braces around
if-clause.
2003-05-21 21:47:25 +00:00
Werner Lemberg a3f4da8e99 Minor cleanups. 2003-04-29 13:23:47 +00:00
Graham Asher 3ea859f6e9 Added the unpatented hinting system, which is compiled only if
TT_CONFIG_OPTION_COMPILE_UNPATENTED_HINTING is defined
in ftoption.h
2003-04-25 11:40:46 +00:00
Werner Lemberg b442ca1713 Cleanups. 2003-04-23 15:50:27 +00:00
David Turner ba4511b807 * src/truetype/ttdriver.c, src/truetype/ttobjs.h, src/truetype/ttobjs.c,
src/truetype/ttinterp.c, src/base/ftobjs.c: fixing the slight distortion
    problem that occured due to the latest auto-hinter changes
2003-02-18 22:25:22 +00:00
David Turner b08fe2dc7a * massive re-formatting changes to many, many source files. I don't
want to list them all here. The operations performed were all logical
    transformations of the sources:

      - trying to convert all enums and constants to CAPITALIZED_STYLE, with
        #define definitions like

          #define  my_old_constants   MY_NEW_CONSTANT

      - big, big update of the documentation comments

    * include/freetype/freetype.h, src/base/ftobjs.c, src/smooth/ftsmooth.c,
    include/freetype/ftimage.h: adding support for LCD-optimized rendering
    though the new constants/enums:

      FT_RENDER_MODE_LCD, FT_RENDER_MODE_LCD_V
      FT_PIXEL_MODE_LCD,  FT_PIXEL_MODE_LCD_V

    this is still work in progress, don't expect everything to work correctly
    though most of the features have been implemented.

    * adding new FT_LOAD_XXX flags, used to specify both hinting and rendering
    targets:

      FT_LOAD_TARGET_NORMAL :: anti-aliased hinting & rendering
      FT_LOAD_TARGET_MONO   :: monochrome bitmaps
      FT_LOAD_TARGET_LCD    :: horizontal RGB/BGR decimated hinting & rendering
      FT_LOAD_TARGET_LCD_V  :: vertical RGB/BGR decimated hinting & rendering

    note that FT_LOAD_TARGET_NORMAL is 0, which means that the default
    behaviour of the font engine is _unchanged_.
2002-08-27 20:20:29 +00:00
Werner Lemberg 91db04cb9c * src/truetype/ttgload.c: 16bit fixes.
(TT_Load_Simple_Glyph): Improve debug messages.
(load_truetype_glyph): Remove dead code.
* src/truetype/ttinterp.c: 16bit fixes.
* src/truetype/ttobjs.c: Ditto.

* include/freetype/ftsnames.h, include/freetype/internal/sfnt.h,
src/cff/cffload.h, src/psaux/psobjs.h, src/truetype/ttinterp.[ch],
src/sfnt/ttpost.h: s/index/idx/.

formatting, copyright updates.
2002-04-01 14:25:28 +00:00
Werner Lemberg b1e6e59782 * builds/vms/ftconfig.h: Rename LOCAL_DEF and LOCAL_FUNC to
FT_LOCAL and FT_LOCAL_DEF, respectively, as with other ftconfig.h
files.
* builds/unix/ftconfig.in: Add argument to FT_LOCAL and
FT_LOCAL_DEF.
* src/truetype/ttinterp.c: s/FT_Assert/FT_ASSERT/.
* builds/unix/configure.ac: Temporarily deactivate creation of
../../Jamfile.
* builds/unix/configure: Updated.
2002-03-29 07:43:04 +00:00
David Turner 4b29d58761 removing compiler warnings 2002-03-25 17:02:26 +00:00
David Turner e459d742e6 * include/freetype/internal/ftmemory.h, and a lot of other files !!:
changed the names of memory macros. Examples:

              MEM_Set   => FT_MEM_SET
              MEM_Copy  => FT_MEM_COPY
              MEM_Move  => FT_MEM_MOVE

              ALLOC     => FT_ALLOC
              FREE      => FT_FREE
              REALLOC   = >FT_REALLOC

            FT_NEW was introduced to allocate a new object from a _typed_
            pointer..

            note that ALLOC_ARRAY and REALLOC_ARRAY have been replaced
            by FT_NEW_ARRAY and FT_RENEW_ARRAY which take _typed_ pointer
            arguments.

            This results in _lots_ of sources being changed, but makes the
            code more generic and less error-prone..
2002-03-22 13:52:37 +00:00
David Turner b5713c54c3 * include/freetype/internal/psglobals.h (removed),
include/freetype/internal/pshints.h,
          src/pshinter/pshglob.h: removing obsolete file

        * include/freetype/internal/tttypes.h,
          include/freetype/internal/sfnt.h,
          src/base/ftnames.c, src/cff/cffdrivr.c,
          src/sfnt/*.c, src/truetype/*.c: updated SFNT/TrueType type
          definitions
2002-03-14 11:26:29 +00:00
David Turner bc82f1bbef * include/freetype/ftconfig.h: changed FT_LOCAL xxxx to FT_LOCAL( xxxx )
everywhere in the source. Sames goes for FT_LOCAL_DEF xxxx translated
        into FT_LOCAL_DEF( xxxxx )
2002-03-01 02:26:22 +00:00
Werner Lemberg 2b6248bac0 formatting 2001-07-07 23:24:02 +00:00
David Turner 3b7049fe10 removed pedantic compiler warnings when the bytecode
interpreter is compiled in the library
2001-07-07 16:12:14 +00:00
Werner Lemberg 415235df1b finishing function header formatting
updating copyrights
2001-06-28 17:49:10 +00:00
Werner Lemberg 4a2305cf0c formatting 2001-06-28 07:17:51 +00:00
David Turner 7ad248a51b formatting/bug fix 2001-06-27 11:08:25 +00:00
David Turner dee781342b * include/freetype/ftconfig.h, src/*/*.c: changed the definition and
uses of the FT_CALLBACK_DEF macro in order to support 16-bit compilers
2001-06-27 09:26:46 +00:00
David Turner ac6cc419df modified the TrueType interpreter to let it
use the new trigonometric functions provided in "fttrigon.h". This
        gets rid of some old 64-bit computation routines, as well as many
        warnings when compiling the library with the "long long" 64-bit
        integer type.
2001-06-14 12:34:00 +00:00
Werner Lemberg 7986070714 Increase `version_info' to 7:0:1.
Fixed a bug that returned an invalid linear width for composite
TrueType glyphs.
* include/internal/tttypes.h (TT_Loader_): Two new elements `linear'
and `linear_def'.
* src/truetype/ttgload.c (load_truetype_glyph,
compute_glyph_metrics): Use it.
* include/fttypes.h (FT_ERROR_BASE): New macro.
* src/base/ftobjs.c (FT_Open_Face, FT_Render_Glyph_Internal): Use it
to make source code work with the new error scheme implemented by
Werner.
* src/base/ftoutln.c (FT_Outline_Render): Ditto.
2001-06-08 21:17:29 +00:00
David Turner 57d4de0e51 fixed a bug that returned an invalid linear width for composite
TrueType glyphs

fixed source code to work with the new error scheme implemented
by Werner
2001-06-08 13:29:36 +00:00
Werner Lemberg 1f7f0e87e5 Complete redesign of error codes. Please check ftmoderr.h for more
details.

* include/freetype/internal/cfferrs.h,
include/freetype/internal/tterrors.h,
include/freetype/internal/t1errors.h: Removed.  Replaced with files
local to the module.  All extra error codes have been moved to
`fterrors.h'.

* src/sfnt/ttpost.h: Move error codes to `fterrors.h'.

* src/autohint/aherrors.h, src/cache/ftcerror.h, src/cff/cfferrs.h,
src/cid/ciderrs.h, src/pcf/pcferror.h, src/psaux/psauxerr.h,
src/psnames/psnamerr.h, src/raster/rasterrs.h, src/sfnt/sferrors.h,
src/smooth/ftsmerrs.h, src/truetype/tterrors.h,
src/type1/t1errors.h, src/winfonts/fnterrs.h: New files defining the
error names for the module it belongs to.

* include/freetype/ftmoderr.h: New file, defining the module error
offsets.  Its structure is similar to `fterrors.h'.

* include/freetype/fterrors.h (FT_NOERRORDEF): New macro.
(FT_ERRORDEF): Redefined to use module error offsets.
All internal error codes are now public; unused error codes have
been removed, some are new.

* include/freetype/config/ftheader.h (FT_MODULE_ERRORS_H): New
macro.
* include/freetype/config/ftoption.h
(FT_CONFIG_OPTION_USE_MODULE_ERRORS): New macro.

All other source files have been updated to use the new error codes;
some already existing (internal) error codes local to a module have
been renamed to give them the same name as in the base module.

All make files have been updated to include the local error files.


* src/cid/cidtokens.h: Replaced with...
* src/cid/cidtoken.h: This file for 8+3 consistency.

* src/raster/ftraster.c: Use macros for header file names.
2001-06-06 17:30:41 +00:00
David Turner 8d3a401fa8 * builds/*/*-def.mk: changed the objects directory from "obj" to "objs"
* include/freetype/config/ftheader.h: removed obsolete macros like
	FT_SOURCE_FILE, etc.. and added cache-specific macro definitions that
	were previously defined in <freetype/ftcache.h>. Added comments to be
	included in a new API Reference section.

	* src/*/*: removed the use of FT_SOURCE_FILE, etc.. now, each component
	needs to added its own directory to the include path at compile time.
	Modified all "rules.mk" and "descrip.mms" accordingly..
2001-03-20 11:14:24 +00:00
Werner Lemberg 63408a1299 include/freetype/internal/internal.h: Fixed header inclusion macros
to use direct definitions.  This is the only way to do these things
in a portable way :-(  The rest of the code should follow shortly
though everything compiles now.
* builds/compiler/intelc.mk, builds/compiler/watcom.mk: New files.

* builds/win32/detect.mk: Added support for the Intel C/C++
compiler, as well as _preliminary_ (read: doesn't work!) support for
Watcom.  Also added a new setup target.  Type "make setup list" for
a list of supported command-line compilers on Win32.

* src/base/ftdebug.c: Added dummy symbol to avoid empty file if
conditionals are off.
2000-12-13 23:44:37 +00:00
David Turner 170c0d4c0d * include/freetype/config/ft2build.h,
include/freetype/internal/internal.h: fixed header inclusion macros
	to use direct definitions. This is the only way to do these things
	in a portable way :-( The rest of the code should follow shortly
	though everything compiles now..

	* builds/compiler/intelc.mk, builds/compiler/watcom.mk,
	builds/win32/detect.mk: added support for the Intel C/C++ compiler,
	as well as _preliminary_ (read: doesn't work !!) support for Watcom.
	Also added a new setup target. Type "make setup list" for a list
	of supported command-line compilers on Win32..
2000-12-13 19:55:11 +00:00
Werner Lemberg d5c1b27d58 * include/freetype/config/ft2build.h (FT2_ROOT, FT2_CONFIG_ROOT):
Removed.  ANSI C doesn't (explicitly) allow macro expansion in
arguments using `##'.
(FT2_PUBLIC_FILE, FT2_CONFIG_FILE, FT2_INTERNAL_FILE): Use directory
names directly.  Make them configurable.  Use `##' to strip leading
and trailing spaces from arguments.

* builds/unix/ft2unix.h: Adapted.

* src/base/ftsystem.c (ft_alloc, ft_realloc, ft_free, ft_io_stream,
ft_close_stream): Use FT_CALLBACK_DEF.

* builds/unix/ftsystem.c: Use new header scheme.
(FT_Done_Memory): Use free() from FT_Memory structure.

* src/base/ftinit.c, src/base/ftmac.c: Header scheme fixes.

* include/freetype/config/ft2build.h (FT2_CONFIG_ROOT,
FT2_PUBLIC_FILE, FT2_CONFIG_FILE, FT2_INTERNAL_FILE,
FT_SOURCE_FILE): Use `##' operator to be really ANSI C compliant.
2000-12-12 22:28:12 +00:00
Werner Lemberg 6d5d719d9e * include/freetype/config/build.h (FT2_CONFIG_ROOT, FT2_PUBLIC_FILE,
FT2_CONFIG_FILE, FT2_INTERNAL_FILE, FT_SOURCE_FILE): Use `##'
operator to be really ANSI C compliant.


* builds/unix/detect.mk: Remove unused USE_CFLAGS variable.


* src/truetype/ttinterp.c: Remove unused CALC_Length() macro.
2000-12-12 06:36:55 +00:00
Werner Lemberg cc069beb2d cleanups 2000-12-08 16:17:16 +00:00
David Turner 19ed8afe60 - updated all source files to adhere to the new inclusion scheme
- the CFF loader now loads the encodings and charset tables
  though doesn't use them for now
2000-12-08 02:42:29 +00:00
David Turner b1aabf4c5e - added support for the free command-line Borland C++ compiler
in the "builds" directory

- modified a few files because BCC32 didn't like certain comparisons
  (UInt compared with a UShort, apparently the UShort is promoted to
  an Int)

- updated the INSTALL file to include IDE compilation, prevent against
  BSD Make, and clarify the use of "make setup" (instead of "make")
  for build configuration
2000-11-30 23:48:22 +00:00
Werner Lemberg 90a0330142 All function comments are now removed from source files (and moved to the
header files if necessary).

Some minor fixes to have `make multi' run successfully (with gcc and g++).

Fixing compiler warnings.
2000-11-07 17:21:11 +00:00