Commit Graph

2721 Commits

Author SHA1 Message Date
Werner Lemberg 5cdeb3cd60 Fix Savannah bug #37000.
* src/type1/t1load.c (parse_encoding): Fix order of checks.
2012-07-31 20:17:13 +02:00
Werner Lemberg 5987445073 Formatting, comment fixes. 2012-07-29 13:15:53 +02:00
Werner Lemberg 6b440425fc Fix Savannah bug #36833.
* src/psaux/t1decode.c (t1operator_seac): `seac' is not a valid
operator if we want metrics only.
2012-07-18 10:39:18 +02:00
Werner Lemberg 01b508f247 Fix Savannah bug #36832.
* src/type1/t1load.c (parse_charstrings): Reject negative number of
glyphs.
2012-07-18 10:38:54 +02:00
Werner Lemberg a8c243514c Fix Savannah bug #36829.
* src/type1/t1load.c (parse_encoding): Check cursor position after
call to T1_Skip_PS_Token.
2012-07-18 10:38:37 +02:00
Alexei Podtelezhnikov bc5bcecfd2 Revert the last commit 45337b07. 2012-07-13 17:52:43 -04:00
Alexei Podtelezhnikov 45337b07a7 [ftstroke] Fix uninitialized return value.
* src/base/ftstroke.c (FT_Stroker_New): Return FT_Err_Ok instead.
2012-07-11 22:12:13 -04:00
Werner Lemberg e7454a47e2 [smooth] Avoid memory like in case of failure.
* src/smooth/ftsmooth.c (ft_smooth_render_generic): Use flags to
indicate what to clean up after finishing the function, with and
without errors.
2012-07-11 12:05:58 +02:00
Werner Lemberg 26472b4f16 Fix compilation with MSVC 5.0.
Problem reported by Peter Breitenlohner and Akira Kakuto.

* include/freetype/config/ftstdlib.h (ft_setjmp): Updated.
* src/sfnt/ttcmap.c (tt_face_build_cmaps): Remove cast.
2012-07-09 09:55:50 +02:00
Werner Lemberg 5a0af493e4 [autofit] Improve debugging messages; do some code cleanup.
* src/autofit/aflatin.c (af_latin_align_linked_edge,
af_latin_hint_edges): Synchronize with formatting used in the
ttfautohint project.
2012-07-09 08:19:25 +02:00
Gilles Espinasse 9123404c57 Fix strict-aliasing warning.
* src/base/ftglyph.c (FT_Glyph_To_Bitmap): Avoid double cast.
2012-07-07 11:17:02 +02:00
Werner Lemberg b6978dd0c9 [autofit] Do some code cleanup.
* src/autofit/afglobal.c (af_face_globals_new): Simplify.

* src/autofit/afhints.c: Use `FT_TRACE7' instead of `printf'
everywhere.
(FT_COMPONENT): New macro.
(af_glyph_hints_done): Simplify.

* include/freetype/internal/fttrace.h: Updated.
2012-07-06 19:38:44 +02:00
Werner Lemberg fd5ae9599a [autofit] Improve output of debugging information.
* src/autofit/afhints.c (af_glyph_hints_dump_segments): Print more
data; report no data.
(af_glyph_hints_dump_edges): Report no data.
2012-07-05 10:30:41 +02:00
Werner Lemberg 5210306145 Fix Savannah bug #36091.
* src/autofit/aflatin.c (af_latin_metrics_init_blues),
src/autofit/aflatin2.c (af_latin2_metrics_init_blues): Change the
constraint for testing round vs. flat segment: Accept either a
small distance or a small angle.
2012-07-04 17:20:33 +02:00
Werner Lemberg e8da532d2a [autofit] Improve comment. 2012-07-04 13:51:32 +02:00
Werner Lemberg 09e9b59605 [autofit] Beautify blue zone tracing.
* src/autofit/aflatin.c (af_latin_metrics_init_blues),
src/autofit/aflatin2.c (af_latin2_metrics_init_blues): Implement it.
2012-07-04 13:00:06 +02:00
Werner Lemberg 2a9c4552f6 [autofit] Quantize stem widths.
* src/autofit/afangles.c (af_sort_widths): Rename to...
(af_sort_and_quantize_widths): This.
Add code to avoid stem widths which are almost identical.
* src/autofit/aftypes.h, src/autofit/aflatin.c, src/autofit/afcjk.c:
Updated.
2012-07-03 11:54:12 +02:00
Werner Lemberg d4cbbf35d4 [autofit] Minor speed-up.
* src/autofit/afangles (af_sort_pos, af_sort_widths): Don't swap
elements if they are equal.
2012-07-03 11:01:53 +02:00
Infinality d0a827b340 [truetype] Fix various artifacts. 2012-06-28 20:34:26 -05:00
Werner Lemberg b3953aa7c4 [truetype] Set the `subpixel_positioned' flag unconditionally.
This is how the code currently behaves.

* src/truetype/ttgload.c (tt_loader_init): Do it.
2012-06-28 06:23:12 +02:00
Werner Lemberg 124709657a Fix conditional compilation.
* src/base/basepic.c: Use FT_CONFIG_OPTION_MAC_FONTS.
2012-06-27 08:44:30 +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
Werner Lemberg 56751532d3 [cff] Fix Savannah bug #36705.
Handle numbers like 2.001 correctly.

* src/cff/cffparse.c (cff_parse_real): Avoid negative values for
`shift'.
2012-06-25 10:58:20 +02: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
Alexei Podtelezhnikov cea9d7a682 * src/base/ftsynth.c (FT_GlyphSlot_Embolden): Improve spacing.
* docs/CHANGES: Updated.
2012-06-15 06:33:46 +02:00
suzuki toshiya 6c7c3de197 [truetype] Add new versions of NEC FA family to tricky font list.
NEC FA family dated in 1996 have different checksum.
Reported by Johnson Y. Yan <yinsen_yan@foxitsoftware.com>; see

  http://lists.gnu.org/archive/html/freetype-devel/2012-06/msg00023.html

