Commit Graph

363 Commits

Author SHA1 Message Date
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
David Turner 76a5f62323 major reformatting of the sources:
FT_EXPORT_DEF    => FT_EXPORT
  FT_EXPORT_FUNC => FT_EXPORT_DEF
  BASE_DEF               => FT_BASE
  BASE_FUNC            => FT_BASE_DEF
  LOCAL_DEF             => FT_LOCAL
  LOCAL_FUNC          => FT_LOCAL_DEF
  LOCAL_FUNC_X     => FT_CALLBACK_DEF
  LOCAL_DEF_X       => FT_CALLBACK_TABLE
  FT_CPLUSPLUS     => FT_CALLBACK_TABLE_DEF
2000-11-04 01:55:49 +00:00
Werner Lemberg a13a473dd9 More C++ fixes. 2000-11-02 15:14:38 +00:00
Werner Lemberg 7fa51b5535 Formatting.
Adding some trivial error checking.

Adding/Fixing tracing levels.
2000-07-08 19:51:42 +00:00
David Turner a90663f591 vast clean-up of the sources in order to allow flat
directory compilation (by defining the FT_FLAT_COMPILE
macro at compile time..)

moved "freetype2/BUILD" to "freetype2/docs/BUILD"
2000-07-08 00:41:13 +00:00
David Turner 43a2f656a7 fixed a few bugs, cleaned up some code 2000-07-05 18:23:38 +00:00
Werner Lemberg bd5ae40006 Run g++ on the FreeType library. This should make the use of code in
C++ programs easier:

  Renamed FT_WordXX to FT_UIntXX.

  Changed a lot of void* to FT_Byte* if related to i/o streams -- FreeType
  always accesses streams byte-wise, so this makes sense IMHO.

  Added a lot of #ifdef __cplusplus to header files (and removed a few).

  Other minor syntax fixes (mostly casts).

  Replaced the variable `private' with `private_dict' -- `private' is
  reserved in C++.
2000-07-05 04:32:02 +00:00
David Turner c6a92202c2 various clean-ups:
- using FT_UNUSED instead of UNUSED
- using FT_LONG64 and FT_INT64 instead of LONG64 & INT64
- using FT_SIZEOF_INT & FT_SIZEOF_LONG instead of...

- removed the #ifdefs that used SIZEOF_INT, instead we now
  use FT_Int32 and FT_UInt32 when needed to support
  32-bits quantity correctly on 64-bits systems..
2000-07-04 18:12:13 +00:00
Werner Lemberg 5811c7c3a5 Formatting.
Fixed some errors which prevented compiling.
2000-07-02 13:53:16 +00:00
Werner Lemberg a929ba9b20 applying formatting again 2000-06-25 06:47:11 +00:00
David Turner f0df85ba2a - MAJOR INTERNAL REDESIGN:
A lot of internal modifications have been performed lately on the
    source in order to provide the following enhancements:

      - more generic module support:

        The FT_Module type is now defined to represent a handle to a given
        module. The file <freetype/ftmodule.h> contains the FT_Module_Class
        definition, as well as the module-loading public API

        The FT_Driver type is still defined, and still represents a pointer
        to a font driver. Note that FT_Add_Driver is replaced by FT_Add_Module,
        FT_Get_Driver by FT_Get_Module, etc..


      - support for generic glyph image types:

        The FT_Renderer type is a pointer to a module used to perform various
        operations on glyph image.

        Each renderer is capable of handling images in a single format
        (e.g. ft_glyph_format_outline). Its functions are used to:

           - transform an glyph image
           - render a glyph image into a bitmap
           - return the control box (dimensions) of a given glyph image


        The scan converters "ftraster.c" and "ftgrays.c" have been moved
        to the new directory "src/renderer", and are used to provide two
        default renderer modules.

        One corresponds to the "standard" scan-converter, the other to the
        "smooth" one.

        The current renderer can be set through the new function
        FT_Set_Renderer.

        The old raster-related function FT_Set_Raster, FT_Get_Raster and
        FT_Set_Raster_Mode have now disappeared, in favor of the new:

           FT_Get_Renderer
           FT_Set_Renderer

        see the file <freetype/ftrender.h> for more details..

        These changes were necessary to properly support different scalable
        formats in the future, like bi-color glyphs, etc..


      - glyph loader object:

        A new internal object, called a 'glyph loader' has been introduced
        in the base layer. It is used by all scalable format font drivers
        to load glyphs and composites.

        This object has been created to reduce the code size of each driver,
        as each one of them basically re-implemented its functionality.

        See <freetype/internal/ftobjs.h> and the FT_GlyphLoader type for
        more information..



      - FT_GlyphSlot had new fields:

        In order to support extended features (see below), the FT_GlyphSlot
        structure has a few new fields:

           linearHoriAdvance:  this field gives the linearly scaled (i.e.
                               scaled but unhinted) advance width for the glyph,
                               expressed as a 16.16 fixed pixel value. This
                               is useful to perform WYSIWYG text.

           linearVertAdvance:  this field gives the linearly scaled advance
                               height for the glyph (relevant in vertical glyph
                               layouts only). This is useful to perform
                               WYSIWYG text.

        Note that the two above field replace the removed "metrics2" field
        in the glyph slot.

           advance:   this field is a vector that gives the transformed
                      advance for the glyph. By default, it corresponds
                      to the advance width, unless FT_LOAD_VERTICAL_LAYOUT
                      was specified when calling FT_Load_Glyph or FT_Load_Char

           bitmap_left: this field gives the distance in integer pixels from
                        the current pen position to the left-most pixel of
                        a glyph image WHEN IT IS A BITMAP. It is only valid
                        when the "format" field is set to
                        "ft_glyph_format_bitmap", for example, after calling
                        the new function FT_Render_Glyph.

           bitmap_top:  this field gives the distance in integer pixels from
                        the current pen position (located on the baseline) to
                        the top-most pixel of the glyph image WHEN IT IS A
                        BITMAP. Positive values correspond to upwards Y.

           loader:  this is a new private field for the glyph slot. Client
                    applications should not touch it..


      - support for transforms and direct rendering in FT_Load_Glyph:

        Most of the functionality found in <freetype/ftglyph.h> has been
        moved to the core library. Hence, the following:

          - a transform can be specified for a face through FT_Set_Transform.
            this transform is applied by FT_Load_Glyph to scalable glyph images
            (i.e. NOT TO BITMAPS) before the function returns, unless the
            bit flag FT_LOAD_IGNORE_TRANSFORM was set in the load flags..


          - once a glyph image has been loaded, it can be directly converted to
            a bitmap by using the new FT_Render_Glyph function. Note that this
            function takes the glyph image from the glyph slot, and converts
            it to a bitmap whose properties are returned in "face.glyph.bitmap",
            "face.glyph.bitmap_left" and "face.glyph.bitmap_top". The original
            native image might be lost after the conversion.


          - when using the new bit flag FT_LOAD_RENDER, the FT_Load_Glyph
            and FT_Load_Char functions will call FT_Render_Glyph automatically
            when needed.