* src/truetype/ttobjs.c (tt_check_trickyness_sfnt_ids): 4 sets
of fpgm & prep table checksums for FA-Gothic, FA-Minchou,
FA-RoundedGothicM, FA-RoundedGothicB are added.  The family
names in sample PDF are truncated, thus the list of the
family names in tt_check_trickyness_family() is not updated yet.
2012-06-14 01:38:20 +09:00
Werner Lemberg 495bd3cc4f [ftraster] Fix rounding issue causing visual artifacts.
Problem reported by jola <hans-jochen.lau@lhsystems.com>; see

  http://lists.gnu.org/archive/html/freetype-devel/2012-05/msg00036.html

* src/raster/ftraster.c (SMulDiv_No_Round): New macro.
(Line_Up): Use it.
* src/raster/ftmisc.h (FT_MulDiv_No_Round): Copied from `ftcalc.c'.
2012-06-06 13:24:04 +02:00
Alexei Podtelezhnikov 2bdd094976 * src/base/ftoutln.c (FT_Outline_Get_Orientation): Simplify.
We now use the cross product of the direction vectors to compute the
outline's orientation.
2012-05-28 23:11:03 +02:00
Alexei Podtelezhnikov f875fc7117 New function FT_Outline_EmboldenXY.
* include/freetype/ftoutln.h (FT_Outline_EmboldenXY): Define it.

* src/base/ftoutln.c (FT_Outline_EmboldenXY): Implement it, using a
simplified embolding algorithm.
(FT_Outline_Embolden): Make it a special case of
`FT_Outline_EmboldenXY'
2012-05-28 22:34:58 +02:00
Werner Lemberg 8dc17bb47b [type1] Fix Savannah bug #36386.
* src/type1/t1load.c (t1_load_keyword): Ignore keyword if context is
not valid.
2012-05-07 11:24:48 +02:00
Werner Lemberg 9c6d1ac39c Remove compiler warning.
* src/truetype/ttgload.c (TT_Load_Glyph)
[!TT_CONFIG_OPTION_EMBEDDED_BITMAPS]: Access `glyph->face' directly.
2012-04-07 06:39:25 +02:00
Werner Lemberg 8be32d2f4a [autofit] Properly copy scaler flags to script metrics object.
Without this patch, only the dummy and cjk autohinter modules get
them (since they copy the whole scaler object).

* src/autofit/aflatin.c (af_latin_metrics_scale),
src/autofit/aflatin2.c (af_latin2_metrics_scale): Implement it.
2012-03-28 12:21:50 +02:00
Alexei Podtelezhnikov 0c5789f9c2 [bdflib] Remove redundant macro.
* src/bdf/bdflib.c (isdigok): Remove and replace with sbitset, which
is exactly the same.
2012-03-22 07:05:40 +01:00
Werner Lemberg 37b5c92f83 [bdf] Improvement to Savannah bug #35656.
* src/bdf/bdflib.c (isdigok): Add cast, as suggested in report.
2012-03-20 07:23:12 +01:00
Werner Lemberg b43e0f4413 [type1] Fix Savannah bug #35847.
* src/type1/t1load.c (parse_subrs): Fix the loop exit condition;
we want to exit when we have run out of data.
2012-03-17 07:42:43 +01:00
Werner Lemberg 649c673a8f [bdf] Really fix 35658.
* src/bdf/bdflib.c (_bdf_list_split): Add one more `field' initializer.
2012-03-16 21:12:41 +01:00
Werner Lemberg ad05bac605 [sfnt] Make arrays static like all others.
* src/sfnt/ttload.c (tt_face_load_maxp, tt_face_load_os2),
src/sfnt/ttmtx.c (tt_face_load_hhea): Add `static' keyword to frame
fields.
2012-03-14 18:34:36 +01:00
Huw Davies 3650f80165 [sfnt] A refinement of the previous commit.
* src/sfnt/sfobjs.c (tt_name_entry_ascii_from_utf16,
tt_name_entry_ascii_from_other): Stop at null byte.
2012-03-14 18:29:57 +01:00
Huw Davies bf06b62a09 [sfnt] Add `name' table compatibility to MS Windows.
* src/sfnt/sfobjs.c (tt_name_entry_ascii_from_utf16,
tt_name_entry_ascii_from_other): Don't replace `\0' with question
marks when converting strings.
2012-03-14 14:44:46 +01:00
Werner Lemberg 9a55cb7a71 Fix Savannah bug #35833.
Based on the patch given in the bug report.

* src/type1/t1load.c (IS_INCREMENTAL): New macro.
(read_binary_data): Add parameter `incremental'.
Update all callers using `IS_INCREMENTAL'.
2012-03-14 14:40:03 +01:00
Werner Lemberg cbe9029203 Comment typo. 2012-03-13 08:52:31 +01:00
Werner Lemberg 1036409692 [autofit] Return correct linear advance width values.
This was quite a subtle bug which accidentally showed up with glyph
`afii10023' of arial.ttf (version 2.76).  This glyph is a composite;
the first component, `E', has an advance width of 1366 font units,
while the advance width of the composite itself (which looks like
uppercase `E' with dieresis) is 1367 font units.  I think this is
actually a bug in the font itself, because there is no reason that
this glyph has not the same width as uppercase `E' without the
dieresis.  Anyway, it helped identify this problem.

Using the TrueType hinter, the correct value (1367) of `afii10023'
was returned, but the autohinter mysteriously returned 1366.

Digging in the code showed that the autohinter recursively calls
FT_Load_Glyph to load the glyph, adding the FT_LOAD_NO_SCALE load
flag.  However, the `linearHoriAdvance' field is still returned as a
scaled value.  To avoid scaling twice, the old code in autofit reset
`linearHoriAdvance', using the `horiAdvance' field.  This seemed to
work since FT_LOAD_NO_SCALE was in use, but it failed actually,
because `horiAdvance' is defined as the distance of the first
subglyph's phantom points, which in turn are initialized using the
advance width of the first subglyph.  And as the given example
shows, these widths can differ.

* src/autofit/afloader.c (af_loader_load_g): Temporarily set
FT_LOAD_LINEAR_DESIGN while calling FT_Load_Glyph to get unscaled
values for the linear advance widths.
2012-03-11 15:20:32 +01: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 c4cad30ed1 [bdf] Add missing overflow check.
* src/bdf/bdflib.c (_bdf_parse_glyphs) <BITMAP>: Add threshold for
`glyph->bpr'.
2012-03-08 20:11:37 +01:00
Vinnie Falco 26dfeb6d63 Prepare source code for amalgamation.
* src\autofit\aferrors.h, src\bdf\bdferror.h, src\bzip2\ftbzip2.c,
src\cache\ftcerror.h, src\cff\cfferrs.h, src\cid\ciderrs.h,
src\gxvalid\gxverror.h, src\gzip\ftgzip.c, src\lzw\ftlzw.c,
src\otvalid\otverror.h, src\pcf\pcferror.h, src\pfr\pfrerror.h,
src\psaux\psauxerr.h, src\pshinter\pshnterr.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\type42\t42error.h, src\winfonts\fnterrs.h:
Add #undef FT_ERR_PREFIX before #define FT_ERR_PREFIX.
2012-03-08 06:04:03 +01:00
Werner Lemberg 8a2b444db1 Revert "[cff] One more check against malformed font matrix."
As Alexei points out, this test is completely nonsense.

This reverts commit 35bb214ae6.
2012-03-04 08:35:03 +01:00
Werner Lemberg 35bb214ae6 [cff] One more check against malformed font matrix.
* src/cff/cffparse.c (cff_parse_font_matrix): Guard against `xx' and
`yy' matrix coefficients being zero.
2012-03-03 12:29:53 +01:00