2000-06-22 00:17:42 +00:00
Werner Lemberg 9ca2af3838 A new formatting orgy.
Added some `#if 0' to completely disable the CID AFM stuff.  In case this is
not correct please fix.
2000-06-21 03:03:28 +00:00
David Turner f9b8dec437 major reformatting of the modules source code in order to get
rid of most of the basic types redefinitions (i.e. FT_Int instead
of "FT_Int", etc..)

The format-specific prefixs like "TT_", "T1_", "T2_" & 'CID_"
are now only used in relevant structures..

fixed Werner's fix to t2gload.c :-)
other small bug fixes
2000-06-16 19:34:52 +00:00
Werner Lemberg 7a4fda8821 The next round of formatting, checking documentation, etc. 2000-06-13 23:21:00 +00:00
Werner Lemberg 78575dc0d1 A lot of formatting.
Added more tracing levels.

More Makefile fixes.

Minor other changes.
2000-06-12 19:36:41 +00:00
Werner Lemberg e1d5dd78f4 Moved all *errors.h header files to include/freetype/internal for
consistency.

Removed unused error message.
2000-06-07 04:48:12 +00:00
David Turner 1fb6eea7d1 EXPORT_DEF renamed to FT_EXPORT_DEF +
reformating/spacing
2000-05-24 00:31:14 +00:00
David Turner 51179f0ae3 some fixes for 64-bit systems. Mainly changed some
FT_TRACE calls to use %p instead of %lx when dumping
a pointer address
2000-05-18 16:18:05 +00:00
David Turner e49ab25c08 formatting - removed trailing spaces 2000-05-16 23:44:38 +00:00
David Turner c30aea9846 another massive changes in order to completely avoid
compiler warnings with GCC + "-ansi -pedantic -Wall -W"
and LCC.

Also fixed the compilation of "type1z" with Win32-LCC
(its pre-processor is broken !!)

Updated the BUILD document too
2000-05-12 15:01:18 +00:00
David Turner bfe2f98f1f a new massive grunt work. Redefined the EXPORT_DEF,
EXPORT_FUNC, BASE_DEF and BASE_FUNC macros to
let them take an argument..

This is needed to compile the library as a DLL on some platforms
that have different compiler conventions..
2000-05-12 12:17:15 +00:00
David Turner efce08d67c major re-organisation of the FreeType 2 directory hierarchy 2000-05-11 18:23:52 +00:00
David Turner d186a361a1 various updates to reduce the compilation warnings 2000-05-02 17:41:41 +00:00
David Turner b7ef2b0968 in order to ensure that the bytecode interpretation is exactly
equivalent to the one in FT 1.4, moved some code from the
old version of FreeType in order to compute vector normalization
a bit differently
2000-05-02 11:01:12 +00:00
David Turner 41dbcbf628 reformatting, changing the FT_Outline structure:
- "flags" have been renamed to "tags"
  - "outline_flags" have been renamed to "flags"

Look for more re-formatting today..
2000-03-09 11:46:25 +00:00
David Turner 08fdac980a fixed a bug in the glyph loader that caused a memory
block to be freed twice. Also performed changes to use
the new glyph zone object that has appeared in ftobjs.h
2000-02-21 16:01:33 +00:00
David Turner 1ab77fdfff some updates to make everything compile clean 2000-02-10 18:08:17 +00:00
David Turner d42c68e855 many new small, but important, changes there:
- modified the interface of the "sfnt" module. There is now a function
    called "load_format_tag", and another called "load_directory".

    The first one is in charge of returning the 4-byte tag located at
    the beginning of a given font file. It understand TrueType collections
    and parses them automatically

    The second loads the table directory that is located just after
    the format tag.

    This is useful, because the "SFNT" storage scheme can be used by
    several distinct formats, each with its own format tag.

    The TrueType driver now checks the format tag in "src/truetype/ttobjs.c"

  - made some changes to "src/shared/t1types.h" to clearly separate the
    Type 1 font content from the rest of the T1_Face structure. This
    will be useful when adding the CFF/Type2 driver that will be able
    to reuse the "T1_Font" structure within a "TT_Font" one (which
    really describes a SFNT-based font file).

    Some changes in "src/type1" were thus performed to reflect this.
    Note that the current type1 driver will be discontinued in a
    distant future. More on this later..
2000-01-27 13:56:02 +00:00
David Turner d2b1f35704 Initial revision 1999-12-16 23:11:37 +00:00