Compare commits

...

7606 Commits

Author SHA1 Message Date
Ben Wagner d41a855aab [ttgxvar] Replace tabs with spaces
Also clarify comments around conversion and clamping.

* src/truetype/ttgxvar.c (ft_var_to_normalized): doit
2024-05-29 17:01:29 -04:00
Alexei Podtelezhnikov 7ff43d3e9f [truetype/GX] Consolidate memory allocations.
* src/truetype/ttgxvar.c (tt_face_vary_cvt, TT_Vary_Apply_Glyph_Deltas):
Allocate and split bigger memory blocks, avoid unnecessary zeroing,
do not copy shared tuples, revise error exit paths.
2024-05-26 19:40:20 -04:00
Alexei Podtelezhnikov 3416ac16d0 Whitespace. 2024-05-26 08:10:21 -04:00
Alexei Podtelezhnikov b6dbbd9630 * src/truetype/ttgxvar.c (ft_var_apply_tuple): Reduce checks. 2024-05-24 17:38:14 +00:00
Alexei Podtelezhnikov 70299c924f Revert "[truetype] Reduce allocation scope."
This reverts commit 9ff4153cbf.
2024-05-23 22:50:32 -04:00
Alexei Podtelezhnikov 9ff4153cbf [truetype] Reduce allocation scope.
* src/truetype/ttgxvar.c (TT_Vary_Apply_Glyph_Deltas): Reduce scope
of `points_org` and 'points_out`.
2024-05-22 23:38:34 -04:00
Alexei Podtelezhnikov (Алексей Подтележников) a498873652 * .gitlab-ci.yml: Disable UWP compilation. 2024-05-23 03:05:59 +00:00
Alexei Podtelezhnikov 42d406ab04 * include/freetype/internal/ftmemory.h (FT_MEM_DUP): Fix g++ error. 2024-05-22 21:08:34 -04:00
Alexei Podtelezhnikov 5f131cfd20 [cff, truetype] Validate variation axes immediately.
Instead of validating variation axes in every access, OpenType specs
suggest that peak = 0 be used to tag invalid ranges.  This implements
just that once during loading.

* src/cff/cffload.c (cff_blend_build_vector): Move the range checks...
(cff_vstore_load): ... here.
* src/truetype/ttgxvar.c (tt_var_get_item_delta): Ditto...
(tt_var_load_item_variation_store): ... ditto.
2024-05-21 16:24:43 -04:00
Alexei Podtelezhnikov 99be2b3154 [cff, truetype] Rearrange variation range checks.
This should achieve quicker results for common cases.

* src/cff/cffload.c (cff_blend_build_vector): Rearrange conditionals.
* src/truetype/ttgxvar.c (tt_var_get_item_delta): Ditto.
2024-05-21 18:26:09 +00:00
Alexei Podtelezhnikov 347276c1f6 * src/truetype/ttgxvar.c (tt_var_get_item_delta): Align with specs. 2024-05-21 13:12:45 +00:00
Alexei Podtelezhnikov 39f2fbf80c * src/truetype/ttgxvar.c (tt_var_get_item_delta): Minor refactoring. 2024-05-20 22:47:14 -04:00
Alexei Podtelezhnikov 4ccdc9f982 [cff] Optimize the blend vector computations.
* src/cff/cffload.c (cff_blend_build_vector): Use FT_MulDiv and skip
multiplying by 1.
2024-05-20 18:53:57 -04:00
Alexei Podtelezhnikov b25265fe55 [bdf] Use concise macros.
* src/bdf/bdflib.c (bdf_create_property): Use FT_STRDUP.
(bdf_parse_glyphs_, bdf_parse_start_): Use FT_DUP for brevity.
2024-05-19 22:58:23 -04:00
Alexei Podtelezhnikov 026fd5d4f0 [cache] Use FT_DUP to duplicate data.
* src/cache/ftcsbits.c (ftc_sbit_copy_bitmap): Use concise FT_MEM_DUP.
2024-05-19 22:54:57 -04:00
Alexei Podtelezhnikov d7cf931ac6 [truetype, type1] Use FT_DUP to duplicate data.
* src/truetype/ttgload.c (TT_Load_Simple_Glyph): Use concise FT_DUP.
* src/truetype/ttgxvar.c (TT_Get_MM_Var): Ditto.
* src/type1/t1load.c (parse_subrs): Ditto.
2024-05-19 22:48:13 -04:00
Alexei Podtelezhnikov cdd3572e52 * builds/windows/ftsystem.c: Use _WINRT_DLL to check for UWP.
Fixes compilation using Windows GDK, reported by Erin Melucci.
2024-05-17 22:25:00 -04:00
Alexei Podtelezhnikov 68399b4244 * include/freetype/ftmm.h: Include `freetype.h`.
Reported by Ben Wagner, see !326.
2024-05-13 16:57:35 +00:00
Alexei Podtelezhnikov b8db819768 [type1/MM] Safer handle arrays of different types.
* src/type1/t1load.c (parse_blend_design_map): Separately allocate...
(T1_Done_Blend): ... and free `design_points` and `blend_points`.
2024-05-12 22:38:38 -04:00
Alexei Podtelezhnikov 5b1cde804d * src/type1/t1load.c (parse_blend_design_map): Add risky cast. 2024-05-11 23:27:34 -04:00
Alexei Podtelezhnikov e834786b34 * docs/CHANGES: Mention the last commit. 2024-05-11 23:25:37 -04:00
Alexei Podtelezhnikov 4a85db7e31 [type1/MM] Tighten headers.
* include/freetype/internal/t1types.h: Host PS_DesignMap and PS_Blend.
* include/freetype/ftmm.h: Host and document TT_MAX_MM_XXX.
* include/freetype/t1tables.h: Remove them from here.
2024-05-11 22:19:25 -04:00
Alexei Podtelezhnikov b875924a6f * src/pshinter/pshrec.c (ps_hints_stem): Correct argument. 2024-05-10 23:01:23 -04:00
Ben Wagner a46424228f [psaux] Fix location and type order in initializer
`T1_FIELD_ZERO` is used to zero initialize a `T1_FieldRec`.
`T1_FIELD_ZERO` is currently initilizing `T1_FieldRec::location` with a
`T1_FieldType` and `T1_FieldRec::type` with a `T1_FieldLocation`. This
was detected with `-Wenum-conversion`.

* include/freetype/internal/psaux.h (T1_FIELD_ZERO): correct order of
initalizers
2024-05-08 11:36:18 -04:00
Alexei Podtelezhnikov 1264b84c08 * include/freetype/internal/psaux.h: Fix g++ warning.
Reported by Hin-Tak Leung.
2024-05-07 23:35:59 -04:00
Ben Wagner 5858fa16ca [colr] Avoid overflow in range checks
In 32 bit builds `FT_ULong` is 32 bits and can silently overflow when a
large number is read into one and then it is summed or multiplied with
another number.  Checks for range overflow must be written so that they
themselves do not overflow.  Also ensure that the table_size is always the
first part of the range check and consistently use `<` or `<=`.

* src/sfnt/ttcolr.c (tt_face_load_colr): Avoid overflow.
(find_base_glyph_v1_record): Remove old work-around.

Bug: https://issues.chromium.org/issues/41495455
Bug: https://issues.chromium.org/issues/40945818
2024-05-08 05:01:16 +02:00
Werner Lemberg 2240e21cf5 .mailmap: Fix entry for Ben Wagner. 2024-05-06 21:53:24 +02:00
Alexei Podtelezhnikov d0e3239f32 [sdf, bsdf] Use shared FT_SqrtFixed.
FT_SqrtFixed (95b0fe2a6d) is faster and does not overflow.

* src/sdf/ftsdfcommin.h (square_root): Replace with a macro.
* src/sdf/ftsdfcommin.c (square_root): Remove function.
2024-05-06 13:39:06 +00:00
Alexei Podtelezhnikov 2edfd7e168 * src/autofit/aflatin.c (af_latin_metrics_scale_dim): Remove FT_ABS.
See
    https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=68679
2024-05-04 16:42:47 -04:00
Alexei Podtelezhnikov 7bd887f177 * src/sfnt/sfwoff2.c (woff2_open_font): Fix copy-paste typo. 2024-05-03 16:04:35 +00:00
Alexei Podtelezhnikov 3f28a6b6af [woff,woff2] Limit the number of tables and use FT_MSB.
The upper limit of 4095 is implied by the SFNT header format
where the multiplication by 16 would overflow without it.

* src/sfnt/sfwoff.c (woff_open_font): Updated.
* src/sfnt/sfwoff2.c (woff2_open_font): Ditto.
2024-05-03 15:44:57 +00:00
Ben Wanger 13d1180f45 [woff2] Disallow zero table font entries
The existing code already disallows zero table woff2 overall, but still
allows for individual CollectionFontEntry to create font instances with
zero tables. Such fonts are not useful so error early.

This also fixes an MSAN discovered issue where if a CollectionFontEntry
numTables is zero then the sfnt_header was not fully initialized.

* src/sfnt/sfwoff2.c (woff2_open_font): error on zero tables, always
initalize sfnt_header

Fixes: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=68384
2024-05-02 15:00:27 -04:00
Alexei Podtelezhnikov 4d50468478 [sfnt] Use faster macros in checksums.
* src/truetype/ttobjs.c (tt_synth_sfnt_checksum): Use FT_NEXT_XXX.
* src/sfnt/sfwoff2.c (compute_ULong_sum): Use macros.
2024-05-01 23:19:31 -04:00
Alexei Podtelezhnikov 13da904267 * src/sfnt/sfwoff2.c (compute_ULong_sum): Clean up. 2024-05-01 00:34:21 -04:00
Alexei Podtelezhnikov 2c9691e7c1 * docs/CHANGES: Updated. 2024-04-30 12:59:52 +00:00
Alexei Podtelezhnikov 5962d3c1b9 * src/cache/ftccache.c (FTC_Cache_RemoveFaceID): Remove nodes instantly. 2024-04-29 22:34:09 -04:00
Alexei Podtelezhnikov a209e1adcd [cache] Remove unused `node_reset`.
* src/cache/ftcmru.h (FTC_MruListClassRec): Remove `node_reset` field.
* src/cache/ftcbasic.c (ftc_basic_{image,sbit}_family_class): Ditto.
* src/cache/ftcmanag.c (ftc_face_list_class): Ditto.
(ftc_size_node_reset): Remove function.
* src/cache/ftcglyph.h: Fix comment.
2024-04-29 17:54:30 -04:00
Alexei Podtelezhnikov f8f0d1a1d9 * src/cache/ftcmru.c (FTC_MruList_New): Do not reset nodes.
Resetting of the size nodes can crash, if a parent face purge happens
simultaneously and destroys the node. It is safer to create a new node.
Fixes #1270, reopened with a separate issue.
2024-04-29 16:58:59 -04:00
Alexei Podtelezhnikov 1168b1b5b0 * src/cache/ftcimage.c (ftc_inode_weight): Formatting. 2024-04-27 20:44:01 -04:00
Alexei Podtelezhnikov 4e079f6357 Document the SDF spread further. 2024-04-27 20:07:36 -04:00
Alexei Podtelezhnikov e2bcca40ca * include/freetype/ftdriver.h: s/truncated/clamped/. 2024-04-22 22:43:41 -04:00
Alexei Podtelezhnikov ec46a50dac Improve SDF documentation. 2024-04-22 21:21:12 -04:00
Alexei Podtelezhnikov 982bc83849 [cache] Minor tweaks.
* src/cache/ftcimage.c (ftc_inode_free): Remove unnecessary check.
* src/cache/ftcmanag.c (FTC_Manager_Done): Do not zero before freeing.
2024-04-21 15:53:05 -04:00
Alexei Podtelezhnikov 5a3bfa92d9 * src/cache/ftcbasic.c: Cosmetic harmonization. 2024-04-20 23:28:17 -04:00
Alexei Podtelezhnikov 23e1d64556 [cache] Reduce type mismatches.
* src/cache/ftcbasic.c (FTC_BasicAttrRec): Match type of `load_flags`
to its main purpose in `FT_Load_Glyph`.
(FTC_ImageCache_Lookup{,Scaler},FTC_SBitCache_Lookup{,Scaler}): Updated.
2024-04-20 12:01:58 -04:00
Alexei Podtelezhnikov 9a2d6d97b2 * src/cache/{ftcbasic.c,ftccmap.c}: Use FTC_INLINE. 2024-04-19 14:45:39 -04:00
Alexei Podtelezhnikov dbdcd75889 [cache] Tweak headers.
* src/cache/ftccback.h: Include less and move `ftc_node_destroy`...
* src/cache/ftccache.h: ... to here.
* src/cache/ftcmanag.c: Include less.
2024-04-19 14:02:43 -04:00
Alexei Podtelezhnikov db83e9c0ec * src/cache/ftcglyph.c [!FTC_INLINE]: Fix compilation. 2024-04-18 23:23:13 -04:00
Alexei Podtelezhnikov 12adfc212b [cache] Improve MRU list management.
* src/cache/ftcmru.c (FTC_MruList_Remove): Cosmetic.
(FTC_MruList_New): Accept only valid changes.
* src/cache/ftcmanag.c (ftc_size_node_done):  Simplify.
2024-04-17 15:07:23 +00:00
Alexei Podtelezhnikov d091bca546 [cache] Fix error handling.
Manipulate the cache after a face is requested or a size is looked up
successfully. Fixes #1270.

* src/cache/ftcmanag.c (ftc_size_node_init, ftc_size_node_reset,
ftc_face_node_init): Check for errors before accepting a change.
* src/cache/ftcmru.c (FTC_MruList_New): Do nothing if reset fails.
2024-04-17 00:33:14 -04:00
Alexei Podtelezhnikov b3a6a20a80 [smooth] Switch to vertical bisections.
With horizontal bisections, the smallest section is a whole single
scanline. Almost horizontal lines or other complex scanlines can
easily overflow the rendering pool. Switching to vertical bisections
splits the scanlines and should rule out the overflows.  Fixes #1269.

* src/smooth/ftgrays.c (gray_convert_glyph): Bisect vertically.
2024-04-14 15:37:57 -04:00
Alexei Podtelezhnikov fff58f5424 * src/smooth/ftgrays.c (gray_convert_glyph): Refactor for convenience. 2024-04-14 15:12:31 -04:00
Alexei Podtelezhnikov 674d629b5e [smooth] Store persistent clipping box.
* src/smooth/ftgrays.c (gray_TWorker, gray_raster_render): Add and set
the new structure field.
(gray_convert_glyph): Use it.
2024-04-14 13:06:01 -04:00
Ben Wanger f42ce25563 [colr] Ensure enough bytes for PaintColrLayers
* src/sfnt/ttcolr.c (read_paint): check that there are five additional
bytes to be read when reading PaintColrLayers.

Reported as

  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=66566
2024-03-08 14:55:12 -05:00
Ben Wagner 17545d4bf7 Avoid n^2 scanning for binary data.
When creating a CID parser the location of the 'StartData' or '/sfnts'
tokens needs to be known.  However, the token parser requires that the
entire document be in memory and flattening the entire stream into memory is
to be avoided.

To avoid forcing the entire stream into memory, previously this code would
scan through the stream looking for 'StartData' or '/sfnts' as strings.
However, these strings could have been in a comment or string token, so the
stream would be read into memory up to that point and the parser run to
check that these strings were actually tokens.  This forced a parser restart
from the beginning each time; as a result, data with many 'StartData'
non-tokens would take n^2 time to check.

* src/cid/cidparse.c (cid_parser_new): Change algorithm to make the initial
scan look for the last possible 'StartData' or '/sfnts' string in the
stream.  The stream is read forward instead of backward as a typical normal
CID font will have one 'StartData' toward the beginning of the data and it
it much faster to read the data from beginning to end instead of end to
beginning.  For memory-based fonts the limit is set to the end of the stream
since the stream is already in memory.  Then the parser is run once to look
for 'StartData' or '/sfnts' tokens.  If they are found the parser is re-set
to reflect this new information.

Reported as

  https://issues.chromium.org/issues/40201695
2024-03-08 17:47:43 +01:00
Alexei Podtelezhnikov 660a7017fa * CMakeLists.txt: Bump required version to 3.5.
Fixes #1267.
2024-03-06 20:08:04 +00:00
Jordan Williams 2cc589043e
meson: Use the standard dependency mechanism to find bzip2
This follows standard conventions in Meson by using the pkg-config file.
This change allows Conan to switch to the Meson build system.
2024-03-04 12:46:19 -06:00
Ben Wanger 2a790a9f49 [cff, truetype] Always set up default variable instance.
For default variable instances `cff_face_init` did not set the blend.  This
mostly worked as later use of the unset blend produced the default
variation.  However, if a user called `TT_Get_MM_Var` the blend would be
partially set up, but not fully.  In particular the number of axes, the axis
definitions, and the instance locations would be set up, but not the current
instance location (`coords` and `normalizedcoords`).  This could lead to the
default instances of CFF2 fonts erroring on any use of `blend`.

Ensure the default variable instance is fully set up by always calling
`FT_Set_Named_Instance` on a variable face.

* src/cff/cffobjs.c (cff_face_init): Call `FT_Set_Named_Instance` on
default instances.
* src/truetype/ttobjs.c (tt_face_init): Ditto.

Fixes #1268.
2024-02-29 07:06:46 +01:00
Werner Lemberg 546237e1bb * src/truetype/ttgxvar.c (ft_var_to_normalized): Integer overflow.
Reported as

  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=66543
2024-02-23 11:55:53 +01:00
Alexei Podtelezhnikov 47574f7ea4 Update all copyright notices. 2024-01-27 11:11:22 -05:00
Alexei Podtelezhnikov 4f0256c13f * src/sfnt/ttgpos.c (tt_gpos_get_glyph_class): Fix warning C4018. 2024-01-27 10:47:10 -05:00
David Saltzman 8f286c86ef Add support for kerning from 'GPOS' tables.
This commit adds support for kerning from 'GPOS' tables, while maintaining
support for basic 'kern' tables.  `FT_HAS_KERNING` will be true for a font
with either available and `FT_Get_Kerning` will still use the basic 'kern'
table data if avilable, otherwise check the GPOS 'kern' feature.

This feature is disabled by default; it can be enabled with the
`TT_CONFIG_OPTION_GPOS_KERNING` flag.

Only basic kerning (pair positioning with just an x advance) is supported
from the GPOS layout features; support for that was added to make the
existing `FT_Get_Kerning` API more consistently functional.  FreeType does
not intend to extend itself to further GPOS functionality though; a
higher-level library like HarfBuzz can be used instead for that.

* include/freetype/config/ftoption.h, include/devel/ftoption.h
(TT_CONFIG_OPTION_GPOS_KERNING): New configuration option.

* include/freetype/internal/fttrace.h: Add `ttgpos` trace handler.

* include/freetype/internal/sfnt.h (SFNT_Interface): Add `load_gpos` and
`get_gpos_kerning` fields.
(FT_DEFINE_SFNT_INTERFACE): Updated.

* include/freetype/internal/tttypes.h: Include `fttypes.h`.
(TT_FaceRec) [TT_CONFIG_OPTION_GPOS_KERNING]: Add `gpos_table` and
`gpos_kerning_available` fields.

* src/sfnt/ttgpos.c, src/sfnt/ttgpos.h: New files.

* src/sfnt/sfdriver.c [TT_CONFIG_OPTION_GPOS_KERNING]: Include `ttgpos.h`.
(sfnt_interface): Updated.

* src/sfnt/sfnt.c: Include `ttgpos.c`.

* src/sfnt/sfobjs.c [TT_CONFIG_OPTION_GPOS_KERNING]: Include `ttgpos.h`.
(sfnt_load_face) [TT_CONFIG_OPTION_GPOS_KERNING]: Load and free GPOS kerning
data; check GPOS kerning availability.

* src/truetype/ttdriver.c (tt_get_kerning): Use GPOS kerning if there's no
'kern' table.
2024-01-27 10:55:04 +01:00
Alexei Podtelezhnikov 5761778246 [smooth] Remove SSE2.
As a result of 7b308a29dd, the regular 64-bit execution is now faster
than SSE2. The rendering speed of script fonts at 64 ppem or larger is
improved by about 3% without SSE2. See !314 for the testing results.   

* src/smooth/ftgrays.c (gray_render_conic)[FT_INT64]: Remove SSE2 code.
2024-01-14 13:03:51 +00:00
Alexei Podtelezhnikov 6d9147263b * CMakeLists.txt: Accommodate MingGW.
See https://github.com/StephanTLavavej/mingw-distro/issues/97.
2024-01-13 22:28:54 -05:00
Ozkan Sezer 7bac4d146a * src/sfnt/ttcolr.c (find_base_glyph_v1_record): Fix build in C90 mode. 2024-01-08 20:27:03 +01:00
Alexei Podtelezhnikov cc081d7cce [base] Fix up Mac resource forks and dfonts.
* src/base/ftobjs.c (IsMacResource): Assign `face_index`.
* src/base/ftmac.c (FT_New_Face_From_Suitcase): Ditto after rework.
2024-01-06 19:22:36 -05:00
Alexei Podtelezhnikov 4a85ff0b79 [sfnt] Restrict POST version 1.0.
A font has surfaced with `post` version 1.0 and fewer than 258 glyphs.
Its glyphs did not correspond to their names. We now reject such `post`
strictly following specifications.

* src/sfnt/ttpost.c (tt_face_get_ps_name): Check the number of glyphs
for version 1.0.
2024-01-04 21:38:51 -05:00
Alexei Podtelezhnikov a07ca46cd0 * .gitlab-ci.yml: Use detached CI pipelines.
See issue freedesktop/freedesktop#540.
2024-01-03 14:55:33 +00:00
Werner Lemberg 57c4252ab5 [sfnt] Guard access in 'COLR' v1 glyph binary search.
Reported as

  https://bugs.chromium.org/p/chromium/issues/detail?id=1505216

* src/sfnt/ttcolr.c (find_base_glyph_v1_record): Guard access of the search
pointer during binary search.  The pointer needs to be checked as we go as
the test that compares number of v1 glyphs with table size at the time of
loading the table is not sufficient on its own.

A scenario is possible in which the `BaseGlyphRecord` list extends into
non-`BaseGlyphRecord` parts of the 'COLR' v1 table (but passed the size
comparison check).  Then, at those locations, invalid glyph ID values are
read and may provoke an invalid read due to reassigning min and max values
during the binary search.
2024-01-02 17:55:33 +01:00
Alexei Podtelezhnikov ca76683b78 [ci] Add support for MSBuild on Windows.
This adds msbuild job for VS2019 (x64).

* .gitlab-ci.yml: Added "windows msbuild vs2019 amd64".
2023-12-18 17:45:05 +00:00
Skef Iterum 8eab511017 [CFF] Extract `BlueValues` as `Fixed` rather than `Int`.
This is a follow-up to commit 26a7f047,

  [cff] Make blend operator work with floats in private dicts.

which addressed the 'party baseline' bug.  However, the reporting user
indicated that the default location and some other points in design space
rendered OK, but other points in design space still had problems.  The most
obvious issue being that the x-heights of lower-case letters did not align;
see

  https://github.com/adobe-fonts/source-serif/issues/121#issuecomment-1773794136

After some analysis we determined that this was due to an interaction
between `BlueValue` rounding and the zone-based algorithm.  In short, for a
point to be considered in a zone it must fall within the bounds of the zone.
(There is a slop factor in some cases, but only a very small one.)  In the
Adobe-contributed side of the code, point values are not integer-rounded,
instead they're kept as (some form of) fixed.  Rounding just the `BlueValues`
means that points that need to be considered within a zone will fall outside
of it at some points in design space.

The majority of this patch changes the storage and parsing of `BlueValues`
to keep them as `FT_Fixed`.  No significant code changes were needed because
the values are converted to `Fixed` anyway when stored in `CF_BlueRec`.  No
attempt was made to address problems in the older pshinter code beyond
converting the values from `FT_Fixed` to `FT_Short` when copying the private
dictionary.  (However, as the point values are also rounded in that code,
the problem is much less likely to occur, although inconsistency between
rounding and truncation could cause an analogous problem.)

* include/freetype/internal/cfftypes.h (CFF_PrivateRec): Use `FT_Fixed` for
`blue_values`, `other_blues`, `family_blues`, and `family_other_blues`.

* src/cff/cffload.c (cff_blend_doBlend): Updated.

* src/cff/cffobjs.c (CFF_fixedToInt): New macro.
(cff_make_private_dict): Use it.

* src/cff/cffparse.h (cff_kind_delta_fixed): New enum value.

* src/cff/cffparse.c (do_fixed): Updated.
(CFF_FIELD_DELTA, CFF_FIELD_DELTA_FIXED, CFF_DELTA_KIND): New set of macros,
replacing `CFF_FIELD_DELTA`.
(cff_parser_run): Updated to handle fixed-float deltas.

* src/cff/cfftoken.h: Updated to use `CFF_FIELD_DELTA_FIXED` for blue
values.

* src/psaux/psblues.c (cf2_blueToFixed): Removed, no longer needed.
(cf2_blues_init): Updated.

* src/pxaux/psft.c, src/pxaux/psft.h (cf2_getBlueValues, cf2_getOtherBlues,
cf2_getFamilyBlues, cf2_getFamilyOtherBlues): Updated signatures.

* src/psaux/psobjs.c (t1_make_subfont): Updated.
2023-12-14 07:17:01 +01:00
Skef Iterum 6f2bf6a582 [psaux] Improve tracing.
* src/psaux/psintrp.c (cf2_doBlend, cf2_interpT2CharString [cf2_cmdBLEND]):
Show blended values.
2023-12-14 06:55:33 +01:00
Jouk Jansen af6d210537 * vms_make.com: Switch to `clang`.
Also add proper bzip2 support.
2023-12-14 06:21:52 +01:00
Werner Lemberg 9bf72966ed * src/truetype/ttgxvar.c (ft_var_to_normalized): Fix undefined left-shift.
Reported as

  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=63723
2023-12-14 06:14:43 +01:00
Alexei Podtelezhnikov 50740b37ba [msbuild] Streamline the process.
MSBuild.exe can now be fired from the root folder without options.

* builds/windows/vc2010/freetype.sln: Relocated to...
* MSBuild.sln: ... here with minor changes.
* MSBuild.rsp: New file with command line options.
* docs/INSTALL: Reference `MSBuild.sln`.
2023-12-06 23:33:32 -05:00
Alexei Podtelezhnikov 01f23c39e0 * src/raster/ftraster.c (Draw_Sweep): Swap stub conditions. 2023-12-01 23:13:28 -05:00
Alexei Podtelezhnikov 5999d47d68 * src/raster/ftmisc.h (FT_MulDiv): Remove unused copy. 2023-12-01 20:50:16 -05:00
Alexei Podtelezhnikov 8f255c89e1 [raster] Speed up Bézier arches with extrema.
While it is recommended to have an explicit point at each curve
extrema, they might be missing or outline could be rotated. This
leads to excessive bisections in raster to find them.  This change
helps to decrease the number of bisections.  The scanline
intersections remain monotonous, of course.

* src/raster/ftraster.c (Conic_To, Cubic_To): Check that control
points cross the scanlines to bisect.
2023-11-27 22:44:36 -05:00
Alexei Podtelezhnikov 1eb04c71eb * docs/*: Typos. 2023-11-25 09:00:11 -05:00
Alexei Podtelezhnikov efbae5476f [raster] Eliminate intensive flow checking.
* src/raster/ftraster.c (Draw_Sweep): Pass the flow increment.
(Increment): Accept the flow increment.
2023-11-24 10:23:36 -05:00
Alexei Podtelezhnikov 63d3a37eb7 * src/raster/ftraster.c: Comments, defines, includes, cleanups. 2023-11-23 17:50:04 -05:00
Alexei Podtelezhnikov df39b017d9 * src/raster/ftraster.c (FT_Outline_Get_CBox ) [STANDALONE_]: Removed. 2023-11-21 18:12:45 +00:00
Alexei Podtelezhnikov c62027d910 * src/raster/ftraster.c (Draw_Sweep): No-fault return.
(Render_Single_Pass): Updated.
2023-11-21 16:54:25 +00:00
Alexei Podtelezhnikov d77dd24b41 [raster] Sweep polishing.
* src/raster/ftraster.c (*_Sweep_Span): Polish.
(*_Sweep_Drop): Restore tracing, polish.
(Draw_Sweep): Simplify the dropout processing loop.
2023-11-21 15:16:56 +00:00
Alexei Podtelezhnikov da8e428977 [raster] Rearrange dropout control.
This reduces the code duplication.

* src/raster/ftraster.c (Function_Sweep_Span): Change signature.
(Vertical_Sweep_Drop, Horizontal_Sweep_Drop): Focus on pixel setting
and move duplicated the dropout control logic to...
(Draw_Sweep): ... this function and refactor.
(Vertical_Sweep_Span, Horizontal_Sweep_Span): Minor.
2023-11-21 00:53:50 -05:00
Alexei Podtelezhnikov d7c72ff919 [raster] Use bitwise dropout mode interpretation.
* src/raster/ftraster.c (Vertical_Sweep_Drop, Horizontal_Sweep_Drop,
Draw_Sweep, Render_GLyph): Interpret dropout mode using bit masks.
2023-11-20 22:46:36 -05:00
Alexei Podtelezhnikov e969289f88 * docs/CHANGES: Updated. 2023-11-16 20:02:08 +00:00
Alexei Podtelezhnikov 050a320764 [raster] Keep only bottom y-turns.
This results in noticeable performance improvement.

* src/raster/ftraster.c (Insert_Y_Turns): All bottom y-turns are still
sorted and stored; only the maximum top y-turn is recorded now. The
function is renamed.
(End_Profile): Updated accordingly.
(Convert_Glyph): Reserve space for the top value.
2023-11-15 23:41:56 -05:00
Alexei Podtelezhnikov fa59e0d64c * src/raster/ftraster.c (End_Profile): Reduce branching.
(InsNew): Tweak condition.
2023-11-15 16:55:57 +00:00
Alexei Podtelezhnikov c580926f35 * src/raster/ftraster.c (Draw_Sweep): Use more natural loop. 2023-11-15 15:17:50 +00:00
Alexei Podtelezhnikov b0265ccd33 [raster] Dissolve a loop.
* src/raster/ftraster.c (End_Profile): Set initial `X` here...
(Draw_Sweep): ... instead of here; delay the `start` decrement.
2023-11-14 23:32:06 -05:00
Alexei Podtelezhnikov 6dc2ecb757 * src/raster/ftraster.c: Comments. 2023-11-14 23:06:41 -05:00
Alexei Podtelezhnikov aec7e717fb [raster] Stylistic changes.
* src/raster/ftraster.c (Line_To): Code it similar to curves;
shortcut the flat lines here...
(Line_Up): ... instead of here.
2023-11-14 16:47:34 +00:00
Alexei Podtelezhnikov d1b3ef7704 [raster] Revise overshoot setting.
* src/raster/ftraster.c (New_Profile, End_Profile): Deal with overshoots
locally.
(Line_To, Conic_To, Cubic_To): Update callers.
2023-11-14 15:54:52 +00:00
Alexei Podtelezhnikov 667aad581a * src/raster/ftraster.c (Conic_To, Cubic_To): Fix recent regression. 2023-11-14 15:10:52 +00:00
Alexei Podtelezhnikov 0f98994ef6 * include/freetype/ftimage.h: Fix type and link. 2023-11-13 23:15:00 -05:00
Alexei Podtelezhnikov 6e7ef1687f * src/raster/ftraster.c (Increment): Minor tweak. 2023-11-13 22:07:42 -05:00
Alexei Podtelezhnikov e9359e29be [raster] Get rid of the fresh flag.
* src/raster/ftraster.c (black_TWorker): Remove the fresh flag.
(New_Profile): Set the starting scanline here based on the current
coordinate and initialize the joint crossing if necessary.
(Line_Up, Bezier_Up): Do not deal with fresh and joint starts at all.
(Line_Down, Bezier_Down): Simplify.
(Conic_To, Cubic_To): Update the current coordinate after each
subsection.
2023-11-12 23:01:49 -05:00
Alexei Podtelezhnikov d5e8686dd8 [raster] Get rid of the joint flag.
* src/raster/ftraster.c (Line_Up, Bezier_Up): Deal with the scanline
joints directly based on the initial y-coordinate.
(New_Profile, black_TWorker): Remove the boolean flag.
2023-11-11 21:10:29 -05:00
Alexei Podtelezhnikov 9cd403bc9f * src/raster/ftraster.c (Line_Up, Bezier_Up): Check "between" earlier. 2023-11-11 10:18:53 -05:00
Alexei Podtelezhnikov 028b0d5c1b * src/raster/ftraster.c (Line_Up): Updated and fixed up.
This largely synchronizes the entries into `Line_Up` and `Bezier_Up`.
Minor bugs in the remainder calculations and accumulations are fixed.
2023-11-10 23:25:26 -05:00
Alexei Podtelezhnikov d5973932d0 * src/raster/ftraster.c (End_Profile, Convert_Glyph): Clean up. 2023-11-09 22:52:14 -05:00
Alexei Podtelezhnikov e9a81e4dd8 * src/raster/ftraster.c (Bezier_Up): Improve joint and loop. 2023-11-09 22:31:36 -05:00
Alexei Podtelezhnikov 6338f2a681 [raster] Harmonize target bitmap navigation.
* src/raster/ftraster.c (black_TWorker): Store signed maximum indexes
in both directions instead of unsigned dimensions of the original bitmap.
(*_Sweep_*, Render_Glyph, ft_black_render): Updated all users.
2023-11-06 18:56:38 -05:00
Alexei Podtelezhnikov e920273774 * src/raster/ftraster.c (Bezier_Up): Improve flow. 2023-11-05 23:12:56 -05:00
Alexei Podtelezhnikov 8a2ca26b41 [raster] Reshuffle code for readability.
* src/raster/ftraster.c (Render_Glyph): Setup the rendering pool here.
(ft_black_render): Setup the target bitmap helpers here.
2023-11-05 22:34:16 -05:00
Alexei Podtelezhnikov 9e86fb806d [raster] Improve profile accounting during sweeping.
* src/raster/ftraster.c (TProfile): Get rid of `countL`.
(Draw_Sweep): Use `start` for countdown to activation.
(Horizontal_Sweep_Drop, Vertical_Sweep_Drop): Rely on `height` and
`offset` to verify profile ends for the stub detection.
2023-11-03 23:59:05 -04:00
Alexei Podtelezhnikov 32081d8123 [raster] Consolidate profile increment to the next line.
* src/raster/ftraster.c (s/Sort/Increment): Rename this function to
reflect its true purpose, delete exhausted profiles here...
(Draw_Sweep): ... instead of here.
2023-11-03 23:10:41 -04:00
Alexei Podtelezhnikov 046c4fc7be [raster] Instantly remove profiles from linked lists.
* src/raster/ftraster.c (DelOld): Remove loopy function.
(Draw_Sweep): Implement instant profile removal.
2023-11-03 22:34:37 -04:00
Alexei Podtelezhnikov (Алексей Подтележников) 6d6607b8b3 [raster] Modify the split condition.
While curving close to a pixel center, vertical and horizontal pass
might split the curve differently and cause a rare dropout.  This
makes the split condition invariant of the sweep direction and more
robust.

* src/raster/ftraster.c (Bezier_Up): Modify the split condition.
2023-11-03 03:09:54 +00:00
Alexei Podtelezhnikov (Алексей Подтележников) f2e76e8356 [raster] Remove the jitter exception.
The jitter exception used to be applied when two neighboring pixels
were barely inside the outline. One the left one was turned on then,
which contradicts the OpenType specifications.  Intended to remove
glitches, it caused disappearing lines and was softened by adding an
exception to the exception (#54589).

* src/raster/ftraster.c (Vertical_Sweep_Span): Drop the jitter exception.
2023-11-03 03:09:54 +00:00
Alexei Podtelezhnikov dc519d06ea [raster] Simplify dropout detection.
* src/raster/ftrater.c (Draw_Sweep): Use a single dropout condition.
2023-10-31 15:01:32 +00:00
Alexei Podtelezhnikov 4e2d1f040c [raster] Simplify sweeping entry and exit.
* src/raster/ftraster.c (Draw_Sweep): Use y-turns to set the range,
correctly set the initial position, directly loop through y_turns,
and remove a 5-gray remnant at exit.
2023-10-30 22:46:32 -04:00
Alexei Podtelezhnikov 55d0287cfc [raster] Switch to routine Int instead of Short.
This is mostly cosmetic and removes a few casts, plus Short is
promoted to Int in calculations anyway.

* src/raster/ftraster.c (Vertical_Sweep_Init, Vertical_Sweep_Span,
Vertical_Sweep_Drop, Horizontal_Sweep_Init, Horizontal_Sweep_Span,
Horizontal_Sweep_Drop, Draw_Sweep): Mostly s/Short/Int/ and remove
casting.
2023-10-25 23:23:30 -04:00
Alexei Podtelezhnikov 8c5ec8dd63 [raster] Increase the raster pool density.
This only helps to delay the pool overflow and bisections to larger
sizes and benefits only very intricate glyphs at reasonable sizes.

* src/raster/ftraster.c (TProfile): Use Int instead of Long or PLong
when it is sufficient.
(New_Profile, End_Profuile, Bezier_Up, Sort): Updated accordingly.
2023-10-23 22:48:34 -04:00
Alexei Podtelezhnikov a0e10a87f5 [raster] Slightly improve the pool design.
* src/raster/ftraster.c (TProfile): Include the variable array member
and repackage with pointers first.
(New_Profile): Advance the top using the variable array pointer.
2023-10-23 17:47:10 -04:00
Alexei Podtelezhnikov d1e894b1f1 [raster] Clean up sweeping.
* src/raster/ftraster.c (Draw_Sweep): Zero initialize the working
lists directly and remove unnecessary y-turn checks.
(Init_Linked): Removed.
2023-10-22 13:08:36 -04:00
Alexei Podtelezhnikov 09ae6eb677 * src/raster/ftraster.c (Insert_Y_Turn): Improve flow. 2023-10-22 08:13:35 -04:00
Alexei Podtelezhnikov fab53f7b1f * src/pcf/pcfutil.c (BSWAP16): Limit clang support.
These ancient builtins have been supported by clang since 2013. We
condition it somewhat stricter but still around 2017.  This is more
portable than `__has_builtin`. Fixes #1260.
2023-10-21 19:08:20 -04:00
Alexei Podtelezhnikov 4e61303a3b [raster] Small optimizations.
* src/raster/ftraster.c (New_Profile): Set important fields only and
delay setting `gProfile` until...
(End_Profile): ... it is checked to be valid here.
(Convert_Glyph): Updated.
2023-10-18 23:13:13 -04:00
Alexei Podtelezhnikov a35da2c093 * src/raster/ftraster.c (Convert_Glyph): Remove redundant check. 2023-10-18 18:44:00 +00:00
Alexei Podtelezhnikov 3fa5c84565 [raster] Fix linked profiles in contour loops.
This fixes a subtle bug when the last profile in a contour was not
properly short-circuited if it was still empty at `End_Profile`.
We finalize all linking in `Finalize_Profile_List` now and do nothing
else there.  The turns are added in `End_Profile`.

* src/raster/ftraster.c (Insert_Y_Turn): Moved up unchanged.
(End_Profile): Take care of turns but set only preliminary linking.
(Finalize_Profile_Table): Take care of linking and null-termination.
(Convert_Glyph): Adjusted accordingly.
2023-10-17 23:56:23 -04:00
Alexei Podtelezhnikov 749b8f9d34 * src/raster/ftraster.c: Improve tracing. 2023-10-14 22:28:06 -04:00
Alexei Podtelezhnikov 153c038e3c [raster] Improve profile accounting.
* src/raster/ftraster.c (End_Profile): Do not initiate next profile.
(New_Profile): Fully initiate new profile.
(Convert_Glyph): Clean up variables, initialize `fProfile` here.
2023-10-13 15:22:32 +00:00
Alexei Podtelezhnikov f09c5e58c2 * src/raster/ftraster.c (Convert_Glyph): Fix null-dereference. 2023-10-13 13:44:39 +00:00
Alexei Podtelezhnikov c7fa00bf4e [raster] Fix pool overflow checking.
* src/raster/ftraster.c (New_Profile, End_Profile): Check for overflow
immediately.
(Convert_Glyph, Render_Single_Pass): Fix boundaries.
2023-10-13 00:16:02 -04:00
Alexei Podtelezhnikov 14bcb2867a [raster] Miscellaneous clean-ups.
* src/raster/ftraster.c (New_Profile): Use NULL.
(End_Profile): Optimize variables.
(Convert_Glyph): Do not initialize `cProfile` yet.
(Render_Single_Pass): Tracing.
2023-10-12 22:44:46 -04:00
Alexei Podtelezhnikov 322e580bd0 * src/smooth/ftgrays.c: Move the sweep functions...
... out of the setjmp/longjmp scope for readability.
2023-10-09 22:22:24 -04:00
Alexei Podtelezhnikov 84cd2e9897 * src/raster/ftraster.c: Tracing updates. 2023-10-09 22:11:41 -04:00
Zachary Zollman 21435f07de fix typo in FT_Outline_Decompose note 2023-10-08 23:34:28 +00:00
Alexei Podtelezhnikov 7b308a29dd * src/smooth/ftgrays.c (gray_render_conic) [SSE2]: Improve flow. 2023-09-28 22:56:15 -04:00
Alexei Podtelezhnikov e0e5b838e5 * src/gxvalid/gxvcommn.h (GXV_USHORT_TO_SHORT): Removed. 2023-09-25 22:26:15 -04:00
Alexei Podtelezhnikov 49781ab72b Comment typos. 2023-09-24 20:09:17 -04:00
Alexei Podtelezhnikov 73490681a7 * src/base/ftcalc.c (FT_MOVE_SIGN): Enclose assignments. 2023-09-24 19:39:10 -04:00
Alexei Podtelezhnikov cc732ec6d1 * include/freetype/internal/ftcalc.h (FT_MSB): Define for Solaris 11. 2023-09-21 02:28:32 +00:00
Alexei Podtelezhnikov c4073d8251 [psaux] Use `FT_SqrtFixed`.
* src/psaux/cffdecode.c <cff_op_sqrt>: Call `FT_SqrtFixed`.
* src/psaux/psintrp.c <cf2_escSQRT>: Ditto.
2023-09-19 22:29:14 -04:00
Alexei Podtelezhnikov 95b0fe2a6d [base] Reintroduce `FT_SqrtFixed`.
The general square root calculations are not necessary in FreeType.
For vector normalization or length, FreeType uses special functions.
It is, however, required in the legacy CFF specifications.

* src/base/ftcalc.c (FT_SqrtFixed): New function that uses either
Babylonian or bit-wise algorithm, whichever is faster for the given
situation.
* include/freetype/internal/ftcalc.h (FT_SqrtFixed): Declare it.
2023-09-19 22:26:32 -04:00
Alexei Podtelezhnikov babe6af167 * src/base/ftcalc.c /* FT_SqrtFixed */: Fix defunct overflow. 2023-09-18 15:01:26 +00:00
Alexei Podtelezhnikov d7b63a966b * src/tools/apinames.c (read_header_file): Typos. 2023-09-14 13:00:07 +00:00
Alexei Podtelezhnikov 6eb5f2be40 Update 2 files
- /src/base/ftcalc.c
- /include/freetype/internal/ftcalc.h
2023-09-13 17:02:31 +00:00
Ben Wagner 16f311d725 [base] Fix typo to correct predicate for call
* src/base/ftobj.c (FT_Get_Color_Glyph_Paint): check
`get_colr_glyph_paint` before calling `get_colr_glyph_paint` and not
`get_colr_layer`
2023-09-12 18:35:01 -04:00
Alexei Podtelezhnikov 7d45cf2c8f * src/psaux/cffdecode.c (cff_op_sqrt): Correct upper limit. 2023-09-11 20:45:16 -04:00
Alexei Podtelezhnikov 18eb93556c * src/psaux/cffdecode.c (cff_op_sqrt): Improve initial guess. 2023-09-11 17:00:49 -04:00
Alexei Podtelezhnikov 30b0ce7303 src/psaux/psintrp.c (cf2_escSQRT): Improve initial guess.
The worst number of iterations decreased from 11 to 5.
2023-09-11 16:34:36 +00:00
Alexei Podtelezhnikov 17db21f3fc * src/type1/t1afm.c (t1_get_index): Restore `strlen` call.
This reverts commit 8ed6d97446
and fixes
   https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=62246
2023-09-10 22:34:17 -04:00
Alexei Podtelezhnikov 446720a29e * src/cff/cffparse.c (CFF_Field_Handler): Some s/0/NULL/. 2023-09-09 23:01:13 -04:00
Alexei Podtelezhnikov 8d0897b37d [type1, cid, type42] Post-cleanup.
* include/freetype/internal/psaux.h (T1_FIELD_ZERO): Terminating macro.
* src/cid/cidload.c (cid_parse_dict): Use while-loop.
* src/type1/t1load.c (parse_dict): Ditto.
* src/type42/t42parse.c (t42_parse_dict): Ditto.
2023-09-09 22:20:00 -04:00
Alexei Podtelezhnikov 3302e2f60c Update forgotten array termini.
* src/cid/cidload.c (cid_field_records): Account for added `len`.
* src/type1/t1load.c (t1_keywords): Ditto.
* src/type42/t42parse.c (t42_keywords): Ditto.
2023-09-09 17:24:34 -04:00
Alexei Podtelezhnikov 7ad9d57c3b [type1, cid, type42] Streamline dictionary parsing.
When matching the keywords, we avoid calculating their lengths by
checking the stored values. This itself is a sufficient pre-check
before diving into `memcmp`. Therefore, we remove explicit check of
the first characters.

* include/freetype/internal/psaux.h (T1_FieldRec): Store length.
* src/cid/cidload.c (cid_parse_dict): Use `memcmp` and stored length.
* src/type1/t1load.c (parse_dict): Ditto.
* src/type42/t42parse.c (t42_parse_dict): Ditto.
2023-09-09 15:19:06 -04:00
Alexei Podtelezhnikov 8ed6d97446 * src/type1/t1afm.c (t1_get_index): Avoid `strlen` call.
Instead, we check the terminal zero.
2023-09-09 15:13:55 -04:00
Alexei Podtelezhnikov 68f1b93247 * src/type1/t1driver.c (t1_ps_get_font_value): Avoid redundant null. 2023-09-08 16:23:05 +00:00
Alexei Podtelezhnikov 9c51e21e53 [cff, truetype] Improve prefix and suffix removal.
* src/cff/cffobjs.c (remove_style): Rewrite using pointers.
(remove_subset_prefix): Unwrap loop and use `memmove`.
* src/truetype/ttobjs.c (tt_skip_pdffont_random_tag): Unwrap loop
and avoid `strlen`.
2023-09-07 23:50:35 -04:00
Alexei Podtelezhnikov 4904d1eb1b * src/sfnt/ttpost.c (load_format_20): Micro-optimize. 2023-09-06 22:58:46 -04:00
Werner Lemberg 45903920b9 [autofit] Fix synchronization mistake between FreeType and ttfautohint.
Found by Behdad.

* src/autofit/aflatin.c (af_latin_metrics_init_blues): Fix array size of
`blue_sorted`: FreeType doesn't have artificial blue zones.
2023-09-05 08:09:31 +02:00
Werner Lemberg ad20173942 [autofit] Fix typos.
This also reduces the used heap size by a large factor.

From Behdad.

* src/autofit/afcjk.h (AF_CJKAxisRec): Use `AF_BLUE_STRINGSET_MAX_LEN`.
* src/autofit/aflatin.h (AF_LatinAxisRec): Ditto.
2023-09-04 19:26:31 +02:00
Alexei Podtelezhnikov 000b26a30f * src/sfnt/ttpost.c (load_format_20): Rework tracing. 2023-08-30 23:03:02 -04:00
Alexei Podtelezhnikov dd1ced4ee3 [builds] Abbreviate the DLG submodule update.
* autogen.sh, builds/toplevel.mk: Revise the command options.
2023-08-30 02:28:48 +00:00
Alexei Podtelezhnikov 2f7abe4838 Comment added. 2023-08-29 19:18:43 +00:00
Alexei Podtelezhnikov c46c4b8e79 * src/sfnt/ttpost.c (load_format_20): Permit long names.
Fixes #1254.
2023-08-29 17:52:06 +00:00
Werner Lemberg 2d9fce53d4 [gzip] Update sources to zlib 1.13. 2023-08-27 09:47:24 +02:00
Werner Lemberg 4a0c5639f7 docs/release: Minor fixes. 2023-08-25 21:36:39 +02:00
Anurag Thakur a4f3e858ae docs/freetype-web.txt: New file. 2023-08-25 21:36:12 +02:00
Werner Lemberg 920c5502cc * Version 2.13.2 released.
==========================

Tag sources with `VER-2-13-2'.

* docs/VERSION.TXT: Add entry for version 2.13.2.
* docs/CHANGES: Updated.
* docs/release, docs/README, builds/macs/README: Updated.

* README, src/base/ftver.rc, builds/windows/vc2010/index.html,
builds/windows/visualc/index.html, builds/windows/visualce/index.html,
builds/wince/vc2005-ce/index.html, builds/wince/vc2008-ce/index.html,
docs/freetype-config.1: s/2.13.1/2.13.2/, s/2131/2132/.

* include/freetype/freetype.h (FREETYPE_PATCH): Set to 2.

* builds/unix/configure.raw (version_info): Set to 26:1:20.
* CMakeLists.txt (VERSION_PATCH): Set to 2.
2023-08-25 20:12:52 +02:00
Alexei Podtelezhnikov 0c817334b7 * src/base/ftcalc.c (FT_MulAddFix): Simplify 32-bit rounding. 2023-08-25 17:57:47 +00:00
Werner Lemberg d42679b93d Fix clang warnings.
* src/cffload.c (cff_blend_doBlend): Fix type of `sum`.
* src/truetype/ttgxvar.c (tt_var_load_item_variation_store): Fix type of
  `word_delta_count`.
2023-08-25 18:05:01 +02:00
Werner Lemberg aa5f001874 * subprojects/*.wrap: Updated. 2023-08-24 20:47:00 +02:00
Hugh McMaster e3ada2f70d builds/unix/configure.raw: Use variable to specify minimum Python version. 2023-08-24 20:47:00 +02:00
Alexei Podtelezhnikov 00b07598d9 * builds/toplevel.mk: Simplify version extraction. 2023-08-24 08:13:18 -04:00
Alexei Podtelezhnikov 97251fd5aa [base] Improve the matrix degeneracy check.
Also fixes #1251.

* src/base/ftcalc.c (FT_Matrix_Check): To avoid overflow, scale by shifting.
* include/freetype/internal/ftcalc.h (FT_Matrix_Check): Update description.
2023-08-22 11:01:16 +00:00
Werner Lemberg a3f44aadbc builds/toplevel.mk: Don't use `\#` in functions.
The behaviour changed in GNU make 4.3, where `#` (without the backslash)
would be necessary.  Using a variable instead the code works with both older
and newer GNU make versions.

Fixes #1252.
2023-08-22 12:27:10 +02:00
Hugh McMaster e907eef6b2 builds/freetype.mk: Invoke `mkdocs` as a Python module
FreeType's `refdoc` target currently allows users to override the
default Python path, which is useful for testing and development.

In contrast, `mkdocs` is invoked via the default Python path.

Invoking `mkdocs` via Python's module syntax allows for greater
flexibility, although there is no change for the default use case.
2023-08-19 22:02:14 +10:00
Ben Wagner a9793feace [base] Avoid UB with memcpy
`FT_NEW_ARRAY(p, 0)` sets `p` to `NULL`. `FT_Stream_ReadAt` with a
memory based stream uses `FT_MEM_COPY` which is `memcpy` which specifies
that it is undefined behavior for either the `src` or `dst` to be
`NULL`. Instead of forcing all callers work around calling
`FT_Stream_Read` when `buffer == NULL && count == 0` do the check in
`FT_StreamRead`. This allows any call with `count == 0` to succesfully
read zero bytes without UB.

* src/base/ftstream.c (FT_Stream_ReadAt): skip `FT_MEM_COPY` when
`count == 0`. (FT_Stream_TryRead): ditto

Fixes: #1250
2023-08-17 13:25:31 -04:00
Werner Lemberg a20de84e16 Fix warnings in tracing messages for 32bit compilation.
Since we now require C99, use `%td` for `ptrdiff_t` and `%zu` for `size_t`.
2023-08-12 11:47:41 +02:00
Ben Wagner 3829fdaae5 Avoid overflow in COLR bounds checks.
The values read into `base_glyphs_offset_v1` and `layer_offset_v1` may
be in the range 0xFFFFFFFD-0xFFFFFFFF. On systems where `unsigned long`
is 32 bits adding 4 to such values will wrap and pass bounds checks but
accessing values at such offsets will be out of bounds.

On the other hand `table_size` has already been tested to be at least
`COLRV1_HEADER_SIZE` (34) so it is safe to subtract 4 from it.

* src/sfnt/ttcolr.c (tt_face_load_colr): subtract 4 from `table_size`
instead of adding 4 to font data offsets in bounds checks

Fixes: https://crbug.com/1469348
2023-08-04 11:41:23 -04:00
Alexei Podtelezhnikov 95a872085e * src/base/ftobjs.c (open_face_from_buffer): Silence `maybe-uninitialized`.
We never call this function without a `driver_name` (#1245).
2023-08-01 22:48:31 -04:00
Alexei Podtelezhnikov b2584c738f [truetype] Reduce v40 footprint.
*  src/truetype/ttgload.c (TT_HInt_Glyph, tt_loader_set_pp,
tt_loader_init): Refactor code.
2023-07-28 22:35:58 -04:00
Alexei Podtelezhnikov 1ecfd21990 [truetype] Remove Infinality for good (remaining bits).
* src/truetype/ttobjs.h: Remove remaining fields.
* src/truetype/ttinterp.c: Do not initialize them.
* include/freetype/internal/tttypes.h: Remove descriptions.
2023-07-27 16:12:28 +00:00
Alexei Podtelezhnikov 5b7e45ac34 [truetype] Remove Infinality for good.
Remove everything `#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY`,
which was undefined for a while now.

* include/freetype/internal/tttypes.h: Ditto.
* src/truetype/truetype.c: Ditto.
* src/truetype/ttdriver.c: Ditto.
* src/truetype/ttgload.c: Ditto.
* src/truetype/ttinterp.c: Ditto.
* src/truetype/ttinterp.h: Ditto.
* src/truetype/ttobjs.c: Ditto.
* src/truetype/ttsubpix.[ch]: Remove files.
* src/truetype/rules.mk: Don't mention "ttsubpix.c".
2023-07-27 15:06:38 +00:00
Jouk Jansen 9e3c5d7e18 * vms_make.com: Provide separate library compiled with C++.
Some types on OpenVMS x86_64 (for example, `long') have different sizes
depending on whether compiled with either C or C++.  In particular,
X-Windows applications crash if linked with the C++ version.

This patch makes `vms_make.com` create a second version of the FreeType
library compiled with C++ if OpenVMS is running on the x86_64 platform.
2023-07-21 21:36:57 +02:00
Jouk Jansen f7ae7e88e9 * vms_make.com: Fix typos. 2023-07-21 21:33:20 +02:00
Jouk Jansen 7c542d02bf * src/smooth/ftgrays.c (FT_SSE2): Fix definition for VMS. 2023-07-21 21:31:28 +02:00
Jouk Jansen 5769f13a6b vms_make.com: Make use of additional libraries optional.
Check whether `.olb` files are present.

Also check for the HarfBuzz library.
2023-07-19 13:41:04 +02:00
Jouk Jansen e8aa5af936 vms_make.com: Add `/warn=noinfo` to `CFLAGS`.
This reduces enormously the informationals while compiling on x86_64 (i.e.,
which `.h` file is inluded form where).
2023-07-19 13:41:04 +02:00
Ben Wagner dd3c9c5fec [woff2] Clean up on large brotli expansion
* src/sfnt/sfwoff2.c (woff2_open_font): set error and goto cleanup

Fixes: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=60711
2023-07-18 13:34:09 -04:00
Werner Lemberg 336503dfd7 [woff2] Avoid allocation bomb.
This is a fix for commit 85167dbd5, reported as

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

* src/sfnt/sfwoff2.c (MAX_SFNT_SIZE): New macro.
(woff2_open_font): Use it to limit the maximum size of an uncompressed WOFF2
font.
2023-07-16 07:40:32 +02:00
Werner Lemberg 3c92e7bfc2 [cff] Fix compiler warning.
* src/cff/cffparse.c, src/cff/cffparse.h: Make `cff_parse_fixed` a local
function.
2023-07-14 18:58:55 +02:00
Ben Wagner 85167dbd50 [woff2] Remove sfnt size guess check
In WOFF the `totalSfntSize` must be correct, however in WOFF2 this value
is now just a hint and a conforming implementation must not reject
otherwise valid data if the `totalSfntSize` turns out not to be exact.

* src/sfnt/sfwoff2.c (woff2_open_font): remove check that uncompressed
woff2 data would fit in the sfnt size guess.

Fixes: #1235
2023-07-14 14:52:20 +00:00
Skef Iterum 26a7f0478b [cff] Make blend operator work with floats in private dicts.
The CFF2 blend operator takes N default values and corresponding
sets of deltas and pushes N values specific to a designspace
location.  CFF has a floating point numeric type and the FreeType
blending code was not converting those into its internal 16.16
Fixed type format.

Fixes #1243.

* src/cff/cffparse.c (do_fixed): Handle floating point numbers.
Also fix scaling overflow check for integer-to-fixed conversion.

* src/cff/cffload.c (cff_blend_doBlend): Updated.
2023-07-14 11:28:24 +02:00
Hin-Tak Leung dec2743e6a * src/truetype/ttgload.c (TT_Hint_Glyph): More mostly cosmetic update.
This is a follow-up to commit 49c74ac02, which creates a new local variable
"exec = loader->exec", and shortening a lot of "loader->exec".  This commit
does two more such changes missed in that first commit.

Signed-off-by: Hin-Tak Leung <htl10@users.sourceforge.net>
2023-07-08 05:39:25 +02:00
Hugh McMaster 355e919746 [gzip] Don't compile internal zlib development files when using system zlib.
`src/gzip/rules.mk` compiles the internal zlib sources even when using the
zlib development files provided by a host system.  If the internal zlib
development files are not present, FreeType fails to build from source.

This patch ensures the internal zlib development files are only
prerequisites when not using zlib development files on a host system.

* src/gzip/rules.mk (GZIP_DRV_SRCS): Define conditionally.
2023-07-06 14:22:15 +02:00
Werner Lemberg e4586d960f * Version 2.13.1 released.
==========================

Tag sources with `VER-2-13-1'.

* docs/VERSION.TXT: Add entry for version 2.13.1.
* docs/CHANGES: Updated.
* docs/release, docs/README, builds/macs/README: Updated.

* README, src/base/ftver.rc, builds/windows/vc2010/index.html,
builds/windows/visualc/index.html, builds/windows/visualce/index.html,
builds/wince/vc2005-ce/index.html, builds/wince/vc2008-ce/index.html,
docs/freetype-config.1: s/2.13.0/2.13/1/, s/2130/2131/.

* include/freetype/freetype.h (FREETYPE_PATCH): Set to 1.

* builds/unix/configure.raw (version_info): Set to 26:0:20.
* CMakeLists.txt (VERSION_PATCH): Set to 1.

* subprojects/libpng.wrap, subprojects/zlib.wrap, subprojects/dlg: Updated.
2023-06-24 08:11:05 +02:00
suzuki toshiya 5c00a46805 Comment fixes. 2023-06-09 07:36:49 +02:00
Werner Lemberg 86d0ca245a [sdf] Correct handling of empty glyphs.
This is a refinement of commit 7b3ebb9.

* src/sdf/ftsdfrend.c (ft_sdf_render): Goto 'Exit' instead of directly
returning.
(fd_bsdf_render): Ditto, also taking care of setting `FT_GLYPH_OWN_BITMAP`
correctly.
2023-06-09 05:38:49 +02:00
Ben Wagner 4e1c0e8fba Mark FT_Renderer_Class::raster_class as pointer to const
The `FT_DEFINE_RASTER_FUNCS` macro declares a `const FT_Raster_Funcs`.
The address of the definition is taken and assigned to
`FT_Renderer_Class::raster_class` which is currently `FT_Raster_Funcs*`.
Until recently the `const` was cast away and with the removal of the
cast there are now warnings about dropping this `const`. Instead of
adding back the casts, make `FT_Renderer_Class::raster_class` a pointer
to const, as is done with pointers in other interfaces.

* include/freetype/ftrender.h (FT_Renderer_Class_): mark `raster_class`
as const.
2023-06-05 12:06:24 -04:00
Ben Wagner 7bed7a02f4 Fix some `FT_Fixed` vs. `FT_Long` confusion.
`FT_Fixed` and `FT_Long` are both typedef'ed to be `signed long`.  However,
`FT_Fixed` implies that the lower 16 bits are being used to express
fractional values and so these two types should not be confused.

* include/freetype/internal/services/svmm.h (FT_Set_MM_Blend_Func): Use
`FT_Fixed` for `coords`.  Users are passing `FT_Fixed` and implementations
are taking `FT_Fixed`.
(FT_Get_MM_Blend_Func): Ditto.

* src/autofit/afcjk.c (af_cjk_metrics_check_digits): Use `FT_Long` for
`advance` and `old_advance`.  `advance`'s address is passed as `FT_Long*` to
`af_shaper_get_elem`, which writes the advance in em units (not fixed).  The
exact value is not important here as it is only compared to check whether it
has changed.

* src/autofit/aflatin.c (af_latin_metrics_check_digits): Ditto.
2023-06-03 07:02:12 +02:00
Ben Wagner 2fb8eda5d6 */*: Remove many function pointer casts.
In C it is undefined behavior to call a function through a function pointer
of a different type.  This is now detected by the Control Flow Integrity
Sanitizer.  All known issues have already been fixed.  Prevent any
accidental re-introduction by removing function pointer casts when defining
services.  The services will call the service functions through the function
pointers on the service.  As a result the functions must have the same type
so there should be no need to cast.  Removing the casts allows compilers to
warn about assignment to an incompatible function pointer type.
2023-06-03 06:58:09 +02:00
Werner Lemberg b641b607be Minor formatting. 2023-06-03 06:09:30 +02:00
Werner Lemberg 80a507a6b8 Replace `sprintf` with `snprintf`.
Fixes #1233.

* include/freetype/config/ftstdlib.h (ft_sprintf): Replace with...
(ft_snprintf): This new macro.

* src/autofit/afhints.c (af_print_idx): Add argument to pass the buffer
size.
(af_glyph_hints_dump_points, af_glyph_hints_dump_segments,
af_glyph_hints_dump_edges): Updated.

* src/bdf/bdflib.c (BUFSIZE): New macro.
(bdf_parse_properties_, bdf_parse_start_): Use `ft_snprintf`.

* src/tools/ftrandom/ftrandom.c (do_test): Use `snprintf`.
2023-05-23 13:18:01 +02:00
Werner Lemberg 66cc4619d2 docs/DEBUG: Formatting. 2023-05-23 12:54:48 +02:00
suzuki toshiya 562f348192 [doc] Type1 GX (sfnt-wrapped Type1) is not supported.
* docs/formats.txt: Clarify the reference of Type1 GX,
and state that this format is not supported.  This
is because the content `TYP1' table is not exactly same
with the Type1 font format specification; no eexec
encryption is used.  For detail and concrete examples,
see the analysis on:

https://gitlab.freedesktop.org/freetype/freetype/-/issues/1231
2023-05-20 12:52:25 +00:00
Craig White 2342a03a9d Add missing end quote of a string in the example code of FT_Trace_Set_Level 2023-05-19 14:11:57 -04:00
Seigo Nonaka 115e927540 [truetype] Reduce heap allocation of `deltaSet` variation data.
`deltaSet` is an array of packed integers that can be 32 bits, 16 bits, or
8 bits.  Before this change, these values were unpacked to 32-bit integers.
However, this can cause big heap allocations, e.g., around 500 KByte for
'NotoSansCJK'.  To reduce this amount, store the packed integers and unpack
them just before passing to the calculation.  At calculation time, due to
the variable length of region indices, temporary heap allocations are
necessary.  This heap allocation is not negligible and visible in `ftbench`
results.  So, use stack-allocated arrays for short array calculations.

Fixes #1230.

* include/freetype/internal/ftmmtypes.h (GX_ItemVarDataRec): New fields
`wordDeltaCount` and `longWords`.

* src/truetype/ttgxvar.c (tt_var_load_item_variation_store): Load packed
data.
(tt_var_get_item_delta): Unpack data before applying.
2023-05-19 06:50:28 +02:00
Jouk Jansen 99dadd56a4 vms_make.com: Create shared executable for x86 version of OpenVMS. 2023-05-17 12:40:59 +02:00
Werner Lemberg 416d4c25f1 Add new load flag `FT_LOAD_NO_SVG`.
Modern color fonts often contain both an 'SVG' and 'COLR' table.  FreeType
always preferred 'SVG' over 'COLR' (this was a design decision), however,
this might not be the right choice for the user.  The new flags makes
FreeType ignore the 'SVG' table while loading a glyph.

Fixes #1229.

* include/freetype/freetype.h (FT_LOAD_NO_SVG): New macro.

* src/base/ftobjs.c (FT_Load_Glyph), src/cff/cffgload.c (cff_slot_load),
src/truetype/ttgload.c (TT_Load_Glyph): Use it.
2023-05-15 16:04:15 +02:00
Werner Lemberg 872a759b46 .mailmap: Updated. 2023-05-13 09:35:12 +02:00
Alexei Podtelezhnikov e1a4e081aa [cache] Merge functions.
* src/cache/ftccache.c (FTC_Cache_Init): Merge into...
(ftc_cache_done): ... this function, with unnecessary checks removed.
2023-05-12 22:27:08 -04:00
Alexei Podtelezhnikov 771ff8bd03 [cache] Minor casting and cosmetic updates.
* src/cache/ftcglyph.c (ftc_gcache_{init,done}): Remove casting.
(FTC_GCache_Lookup): Cosmetic variable renaming.
* src/cache/ftcsbits.c (ftc_snode_compare): Formatting.
2023-05-12 22:21:47 -04:00
Werner Lemberg 3af4772d68 * include/freetype/ftcache.h: Typo, punctuation. 2023-05-12 05:59:00 +02:00
Alexei Podtelezhnikov b07ab47b2a * include/freetype/ftcache.h: Formatted and updated. 2023-05-11 23:23:52 -04:00
suzuki toshiya 7132f5b0d1 * include/freetype/internal/t1types.h: Fix the indentation. 2023-05-12 09:49:58 +09:00
Alexei Podtelezhnikov ad708d70c9 [cache] Revise the dynamic hash table accounting.
Instead of counting entries relative to the middle of the hash table,
this switches to the absolute counter with the full index range mask.
As a result, some calculations become a bit simpler.  The cache resizing
logic stays largely the same.

* src/cache/ftccache.h (FTC_NODE_TOP_FOR_HASH): Revised with new counter.
* src/cache/ftccache.c (ftc_get_top_node_for_hash): Ditto.
(ftc_cache_resize): Simplify reallocations and stop their zeroing.
(ftc_cache_init): Stop over-allocating but keep zeroing initially.
(FTC_Cache_Clear, FTC_Cache_RemoveFaceID): Updated accordingly.
2023-05-11 21:44:31 +00:00
suzuki toshiya 6ca0a9356f [t1cid] Set FT_FACE_FLAG_CID_KEYED.
* cidobjs.c (cid_face_init): Set FT_FACE_FLAG_CID_KEYED.

* cidriver.c (cid_get_is_cid): Comment about the case that
is_cid cannot guarantee the glyph collection specification.
2023-05-11 14:31:23 +00:00
Jouk Jansen c3876354e5 * src/smooth/ftgrays.c (FT_SSE2): Don't define for VMS. 2023-05-09 07:15:53 +02:00
Werner Lemberg e02a40a4f8 * src/cff/cffdrivr.c (cff_glyph_load): Fix guard for `size`.
This was forgotten to change in commit 2b54eba36b (in May 2004).

Reported as

  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=58739
2023-05-08 20:12:26 +02:00
Werner Lemberg 5edd6d52b1 Minor compiler warning fixes.
* src/autofit/afcjk.c (af_cjk_get_standard_widths), src/autofit/aflatin.c
(af_latin_get_standard_widths): Use `FT_CALLBACK_DEF`.

* src/cff/cffparse.c (cff_parser_run): Initialize and fix allocation of `q`.
2023-05-08 07:22:59 +02:00
Werner Lemberg bd37b84718 * src/psaux/t1cmap.c: Signature fixes. 2023-05-08 06:46:55 +02:00
Werner Lemberg 968fc281ac * src/bzip2/ftbzip2.c: Signature fixes. 2023-05-08 06:26:43 +02:00
Werner Lemberg d52166ae9d [cache] Signature fixes.
* src/cache/ftcglyph.c, src/cache/ftcglyph.h (FTC_GNode_Compare): Remove
redundant function.  It is equivalent to `ftc_gnode_compare` and becomes
completely meaningless with fixed signatures.
Update all callers.

* src/cache/ftcsbits.c, src/cache/ftcsbits.h (FTC_SNode_Compare): Remove
redundant function.  It is equivalent to `ftc_snode_compare` and becomes
completely meaningless with fixed signatures.
Update all callers.
2023-05-08 06:21:16 +02:00
Werner Lemberg c8ae37bab3 [sdf] Signature fixes. 2023-05-07 21:06:14 +02:00
Werner Lemberg 924329a9b0 * src/svg/ftsvg.c: Signature fixes. 2023-05-07 20:57:22 +02:00
Werner Lemberg 6e7b1b7650 [raster] Signature fixes. 2023-05-07 20:51:32 +02:00
Werner Lemberg 02283a6e99 [smooth] Signature fixes. 2023-05-07 20:44:20 +02:00
Werner Lemberg 669b7f7d6b [pshinter] Signature fixes.
* src/pshinter/pshrec.c (t1_hints_close, t1_hints_apply): New wrapper
functions.
(t1_hints_funcs_init): Use them.
(t2_hints_close, t2_hints_apply): New wrapper functions.
(t2_hints_funcs_init): Use them.
2023-05-07 20:26:12 +02:00
Werner Lemberg 274e0dd5b5 [autofit] Signature fixes. 2023-05-07 19:54:46 +02:00
Werner Lemberg 365eb10dd4 * src/sfnt/ttcmap: Signature fixes. 2023-05-07 19:16:38 +02:00
Werner Lemberg 60c11919e0 * src/pcf/pcfdrivr.c: Signature fix. 2023-05-07 16:42:01 +02:00
Werner Lemberg 5f7a26fd31 * src/winfonts/winfnt.c: Signature fixes. 2023-05-07 16:30:21 +02:00
Werner Lemberg 394c4de988 * src/type42/t42parse.c: Signature fixes. 2023-05-07 16:25:37 +02:00
Werner Lemberg 19aca9666e [pfr] Signature fixes. 2023-05-07 15:57:06 +02:00
Werner Lemberg 3297a7a9e0 * src/cid/cidload.c: Signature fixes. 2023-05-07 15:23:46 +02:00
Werner Lemberg 4a28ff3db8 * src/cff/cffcmap.c: Signature fixes. 2023-05-07 14:59:50 +02:00
Werner Lemberg 563f401127 * src/type1/t1load.c: Signature fixes. 2023-05-07 14:59:50 +02:00
Werner Lemberg 95d635eab1 [truetype] Signature fixes. 2023-05-07 14:59:50 +02:00
Werner Lemberg e05c056220 [base] Signature fixes. 2023-05-07 14:59:50 +02:00
Werner Lemberg ff0ef828c9 * src/type42/t42drivr.c: Clean up interface.
Ensure that all driver functions use the signature of the service or driver.
This avoids pointer mismatches, which are technically undefined behaviour.
Recent compilers are more picky in catching them as part of Control Flow
Integrity tests.
2023-05-07 14:59:50 +02:00
Werner Lemberg 7cc5dfa297 * src/type1/*: Clean up interface.
Ensure that all driver functions use the signature of the service or driver.
This avoids pointer mismatches, which are technically undefined behaviour.
Recent compilers are more picky in catching them as part of Control Flow
Integrity tests.
2023-05-07 14:59:50 +02:00
Werner Lemberg 3a85bf0b3f * src/truetype/*: Clean up interface.
Ensure that all driver functions use the signature of the service or driver.
This avoids pointer mismatches, which are technically undefined behaviour.
Recent compilers are more picky in catching them as part of Control Flow
Integrity tests.
2023-05-07 14:59:50 +02:00
Werner Lemberg e245951c43 * src/sfnt/sfdriver.c, src/sfnt/ttbdf.c: Clean up interface.
Ensure that all driver functions use the signature of the service or driver.
This avoids pointer mismatches, which are technically undefined behaviour.
Recent compilers are more picky in catching them as part of Control Flow
Integrity tests.

* src/sfnt/sfdriver.c (sfnt_load_table): New wrapper function.
(sfnt_service_sfnt_table): Use it.
2023-05-07 14:59:50 +02:00
Werner Lemberg ceba488cf8 * src/psnames/psmodule.c: Use `FT_CALLBACK_DEF`. 2023-05-07 14:59:50 +02:00
Werner Lemberg 4360e20e31 * src/pfr/pfrdrivr.c: face -> pfrface, pfrface -> face. 2023-05-07 14:59:50 +02:00
Werner Lemberg 0685b0ad36 * src/pcf/pcfdrivr.c: Clean up interface.
Ensure that all driver functions use the signature of the service or driver.
This avoids pointer mismatches, which are technically undefined behaviour.
Recent compilers are more picky in catching them as part of Control Flow
Integrity tests.
2023-05-07 14:59:50 +02:00
Werner Lemberg b9ce8e33a7 * src/cid/cidriver.c: Clean up interface.
Ensure that all driver functions use the signature of the service or driver.
This avoids pointer mismatches, which are technically undefined behaviour.
Recent compilers are more picky in catching them as part of Control Flow
Integrity tests.
2023-05-07 14:59:50 +02:00
Werner Lemberg bc7466ad45 * src/bdf/bdfdrivr.c: Clean up interface.
Ensure that all driver functions use the signature of the service or driver.
This avoids pointer mismatches, which are technically undefined behaviour.
Recent compilers are more picky in catching them as part of Control Flow
Integrity tests.
2023-05-07 14:59:50 +02:00
Werner Lemberg c041411917 * src/cff/*: Clean up interface.
Ensure that all driver functions use the signature of the service or driver.
This avoids pointer mismatches, which are technically undefined behaviour.
Recent compilers are more picky in catching them as part of Control Flow
Integrity tests.
2023-05-07 14:59:21 +02:00
Werner Lemberg 8fe50c2adc [truetype] Fix style name handling for variation fonts.
* include/freetype/internal/tttypes.h (TT_FaceRec): New field
`non_var_style_name`.

* src/sfnt/sfobjs.c (sfnt_load_face): Initialize `non_var_style_name`.
(sfnt_done_face): Free `non_var_style_name`.

* src/truetype/ttgxvar.c (TT_Set_Named_Instance): Restore non-VF style name
if switching back to non-VF mode.
2023-05-06 18:53:50 +02:00
Werner Lemberg c8a24209d3 [truetype] Fix PostScript name handling for variation fonts.
A variation font's PostScript name of a named instance is usually different
from the PostScript name of an unnamed instance.  However, if a change
between a named instance and an unnamed instance with exactly the same
design axis values happened, it was possible that the PostScript name wasn't
correctly updated.

This commit reorganizes the code to handle this issue within the top-level
API functions, using a new service to trigger recomputation of the
PostScript name.

* include/freetype/internal/services/svmm.h (FT_Construct_PS_Name_Func): New
typedef.
(FT_Service_MultiMasters): New field `construct_ps_name`.
(FT_DEFINE_SERVICE_MULTIMASTERSREC): Updated.

* src/base/ftmm.c (FT_Set_Var_Design_Coordinates,
FT_Set_MM_Blend_Coordinates, FT_Set_Var_Blend_Coordinates): Call
`mm->construct_ps_name` to handle `postscript_name`.
(FT_Set_Named_Instance): Call `mm->construct_ps_name` to handle
`postscript_name`.
Use shortcut.
* src/cff/cffdrivr.c (cff_construct_ps_name): New function.
(cff_service_multi_masters): Updated.

* src/truetype/ttgxvar.c (tt_set_mm_blend): Don't handle `postscript_name`.
(TT_Set_MM_Blend): Simplify.
(TT_Set_Named_Instance): Return -1 if axis values haven't changed.
Don't set `face_index`.
(tt_construct_ps_name): New function.

* src/truetype/ttgxvar.h: Updated.

* src/truetype/ttdriver.c (tt_service_gx_multi_masters): Updated.

* src/type1/t1driver.c (t1_service_multi_masters): Updated.

* src/type1/t1load.c (T1_Set_MM_Blend): Simplify.
2023-05-06 18:53:50 +02:00
Werner Lemberg 7af8fd0063 * include/freetype/internal/services/svmm.h: Minor changes. 2023-05-06 18:53:50 +02:00
Werner Lemberg 6713b1e41a [truetype] Fix deactivation of variation font handling.
According to the documentation, the functions `FT_Set_Named_Instance`,
`FT_Set_MM_Design_Coordinates`, `FT_Set_Var_Design_Coordinates`, and
`FT_Set_Var_Blend_Coordinates` can unset the `FT_FACE_FLAG_VARIATION` flag.
(The same is true for `FT_Set_MM_WeightVector` but this information was
accidentally omitted from the documentation.)

However, if a call of these functions didn't change the axis values this
could fail because internal shortcuts exited too early.

This commit reorganizes the code to handle `FT_FACE_FLAG_VARIATION` in the
top-level API functions, also taking care of the issue at hand.

* src/base/ftmm.c (FT_Set_MM_Design_Coordinates, FT_Set_MM_WeightVector,
FT_Set_Var_Design_Coordinates, FT_Set_MM_Blend_Coordinates,
FT_Set_Var_Blend_Coordinates): Handle `FT_FACE_FLAG_VARIATION`.

* src/truetype/ttgxvar.c (TT_Set_MM_Blend, TT_Set_Var_Design,
TT_Set_Named_Instance) Don't handle `FT_FACE_FLAG_VARIATION`.

* src/type1/t1load.c (T1_Set_MM_Blend, T1_Set_MM_WeightVector,
T1_Set_MM_Design): Ditto.

* src/cff/cffobjs.c (cff_face_init): Use `FT_Set_Named_Instance` instead of
low-level functions.

* src/truetype/ttobjs.c (tt_face_init): Ditto.
2023-05-06 18:53:50 +02:00
Werner Lemberg fdcb14a2ee s/set_instance/set_named_instance/
* include/freetype/internal/services/svmm.h (FT_Set_Instance_Func): Renamed
to...
(FT_Set_Named_Instance_Func): ...this.
(FT_Service_MultiMasters): Rename `set_instance` to `set_named_instance`.
(FT_DEFINE_SERVICE_MULTIMASTERSREC): Updated.

* src/base/ftmm.c (FT_Set_Named_Instance): Updated.

* src/cff/cffdrivr.c (cff_set_instance): Renamed to...
(cff_set_named_instance): ...this.
(cff_service_multi_masters): Updated.
* src/cff/cffobjs.c (cff_face_init): Updated.

* src/truetype/ttdriver.c (tt_service_gx_multi_masters): Updated.

* src/type1/t1driver.c (t1_service_multi_masters): Updated.
2023-05-06 18:53:50 +02:00
Werner Lemberg fb982e78a7 New Variation Font function `FT_Get_Default_Named_Instance`.
* include/freetype/ftmm.h, src/base/ftmm.c (FT_Get_Default_Named_Instance):
New function.

* include/freetype/internal/services/svmm.h
(FT_Get_Default_Named_Instance_Func): New typedef.
(FT_Service_MultiMasters): New field `get_default_named_instance`.
(FT_DEFINE_SERVICE_MULTIMASTERSREC): Updated.

* include/freetype/internal/tttypes.h (TT_Face): New field
`var_default_named_instance`.

* src/sfnt/sfobjc.s (sfnt_init_face): Initialize
`var_default_named_instance`.

* src/cff/cffdrivr.c (cff_get_default_named_instance): New function.
(cff_service_multi_masters): Updated.

* src/truetype/ttgxvar.c (TT_Get_MM_Var): Initialize
`var_default_named_instance`.
(TT_Get_Default_Named_Instance): New function.
* src/truetype/ttgxvar.h: Updated.
* src/truetype/ttdriver.c (tt_service_gx_multi_masters): Updated.

* src/type1/t1driver.c (t1_service_multi_masters): Updated.

* docs/CHANGES: Updated.
2023-05-06 18:53:50 +02:00
Werner Lemberg b5e57b041b [cid] Improve tracing messages; formatting. 2023-05-06 16:41:13 +02:00
Alexei Podtelezhnikov 9127c68f59 * src/cache/ftccache.c (ftc_node_hash_unlink): Minor. 2023-05-04 16:54:22 +00:00
Alexei Podtelezhnikov 345f88109b * src/cache/ftcmru.c (FTC_MruList_RemoveSelection): Purge backwards. 2023-05-03 23:33:32 -04:00
Alexei Podtelezhnikov f2f9754542 [cache] Revise list cleansing.
* src/cache/ftcmru.c (FTC_MruList_RemoveSelection): Use one loop to
do it.
* src/cache/ftcmanag.c (FTC_Manager_Compress, FTC_Manager_FlushN):
Streamline loops.
2023-05-03 23:02:04 -04:00
suzuki toshiya be15811c46 [t1cid] Improve cid_get_cid_from_glyph_index().
Update cid_get_cid_from_glyph_index() to
return an error and CID=0 in the case that
the specified glyph index points to an invalid
entry.

cidgload.h (cid_compute_fd_and_offsets):
Declare new helper function to set the
fd_select and 2 offsets to access the glyph
description data.

cidgload.c (cid_compute_fd_and_offsets):
Move the part loading fd_select and 2 offsets
from cid_load_glyph() to here.  If the loaded
parameters are broken, return the Invalid_Offset
error.  This function does not load the glyph
data, only fills these parameters.

(cid_load_glyph): Use new helper function in above.

cidriver.c (cid_get_cid_from_glyph_index):
Check whether the requested glyph index points
to a valid entry, by calling cid_compute_fd_and_offsets().
If it is valid, fill the cid by the glyph
index (=CID).  If it is invalid, return an
error and fill the cid by 0.
2023-05-03 01:31:37 +00:00
Werner Lemberg 77bbfc5960 API documentation: Re-organize chapters and sections
* Split the very long 'Base Interface' section into smaller sections.
* Split the 'Core API' chapter into two chapters.
* Remove single enumeration values from `@order` fields since they have no
  effect.
2023-04-30 14:42:11 +00:00
Alexei Podtelezhnikov 36a086b630 * src/sfnt/pngshim.c (Load_SBit_Png): Remove FALL_THROUGH warning. 2023-04-28 19:40:35 -04:00
Werner Lemberg 08268691aa * src/sfnt/ttload.c (tt_face_load_font_dir): Add another guard.
Reject 'OTTO' fonts with no valid tables.
2023-04-28 15:33:58 +02:00
Werner Lemberg 966ff5a55c * src/cff/cffdrivr/c (cff_get_ps_name): Avoid unnecessary crash.
The situation can happen if `FT_New_Face` (or one of its siblings) is called
with a negative index to get the number of contained faces, followed
immediately by a call to `FT_Get_Postscript_Name`.  While this is not a valid
use of the FreeType library there is no need for a crash.

Fixes #1219.
2023-04-28 15:25:20 +02:00
Werner Lemberg 17a0c5dfd5 * src/cff/cffdrivr.c (cff_ps_get_font_info): Reject 'CFF2' format. 2023-04-28 10:40:41 +02:00
Werner Lemberg 4908c1e84d * src/cid/cidgload.c (cid_load_glyph): Fix compiler warnings. 2023-04-28 06:54:25 +02:00
Werner Lemberg 13df1c7d29 Minor documentation updates. 2023-04-28 06:39:32 +02:00
Werner Lemberg 9a3d05d980 * src/ttgxvar.c: Minor changes.
(TT_Get_MM_Var): Improve tracing messages.
(tt_set_mm_blend): Minor speed-up.
2023-04-27 06:24:48 +02:00
Werner Lemberg cfe54d6ac3 s/this is,/that is,/ 2023-04-27 06:24:48 +02:00
Alexei Podtelezhnikov 7ab541a28b [bdf] Clean up the atom property parsing.
* src/bdflib.c (bdf_is_atom_): Refactor code with fewer checks.
(bdf_list_join_): Return NULL.
(bdf_add_comment_): Use const argument.
(bdf_get_property): Ditto, ditto, make the function static.
* src/bdf.h (bdf_get_property): Remove prototype.
2023-04-26 23:15:24 -04:00
Werner Lemberg 0a3836c97d Improve/add source comments and documentation. 2023-04-25 11:47:18 +02:00
Werner Lemberg 40676afc4c [sfnt] Fix handling of PS names for Variation Fonts.
* src/sfnt/sfdriver.c (get_win_string, get_apple_string): Continue
construction of string if an invalid character is encountered.

Fixes #1218.
2023-04-25 11:47:18 +02:00
suzuki toshiya f312b3402a [t1cid] Change the trace messages of the charstrings retrieval errors.
The t1cid driver catches 3 types of errors in
the charstrings retrieval;
A) The invalid FD number, there are 2 subtypes;
  A-1) FD number is the maximum number fitting to FDBytes.
  A-2) FD number is greater than num_dicts.
B) Declared length is overrunning.
C) Declared length is invalid (its end is before its head).

Considering that some widely distributed fonts
(e.g., "CJKV" book by O'Reilly) have A-1 errors
in the unimplemented glyphs, the trace level for
A-1 is calmed to level 1.

The errors A-2, B, and C would be irregular;
their trace levels are kept at level 0, but
the updated trace messages include the CID number.
2023-04-24 14:06:09 +09:00
suzuki toshiya 9806414c15 [truetype] Fix `make multi'.
* src/truetype/ttgxvar.c: Include freetype/internal/services/svmetric.h
for the FT_Service_MetricsVariations type definition.
2023-04-24 13:36:30 +09:00
Ben Wagner 8154d8e2be [services] FT_Size_Reset_Func to return FT_Error
The `MetricsVariations` `FT_Size_Reset_Func` is currently defined to
return `void`, but the implementations return `FT_Error`. Even though
the pointers passed will be the same at runtime, calling a function
through a pointer of a different type from the original function pointer
type is undefined behavior. This may be caught at runtime by Control
Flow Integrity with something like clang's `cfi-icall`.

Issue: https://crbug.com/1433651

* include/freetype/internal/services/svmetric.h (FT_Size_Reset_Func):
return `FT_Error` instead of `void`.
2023-04-19 13:48:59 -04:00
Ben Wagner c4fe77c3f0 [truetype] tt_size_reset_height to take FT_Size
The `MetricsVariations` `FT_Size_Reset_Func` is defined to take an
`FT_Size`. Because `tt_size_reset_height` is to be used as such a
function, it must also take an `FT_Size` instead of a `TT_Size`. Even
though the pointers passed will be the same at runtime, calling a
function through a pointer of a different type from the original
function pointer type is undefined behavior. This may be caught at
runtime by Control Flow Integrity with something like clang's
`cfi-icall`.

Issue: https://crbug.com/1433651

* src/truetype/ttobjs.h (tt_size_reset_height): take `FT_Size`

* src/truetype/ttobjs.c (tt_size_reset_height): take `FT_Size` and
update documentation
2023-04-17 12:32:04 -04:00
Werner Lemberg ea9fca0add * src/truetype/ttinterp.c: Remove outdated comments. 2023-04-13 06:34:32 +02:00
Ben Wagner e78e2d29a9 [sfnt, truetype] Add `size_reset` to `MetricsVariations`.
This is a generalization of commit

```
commit e6699596af
Author: Werner Lemberg <wl@gnu.org>
Date:   Thu Feb 2 11:38:04 2017 +0100

    [truetype] Fix MVAR post-action handling.
```

It is also possible for plain `CFF ` style fonts to contain an `fvar` and
`MVAR` table and use `cff_metrics_adjust`.  `tt_size_reset` should only be
called with `TT_Size` and never with `CFF_Size`.

Allow the "metrics-variations" service to specify the correct function (if
any) to reset `FT_Size`s after adjusting metrics.

* src/truetype/ttobjs.c (tt_size_reset): Split off some functionality
into...
(tt_size_reset_height): ... this new function.

* src/truetype/ttdriver.c (tt_service_metrics_variations): Add
`size_reset`.
(tt_size_select, tt_size_request): Updated.

* src/truetype/ttobjs.h: Updated.

* include/freetype/internal/services/svmetric.h (MetricsVariations): Add
`size_reset`.
(FT_DEFINE_SERVICE_METRICSVARIATIONSREC): Updated.

* include/freetype/internal/tttypes.h (TT_FaceRec_): Rename `var` to
`tt_var` and add `face_var`.

* src/cff/cffdrivr.c (cff_service_metrics_variations): Add `size_reset`.
(cff_hadvance_adjust, cff_metrics_adjust): Updated.

* src/cff/cffobjs.c (cff_face_init): Use `face_var`.

* src/sfnt/sfobjs.c (sfnt_init_face): Initialize `face_var`.

* src/sfnt/ttmtx.c (tt_face_get_metrics): Use `tt_var`.

* src/truetype/ttgxvar.c (tt_size_reset_iterator): Renamed to...
(ft_size_reset_iterator): ... this new function.
Call `size_reset`.
(tt_apply_mvar): Pass `size_reset` to `ft_size_reset_iterator`.

Fixes #1211
2023-04-11 10:20:58 +02:00
Alexei Podtelezhnikov e77d8ba87c * src/cff/cffcmap.c (cff_cmap_encoding_char_next): Abbreviate. 2023-04-10 15:17:17 -04:00
Alexei Podtelezhnikov 1a4c18f7cb Align `char_next` return types.
This is mostly cosmetic because FT_UInt and FT_UInt32 are likely identical.

* src/sfnt/ttcmap.c, src/cff/cffcmap.c, src/psaux/t1cmap.c,
src/psnames/psmodule.c, include/freetype/internal/service/svpcsmap.h,
src/pfr/pfrcmap.c, src/winfonts/winfnt.c (*_char_next): return FT_UInt.
2023-04-10 15:30:43 +00:00
Alexei Podtelezhnikov d25444333c [sfnt] Clean up CMAP{4,12,13} handling.
This moves the charcode overflow checks upstream and turns some
while-loops into the do-while ones to avoid the uninitialized warnings.
This should slightly reduce the number of checks and jumps.

* src/sfnt/ttcmap.c (tt_cmap{4,12,13}_next,
tt_cmap{4.12.13}_char_map_linear): Remove the charcode overflow check.
(tt_cmap{4,12,13}_char_map_binary): Ditto and use do-while.
(tt_cmap{12,13}_char_next): Add the overflow check.
2023-04-08 23:15:41 -04:00
Alexei Podtelezhnikov b0a4f99278 * src/sfnt/ttpost.c (load_format_25): Do not abort frame reading. 2023-04-02 22:45:48 -04:00
Alexei Podtelezhnikov 340767bf85 * src/sfnt/ttpost.c (load_format_*): Streamline frame reading. 2023-04-02 22:00:59 -04:00
Alexei Podtelezhnikov 311b78fa12 * src/sfnt/ttpost.c: Formatting and comments. 2023-04-02 09:24:16 -04:00
Alexei Podtelezhnikov 8f7b145524 [sfnt] Consolidate POST version 2.0 and 2.5 (pt 2).
* src/sfnt/ttpost.c (load_format_20, load_format_25): Update arguments
and move shared calls and checks upstream to...
(load_post_names): ... this function.
(tt_face_free_ps_names, tt_face_get_ps_name): Updated.
2023-04-01 23:37:51 -04:00
Alexei Podtelezhnikov 9597a62bac [sfnt] Consolidate POST version 2.0 and 2.5 (pt 1).
The deprecated POST version 2.5 can be handled using the data
structures of version 2.0.  The goal is to reduce the footprint.

* include/freetype/internal/tttypes.h (TT_Post_Names): Absorb and...
(TT_Post_20, TT_Post_25): ... remove these structures.
src/sfnt/ttpost.c (load_post_names, tt_face_get_ps_name,
tt_face_free_ps_names, load_format_20): Updated accordingly.
(load_format_25): ditto and convert offsets to glyph indices.
2023-04-01 22:34:30 -04:00
Alexei Podtelezhnikov 6d7b8b22c4 [sfnt] Miscellaneous POST clean-ups.
* src/sfnt/ttpost.c (load_format_20): Decrease casts.
(load_format_25): Check the table length and impose a theoretical
glyph number limit usable with 8-bit offset.  Decrease casts.
(load_post_names): Pass the mapping data length without 2 bytes.
2023-03-31 23:17:46 -04:00
Alexei Podtelezhnikov 0db6997026 * src/sfnt/ttpost.c (load_format_20): Simplify comutations. 2023-03-30 09:06:35 -04:00
Alexei Podtelezhnikov 4679fcb666 [sfnt] Streamline POST format 2.0 handing (cont'd).
* src/sfnt/ttpost.c (load_format_20): Co-allocate the string data and
their pointers, which makes it easier to handle and free them.
(tt_face_free_ps_names): Updated.
* include/freetype/internal/tttypes.h (TT_Post_20): Update type.
2023-03-29 00:21:00 -04:00
Alexei Podtelezhnikov 4d8db130ea [cff] Simplify `t2_strings` management in the old engine.
* src/cff/cffparse.c (cff_parser_run): Allocate the charstring buffers
and the list nodes together so that they can be freed at once.
(finalize_t2_strings): Removed as no longer needed.
(cff_parser_done): Updated.
2023-03-20 16:53:51 -04:00
Alexei Podtelezhnikov 4f0a55d15e [cff] Rework the stream limit checks.
The old stream limit checks, before 6986ddac1e, were good but
pointless for the crafted t2_strings.  Checking limits there is
not necessary as they are created to hold all data.  By using two
conditions, we can detect the actual crossing of the stream boundary
as appropriate for the stream pointer only.  The t2_strings parsing
will not be triggering these checks.

* src/cff/cffparse.c (cff_parser_within_limits): Removed.
(cff_parse_real, cff_parse_integer): Redesign the stream limit check.
(cff_parse_num, do fixed, cff_parse_fixed_dynamic): Update callers.
2023-03-19 10:13:52 -04:00
Alexei Podtelezhnikov 8fc6df1028 * src/truetype/ttgload.c (TT_Load_Simple_Glyph): Use for-loop.
Even though we never call `TT_Load_Simple_Glyph` with zero contours,
out of abundance of precaution, let's handle this case properly.
2023-03-17 23:35:10 -04:00
Alexei Podtelezhnikov ef63669652 [truetype] Clean up zeroing and local variables.
* src/truetype/ttgload.c (TT_Process_Simple_Glyph): Avoid zeroing.
(load_truetype_glyph): Avoid zeroing and clean local variables.
2023-03-17 23:25:45 -04:00
Werner Lemberg 7be364c6a2 * include/freetype/ftsystem.h (FT_Stream_IoFunc): Improve documentation.
Fixes #1208.
2023-03-16 05:26:48 +01:00
Alexei Podtelezhnikov dd78d4a774 * src/base/ftsynth.c (FT_GlyphSlot_AdjustWeight): New API. 2023-03-16 03:28:59 +00:00
Alexei Podtelezhnikov 764bc8e41c [truetype] Clean up glyph loading.
* src/truetype/ttgload.c (TT_Load_Simple_Glyph): Clean space checking.
(TT_Hint_Glyph): Don't copy the outline structure.
(TT_Process_Simple_Glyph): Cosmetic update.
2023-03-15 23:18:18 -04:00
Alexei Podtelezhnikov e71647621c * src/truetype/ttgload.c (TT_Load_Simple_Glyph): Clean up. 2023-03-15 18:48:27 +00:00
Werner Lemberg d857bd535b builds/vms/apinames_vms.bash: Fix `unzip` artifact
The problem occured when unpacking a zip file created on OpenVMS on Linux.
While OpenVMS knows many different file formats, Unix only knows stream-LF
and binary.  In principle `zip` on Linux should have translated the file to
stream-LF but failed to do so.  That caused the file to incorrectly contain
only one line with control-characters.
2023-03-13 11:47:38 +01:00
Alexei Podtelezhnikov b9376065d6 [truetype] Fix recent fallout in memory management.
* src/truetype/ttgload.c (TT_Process_Composite_Glyph,
TT_Load_Simple_Glyph): Clean up old instructions regardless of
new ones, postpone setting `control_len` and `control_data` until...
(TT_Load_Glyph): ... the exit from this function.
2023-03-10 23:41:39 -05:00
Jouk Jansen 24d2523cdd Update VMS installation support. 2023-03-10 16:56:15 +01:00
Alexei Podtelezhnikov 49c74ac021 * src/truetype/ttgload.c (TT_Hint_Glyph): Mostly cosmetic update.
The number of instructions is now taken from the executed context.
Technically, this means that `control_len` and `control_data`
values are no longer _used_ internally but only expose them.
2023-03-09 22:37:03 -05:00
Werner Lemberg bd6208b712 apinames.c: Add comment. 2023-03-08 10:49:42 +01:00
Werner Lemberg d5c6b948ac [gzip] File `infback.c` is not needed.
* src/gzip/infback.c: Remove.
* src/gzip/rules.mk (GZIP_DRV_SRCS): Updated.
2023-03-07 08:55:58 +01:00
Werner Lemberg 092f9d9874 [apinames] Fix VMS handling of overly long function names.
Based on ideas from Jouk Jansen <joukj@hrem.nano.tudelft.nl>.

* src/tools/vms_shorten_symbol.c: New file, taken from

  https://sourceforge.net/p/vms-ports/vmsshortsym/ci/default/tree/vms_shorten_symbol.c

with some minor edits to allow compilation with C++ and being included in
another source code file.

* src/tools/apinames.c: Include `vms_shorten_symbol.c`.
(PROGRAM_VERSION): Set to '0.5'.
(names_dump) [OUTPUT_VMS_OPT]: Call `vms_shorten_symbol` to get unique function
identifiers not longer than 31 characters.
2023-03-07 07:28:32 +01:00
Werner Lemberg 72a8d65218 * src/tools/apinames.c (panic): Accept variable number of arguments. 2023-03-07 07:16:59 +01:00
Alexei Podtelezhnikov b3250f367a * src/truetype/ttgload.c (TT_Process_Composite_Glyph): Fix leak too. 2023-03-06 23:53:42 -05:00
Alexei Podtelezhnikov b36193d025 * src/truetype/ttgload.c (TT_Load_Simple_Glyph): Triage memory leak.
This leak has been introduced in the previous commit and immediately
detected:
  https://chromium-review.googlesource.com/c/chromium/src/+/4313202
2023-03-06 22:48:21 -05:00
Alexei Podtelezhnikov de94e2cbfb [truetype] Simplify memory management.
Instead of using `Update_Max`, switch to regular FreeType memory
allocation macros, stop pre-allocating the glyph instruction arrays.

* src/truetype/ttgload.c (TT_Load_Simple_Glyph,
TT_Process_Composite_Glyph): Switch to regular memory allocation.
* src/truetype/ttinterp.c (Update_Max): Removed.
(TT_Load_Context): Reallocate stack and free old instructions.
(Modify_CVT_Check, Ins_WS): Switch to regular memory allocation.
* src/truetype/ttinterp.h (Update_Max): Removed.
2023-03-06 16:23:14 -05:00
David PROVENT b2a9490623 Added information about the zlib version update in the changelog 2023-03-06 14:32:02 +01:00
Alexei Podtelezhnikov fc01e7dd67 Fix a couple of MSVC warnings.
* src/base/ftcalc.c (FT_MulAddFix): Add cast.
* src/sfnt/ttcolr.c (tt_face_get_colorline_stops, read_paint): Ditto.
2023-03-05 22:05:24 -05:00
Alexei Podtelezhnikov 70946f6dc6 * builds/windows/vc2010/freetype.vcxproj: Suppress C4267 on _WIN64.
This usually comes from `strlen` returning 64-bit `size_t`, which
we often assign to 32-bit `FT_ULong` on Windows-64 (LLP64).
2023-03-05 16:08:14 -05:00
Alexei Podtelezhnikov c4b5127b74 * src/cff/cffparse.c (cff_parser_run): Thinko. 2023-03-05 00:31:58 -05:00
Alexei Podtelezhnikov de6002203b [cff] Clean up CharString number encoding.
* src/cff/cffparser.c (cff_parser_run): Work with signed numbers.
2023-03-04 23:49:49 -05:00
Alexei Podtelezhnikov 51c1705477 * src/cff/cffparse.c (cff_parser_run): Fix variable type. 2023-03-04 23:32:50 -05:00
Alexei Podtelezhnikov a2b8937d47 [cff] Clean up memory management in the old engine.
* src/cff/cffparse.c (finalize_t2_strings): Fix NULL-dereferencing
in the out-of-memory situation, use `FT_FREE`.
(cff_parser_run): Use FreeType memory allocation macros and avoid
uninitialized pointers.
2023-03-04 14:00:52 -05:00
Alexei Podtelezhnikov 29578f75c3 * src/cff/cffobjs.c (cff_size_init): Synonymous change. 2023-03-04 13:39:27 +00:00
Alexei Podtelezhnikov 7ae20e55c9 * src/sfnt/sfobjs.c (sfnt_load_face): Shorten de-referencing. 2023-03-03 22:41:09 -05:00
Alexei Podtelezhnikov 49eac0da0c [pfr] Shorten de-referencing.
* src/pfr/pfrobjs.c (pfr_face_done, pfr_face_init): Use closer `memory`.
* src/pfr/pfrgload.c (pfr_glyph_load_compound): Remove `loader`.
2023-03-03 22:10:50 -05:00
Alexei Podtelezhnikov 2adef94f43 * src/cff/cffobjs.c (cff_size_get_globals_funcs): Shorten de-referencing. 2023-03-03 18:40:48 +00:00
Alexei Podtelezhnikov 5ac6276af1 [cff,cid,type1] Shorten de-referencing.
* src/cff/cffobjs.c (cff_clot_init): Use immediate library reference.
* src/cid/cidobjs.c (cid_slot_init): Ditto.
* src/type1/t1objs.c (T1_GlyphSlot_Init): Ditto.
2023-03-03 17:21:10 +00:00
Alexei Podtelezhnikov 5c37b64062 * configure: Use `sed` instead of `grep`.
This is more portable and consistent with `autogen.sh`.
2023-03-02 20:53:21 +00:00
Ben Wagner 09b326fa2b Avoid strtol on non-null-terminated data.
Technically, `strtol` can only be used with C strings terminated with
`\0`.  CID data is not generally null-terminated and often does not
contain a `\0` if it is hex-encoded.  AddressSanitizer with `ASAN_OPTIONS`
containing `strict_string_checks=1` verifies this by using an adversarial
`strtol` that always reads to the terminating `\0`.

To avoid undefined behavior from `strtol` in `cid_parser_new`, use the
parser to parse the tokens instead of attempting to parse them ad-hoc.
This will internally use `PS_Conv_Strtol` to parse the integer, which
respects the parser's limits and directly implements the PostScript
parsing rules for integers.

* src/cid/cidparse.c (cid_parser_new): Use the parser to parse the
tokens.

Fixes: https://bugs.chromium.org/p/chromium/issues/detail?id=1420329
2023-03-02 20:56:41 +01:00
Alexei Podtelezhnikov e95e623471 * src/cff/cffload.c (cff_subfont_load): Synonymous update. 2023-03-02 17:58:03 +00:00
ubawurinna e8931f8c56 * src/gzip/README.freetype: Update version. 2023-03-01 18:20:46 +00:00
ubawurinna 79c8bd9110 [gzip] Fix static linking.
Without this patch, static linking with MS Visual Studio causes linking
errors.

* src/gzip/ftgzip.c: Set `ZEXPORT` to nothing and `ZEXTERN` to static for
all compilers.
2023-03-01 18:09:56 +01:00
Werner Lemberg d874ffa96c * include/freetype/internal/compiler-macros.h (FALL_THROUGH): Update.
This follows

  https://lists.gnu.org/archive/html/bug-gnulib/2023-02/msg00200.html
2023-03-01 06:36:59 +01:00
Alexei Podtelezhnikov 638df2fe32 [truetype] Treat 38 as 40 without Infinality.
* include/freetype/ftdriver.h (TT_INTERPRETER_VERSION_38): Reinstate.
* src/truetype/ttdriver.c (tt_property_set): Fallback from 38 to 40.
2023-02-27 21:54:23 -05:00
Werner Lemberg 2257f9abf6 * include/freetype/internal/compiler-macros.h (FALL_THROUGH): Update.
This follows

  https://lists.gnu.org/archive/html/bug-gnulib/2023-02/msg00159.html
2023-02-26 20:23:43 +01:00
Werner Lemberg d399657f1b * src/*: Replace leading underscores with trailing ones in dummy variables.
This is to avoid clang warnings.
2023-02-26 20:18:54 +01:00
Karl Berry f19ab67327 * configure: Don't hardcode `grep -E`.
TeXLive still supports Solaris 5.10, where the system's `grep` doesn't
accept the `-E` option.  We thus introduce an `EGREP` variable that is set
to either `grep -E` or `-egrep`.
2023-02-26 07:31:49 +01:00
Alexei Podtelezhnikov 6423ddb8a0 * src/cff/cffload.c (cff_encoding_load): Optimize array zeroing.
This is unnecessary for predefined standard and expert encodings.
Even for custom encodings the arrays might be already zeroed when
CFF_FontRec is created but we keep it just in case.
2023-02-25 21:54:21 -05:00
Alexei Podtelezhnikov 74c498a383 * src/type1/t1load.c (T1_Get_MM_Var): Optimize array zeroing. 2023-02-25 11:02:21 -05:00
Tamir Duberstein 3f2ac7d890 * src/base/ftsystem.c (ft_ansi_stream_io): Avoid undefined behaviour.
Also short-circuit on `offset` to avoid checking `count` a second time when
`ft_ansi_stream_io` is used for reading.

Per ISO/IEC 9899:

  If an argument to a function has an invalid value (such as a value outside
  the domain of the function, or a pointer outside the address space of the
  program, or a null pointer, or apointer to non-modifiable storage when the
  corresponding parameter is not const-qualified) or a type (after
  promotion) not expected by a function with variable number of arguments,
  the behavior is undefined.  If a function argument is described as being
  an array, the pointer actually passed to the function shall have a value
  such that all address computations and accesses to objects (that would be
  valid if the pointer did point to the first element of such an array) are
  in fact valid.

Per IEEE Std 1003.1:

  size_t fread(void *restrict ptr, size_t size, size_t nitems,
               FILE *restrict stream);

  The `fread` function shall read into the array pointed to by `ptr` up to
  `nitems` elements whose size is specified by `size` in bytes, from the
  stream pointed to by `stream`.

Since the first argument to `fread` is described as being an array, its
behavior is undefined when that argument is a null pointer.

Per the documentation on `ft_ansi_stream_io`:

  If `count' is zero (this is, the function is used for seeking), a non-zero
  return value indicates an error.

Thus the intent is clear, and the call to `fread` can be skipped, avoiding
undefined behaviour.
2023-02-25 05:20:57 +01:00
Alexei Podtelezhnikov 3f01161ff2 [raster] Clean up contour indexing.
* src/raster/ftraster.c (Decompose_Curve, Convert_Glyph): Use consistent
index types (Int) and compact iterations.
2023-02-21 16:17:07 +00:00
Alexei Podtelezhnikov 7f9499044e [autofit] Clean up contour indexing.
* src/autofit/aflatin.c (af_latin_metrics_init_blues): Refactor.
* src/autofit/afcjk.c (af_cjk_metrics_init_blues): Ditto.
2023-02-20 23:29:58 -05:00
Alexei Podtelezhnikov 78464d1b0c * src/base/ftoutln.c (FT_Outline_Check): Fix C4701 warning. 2023-02-20 22:31:21 -05:00
Alexei Podtelezhnikov f5f969a8fe * src/sdf/ftsdf.c (get_min_distance_cubic): Fix C4701, typos. 2023-02-20 22:29:18 -05:00
Alexei Podtelezhnikov fecd19b449 * src/base/ftstroke.c (FT_Stroker_ParseOutline): Clean up contour indexing. 2023-02-20 17:13:40 +00:00
Alexei Podtelezhnikov 34ed28d0fb [base] Clean up contour indexing.
* src/base/ftoutln.c (FT_Outline_Reverse, FT_Outline_EmboldenXY,
FT_Outline_Get_Orientation): Set the first and last indexes together.
(FT_Outline_Decompose): Ditto and check them more stringently.
* src/smooth/ftgrays.c (FT_Outline_Decompose)[STANDALONE_]: Ditto.
2023-02-20 16:33:45 +00:00
Alexei Podtelezhnikov 713580f41d * src/base/ftoutln.c (FT_Outline_Check): Update error code, clean up. 2023-02-20 15:58:04 +00:00
Alexei Podtelezhnikov bbfcd79eac [truetype] Hide Infinality.
Remove Infinality as an option before its complete extraction.

* include/freetype/ftoption.h: Remove the Infinality option.
* devel/ftoption.h: Ditto.
* include/freetype/ftdriver.h (TT_INTERPRETER_VERSION_38): Is 40 now.
2023-02-17 04:22:24 +00:00
Alex Ringlein 74ea5454cc * src/base/ftoutln.c (FT_Outline_Reverse): Anchor first contour points.
A cubic contour has to always start from an on-point. Therefore, we
should not swap the first with the last point, which might be off, and
obtain an invalid contour. This does not matter for conic contours.
If anything, it also saves one swap there. Fixes #1207.
2023-02-16 22:38:35 -05:00
Werner Lemberg 0eca6ead82 Documentation improvement for `FT_Bitmap`.
Fixes #1205.
2023-02-16 06:35:33 +01:00
Alexei Podtelezhnikov dacbb55433 [type1/MM] Round design coordinates.
The design coordinates for MM fonts were not rounded. For example,
`FT_Get_Var_Design_Coordinates` returned values with fractional part.

* src/type1/t1load.c (mm_axis_unmap): Refactor with rounding.

* include/freetype/ftmm.h (FT_Var_Axis, FT_Set_Var_Design_Coordinates,
FT_Get_Var_Design_Coordinates): Reword documentation.
2023-02-10 08:24:33 -05:00
Jan Alexander Steffens (heftig) 23e60caeef * builds/meson/parse_modules_cfg.py: Handle `gxvalid` and `otvalid`.
These need a name mapping similar to what was done for other modules,
or linking will fail.
2023-02-09 21:49:34 +01:00
Werner Lemberg 79a8201e6e * build/toplevel.mk (do_dist): Fix typo. 2023-02-09 07:32:05 +01:00
Werner Lemberg de8b92dd7e * Version 2.13 released.
==========================

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

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

* README, src/base/ftver.rc, builds/windows/vc2010/index.html,
builds/windows/visualc/index.html, builds/windows/visualce/index.html,
builds/wince/vc2005-ce/index.html, builds/wince/vc2008-ce/index.html,
docs/freetype-config.1: s/2.12.1/2.13/, s/2121/2130/.

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

* builds/unix/configure.raw (version_info): Set to 25:0:19.
* CMakeLists.txt (VERSION_MINOR): Set to 13.
(VERSION_PATCH): Set to 0.
2023-02-09 07:24:52 +01:00
Alexei Podtelezhnikov 4f8c4b0fc4 Comment on `FT_GlyphSlot_Slant'. 2023-02-09 03:59:30 +00:00
Werner Lemberg 995ccfaca5 [autofit] Fix 'multi' compilation.
* src/autofit/ft-hb.c: Decorate with `FT_LOCAL_DEF`.
Add ANSI boilerplate code for otherwise empty file.
* src/autofit/ft-hb.h: Include `compiler-macros.h` and `freetype.h`.
Use `FT_BEGIN_HEADER` and `FT_END_HEADER`.
Decorate with `FT_LOCAL`.

* src/autofit/rules.mk (AUTOF_DRV_SRC): Add `ft-hb.c`.
2023-02-08 21:53:30 +01:00
Werner Lemberg 663486a7ac Fix `FT_LOCAL` and `FT_LOCAL_DEF` tags. 2023-02-08 21:09:32 +01:00
Werner Lemberg ac5babe876 Fix 'fall-through' warning messages.
Modern compilers get more insistent on that...

* include/freetype/internal/compiler-macros.h (FALL_THROUGH): Define.
* src/*: Use it instead of `/* fall through */` comments.
2023-02-08 21:09:32 +01:00
Werner Lemberg be724c8142 For debugging, avoid implicit conversion from integer to double.
Otherwise we get zillions of clang 15 warnings.

* src/autofit/afcjk.c, src/autofit/afhints.c, src/autofit/aflatin.c,
src/base/ftobjs.c, src/base/ftoutln.c, src/cff/cffparse.c,
src/raster/ftraster.c, src/sfnt/pngshim.c, src/truetype/ttgload.c,
src/truetype/ttgxvar.c, src/truetype/ttobjs.c, src/type1/t1gload.c: Use
`double` cast in debugging and tracing macros.
2023-02-08 21:09:32 +01:00
Werner Lemberg 37bc7c2604 Avoid reserved identifiers that are globally defined.
This is mandated by the C99 standard, and clang 15 produces zillions of
warnings otherwise.

* devel/ftoption.h, include/freetype/config/ftoption.h,
include/freetype/internal/ftmemory.h, src/autofit/afhints.h,
src/autofit/afmodule.c, src/autofit/aftypes.h, src/base/ftadvanc.c,
src/base/ftdbgmem.c, src/base/ftstream.c, src/bdf/bdflib.c,
src/truetype/ttinterp.c: Replace identifiers of the form `_foo` with `foo_`.
2023-02-08 21:09:30 +01:00
Werner Lemberg da9eb9c719 Fix minor clang and clang++ warnings. 2023-02-08 19:57:22 +01:00
Alexei Podtelezhnikov 4c3916e901 [truetype, type1] Additional variation tags.
Sync with
  https://learn.microsoft.com/en-us/typography/opentype/spec/dvaraxisreg#registered-axis-tags

* src/truetype/ttgxvar.h (TTAG_ital): New tag.
* src/truetype/ttgxvar.c (TT_Get_MM_Var): Use it.
* src/type1/t1load.c (T1_Get_MM_Var): Handle 'slnt' and 'ital'.
2023-02-08 14:58:46 +00:00
Alexei Podtelezhnikov 27b2cd4101 * src/base/ftsynth.c (FT_GlyphSlot_Slant): Add vertical slant.
* include/freetype/ftsynth.h (FT_GlyphSlot_Slant): Update it.
2023-02-07 23:03:18 -05:00
anuj 515bdfef7e [sdf] Use 32-bit integers internally.
* src/sdf/ftsdfcommon.h (FT_16D16, FT_26D6): Use 32-bit integers
  instead of `FT_Fixed` for internal data types. `FT_Fixed` i.e.
  `signed long` is 64-bit on some architectures.
2023-02-07 23:03:23 +00:00
Werner Lemberg d3582e3f8d docs/CHANGES: Updated. 2023-02-07 05:56:12 +01:00
Alexei Podtelezhnikov beb2272949 Comment on optional ascender and descender. 2023-02-04 09:47:44 -05:00
Alexei Podtelezhnikov 1bbec9e993 * src/type1/t1afm.c (T1_Read_Metrics): Reaffirm ascender and descender. 2023-02-04 08:34:58 -05:00
Alexei Podtelezhnikov 82c131accb * src/type1/t1afm.c (T1_Read_Metrics): Validate ascender and descender.
The ascender and descender are optional in the AFM specifications.
They could be omitted or even set to zero, e.g., in the current release
of URW++ base 35 fonts.
2023-02-04 03:20:25 +00:00
Werner Lemberg 646cc8ef8d * src/cff/cffgload.c (cff_slot_load): Avoid memory leak.
Fixes issue #1204.
2023-02-02 10:51:39 +01:00
Werner Lemberg 9508811a3a * src/truetype/ttgxvar.c (tt_var_get_item_delta): Check `face->blend`.
Reported as

  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=55581
2023-02-01 12:01:58 +01:00
Werner Lemberg aec87c0955 * docs/CHANGES: Add news for 'freetype-demos'. 2023-02-01 11:52:26 +01:00
Werner Lemberg 9c23b89d54 * subprojects/harfbuzz.wrap, subprojects/libpng.wrap: Updated. 2023-01-30 17:16:34 +01:00
Werner Lemberg e97544a739 Minor changes.
Comment fixes, typos, removing of unnecessary parentheses.
2023-01-28 17:04:38 +01:00
Werner Lemberg bacc48e616 Whitespace. 2023-01-28 17:04:11 +01:00
Behdad Esfahbod bea675cde6 [ttgxvar] Fix crash in COLRv1.
This is a stopgap until issue #1202 is properly fixed.

* src/truetype/ttxgvar.c (tt_var_get_item_delta): Check `normalizedcoords`.
2023-01-27 06:53:46 +01:00
Werner Lemberg 82ce172669 The 'COLR' v1 API will no longer be experimental in the next release. 2023-01-19 07:17:14 +01:00
Alexei Podtelezhnikov 0982d3ecc6 * docs/oldlogs/ChangeLog.210: Typos. 2023-01-18 18:31:27 +00:00
Ben Wagner d680908af2 [base] Fix typo.
* src/base/ftobjs.c (open_face_PS_from_sfnt_stream): Request module 't1cid',
not 'cid'.
2023-01-18 09:00:21 +01:00
Ben Wagner 188019eb70 [base] Return error if requested driver is not found.
In `open_face_from_buffer` it is possible that a driver is requested but
FreeType was built without the requested module.  Return an error in this
case to indicate that the request could not be satisfied, rather than trying
all existing driver modules.

* src/base/ftobjs.c (open_face_from_buffer): Return `FT_Err_Missing_Module`
if a driver is specified but not found.
2023-01-18 08:37:51 +01:00
Dominik Röttsches a297feab0e [sfnt] Avoid nullptr dereference in reading malformed 'COLR' v1 table.
Fixes https://bugs.chromium.org/p/chromium/issues/detail?id=1408044.

* src/sfnt/ttcolr.c (tt_face_load_colr): When the 'COLR' v1 table header is
too small, don't deallocate delta set index map structures.
2023-01-18 08:22:53 +01:00
Werner Lemberg f80be4e959 * src/tools/update-copyright: Allow execution from other repositories.
We use this for `freetype-demos`.
2023-01-17 19:03:45 +01:00
Werner Lemberg 65f8523706 Update all copyright notices. 2023-01-17 09:18:25 +01:00
Werner Lemberg 6c1bd0f2b2 * src/tools/no-copyright: Updated. 2023-01-17 09:15:36 +01:00
Ben Wagner 29f83d1dd5 [base] 'close' callback may not use `stream->memory`.
The documentation for `FT_StreamRec::memory` states that it 'shouldn't be
touched by stream implementations'.  This is true even for internal
implementations of the 'close' callback, since it is not guaranteed that
`memory` will even be set when the 'close' callback occurs.

* src/base/ftobjs.c (new_memory_stream): stash current `memory` in
`stream->descriptor`.
(memory_stream_close): Use it.
2023-01-17 08:59:25 +01:00
Ben Wagner 0d4f887c79 [base] Always close user-provided stream.
The `FT_Open_Face` documentation states

> If `FT_OPEN_STREAM` is set in `args->flags`, the stream in `args->stream`
> is automatically closed before this function returns any error (including
> `FT_Err_Invalid_Argument`).

However, if the user provides a stream in `args.stream` with
`FT_OPEN_STREAM` set and a `close` function, but then for some reason passes
NULL for `aface` and a non-negative `face_index`, the error
`Invalid_Argument` is returned but the `close` callback will not be called
on the user-provided stream.  This may cause resource leaks if the caller is
depending on the `close` callback to free resources.

The difficulty is that a user may fill out a `FT_StreamRec` and pass its
address as `args.stream`, but the stream isn't really 'live' until
`FT_Stream_New` is called on it (and `memory` is set).  In particular, it
cannot really be cleaned up properly in `ft_open_face_internal` until the
stream pointer has been copied into the `stream` local variable.

* src/base/ftobj.c (ft_open_face_internal): Ensure that user-provided
`args.stream.close` is called even with early errors.
2023-01-17 08:54:11 +01:00
Ben Wagner 13983b058e [base] Fix leak of internal stream marked external.
`open_face_from_buffer` allocates a new `FT_Stream` to pass to
`ft_open_face_internal`.  Because this is an `FT_OPEN_STREAM`,
`ft_open_face_internal` will mark this as an 'external stream', which the
caller must free.  However, `open_face_from_buffer` cannot directly free it
because the stream must last as long as the face.  There is currently an
attempt at this by clearing the 'external stream' bit after
`open_face_from_buffer` returns successfully.  However, this is too late as
the original stream may have already been closed and the stream on the face
may not be the same stream as originally passed.

It is tempting to use `FT_OPEN_MEMORY` and let `ft_open_face_internal`
create the stream internally.  However, with this method there is no means
to pass through a 'close' function to the created stream to free the
underlying data, which must be owned by the stream.

A possibility is to check on success if the stream of the face is the same
as the original stream.  If it is then unset the external flag.  If not,
then free the original stream.  Unfortunately, while no current
implementation does so, it is possible that the face still has the original
stream somewhere other than as the `FT_FaceRec::stream`.  The stream needs
to remain available for the life of the face or until it is closed,
whichever comes earlier.

The approach taken here is to let the stream own itself.  When the stream is
closed it will free itself.

* src/base/ftobjs.c (memory_stream_close): Free `stream`.
(open_face_from_buffer): Simplify error handling, since
`ft_open_face_internal` always closes `args.stream` on any error.

Fixes: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=54930
2023-01-17 08:48:33 +01:00
Werner Lemberg 6a179ff7d5 sr/*.c: Various minor fixes.
* src/autofit/ft-hb.c (_hb_ft_reference_table): Call `FT_UNUSED` after
variable declarations.

* src/gxvalid/gxvjust.c (gxv_just_widthDeltaClusters_validate): Eliminate
unused variable.

* src/gzip/ftgzip.c: Don't call GCC '-Wstrict-prototypes' pragma for C++
compiler.

* src/sfnt/ttcolr.c (ENSURE_READ_BYTES): Remove final semicolon to avoid
compiler warning.

* src/sfnt/ttsvg.c (tt_face_load_svg_doc): Fix signedness warning.
2023-01-16 16:38:56 +01:00
Dominik Röttsches 2692b3215b [sfnt] Remove temporary runtime flag for variable 'COLR' v1.
Fixes #1187.

* src/sfnt/ttcolr.c (top level, read_paint, tt_face_load_colr,
tt_face_free_colr, get_deltas_for_var_index_base,
tt_face_get_color_glyph_clipbox, tt_face_get_colorline_stops): Remove macro
definition `VARIABLE_COLRV1_ENABLED` and its usage.

* src/truetype/ttdriver.c (tt_property_set): Remove parsing of
'TEMPORARY-enable-variable-colrv1' property name.

* src/truetype/ttobjs.h (TT_DriverRec): Remove `enable_variable_colrv1`
flag.
2023-01-16 14:02:36 +01:00
Werner Lemberg b1c90733ee * src/autofit/ft-hb.c (_hb_ft_reference_table): Minor integration fixes. 2023-01-07 07:41:31 +01:00
Ben Wagner 3481b15443 [truetype] Reset cvt and storage in context load.
Currently the cvt and storage are saved and restored in `TT_RunIns`.
However, this is too granular as the cvt and storage area should be set to
the original cvt and storage area only when setting up the hinting context.
This allows for the cvt and storage area to be modified while parsing
multiple glyphs, as is the case with composite glyphs.

* src/truetype/ttinterp.h (TT_ExecContextRec): Remove `origCvt` and
`origStorage`.

* src/truetype/ttinterp.c (TT_RunIns): Don't save and restore the cvt and
storage area.
(Modify_CVT_Check, Ins_WS): Switch from "if in glyph and using original data
do copy on write" to "if in glyph and not using glyph specific data do copy
on write".
2023-01-07 07:28:04 +01:00
Matthias Clasen ebe7e9128c [autofit] Don't depend on 'hb-ft'.
The circular dependency is still there, but at least we no longer depend on
the HarfBuzz API that is only present if HarfBuzz has been built with
FreeType support, making the bootstrapping a bit easier.

* src/autofit/ft-hb.c, src/autofit/ft-hb.h: New files, providing
`_hb_ft_font_create`, which is more or less a verbatim copy of the
corresponding HarfBuzz code from file `hb-ft.cc`.

* src/autofit/afglobal.c (af_face_globals_new): Use it.
* src/autofit/afshaper.h: Don't include `hb-ft.h` but `ft-hb.h`.
* src/autofit/autofit.c: Include `ft-hb.c`.

* LICENSE.TXT: Updated.
2023-01-06 12:54:17 +01:00
Ben Wagner 262b47ac5a [truetype] Keep variation store consistent.
`tt_var_load_item_variation_store` fills out a `GX_ItemVarStore`.  While it
may return an error, the item store must be left in a consistent state so
that any use or destruction of the item store can properly use or free the
data in it.  Before this change the counts from the font data were read
directly into the item store before the actual allocation of the arrays to
which they referred.  There exist many opportunities between the time the
counts are read and the arrays are allocated to return early due to invalid
data.  When this happened the item store claimed to have entires it actually
did not, leading to crashes later when it was used.

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

* src/truetype/ttgxvar.c (tt_var_load_item_variation_store): Read the counts
into local variables and store them in the item store only after the related
arrays are actually created on the item store.
2023-01-06 07:11:41 +01:00
Ben Wagner 15afb55458 [base] Report used stream's external status.
In `open_face` the initial stream is set on the face, along with the
information about if FreeType is the owner of the stream object itself.  The
loaders may in the course of their work replace this stream with a new
stream (as is the case for 'woff' and 'woff2'), which may have a different
ownership than the initial stream object (likely the original stream object
is owned by the user and is external, while the new stream object is created
internally to FreeType and is internal).  When the stream is replaced, the
face's flags are updated with the new ownership status.

However, `open_face` cannot itself free this stream as its caller
`ft_open_face_internal` is responsible for this.  In addition, in the case
of an error `open_face` cannot return an actual face with the new stream and
its ownership status to the caller.  As a result, it must pass this
information back to the caller as a sort of "failed face" so that the caller
can clean up.

`open_face` was already passing back the new stream but was not passing back
the stream ownership information.  As a result the stream may not have been
free'd when needed.

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

* src/base/ftobjs.c (open_face): Pass back the ownership information as
well.
(ft_open_face_internal): Updated.
2023-01-05 22:05:02 +01:00
Noah Cabral c0b4f6a862 fix spelling err in LICENSE.txt 2023-01-05 14:58:51 +01:00
Dominik Röttsches 63f371367a [sfnt] Fix color stop bounds check calculation at table end.
Fixes https://bugs.chromium.org/p/skia/issues/detail?id=14021

* src/sfnt/ttcolr.c (VAR_IDX_BASE_SIZE): New macro.
(tt_face_get_colorline_stops): Fix off-by-one bounds check calculation, take
`VarColorStop` into account, and hopefully make it easier to read.
2023-01-05 09:35:32 +01:00
Alexei Podtelezhnikov 81a456b28f * src/base/ftobjs.c (FT_Request_Metrics): Avoid division by zero.
The division-by-zero might happen in broken fonts (see #1194).
Instead of returning a huge number from FT_DivFix and failing
to scale later, we now bail immediately.
2023-01-04 22:41:34 -05:00
Alexei Podtelezhnikov 0bcb664de8 [psaux] Delay the upem validity assertion.
Fixes #1194.

* src/psaux/psft.c (cf2_getUnitsPerEm): Remove the upem assert.
(cf2_checkTransform): Assert the upem validity after checking the scale.
2022-12-20 16:38:39 +00:00
David Vanderson ace97a02a4 [gzip] Make static compilation not leak global symbols.
* src/gzip/ftgzip.c (HAVE_HIDDEN): Do not define; it is no longer needed
because everything is static.
(HAVE_MEMCPY): Define.
(zcalloc, zcfree): Remove no longer needed definitions (because `Z_SOLO` is
active).

* src/gzip/patches/freetype-zlib.diff: Regenerated.

Fixes #1146.

Co-authored-by: Werner Lemberg <wl@gnu.org>
2022-12-14 10:44:03 +01:00
Werner Lemberg bc3aa767a7 * src/gzip/ftzconf.h: Updated to zlib 1.2.13.
I forgot to copy that file.
2022-12-14 10:32:53 +01:00
Werner Lemberg 30d4863781 * builds/unix/configure.raw: Don't check for `memcpy` and `memmove`.
We expect a C99 compiler, and both functions are part of this standard.
2022-12-14 09:19:26 +01:00
Werner Lemberg 26e9028f10 [sdf, sfnt] Handle minor compiler warnings.
* src/sdf/ftsdf.c (get_min_distance_conic): Initialize `nearest_point`.

* src/sfnt/ttsvg.c (find_doc): Initialize `mid_doc`.

Fixes #1195.
2022-12-13 09:53:26 +01:00
Werner Lemberg b405fc5c1d * subprojects/zlib.wrap: Micro-update from upstream. 2022-12-07 17:05:17 +01:00
Jiří Malák 34c1bb66e4 * include/freetype/internal/ftcalc.h (FT_MSB): Support Open Watcom 2.0.
Closes !232.
2022-12-06 10:21:53 -05:00
Luca Bacci aca4ec5907 * src/base/ftdbgmem.c (ft_mem_source_compare): Add FT_COMPARE_DEF.
Closes !230.
2022-11-22 22:34:41 -05:00
Alexei Podtelezhnikov 1c44de209c * src/autofit/afloader.c (af_loader_load_glyph): Remove `size` check.
This is done by `FT_Load_Glyph`.
2022-11-20 22:37:08 -05:00
Alexei Podtelezhnikov 4e6906cc5d Comments added. 2022-11-18 14:03:19 +00:00
Johan Matsson 0f43a0e7eb * src/autofit/afloader.c (af_loader_load_glyph): Fix dereference.
This must happen after the NULL check.

Taken from

  https://github.com/freetype/freetype/pull/2
2022-11-16 07:54:39 +01:00
Alexei Podtelezhnikov 47e61d02e6 * src/pcf/pcfutil.c ({Two,Four}ByteSwap): Use builtins or shifts.
We trust glibc which uses shifts or builtins to swap bytes.  This
must be more efficient.
2022-11-14 22:53:14 -05:00
Werner Lemberg e6fda039ad * src/truetype/ttgxvar.c (tt_hvadvance_adjust): Integer overflow.
Reported as

  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=50462
2022-11-14 19:18:19 +01:00
Loïc Yhuel 63ccaef07a [meson] Use generated ftmodule.h
ftmodule.h is generated at the root of the build directory, but FT_CONFIG_MODULES_H
(freetype/config/ftmodule.h) is used instead.
This makes the build fail when disabling modules in modules.cfg.

* meson.build (harfbuzz_dep): Add '-DFT_CONFIG_MODULES_H=<ftmodule.h>'.
2022-11-14 14:43:04 +01:00
Loïc Yhuel b37b8d2a70 [meson] Fix generated ftmodule.h
The sdf module wasn't recognized, so the generated ftmodule.h had "None_renderer_class".

* builds/meson/parse_modules_cfg.py: Handle sdf in RASTER_MODULES.
2022-11-14 14:43:04 +01:00
Dominik Röttsches ba4bd5b994 Add `TT_CONFIG_OPTION_NO_BORING_EXPANSION` configuration macro.
This gives users a possibility to deactivate new features not (yet) in the
OpenType standard.

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

* src/truetype/ttgxvar.c (ft_var_load_avar): Use it to disable 'avar'
version 2.0 support.
2022-11-12 17:11:36 +01:00
Behdad Esfahbod e97cb9e8da [truetype] Improve bounds checks for `ItemVariationStore`.
* src/truetype/ttgxvar.c (tt_hvadvance_adjust): Move bounds check ...
(tt_var_get_item_delta): ...  to this function, because it is safer.  For
example, the 'avar' table 2.0 codepath was not performing a bounds check at
all.
2022-11-12 16:45:44 +01:00
Behdad Esfahbod 9be958ca39 [truetype] In `ItemVariationStore`, value 0xFFFF for `dataCount` is valid.
It corresponds to outer indices of 0 to 0xFFFE.

* src/truetype/ttgxvar.c (tt_var_load_item_variation_store): Remove invalid
code.
2022-11-12 16:41:20 +01:00
Alexei Podtelezhnikov 109179c70e [pcf] Improve CMap efficiency and readability.
* src/pcf/pcfdrivr.c (pcf_cmap_char_{index,next}): Check and walk
the encoding array indexes.
2022-11-10 23:25:48 -05:00
Sam James e82371bf6e Fix `-Wstrict-prototypes`.
* builds/unix/configure.raw: Fix `-Wstrict-prototypes`.
Clang 16 warns on these and they will be dropped in C23.

* builds/unix/freetype2.m4: Ditto.

Signed-off-by: Sam James <sam@gentoo.org>
2022-11-10 05:38:55 +01:00
Ben Wagner 9154707f6b [truetype] Check avar_segment before access
* src/truetype/ttgxvar.c (tt_done_blend): check `avar_segment` before
accessing to free its `correspondence`.

Reported as:

  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=53062
2022-11-09 19:15:26 +00:00
Ben Wagner d38407f79e [truetype] Restore behavior of ft_var_load_hvvar
* src/truetype/ttgcvar.c (ft_var_load_hvvar): restore previous behavior

In a previous change [0] the behavior of `ft_var_load_hvvar` was changed
to not load the item variation store if it was at offset 0, but not
return an error when this happened. This broke any users, like
`tt_hvadvance_adjust`, that rely on successful completion of
`ft_var_load_hvvar` to imply that returned table's `itemStore` had been
initialized. This lead such users to dereference NULL.

This change appears to have been unintentional and unrelated to the
actual avar2 changes. As a result, fix these NULL dereferences by
restoring the code to always attempt to initialize the `itemStore`.

[0] ae4eb996 "[truetype] Add support for `avar` table 2.0 format."

Reported as

  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=53061
2022-11-09 19:02:22 +00:00
Werner Lemberg 978fdb292a docs/CHANGES: Updated. 2022-11-08 08:27:52 +01:00
suzuki toshiya bccf1cd6b4 [build] use AC_CHECK_PROG() macro for libpng-config detection
* builds/unix/configure.raw: use AC_CHECK_PROG() instead of `which` to find `libpng-config`.
2022-11-08 14:31:23 +09:00
suzuki toshiya 32cfab4be7 [build] fix for make multi
Fix "make multi" by MR !223

* include/freetype/internal/services/svmm.h: include ftmm.h to define FT_Get_MM_Func.
* src/truetype/ttgxvar.h: include ftmmtypes.h to use GX_AVarTable properly.
* src/base/ftmac.c: include ftdebug.h to use FT_THROW() properly.
2022-11-08 14:23:37 +09:00
Alexei Podtelezhnikov e00afdb35b * src/pfr/pfrsbit.c (pfr_lookup_bitmap_data): Accelerate the search.
This is mostly for consistency because PFR fonts with bitmap strikes
do not seem to exist.
2022-11-07 21:36:32 -05:00
Alexei Podtelezhnikov 6139f2b647 [bdf, pfr, psnames] Accelarate charmap searches.
The binary searches within charmaps can be accelerated because they
often contain dense continuous blocks of character codes. Within such
blocks, you can predict matches based on misses.  This method has been
deployed in `bdf` since 0f122fef34; we only refactor it there.  We now
use it in `pfr` and `psnames`, which speeds up the unicode charmap
access by about 50% in PFR and Type 1 fonts.

* src/bdf/bdfdrivr.c (bdf_cmap_char_{index,next}): Refactor.
* src/pfr/pfrcmap.c (pfr_cmap_char_{index,next}): Predict `mid` based
on the mismatch distance.
* src/psnames/psmodule.c (ps_unicodes_char_{index,next}): Ditto.
2022-11-06 13:12:47 -05:00
Behdad Esfahbod ae4eb996ab [truetype] Add support for `avar` table 2.0 format.
See

  https://github.com/harfbuzz/boring-expansion-spec/blob/main/avar2.md

for the specification.

Currently, this is implemented only in most recent OS versions on Apple
platforms and in the HarfBuzz library, but it is expected to be added to the
OpenType standard soon.

* src/truetype/ttgxvar.h (GX_AVarTableRec): New structure.
(GX_BlendRec): Use it to replace `avar_segment` with `avar_table`.

* src/truetype/ttgxvar.c (ft_var_load_avar): Load new table version.
(ft_var_to_normalized, tt_done_blend): Extend for new format.
(ft_var_load_hvvar, ft_var_to_design): Updated.
2022-11-04 19:44:36 +01:00
Werner Lemberg dea2e6358b Replace '1/64th' (and similar entries) with '1/64' in docs and comments. 2022-10-24 07:01:21 +02:00
Ivan Panchenko 05e1b37e3d * include/freetype/*: Fix documentation typos. 2022-10-24 06:52:06 +02:00
Alexei Podtelezhnikov ffbbf3df3e * src/truetype/ttgload.c: Cosmetic changes. 2022-10-21 15:55:30 +00:00
Alexei Podtelezhnikov 1bfaca0635 [cff, truetype] Simplify SVG metrics scaling.
Use pre-calculated scaling factors. Also, the advance widths used
to be rounded, which was incorrect.

* src/cff/cffgload.c (cff_slot_load): Use `x_scale` and `y_scale`.
* src/truetype/ttgload.c (TT_Load_Glyph): Ditto.
2022-10-21 12:14:52 +00:00
Werner Lemberg 0ec85f71a8 * subprojects/zlib.wrap: Update to zlib version 1.2.13. 2022-10-20 13:55:41 +02:00
Dominik Röttsches 0b62c1e43d [sfnt] Additional bounds checks for `COLR` v1 table handling.
* src/sfnt/ttcolr.c (read_paint): Add `colr` argument, necessary for...
... another use of `ENSURE_READ_BYTES`.
Update callers.
(tt_face_get_paint_layers): Ensure that the 4-byte paint table
offset can be read.

This is a follow-up to !124 and issue
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=52404
2022-10-18 19:55:25 +02:00
Werner Lemberg af46fcc15a [gzip] Update sources to zlib 1.2.13. 2022-10-18 19:43:52 +02:00
Alexei Podtelezhnikov b8882a3ed6 * src/sfnt/ttsbit.c (tt_face_load_strike_metrics): Simplify calculations. 2022-10-18 15:58:02 +00:00
Werner Lemberg c943d408e0 Minor formatting. 2022-10-18 11:41:00 +02:00
Dominik Röttsches 04272824e0 [sfnt] Guard individual `COLR` v1 paint field reads.
* src/sfnt/ttcolr.c (ENSURE_READ_BYTES): New macro.
(read_paint): Use it – after the start pointer `p` has been checked for
whether it allows reading the format byte, each successive paint table field
read need to be bounds-checked before reading further values.

Reported as

  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=52404
2022-10-18 08:37:05 +02:00
Xiang Xiao 8493877e78 * builds/toplevel.mk: Prefix all paths with `$(TOP_DIR)/`.
This is useful for builds that are not started from the root directory.

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-10-17 08:49:53 +02:00
Liu Kunpeng(柳鲲鹏) bb59c3c958 * src/base/ftsynth.c (FT_GlyphSlot_Slant): New API with custom slant.
* include/freetype/ftsynth.h (FT_GlyphSlot_Slant): Declare it.
2022-10-16 22:10:19 -04:00
Alexei Podtelezhnikov 3ab1875cd2 Note the lack of floating-point data types. 2022-10-14 22:06:23 -04:00
Werner Lemberg 5182264a40 [cff] Remove `FT_CONFIG_OPTION_NO_GLYPH_NAMES`.
This ancient option stayed completely undocumented.  Given that the 'cff'
driver requires the 'psnames' module, it makes no sense today to have this
macro.

* src/cff/cffdrivr.c (cff_services), src/cff/cffobjs.c (cff_face_init):
Remove corresponding conditional code.
2022-10-10 12:41:49 +02:00
Werner Lemberg 0d66abca4b Synchronize `ftoption.h` flavours. 2022-10-10 12:41:19 +02:00
Werner Lemberg 141d979af7 Minor comment changes. 2022-10-10 12:25:51 +02:00
Alexei Podtelezhnikov 15f6873495 Improve FT_Get_Name_Index docs and place it next to FT_Get_Glyph_Name. 2022-10-04 23:36:09 -04:00
Alexei Podtelezhnikov 0417527d5b [autofit] Reset the face charmap directly.
There is no need to validate the original charmap in `FT_Set_Charmap`.
It can be reset directly.

* src/autofit/afglobal.c (af_face_globals_compute_style_coverage):
Use direct assignment.
* src/autofit/af{latin,cjk,indic}.c (af_latin_metrics_init): Ditto.
2022-10-03 19:23:26 -04:00
Alexei Podtelezhnikov 1b6dce84f9 * src/type1/t1afm.c (T1_Read_PFM): Set charmaps directly.
As with the previous commit, we can avoid the validation checks
of `FT_Set_Charmap` and set it directly when choosing from the
available list.
2022-10-03 19:18:48 -04:00
Alexei Podtelezhnikov 8faf57dd17 * src/cache/ftccmap.c (FTC_CMapCache_Lookup): Avoid `FT_Set_Charmap`.
Set charmap aggressively without all validations of `FT_Set_Charmap`
because we take it from the available array and only temporarily.
Even CMap Format 14 will gracefully return 0.
2022-10-03 17:13:30 +00:00
Alexei Podtelezhnikov b93f20ab7a * src/cache/ftcbasic.c (ftc_basic_family_get_count): Remove redundancy. 2022-10-03 15:10:12 +00:00
Werner Lemberg de8f14a8e4 * src/psaux/pshints.c (cf2_hintmap_insertHint): Fix midpoint computation.
Replace '(start + end) / 2' with 'start + (end - start) / 2' to avoid
overflow.

Fixes #1180.
2022-09-30 23:25:02 +02:00
Werner Lemberg 2adb810c3d * src/psaux/pshints.c (cf2_hintmap_build): Improve debugging output. 2022-09-30 17:00:10 +02:00
mlugg 905270925d [truetype] Fix undefined pointer arithmetic.
* src/truetype/ttgxvar.c (tt_var_get_item_delta, ft_var_load_mvar): Use
`FT_OFFSET`.
2022-09-29 20:44:41 +02:00
Alexei Podtelezhnikov ff66e912d0 * src/sfnt/ttsbit.c (tt_face_load_strike_metrics): Use lighter FT_DivFix. 2022-09-29 17:46:23 +00:00
Ali Chraghi 5faa1df8b9 [base] FT_Attach_Stream: Make `parameters` argument constant. 2022-09-29 19:30:20 +02:00
Azamat Hackimov 3f3427c6f3 * src/tools/*.py: Migrate to Python 3.
Fixes #1185, closes !205. Formatting changes according to PEP8.
2022-09-28 22:35:49 -04:00
Dominik Röttsches df2601395f [sfnt] Guard access in 'COLR' table when requesting child table pointer.
* src/sfnt/ttcolr.c (tt_face_get_colorline_stops, read_paint): Tighten
pointer bounds checks.
(get_child_table_pointer): Check whether incoming pointer `p` lies within
the 'COLR' table.

Reported as

  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=51816
2022-09-27 18:18:59 +02:00
Ben Wagner bd41700773 [sfnt] Add SVG document bounds checking.
Add a check that the document content is actually contained within the
`SVG ` table.  Without this check a malformed font may claim arbitrary
memory as its document content.

* src/sfnt/ttsvg.c (tt_face_load_svg): Take `numEntries` into account when
testing 'documentRecord' extents.
(find_doc): Rename `stream` to `document_records` for clarity.
(tt_face_load_svg_doc): Split `doc` from `doc_list` pointer for clarity.
Test that the document content is contained within the table.
Ensure minimum length of document before testing for gzip format.

Reported as

  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=51812
2022-09-27 07:31:32 +02:00
Alexei Podtelezhnikov c9c326312f [base] Clean up the bitmap flow control.
* src/base/ftbitmap.c (FT_Bitmap_Copy): Flip the copy if its pitch
is trully opposite, zero is not a positive value.
(FT_Bitmap_Convert): Set negative pitch as needed, accept negative
alignment values.
2022-09-22 20:40:21 -04:00
Alexei Podtelezhnikov c456eeb47a [base] Discard and recreate bitmaps for copying and converting.
Reusing target bitmaps for copying and converting is permitted.  It is,
however, pointless to preserve their content before overwriting.  Free-
malloc might be faster than realloc.

* src/base/ftbitmap.c (FT_Bitmap_Copy, FT_Bitmap_Convert): Free
an old buffer and create a new one.
2022-09-22 15:09:17 +00:00
Dominik Röttsches 33ceac2afc Reject 'COLR' table if version is 1 but header too small.
* src/sfnt/ttcolr.c (tt_face_load_colr): If the version is determined to
be 1, then the table size has to be at least the size of the v1 header.
Also, for peeking the number of base glyphs and entries in the layer list,
ensure that the table is sufficiently long.

Fixes #1179.  Original patch by Sergey Temnikov.
2022-09-16 18:55:24 +02:00
Werner Lemberg a0d1536452 * src/otvalid/otvgsub.c (otv_SingleSubst_validate): Fix format 1 handling.
Fixes #1181.
2022-09-15 09:14:06 +02:00
Dominik Röttsches 8e68439a6f [truetype] Reject 'fvar' loading when `num_instances` is too small.
* src/truetype/ttgxvar.c (TT_Get_MM_Var): Reject retrieving master when
'fvar' values locally do not match with sanitized values from initialization
at `sfnt_init_face` time.

Reported as

  https://bugs.chromium.org/p/chromium/issues/detail?id=1360295
2022-09-06 17:18:17 +02:00
Dominik Röttsches 91a7fae777 [sfnt] Handle variable `COLR` v1 fonts without delta set index map
Fixes #1178.

* src/sfnt/ttcolr.c (get_deltas_for_var_index_base): Set outer index to
0 and inner index to the delta index when retrieving deltas if the
`COLR` table has no delta set index map.
2022-09-05 15:52:58 +02:00
Dominik Röttsches 6d62076ae5 [sfnt] Pointer sanity checks before reading layer info in 'COLR' v0
* src/sfnt/ttcolr.c (tt_face_get_colr_layer): Check that the pointer to
read from is within the 'COLR' table.

Reported as

  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=50633
2022-09-05 12:23:31 +02:00
Werner Lemberg 048f2e247c [autofit] Minor fix.
* src/autofit/afglobal.c (af_face_globals_compute_style_coverage): Avoid
compiler warning.
2022-09-05 10:43:59 +02:00
Dominik Röttsches a1017e2655 [sfnt] Don't require 'gvar' table to support variation fonts.
Fixes #1172.

* src/sfnt/sfobjs.c (sfnt_load_face): Tag font as Multiple Masters font if
`fvar` is present; do not require other tables to be present.

* src/truetype/ttgxvar.c (tt_set_mm_blend): Allow for a missing 'gvar' table
when setting variation coordinates.  However, if a 'gvar' table is actually
present, do perform a sanity check and fail on malformedness.
(TT_Get_MM_Var): Don't assume 'fvar' needs 'gvar' or 'CFF2 tables in all
cases, which is an overly tight check.
2022-09-05 10:36:22 +02:00
Alexei Podtelezhnikov dd91f6e7f5 * src/base/ftver.rc: Explicitly use UTF-16.
Fixes #1177 to avoid mistranslation and other problems.
2022-08-26 22:24:02 -04:00
Dominik Röttsches 4797b2ff22 [sfnt] Avoid undefined shifts in `COLR` v1 color line retrieval
* src/sfnt/ttcolr.c (tt_face_get_colorline_stops): Disambiguate shift
behavior by using multiplication using macros from ftcalc.h.

Fixes: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=50573
2022-08-26 12:08:34 +03:00
Sean Farrell 395da3d72a CMakeLists.txt (FT_ENABLE_ERROR_STRINGS): New configuration option.
This option uncomments FreeType configuration macro
`FT_CONFIG_OPTION_ERROR_STRINGS` to make function `FT_Error_String` return
meaningful error strings.

This option is off by default.
2022-08-21 19:58:35 +02:00
Chris Liddell 37b718d589 [base, type1] Better handling of out-of-memory situations.
This follows similar code in `cff_slot_done`.

* src/base/ftobjs.c (ft_glyphslot_done), src/type1/t1objs.c
(T1_GlyphSlot_Done): Check `internal` pointer.

The Type1 problems was reported as

  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=50057.
2022-08-21 19:41:45 +02:00
Tim-Philipp Müller 7cd3f19f21 ci: bump windows image and use newer runner and vs2019
The old 1809 runner will be decommissioned at some point.
2022-08-06 11:52:32 +00:00
@udoudou 90e1e39f50 * src/cache/ftcmanag.c (FTC_Manager_New): Initialize `cur_weight`.
See !192.
2022-08-03 22:54:38 -04:00
Alexei Podtelezhnikov dcb5fc5bcd * src/sfnt/ttload.c: Trace formatting updates. 2022-08-02 17:10:25 +00:00
Alexei Podtelezhnikov d53c114165 * src/psaux/psobjs.c (ps_table_release): Remove redundant casting. 2022-08-02 12:57:39 +00:00
Alexei Podtelezhnikov 480be443b7 * src/base/ftobjs.c (Mac_Read_sfnt_Resource): Reduce casting. 2022-08-01 22:59:58 -04:00
Alexei Podtelezhnikov 039b9071f3 [cache] Remove some casts, clean up tracing.
* src/cache/ftcbasic.c (FTC_ImageCache_Lookup, FTC_SBitCache_Lookup):
Clean up tracing types.
* src/cache/ftccache.c (ftc_node_destroy): Ditto.
* src/cache/ftcmanag.c (FTC_Manager_Check): Ditto.
(FTC_Manager_Check, FTC_Node_Unref): Remove a cast.
* src/cache/ftccmap.c (FTC_CMapCache_Lookup): Ditto.
2022-08-01 20:19:12 -04:00
Alexei Podtelezhnikov a18ad83e8b [autofit] Updated to reduce casting (cont'd).
* src/autofit/afmodule.h (AF_ModuleRec): Change `default_script` type.
* src/autofit/afglobal.c (af_face_globals_compute_style_coverage):
Remove casting.
* src/autofit/afmodule.c (af_property_{set,get}): Updated accordingly.
2022-08-01 13:20:13 -04:00
Alexei Podtelezhnikov 4f195185ee [autofit] Updated to reduce casting.
* src/autofit/afglobal.h (AF_FaceGlobalsRec): Change `glyph_count` type.
* src/autofit/afglobal.c (af_face_globals_compute_style_coverage,
af_face_globals_get_metrics, af_face_globals_is_digit,
af_face_globals_new): Changed local types and updated accordingly.
* src/autofit/aflatin.c (af_latin_metrics_init_blues): Ditto.
2022-08-01 09:52:43 -04:00
Alexei Podtelezhnikov 9de432f7f2 [psaux] Remove unused structure field.
* include/freetype/internal/psaux.h (PS_TableRec): Remove `num_elems`.
* src/psaux/psobjs.c (ps_table_new): Remoove its initialization.
2022-07-31 22:13:34 -04:00
Dominik Röttsches 919561ca8c [sfnt] Implement VarClipBox.
* src/sfnt/ttcolr.c (tt_face_get_color_glyph_clipbox): Depending on the
format, read `var_index_base`, then retrieve and apply scaled deltas.
2022-07-30 15:24:58 +02:00
Dominik Röttsches 649352ab73 [sfnt] Fix typo in clip box computation.
* src/sfnt/ttcolr.c (tt_face_get_color_glyph_clipbox): Use appropriate
scale factor for `yMin` and `yMax`.
2022-07-30 15:10:17 +02:00
Alexei Podtelezhnikov ee72e28503 [autofit] Use unsigned accounting for hints.
* src/autofit/afhints.h (AF_AxisHintsRec): Use unsigned types.

* src/autofit/afhints.c (af_axis_hints_new_{segment,edge},
af_glyph_hints_get_num_segments, af_glyph_hints_get_segment_offset):
Updated accordingly.
* src/autofit/aflatin.c (af_cjk_hints_compute_edges): Ditto.
* src/autofit/afcjk.c (af_cjk_hints_compute_edges): Ditto.
2022-07-29 22:55:28 -04:00
Alexei Podtelezhnikov fd02c369da * src/autofit/afhints.h: Remove dead code. 2022-07-29 22:54:38 -04:00
Werner Lemberg 2af6903b15 * src/base/ftglyph.c (FT_Get_Glyph): Set `*aglyph` to NULL in case of error. 2022-07-29 22:57:18 +02:00
Werner Lemberg a3749a64cd Fix compilation if `TT_CONFIG_OPTION_GX_VAR_SUPPORT` is not set.
* src/sfnt/ttcolr.c: Protect relevant code with
`TT_CONFIG_OPTION_GX_VAR_SUPPORT`.
2022-07-29 22:21:12 +02:00
Werner Lemberg 38dc768a42 Fix clang14 compiler warnings.
* include/freetype/internal/ftstream.h (FT_GET_SHORT_LE, FT_GET_USHORT_LE):
Fix type.

* src/sfnt/ttcolr.c (get_deltas_for_var_index_base): Always return boolean
value.
(tt_face_get_colorline_stops): Fix type of `var_index_base`.
2022-07-29 21:53:28 +02:00
Alexei Podtelezhnikov 284956b5b1 [pfr] Fortify the kerning code.
Any array index must be strictly less then the array size. Therefore,
we must reject indexes that are equal to the array size.  Alternatively,
we should move the bounds check before the index decrement but that
would be confusing.

In addition, it is ok to decrement zero (.notdef) and get UINT_MAX,
which is then automatically rejected in the bounds check.

* src/pfr/pfrobjs.c (pfr_face_get_kerning): Fix the bounds checking.
2022-07-26 12:23:15 -04:00
Werner Lemberg 182295cbcf [pfr] Add some safety guards.
* src/pfr/pfrload.c (pfr_phy_font_load): Check resolutions and number of
characters.

Fixes #1174.
2022-07-26 16:50:19 +02:00
Werner Lemberg 1f005c0918 * src/pfr/*.c: Trivial improvements and formatting. 2022-07-26 16:22:27 +02:00
Werner Lemberg 9a00282efc * configure: s/egrep/grep -E/
`egrep` is deprecated.
2022-07-24 19:49:56 +02:00
Ben Wagner 0417e54bec [base] Build outlines in amortized constant time.
When resizing the loader's points and contours, resize them to at least 1.5
times their current size.  The code currently only reserves as much space as
is currently required, leading to O(n^2) runtime when adding points one at a
time.

This change does not attempt to ever shrink the loader's point and contour
storage since this was not attempted previously either.  The 1.5 multiple
was chosen as a trade-off between potentially unused space and the runtime.

* src/base/ftgloader.c (FT_GlyphLoader_CheckPoints): Implement it.

Fixes #1173.
2022-07-23 23:30:22 +02:00
Dominik Röttsches 275b116b40 [sfnt] Support variable 'COLR' v1 `PaintVarSkew*`.
* src/sfnt/ttcolr.c (FT_PaintFormat_Internal): New enumeration values
`FT_COLR_PAINTFORMAT_INTERNAL_VAR_SKEW`,
`FT_COLR_PAINTFORMAT_INTERNAL_SKEW_CENTER`, and
`FT_COLR_PAINTFORMAT_INTERNAL_VAR_SKEW_CENTER`.
(read_paint): Handle new enumeration values.
2022-07-09 05:59:45 +02:00
Dominik Röttsches 44fd524ee4 [sfnt] Support variable 'COLR' v1 `PaintVarRotate*`.
* src/sfnt/ttcolr.c (FT_PaintFormat_Internal): New enumeration values
`FT_COLR_PAINTFORMAT_INTERNAL_VAR_ROTATE` and
`FT_COLR_PAINTFORMAT_INTERNAL_VAR_ROTATE_CENTER`.
(read_paint): Handle new enumeration values.
2022-07-09 05:59:45 +02:00
Dominik Röttsches 603fef28a6 [sfnt] Support 'COLR' v1 variable `PaintVarScale*`.
* src/sfnt/ttcolr.c: (FT_PaintFormatInternal): New enumeration values
`FT_COLR_PAINTFORMAT_INTERNAL_VAR_SCALE`,
`FT_COLR_PAINTFORMAT_INTERNAL_VAR_SCALE_CENTER`,
`FT_COLR_PAINTFORMAT_INTERNAL_VAR_SCALE_UNIFORM`, and
`FT_COLR_PAINTFORMAT_INTERNAL_VAR_SCALE_UNIFORM_CENTER`.
(read_paint): Handle new enumeration values.
2022-07-09 05:59:41 +02:00
Dominik Röttsches d134b9e37b [sfnt] Support for 'COLR' v1 variable translate.
* src/sfnt/ttcolr.c (FT_PaintFormat_Internal): New enumeration value
`FT_COLR_PAINTFORMAT_INTERNAL_VAR_TRANSLATE`.
(read_paint): Handle new enumeration value.
2022-07-09 05:44:58 +02:00
Dominik Röttsches 8ec531c26c [sfnt] Support for 'COLR' v1 variable transforms.
* src/sfnt/ttcolr.c (FT_PaintFormat_Internal): New enumeration value
`FT_COLR_PAINTFORMAT_INTERNAL_VAR_TRANSFORM`.
(read_paint): Handle new enumeration value.
2022-07-09 05:43:28 +02:00
Dominik Röttsches 9c4ad2a901 [sfnt] Deltas for 'COLR' v1 gradient coordinates.
* src/sfnt/ttcolr.c (read_paint) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Read and
apply deltas to radial, linear, and sweep gradient coordinates such as 'p0',
'p1', 'p2', 'center', 'radii', and 'angles'.
2022-07-09 05:41:27 +02:00
Dominik Röttsches 3414fef74f [sfnt] Support variable 'COLR' v1 color lines.
* include/freetype/ftcolor.h (FT_ColorStopIterator): Add field
`read_variable` to indicate whether a variation index base should be read.

* src/sfnt/ttcolr.c: (FT_PaintFormat_Internal): New enumerations
`FT_COLR_PAINTFORMAT_INTERNAL_VAR_LINEAR_GRADIENT`
`FT_COLR_PAINTFORMAT_INTERNAL_VAR_RADIAL_GRADIENT`, and
`FT_COLR_PAINTFORMAT_INTERNAL_VAR_SWEEP_GRADIENT`.
(read_color_line): New parameter `read_variable`; update callers.
(read_paint): Handle new enumerations.
2022-07-08 11:51:07 +02:00
Dominik Röttsches 7c151abb69 [sfnt] Apply variation deltas to `PaintVarSolid`.
* src/sfnt/ttcolr.c (FT_PaintFormat_Internal_): New enumeration
`FT_COLR_PAINTFORMAT_INTERNAL_VAR_SOLID`.

(get_deltas_for_var_index_base) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: New
function to retrieve an array of delta values, which will be used for most
of 'COLR' v1 variation formats (in follow-up commits).

(read_paint): Add `face` parameter; update caller.
Handle `FT_COLR_PAINTFORMAT_INTERNAL_VAR_SOLID`.
2022-07-07 19:48:19 +02:00
Dominik Röttsches 8a9192f68e [sfnt] Check safety of cast to `TT_Driver` before accessing member.
* src/sfnt/ttcolr.c (VARIABLE_COLRV1_ENABLED): Access
`enable_variable_colrv1` only if driver class matches.
2022-07-07 19:36:49 +02:00
Stephen Holdaway d5d048bbfe doc: Clarify description of `FT_Stream_IoFunc`.
The existing documentation comments on `FT_Stream_IoFunc` hinted at the dual
seek/read behavior required for custom stream implementations to work, but
it didn't explicitly explain it.  Without looking at the internals of
FreeType, it was easy for someone to assume their implementation should
handle both seek and read operations all the time.  If this is done, you get
a variety of errors, but mostly just `Unknown_File_Format` (error code
0x02).
2022-07-06 12:55:40 +02:00
Dominik Röttsches 31b14fd4dc [sfnt] Load variation store for 'COLR' v1.
* src/sfnt/ttcolr.c: Include `ttobjs.h` temporarily.
(VARIABLE_COLRV1_ENABLED): New temporary macro to detect whether variable
COLRv1 is enabled.
(Colr): New fields `var_store` and `delta_set_idx_map`.
(tt_face_load_colr, tt_face_free_colr) [VARIABLE_COLRV1_ENABLED]: Load and
free variation store data using the functions from the Multiple Masters
service.
2022-07-04 16:34:02 +02:00
Chris Liddell 1a242558be [base] Improve error handling in `FT_GlyphLoader_CheckPoints`.
If `FT_GlyphLoader_CreateExtra` returns an error (and a couple of other
places), `FT_GlyphLoader_CheckPoints` would propagate the error immediately,
rather than cleaning up the partially set up `FT_GlyphLoader`.  As a
consequence, a subsequent attempt to create a glyph could result in a crash.

* src/base/ftgloadr.c (FT_GlyphLoader_CheckPoints): Ensure all the error
conditions exits are consistent, eventually calling `FT_GlyphLoader_Reset`.
2022-07-03 06:58:23 +02:00
Thomas Sondergaard 55a97b0cb1 CMakeLists.txt: Provide both 'freetype' and 'Freetype::Freetype' targets.
FreeType can be located by consuming projects that use
`find_package(Freetype)` either via the old `MODULE` path (which uses
`FindFreetype.cmake` supplied by CMake), or via the new `CONFIG` path (which
uses `freetype-config.cmake` as supplied by this project).  Up to this point
the CMake module has supplied the target `Freetype::Freetype` and the config
file provided by this project the target `freetype`.  Now we supply both
`freetype` and `Freetype::Freetype` so that consuming projects can always
use the target `Freetype::Freetype` regardless of what path was taken by
`find_package(Freetype)`.

Fixes #1165.
2022-07-03 06:48:15 +02:00
Werner Lemberg 31005d98a4 include/freetype/ftmm.h: Improve documentation. 2022-07-02 09:34:13 +02:00
Dominik Röttsches bec4ef415e [base] Round values in `FT_MulAdd_Fix`.
This avoids regressing Blink layout tests and makes `FT_MulAdd_Fix` delta
retrieval implementation consistent with the previous implementation, which
used `FT_fixedToInt` and included rounding.

* src/base/ftcalc.c (FT_MulAdd_Fix): Implement it.
Also fix remaining `temp` initialization compilation issue.

Fixes #1169.
2022-07-01 14:01:08 +02:00
Werner Lemberg de27955c2a Minor formatting. 2022-07-01 06:33:50 +02:00
Dominik Röttsches 0607e0e959 Fix initialisation of temp variable in new FT_MulAddFix
src/truetype/ttgxvar.c (FT_MulAddFix): Initialise `temp`.
2022-06-30 10:55:50 +03:00
Dominik Röttsches dece953516 [truetype] Perform variation store delta computation with 64-bit precision.
* include/freetype/internal/ftmmtypes.h (FT_ItemVarDelta): Make type
explicitly 32-bit.
* include/freetype/internal/services/svmm.h
(FT_Var_Get_Item_Delta_Func): Change return type to `FT_ItemVarDelta`
* truetype/ttgxvar.h (tt_var_get_item_delta): Change return type to
`FT_ItemVarDelta`.
* truetype/ttgxvar.c (tt_var_get_item_delta): Store scalars and deltas
to intermediate array, perform computation using new method
`FT_MulAddFix`.
2022-06-29 20:27:11 +02:00
Dominik Röttsches 15fef219d6 New function `FT_MulAddFix` to compute the sum of fixed-point products.
This function, based on the code of `FT_MulFix`, uses 64-bit precision
internally for intermediate computations.

* include/freetype/internal/ftcalc.h, base/ftcalc.c (FT_MulAddFix):
Implement it.
2022-06-29 20:12:04 +02:00
Werner Lemberg 2db58e061e CMakeLists.txt: Move inclusion of `FindPkgConfig` down.
It must come after `CMAKE_TOOLCHAIN_FILE`.

Fixes #1167.
2022-06-22 12:16:00 +02:00
Dominik Röttsches 117df36b4c [sfnt] Upgrade stop_offset to FT_Fixed from FT_F2Dot14 2022-06-22 09:33:20 +00:00
Alexei Podtelezhnikov 5e48c88d57 * docs/CHANGES: Announce impending Infinality removal. 2022-06-21 17:34:29 +00:00
Alexei Podtelezhnikov 9006ff7d10 * ttgload.c (TT_Process_Composite_Glyph): Fix a signedness warning. 2022-06-21 17:10:56 +00:00
Werner Lemberg 2848378be5 s/fixed point/fixed-point/ 2022-06-21 17:08:04 +02:00
Werner Lemberg 40c6f97326 .gitlab-ci.yml: Correctly upgrade `meson`. 2022-06-21 14:45:42 +02:00
Dominik Röttsches 4b6f92e6b3 Proposal: Feature control for variable COLRv1
* include/freetype/ftdriver.h (variable-color-v1 property): Add documentation
for variable-colr-v1 property.
* src/truetype/ttdriver.c (tt_property_set): Ingest variable-control property
when called, set to enable_variable_colrv1 driver flag.
* src/truetype/ttobjs.h (TT_DriverRec): Add enable_variable_colrv1 flag.
2022-06-21 12:25:46 +03:00
Xavier Claessens b861b24157 [meson] Disable FreeType in HarfBuzz fallback.
This avoids cyclic subproject configuration when the 'harfbuzz' feature is
enabled, or `--wrap-mode=forcefallback` is used, but HarfBuzz is built as a
subproject.  HarfBuzz does the same and disables HarfBuzz support when
configuring FreeType as a subproject.

* meson.build (harfbuzz_dep): Implement it.

* subprojects/harfbuzz.wrap: New file.

* .gitlab-ci.yml [windows meson]: Use latest version of the meson 0.59
  series, which has a necessary bug fix to make CI work.
2022-06-21 08:09:16 +02:00
Alexei Podtelezhnikov 47103b2f19 [truetype] Clean up phantom point accounting.
This formalizes that the phantom points appended in the outline
do not increase its point count, nor are they tagged or included
in any additional contours.  Only their coordinates are stored.
They are counted in the glyph zone, however.

* src/truetype/ttgxvar.c (TT_Vary_Apply_Glyph_Deltas): Infer `n_points`
from the outline size plus four phantom points.
* src/truetype/ttgxvar.h (TT_Vary_Apply_Glyph_Deltas): Remove this
argument.
* src/truetype/ttgload.c (tt_prepare_zone): Add phantom four.
(TT_Process_Simple_Glyph, load_truetype_glyph): Update all callers.
2022-06-18 23:09:17 -04:00
Alexei Podtelezhnikov 705f416184 [truetype/GX] Clean up phantom point adjustment.
This moves phantom point and advance variation adjustment next to
calculations. The logic stays the same, HVAR and VVAR take priority.

* src/truetype/ttgload.c (load_truetype_glyph): Move it from here...
* src/truetype/ttgxvar.c (TT_Vary_Apply_Glyph_Deltas): ... to here
and check for HVAR and VVAR presence outside the main loop.
2022-06-18 23:02:26 -04:00
Ben Wagner f7daf9d293 [stream] Fix reading s32 when long is s64
`FT_READ_LONG`, `FT_GET_LONG`, and related macros did not return
negative values when `long` is more than 32 bits. `FT_Stream_ReadULong`
would read four bytes into the LSB of an `FT_ULong` and return that.
Since this can never set the MSb of the `FT_ULong` when `FT_ULong` is
more than 32 bits the cast to `FT_Long` never resulted in a negative
value.

Fix this by modifying `FT_Stream_Read*` to return a type of the same
size as the bytes it is reading and changing the `FT_READ_*` and
`FT_GET_*` macros to cast to the same type returned by `FT_Stream_Read*`
but with the correctly signed type (instead of casting to what is
assumed to be the type of `var` which will happen automatically anyway).

There exist a few cases like with the `OFF3` variants where there isn't
generally a type with the correct size. `FT_PEEK_OFF3` works around this
loading the bytes into the three most significant bits and then doing a
signed shift down. `FT_NEXT_OFF3` also already worked correctly by
casting this signed value to another signed type. `FT_Stream_GetUOffset`
works correctly but one must be careful not to attempt to cast the
returned value to a signed type. Fortunately there is only
`FT_GET_UOFF3` and no `FT_GET_OFF3`.

All of these cases are handled correctly when reading values through
`FT_Stream_ReadFields` since it generically computes the signed value
through an `FT_Int32`. This change is essentially doing the same for
these macros.

* include/freetype/internal/ftstream.h (FT_NEXT_*, FT_GET_*, FT_READ*):
Update macros and return types to use fixed size types for fixed size
values.

* src/base/ftstream.c (FT_StreamGet*, FT_StreamRead*): Dito.

Issue: #1161
2022-06-18 12:58:23 -04:00
Alexei Podtelezhnikov d9b8a69e9a [truetype/GX] Fix an old typo.
* src/truetype/ttgxvar.c (TT_Vary_Apply_Glyph_Deltas): Vertical
advance is measured along y-coordinate.
2022-06-16 22:13:25 -04:00
Alexei Podtelezhnikov 9c706dcca7 [truetype/GX] Clean up advance adjustment (Brrr).
* src/truetype/ttgload.c (load_truetype_glyph): Remove remaining code.
2022-06-16 16:11:51 +00:00
Ben Wagner 9079521002 [type1] Directly search for eexec in private dict
This code originally just searched for `eexec`. This was later modified
to check that the `eexec` found is valid (not in a string or comment).
This was done by searching for `eexec` as before and then, for each
`eexec` found, searching from the beginning using the correct parsing to
see if the `eexec` was still found. If the private dictionary is large
and contains many copies of `eexec` which are not valid, the initial
part of the private dictionary is scanned once for each, potentially
leading to n^2 parsing time.

Instead of finding an initial `eexec` and then re-parsing to discover if
it is valid, drop the initial search for `eexec` and just parse to find
a valid `eexec`. This is strictly faster since the validation must
happen anyway and avoids restarting from the beginning each time an
`eexec` is found in the data.

* src/type1/t1parse.c (T1_Get_Private_Dict): avoid n^2 parsing

Bug: https://bugs.chromium.org/p/chromium/issues/detail?id=1328883
2022-06-16 14:51:57 +00:00
Alexei Podtelezhnikov d6fc8c6ba0 [truetype/GX] Clean up advance adjustment.
* src/truetype/ttgload.c (TT_Process_Simple_Glyph, load_truetype_glyph):
Move the advance adjustment from here...
* src/truetype/ttgxvar.c (TT_Vary_Apply_Glyph_Deltas): ... to here and
simplify arguments.
* src/truetype/ttgxvar.h (TT_Vary_Apply_Glyph_Deltas): Update prototype
with fewer arguments.
2022-06-15 18:28:50 -04:00
Ben Wagner 8bb7722a53 [gzip] Handle inflate returning Z_NEED_DICT
When `inflate` returns `Z_NEED_DICT` this is currently not reported as
an error and callers may assume that the decompression succeeded when it
did not. In particular, a compressed table in a woff file may not
actually be decompressed and written as expected, leaving the backing
memory for the expanded table uninitialized.

* src/gzlip/ftgzip.c (FT_Gzip_Uncompress): treat `Z_NEED_DICT` as
indicating invalid data since there is no means to provide a dictionary.

Bug: https://bugs.chromium.org/p/chromium/issues/detail?id=1335712
2022-06-14 04:49:29 +00:00
Ben Wagner 58395dd200 [woff] Don't allocate table entries until needed
* src/sfnt/sfwoff.c (woff_open_font): delay allocating space for the
table entries until they are actually written out with the data.
2022-06-13 15:32:28 -04:00
Alexei Podtelezhnikov 8b6bcc92c5 * src/sfnt/sfwoff2.c (woff2_open_font): Partial revert.
Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=47981.
2022-06-12 09:04:13 -04:00
Alexei Podtelezhnikov e7482ff4c2 * src/lzw/ftzopen.c (ft_lzwstate_stack_grow): Cosmetic macro change. 2022-06-11 23:47:19 -04:00
Alexei Podtelezhnikov 73631b9530 [woff, woff2] Avoid buffer zeroing.
* src/sfnt/sfwoff.c (woff_open_font): Use Q-macros.
* src/sfnt/sfwoff2.c: Ditto.
(reconstruct_font): Allocate table_entry on stack.
2022-06-11 16:10:40 -04:00
Alexei Podtelezhnikov 4fef1fcede [smooth] Fix GCC LTO crashes on Windows.
Fixes #1164 by using a volatile variable around `setjmp`.  It is hard to
say how this fixes crashes related to certain link-time optimizations.
This does not decrease the rendering performance.

* src/smooth/ftgrays.c (gray_convert_glyph_inner): Use volatile `error`.
2022-06-10 11:34:56 -04:00
bruvzg 9acefc4f51 * src/smooth/ftgrays.c [FT_STATIC_RASTER]: Fix compilation. 2022-06-09 10:51:07 -04:00
Ben Wagner b11074cf6d [svg] Set linear advances when loading SVG glyphs
* include/freetype/freetype.h (FT_GlyphSlotRec_): update doc
* src/cff/cffgload.c (cff_slot_load): do it
* src/truetype/ttgload.c (TT_Load_Glyph): do it

Fixes: #1156
2022-06-06 16:55:17 -04:00
Ben Wagner c26872ed59 [svg] Clear correct flags for doc ownership
This issue was discovered with an SVG based font with some documents
compressed and other uncompressed. After loading the first compressed
document the ownership flag on the glyph slot was set to true but never
set to false. As a result after loading a compressed document a glyph
from an uncompressed document would load fine, but when this glyph slot
was cleared it would try to free its document resulting in a wild free.

* src/base/ftobjs.c (ft_glyphslot_clear): clear correct flags

Fixes: #1162
2022-06-01 17:27:38 +00:00
Alexei Podtelezhnikov d685798123 [docs] Correct favicon. 2022-05-31 22:40:55 -04:00
Alexei Podtelezhnikov 8addad6065 [docs] Use hinted favicon. 2022-05-31 22:38:24 -04:00
Alexei Podtelezhnikov c26f0d0d7e [docs] Update favicon. 2022-05-26 23:48:26 -04:00
Behdad Esfahbod (بهداد اسفهبد) b98dd169a1 * src/sfnt/ttmtx.c (tt_face_get_metrics): Apply variations unconditionally.
This causes a speed-up of approx. 20% for getting advance widths.
2022-05-25 14:49:37 +02:00
Dominik Röttsches 7838c78f53 [truetype] Support reading 32bit/16bit VarStore deltas
* include/freetype/internal/ftmmtypes.h (FT_ItemVarDelta): Define type
to be used for delta arrays, upgrade to FT_long.
* src/truetype/ttgxvar.c: Adhere to long_words bit and read either
Short/Byte pairs or Long/Short pairs, as defined by spec. For better
readability, define macro for repetitive read code.
2022-05-23 16:18:28 +03:00
Dominik Röttsches 9aa99f2262 [truetype] Handle 0xFFFF special value inside delta retrieval function
* truetype/ttgxvar.c (tt_hvadvance_adjust, tt_apply_mvar,
tt_var_get_item_delta): Remove special 0xFFFF handling in favor of less
redundant handling inside the tt_var_get_item_delta function, as it is
equivalent to returning a 0 delta. Avoids code-duplication checking for
special value 0xFFFF.
2022-05-20 17:20:08 +03:00
Dominik Röttsches a4c4566b6d [truetype, snft] Add service methods for `DeltaSetIdxMap` and `VarStore`.
This will be needed for 'COLR' v1 variation support.

* src/truetype/ttgxvar.h (GX_ItemVarData, GX_AxisCoords, GX_VarRegion,
GX_VarItemStore, GX_DeltaSetIdxMap): Move structures to...
* include/freetype/internal/ftmmtypes.h: ... this new file.

* include/freetype/internal/service/svmm.h (MultiMasters): Include
`ftmmtypes.h`.
(FT_Var_Load_Delta_Set_Idx_Map_Func, FT_Var_Load_Item_Var_Store_Func,
FT_Var_Get_Item_Delta_Func, FT_Var_Done_Item_Var_Store_Func,
FT_Var_Done_Delta_Set_Idx_Map_Func): New function typedefs.
(MultiMasters): Add them.
(FT_DEFINE_SERVICE_MULTIMASTERSREC): Updated.

* src/cff/cffdrivr.c (cff_load_item_variation_store,
cff_load_delta_set_index_mapping, cff_get_item_delta,
cff_done_item_variation_store, cff_done_delta_set_index_map): New wrapper
methods calling into mm service.
(cff_service_multi_masters): Updated.

* src/truetype/ttgxvar.c (ft_var_load_item_variation_store,
ft_var_load_delta_set_index_mapping, ft_var_get_item_delta,
ft_var_done_item_variation_store, ft_var_done_delta_set_index_map): Renamed
to ...
(tt_var_load_item_variation_store, tt_var_load_delta_set_index_mapping,
tt_var_get_item_delta, tt_var_done_item_variation_store,
tt_var_done_delta_set_index_map): ... this for consistency.
Mark them as non-static.
* src/truetype/ttgxvar.h: Add corresponding prototypes.

* src/truetype/ttdriver.c (tt_service_gx_multi_masters): Updated.

* src/type1/t1driver.c (t1_service_multi_masters): Updated.
2022-05-19 07:14:05 +02:00
Dominik Röttsches 5f19f49c81 [truetype] Move deallocation of `DeltaSetIdxMap` into own function.
This is a preparation for handling `DeltaSetIdxMap` and `VarStore` as a
FreeType service.

* src/truetype/ttgxvar.c (ft_var_done_delta_set_index_map): New function.
(tt_done_blend): Use it.
2022-05-19 06:09:17 +02:00
Werner Lemberg e3ac7bb64a * builds/toplevel.mk (do-dist): Don't remove meson wrap files.
Fixes #1157.
2022-05-18 16:12:19 +02:00
Werner Lemberg b4b7c3f607 * subprojects/zlib.wrap: Update to zlib version 1.2.12. 2022-05-18 16:02:21 +02:00
Werner Lemberg c8a9c88975 REAMDE: Mention that gitlab's 'download' button doesn't work.
This is because the `git archive` command doesn't preserve submodules.

Note that currently there is no support for disabling the 'download' button
in gitlab (https://gitlab.com/gitlab-org/gitlab/-/issues/17032).

Fixes issue #1158.
2022-05-18 07:06:58 +02:00
Werner Lemberg 5d49473f85 [truetype] Handle inner/outer index values 0xFFFF/0xFFFF.
This was introduced in OpenType 1.8.4.

* src/truetype/ttgxvar.c (ft_var_load_delta_set_index_mapping,
tt_hvadvance_adjust, ft_var_load_mvar, tt_apply_mvar): Handle special
inner/outer index values.
(ft_var_load_item_variation_store): Add test.

Fixes #1154.
2022-05-11 18:15:02 +02:00
Werner Lemberg e8ebfe988b * Version 2.12.1 released.
==========================

Tag sources with `VER-2-12-1'.

* docs/VERSION.TXT: Add entry for version 2.12.1.
* docs/CHANGES, docs/release: Updated.

* README, src/base/ftver.rc, builds/windows/vc2010/index.html,
builds/windows/visualc/index.html, builds/windows/visualce/index.html,
builds/wince/vc2005-ce/index.html, builds/wince/vc2008-ce/index.html,
docs/freetype-config.1: s/2.12.0/2.12.1/, s/2120/2121/.

* include/freetype/freetype.h (FREETYPE_PATCH): Set to 1.

* builds/unix/configure.raw (version_info): Set to 24:3:18.
* CMakeLists.txt (VERSION_PATCH): Set to 1.
2022-05-01 07:09:34 +02:00
Anuj Verma 7b3ebb9c12 [sdf] Do not throw errors for invisible glyphs.
* src/sdf/ftsdfrend.c (ft_sdf_render, ft_bsdf_render): Return `FT_Err_Ok` if
width or height is zero, since some glyphs do not generate visible bitmaps.

Fixes #1150.
2022-04-30 19:38:11 +02:00
Werner Lemberg 62bc04f4c5 * src/sfnt/sfobjs.c (sfnt_load_face): Set `FT_FACE_FLAG_COLOR` for SVG fonts.
Fixes #1151.
2022-04-30 15:37:14 +02:00
Brendan Shanks 6fb7b7a09d autogen.sh: Fix building when freetype is itself a git submodule.
There are situations where .git is not a directory, like when
freetype is a submodule in another repository.
2022-04-26 16:07:42 -07:00
Alexei Podtelezhnikov ed4d0710f1 [builds/windows] Simplify non-desktop UWP check.
Fixes mingw compilation described in !159.

* builds/windows/ftsystem.c: Do not use WINAPI_FAMILY_PARTITION macro.
2022-04-25 19:05:11 -04:00
Alexei Podtelezhnikov 581dd06405 [truetype] Reset IUP flags in `TT_RunIns`.
Fixes #1148 by moving the flag initialization back, partly reverting
7809007a and fd03dcc1.  Initializing these flags elsewhere skips 'cvt'.

* src/truetype/ttinterp.c (TT_RunIns): Initialize the IUP flag here...
(TT_Run_Context): ... instead of here.
2022-04-25 08:03:08 -04:00
Xavier Claessens d59c7ce1b9 [meson] Remove `default_library=both` from `default_options`.
It is inconsistent with what all other Meson projects do.

It also prevents static linking to FreeType when it is a subproject because
`default_options` in a subproject takes precedence on values set on the main
project.  For example, building 'GStreamer' with `-Ddefault_library=static`
would still dynamically link on FreeType unless the user also sets
`-Dfreetype2:default_library=static`.

* meson.build: Updated.

* .gitlab-ci.yml: Retain `both` option for testing.
2022-04-24 17:01:56 +02:00
Werner Lemberg 079a22da03 * src/truetype/ttgload.c (TT_Process_Simple_Glyph): Integer overflow.
Reported as

  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=46792
2022-04-19 09:34:10 +02:00
Georg Brandl 978eefee54 * src/cff/cffgload.c (cff_slot_load) [FT_CONFIG_OPTION_SVG]: Fix segfault.
This can happen if the function is called with `size` being `NULL`.

Fixes #1147.
2022-04-16 15:39:11 +02:00
Steve Lhomme 3100c8120e .gitlab-ci.yml: Add a Universal Windows build target
It's compiled for Windows 10 and up, ensuring UNICODE is set (default for UWP)
and selecting the proper WINAPI_FAMILY (WINAPI_FAMILY_APP).

Do not try to run the UWP exe in the Docker as it doesn't work.
2022-04-14 10:53:13 +00:00
Ben Wagner a1ca701023 [sfnt] Correct FT_ColorStopIterator documentation.
* include/freetype/ftcolor.h (FT_ColorStopIterator): the user should not
 set `p` to NULL before calling `FT_Get_Colorline_Stops`. `p` and
`num_color_stops` are set by `FT_Get_Paint`. `p` and
`current_color_stop` are updated by `FT_Get_Colorline_Stops`.
2022-04-04 15:28:54 -04:00
Werner Lemberg aee6b94727 * builds/unix/configure.raw: Add option `--with-librsvg`.
Since 'librsvg' is written in Rust, this option allows distributions to
avoid a dependency on the entire Rust toolchain to provide the FreeType demo
programs.

Suggested by Lars Wendler in !156.
2022-04-01 14:55:12 +02:00
Werner Lemberg fc08295650 * src/sfnt/sfwoff.c (reconstruct_glyf): Fix gcc 10 warning. 2022-04-01 14:50:44 +02:00
Werner Lemberg 1603378b91 [gzip] Update sources to zlib 1.2.12. 2022-04-01 10:47:23 +02:00
Eric Jing 89d5cce58d CMakeLists.txt: Fix `Info.plist` path.
When building a framework using CMake with `add_subdirectory`, CMake must be
able to find `freetype-Info.plist` when configuring the framework
properties.

Fixes #1145.
2022-04-01 08:55:22 +02:00
Werner Lemberg 695d606ae5 Whitespace. 2022-04-01 08:50:33 +02:00
Ben Wagner d247c56278 [truetype] Use SUB_LONG for component offset.
* src/truetype/ttgload.c (TT_Process_Composite_Component): do it.

Bug: https://crbug.com/1309429
2022-04-01 05:50:41 +00:00
Werner Lemberg 385345037e CMakeList.txt: Update code to handle recent changes for `freetype.pc`.
Fixes #1144.
2022-03-31 20:52:43 +02:00
Werner Lemberg 8a33164dad CMakeLists.txt: s/PKG_CONFIG/PKGCONFIG/, s/REQUIRED_/REQUIRES_/. 2022-03-31 20:51:58 +02:00
Werner Lemberg e50798b720 * Version 2.12.0 released.
==========================

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

* docs/VERSION.TXT: Add entry for version 2.12.0.
* docs/CHANGES, docs/release: Updated.

* README, src/base/ftver.rc, builds/windows/vc2010/index.html,
builds/windows/visualc/index.html, builds/windows/visualce/index.html,
builds/wince/vc2005-ce/index.html, builds/wince/vc2008-ce/index.html,
docs/freetype-config.1: s/2.11.1/2.12.0/, s/2111/2120/.

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

* builds/unix/configure.raw (version_info): Set to 24:2:18.
* CMakeLists.txt (VERSION_MINOR): Set to 12.
(VERSION_PATCH): Set to 0.

* builds/toplevel.mk (do-dist): Generate `ChangeLog` entries for all commits
since version 2.11.0 (when we stopped creating this file manually).
2022-03-31 13:55:50 +02:00
Werner Lemberg 87989a1435 Fix clang++ warnings.
* src/base/ftglyph.c (ft_svg_glyph_prepare), src/base/ftobj.c
(ft_glyphslot_init), src/cache/ftccmap.c (ftc_cmap_node_new),
src/cache/ftcimage.c (FTC_INode_New), src/lzw/ftlzw.c (FT_Stream_OpenLZW),
src/psaux/psobjs.c (ps_parser_load_field), src/pshinter/pshglob.c
(psh_globals_new), src/sfnt/ttsvg.c (tt_face_load_svg_doc): Initialize
variables used for allocation.

* src/sdf/ftsdf.c (split_sdf_conic, split_sdf_cubic): Change type of
`max_splits` to FT_UInt.
(sdf_generate_bounding_box): Add cast.
2022-03-31 07:49:35 +02:00
Werner Lemberg 97cdbb24f7 Whitespace. 2022-03-30 20:50:28 +02:00
Werner Lemberg 119e404b89 [builds] Fix creation of `freetype2.pc` for static-only builds.
We have to help `pkg-config` since it can't recognize that there is no
shared library installed.

Note that meson already does exactly the same.

* builds/unix/configure.raw (REQUIRES_PRIVATE, LIBS_PRIVATE): Rename to...
(PKGCONFIG_REQUIRES_PRIVATE, PKGCONFIG_LIBS_PRIVATE): This.  Adjust them
depending on `$enable_shared`.
(PKGCONFIG_REQUIRES, PKGCONFIG_LIBS): New variables.

* builds/unix/freetype2.in, builds/unix/unix-def.in: Use new and updated
variables.
2022-03-30 18:20:34 +00:00
Werner Lemberg a8e4563c34 Add `FT_FACE_FLAG_SBIX_OVERLAY` and `FT_HAS_SBIX_OVERLAY`.
* include/freetype/freetype.h (FT_FACE_FLAG_SBIX_OVERLAY,
FT_HAS_SBIX_OVERLAY): New macro.

* src/sfnt/ttsbit.c (tt_face_load_sbit): Handle `FT_FACE_FLAG_SBIX_OVERLAY`.
Remove obsolete tracing message.
2022-03-25 06:37:41 +00:00
Werner Lemberg 1949a7ec3a Add `FT_PARAM_TAG_IGNORE_SBIX`.
This is another bit to handle 'sbix' tables as described in the OpenType
specification.

* include/freetype/ftparams.h (FT_PARAM_TAG_IGNORE_SBIX): New macro.

* src/sfnt/sfobjc.c (is_apple_sbix): Rename to...
(has_sbix): ... this.
Check for more sbit tables.
Handle `FT_PARAM_TAG_IGNORE_SBIX` to eventually control `has_sbix`.
Only call sbit table loader if an sbit table is present.
2022-03-25 06:37:41 +00:00
Werner Lemberg ac4c1ebf7e [truetype] Fix 'sbix' table handling.
* src/sfnt/ttsbit.c (tt_face_load_sbix_image): Correct calculation of
'metrics->horiBearingY'.
Set vertical metrics.

* src/sfnt/sfobjs.c (sfnt_load_face): Adjust setting of `FT_FACE_FLAG_SBIX`.
Handle metrics of fonts with 'sbix' table.

* src/truetype/ttgload.c (TT_Load_Glyph): For 'sbix' embedded bitmaps, apply
bbox offset and bearing values of the corresponding glyph in the 'glyf'
table if it exists and has a contour.

* src/truetype/ttobjs.c (tt_face_init): Handle font with 'sbix' table.

Fixes issue #998.
2022-03-25 06:37:41 +00:00
Werner Lemberg 907715a6a2 Add `FT_FACE_FLAG_SBIX` and `FT_HAS_SBIX`.
Fonts with 'sbix' tables need special handling by the application.

* include/freetype/freetype.h (FT_FACE_FLAG_SBIX, FT_HAS_SBIX): New macros.

* src/sfnt/sfobjs.c (sfnt_load_face): Set `FT_FACE_FLAG_SBIX` if 'sbix'
table is present.
2022-03-25 06:37:41 +00:00
Werner Lemberg 06727a5257 * include/freetype/freetype.h (FT_LOAD_SBITS_ONLY): Tag macro as public. 2022-03-25 06:37:41 +00:00
Carlo Bramini 127c1e8331 [builds/windows] Fix WCE support.
* builds/windows/ftsystem.c [_WIN32_WCE]: Include <malloc.h> needed by
_alloca.
2022-03-23 22:53:07 -04:00
Steve Lhomme 0574692c6d [build/windows] Improve UWP support.
* builds/windows/ftsystem.c [UWP]: Wrap CreateFile2 into CreateFileA.
2022-03-23 22:46:15 -04:00
Werner Lemberg fc15ebe0a6 * src/sfnt/ttkern.c (tt_face_get_kerning): Exit early if no table.
Fixes #1141.
2022-03-21 11:17:28 +01:00
Ben Wagner a960be9e5e [woff2] Support overlap flag for simple glyphs.
In the woff2 spec it has been proposed to allow the OVERLAP_SIMPLE flag
to be retained through the woff2 format [0].

[0] https://www.w3.org/TR/WOFF2/#glyf_table_format

* src/sfnt/sfwoff2.h (GLYF_OVERLAP_SIMPLE): add glyf flag.

* src/sfnt/sfwoff2.c (reconstruct_glyf): parse optionFlags and
overlapSimpleBitmap[]. (store_points): set OVERLAP_SIMPLE on first point's
flag if the overlap bit is set.
2022-03-20 07:27:43 +00:00
Werner Lemberg d2c3bbcd8e [cff] Synchronize `cff_slot_load` with `TT_Load_Glyph`.
* src/cff/cffgload.c (IS_DEFAULT_INSTANCE): New macro.
(cff_slot_load): Use it.
2022-03-19 19:31:25 +01:00
Werner Lemberg 0c2bdb01a2 * src/base/ftobjs.c (FT_Request_Size): Guard `face->size`.
Fixes #1140.
2022-03-19 09:37:28 +01:00
Werner Lemberg d014387ad4 * src/base/ftobjs.c (ft_open_face_internal): Thinko. 2022-03-19 09:30:45 +01:00
Ben Wagner 7789f2bb79 [doc] FT_OUTLINE_OVERLAP was introduced in 2.10.3.
* include/freetype/ftimage.h (FT_OUTLINE_OVERLAP): Document when added.
2022-03-19 06:20:53 +00:00
Werner Lemberg 22a0cccb4d * src/base/ftobjs.c (ft_open_face_internal): Properly guard `face_index`.
We must ensure that the cast to `FT_Int` doesn't change the sign.

Fixes #1139.
2022-03-19 06:40:17 +01:00
Werner Lemberg 53dfdcd819 [sfnt] Avoid invalid face index.
Fixes #1138.

* src/sfnt/sfobjs.c (sfnt_init_face), src/sfnt/sfwoff2.c (woff2_open_font):
Check `face_index` before decrementing.
2022-03-17 19:24:16 +01:00
Werner Lemberg 1e2eb65048 Documentation, whitespace. 2022-03-07 10:13:44 +01:00
Anuj Verma 360e2507a3 [sdf] Fix corner checks and improve performance.
* src/sdf/ftsdf.c (sdf_generate_bounding_box): Always check for a corner if
two distances (for different curves) are very close.

(sdf_conic_to): Check whether the conic curve can be treated as a line
(which happens if the control point coincides with any end point).
2022-03-05 17:00:10 +01:00
Anuj Verma 2600ef637e [sdf] Implement deviation-based splitting for Bezier curves.
* src/sdf/ftsdf.c (split_sdf_cubic, split_sdf_shape): Add checks to figure
out the deviation of Bezier curves and stop splitting if the curve is flat
enough.

* src/sdf/ftsdfcommon.h (ONE_PIXEL): New macro.
2022-03-05 16:53:45 +01:00
Anuj Verma 5499d7bf81 * include/freetype/freetype.h: Improve SDF documentation. 2022-03-05 16:44:23 +01:00
Ben Wagner 335224beee [sfnt] Fix bounds check in SVG.
The `SVG_DOCUMENT_LIST_MINIMUM_SIZE` macro is non trivial and not
protected by parentheses. As a result, the expression
`table_size - SVG_DOCUMENT_LIST_MINIMUM_SIZE` expands to
`table_size - 2U + SVG_DOCUMENT_RECORD_SIZE` instead of the expected
`table_size - (2U + SVG_DOCUMENT_RECORD_SIZE)`. This causes an incorrect
bounds check which may lead to reading past the end of the `SVG ` table.

* src/sfnt/ttsvg.c (tt_face_load_svg): wrap macro definitions in
parentheses.

Bug: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=45179
2022-03-03 16:42:54 -05:00
Ben Wagner 034e5dbf92 [psaux] Full bounds check for OtherSubr 19.
It is possible for OtherSubr 19 to be invoked when `decoder->buildchar` is
NULL (so that `decoder->len_buildchar` is 0), the `blend` is non-NULL with
`blend->num_designs` set to 2, and the user supplied `idx` to be large (for
example 0xFFFFFFFE).  Since these are all `FT_UInt32` the existing bounds
check overflows in a well defined manner, allowing for an invalid call to
`memcpy`.

In addition, it is possible to call OtherSubr 19 with
`decoder->len_buildchar`, `blend->num_designs`, and `idx` all zero (implying
that `blend->weight_vector` and `decoder->buildchar` are NULL).  This passes
the bounds check (it is logically always fine to copy nothing starting at
index zero) but may invoke undefined behavior in `ft_memcpy` if it is backed
by `memcpy`.  Calling `memcpy` with either the `src` or `dst` NULL is
undefined behavior (even if `count` is zero).

* src/psaux/psintrp.c (cf2_interpT2CharString): Correctly check that
`blend->num_designs` can be copied to `decoder->buildchar[idx]`.
Also avoid passing NULL to `ft_memcpy`.

Bug: https://crbug.com/1299259
2022-02-23 17:42:55 +01:00
suzuki toshiya bcdfa38692 [cmake] Drop the support of CMake 2.x.
* CMakeLists.txt: Require CMake 3.0 (released on 2014) or newer.

The issue #1059 reports the difficulty to support both of
CMake 2.x and newer one by single CMakeLists.txt without
the inflation of cmake_policy() workarounds.

For better maintainability, the support of CMake 2.x is
dropped.
2022-02-21 10:44:42 +09:00
Werner Lemberg 6c5522c6f8 * src/bdf/README: Updated. 2022-02-19 13:37:07 +01:00
Werner Lemberg ca46bc0cf2 * builds/mac/ftmac.c, src/base/ftmac.c: s|FT_MAC_H|<freetype/ftmac.h>|. 2022-02-19 13:36:25 +01:00
Werner Lemberg 5b26e92a0f src/sfnt/ttkern.c (tt_face_load_kern): Micro-optimize.
A kerning table can be handled by binary search if it has equal entries.

Fixes #1132.
2022-02-19 07:20:24 +01:00
Steve Lhomme 20ec99be7e [builds/windows] Add support for legacy UWP builds.
* builds/windows/ftsystem.c: Add neccessary macro substitutions to
enable strict UWP builds.

See !141.

Co-authored-by: Alexei Podtelezhnikov <apodtele@gmail.com>
2022-02-17 13:35:52 -05:00
Werner Lemberg 01d4deb061 ftmm.h: Minor documentation improvement. 2022-02-16 14:51:44 +01:00
Alexei Podtelezhnikov 00ae29fcd2 [pshinter] Tune PSH_STRONG_THRESHOLD_MAXIMUM value.
Before the change, the hinting engine frequently confused horizontal
stem and serif hints making some stems too thin and some serifs too
thick. The value was tuned using serif fonts from the URW+ base 35
collection.

* src/pshinter/pshalgo.c [PSH_STRONG_THRESHOLD_MAXIMUM]: s/30/12/.
2022-02-12 23:42:08 -05:00
Werner Lemberg 5a53e51b5c t1tables.h: Documentation improvements. 2022-02-12 07:58:43 +01:00
Werner Lemberg c67ecb8c3a t1tables.h: Whitespace. 2022-02-12 07:52:57 +01:00
Werner Lemberg 338b4e8846 [type42] Fix `FT_Get_PS_Font_Private` for this format.
Since Type42 fonts don't have a 'Private' dictionary, the return value
should be `FT_Err_Invalid_Argument`.

* src/type42/t42drivr.c (t42_ps_get_font_private): Removed.
(t42_service_ps_info): Updated.
2022-02-11 19:32:49 +01:00
Alexei Podtelezhnikov 1680885aa5 [pshinter] Clear reused mask.
In PS hinter, memory allocations persist until the module is done.
Therefore, we have to clear reused masks.

* src/pshinter/pshrec.c (ps_mask_table_alloc): Clear reused mask.
2022-02-09 16:41:07 +00:00
Alexei Podtelezhnikov 0447df71e7 [pshinter] Use unsigned indices.
This reduces casting and eliminates some checks.

* src/pshinter/pshrec.c (ps_mask_test_bit, ps_mask_table_merge,
ps_dimension_add_t1stem, ps_hints_t1stem3): Updated.
(ps_dimension_add_counter): Updated, unnecessary checks removed.
2022-02-09 15:04:58 +00:00
Alexei Podtelezhnikov ed0e2e76d8 [pshinter] Fix mask merging.
We forgot to update the number of bits when merging a larger mask
into a smaller one.  This fix might have rendering effects.

* src/pshinter/pshrec.c (ps_mask_table_merge): Inherit the number
of bits from a larger mask. There is no need to zero unused bits,
already zeroed during allocation.
(ps_mask_clear_bit): Removed.
(ps_mask_ensure): Minor.
2022-02-08 16:35:14 -05:00
Alexei Podtelezhnikov 7c6b2f20b0 [pshinter] Revise the hint table handling.
* src/pshinter/pshrec.c (ps_hint_table_ensure): Remove redundant size
check; avoid array zeroing because it is fully initialized when used.
(ps_hint_table_alloc): Fix off-by-one comparison and remove another
zeroing of the array elements.
2022-02-08 14:37:34 +00:00
Werner Lemberg 24db55ecb8 Various minor doc fixes. 2022-02-06 21:06:52 +01:00
Alexei Podtelezhnikov a173aead31 [builds/windows] Add SVG to to project files.
* builds/windows/vc2010/freetype.vcxproj: Updated.
* builds/windows/vc2010/freetype.vcxproj.filters: Updated.
* builds/windows/visualc/freetype.vcproj: Updated.
2022-02-06 08:25:52 -05:00
Alexei Podtelezhnikov dd8676b277 * src/winfonts/winfnt.c (fnt_face_get_dll_font): Trace font resources. 2022-02-03 14:32:50 +00:00
Eric Jing 56d182a74d [cmake] Fix build on MacOS.
* CMakeLists.txt (CMAKE_OSX_ARCHITECTURES): Update value to fix the building
of a framework on MacOS.

* builds/mac/freetype-Info.plist (CFBundleExecutable): Make identifier
lowercase only.

Fixes #1127.
2022-02-02 18:15:28 +01:00
Alexei Podtelezhnikov 8e39e42ee9 [psaux] Revise `PS_Table` handling.
The old impleemntation was not using `FT_REALLOC`, buing too careful
with the offset rebasing.  It shoudl be safe to rely on the base
movements.

* src/psaux/psobjs.c (reallocate_t1_table, shift_elements): Combine
into...
(ps_table_realloc): ... this function based on `FT_REALLOC`.
(ps_table_done): Simplified.
(ps_table_add): Updated.
2022-02-02 11:35:14 -05:00
Alexei Podtelezhnikov c6dd509b99 * src/cache/ftcmru.c (FTC_MruList_New): Explain zeroing. 2022-02-02 11:32:58 -05:00
Alexei Podtelezhnikov 946e1353ea [cache] Partially revert 9870b6c07e.
Fix crashes reported by Werner.

* src/cache/ftcmru.c (FTC_MruList_New): Use `FT_ALLOC` again.
2022-01-31 14:19:07 +00:00
Werner Lemberg 36ee3160a0 freetype.h: Minor documentation improvement. 2022-01-31 10:37:56 +01:00
Alexei Podtelezhnikov 983d435865 [cache] Fix fallouts from edd4fedc54.
Reported by Werner.

* src/cache/ftcimage.c (FTC_INode_New): Always initialize FT_Glyph.
* src/cache/ftcsbits.c (FTC_SNode_New): Always initialize FT_SBit.
2022-01-30 22:13:51 -05:00
Alexei Podtelezhnikov bee8886408 Clean-up - do not doubt FT_FREE.
* src/base/ftobjs.c (memory_stream_close): Do not reassign zero
after `FT_FREE`.
* src/sfnt/sfwoff.c (sfnt_stream_close): Ditto.
* src/sfnt/sfwoff2.c (stream_close): Ditto.
* src/psaux/psobjs.c (ps_parser_load_field): Ditto.
* src/truetype/ttgxvar.c (ft_var_load_avar, tt_set_mm_blend,
tt_set_mm_blend): Ditto.
2022-01-30 21:55:21 -05:00
Werner Lemberg 7fd03a3e25 * CMakeLists.txt: Include 'FindPkgConfig' module.
Older cmake versions don't provide `pkg_check_modules` by default.

Fixes #1126.
2022-01-30 20:50:42 +01:00
Alexei Podtelezhnikov da877c8693 * src/psaux/psobjs.c (ps_parser_load_field): Reduce `string` scope. 2022-01-29 22:46:56 -05:00
suzuki toshiya 35740aa6a9 [cmake] Check the availability of `bzip2.pc'.
(CMakeLists.txt): Check the availability of `bzip2.pc'.

* If `bzip2.pc' is available, Requires.private should include
bzip2, but Libs.private should not include -lbz2.

* If `bzip2.pc' is unavailable, Requires.private cannot include
bzip2, but Libs.private should include -lbz2.

Fix #897.
2022-01-29 01:36:12 +00:00
Werner Lemberg fa226478b1 * unix/configure.raw: We need 'librsvg' version 2.46.0 or newer.
Older versions don't have function `rsvg_handle_get_intrinsic_dimensions`.
2022-01-28 15:20:12 +01:00
Alexei Podtelezhnikov b34741c1cc Minor clean-ups.
* src/base/ftrfork.c (raccess_make_file_name): Do not set error.
* src/sfnt/sfdriver.c (get_win_string, get_apple_string): Ditto.
* src/cff/cffobjs.c (cff_strcpy): Do not confuse about error.
* src/psaux/psobjs.c (ps_table_done): Ditto.
* src/truetype/ttgxvar.c (ft_var_readpacked*, ft_var_load_avar): Ditto.
2022-01-27 22:55:34 -05:00
Ben Wagner e34a860a07 Document `FT_Outline_Decompose` degenerate segments.
`FT_Outline_Decompose` does not filter out and can return degenerate
segments in an outline. This can be surprising when attemping to
stroke such an outline. Clarify the existing documentation on this
matter to cover all forms of degeneracy (without specifying exactly
how they will be reported), why they might arise, and better explain in
what cases they may be an issue.

* include/freetype/ftoutlin.h (FT_Outline_Decompose): update
documentation.

Fixes #952.
2022-01-27 21:49:47 +01:00
Anuj Verma ab1c98ac18 Fix sdf computation while `USE_SQUARED_DISTANCES`.
Function `map_fixed_to_sdf` expects spread to be absolute
and not squared.

* src/sdf/ftbsdf.c (finalize_sdf): Pass absolute spread
while `map_fixed_to_sdf`.

* src/sdf/ftsdf.c (sdf_generate_bounding_box): Ditto.
2022-01-27 18:01:08 +05:30
Tapish Ojha 3d77756e73 [sfnt] Improve sRGB constants.
* src/base/ftbitmap.c (ft_gray_for_premultiplied_srgb_bgra): Use slightly
more precise values.

Fixes #1018.
2022-01-27 08:43:19 +01:00
Werner Lemberg 9476cb7eb3 docs/release: Updated. 2022-01-27 08:32:42 +01:00
Alexei Podtelezhnikov 837f0345a9 * src/pfr/pfrload.c (pfr_phy_font_load): Use FT_QNEW_ARRAY. 2022-01-26 15:49:24 -05:00
Alexei Podtelezhnikov 0ac535900b * src/sdf/ftsdf.c (sdf_*_new): Use standard macro. 2022-01-26 14:02:27 -05:00
Alexei Podtelezhnikov 09223ef929 [pcf] Delay encoding allocation and avoid its zeroing.
* src/pcf/pcfread.c (pcf_get_encodings): Refactor and use FT_QNEW_ARRAY.
2022-01-26 11:23:38 -05:00
Werner Lemberg 267c6918d1 Aarg, typo. 2022-01-25 14:46:36 +01:00
Werner Lemberg 9af1127fbe freetype.h: More updates to `FT_LOAD_COLOR` description. 2022-01-25 14:45:10 +01:00
Werner Lemberg 8b7226bb43 * builds/unix/configure.raw (FT_DEMO_CFLAGS): Pass `-DHAVE-LIBRSVG`.
This helps in decoupling library support from `pkg-config` for other
platforms.
2022-01-25 14:28:45 +01:00
Werner Lemberg 6a8e95b7a0 Update documentation for `FT_LOAD_COLOR`. 2022-01-25 08:49:41 +01:00
Ben Wagner 5e9caaee78 [pshinter] Ensure all point flags are initialized.
Only off curve point flags were fully initialized.

* src/pshinter/pshalgo.c (psh_glyph_init): always initialize flags.

Fixes: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=43930
2022-01-24 12:24:59 -05:00
Werner Lemberg 657745212b .mailmap: Typo. 2022-01-24 07:57:20 +01:00
Werner Lemberg ef48a33271 * src/svg/ftsvg.c (ft_svg_property_set): Disallow NULL pointers. 2022-01-23 19:05:15 +01:00
Werner Lemberg cddfe6574b .mailmap: Updated. 2022-01-23 12:37:48 +01:00
Werner Lemberg 21d0fa3742 More documentation on handling OT-SVG. 2022-01-23 12:23:47 +01:00
Werner Lemberg 9c1538525b * src/svg/ftsvg.c: Rename `svg_hooks` to `svg-hooks` for consistency. 2022-01-23 08:56:17 +01:00
Werner Lemberg 112527dd44 [sfnt] Reject malformed SVG tables.
* src/sfnt/ttsvg.c (SVG_TABLE_HEADER_SIZE, SVG_DOCUMENT_RECORD_SIZE,
SVG_DOCUMENT_LIST_MINIMUM_SIZE, SVG_MINIMUM_SIZE): New macros.
(tt_face_load_svg): Check offsets.
Check table and record sizes.

Reported as

  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=43918
2022-01-22 12:09:08 +01:00
Alexei Podtelezhnikov 706c79a1da * src/psaux/psobjs.c (ps_table_new): Revert to zeroing. 2022-01-21 22:46:35 -05:00
Alexei Podtelezhnikov 0d2b4952a3 [psaux, type1, type42] Avoid annecessary zeroing.
* src/psaux/psobjs.c (ps_table_new): Use FT_QNEW_ARRAY.
* src/type1/t1load.c (parse_encoding): Ditto.
* src/type42/t42parse.c (t42_parse_encoding): Ditto.
2022-01-20 14:47:01 -05:00
Werner Lemberg 02fa26f4cd [builds/unix] Handle 'librsvg' for demo programs.
* builds/unix/configure.raw: Check for 'librsvg'.
(LIB_CLOCK_GETTIME): Don't call `AC_SUBST` on this but on...
(FT_DEMO_CFLAGS, FT_DEMO_LDFLAGS): ... these two new variables.

* builds/unix/unix-cc.in (LIB_CLOCK_GETTIME): Replaced by...
(FT_DEMO_CFLAGS, FT_DEMO_LDFLAGS): ... these two new variables.
2022-01-20 16:45:18 +00:00
Moazin Khatti 0bf49bd229 Add 'svg' module for OT-SVG rendering.
* CMakeLists.txt (BASE_SRCS): Add svg module file.
* meson.build (ft2_public_headers): Add `otsvg.h`.

* modules.cfg (RASTER_MODULES): Add `svg` module.

* builds/meson/parse_modules_cfg.py: Add svg module.

* include/freetype/config/ftmodule.h: Add `ft_svg_renderer_class`.
* include/freetype/fterrdef.h: Add `Invalid_SVG_Document` and
`Missing_SVG_Hooks` error codes.
* include/freetype/internal/fttrace.h: Add tracing for `otsvg`.
* include/freetype/internal/svginterface.h: New file.  It adds an interface
to enable the presetting hook from the `base` module.
* include/freetype/otsvg.h (SVG_Lib_Init_Func, SVG_Lib_Free_Func,
SVG_Lib_Render_Func, SVG_Lib_Preset_Slot_Func): New hooks for SVG rendering.
(SVG_RendererHooks): New structure to access them.

* src/base/ftobjs.c: Include `svginterface.h`.
(ft_glyphslot_preset_bitmap): Add code for presetting the slot for SVG
glyphs.
(ft_add_renderer): Updated.

* src/svg/*: New files.
2022-01-20 16:45:18 +00:00
Moazin Khatti 97c09a803e Add `FT_Glyph` support for OT-SVG glyphs.
* include/freetype/ftglyph.h (FT_SvgGlyphRec, FT_SvgGlyph): New structure.

* src/base/ftglyph.c: Include `otsvg.h`.
(ft_svg_glyph_init, ft_svg_glyph_done, ft_svg_glyph_copy,
ft_svg_glyph_transform, ft_svg_glyph_prepare): New function.
(ft_svg_glyph_class): New class.
(FT_New_Glyph, FT_Glyph_To_Bitmap): Updated to handle OT-SVG glyphs.
* src/base/ftglyph.h: Updated.
2022-01-20 16:45:18 +00:00
Moazin Khatti 5cf01aa2b2 [truetype, cff] Add code to load SVG document.
* src/cff/cffgload.c (cff_slot_load): Add code to load SVG doc.
* src/truetype/ttgload.c (TT_Load_Glyph): Add code to load SVG doc.
2022-01-20 16:45:18 +00:00
Moazin Khatti f93a897afe Add code to load OT-SVG glyph documents.
* include/freetype/config/ftheader.h (FT_OTSVG_H): New macro.
* include/freetype/freetype.h (FT_FACE_FLAG_SVG, FT_HAS_SVG): New macros.
(FT_LOAD_SVG_ONLY): New internal macro.
* include/freetype/ftimage.h (FT_Glyph_Format): New enumeration value
`FT_GLYPH_FORMAT_SVG`.
* include/freetype/internal/ftobjs.h (FT_GLYPH_OWN_GZIP_SVG): New macro.
* include/freetype/internal/fttrace.h: Add `ttsvg` for `ttsvg.c`.
* include/freetype/internal/sfnt.h(load_svg, free_svg, load_svg_doc): New
functions.
* include/freetype/internal/tttypes.h (TT_FaceRec): Add `svg` for
the SVG table.
* include/freetype/otsvg.h (FT_SVG_DocumentRec): New structure to hold the
SVG document and other necessary information of an OT-SVG glyph in a glyph
slot.
* include/freetype/tttags.h (TTAG_SVG): New macro.

* src/base/ftobjs.c: Include `otsvg.h`.
(ft_glyphslot_init): Allocate `FT_SVG_DocumentRec` in `slot->other`
if the SVG table exists.
(ft_glyphslot_clear): Free it upon clean-up if it is a GZIP compressed
glyph.
(ft_glyphslot_done): Free the document data if it is a GZIP compressed
glyph.
(FT_Load_Glyph): Don't auto-hint SVG documents.

* src/cache/ftcbasic.c (ftc_basic_family_load_glyph): Add support for
FT_GLYPH_FORMAT_SVG.

* src/sfnt/rules.mk (SFNT_DRV_SRC): Add `ttsvg.c`.
* src/sfnt/sfdriver.c: Include `ttsvg.h`.
(sfnt_interface): Add `tt_face_load_svg`, `tt_face_free_svg` and
`tt_face_load_svg_doc`.
* src/sfnt/sfnt.c: Include `ttsvg.c`.
* src/sfnt/sfobjs.c (sfnt_load_face, sfnt_done_face): Add code to load and
free data of the the SVG table.
* src/sfnt/ttsvg.c: New file, implementing `tt_face_load_svg`,
`tt_face_free_svg` and `tt_face_load_svg_doc`.
* src/sfnt/ttsvg.h: Declarations of the SVG functions in
`ttsvg.c`.
2022-01-20 16:45:18 +00:00
Moazin Khatti 06c1a25e63 Add flag `FT_CONFIG_OPTION_SVG`.
This flag is going to be used to conditionally compile support for OT-SVG
glyphs.  FreeType will do the parsing and rely on external hooks for
rendering of OT-SVG glyphs.

* devel/ftoption.h, include/freetype/config/ftoption.h
(FT_CONFIG_OPTION_SVG): New flag.
2022-01-20 16:45:18 +00:00
Alexei Podtelezhnikov 0b635b1eb2 [pshinter] Avoid unnecessary zeroing.
* src/pshinter/pshalgo.c (psh_hint_table_init,psh_glyph_init,
psh_glyph_interpolate_normal_points): Use FT_QNEW_ARRAY.
2022-01-20 15:06:25 +00:00
Alexei Podtelezhnikov 99a940f84a * include/freetype/freetype.h: Clarify `FT_Size` life cycle. 2022-01-20 15:06:09 +00:00
Alexei Podtelezhnikov 054782c48e [base] Undefined scale means no scale.
It might be surprising that FreeType does not have default ppem and
the size has to be set explicitly or face undefined behavior with
undefined variables and errors. This offers an alternative to
missing or zero scale by simply setting FT_LOAD_NO_SCALE.  Defined
behavior is bettr than undefined one.

This is alternative to !132 and discussed in
  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=43708

* src/base/ftobjs.c (FT_Load_Glyph): Deal with zero scale.
* include/freetype/freetype.h: Document it.
2022-01-19 22:14:06 -05:00
Alexei Podtelezhnikov 773e31c783 * src/autofit/afglobal.c (af_face_globals_new): Reduce zeroing.
Everything in AF_FaceGlobals is initialized except metrics.  Those
are zeroed here and initialized on demand later.
2022-01-18 14:05:46 -05:00
Alexei Podtelezhnikov d118bf8e35 [bdf,type1] Avoid unnecessary hash zeroing.
* src/bdf/bdflib.c (_bdf_parse_start): Use `FT_QALLOC`.
* src/type1/t1load.c (parse_subrs): Use `FT_QNEW`.
2022-01-15 23:09:53 -05:00
Ozkan Sezer 3f6497bdc5 Add Watcom C/C++ calling.
In the unlikely case the source is built with OpenWatcom's -ec?
switches to enforce a calling convention, the qsort() compare
function must still be set to __watcall.

* include/freetype/internal/compiler-macros.h (FT_COMPARE_DEF):
Updated.
2022-01-15 22:44:28 -05:00
Ben Wagner 5e227133c1 [pshinter] Avoid accessing uninitialized zone.
The `normal_top.count` may be 0, implying no `normal_top.zones` exist.
The code must not access these (non-existent) `normal_top.zones`.

* src/pshinter/pshalgo.c (ps_hints_apply): Do not assume that
`normal_top.zones[0]` is initialized. Test `normal_top.count`
before using `normal_top.zones[0]`. Do not rescale if there are no
`zones`.

Fixes: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=43675
2022-01-15 17:21:39 -05:00
Alexei Podtelezhnikov edd4fedc54 [cache] Avoid unnecessary zeroing.
* src/cache/ftccmap.c (ftc_cmap_node_new): Use `FT_QNEW`.
* src/cache/ftcimage.c (FTC_INode_New): Ditto.
* src/cache/ftcsbits.c (FTC_SNode_New): Ditto.
2022-01-14 22:53:57 -05:00
Ozkan Sezer 11ea89b51c Add Watcom C/C++ support.
* include/freetype/config/integer-types.h: Make sure `long long` is
used then available.
* include/freetype/internal/ftcalc.h (FT_MSB): Add Watcom C/C++ pragma.
2022-01-14 22:07:44 -05:00
Alexei Podtelezhnikov ba5d661f34 * src/sdf/ftbsdf.c (ED): s/near/prox/.
This works around the Watcom C definition of `near` as restricted
__near.
2022-01-14 21:54:17 -05:00
Alexei Podtelezhnikov 7f7bf6f0f0 * include/freetype/internal/compiler-macros.h [FT_COMPARE_DEF]: Tighten.
This works around Watcom C library using __watcall.
2022-01-14 20:33:28 -05:00
Alexei Podtelezhnikov 7eb9a9dbbe * src/pshinter/pshglob.c (psh_globals_new): Avoid zeroing.
This large allocation is followed by careful initialization. Whatever
is missed should be initialized manually.
2022-01-14 14:40:11 -05:00
Alexei Podtelezhnikov 81b81feb62 * src/base/fthash.c (hash_insert): Avoid unnecessary zeroing. 2022-01-14 18:22:23 +00:00
Alexei Podtelezhnikov 904ad21266 * src/bdf/bdflib.c (_bdf_parse_glyphs): Remove redundant assignment. 2022-01-13 23:38:56 -05:00
Alexei Podtelezhnikov ee52b57121 * src/lzw/ftlzw.c (FT_Stream_OpenLZW): Avoid unnecessary zeroing. 2022-01-13 09:45:48 -05:00
Ben Wagner 6ee8951956 [bzip2] Reset bzip stream on any error.
According to the bzip documentation it is undefined what will happen if
`BZ2_bzDecompress` is called on a `bz_stream` it has previously returned an
error against.  If `BZ2_bzDecompress` returns anything other than `BZ_OK`
the only valid next action is `BZ2_bzDecompressEnd`.

Reported as

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

* src/bzip2/ftbzip2.c (FT_BZip2FileRec_): Add `reset` to track the need to
reset the stream.
(ft_bzip2_file_init): Initialize `reset` to 0.
(ft_bzip2_file_reset): Set `reset` to 0 after resetting.
(ft_bzip2_file_fill_output): Set `reset` to 1 when `BZ2_bzDecompress`
returns anything other than `BZ_OK`.
2022-01-13 08:21:36 +01:00
Werner Lemberg b647dbdeb8 .gitlab-ci.yml: Minor comment cleanups. 2022-01-12 06:22:15 +01:00
Azamat H. Hackimov ca44a236a0 .gitlab-ci.yml: Add steps to `before_script` to ensure recent CA.
Fetch current list of valid CAs from Windows Update and manually import them
to trusted datastore.  This action is required to make downloads work from
sites that need recent Let's Encrypt ISRG Root X1 certificate.
2022-01-12 06:22:15 +01:00
Ben Wagner f1d3b9f10a Revert "[bzip2] Avoid use of uninitialized memory."
This reverts commit d276bcb7f0.

The original commit did avoid the use of uninitialized memory. However,
it appears that the original commit is no longer required. The
underlying issue was resolved by a change in freetype2-testing "Build
bzip2 correctly." [0]. Prior to [0] bzip2 was built without msan, so
bzip2 writes were not tracked or considered initialized. Clearing
`buffer` in the original commit allowed msan to see the `buffer` content
initialized once in FreeType code, but msan saw no writes into buffer
from bzip2.  With bzip2 now built with msan, the bzip2 writes are
properly instrumented and msan sees the bzip2 writes into the buffer. As
a result the original commit can be safely reverted to allow for better
detection of other uninitialized data scenarios.

* src/bzip2/ftbzip2.c (FT_Stream_OpenBzip2): Revert to using `FT_QNEW`.

[0] 3c052a837a
2022-01-11 17:15:35 -05:00
Ben Wagner e838c37c2c [type42] Track how much type42 ttf data is available.
Currently `T42_Open_Face` eagerly allocates 12 bytes for the ttf header
data which it expects `t42_parse_sfnts` to fill out from /sfnts data.
However, there is no guarantee that `t42_parse_sfnts` will actually be
called while parsing the type42 data as the /sfnts array may be missing
or very short. This is also confusing behavior as it means
`T42_Open_Face` is tightly coupled to the implementation of the very
distant `t42_parse_sfnts` code which requires at least 12 bytes to
already be reserved in `face->ttf_data`.

`t42_parse_sfnts` itself eagerly updates `face->ttf_size` to track how
much space is reserved for ttf data instead of traking how much data has
actually been written into `face->ttf_data`. It will also act strangely
in the presense of multiple /sfnts arrays.

* src/type42/t42objs.c (T42_Open_Face): ensure `ttf_data` is initialized
to NULL. Free `ttf_data` on error.

* src/type42/t42parse.c (t42_parse_sfnts): delay setting `ttf_size` and
set it to the actual number of bytes read. Ensure `ttf_data` is freed
if there are multiple /sfnts arrays or there are any errors.
2022-01-11 14:58:18 -05:00
Dominik Röttsches 3876846e26 [sfnt] Fix limit checks for `COLR` v1 ClipBoxes
* src/sfnt/ttcolr.c (tt_face_get_color_glyph_clipbox): Fix off-by-one in
limit checks.
2022-01-11 13:40:20 +02:00
Werner Lemberg d0cfb4e1b2 Update all copyright notices. 2022-01-11 10:54:10 +01:00
Werner Lemberg 947fddc8da * src/sfnt/ttcolr.c (read_paint): Fix undefined left-shift operation.
Reported as

  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=43151
2022-01-11 08:27:26 +00:00
Werner Lemberg 639a02154b * src/type42/t42objs.c (T42_Open_Face): Avoid use of uninitialized memory.
Reported as

  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=43508
2022-01-11 09:14:48 +01:00
Werner Lemberg 33626164e8 .gitlab-ci.yml: Fix typo in previous commit. 2022-01-11 08:01:30 +01:00
Werner Lemberg 4c0db60772 .gitlab-ci.yml: Update Windows image.
The old image produced errors like

```
Downloading zlib patch from
  https://wrapdb.mesonbuild.com/v2/zlib_1.2.11-5/get_patch
A fallback URL could be specified using patch_fallback_url key in the wrap file
WrapDB connection failed to
  https://wrapdb.mesonbuild.com/v2/zlib_1.2.11-5/get_patch
with error
  <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify
   failed: certificate has expired (_ssl.c:1122)>
```
2022-01-11 07:52:28 +01:00
Werner Lemberg 2e62b7446b * subprojects/zlib.wrap: Update from upstream. 2022-01-11 05:37:56 +01:00
Werner Lemberg 4a89112b2a * src/sfnt/ttcolr.c (tt_face_get_color_glyph_clipbox): Add limit checks.
Reported as

  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=40716
2022-01-10 18:31:17 +00:00
Werner Lemberg 3f9b78fc79 [zlib] Don't typedef `ptrdiff_t`.
While using zlib in 'solo' mode (via the `Z_SOLO` macro), we actually
include some standard header files, making the typedef fail on systems where
the native `ptrdiff_t` type differs.

Fixes #1124.

* src/zlib/zutil.h: Comment out definition; it doesn't work on Windows.

* src/zlib/patches/freetype-zlib.diff: Updated.
2022-01-10 18:24:56 +01:00
Werner Lemberg da8a8b8bcf [zlib] Some organizational changes.
We now first apply zlib's `zlib2ansi` script, then FreeType's patch file.

* src/gzip/README.freetype: Updated.

* patches/0001-zlib-Fix-zlib-sources-to-compile-for-FreeType.patch: Renamed
to...
* patches/freetype-zlib.diff: This.
Clean up description, then regenerate it as follows:

  - Copy unmodified files from `zlib` repository.
  - Run `zlib2ansi` script.
  - Run `git diff -R > patches/freetype-zlib.diff.new`.
  - Insert patch description of old diff file, then replace old diff with
    new diff file.
2022-01-10 18:13:10 +01:00
David Turner a25e85ed95 [gzip] Update sources to zlib 1.2.11
This can be tested by building with the Unix development build

  make setup devel
  make

or by building the freetype-demos programs with

  meson setup build -Dfreetype2:zlib=internal
  meson compile -C out

and trying to run `ftview` with a `.pcf.gz` font file.

* src/gzip/ftgzip.c, src/gzip/rules.mk: Update for new zlib sources.  Also
remove the temporary fix introduced in commit 6a431038 to work around the
fact that the internal sources were too old.

* src/gzip/README.freetype: New file describing the origin of the sources
and how they were modified.

* src/gzip/patches/*: Patch files applied to original sources.

* src/gzip/*: Updated zlib sources with the patch file(s) from
`src/gzip/patches/` applied, followed by a conversion with zlib's
`zlib2ansi` script.
2022-01-09 23:16:00 +01:00
David Turner 0d34386366 [meson] Change Zlib configuration option.
* meson_options.txt, meson.build: Change the format of the 'zlib' meson
build configuration option to be a combo with the following choices:

  - none: Do not support gzip-compressed streams at all.

  - internal: Support gzip-compressed streams using the copy of the gzip
    sources under `src/gzip/`; this should only be used during development
    to ensure these work properly.

  - external: Support gzip-compressed streams using the 'zlib' Meson
    subproject, linked as a static library.

  - system: Support gzip-compressed streams using a system-installed version
    of zlib.

  - auto: Support gzip-compressed streams using a system-installed version
    of zlib, if available, or using the 'zlib' subproject otherwise.  This
    is the default.

  - disabled: Backward-compatible alias for 'none'.

  - enabled: Backward-compatible alias for 'auto'.
2022-01-09 21:38:29 +01:00
Werner Lemberg d276bcb7f0 [bzip2] Avoid use of uninitialized memory.
* src/bzip2/ftbzip2.c (FT_Stream_OpenBzip2): Don't use `FT_QNEW` but
`FT_NEW` for setting up `zip` to avoid uninitialized memory access while
handling malformed PCF fonts later on.

Fixes

  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=42800
2022-01-09 07:48:59 +01:00
Alexei Podtelezhnikov ca01112894 [sfnt] Fix off-by-one error.
The 0-base index is equal to the number of previosly parsed entries.
It is an error to adjust it by one to get the number truncated by
a stream error.  This is probably inconsequential because valid
entries are correctly accounted for.

* src/sfnt/ttload.c (check_table_dir): Do not adjust the truncated
number of tables.
2022-01-08 22:28:44 -05:00
Werner Lemberg 7a493e3a40 [sfnt, type42] Correct previous commit.
Really fix https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=42773.

* src/sfnt/ttload.c (check_table_dir): Revert change.

* src/type42/t42.parse.c (t42_parse_sfnts): Don't use `FT_QREALLOC` but
`FT_REALLOC` for setting up `ttf_data` to avoid uninitialized memory access
while handling malformed TrueType fonts later on.
2022-01-08 10:28:19 +01:00
Werner Lemberg bf9b1ef905 * src/sfnt/ttload.c (check_table_dir): Initialize `table`.
Reported as

  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=42773
2022-01-07 10:25:52 +01:00
Werner Lemberg b5c2172f59 [sfnt] Avoid 'runtime error: applying zero offset to null pointer'.
* src/sfnt/ttsbit.c (tt_sbit_decoder_load_byte_aligned): Exit early if
`line` is NULL.
2022-01-07 06:53:44 +01:00
Werner Lemberg 5aa2a5c34a [autofit, pshinter] Use `FT_OFFSET`.
This avoids

```
runtime error: applying zero offset to null pointer
```

warnings of clang's undefined behaviour sanitizer.

* src/autofit/afcjk.c (af_cjk_hints_link_segments,
af_cjk_hints_compute_edges, af_cjk_hints_compute_blue_edges,
af_cjk_hint_edges, af_cjk_align_edge_points): Do it.

* src/autofit/afhints.c (af_glyph_hints_align_edge_points,
af_glyph_hints_align_strong_points): Ditto.

* src/autofit/aflatin.c (af_latin_metrics_init_widths,
af_latin_hints_link_segments, af_latin_hints_compute_edges,
af_latin_hints_compute_blue_edges, af_latin_hint_edges): Ditto.

* src/pshinter/pshalgo.c (psh_hint_table_init): Ditto.
2022-01-07 06:41:36 +01:00
Ben Wagner afb4ca0151 [truetype] Reset localpoints when varying cvt.
When iterating over the cvt tuples and reading in the points it is necessary
to set all of `localpoints`, `points`, and `point_count` in all cases.  The
existing code did not reset `localpoints` to `NULL` when there were no
private point numbers.  If the previous tuple did have private point numbers
and set `localpoints` to `ALL_POINTS` this would not be cleared and the
wrong branch would be taken later, leading to possible heap buffer overflow.

* src/truetype/ttgxvar.c (tt_face_vary_cvt): Reset `localpoints` to `NULL`
when it isn't valid.

Fixes: https://crbug.com/1284742
2022-01-06 19:13:00 +01:00
Werner Lemberg 2b672e7210 * builds/unix/configure.raw: Restore `SYSTEM_ZLIB` variable.
This was accidentally removed with commit 93ebcbd0 almost eight years ago.
2022-01-02 18:33:03 +01:00
Alexander Borsuk 4eb6cb8818 Fix warnings for CMake Unity builds.
* src/cache/ftcbasic.c (FT_COMPONENT): Undefine macro before redefinition.
* src/smooth/ftgrays.c (TRUNC, FRACT): Ditto.
2021-12-27 07:48:04 +01:00
Alexander Borsuk 4f35711844 Clang-Tidy warning fixes.
* src/base/ftobjs.c (FT_Get_Paint): Operator has equivalent nested operands.
* src/bdf/bdflib.c (_bdf_add_property): Value stored to `fp` is never read.
* src/sdf/ftbsdf.c (bsdf_init_distance_map): Value stored to `pixel` is
never read.
* src/sdf/ftsdf.c (split_sdf_shape): Value stored to `error` is never read.
2021-12-18 11:09:15 +01:00
Eli Schwartz d6a5c57727 * meson.build: Optimize lookup for `python3` program.
The python module's `find_installation` method is intended to provide
routines for compiling and installing python modules into the
`site-packages` directory.  It does a couple of slow things, including run
an introspection command to scrape sysconfig info from the detected
interpreter, which are not needed for the sole use case of invoking the
found installation as an executable.

Furthermore, when invoked without the name or path of a python binary, it is
hardcoded to always look for `python3` corresponding to the interpreter
meson itself uses to run.  So using `find_installation` did not even allow
detecting `python2` as a fallback.

Instead, switch to a simple `find_program` lookup that finishes as soon as
the program is found.
2021-12-17 10:47:13 +01:00
Eli Schwartz 57fd61805f * builds/meson/*.py: Fix name of python executable for auxiliary scripts.
The previous change to check the return code of `run_command` invocations
caused the CI to fail.  Although most scripts used `python_exe` as the
program command, the script to determine the project version did not.

But, all scripts used `python` as the shebang, and this is not available on
all systems.  Particularly Debian does not provide a `python` command,
though `python3` does exist.  This meant that formerly the version number
was lacking, and now the build simply fails.

Instead, rely on `python3` since it is guaranteed to exist when running
meson, and `python2` is end of life anyway.
2021-12-17 10:45:29 +01:00
Eli Schwartz e342f83c0b * meson.build: Check the return value of `run_command`.
By default, errors are not checked and a command that is somehow broken will
just capture incorrect output (likely an empty string).  Current development
versions of meson now raise a warning for this implicit behavior, and advise
explicitly setting the `check:` keyword argumend to determine whether a
failing return code should be considered an error.

Since none of the commands in this project are expected to fail, mark them
as required to succeed.
2021-12-17 10:38:57 +01:00
Alexei Podtelezhnikov 0da2a1155e [truetype] Upstream the hdmx binary search.
* src/truetype/ttobjs.h (TT_SizeRec): Add `widthp` for the hdmx
widths.
* src/truetype/ttobjs.c (tt_size_reset): Initialize `widthp` even
though it might never be used by the interpreter.
* src/truetype/ttgload.c (tt_loader_init): Avoid repeated searches
in the hdmx table.
2021-12-13 11:44:24 -05:00
Alexei Podtelezhnikov fd03dcc122 [truetype] Reset the IUP-called flags for each subglyph.
This fixes fall-out from 7809007a5b, where the composite
accents were no longer hinted.

* src/truetype/ttgload.c (ttloader_init): Move the IUP-called flag
initialization from here...
* src/truetype/ttinterp.c (TT_Run_Context): ... to here.
2021-12-12 12:29:04 -05:00
Alexei Podtelezhnikov 7add5b2bcb [truetype] Binary search through the `hdmx` records.
The `hdmx` table is supposed to be sorted by ppem size, which
enables binary search.  We also drop the check for the sufficient
length of the record because it is now enforced when the table
is loaded.

* include/freetype/internal/tttypes.h (TT_FaceRec): Store the `hdmx`
record pointers sorted by ppem instead of ppem's themselves.
* src/truetype/ttpload.c (tt_face_load_hdmx): Prudently sort records.
(tt_face_get_device_metrics): Implement binary search to retrieve
advances.
2021-12-11 22:54:06 -05:00
Alexei Podtelezhnikov a8ef33e3ae [truetype] Honor FT_LOAD_ADVANCE_ONLY if `hdmx` is usable.
This simply shortcuts the glyph loading if FT_LOAD_ADVANCE_ONLY
is specified by FT_Get_Advances and the `hdmx` data are located.
Particularly, the classic v35 interpreter or "verified" ClearType
fonts might see 100x speed up in retrieving the hdmx cache.

* src/truetype/ttgload.c (TT_Load_Glyph): Insert the shortcut.
2021-12-11 22:42:46 -05:00
Alexei Podtelezhnikov 6c831d658f [truetype] Initialize the loader with `hdmx` data.
The `hdmx` matching can be done before the glyph is loaded.

* include/freetype/internal/tttypes.h (TT_LoaderRec): Add a field.
* src/truetype/ttgload.c (compute_glyph_metrics): Relocate the `hdmx`
code from here...
(tt_loader_init): ... to here, before the glyph is loaded.
2021-12-11 22:34:27 -05:00
Alexei Podtelezhnikov 7809007a5b [truetype] Relocate subpixel flag setting.
`TT_RunIns` is too busy to deal with subpixel flags. It is better
to set them in `tt_loader_init`, which is executed before each
glyph program.

* src/truetype/ttinterp.c (TT_RunIns): Move the flag setting from
here...
* src/truetype/ttgload.c (tt_loader_init): ... to here.
2021-12-11 22:22:57 -05:00
Alexei Podtelezhnikov a35b081ebc [truetype] Limit INSTCTRL appication within specs.
* src/truetype/ttinterp.c (Ins_INSTCTRL): Limit its global effects
to the CVT program and local effects to the glyph program.

This also fixes an Infinality buglet. The `ignore_x_mode` should be
locally unset by the glyph program.
2021-12-11 22:12:25 -05:00
Ben Wagner bad92be927 [bdf] Fix use of uninitialized value.
In _bdf_readstream if the data contained no newline then the buffer
would continue to grow and uninitialized data read until either the
uninitialized data contained a newline or the buffer reached its
maxiumum size. The assumption was that the line was always too long and
the buffer had been filled, however this case can also happen when there
is not enough data to fill the buffer.

Correct this by properly setting the cursor to the end of the available
data, which may be different from the end of the buffer. This may still
result in one extra allocation, but only on malformed fonts.

* src/bdf/bdflib.c (_bfd_readstream): Correctly update cursor. Remove
unread set of `avail`.

Bug: https://lists.nongnu.org/archive/html/freetype-devel/2021-12/msg00001.html
2021-12-09 17:07:58 -05:00
Alexei Podtelezhnikov 012b00f3e6 [truetype] Reduce Infinality footprint again.
* src/truetype/ttgload.c (compute_glyph_metrics): Streamline and
prioritize the Infinality checks to use `hdmx`.
2021-12-07 10:19:06 -05:00
Cameron Cawley 1f95189875 [builds/windows] Guard some non-ancient API.
We can support Windows 98 and NT 4.0 in principle...

* builds/windows/ftdebug.c, builds/windows/ftsystem.c: Check for the
ancient SDK using _WIN32_WINDOWS, _WIN32_WCE, or _WIN32_WINNT.
2021-12-06 23:08:46 -05:00
Cameron Cawley 9a533aa27f * builds/windows/visualc/freetype.vcproj: Add missing file. 2021-12-06 21:46:47 -05:00
Werner Lemberg 3f83daeecb * Version 2.11.1 released.
==========================

Tag sources with `VER-2-11-1'.

* docs/VERSION.TXT: Add entry for version 2.11.1.
* docs/CHANGES, docs/release: Updated.

* README, src/base/ftver.rc, builds/windows/vc2010/index.html,
builds/windows/visualc/index.html, builds/windows/visualce/index.html,
builds/wince/vc2005-ce/index.html, builds/wince/vc2008-ce/index.html,
docs/freetype-config.1: s/2.11.0/2.11.1/, s/2110/2111/.

* include/freetype/freetype.h (FREETYPE_PATCH): Set to 1.

* builds/unix/configure.raw (version_info): Set to 24:1:18.
* CMakeLists.txt (VERSION_PATCH): Set to 1.

* builds/toplevel.mk (version_tag, CHANGELOG_SCRIPT): New variables.
(do-dist): Generate `ChangeLog` file with all commits since last release.
2021-12-02 13:33:12 +01:00
Alexei Podtelezhnikov 03380482ce [builds/windows] Improve debugging.
* builds/windows/ftdebug.c (FT_Message, FT_Panic): Buffer output
and call `OutputDebugStringA` only if `IsDebuggerPresent`.
[_WIN32_WCE] (OutputDebugStringA): Implement the missing API.
2021-11-29 20:45:07 -05:00
Seigo Nonaka 3b45f564e9 * src/base/ftobjs.c (FT_Request_Metrics): Fix build warning on Android.
Use casts since `FT_USHORT_MAX` is unsigned short in bionic (libc used in
Android).
2021-11-29 18:21:27 +01:00
Alexei Podtelezhnikov 64e26ad3a2 * builds/windows/vc2010/freetype.vcxproj (DlgCopy): Minor tweak. 2021-11-27 22:31:17 -05:00
Alexei Podtelezhnikov 36a905e174 * src/truetype/ttpload.c (tt_face_load_hdmx): Added comments. 2021-11-26 09:15:46 -05:00
Alexei Podtelezhnikov 32f13c11a4 [truetype] Quietly reject out-of-spec `hdmx` tables.
The `hdmx` table is optional and can be safely rejected without
an error if it does not follow specifications. The record size
must be equal to the number of glyphs + 2 + 32-bit padding.

* src/truetype/ttpload.c (tt_face_load_hdmx): Thoroughly check
the record size and improve tracing.
2021-11-25 22:38:40 -05:00
Alexei Podtelezhnikov cff026d415 [truetype] Partly revert 5b626281.
Fixes #1118.

* src/truetype/ttpload.c (tt_face_load_hdmx): Do not assume that
`record_size` is rounded even though the records are padded.
2021-11-23 16:05:12 -05:00
Alexei Podtelezhnikov 99086bf224 * builds/windows/vc2010/freetype.vcxproj (DlgCopy): Use transforms. 2021-11-23 16:02:02 -05:00
Werner Lemberg 3cabd142ce Update `CHANGES` files, other minor whitespace and documentation issues. 2021-11-22 19:58:21 +01:00
Werner Lemberg 81912a1385 formats.txt: Add info about WOFF and WOFF2. 2021-11-21 18:31:53 +01:00
Werner Lemberg 407f31ff87 meson.build: Initialize `common_ldflags`. 2021-11-21 11:01:59 +01:00
Lukas Oberhuber 896630bed6 * meson.build: Fix compatibility version on MacOS.
Fixes #1117.
2021-11-21 10:41:53 +01:00
Werner Lemberg a11650d7fa * src/truetype/ttinterp.c (Ins_MD): Avoid `FT_ABS`.
Reported as

  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=38562
2021-11-21 07:54:49 +01:00
Alexei Podtelezhnikov f8a4163a45 * include/freetype/fttypes.h (FT_MAKE_TAG): Remove the same casting. 2021-11-20 07:01:26 -05:00
Werner Lemberg 6da5f95fcf [gxvalid] Fix minor compilation warning.
* src/gxvalid/gxvmort5.c (gxv_mort_subtable_type5_subtable_setup): Declare
as static.
2021-11-20 09:29:09 +01:00
Werner Lemberg f5ce182420 [smooth] Fix stand-alone compilation.
* src/smooth/ftgrays.c (FT_Trace_Enable, FT_Trace_Disable)[STANDALONE_]:
Define.
2021-11-20 07:58:40 +01:00
Werner Lemberg 8c8f51c558 Avoid undefined left-shifts.
We really have to use double casts to avoid issues with C's and C++'s
signedness propagation rules in implicit casts.

Reported as

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

* include/freetype/config/public-macros.h (FT_STATIC_CAST,
FT_REINTERPRET_CAST): Modify macro to take two arguments.
Update all callers.
(FT_STATIC_BYTE_CAST): New macro.

* include/freetype/freetype.h (FT_ENC_TAG): Use `FT_STATIC_BYTE_CAST`.
* include/freetype/ftimage.h (FT_IMAGE_TAG): Ditto.
* include/freetype/fttypes.h (FT_MAKE_TAG): Ditto.
Use `FT_Tag` for casting.

* src/ftraster/ftmisc.h (FT_MAKE_TAG): Removed, no longer needed.
(FT_STATIC_BYTE_CAST): New macro.

* src/smooth/ftgrays.c (FT_STATIC_CAST): Replace with...
(FT_STATIC_BYTE_CAST): ... this.
2021-11-20 07:58:31 +01:00
Werner Lemberg 9079c5d91a Provide C++ versions for public macros with casts.
Many FreeType clients use C++.  However `g++ -Wold-style-cast` warns for
macros with C-style casts even for system header files; this also affects
directories included with `-isystem`.  While this could be seen as a problem
with g++, the problem is more a philosophical one: Over the time, C and C++
diverged more and more, and some features of C are no longer the 'right'
solution in C++.

* include/freetype/config/public-macros.h (FT_STATIC_CAST,
FT_REINTERPRET_CAST): New macros.

* include/freetype/freetype.h (FT_ENC_TAG, FT_LOAD_TARGET_,
FT_LOAD_TARGET_MODE): Use `FT_STATIC_CAST`.
Correctly handle negative 'signed char' input.
* include/freetype/ftimage.h (FT_IMAGE_TAG): Ditto.
* include/freetype/fttypes.h (FT_MAKE_TAG, FT_BOOL): Ditto.
* include/freetype/ftmodapi.h (FT_FACE_DRIVER_NAME): Use
`FT_REINTERPRET_CAST`.

* src/smooth/ftgrays.c (FT_STATIC_CAST)[STANDALONE_]: New macro.
[!STANDALONE]: Include `FT_CONFIG_CONFIG_H`.

Fixes #1116.
2021-11-18 19:28:07 +00:00
Werner Lemberg 238245cd66 Fix clang++ warnings.
* src/*: Initialize some variables to NULL.
2021-11-16 22:08:47 +01:00
Werner Lemberg e4f7673e46 [truetype] Updates for the forthcoming OpenType 1.9 standard (2/2).
* src/truetype/ttgxvar.c (ft_var_load_item_variation_store):
s/shortDeltaCount/wordDeltaCount/ (as done in the specification, too).
Recognize new format and reject it for now.
2021-11-16 20:13:58 +00:00
Werner Lemberg 93e6b3e8e9 [truetype] Updates for the forthcoming OpenType 1.9 standard (1/2).
This is in preparation for implementing `DeltaSetIndexMap` format 1, which
is used by `COLR` v1 tables, and which allows 32bit indices.

  https://docs.microsoft.com/en-us/typography/opentype/otspec190/delta/otvarcommonformats_delta.html

* src/truetype/ttgxvar.h (GX_DeltaSetIdxMapRec): Change type of `mapCount`
to `FT_ULong`.

* src/truetype/ttgxvar.c (ft_var_load_delta_set_index_mapping): Add argument
for passing the table size; update caller.
Implement new format.
2021-11-16 20:13:58 +00:00
Werner Lemberg d31bafcb9c Fix clang warnings.
* src/gxvalid/gxvcmmn.h (GXV_SET_ERR_IF_PARANOID): Use 'do' block.
* src/gxvalid/gxvmod.c (GXV_TABLE_LOAD, GXV_TABLE_VALIDATE): Ditto.

* src/smooth/ftgrays.c (gray_convert_glyph): Add cast.

* src/type1/t1gload.c (T1_Parse_Glyph_And_Get_Char_String): Remove cast.
* src/type1/t1load.c (read_binay_data): Use `FT_ULong` for `size` parameter.
(parse_subrs, parse_charstrings, parse_dict): Ditto; also add some casts.
2021-11-14 11:02:54 +01:00
Dominik Röttsches 9597fd7b40 [sfnt] Avoid undefined shifts in `COLR` v1 paint parsing
* src/sfnt/ttcolr.c (read_paint, tt_face_get_paint): Tighten shift
behavior by using multiplication, mostly using macros from ftcalc.h.

Fixes: https://bugs.chromium.org/p/chromium/issues/detail?id=1269168
2021-11-13 06:48:23 +00:00
Alexei Podtelezhnikov cf55313650 [builds/windows] Improve `DlgCopy` target.
Fixes #1113.

* builds/windows/vc2010/freetype.vcxproj: Run `DlgCopy` conditionally
and decouple it from `Build`.
2021-11-12 22:27:18 -05:00
Alexei Podtelezhnikov 42e617238a Explicitly define `FT_MSB` for Clang.
* include/freetype/internal/ftcalc.h [__clang__] (FT_MSB): Updated.
2021-11-11 23:06:36 -05:00
Alexei Podtelezhnikov c5cd2a3db4 * src/truetype/ttgxvar.c (ft_var_to_normalized): Edge optimization. 2021-11-10 08:46:26 -05:00
Alexei Podtelezhnikov 188c7d6670 Additional `FT_MSB` macro definitions.
Better macros for Windoes CE and ARM in general, based on !109
from metarutaiga.

* include/freetype/internal/ftcalc.h [_MSC_VER] (FT_MSB): Updated.
2021-11-09 22:47:26 -05:00
Alexei Podtelezhnikov 05089e8a07 [build/windows] Remove logging from default debug configurations.
DLG is rather costly for performance and should be used judiciously.
This removes it from the default configurations but gives an example
how to enable it using the `UserDefines` property.

* builds/windows/vc2010/freetype.vcxproj: Hide FT_DEBUG_LOGGING.
2021-11-08 22:33:12 -05:00
Werner Lemberg d899b200f6 * src/sfnt/sfobjs.c (sfnt_open_font): Fix typo. 2021-11-08 12:27:04 +01:00
Werner Lemberg b86f96bce6 * src/gxvalid.*, src/otvalid.*: Fix `-Wformat` warnings. 2021-11-08 11:44:02 +01:00
Werner Lemberg cce782281b [pshinter] Fix C++ compilation.
* src/pshinter/pshalgo.c (psh_compute_dir): Fix type of `result`.
(psh_hint_table_find_strong_points): Add cast.
2021-11-08 09:41:54 +01:00
Werner Lemberg 7ef266045f [sfnt] Reduce footprint if WOFF and WOFF2 support is not needed.
Based on a patch from metarutaiga (MR !106).  The gist of this commit is
that it doesn't make sense to support WOFF without compression (which would
be only possible in WOFF 1.0 anyway).

* src/sfnt/sfobjs.c (sfnt_open_font): Guard WOFF code with
`FT_CONFIG_OPTION_USE_ZLIB` block.
Guard WOFF2 code with `FT_CONFIG_OPTION_USE_BROTLI` block.

* src/sfnt/sfwoff.c, src/sfnt/sfwoff.h: Guard files with
`FT_CONFIG_OPTION_USE_ZLIB` blocks, not parts of the code.

* src/sfnt/sfwoff2.c, src/sfnt/sfwoff2.h, src/sfnt/woff2tags.c,
src/sfnt/woff2tags.h: Guard files with `FT_CONFIG_OPTION_USE_BROTLI` blocks,
not parts of the code.

Fixes #1111.
2021-11-08 08:56:37 +01:00
Werner Lemberg bb4e049abe [truetype] Make trickyness checks depend on TT_USE_BYTECODE_INTERPRETER.
Based on a patch from metarutaiga (MR !106).

* src/truetype/ttobjs.c (tt_skip_pdffont_random_tag,
tt_check_trickyness_family, tt_synth_sfnt_checksum, tt_get_sfnt_checksum,
tt_check_trickyness_sfnt_ids, tt_check_trickyness): Put functions into a
`TT_USE_BYTECODE_INTERPRETER` block.
(tt_face_init): Put trickyness checks into a `TT_USE_BYTECODE_INTERPRETER`
block.

Fixes #1111.
2021-11-08 08:22:13 +01:00
Alexei Podtelezhnikov 9ebdc9cb1b * src/sfnt/ttload.c (tt_face_load_gasp): Fix a type mismatch warning. 2021-11-07 23:21:40 -05:00
Alexei Podtelezhnikov 7f4b9bfbc9 [dlg] Define DLG_STATIC explicitly.
DLG_STATIC is intended to disable Windows DLL linking attributes.
It does not hurt to define it explicitly when we wrap DLG code.
This fixes tons of LNK4286 and C4273 warnings from MSVC if we
forget to define DLG_STATIC as a compiler option.

* builds/windows/vc2010/freetype.vcxproj: Remove DLG_STATIC option.
* src/dlg/dlgwrap.c [FT_DEBUG_LOGGING]: Define DLG_STATIC.
* include/freetype/internal/ftdebug.h [FT_DEBUG_LOGGING]: Ditto.
2021-11-07 10:20:16 -05:00
Alexei Podtelezhnikov c693377ed3 [dlg] Lighten up the inclusions.
The DLG wrapper needs to know if FT_DEBUG_LOGGING is defined in
`ftoption.h`. It does not need entire FreeType.

* src/dlg/dlgwrap.c: Include FT_CONFIG_OPTIONS_H directly.
2021-11-07 10:05:05 -05:00
Alexei Podtelezhnikov cb9e7b7aac [truetype] Avoid some memory zeroing in variations.
* src/truetype/ttgxvar.c (ft_var_readpackeddeltas, ft_var_load_avar,
ft_var_load_item_variation_store, ft_var_load_gvar): Use FT_QNEW_ARRAY
if memory immediately initialized or discarded otherwise.
2021-11-06 22:59:31 -04:00
Jany Belluz fc55291b1c [truetype] Fix handling of packed deltas in Variation Fonts.
* src/truetype/ttgxvar (ft_var_readpackeddeltas): Don't expect the number of
bytes used to encode the deltas to be higher than the number of encoded
values.  The specification allows a very compact encoding; for example, a
list of 200 zeros can be encoded with just a couple of bytes.

We now count the consumed bytes to make sure to not read more than expected.
2021-11-05 13:53:45 +01:00
Jany Belluz 9ed5332fe6 [truetype] Fix CVAR handling of tuples for all points.
* src/truetype/ttgxvar (tt_face_vary_cvt): Function
`ft_var_readpackedpoints`, when it returns `ALL_POINTS`, also sets
`point_count` to value 0.  However, the CVAR code was incorrectly expecting
that `point_count` would be set to match the length of the CVT table.
2021-11-04 12:09:01 +01:00
Jany Belluz 23d1d8ada8 * src/truetype/ttgxvar.c: Fix typos in macros that guard CVAR code. 2021-11-04 12:07:47 +01:00
Alexei Podtelezhnikov 5d651faa70 * docs/INSTALL: Mention Meson and MSBuild more prominently. 2021-11-03 22:43:22 -04:00
Gabor Kertesz e6e6cbf164 [libpng] Update Meson wrap for win-arm64
1.6.37-5 released patches for win-arm64 to successfully build
libpng with Meson:
https://github.com/mesonbuild/wrapdb/pull/205
https://github.com/mesonbuild/wrapdb/pull/216

Updated by the following command:
meson wrap update libpng

Tested on win-arm64 and x64.
2021-11-03 10:25:12 +01:00
Dominik Röttsches d3d3ff76d1 [sfnt] Clarify `COLR` v1 FT_Paint* format representations
* include/freetype/ftcolor.h (FT_PaintLinearGradient,
FT_PaintRadialGradient, FT_PaintSweepGradient, FT_PaintTransform,
FT_PaintTranslate, FT_PaintScale, FT_PaintRotate, FT_PaintSkew): Clarify
16.16 fixed point representation of struct fields.
* src/sfnt/ttcolr.c (read_paint): Shift coordinates for
FT_PaintLinearGradient, FT_PaintRadialGradient, FT_PaintSweepGradient
accordingly.

Fixes: https://gitlab.freedesktop.org/freetype/freetype/-/issues/1110
2021-11-03 08:28:10 +00:00
Alexei Podtelezhnikov 588a058d9b [builds/windows] Let MSBuild handle DLG copy.
* builds/windows/vc2010/freetype.vcxproj: Specify DlgCopy target.
* builds/windows/vc2010/script.bat: Deleted.
2021-11-02 22:51:51 -04:00
Alexei Podtelezhnikov 94cb3a2eb9 * src/truetype/ttgload.c (load_truetype_glyph): Fix MSVC warning C4312. 2021-10-29 10:31:59 -04:00
Alexei Podtelezhnikov 31fd054701 [builds/windows] Separate MSVC linker and librarian.
MSVC uses LIB for static and LINK for dynamic libraries. They are
related but the former has much smaller set of options.

* builds/windows/vc2010/freetype.vcxproj: Updated.
2021-10-29 10:13:47 -04:00
Alexei Podtelezhnikov 79b28d3781 [builds/windows] Revise MSVC linking optimizations.
* builds/windows/vc2010/freetype.vcxproj: Optimize DLL linking only.
* builds/windows/visualc/freetype.dsp: Ditto.
* builds/windows/visualc/freetype.vcproj: Ditto.
2021-10-28 22:51:15 -04:00
Alexei Podtelezhnikov 793c012635 [woff] Optimize table tagging.
* include/freetype/internal/wofftypes.h (WOFF_TableRec): Use
32-bit tag.
* src/sfnt/sfwoff.c (woff_open_font): Use 32-bit tag.
2021-10-27 22:36:11 -04:00
Alexei Podtelezhnikov a577bbcb5b [woff2] Optimize table tagging.
Fixes #1107.

* include/freetype/internal/wofftypes.h (WOFF2_TableRec): Use
32-bit tag.
* src/sfnt/sfwoff2.c (compare_tags, find_table, woff2_open_font):
Use 32-bit tag.
* src/sfnt/woff2tags.[ch] (woff2_known_tags): Use static storage and
return 32-bit tag.
2021-10-27 22:24:27 -04:00
Werner Lemberg 80b13f5732 Formatting. 2021-10-26 10:57:17 +02:00
Ben Wagner 535c67dda7 [mm] Tolerate missing Blend dictionary entries
In a Multiple Master font, the Blend dictionary must contain valid
Private, FontInfo, and FontBBox. The current code will error if any of
these are present and invalid, but will not error and will provide
uninitialized data if the Blend dictionary exists but does not contain
one of these entries. This change reverts to the older behavior of
treating any missing entries as containing all zero data and not
returning an error.

In the future it may be best to keep track of when these are actually
initialized and error if they are not.

* src/type1/t1load.c (t1_allocate_blend): Zero initiailize.
2021-10-25 22:38:05 -04:00
Alexei Podtelezhnikov f091e60c48 [builds/windows] Add MSVC linker optimazations.
We continue to build static libraries with statically linked C run-
time and add options to optimize references.

* builds/windows/vc2010/freetype.vcxproj: Sort entries, add options.
2021-10-25 22:31:09 -04:00
Alexei Podtelezhnikov 92f5e15f4f * builds/windows/vc2010/freetype.vcxproj: Use MachineARM64. 2021-10-23 09:43:46 -04:00
Alexei Podtelezhnikov 5e6efd6a4c [builds/windows] Prioritize x64.
* builds/windows/vc2010/freetype.sln: Sort entries.
2021-10-22 15:25:10 -04:00
Gabor Kertesz 80bd4cba7e [builds/windows] Add ARM64 platform.
* builds/windows/vc2010/freetype.sln: Updated
* builds/windows/vc2010/freetype.vcxproj: Updated.
* builds/windows/vc2010/freetype.vcxproj.filters: Minor fix.
2021-10-22 10:56:42 -04:00
Ben Wagner 65be4b2112 [mm] Delay setting blend weight and design position.
Previously the `blend->weight_vector`, `blend->default_weight_vector`,
and `blend->design_pos` were set early to allocated but uninitialized
memory under the assumption that the memory would eventually be
initialized. However, it is possible that some of the required
keywords may not actually be present, leaving the memory uninitialized.
This is different from a present but invalid table, which would produce
an error.

Reported as
  https://bugs.chromium.org/p/chromium/issues/detail?id=1261762

* src/type1/t1load.c (t1_allocate_blend): Remove early allocation and
initialization.
(parse_blend_design_positions, parse_weight_vector): Parse into local
and assign to blend if valid.
(T1_Open_Face): Check that if a blend exists that it has the weight
vector and design positions.
2021-10-21 09:55:28 -04:00
Ben Wagner b5e003f1f2 [cff] Commit vstore data and regions on allocation.
The vstore->regionCount and vstore->dataCount were read directly
from the data. However, vstore->varRegionList and vstore->varData
would still contain uninitialized entries with uninitialized
pointers in the event of an error, leading to issues when attempting
to clean up.

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

* src/cff/cffload.c (cff_vstore_load): Read the region and data counts
into locals and update the vstore counts immediately after each entry
becomes free-able.
2021-10-21 09:48:38 -04:00
Ben Wagner fde91ab8f1 [sfnt] Delay setting gasp ranges and count until computed.
Previously, the gasp.numRanges was set and gasp.gaspRanges was
allocated and assigned before a possible early exit if the frame could
not be entered. It is also possible that the gaspRanges allocation
could fail but the numRanges still be set to non-zero. In such cases
an error would be returned, but the face would have a gasp in an
inconsistent state which may still be accessed.

Reported as
  https://bugs.chromium.org/p/chromium/issues/detail?id=1261450

* src/sfnt/ttload.c (tt_face_load_gasp): Delay setting gasp.numRanges
and gasp.gaspRanges until after the ranges are initialized.
2021-10-20 11:45:15 -04:00
Ben Wagner 6d12e3a0ca [sfnt] Delay setting names and langTags until computed.
Previously, the table->names and table->langTags fields were created
pointing to uninitialized memory and an early exit could happen if the
frame could not be entered. The caller would then be unable to properly
dispose of the memory as the string fields had not been initialized.

Reported as
  https://bugs.chromium.org/p/chromium/issues/detail?id=1261343

* src/sfnt/ttload.c (tt_face_load_name): delay setting table->langTags
and table->names until after the memory they will point to is fully
initialized.
2021-10-20 11:38:16 -04:00
Alexei Podtelezhnikov e990c33f21 * tests/issue-1063/main.c: s/PATH_MAX/FILENAME_MAX/.
Closes !97 for Windows by using a standard macro.
2021-10-20 11:27:03 -04:00
Werner Lemberg 8ef8072ba1 [bdf, cid, pfr, winfonts] Improve rejection of other font formats.
This is mainly for better diagnostics of malformed fonts.

* src/bdf/bdflib.c (_bfd_readstream): Stop font format testing if the first
input line is too long or doesn't end with `\r` or `\n`.

* src/cid/cidparse.c (cid_parser_new): Don't handle too short input as an
error but as an unknown format.

* src/pfr/pfrobjs.c (pfr_face_init): Ditto.

* src/winfonts/winfnt.c (fnt_font_load, fnt_face_get_dll_font): Ditto.
2021-10-19 22:59:46 +02:00
Alexei Podtelezhnikov 38b349c41b [pcf] Zero out the allocated properties.
Fallout reported as
  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=40033

* src/pcf/pcfread.c (pcf_get_properties): Use FT_NEW_ARRAY and zero
out `properties` in case of failure.
2021-10-18 20:35:28 -04:00
Werner Lemberg de9faa53ed configure: Use string comparison for directory inodes.
Inode values might be larger than integers supported by the shell.

Fixes #1105.
2021-10-18 21:05:04 +02:00
Alexei Podtelezhnikov 986d503f4a * src/sfnt/ttload.c (tt_face_load_name): NULL-initialize langTag.
Another attempt to fix fallout reported as
  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=40024
2021-10-17 09:14:27 -04:00
Alexei Podtelezhnikov 30ca63d4fb [bdf] Fix up user properties.
Fallout reported as
  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=40027

* src/bdf/bdflib.c (_bdf_add_property): Cosmetic NULL.
(bdf_create_property): Limit allocations to customary signed
FT_Long and NULL-initialize unused storage.
(bdf_free_font): Do not free unused storage.
2021-10-16 23:02:47 -04:00
Alexei Podtelezhnikov afd1cb2881 * src/sfnt/ttload.c (tt_face_load_name): Accounting fix.
Fallout reported as
  https://crbug.com/40024
2021-10-16 20:25:11 -04:00
Ben Wagner c71eb22dde Fix typos in memory macros.
FT_QNEW_ARRAY and FT_QRENEW_ARRAY were using the non-Q
FT_MEM_NEW_ARRAY and FT_MEM_RENEW_ARRAY. Change these to use the Q
versions. Also fix the one issue discovered in tt_face_load_name
where table->names is created with FT_QNEW_ARRAY but the extra
string member is not initialized to NULL.

* include/freetype/internal/ftmemory.h (FT_Q(RE)NEW_ARRAY):
Use FT_MEM_Q(RE)NEW_ARRAY as needed.

* src/sfnt/ttload.c (tt_face_load_name): Initialize `entry->string`.
2021-10-15 22:18:38 -04:00
Ben Wagner 8406ae5324 [truetype] Reload context after re-executing `prep`.
When a different hinting mode from the current is selected, the `prep` table
must be re-executed with the new mode.  After this happens the context must
be re-loaded in preparation for the glyph program to be run.

Fixes #1104.

* truetype/ttgload.c (tt_loader_init): Add call to `TT_Load_Context`.
2021-10-15 22:37:31 +02:00
Werner Lemberg 0b92c56c34 [truetype] Minor documentation improvements. 2021-10-15 19:02:41 +02:00
Anurag Thakur 943a6bf7e6 Add clang build to linux CI 2021-10-14 02:00:10 +00:00
Anurag Thakur ede96b239b CI: Add macOS CI, including a clang build 2021-10-12 21:06:41 +05:30
Alexei Podtelezhnikov e294a95ca8 * src/cid/cidload.c (parse_fd_array): Protect against trancation. 2021-10-11 23:25:29 -04:00
Alexei Podtelezhnikov 1029eb9377 [type1] Revert to signed size for binary data.
Recently introduced and reported as
  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=39838

* src/type1/t1load.c (read_binary_data): Reject negative size.
(parse_subrs, parse_charstrings): Use customary signed size.
2021-10-11 22:25:14 -04:00
Alexei Podtelezhnikov 77bd46e959 [psaux] Signedness revisions.
Unsigned indexes are easier to check.

* src/psaux/cffdecode.c (cff_decoder_parse_charstrings): Updated.
* src/psaux/psintrp.c (cf2_interpT2CharString): Ditto.
* src/psaux/t1decode.c (t1_decoder_parse_charstrings): Ditto.
* src/type1/t1load.c (read_binary_data): Ditto.
2021-10-10 23:12:12 -04:00
Alexei Podtelezhnikov 3b036820d6 [cid] Signedness revisions.
Unsigned checks are simpler.

* include/freetype/t1tables.h (CID_FaceInfoRec): Change to unsignd
`num_dicts`.
* src/cid/cidparse.h (CID_Parser): Change to unsigned `num_dict`.

* src/cid/cidgload.c (cid_load_glyph): Updated.
* src/cid/cidload.c (cid_load_keyword, parse_fd_array,
parse_expansion_factor, parse_font_name, cid_read_subrs,
cid_face_open): Updated.
* src/cid/cidobjs.c (cid_face_done): Updated.
* src/cid/cidparse.c (cid_parser_new): Updated.
2021-10-10 23:11:10 -04:00
Alexei Podtelezhnikov 012b4f2d48 * src/cid/cidload.c (cid_face_open): Streamline CIDCount check. 2021-10-08 22:14:12 -04:00
Alexei Podtelezhnikov 946df22165 * src/cid/cidload.c (cid_face_open): Streamline SubrCount check. 2021-10-07 22:44:53 -04:00
Alexei Podtelezhnikov 0313a11c4c * src/cid/cidgload.c (cid_load_glyph): Fortify incremental loading. 2021-10-07 22:43:12 -04:00
Alexei Podtelezhnikov 22befeef82 Signedness revisions.
This eliminates explicit casting by switching to unsigned fields.
The revisions mostly impact the handling of CID fonts.

* include/freetype/fttypes.h (FT_Data): Change to unsigned `length`.
* include/freetype/t1tables.h (CID_FaceDictRec): Ditto for `sd_bytes`.
(CID_FaceInfoRec): Ditto for `gd_bytes` and `gd_bytes`.
* include/freetype/internal/tttypes.h (TT_LoaderRec): Ditto for
`byte_len`.

* src/cid/cidgload.c (cid_load_glyph): Updated.
* src/cid/cidload.h (cid_get_offset): Update argument.
* src/cid/cidload.c (cid_get_offset, cid_read_subrs, cid_face_open):
Updated.
* src/cff/cffgload.c (cff_get_glyph_data, cff_free_glyph_data):
Updated.
* src/psaux/psft.c (cf2_getT1SeacComponent): Updated.
* src/truetype/ttgload.c (TT_Process_Composite_Glyph,
load_truetype_glyph): Updated.
2021-10-07 22:41:56 -04:00
Jan Alexander Steffens (heftig) 842ec5ed62 meson.build (gen_docs): Use `current_source_dir` instead of `source_root`.
These two are not equal when FreeType is used as a subproject, such as in
`freetype-demos`.  In that case, `source_root` points at the root project,
causing the docs build to fail.
2021-10-07 12:29:23 +02:00
Alexei Podtelezhnikov 0f23ae2e80 * src/smooth/ftgrays.c (FT_DIV_MOD): Limit the ARM workaround. 2021-10-05 16:28:40 -04:00
Alexei Podtelezhnikov a156040600 [builds/unix, builds/vms] Standardize `mmap` failure.
* builds/unix/ftsystem.c (FT_Stream_Open): Check for MAP_FAILED.
* builds/vms/ftsystem.c (FT_Stream_Open): Ditto.

This should cover https://savannah.nongnu.org/patch/?5909 as well.
2021-10-05 14:19:06 -04:00
Hugh McMaster 467e49e817 autogen.sh: Only copy submodules if building from a git branch.
`autogen.sh` fails if building from a standard source tarball.  Firstly, git
expects to be called in a git repository, then `copy_submodule_files`
blindly attempts to copy files.

Debian, Ubuntu, Linux Mint, and other derivatives all run `autogen.sh`
before compiling to regenerate build files.

This patch ensures that various git commands are only called and 'dlg' files
are only copied if `autogen.sh` is called from a git repository.
2021-10-05 19:44:27 +02:00
Alexei Podtelezhnikov bbab0a675e * include/freetype/internal/ftgloadr.h: Add missing header.
Noticed by Jouk Jansen.
2021-10-04 23:55:46 -04:00
Alexei Podtelezhnikov ec6a458821 [pshinter] Additional clean-ups.
* src/pshinter/pshalgo.h (psh_hint_table_find_strong_points): Streamline code.
* src/pshinter/pshalgo.h (PSH_Glyph): Remove unused fields.
2021-10-04 23:10:59 -04:00
Alexei Podtelezhnikov 227445f613 [pshinter] More convenient direction definition.
It is easier to check directions using flags than integer values.

* src/pshinter/pshalgo.h (PSH_Dir): Redefine directions.
(PSH_PointRec): Use them as an enum type.

* src/pshinter/pshalgo.c (psh_compute_dir): Modify return type.
(psh_glyph_init, psh_hint_table_find_strong_points,
psh_glyph_find_blue_points): Update users.
2021-10-03 22:48:23 -04:00
Alexei Podtelezhnikov d102a51438 [pshinter] Remove unnecessary check.
* src/pshinter/pshalgo.c (psh_hint_table_find_strong_points): Do not
check if direction is defined before checking how.
2021-10-03 22:45:42 -04:00
AnuthaDev 3a65f1a215 CI: Hardcode meson version to fix build failure on windows 2021-10-02 14:11:17 +00:00
Alexei Podtelezhnikov 311764fabb Additional `FT_MSB` macro definitions.
* include/freetype/internal/ftcalc.h [__DECC,_CRAYC]: Use builtins
and intrinsics.
2021-10-01 11:50:12 -04:00
Alexei Podtelezhnikov 68fae526c4 * src/autofit/afhints.c (af_glyph_hints_reload): Decrease casting. 2021-09-30 22:59:04 -04:00
Alexei Podtelezhnikov 1d79c892cf * src/tools/apinames.c: Facilitate OpenVMS linker options. 2021-09-29 22:17:31 -04:00
Alexei Podtelezhnikov dd0ccdc3d3 * src/winfonts/winfnt.c (FNT_Face_Init): Correct reallocation. 2021-09-28 22:57:58 -04:00
Alexei Podtelezhnikov 12ef831fc3 [builds/unix] Do not use autoconf SIZEOF.
* builds/unix/ftconfig.h.in [FT_USE_AUTOCONF_SIZEOF_TYPES]: Removed.
* builds/unix/configure.raw: Remove AC_CHECK_SIZEOF and update.

After this commit, autoconf builds will fully rely on <limits.h>
rather than falling back on it if AC_CHECK_SIZEOF failed for some
reason.  There is a risk that misconfigured cross-compilation might
have wrong headers.  Note that Meson and CMake builds always relied on
<limits.h> for sizes and availability of integer types.
2021-09-24 22:27:27 -04:00
Alexei Podtelezhnikov 766b2c19e2 Propagate sign when reading OFF3.
Signed 24-bit values are extremely rare.  FreeType only reads them in
PFR fonts with bitmap strikes conditionally. They have not been seen
in the known fonts.  That is why this bug could never be discovered.
`FT_FRAME_OFF3` propagates sign correctly.

* include/freetype/internal/ftstream.h (FT_PEEK_OFF3, FT_PEEK_OFF3_LE):
Propagate sign into 32-bit value.
(FT_GET_OFF3, FT_READ_OFF3): Needed fixing but removed as unused.
2021-09-24 22:14:22 -04:00
Alexei Podtelezhnikov a69320a9b2 [bdf] Simplify comment collection or lack thereof.
BDF comments are neither actually collected nor retrieved. There is
no need to be fancy with delimiters.

* src/bdf/bdflib.c (_add_bdf_comment): Delimit comments with zeros...
(bdf_load_font): ...and do not null-terminate comments additionally.
(_bdf_parse_glyphs): Check if comments are kept, which they are not.
(_bdf_parse_start): Minor clean up.
2021-09-24 22:06:44 -04:00
Alexei Podtelezhnikov a29e020059 Use NULL for pointers only.
* src/bdf/bdflib.c (*): Code changes.
* include/freetype/freetype.h: Comments only.
* src/cff/cffload.c, src/cff/cffobjs.c: Ditto.
* src/winfonts/winfnt.c: Ditto.
2021-09-23 23:10:26 -04:00
Werner Lemberg 6d19b29fbc Minor documentation fixes and improvements. 2021-09-23 08:46:01 +02:00
Alexei Podtelezhnikov 3b573e4527 Reference `fopen` in the docs. 2021-09-22 22:22:13 -04:00
Alexei Podtelezhnikov 90b14882ec [bdf, pcf] Minor optimization.
* src/pcf/pcfread.c (pcf_load_font): Do not call `FT_MulDiv` for a
small job.
* src/bdf/bdfdrivr.c (BDF_Face_Init): Ditto.
* src/bdf/bdflib.c (_bdf_parse_glyphs): Fix a comment.
2021-09-22 20:20:04 -04:00
Alexei Podtelezhnikov b4dddd8244 [base] Initialize stream memory earlier.
With Windows memory management tracking heap, it is important to use
it during the stream opening fallback. In Unix, the argument is
unused, but it is better to set it correctly.

* src/base/ftobjs.c (FT_Stream_New): Set memory before calling
`FT_Stream_Open`.
* builds/windows/ftsystem.c, builds/unix/ftsystem.c (FT_Stream_Open,
ft_close_stream_by_free): Call `ft_alloc` and `ft_free` with proper
memory argumment.
2021-09-22 00:30:03 -04:00
Alexei Podtelezhnikov 93866bec77 [builds/windows] Revert back to `CreateFileA` only.
Calling `CreateFileW` without making sure that the patname is really
`wchar_t` is a bad idea and can lead to unpredictable overreads. For
Windows CE, we impelemnt the missing API.

Fixes #1098 and !76 again.

* builds/windows/ftsystem.c (FT_Stream_Open): Call `CreateFileA`.
[_WIN32_WCE] (CreateFileA, FileSizeEx): Implement missing interfaces.
2021-09-21 23:14:42 -04:00
Alexei Podtelezhnikov 892e7eadc9 * src/bdf/bdflib.c (_bdf_parse_{start,glyphs}): Use appropriate scanner. 2021-09-21 14:39:21 +00:00
Alexei Podtelezhnikov 6190360967 Minor. 2021-09-20 22:18:29 -04:00
Alexei Podtelezhnikov 71969d1edf * src/cff/cffdrivr.c (cff_ps_get_font_{info,extra}): Use FT_QNEW. 2021-09-20 14:31:45 -04:00
Alexei Podtelezhnikov 529158983d [cache] Minor clean-ups.
* src/cache/ftccache.h (FTC_CACHE_LOOKUP_CMP): Remove parantheses.
* src/cache/ftccache.c (FTC_Cache_Lookup): Ditto.
(FTC_Cache_RemoveFaceID): Remove unnecessary variable.
2021-09-18 07:05:55 -04:00
Alexei Podtelezhnikov 0b429b609c [builds/windows] Try both wide and narrow `CreateFile`
Windows handles wchar_t* UTF-16 and char* ANSI (presently UTF-8)
filenames using alternative -A and -W API. We'll try them both
when opening a file. This means that you should not worry about
about conversions.

Fixes #1098 and !76.

* builds/windows/ftsystem.c (FT_Stream_Open): Call alternative
`CreateFile` in the case of failure.
2021-09-17 08:31:27 -04:00
Edwin Steiner 6e1ef98a04 [cff] Explicitly set StandardEncoding or ExpertEncoding offsets.
Fixes #1097.

* src/cff/cffload.c (cff_encoding_load): Set special offset values.
2021-09-16 23:08:46 -04:00
Alexei Podtelezhnikov fce74b7365 [cache] Miscellaneous clean-ups.
* src/cache/ftccache.c (ftc_get_top_node_for_hash, FTC_Cache_Clear):
Remove barely used variables.
(ftc_cache_add): Adjust casting.
* src/cache/ftccmap.c (FTC_CMapCache_Lookup): Remove casting.
* src/cache/ftcsbits.c (ftc_snode_load): Remove casting.
2021-09-16 17:03:19 -04:00
Alexei Podtelezhnikov 79d14cc256 * src/cff/cffload.c (cff_fd_select_get): Remove casting. 2021-09-16 16:41:56 -04:00
Alexei Podtelezhnikov ae516e6a43 * src/pcf/pcfread.c (pcf_read_TOC): Remove casting. 2021-09-16 16:39:23 -04:00
Alexei Podtelezhnikov 801b7540dc Minor type adjustments.
* src/cff/cffobjs.c (cff_face_init): Reduce casting.
* src/truetype/ttobjs.c (tt_size_ready_bytecode): Ditto.
* src/type1/t1load.c (T1_Set_MM_Design): Ditto.
2021-09-14 22:55:50 -04:00
Alexei Podtelezhnikov 49270c1701 Replace boolean allocation macros with MEM ones.
* src/base/ftbitmap.c (FT_Bitmap_Copy): Use MEM-macro.
* src/base/ftobjs.c (ft_glyphslot_alloc_bitmap): Ditto.
* src/bzip2/ftbzip2.c (ft_bzip2_alloc): Ditto.
* src/cache/ftccache.c (ftc_cache_init): Ditto
* src/gzip/ftgzip.c (ft_gzip_alloc): Ditto.
* src/psnames/psmodule.c (ps_unicodes_init): Ditto.
* src/sfnt/sfobjs.c (sfnt_load_face): Ditto.
* src/sfnt/ttload.c (tt_face_load_name): Ditto.
2021-09-14 21:32:43 -04:00
Alexei Podtelezhnikov 9a4c846e60 [cache] Revert to some zeroing.
* src/cache/ftccache.c (ftc_cache_init, ftc_cache_resize): Zero
`buckets` again to fix some crashes.
2021-09-14 21:25:47 -04:00
Alexei Podtelezhnikov 0a8ee851e0 * src/pshinter/pshrec.c (ps_mask_table_merge_all): Tweak loops.
Fixes fallout from 731d0b6856 reported as

  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=38685
2021-09-14 10:26:37 -04:00
Alexei Podtelezhnikov 731d0b6856 [cff, pshinter] Clean up unsigned counters.
Loops with unsigned decrement can be reliably stopped when the counter
wraps around after reaching zero.

* src/cff/cffload.c (cff_charset_compute_cids): Use unsigned counter.
* src/pshinter/pshalgo.c (psh_hint_table_activate_mask): Ditto.
* src/pshinter/pshrec.c (ps_mask_table_merge): Ditto.
2021-09-13 16:29:08 -04:00
Alexei Podtelezhnikov 058f3f2d7d [bdf, psnames, sfnt] Avoid some memory zeroing.
* src/bdf/bdfdrivr.c (BDF_Face_Init): Use Q-macro.
* src/sfnt/sfobjs.c (sfnt_load_face): Ditto.
* src/psnames/psmodule.c (src/psnames/psmodule.c): Remove zero.
2021-09-13 16:24:25 -04:00
Alexei Podtelezhnikov 59b43ae663 * src/base/ftobjs.c (FT_CMap_New): Revert to zeroing.
Fixes fallout from c1fa7aa2bc, reported as

  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=38641
2021-09-13 16:16:18 -04:00
Alexei Podtelezhnikov 073ff2d77e [truetype] Clean up `exec` initialization.
* src/truetype/ttinterp.c (Init_Context): Absorbed into...
(TT_New_Context): ... this function.
2021-09-13 00:04:45 -04:00
Alexei Podtelezhnikov fab94f9fcc [truetype] Avoid some memory zeroing.
* src/truetype/ttgload.c (load_truetype_glyph): Use Q-macro.
* src/truetype/ttinterp.c (Update_Max): Ditto.
* src/truetype/ttpload.c (src/truetype/ttpload.c): Ditto.
2021-09-12 23:30:07 -04:00
Alexei Podtelezhnikov c1fa7aa2bc [base] Avoid some memory zeroing.
* src/base/ftobjs.c (FT_New_Size, FT_CMap_New, FT_CMap_Done,
ft_open_face_internal, ft_open_face_internal): Use Q-macros.
2021-09-12 23:25:46 -04:00
Alexei Podtelezhnikov a8e8d9d7a4 [cache, psaux] Remove zeros.
* src/cache/ftcmru.c (FTC_MruList_New): Remove initialization.
* src/psaux/psstack.c (cf2_stack_init): Ditto.
2021-09-12 23:21:32 -04:00
Alexei Podtelezhnikov 9870b6c07e [cache] Avoid some memory zeroing.
* src/cache/ftcmru.c (FTC_MruList_New): Use Q-macro.
* src/cache/ftcmanag.c (FTC_Manager_RegisterCache): Ditto.
* src/cache/ftccache.c (ftc_cache_init, ftc_cache_resize): Ditto.
2021-09-12 14:32:22 -04:00
Alexei Podtelezhnikov 2d57b05928 * src/cache/ftcmanag.c (FTC_Manager_New): Add missing zero.
Fixes fall out from a7b199d081.
2021-09-11 10:38:08 -04:00
Alexei Podtelezhnikov 5b626281f1 [truetype] Tweak `hdmx` checking.
Fixes #1096.

* src/truetype/ttpload.c (tt_face_load_hdmx): Account for padding.
2021-09-10 10:19:07 -04:00
Alexei Podtelezhnikov e942a31007 [truetype] Tweak `loca` clamping.
Fixes #1095.

* src/truetype/ttpload.c (tt_face_load_loca): Fix up clamping.
* include/freetype/internal/tttypes.h (TT_Face): Correct docs.
2021-09-09 22:17:46 -04:00
Alexei Podtelezhnikov c350aac099 Fortify memory debugging (cont'd).
* src/base/ftdbgmem.c (FT_DumpMemory): Check for active debugger.
(ft_mem_table_destroy): Move `FT_DumpMemory` call from here...
(ft_mem_debug_done): ... to here.
2021-09-08 12:18:23 -04:00
Alexei Podtelezhnikov 63806aad9f Fortify memory debugging.
These changes are neccessary to properly recover `memory->user` that
holds the Windows heap handle now.

* src/base/ftdbgmem.c (ft_mem_debug_init): Handle all table allocations,
initializations, and sizing instead of...
(ft_mem_table_new): ... this function removed.
(ft_mem_debug_done): Better check for the active debugger and free the
debugger table here instead of...
(ft_mem_table_destroy): ... here.
2021-09-08 10:54:44 -04:00
Werner Lemberg 77dcc5ed6a src/tools/ftrandom/ftrandom.c (_XOPEN_SOURCE): Set to 600.
This allows C99 compilation on Solaris.

Problem reported by Mojca Miklavec.
2021-09-07 18:51:53 -07:00
Alexei Podtelezhnikov 7e26c7a6da [builds/windows] Use native memory allocation API.
* builds/windows/ftsystem.c (ft_alloc, ft_realloc, ft_free):
Wrap HeapAlloc, HeapReAlloc, and HeapFree.
(FT_New_Memory): Set the heap handle.
2021-09-07 17:06:27 -04:00
Werner Lemberg 60a93ea231 [dlg] Synchronize with upstream.
* src/dlg/dlgwrap.c (_XOPEN_SOURCE): Set to 600.

Fixes #1093.
2021-09-07 06:40:55 -07:00
Alexei Podtelezhnikov aee1fd3bb8 Cosmetic zeros. 2021-09-03 22:13:22 -04:00
Alexei Podtelezhnikov 7bf655b228 * src/bdf/bdflib.c (_bdf_parse_start): Keep parser memory. 2021-09-03 11:31:41 -04:00
Werner Lemberg d1d3dc0235 autogen.sh: Make it work with old Solaris 10 shell. 2021-09-02 22:12:07 -07:00
Alexei Podtelezhnikov 7f8f0c1c70 [smooth, raster, sdf] Clean up initialization calls.
* src/raster/ftraster.c (ft_black_init): Removed.
(ft_black_new): Clean up.
* src/sdf/ftbsdf.c (bsdf_raster_new): Ditto.
* src/sdf/ftsdf.c (sdf_raster_new): Ditto.
* src/smooth/ftgrays.c (gray_raster_new): Ditto.
2021-09-02 23:30:31 -04:00
Alexei Podtelezhnikov a7b199d081 * src/cache/ftcmanag.c (FTC_Manager_New): Avoid some zeroing. 2021-09-02 22:58:50 -04:00
Alexei Podtelezhnikov 0a6f0f8fed * src/bdf/bdflib.c (bdf_load_font): Remove memory shuffling. 2021-09-02 22:52:21 -04:00
Alexei Podtelezhnikov a81cf5aade Cosmetic zeros. 2021-09-02 22:10:57 -04:00
Alexei Podtelezhnikov 7482c98f15 [base] Clean up stream reading.
* src/base/ftstream.c (FT_Stream_ReadUShort, FT_Stream_ReadUOffset,
FT_Stream_ReadULong and their LE variants): Remove unnecessary
initialization and slightly refactor.
(FT_Stream_GetByte, FT_Stream_ReadByte): Rename to return unsigned
value and align with sister functions.

* include/freetype/internal/ftstream.h (FT_Stream_GetByte,
FT_Stream_ReadByte): Update prototypes and caller macros.
2021-09-01 22:18:29 -04:00
Alexei Podtelezhnikov 612925ff22 s/0/NULL/ where appropriate. 2021-09-01 21:37:21 -04:00
Alexei Podtelezhnikov efa1a35907 * builds/windows/ftsystem.c (FT_Stream_Open): Fix double-close. 2021-08-30 09:38:25 -04:00
Alexei Podtelezhnikov b6c11d494e [smooth] Reduce shift in multiply-shift optimization.
* src/smooth/ftgrays.c (FT_UDIVPREP, FT_UDIV): Reduce shift.

Smaller shifts that keep the division operands of FT_UDIVPREP within
32 bits result in slightly faster divisions, which is noticeable in
the overall performance.  The loss of precision is tolerable until the
divisors (the components dx and dy) approach 32 - PIXEL_BITS. With
PIXEL_BITS = 8, this corresponds to 65,000 pixels or the bitmap size
that we refuse to render anyway.

Using `ftbench -p -s60 -t5 -bc timesi.ttf`,

Before: 8.52 us/op
After:  8.32 us/op
2021-08-30 07:09:53 -04:00
Werner Lemberg d1c2000504 [truetype] Fix compilation if !TT_CONFIG_OPTION_BYTECODE_INTERPRETER.
* src/truetype/ttgxvar.c (tt_cvt_ready_iterator): Compile function
conditionally.
(tt_face_vary_cvt) [!TT_CONFIG_OPTION_BYTECODE_INTERPRETER]: Add code.

Fixes #1091.
2021-08-28 07:36:08 +02:00
Alexei Podtelezhnikov 6804ce2986 [builds/windows] Revise SSE2 settings.
* builds/windows/vc2010/freetype.vcxproj [x64]: Remove explicit SSE2.
* builds/windows/visualc/freetype.vcproj [Win32]: Add explicit SSE2.
2021-08-27 09:46:40 -04:00
Ben Wagner a842a0984b [smooth] Detect SSE2 with MSVC for x86
MSVC does not set `__SSE2__`. Instead one must check whether `_M_IX86_FP` is
defined and greater than or equal to 2.

* src/smooth/ftgrays.c (FT_SSE2): New macro.
Use it where appropriate.
2021-08-27 09:20:26 +02:00
Alexei Podtelezhnikov 3785393d1a Expand comment (cont'd). 2021-08-26 15:31:11 +00:00
Alexei Podtelezhnikov 686e2a5eb3 Expand comment. 2021-08-25 23:18:43 +00:00
Alexei Podtelezhnikov f7f9cb0dde * src/smooth/ftgrays.c (gray_render_conic): Refactor redundancy. 2021-08-24 15:29:06 -04:00
suzuki toshiya 5031835790 [truetype] Fix for the family name shorter than 8 characters.
* src/truetype/ttobjs.c (tt_skip_pdffont_random_tag):
If the family name to be checked is shorter than 8 characters,
do not check its syntax.
2021-08-25 00:31:26 +09:00
suzuki toshiya c4fc0e690c [truetype] Simplify `trick_names'.
* src/truetype/ttobjs.c (tt_check_trickyness_family): For the case
that the beginning part of a long tricky family name is already
registered as another tricky family name, no need to double-check
the longer one.  Such long tricky family names are removed from
the `trick_names'.
2021-08-24 16:58:11 +09:00
suzuki toshiya 992382ba29 [truetype] Add 2 tricky font names.
Additional fix for the issue #1087.

* src/truetype/ttobjs.c (tt_check_trickyness_family): Add 2 tricky
font names reported in #1087.
2021-08-24 16:51:54 +09:00
suzuki toshiya 2b3ccd6e26 [truetype] New function to skip the randomization tag.
* src/truetype/ttobjs.c (tt_skip_pdffont_random_tag):
New function to skip the randomization tag in the names of the
fonts embedded in a PDF.  It is used by tt_check_trickyness_family(),
to keep from mistaking "DLC" in the randomization tag as a
tricky font name. See discussion in:

https://lists.nongnu.org/archive/html/freetype-devel/2021-02/msg00002.html

For technical detail about the randomization tag, please find
PDF Reference 5.5.3 "Font Subsets".  Thanks to Justyna Wawrzynska
for pointing out the issue caused by the randomization tag.
2021-08-24 16:49:34 +09:00
suzuki toshiya 1c23982dd2 [truetype] Add checksums for 2 tricky fonts.
Thanks to Ting717 for providing sample PDF. Fixes #1087.

* src/truetype/ttobjs.c (tt_check_trickyness_sfnt_ids): Add
checksums for 2 tricky fonts `DFHei-Bd-WIN-HK-BF' and
`DFMing-Md-WIN-HK-BF'.
2021-08-24 16:46:06 +09:00
Alexei Podtelezhnikov 78f2bd0bd3 Whitespace formatting. 2021-08-22 22:32:07 -04:00
Alexei Podtelezhnikov d92aa23fd7 Decorate const arguments.
* src/base/ftglyph.c (FT_Glyph_Transform, FT_Glyph_To_Bitmap): Do it.
* include/freetype/ftglyph.h (FT_Glyph_Transform, FT_Glyph_To_Bitmap):
Do it.
2021-08-22 13:12:45 -04:00
Alexei Podtelezhnikov d62d583d92 [smooth] Clean up the null cell usage.
Put the null cell at the end of the pool and store it explicitly so that
we can use it as both the limit and the dumpster.

* src/smooth/ftgrays.c (gray_TWorker): Store the last `cell_null` and
remove unnecesary fields.
(NULL_CELL_PTR, CELL_IS_NULL): Remove in favor of explicit `cell_null`.
(gray_dump_cells, gray_set_cell, gray_sweep{,_direct}): Update callers.
(gray_convert_glyph_inner): Trace remaining cells (oh well).
(gray_convert_glyph): Set up `cell_null` and slightly improve the pool
management.
2021-08-20 23:40:49 -04:00
Alexei Podtelezhnikov 6e9d8d314f [base] Restore quiet no-op rendering of bitmap glyphs.
Fixes #1076.

* src/base/ftobjs.c (FT_Render_Glyph_Internal): Discard an error when
rendering a bitmap glyph.
2021-08-20 16:01:32 -04:00
Alexei Podtelezhnikov de3b5c201c [smooth] Fortify 64-bit algorithm.
* src/smooth/ftgrays.c (FT_UDIVPREP, FT_UDIV): s/long/FT_Int64/ and
s/unsigned long/FT_UInt64/.
(gray_render_line): Adjust a critical variable type.
2021-08-20 13:51:40 -04:00
Carlo Bramini f0f00f7c16 * builds/windows/ftsystem.c (FT_Stream_Open): Support legacy Windows. 2021-08-19 22:14:42 -04:00
Alexei Podtelezhnikov ffdac8d67e Determine `long long` availability based on its size.
MSVC, for example, used `long long` even without full C99 support.

* include/freetype/config/ftstdlib.h: Check if `long long` limits are
defined in <limits.h>.
* include/freetype/config/integer-types.h: Check `long long` size and
use it to typedef FT_Int64.
2021-08-19 20:41:55 -04:00
Dominik Röttsches 633fe08764 [sfnt] Fix format expectation for `COLR` v1 ClipList
* src/sfnt/ttcolr.c (tt_face_get_color_glyph_clipbox): Change ClipList
format expectation to 1 instead of 0 to make it compliant with the
latest spec.
2021-08-19 21:35:08 +00:00
Alexei Podtelezhnikov 02ba0fc81e Readily use `long long` as a 64-bit type in C99 mode.
* include/freetype/config/integer-types.h (FT_INT64):
FT_CONFIG_OPTION_FORCE_INT64 is no longer required to use `long long`.
2021-08-18 23:27:48 -04:00
Alexei Podtelezhnikov 857038399a Use FT_INT64 instead of FT_LONG64.
* include/freetype/config/integer-types.h: Remove synonymous FT_LONG64.
* include/freetype/internal/ftcalc.h: s/FT_LONG64/FT_INT64/.
* src/base/ftcalc.c: Ditto.
* src/base/fttrigon.c: Ditto.
* src/smooth/ftgrays.c: Ditto.
2021-08-18 23:05:51 -04:00
Alexei Podtelezhnikov e2cceed857 [builds/windows] Do not set CharacterSet for VC++.
* builds/windows/vc2010/freetype.vcxproj: s/Unicode/NotSet/.
* builds/windows/visualc/freetype.vcproj: s/"1"/"0"/.
2021-08-18 11:36:33 -04:00
Werner Lemberg f44c2d5860 * src/sdf/ftsdf.c (get_control_box): Fix compiler warning. 2021-08-18 08:52:21 +02:00
Werner Lemberg f11f3ed15b [base] Fix ppem size overflow.
Fixes #1086.

* src/base/ftobjs.c (FT_Request_Metrics): Add return value.
Check whether ppem values fit into unsigned short values.
(FT_Request_Size): Updated.

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

* src/cff/cffobjs.c (cff_size_request), src/cid/cidobjs.c
(cid_size_request), src/truetype/ttdriver.c (tt_size_request),
src/type1/t1objs.c (T1_Size_Request): Updated.
2021-08-18 07:27:02 +02:00
Alexei Podtelezhnikov 536a10aca8 * builds/windows/ftsystem.c (FT_Stream_Open): Cast to remove warning. 2021-08-17 22:24:46 -04:00
Alexei Podtelezhnikov 5116f12963 * builds/windows/ftsystem.c (FT_Stream_Open): Support UNICODE compilation. 2021-08-17 22:08:45 -04:00
Werner Lemberg fed5521016 * src/sfnt/ttcolr.c (tt_face_get_color_glyph_clipbox): Minor fix. 2021-08-09 19:27:34 +02:00
Dominik Röttsches e40ae7569a [sfnt] Add missing blend mode 'plus' to 'COLR' v1.
* include/freetype/ftcolor.h (FT_Composite_Mode): Add missing blend mode
'plus' after it was added to the spec.
2021-08-09 19:25:26 +02:00
Werner Lemberg 2c853b38a7 include/freetype/freetype.h (FT_Encoding): Improve documentation.
Based on a suggestion by Antony Lee <anntzer.lee@gmail.com>.
2021-08-08 00:22:34 +02:00
Werner Lemberg 18fc64e6a3 [smooth] Avoid integer overflow.
Reported as

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

* src/smooth/ftgrays.c(ADD_LONG, SUB_LONG, MUL_LONG, NEG_LONG)
[STANDALONE_]: Removed, unused.
(ADD_INT) [STANDALONE_]: New macro.
(FT_INTEGRATE): Use ADD_INT.
2021-08-07 17:16:52 +02:00
Dominik Röttsches 47cf8ebf4a [sfnt] Add API for retrieving a 'COLR' v1 'ClipBox' table.
The optional 'COLR' v1 glyph-specific clip box helps upstream graphics
libraries allocate a sufficiently large bitmap for a glyph without having to
traverse the glyph graph for that.  See

  https://github.com/googlefonts/colr-gradients-spec/issues/251

for background on the introduction of this specification change.

* include/freetype/ftcolor.h (FT_ClipBox): New structure.
(FT_Get_Color_Glyph_ClipBox): New function declaration.

* include/freetype/internal/sfnt.h (TT_Get_Color_Glyph_ClipBox_Func):
New function type.
(SFNT_Interface, FT_DEFINE_SFNT_INTERFACE): Use it.

* src/base/ftobjs.c (FT_Get_Color_Glyph_ClipBox): New function to link API
with SFNT implementation.

* src/sfnt/sfdriver.c (sfnt_interface): Updated.
* src/sfnt/ttcolr.c (Colr): New field `clip_list`.
(tt_face_load_colr): Parse global clip list offset.
(tt_face_get_color_glyph_clipbox): New function to find the clip box for a
glyph id from the clip list array.
* src/sfnt/ttcolr.h: Updated.
2021-08-07 14:44:05 +02:00
Werner Lemberg 6be8bfe499 [smooth] Fix left shifts of negative numbers.
Reported as

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

* src/smooth/ftgrays.c (LEFT_SHIFT): New macro.
(gray_render_conic) [BEZIER_USE_DDA]: Use it.
2021-08-06 08:31:22 +02:00
Werner Lemberg 09195a82a4 * meson.build: Fix zlib support.
This commit synchronizes zlib support with both autotools and cmake: If no
external zlib is found (or intentionally disabled on the command line), use
the internal zlib by undefining `FT_CONFIG_OPTION_SYSTEM_ZLIB` without
modifying `FT_CONFIG_OPTION_USE_ZLIB`.

Also improve summary output.

Problem reported by Moazin.
2021-08-02 12:55:28 +02:00
Anuj Verma be6ab31900 [sdf] Fix out-of-range-access.
* src/sdf/ftbsdf.c (first_pass, second_pass): Fix range during forward pass.
Otherwise the index goes out of range for the last column.

Fixes issue #1077.
2021-08-02 06:49:50 +02:00
Anuj Verma ebcc96e559 Fix invalid memory access in `bsdf` rasterizer.
Do not generate SDF from bitmap if the `FT_GLYPH_OWN_BITMAP` flag is not
set.  In some cases the bitmap buffer is freed but still points to a valid
address; to handle those cases check the flag before accessing the memory.

* src/sdf/ftsdfrend.c (ft_bsdf_render): Handle the above case.
Also, return an error message if the bitmap's rows/pitch is invalid,
otherwise `slot->buffer` might be assigned to some invalid memory location.
(ft_sdf_render): Same as above.
Plus, move the outline back to original state after rasterization and not if
any error occurs.

Signed-off-by: Anuj Verma <anujv@iitbhilai.ac.in>
2021-08-02 05:51:15 +02:00
Heiko Becker 47b1a541cb * meson.build: Honor `--includedir` instead of hard-coding 'include'.
Signed-off-by: Heiko Becker <heirecka@exherbo.org>
2021-07-29 08:33:56 +02:00
Werner Lemberg d2367abac0 src/sfnt/ttcolr.c: Minor formatting. 2021-07-29 08:16:25 +02:00
Dominik Röttsches 30a82e1e5d [sfnt] 'COLR' v1 PaintSweepGradient spec update
* src/sfnt/ttcolr.c (read_paint): PaintSweepGradient follows other
spec changes and now has the angles specified as F2DOT14, reflect
that in the implementation.
* include/freetype/ftcolor.h (FT_PaintSweepGradient): Update
documentation.
2021-07-29 06:12:51 +00:00
Dominik Röttsches 5c0ac7a435 [sfnt] Retrieve affine matrix from offset in 'COLR' v1 parsing.
* src/sfnt/ttcolr.c (read_paint): Implement spec change where
affine transform matrix is now referenced by offset instead of
being placed inline in the PaintTransform table.
2021-07-29 06:05:18 +00:00
Dominik Röttsches 66189807b8 [sfnt] 'COLR' v1 PaintSkew related spec updates
* src/sfnt/ttcolr.c (read_paint): Implement spec changes around
PaintSkew, PaintSkewAroundCenter.  Update parsing to read shorter
values as changed in the spec.
* include/freetype/ftcolor.h (FT_PaintSkew): Update documentation.
2021-07-29 06:01:34 +00:00
Dominik Röttsches 48df0fa652 [sfnt] PaintRotate/PaintRotateAroundCenter spec updates
* src/sfnt/ttcolr.c (read_paint): Implement spec change where
PaintRotate and PaintRotateAroundCenter were split for a more
compact format definition.  Update parsing to read shorter values
as changed in the spec.
* include/freetype/ftcolor.h (FT_PaintRotate): Update documentation.
2021-07-29 05:59:30 +00:00
Dominik Röttsches d7bdcb1bb5 [sfnt] 'COLR' v1 PaintTranslate and PaintScale precision
* src/sfnt/ttcolr.c (read_paint): Implement spec changes in
PaintTranslate and PaintScale and friends.  Update parsing to read
new shorter values.
2021-07-29 05:56:15 +00:00
AnuthaDev 6af39c3d76 README.git: Add Code of Conduct. 2021-07-29 07:51:59 +02:00
Werner Lemberg ba47af32ba ChangeLog housekeeping.
Archive old `ChangeLog` file.

We no longer write ChangeLog entries manually; instead, the file will be
created from commit messages (which should be formatted in GNU's ChangeLog
style) by a call to

  gitlog-to-changelog --format='%B%n'

or something similar (this script is part of the 'gnulib' repository).
2021-07-25 07:07:19 +02:00
Werner Lemberg c2fa51d9bd Fix some `cppcheck` warnings.
* src/bzip2/ftbzip2.c (ft_bzip2_file_skip_output), src/gzip/ftgzip.c
(ft_gzip_file_skip_output): Reduce scope of `delta`.

* src/psaux/psintrp.c, src/psaux/psintrp.h (cf2_interpT2CharString): Add
`const` to `buf` parameter.

* src/raster/ftraster.c (DelOld): Add `const` to `profile` parameter.
(Vertical_Sweep_Span): Reduce scope of `target`.
(FT_Outline_Get_CBox): Reduce scope of `xMin`, `xMax`, `yMin`, `yMax`.

* src/smooth/ftgrays.c (gray_render_conic): Reduce scope of `split`.
(gray_sweep, gray_sweep_direct): Reduce scope of `area`.

* src/tools/apinames.c (names_dump) <OUTPUT_WATCOM_LBC>: Reduce scope of
`temp`.
2021-07-24 20:32:16 +02:00
AnuthaDev 28c2d7f31c * .gitlab-ci.yml: Fixed cmake build, using correct options. 2021-07-24 08:31:42 +02:00
AnuthaDev 1f742f05bf * CMakeLists.txt: Make `cmake` handle disabled dependencies correctly.
Include 'CMakeDependentOption'.

Replace `FT_WITH_XXX` options with `FT_DISABLE_XXX` and `FT_REQUIRE_XXX`
pairs.  Update option logic accordingly.

Fixes #1066.
2021-07-24 08:31:42 +02:00
Ben Wagner 5bcaf51b61 [autofit] Split `afwrtsys.h`.
The header file `afwrtsys.h` has two distinct functions: to include the
required writing system headers and also to generate code for each writing
system.  At each current use site only one or the other is used, with
various macro trickery selecting one or the other.  Split this header into
`afws-decl.h` for the required writing system declarations and `afws-iter.h`
for iterating over the writing systems to generate code.

The motivation for this change is that the Visual C++ compiler treats the
standard include guard idiom like `#pragma once` 'if no non-comment code or
preprocessor directive comes before or after the standard form of the
idiom'.  It appears to check this after macro expansion, so if
`WRITING_SYSTEM` expands to empty the bottom of `afwrtsys.h` is empty and
looks like the standard include guard idiom which is treated like `#pragma
once`, so subsequent inclusion of `afwrtsys.h` is elided.

Fixes #1075.

* src/autofit/afglobal.c (af_writing_system_classes), src/autofit/aftypes.h
(AF_WritingSystem), src/autofit/rules.mk (AUTOF_DRV_H): Updated.

* src/autofit/afwrtsys.h: Split into...
* src/autofit/afws-decl.h, src/autofit/afws-iter.h: New files.
2021-07-24 07:29:17 +02:00
Werner Lemberg 801cd842e2 * Version 2.11.0 released.
==========================

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

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

* README, src/base/ftver.rc, builds/windows/vc2010/index.html,
builds/windows/visualc/index.html,
builds/windows/visualce/index.html,
builds/wince/vc2005-ce/index.html,
builds/wince/vc2008-ce/index.html, docs/freetype-config.1:
s/2.10.4/2.11.0/, s/2104/2110/.

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

* builds/unix/configure.raw (version_info): Set to 24:0:18.
* CMakeLists.txt (VERSION_MINOR): Set to 11.
(VERSION_PATCH): Set to 0.

* builds/toplevel.mk (dist): Ignore more git-related files.
2021-07-19 18:07:51 +02:00
Ben Wagner 4082b863c1 Document direct header inclusion valid since 2.6.1.
Since commit e13391333 'Make macros for header file names optional.' the
header file layout has become public and using the macro expansions for
includes is no longer required.  While this happened in 2.10.3, the header
file layout had not changed since commit 392cf22f8a 'Another adjustment to
header locations.' in 2.6.1.  Retroactively make the header file layout
public back to 2.6.1 to speed adoption.
2021-07-17 08:51:32 +02:00
David Turner 357b353c2a * src/smooth/ftgrays.c: Fix compilation if `FT_LONG64` is undefined.
The code assumed that if `__SSE2__` is defined, then 64-bit integer
types are available.  This is not the case apparently for certain
multilib compiler targets like 'x86_32.x86' used by Gentoo.

This patch fixes the issue by disabling the special code path when
64-bit integer types are not available.

Fixes #1071.
2021-07-17 08:31:20 +02:00
Alex Richardson 7bc0f48c27 [tests] Allow arbitrary build directories.
* tests/issue-1063/main.c (main): I am building with a build
directory that is not directly inside the source tree, so the path
`../tests/data/As.I.Lay.Dying.ttf` does not resolve to the test
input file.  This change passes the test data directory as an
environment variable to allow arbitrary build directories.

* tests/meson.build: Updated.
2021-07-16 14:42:51 +02:00
Werner Lemberg 685acc04db docs/CHANGES: Mention slight rendering changes.
Suggested by Ben.
2021-07-16 08:20:44 +02:00
Alex Richardson c35961a925 * tests/issue-1063/main.c (main): Fix uninitialized variable.
I tried running `meson test` but the test just crashed and gdb
reported that the face argument to `FT_Get_Char_Index` was nonsense.
With this change the test prints 'Could not open file: ' as it
should.
2021-07-16 08:07:18 +02:00
Werner Lemberg 552fc97fe5 [smooth] Minor fixes.
* src/smooth/ftgrays.c (gray_render_conic): Move variable and
structure declarations to beginning of function.  Inspite of C99
compliance we still do this for the sake of backward compatibility.
This also avoids a shadowing declaration of `count`.
(gray_convert_glyph_inner): Fix typo.
2021-07-16 07:49:20 +02:00
Werner Lemberg 93771d619f Formatting and ChangeLog additions for previous commits. 2021-07-16 07:40:56 +02:00
Ben Wagner c37c087382 Guard inclusion of emmintrin.h
Guard inclusion of emmintrin.h with "#ifdef __SSE2__". The gcc version
of this header, xmmintrin.h, and mmintrin.h check that the appropriate
defines are set before defining anything (are internally guarded).
However the clang versions of these includes are not internally guarded.
As a result of this, externally guard the inclusion of these headers.
2021-07-15 11:33:16 -04:00
David Turner 56cc2ad446 [smooth] Implement Bezier quadratic arc flattenning with DDA
Benchmarking shows that this provides a very slighty performance
boost when rendering fonts with lots of quadratic bezier arcs,
compared to the recursive arc splitting, but only when SSE2 is
available, or on 64-bit CPUs.

On a 2017 Core i5-7300U CPU on Linux/x86_64:

  ./ftbench -p -s10 -t5 -cb .../DroidSansFallbackFull.ttf

    Before: 4.033 us/op  (best of 5 runs for all numbers)
    After:  3.876 us/op

  ./ftbench -p -s60 -t5 -cb .../DroidSansFallbackFull.ttf

    Before: 13.467 us/op
    After:  13.385 us/op
2021-07-15 13:25:58 +02:00
David Turner 86b9c9347f [smooth] Minor speedup to smooth rasterizer
This speeds up the smooth rasterizer by avoiding a
conditional branches in the hot path. Namely:

- Define a fixed "null cell" which will be pointed
  to whenever the current cell is outside of the current
  target region. This avoids a "ras.cell != NULL"
  check in the FT_INTEGRATE() macro.

- Also use the null cell as a sentinel at the end of
  all ycells[] linked-lists, by setting its x coordinate
  to INT_MAX. This avoids a 'if (!cell)' check in
  gray_set_cell() as well.

- Slightly change the worker struct fields to perform
  a little less operations during rendering.

Example results (on a 2013 Corei5-3337U CPU)

  out/ftbench -p -s10 -t5 -bc /usr/share/fonts/truetype/droid/DroidSansFallbackFull.ttf

    Before: 5.472 us/op
    After:  5.275 us/op

  out/ftbench -p -s60 -t5 -bc /usr/share/fonts/truetype/droid/DroidSansFallbackFull.ttf

    Before: 17.988 us/op
    After:  17.389 us/op
2021-07-15 13:25:48 +02:00
David Turner 5ec7f58831 tests/scripts/download-test-fonts.sh rewrite in Python3
Replaces download-test-fonts.sh with download-test-fonts.py
which does the same work, and also avoids downloading anything
if the files are already installed with the right content.

Now uses the first 8 byte of each file's sha256 hash for the
digest.
2021-07-15 13:21:07 +02:00
Alex Richardson f7c6a06cb7 Support architectures where `long` is smaller than pointers.
I am currently trying to compile FreeType for CHERI-extended ISAs
(CHERI-RISC-V and Arm's Morello), but I am getting compiler warnings
from the `FT_UINT_TO_POINTER` macro.  When compiling with the CHERI
Clang compiler, not using `uinptr_t` for casts between integers an
pointers results in the following `-Werror` build failures:

```
In file included from .../src/truetype/truetype.c:22:
  .../src/truetype/ttgload.c:1925:22: error:
    cast from provenance-free integer type to pointer type will
    give pointer that can not be dereferenced
    [-Werror,-Wcheri-capability-misuse]
  node->data = FT_UINT_TO_POINTER( glyph_index );
               ^
  .../include/freetype/internal/compiler-macros.h:79:34: note:
    expanded from macro 'FT_UINT_TO_POINTER'
```

* include/freetype/internal/compiler-macros.h (FT_UINT_TO_POINTER):
The ISO C standard compliant fix for this would be to use
`uintptr_t` from `stdint.h`, but I am not sure if this is supported
by the minimum compiler version.  Therefore, use the
compiler-defined `__UINTPTR_TYPE__` macro (supported in GCC 4.6+ and
Clang since about 3.0) before checking for `_WIN64` and falling back
to `unsigned long`.
2021-07-15 12:09:04 +02:00
Oleg Oshmyan 5d27b10f4c [base] Fix `FT_Open_Face`'s handling of user-supplied streams.
This was already true (though undocumented) most of the time, but
not if `FT_NEW` inside `FT_Stream_New` failed or if the
`FT_OPEN_XXX` flags were bad.

Normally, `FT_Open_Face` calls `FT_Stream_New`, which returns the
user-supplied stream unchanged, and in case of any subsequent error
in `FT_Open_Face`, the stream is closed via `FT_Stream_Free`.

Up to now, however, `FT_Stream_New` allocates a new stream even if
it is already given one by the user.  If this allocation fails, the
user-supplied stream is not returned to `FT_Open_Face` and never
closed.  Moreover, the user cannot detect this situation: all they
see is that `FT_Open_Face` returns `FT_Err_Out_Of_Memory`, but that
can also happen after a different allocation fails within the main
body of `FT_Open_Face`, when the user's stream has already been
closed by `FT_Open_Face`.  It is plausible that the user stream's
`close` method frees memory allocated for the stream object itself,
so the user cannot defensively free it upon `FT_Open_Face` failure
lest it ends up doubly freed.  All in all, this ends up leaking the
memory/resources used by user's stream.

Furthermore, `FT_Stream_New` simply returns an error if the
`FT_OPEN_XXX` flags are unsupported, which can mean either an
invalid combination of flags or a perfectly innocent
`FT_OPEN_STREAM` on a FreeType build that lacks stream support.
With this patch, the user-supplied stream is closed even in these
cases, so the user can be sure that if `FT_Open_Face` failed, the
stream is definitely closed.

* src/base/ftobjs.c (FT_Stream_New): Don't allocate a buffer
unnecessarily.
Move error-handling code to make the control flow more obvious.
Close user-supplied stream if the flags are unsupported.
`FT_Stream_Open` always sets `pathname.pointer`, so remove the
redundant (re)assignment.  None of the `FT_Stream_Open...` functions
uses `stream->memory`, so keep just one assignment at the end,
shared among all possible control flow paths.
('Unsupported flags' that may need a stream closure can be either an
invalid combination of multiple `FT_OPEN_XXX` mode flags or a clean
`FT_OPEN_STREAM` flag on a FreeType build that lacks stream
support.)
2021-07-13 11:00:48 +02:00
Oleg Oshmyan a4c8f21ae7 [base] Reject combinations of incompatible `FT_OPEN_XXX` flags.
The three modes are mutually exclusive, and the documentation of the
`FT_OPEN_XXX` constants notes this.  However, there was no check to
validate this in the code, and the documentation on `FT_Open_Args`
claimed that the corresponding bits were checked in a well-defined
order, implying it was valid (if useless) to specify more than one.
Ironically, this documented order did not agree with the actual
code, so it could not be relied upon; hopefully, nobody did this and
nobody will be hurt by the new validation.

Even if multiple mode bits were allowed, they could cause memory
leaks: if both `FT_OPEN_STREAM` and `stream` are set along with
either `FT_OPEN_MEMORY` or `FT_OPEN_PATHNAME`, then `FT_Stream_New`
allocated a new stream but `FT_Open_Face` marked it as an 'external'
stream, so the stream object was never released.

* src/base/ftobjs.c (FT_Stream_New): Reject incompatible
`FT_OPEN_XXX` flags.
2021-07-13 10:44:38 +02:00
Anuj Verma e592982a83 [sdf] Improve documentation. 2021-07-13 10:00:22 +02:00
Alex Richardson c5516e0f7c * meson.build: Fix build for other UNIX systems (e.g., FreeBSD).
Without this change the build of `unix/ftsystem.c` fails because the
`ftconfig.h` header that defines macros such as `HAVE_UNISTD_H` and
`HAVE_FCNTL_H` is only being generated for Linux, macOS, and Cygwin
systems:

```
.../builds/unix/ftsystem.c:258:32: error:
    use of undeclared identifier 'O_RDONLY'
file = open( filepathname, O_RDONLY );
```

Instead of hardcoding a list of operating systems for this check,
update the logic that decides whether to build the file and set a
boolean flag that can be checked instead.
2021-07-12 22:23:42 +02:00
Werner Lemberg 825b7ea2f2 [autofit] More clean-ups.
* src/autofit/afhints.h (AF_GlyphHintsRec): Remove the no longer
needed fields `xmin_delta` and `xmax_delta`.

* src/autofit/afhints.c (af_glyph_hints_reload),
src/autofit/afloader.c (af_loader_load_glyph): Updated.
2021-07-12 22:11:24 +02:00
Werner Lemberg 205d1ae43e Small clean-ups for the last few commits.
* include/freetype/fttrace.h (afwarp): Removed.
2021-07-12 22:03:25 +02:00
David Turner a212668c9f Remove obsolete AF_Angle type and related sources.
Move the af_sort_xxx() functions from afangles.c to afhints.c
in order to get rid of the obsolete angle-related types,
macros and function definitions.
2021-07-12 09:25:39 +02:00
David Turner 2f11522a2a Remove experimental auto-hinting 'warp' mode.
This feature was always experimental, and probably nevery worked
properly. This patch completely removes it from the source code,
except for a documentation block describing it for historical
purpose.
2021-07-12 09:25:22 +02:00
David Turner 15e889800a Remove experimental "Latin2" writing system (FT_OPTION_AUTOFIT2)
This code has always been experimental and was never compiled
anyway (FT_OPTION_AUTOFIT2 does not appear in ftoption.h or even
any of our build files).
2021-07-12 09:25:07 +02:00
Werner Lemberg 59e95b014a Update 'dlg' subproject. 2021-07-12 06:01:14 +02:00
Werner Lemberg 50d0033f7e meson.build: Minor doc fix. 2021-07-05 05:44:13 +02:00
Werner Lemberg 89c60eca67 * src/base/ftlcdfil.c (FT_Library_SetLcdGeometry): Fix argument.
Reported by Hin-Tak.
2021-07-05 05:41:53 +02:00
Werner Lemberg 5e32a03496 README.git: Revised. 2021-07-03 20:24:16 +02:00
Werner Lemberg a399fb89dc meson.build: Minor doc improvements. 2021-07-03 16:34:01 +02:00
Werner Lemberg 4cb8a88ac7 * meson_options.txt: Sort alphabetically; no final full stops. 2021-07-03 13:25:23 +02:00
Ben Wagner d3dc2da9b2 * src/truetype/ttgxvar.c (tt_set_mm_blend): Test `coords`.
It is undefined behavior to pass `NULL` to `memcpy`.  `coords' is
passed to `memcpy` but `TT_Get_MM_Blend` and `TT_Get_Var_Design`
explictly call `tt_set_mm_blend` with `coords` as `NULL`.  In
addition, `TT_Set_MM_Blend` has a similar possible issue.
2021-07-01 07:02:04 +02:00
Dominik Röttsches 286da6c528 [sfnt] Support PaintScale in 'COLR' v1 parsing.
* include/freetype/ftcolor.h (FT_PaintFormat): Renumber values, add
`FT_COLR_PAINTFORMAT_SCALE`.
(FT_PaintScale): New structure to represent 'PaintScale*' tables.
(FT_COLR_Paint): Updated.

* src/sfnt/ttcolr.c (FT_PaintFormat_Internal): New enumeration.
(read_paint): Parse 'PaintScale' and friends.
2021-07-01 06:49:03 +02:00
Dominik Röttsches 0348c627b1 [sfnt] Handle fonts without layer list in 'COLR' v1.
'COLR' v1 fonts do not necessarily need to have a layer list; for
this reason, 'fontTools' recently started generating fonts in a way
that drops the layer list if there are no layers in it.  This
results in the layer list offset becoming zero, which FreeType
treated as an invalid table.  Fix that and handle the case for layer
list offset being 0.  This slightly changes how we need to calculate
the starting offset for paints.

* src/sfnt/ttcolr.c (tt_face_load_colr): Handle case of layer list
offset being zero without outright rejecting table.
2021-07-01 06:15:22 +02:00
Alexei Podtelezhnikov f27b4834b7 * src/raster/ftraster.c (Render_Single_Pass): Simplify `band_stack'. 2021-06-30 10:54:59 -04:00
Werner Lemberg 90ecac4118 Update `CHANGES` file; other minor doc fixes. 2021-06-30 10:23:42 +02:00
Alexei Podtelezhnikov 69c3516c88 [raster] Do not skip the second pass without dropout control.
The second pass also fixes horizontal lines through the pixel centers.

* src/raster/ftraster.c (black_TWorker): Do not use `second_pass'.
(Render_Glyph): Skip the second pass only with the appropriate flag.
2021-06-29 23:51:23 -04:00
Alexei Podtelezhnikov 3696ac5a18 [raster] Handle sub-band stack locally.
* src/raster/ftraster.c (black_TWorker): Move `band_stack' from here..
(Render_Single_Pass): ... to here and accept limit arguments.
(Render_Glyph): Updated.
2021-06-29 23:27:10 -04:00
Anurag Thakur 7be47010e9 [CI] Introduce linux CI and refactor job names
* .gitlab-ci.yml: Added jobs for building freetype on linux.
2021-06-29 08:43:30 +02:00
Werner Lemberg e1b1b5422c ftcolor.h: Minor grammar fix. 2021-06-29 06:07:00 +02:00
Alexei Podtelezhnikov c852388df7 [raster] Handle Bézier stack locally.
* src/raster/ftraster.c (black_TWorker): Move `arcs' from here...
(Conic_To, Cubic_To): ... to here to tighten their scope.
(Bezier_Up, Bezier_Down): ... Take the current `arc' argument.
2021-06-28 23:26:10 -04:00
Dominik Röttsches 7d4e55c329 [sfnt] Improve paint limit checks
Paint tables can appear before the `base_glyphs_v1` offset if the
font is produced with the layer list before the base glyph list.  In
this case paint tables can occur after the layer list but before the
base glyph list.  Checks in the 'COLR' v1 code were rejecting fonts
with this layout.  Improve these checks by calculating a minimum
offset after which paint tables can occur and use that in safety
checks.

* src/sfnt/ttcolr.c (Colr, tt_face_load_colr): Declare
`paint_start_v1` and calculate that as the minimum of the end of
layer list and base glyph list.
(get_child_table_pointer, read_paint, tt_face_get_paint_layers):
Use that in safety checks.
2021-06-28 18:02:55 +02:00
Alexei Podtelezhnikov 3a278381ae [raster] Clean up vertical sweep.
* src/raster/ftraster.c (black_TWorker): Replace the current line
offset with the pointer and drop the increment.
(Function_Sweep_Init): Take values as arguments instead of pointers.
(Vertical_Sweep_*, Horizontal_Sweep_Init, Draw_Sweep): Updated.
2021-06-28 10:22:03 -04:00
Alexei Podtelezhnikov fb4511eb9a [raster] Make `band_top' local variable.
* src/raster/ftraster.c (black_TWorker): Move `band_top' from here...
(Render_Single_Pass): ... to here, and refactor.
(Render_Glyph): Updated.
2021-06-26 08:49:20 -04:00
Alexei Podtelezhnikov f6370e2f05 [raster] Adjust sub-band bisecting limits.
We can bisect a band until it is just a single scan line.  This might
be slow and cause time-outs but if we need to impose limits it should
be elsewhere.

* src/raster/ftraster.c (Render_Single_Pass): Tweak sub-banding.
2021-06-25 22:59:39 -04:00
Alexei Podtelezhnikov bc1029b9c5 * src/raster/ftraster.c (Render_Single_Pass): Remove dead code. 2021-06-25 18:20:57 -04:00
Werner Lemberg ff40776591 [base] Add trace level to logging output.
Some practical debugging work has shown that displaying level X of
an `FT_TRACEX` macro in the output of `FT2_DEBUG="...  -v"` would be
very helpful to find out which trace level should be selected.  As
an example, we now get output like

```
[ttobjs:2]    TTF driver
[ttobjs:2]      SFNT driver
[sfobjs:2]      not a font using the SFNT container format
[t1objs:2]    Type 1 driver
[stream:7]    FT_Stream_EnterFrame: 14 bytes
```

* include/freetype/internal/ftdebug.h (FT_LOGGING_TAGX): New macro.
(FT_LOG): Use it to add the trace level to the logging tag.

* include/freetype/internal/fttrace.h (FT_MAX_TRACE_LEVEL_LENGTH):
Adjust.

* docs/DEBUG: Updated.
2021-06-25 09:24:07 +02:00
Alexei Podtelezhnikov 1e0cef9e72 [smooth, raster] Fix up and align error codes.
FT_Render_Glyph picked up FAILURE or 1 returned from the raster
function, which became a confusing error code. Instead, return
Raster_Overflow in the unlikely event that banding does not help or
another meaningful error.

* src/smooth/ftgrays.c (gray_convert_glyph_inner, gray_convert_glyph):
Use Raster_Overflow when the rendering pool is exhausted and return it
if banding does not help.
(gray_raster_render): Use Smooth_Err_Ok.

* src/raster/ftraster.c (Render_Single_Pass): Return Raster_Overflow
if banding does not help or another error code.
2021-06-24 00:19:50 -04:00
Alexei Podtelezhnikov d8ac180c88 [smooth, raster] Remove synonymous error macros.
* src/smooth/ftgays.c [STANDALONE_]: s/ErrRaster_/Smooth_Err_/.
(gray_convert_glyph_inner): Updated accordingly.

* src/raster/ftraster.c [STANDALONE_]: Do not abbreviate error macros.
(New_Profile, End_Profile, Insert_Y_Turn, Line_Up, Bezier_Up,
Decompose_Curve, Draw_Sweep, Render_Single_Pass, ft_black_render):
Updated accordingly.
2021-06-23 23:32:02 -04:00
Werner Lemberg 1e65e6051a fterrors.h: Fix documentation extraction of `FT_Error_String`. 2021-06-23 08:14:42 +02:00
Dominik Röttsches 4cb21b9a92 [sfnt] s/PaintTransformed/PaintTransform/, s/transformed/transform/.
* include/freetype/ftcolor.h (FT_PaintTransformed, FT_PaintFormat,
FT_COLR_Paint): Do it to make it harmonize with other names such as
'PaintTranslate'.

* src/sfnt/ttcolr.c (read_paint, tt_face_get_paint): Ditto.
2021-06-22 20:50:48 +02:00
Dominik Röttsches 284eec1e18 Move 'COLR' API to `ftcolor.h`.
* include/freetype/freetype.h: Cut section layer managament
containing 'COLR' v0 and v1 API and move it to `ftcolor.h` as
requested by Werner on freetype-devel.
* include/freetype/ftcolor.h: Paste that section.
2021-06-22 20:33:33 +02:00
Werner Lemberg bcd73f7dbc freetype.h: Mark 'COLR' v1 API as experimental. 2021-06-20 16:23:40 +02:00
Werner Lemberg 008e42a12c ftver.rc: Update copyright year. 2021-06-19 15:45:46 +02:00
Werner Lemberg b460a50610 [truetype] Fix integer overflow.
Reported as

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

* src/truetype/ttinterp.c (Ins_JMPR): Use `ADD_LONG`.
2021-06-19 07:03:40 +02:00
Werner Lemberg 232243e749 Prevent hinting if there are too many segments.
This speeds up handling of broken glyphs.

Reported as

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

* src/autofit/aflatin.c (af_latin_hints_compute_segments): Implement
it.
2021-06-19 06:41:01 +02:00
Alexei Podtelezhnikov 61bac75963 * src/sdf/ftsdfrend.c (ft_(b)sdf_render): Do not FT_ERROR routinely. 2021-06-18 17:38:00 -04:00
Werner Lemberg 482c57cc34 Add `ChangeLog` entries for last two commits. 2021-06-18 16:46:23 +02:00
David Turner f8c5c54680 Fix for issue 1063
See https://gitlab.freedesktop.org/freetype/freetype/-/issues/1063
for more details on the bug.
2021-06-16 10:31:12 +02:00
David Turner 6f273f6878 [meson] Add first regression test to FreeType
* tests/README.md: documentation explaining how to
  build and run the tests with the Meson build.

* tests/scripts/download-test-fonts.sh: Simple script
  to download test font files to the 'tests/data/'
  folder.

* meson.build, meson_options.txt, tests/meson.build:
  Add 'tests' option to enable building and running the
  test programs, disabled by default.

* tests/issue-1063/main.c: Simple regression test to
  exhibit issue 1063.

* .gitignore: Ignore the content of the tests/data/
  folder for now.
2021-06-16 10:28:47 +02:00
Alexei Podtelezhnikov c6fcd61228 Add a comment. 2021-06-15 22:49:21 -04:00
Alexei Podtelezhnikov 8336d53cff [type42] Fix new memory leak.
We need to inverse inheritance of FT_GlyphSlot_Internal so that we
have a chance to free the rendered bitmap from the parent slot.

* src/type42/t42objs.c (T42_GlyphSlot_Init): Remove the internal parts
of the child `ttslot' and replace it with the parent structure.
(T42_GlyphSlot_Done): Updated accordingly.
2021-06-12 22:33:08 -04:00
Werner Lemberg db0f2c448e [psaux] Fix another assertion.
* src/psaux/psintrp.c (cf2_interpT2CharString)
<cf2_escCALLOTHERSUBR>: Convert assertion into error, since the
problem can happen with invalid user input.

Test case is file

  fuzzing/corpora/legacy/oss-fuzz/5754332360212480-unknown-read

in the `freetype2-testing` repository.
2021-06-12 10:13:08 +02:00
Werner Lemberg a34afe6786 [psaux] Fix assertions.
* src/psaux/pshints.c (cf2_hintmap_adjustHints): Check for overflow
before emitting an assertion error.
2021-06-12 08:40:16 +02:00
Alexei Podtelezhnikov 9bfecfd2b6 * src/truetype/ttinterp.c (TT_RunIns): Optimize tracing. 2021-06-09 23:34:04 -04:00
Alexei Podtelezhnikov 7833e308ef [sdf] Fix SDF positioning.
* src/sdf/ftsdfrend.c (ft_sdf_render, ft_bsdf_render): Add padding to
`bitmap_top' and `bitmap_left'.

* sdf/sdf/ftsdf.c (sdf_generate_with_overlaps): Fix VC++ warning.
2021-06-09 10:40:30 -04:00
Alexei Podtelezhnikov 8dc02fb999 More CHANGES. 2021-06-08 22:31:11 -04:00
Werner Lemberg 08f66322e3 More various documentation improvements and fixes. 2021-06-08 18:23:16 +02:00
Werner Lemberg d586927d16 Various documentation improvements and fixes. 2021-06-08 17:44:53 +02:00
Werner Lemberg 640f654bd1 Fix 'devel' build for COLR 'v1'.
* devel/ftoption.h: Synchronize with
  `include/freetype/config/ftoption.h`.
2021-06-08 16:45:04 +02:00
Werner Lemberg b24cfc8dcc [sfnt] Sanitize cmap4 table better.
Fixes #1062.

* src/sfnt/ttcmap.c (tt_cmap4_validate): Handle a too-small value of
`length` gracefully.
2021-06-08 15:26:41 +02:00
Dominik Röttsches ee6d03d369 [sfnt] Pointer validity check when reading COLR 'v1' layers
* src/sfnt/ttcolr.c (tt_face_get_paint_layers): In addition to the
existing sanity checks, ensure that the pointer to the layer to be
read is within the 'COLR' v1 table.
2021-06-08 14:29:11 +03:00
Werner Lemberg 41fa19fcea * src/sdf/ftsdfcommon.c: Fix inclusion of header files. 2021-06-08 10:32:20 +02:00
Werner Lemberg 35b21c71e5 [sdf] Make `make multi` work.
* src/sdf/ftsdf.c: Include `ftbitmap.h`.

* src/sdf/ftsdfcommon.h: Move function bodies to `ftsdfcommon.c`.
Include `ftobjs.h` to get definitions of `FT_LOCAL` and friends.

* src/sdf/ftsdfcommon.c: New file.

* src/sdf/rules.mk, src/sdf/sdf.c: Updated.
2021-06-08 09:06:39 +02:00
Werner Lemberg 36ee71714f [sdf] Formatting and improved comments. 2021-06-08 09:00:39 +02:00
Anuj Verma 2b1d556269 [sdf] Use 8 bits for final SDF output instead of 16bits.
Since 8-bits is enough to represent SDF data we no longer require
16-bits for  this purpose. Also, we now normalize the output data
to use the entire 8-bit range efficiently. For example: if we use
3.5 format with a spread of 1 we basically only use the starting
5-bits. By normalizing we can use the entire 8-bit range.

* include/freetype/freetype.h (FT_Render_Mode): Updated description
for `FT_RENDER_MODE_SDF` regarding this change.

* include/freetype/ftimage.h (FT_Pixel_Mode): Removed
`FT_PIXEL_MODE_GRAY16` since no longer required.

* include/freetype/fttypes.h (FT_F6Dot10): Removed since no longer
required.

* src/sdf/ftsdfrend.c (ft_sdf_render, ft_bsdf_render): Allocate 8-bit
bitmap instead of 16-bit buffer.

* src/sdf/ftsdfcommon.h (map_fixed_to_sdf): Added function to convert
16.16 distance value to our desired format.

* src/sdf/ftsdf.c (sdf_generate_with_overlaps,
sdf_generate_bounding_box): Use the new `map_fixed_to_sdf` function
and also use 8-bit output buffer.

* src/sdf/ftbsdf.c (finalize_sdf): Output to a 8-bit buffer instead
of 16-bit buffer.
2021-06-08 08:29:34 +05:30
Ben Wagner 2a6665a4c0 [sfnt] Fix fallout from 2021-05-29 change.
* src/sfnt/ttcolr.c (find_base_glyph_record,
find_base_glyph_v1_record): Adjust binary search.

Needs to be updated with change to unsigned.
2021-06-02 07:19:07 +02:00
Werner Lemberg 7ca7da9d13 * src/autofit/aflatin.c (af_latin_metrics_scale_dim): Fix tracing.
Problem reported by Alexei.
2021-06-02 06:59:01 +02:00
Werner Lemberg 0abbc9f512 [psaux] Fix MSVC compiler warnings.
* src/psaux/afmparse.c (afm_parse_track_kern, afm_parse_kern_pairs):
Add cast.
2021-06-02 06:36:11 +02:00
Werner Lemberg 6e253b26b2 Typos in previous commit. 2021-05-29 11:07:10 +02:00
Werner Lemberg a50c39aa8e Fix compilation errors and (some) warnings for clang++.
* src/autofit/afmodule.c (AF_GlyphHintsRec): Make it static.

* src/cache/ftcache.c (FTC_Cache_NewNode), src/cache/ftcsbits.c
(ftc_snode_compare): Remove semicolon.

* src/cff/cffparse.c (cff_parser_run): Add `break` statement.

* src/cid/cidload.c (cid_hex_to_binary): Add cast.

* src/sdf/ftbsdf.c (CHECK_NEIGHBOR): Use `do {} while(0)` loop.
(bsdf_init_distance_map, finalize_sdf, bsdf_raster_render): Add
casts.
* src/sdf/ftsdf.c (sdf_generate_bounding_box,
sdf_generate_with_overlaps): Ditto.
* src/sdf/ftsdfcommon.h (square_root): Ditto.
* src/sdf/ftsdfrend.c (sdf_property_get, ft_sdf_render,
ft_bsdf_render): Ditto.

* src/sfnt/ttcolr.c (find_base_glyph_record,
find_base_glyph_v1_record): Fix variable signedness.
(read_color_line): Add cast.
(read_paint): Add casts.
Fix signedness issue.
(tt_face_get_colorline_stops) Fix signedness issues.

* src/sfnt/ttpost.c (load_format_20): Add casts.

* src/truetype/ttsubpix.c (TWEAK_RULES, TWEAK_RULES_EXCEPTIONS):
Remove final semicolons.
2021-05-29 09:51:04 +02:00
Werner Lemberg 2bfdc161fb [build] Allow overriding of `ANSIFLAGS` for GNU make build.
* builds/*: Implement it.
2021-05-29 00:27:40 +02:00
Alexei Podtelezhnikov 28eee3636c [type42] Fix auto-hinting.
The autohinter could not access the base (unscaled) outline in the
child TrueType glyph slot. We now share the internal parts between
the parent and child glyph slots. Fixes #1057.

* src/type42/t42objs.c (T42_GlyphSlot_Init): Remove the internal parts
of `T42_GlyphSlot' and replace it with the child TrueType structure.
(T42_GlyphSlot_Done): Updated accordingly.
2021-05-27 11:38:56 -04:00
Werner Lemberg 0d1c306e51 [psaux] Guard and trace AFM kern data allocation.
Reported as

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

* include/freetype/internal/fttrace.h: Add 'afmparse' trace
component.

* src/psaux/afmparse.c (FT_COMPONENT): Define.
(afm_parse_track_kern, afm_parse_kern_pairs): Protect against
allocations bombs.
Add tracing.
(afm_parse_kern_data): Don't allow multiple kern data sections.
2021-05-25 11:27:56 +02:00
Werner Lemberg 5f485339be .gitignore: Add `subprojects` directory, fix some patterns. 2021-05-24 08:24:36 +02:00
Alexei Podtelezhnikov 16947c0eb1 * meson.build (ft2_public_headers): Add missing `ftcid.h'.
Fixes #1058.
2021-05-23 05:36:16 -04:00
Alexei Podtelezhnikov 2468e59af1 [type42] Avoid some memory zeroing.
* src/type42/t42objs.c (T42_Open_Face): Tweak allocation macro.
* src/type42/t42parse.c (t42_parse_sfnts): Ditto.
2021-05-20 22:20:36 -04:00
Nikolaus Waxweiler ebf9e5ac71 [CMake] Update dependency finders.
1. Fixes CMake using any found HarfBuzz version lower than the minimum
required. This is based on HALX99's merge request at
https://gitlab.freedesktop.org/freetype/freetype/-/merge_requests/31
2. Update FindHarfBuzz.cmake from
https://github.com/WebKit/WebKit/blob/1ce32454/Source/cmake/FindHarfBuzz.cmake
and guard post-CMake-3.1 features to keep the minimum version unchanged
3. Update FindBrotliDec.cmake to stop the warnings, based on what
https://github.com/google/woff2/blob/a0d0ed7d/cmake/FindBrotliDec.cmake
is doing

* CMakeLists.txt, builds/cmake/FindHarfBuzz.cmake: Implement 1 and 2.
* builds/cmake/FindBrotliDec.cmake: Implement 3.
2021-05-19 21:53:21 +01:00
Ben Wagner 06e21ffedf [gzip] Use exact type for `ft_gzip_alloc` and `ft_gzip_free`.
While a function pointer may be cast to another function pointer
type, it is required to cast the function pointer back to the
original function pointer type before calling it.  If a parameter is
a pointer the exact pointer type is required.  Using a pointer to a
different underlying type is technically undefined behavior.  The
wrapper functions `ft_gzip_alloc` and `ft_gzip_free` took
`FT_Memory` (a `FT_MemoryRec_*`) instead of `voidpf` (`void*`), so
when gzip calls these callbacks through `alloc_func` or `free_func`
it invokes undefined behavior.  On most platforms this works out as
expected, but newer undefined behavior detectors and targets like
wasm can detect this and will produce an error.

* src/gzip/ftgzip.c (ft_gzip_alloc, ft_gzip_free): Update signatures
to exactly match `alloc_func` and `free_func`, respectively.
Internally, cast the `void*` opaque pointer to `FT_Memory`.
2021-05-19 09:07:33 +02:00
Alexei Podtelezhnikov 81852fbccc Prioritize the anti-aliasing renderer module.
* modules.cfg: Reorder the renderers.
* include/freetype/config/ftmodule.h: Ditto.
2021-05-18 22:18:17 -04:00
Alexei Podtelezhnikov 1bc801b0d6 [sfnt] Additional guards on the POST table.
Fixes timeout (#1055) analyzed by Ben Wagner, reported as

  https://crbug.com/1194092

* src/sfnt/ttload.c (tt_face_load_post): Check POST format.
* src/sfnt/sfobjs.c (sfnt_load_face): Synthesize the missing unicode
charmap only if the glyph names exist.
* src/psnames/psmodule.c (ps_unicode_value): Short cut ".notdef" and
".null".
2021-05-16 23:12:01 -04:00
Daniel McArdle de15165774 [psaux] Use doubling allocation strategy for CF2_ArrStack.
Fixes timeout reported as

  https://crbug.com/1206181

* src/psaux/psarrst.c (cf2_arrstack_{push,init}): Implement it.
* src/psaux/psarrst.h (CF2_ArrStackiRec): Drop `chunk'.
2021-05-13 23:08:31 -04:00
Alexei Podtelezhnikov 2d3f5dd294 * src/smooth/ftgrays.c (FT_MAX_GRAY_SPANS): Increase from 10 to 16.
Ten was barely enough for two slanted stems. Sixteen can actually fit
a bit more complicated scanlines.
2021-05-12 17:24:35 -04:00
Alexei Podtelezhnikov c653b8d2f1 * src/smooth/ftgrays.c (FT_GRAY_SET): Adjust for better code. 2021-05-12 16:17:21 -04:00
Alexei Podtelezhnikov 8f43d324d1 [smooth] Faster bitmap sweeping.
Selecting the fill rule or checking the direct mode each time we call
`gray_hline' is sub-optimal.  This effectively splits the direct mode
into a separate code path while inlining `gray_hline' and saving 5-7%
of rendering time.

* src/smooth/ftgrays.c (gray_hline): Eliminated in favor of...
(FT_FILL_RULE, FT_GRAY_SET): ... these new macros...
(gray_sweep): ... inlined here.
(gray_sweep_direct): New function that handles the direct span buffer.
(gray_TWorker): Remove the span buffer.
(gray_raster_render, gray_convert_glyph): Updated.
2021-05-12 00:04:59 -04:00
Alexei Podtelezhnikov b070264521 * src/smooth/ftgrays.c (gray_hline): Simplify even-odd computations.
It is too bad the even-odd rule is not used much.
2021-05-10 22:06:01 -04:00
Alexei Podtelezhnikov 967a34eee3 [type1] Avoid MM memory zeroing.
* src/type1/t1load.c (t1_allocate_blend, parse_blend_design_map):
Tweak allocation macros.
* src/type1/t1objs.c (T1_Face_Done): Minor.
2021-05-07 19:17:48 -04:00
Alexei Podtelezhnikov 2f62d8e075 * src/bdf/bdflib.c (_bdf_list_ensure): Tweak allocation macro. 2021-05-07 09:33:41 -04:00
Alexei Podtelezhnikov 79ed536d01 * src/psaux/psobjs.c (ps_parser_load_field): Tweak allocation macro. 2021-05-06 23:46:46 -04:00
Alexei Podtelezhnikov 44c59414eb * src/sfnt/sfobjs.c (sfnt_load_face): Tweak allocation macro. 2021-05-06 22:54:03 -04:00
Alexei Podtelezhnikov 998c7c0f1c * src/cid/cidload.c (cid_read_subrs): Tweak allocation macro. 2021-05-06 22:51:37 -04:00
Alexei Podtelezhnikov 2d95784885 * src/base/ftrfork.c (FT_Raccess_Get_DataOffsets): Tweak allocation. 2021-05-06 22:49:13 -04:00
Alexei Podtelezhnikov 8150ed0db2 [cff,psaux] Avoid memory zeroing (contd.).
* src/cff/cffload.c (cff_blend_doBlend, cff_blend_build_vector): Tweak
allocation macros.
* src/psaux/psarrst.c (cf2_arrstack_setNumElements): Ditto.
* src/psaux/psstack.c (cf2_stack_init): Ditto.
2021-05-05 23:30:46 -04:00
Ben Wagner 82fd32d674 * src/cid/cidload.c (cid_hex_to_binary): Improve return value.
Add argument to return the actual number of bytes that were decoded.
The actual number of bytes decoded can be quite variable depending
on the number of ignored 'whitespace' bytes or early termination
with `>`.
(cid_face_open): Updated to use this calculated value.  This avoids
trusting `parser->binary_length` is always be correct and reading
uninitialized bits if fewer are actually decoded.

First reported as

  https://crbug.com/1203240
2021-05-04 08:56:10 +02:00
Alexei Podtelezhnikov 66630d882c [sfnt] Streamline POST format 2.0 handing.
To reduce memory allocations, we read an entire Pascal-string buffer
and convert it to a C-string buffer.  We also reject tables with
Postscript glyph names exceeding 63 bytes.

* src/sfnt/ttpost.c (load_format20): Implement it.
(load_post_names): Check the minimal POST table size.
(load_format25, tt_face_free_ps_names): Updated accordingly.
2021-05-03 22:40:16 -04:00
Alexei Podtelezhnikov ec95f9c921 [bdf,pcf] Avoid memory zeroing (contd.).
* src/bdf/bdflib.c (bdf_create_property, _bdf_add_comment,
_bdf_add_property, bdf_load_font): Tweak allocation macros.
* src/pcf/pcfread.c (pcf_get_properties, pcf_get_metrics): Ditto.
2021-05-02 18:30:22 -04:00
Alexei Podtelezhnikov d911cb5392 * src/cid/cidload.c (cid_read_subrs): Tweak allocaton macro. 2021-05-01 23:49:11 -04:00
Alexei Podtelezhnikov dc42f826af [sfnt] Avoid some memory zeroing.
* src/sfnt/sfobjs.c (sfnt_open_font, sfnt_init_face,
tt_name_ascii_from_{utf16,other}): Tweak allocaton macros.
* src/sfnt/ttload.c (tt_face_load_name): Ditto.
2021-05-01 12:46:44 -04:00
Alexei Podtelezhnikov b8968d666e * src/sfnt/ttpost.c (load_format_{20,25}): Tweak allocaton macros. 2021-05-01 12:24:44 -04:00
Alexei Podtelezhnikov 2583b6085e * src/sfnt/pngshim.c (Load_SBit_Png): Tweak allocaton macro. 2021-05-01 09:22:26 -04:00
Alexei Podtelezhnikov 56ae943050 [truetype] Avoid some memory zeroing.
* src/truetype/ttinterp.c (Init_Context): Tweak allocation macro.
* src/truetype/ttpload.c (tt_face_load_cvt): Ditto.
2021-05-01 09:14:04 -04:00
Alexei Podtelezhnikov c177cc354d [woff2] Avoid some memory zeroing.
* src/sfnt/sfwoff2.c (store_loca, woff2_open_font): Tweak macros.
2021-05-01 09:09:52 -04:00
Alexei Podtelezhnikov 4e1c6a12e5 * src/gzip/ftgzip.c (ft_gzip_alloc): Zero out memory again. 2021-04-30 09:35:21 -04:00
Alexei Podtelezhnikov f631542dae [lzw] Preserve decompression stack when relocating to heap.
* src/lzw/ftzopen.c (ft_lzwstate_stack_grow): Copy stack when
relocating to heap.
2021-04-27 11:39:58 -04:00
Alexei Podtelezhnikov c213c8a9bb * src/cid/cidgload.c (cid_load_glyph): Restore the glyph_length check. 2021-04-27 08:54:19 -04:00
Werner Lemberg 2ec6feaf39 * src/psmodule.c (ps_unicodes_init): Ignore empty glyph names.
Reported as

  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=33637
2021-04-27 13:28:35 +02:00
Alexei Podtelezhnikov caff87b1f9 * src/sfnt/sfobjs.c (sfnt_init_face): Revert macro change. 2021-04-26 22:45:40 -04:00
Alexei Podtelezhnikov 8750e843df [cff] Avoid some memory zeroing.
* src/cff/cffparse.c (cff_parser_init): Tweak memory macro.
* src/cff/cffload.c (cff_index_load_offsets, cff_index_get_pointers,
cff_charset_load, cff_vstore_load): Ditto.
2021-04-26 17:21:51 -04:00
Alexei Podtelezhnikov 618d0834c7 [pfr] Avoid some memory zeroing.
* src/pfr/pfrobjs.c (pfr_face_init) : Tweak memory macro.
* src/pfr/pfrload.c (pfr_extra_item_load_stem_snaps,
pfr_phy_font_load): Ditto.
2021-04-26 17:14:28 -04:00
Alexei Podtelezhnikov b0a281974d * src/winfonts/winfnt.c (FNT_Face_Init): Tweak memory macro. 2021-04-26 17:10:28 -04:00
Alexei Podtelezhnikov deee5b7017 [psaux,psnames] Avoid some memory zeroing.
* src/psaux/psstack.c (cf2_stack_init): Tweak memory macro.
* src/psnames/psmodule.c (ps_unicodes_init): Ditto.
2021-04-26 17:07:44 -04:00
Alexei Podtelezhnikov 270ff52f62 [base] Avoid some memory zeroing.
* src/base/ftrfork.c (FT_Raccess_Get_DataOffsets): Use FT_QNEW_ARRAY.
* src/base/ftsnames.c (FT_Get_Sfnt_{Name,LangTag}): Ditto.
2021-04-25 23:40:59 -04:00
Alexei Podtelezhnikov c2d283143a [bdf,pcf] Avoid some memory zeroing.
* src/pcf/pcfread.c (pcf_read_TOC, pcf_get_properties, pcf_load_font):
Tweak memory macros.
* src/bdf/bdfdrivr.c (BDF_Face_Init): Ditto.
* src/bdf/bdflib.c (_bdf_readstreami, bdf_create_property,
_bdf_parse_glyphs, _bdf_parse_start): Ditto.
(_bdf_add_property): Do not handle zero size.
2021-04-25 23:33:15 -04:00
Issam E. Maghni f998eaf972 * builds/meson/process_ftoption_h.py: Add LF at EOF.
This fixes

  .../ftoption.h:1030:10: error:
    no newline at end of file [-Werror,-Wnewline-eof]

for the generated `ftoption.h` file.
2021-04-25 20:30:43 +02:00
Alexei Podtelezhnikov c78f78fab4 * src/cff/cffload.c (cff_index_get_pointers): s/FT_QALLOC/FT_ALLOC/. 2021-04-24 22:38:48 -04:00
Alexei Podtelezhnikov 0bd5d95d66 * src/base/ftobjs.c (Mac_Read_POST_Resource): s/FT_ALLOC/FT_QALLOC/.
* builds/mac/ftmac.c (FT_New_Face_From_SFNT, read_lwfn): Ditto.
2021-04-23 22:04:05 -04:00
Alexei Podtelezhnikov e6e5b67db3 * src/sdf/ftsdf.c (sdf_{edge,contour,shape}_new): Use FT_QALLOC. 2021-04-23 21:33:03 -04:00
Alexei Podtelezhnikov 6ada59ab7c [sfnt] s/FT_ALLOC/FT_QALLOC/ for initialized buffers.
* src/sfnt/sfdriver.c (get_win_string, get_apple_string,
sfnt_get_var_ps_name): Do not zero out the buffer.
* src/sfnt/sfobjs.c (sfnt_init_face): Ditto.
* src/sfnt/sfwoff.c (woff_open_font): Ditto.
* src/sfnt/sfwoff2.c (woff2_open_font): Ditto.
2021-04-23 19:22:51 -04:00
Alexei Podtelezhnikov ec9e5114b1 [cff,type1,type42] s/FT_ALLOC/FT_QALLOC/ for initialized buffers.
* src/cff/cffload.c (cff_index_get_pointers, cff_index_get_name):
Do not zero out the buffer.
* src/cff/cffdrivr.c (cff_ps_get_font_info): Ditto.
* src/type1/t1load.c (parse_subrs, parse_charstrings,
parse_blend_axis_types): Ditto.
* src/type1/t1parse.c (T1_New_Parser, T1_Get_Private_Dict): Ditto.
* src/type42/t42parse.c (t42_parser_init): Ditto.
2021-04-23 14:03:03 -04:00
Alexei Podtelezhnikov baa0f71ddf [cid] s/FT_ALLOC/FT_QALLOC/ and clean up.
* src/cid/cidgload.c (cid_load_glyph): Do not zero out the buffer.
* src/cid/cidload.c (cid_face_open, cid_read_subrs): Ditto.
2021-04-23 13:48:34 -04:00
Alexei Podtelezhnikov b3438ccb31 [pfr] s/FT_ALLOC/FT_QALLOC/ for initialized buffers.
* src/pfr/pfrload.c (pfr_extra_item_load_font_id, pfr_aux_name_load):
Do not zero out the buffer.
2021-04-23 08:35:02 -04:00
Alexei Podtelezhnikov 1e525c62ae [bzip2,gzip] s/FT_ALLOC/FT_QALLOC/ for initialized buffers.
* src/bzip2/ftbzip2.c (ft_bzip2_alloc): Do not zero out the buffer.
* src/gzip/ftgzip.c (ft_gzip_alloc, FT_Stream_OpenGzip): Ditto.
2021-04-23 08:24:22 -04:00
Alexei Podtelezhnikov a0fb6dbcd9 [pcf,bdf,winfonts] s/FT_ALLOC/FT_QALLOC/ for initialized buffers.
* src/pcf/pcfread.c (pcf_interpret_style): Do not zero out the buffer.
* src/bdf/bdfdrivr.c (bdf_interpret_style): Ditto.
* src/winfonts/winfnt.c (FNT_Face_Init, FNT_Load_Glyph): Ditto.
2021-04-23 00:05:18 -04:00
Alexei Podtelezhnikov 23f85c8a98 [cache] Optimize SBit copying.
* src/cache/ftcsbits.c (ftc_snode_load): Do not initialize the buffer.
(ftc_sbit_copy_bitmap): Accept zero size, s/FT_ALLOC/FT_QALLOC/.
2021-04-22 23:34:08 -04:00
Alexei Podtelezhnikov 93715ab2c4 [gxvalid,otvalid] s/FT_ALLOC/FT_QALLOC/ for initialized buffers.
* src/gxvalid/gxvmod.c (gxv_load_table): Do not zero out the buffer.
* src/otvalid/otvmod.c (otv_load_table): Ditto.
2021-04-22 23:07:01 -04:00
Alexei Podtelezhnikov 90b97a833d [psaux] s/FT_ALLOC/FT_QALLOC/ for initialized buffers.
* src/psaux/psobjs.c (ps_table_done, ps_parser_load_field): Do not
zero out the buffer.
2021-04-22 23:00:40 -04:00
Alexei Podtelezhnikov 44b1ebe514 [base] s/FT_ALLOC/FT_QALLOC/ for initialized buffers.
* src/base/ftobjs.c (open_face_PS_from_sfnt_stream,
Mac_Read_sfnt_Resource): Do not zero out the buffer.
* src/base/ftmac.c (FT_New_Face_From_SFNT, read_lwfn): Ditto.
* src/base/ftrfork.c (raccess_make_file_name,
raccess_guess_darwin_hfsplus, raccess_guess_darwin_newvfs): Ditto.
2021-04-22 22:34:05 -04:00
Alexei Podtelezhnikov 8a459e5172 [cache] Restore SBit copying for unowned (BDF) bitmaps.
* src/cache/ftcsbits.c (ftc_sbit_copy_bitmap): Restore.
(ftc_snode_load): Check ownership and copy unowned bitmaps.
2021-04-20 22:53:13 -04:00
Alexei Podtelezhnikov 361465dec9 Bitmap tracing. 2021-04-20 22:31:28 -04:00
Dominik Röttsches e662a9500f [sfnt] Return in 'COLR' v1 when layer pointer outside table
* src/sfnt/ttcolr.c (tt_face_get_paint_layers): Add missing return
when paint pointer outside table.
(read_paint): Add missing return when paint pointer outside table.
2021-04-19 12:49:16 +03:00
Alexei Podtelezhnikov 7c685cb3f6 [cache] Switch to lazy SBit setting.
* src/cache/ftcsbits.c (ftc_sbit_copy_bitmap): Removed.
(ftc_snode_load): Take the bitmap ownership instead of copying.
2021-04-18 22:31:13 -04:00
Alexei Podtelezhnikov 02dec61731 Typo. 2021-04-18 10:24:31 -04:00
Daniel Welty 2e68785e08 * src/cache/ftcsbits.c (ftc_snode_load): Properly handle short pitch. 2021-04-17 09:00:40 -04:00
Werner Lemberg 6f6ad87638 * builds/unix/freetype2.m4: Fix help string formatting.
The indented `dnl` macros inserted unwanted horizontal space.

Problem reported by Ozkan Sezer <sezeroz@gmail.com>.
2021-04-16 20:50:27 +02:00
Dominik Röttsches 7f8a1edd3a [sfnt] Safeguard 'COLR' v1 layer extraction
* src/sfnt/ttcolr.c (tt_face_get_paint_layers): Do not output
layer pointer to iterator if it is outside the 'COLR' table.
(read_paint): Do not attempt to read layers that are outside the
table.
2021-04-16 12:41:58 +03:00
Alexei Podtelezhnikov b9b74f9f78 A few words on prerequisites. 2021-04-10 23:32:20 -04:00
Ben Wagner f9350be1e4 [base] Complete `ft_glyphslot_clear`.
* src/base/ftobjs.c (ft_glyphslot_clear): This function is intended
to reset all the values of a glyph slot.  However, it was not
resetting the values of the advances and `glyph_index`.  Reset the
advances and `glyph_index` to zero.
2021-04-02 11:09:01 +02:00
Ben Wagner 52f2a008f1 Update TT_New_Context documentation
In commit 531d463aed

  [truetype] Allocate TT_ExecContext in TT_Size instead of TT_Driver.

the `TT_ExecContext` was moved from being on the driver to being on the size
to make it easier to use FreeType in a multi-threaded environment.  However,
the documentation for `TT_New_Context` was not updated and still reflects
the old behavior and parameter list.

This change updates `TT_New_Context` documentation to reflect the current
parameters and usage.
2021-04-02 11:01:12 +02:00
Ben Wagner 369d8be97f [truetype] Prevent glyph program state from persisting.
`FDEF` instructions are specified as allowed only in 'prep' or
'fpgm'.  FreeType has attempted to prevent their use in the glyph
program, but they were still allowed in glyph programs if defined in
a function defined in 'prep' or 'fpgm' and called from the glyph
program.

Similarly, `IDEF` instructions are specified not to be able to
modify any existing instruction.  FreeType has attempted to prevent
their use in the glyph program, but they can still be used like
`FDEF`.

This change stores the initial bytecode range type and disallows the
use of `FDEF` and `IDEF` while running the glyph program.

Most other state is copied from the `TT_Size` into the execution
context.  However, it is possible for a glyph program to use `WS` to
write to the storage area or `WCVTP`, `WCVTF`, and `DELTAC[123]` to
write to the control value table.

Allowing any change to the global state from the glyph program is
problematic as the outlines of any given glyph may change based on
the order the glyphs are loaded or even how many times they are
loaded.  There exist fonts that write to the storage area or the
control value table in the glyph program, so their use should not be
an error.

Possible solutions to using these in the glyph program are

  * ignore the writes;
  * value-level copy on write, discard modified values when finished;
  * array-level copy on write, discard the copy when finished;
  * array-level copy up-front.

Ignoring the writes may break otherwise good uses.  A full copy
up-front was implemented, but was quite heavy as even well behaved
fonts required a full copy and the memory management that goes along
with it.  Value-level copy on write could use less memory but
requires a great deal more record keeping and complexity.  This
change implements array-level copy on write.  If any attempt is made
to write to the control value table or the storage area when the
initial bytecode range was in a glyph program, the relevant array
will be copied to a designated storage area and the copy used for
the rest of the glyph program's execution.

* src/truetype/ttinterp.h (TT_ExecContextRec): New fields
`iniRange`, `glyfCvtSize`, `glyfCvt`, `origCvt`, `glyfStoreSize`,
`glyfStorage`, and `origStorage`.

* src/truetype/ttinterp.c (Modify_CVT_Check): New function to handle
`exc->glyfCvt`.
(Write_CVT, Write_CVT_Stretched, Move_CVT, Move_CVT_Stretched): Use
it.
(Ins_WS): Handle `exc->glyfStorage`.
(Ins_FDEF, Ins_IDEF): Updated.
(TT_RunIns): Updated.
(TT_Done_Context): Free 'glyf' CVT working and storage area.
(TT_Load_Context): Fix/add casts.

* src/truetype/ttgload.c (TT_Load_Simple_Glyph): Fix cast.
2021-04-02 10:31:39 +02:00
Dominik Röttsches 1c0862938d [sfnt] Check validity of pointer location of `read_color_line`.
* src/sfnt/ttcolr.c (get_child_table_pointer): New function to fetch
child table pointer early for all paint formats that compute a child
table pointer.
(read_color_line, read_paint): Updated.
(tt_face_get_colorline_stops): Check `colr->table`.
2021-04-02 07:09:47 +02:00
nikramakrishnan c1e1a07f79 [docs] Update docwriter stylesheet for 1.3.1.
This change is required to support docwriter 1.3.1.

See

  https://gitlab.freedesktop.org/freetype/docwriter/-/merge_requests/101

for more information.

* docs/markdown/stylesheets/extra.css:
(.wy-nav-content, .md-sidebar--secondary): Remove.
2021-03-28 15:07:05 +05:30
Alexei Podtelezhnikov e9c50fa77d * src/sfnt/pngshim.c (Load_SBit_Png): Free `rows` once later. 2021-03-16 22:12:41 -04:00
Ben Wagner b0729b8fbb [sfnt] Fix memory leak in png loading.
Reported as

  https://bugs.chromium.org/p/chromium/issues/detail?id=1182552

Memory is allocated and the pointer assigned to `rows` inside a
'setjmp' scope.  This memory must be freed outside the 'setjmp'
scope after a 'longjmp'.  Since `rows` is a local and modified
inside the 'setjmp' scope it must be marked volatile or it will have
an indeterminate value after the 'longjmp'.

* src/sfnt/pngshim.c (Load_SBit_Png): Fix memory leak of `rows`.
2021-03-16 08:47:45 +01:00
Christopher Degawa 66005cbae1 * CMakeLists.txt: Don't limit generation of 'pkg-config' file to UNIX.
mingw-w64 uses the 'pkg-config' files but does not set UNIX.
2021-03-16 08:36:54 +01:00
Werner Lemberg 1578e570cd README.git: Document cloning of official site and Savannah mirror. 2021-03-16 06:59:01 +01:00
Alexei Podtelezhnikov fb9bf2efae * src/smooth/ftgrays.c (gray_set_cell): Refactor to fix VC++ warning. 2021-03-15 22:33:17 -04:00
Werner Lemberg 2149b51f25 Handle various VC++ compiler warnings.
Fixes #1039.

* src/base/ftstroke.c (ft_stroker_inside, ft_stroker_outside):
Initialize `sigma`.

* src/sdf/ftsdf.c (sdf_generate_with_overlaps): Exit immediately if
function arguments are invalid.
* src/sdf/ftsdfrend.c (sdf_property_set) <"overlaps">: Fix cast.

* src/sfnt/sfwoff2.c (woff2_decompress)
[!FT_CONFIG_OPTION_USE_BROTLI]: Use `FT_UNUSED`.

* src/truetype/ttgxvar.c (TT_Get_MM_Var): Initialize `fvar_head`.
2021-03-13 19:08:09 +01:00
Alexei Podtelezhnikov 80bda804d5 [smooth] Reduce copying during integration phase.
We now record `cover' and `area' directly into the linked list. This
makes rendering faster by 10% or even more at larger sizes.

* src/smooth/ftgrays.c (FT_INTEGRATE): Write directly.
(gray_TWorker): Add direct cell reference and remove unused fields.
(gray_set_cell): Consolidate the linked list management and pointers.
(gray_convert_glyph, gray_convert_glyph_inner): Updated.
2021-03-11 22:40:19 -05:00
Alexei Podtelezhnikov d5b7de5541 * src/smooth/ftgrays.c (FT_INTEGRATE): New convenience macro.
(gray_render_line, gray_render_scanline): Use it.
2021-03-11 22:08:45 -05:00
Alexei Podtelezhnikov 8516849977 * src/smooth/ftgrays.c (gray_render_line): Rearrange conditionals.
These produce faster or more optimizable code.
2021-03-09 22:14:44 -05:00
Werner Lemberg fedd945c3e meson.build: Minor formatting. 2021-03-08 10:30:57 +01:00
Tim-Philipp Müller 7252e35ed2 [meson] Fix 'mmap' handling on Windows.
* meson.build (ft2_sources): Always use `windows/ftsystem.c` on
Windows unless mmap has been disabled.

  https://gitlab.freedesktop.org/freetype/freetype/-/merge_requests/5#note_829289
2021-03-08 10:24:07 +01:00
Tim-Philipp Müller e222932810 [ci] Add basic support for Meson builds with MSVC on Windows.
This adds meson jobs for VS2017 (x86 and x86_64).

* .gitlab-ci.yml: New file.
2021-03-07 18:01:31 +01:00
Tim-Philipp Müller bb42afbda0 [meson] Add subproject fallbacks for 'libpng' and 'zlib'.
* subprojects/libpng.wrap, subprojects/zlib.wrap: New files.

* meson.build: Updated.
2021-03-07 17:54:21 +01:00
Xavier Claessens d69d9c2397 [meson] Make it work with Windows.
* meson.build: Do not process `ftconfig.h` when not using
`ftconfig.h.in`.

Fixes #1029.
2021-03-07 17:48:15 +01:00
Werner Lemberg 7227aabb3e Revert "[sfnt] Fix crash in `Load_SBit_Png` on Windows x64."
This reverts commit dbf9142f7e, as discussed
in #1037.
2021-03-04 06:41:30 +01:00
Jesse Towner dbf9142f7e [sfnt] Fix crash in `Load_SBit_Png` on Windows x64.
This change fixes a crash that occurs in `Load_SBit_Png` when
running on a 64-bit Windows OS.  A memory access violation exception
would be raised by `setjmp` if the `jmp_buf` is not aligned to a
16-byte memory boundary.  This is due to setjmp executing `movdqa`
instructions to store 128-bit XMM registers to memory, which require
correct memory alignment.  This problem occurs because
`png_create_read_struct` uses `malloc` and `free` for memory
management, which only guarantees 8-byte alignment on Windows.

Instead, to fix the problem, `png_create_read_struct_2` is used on
64-bit Windows, which allows for user-defined memory allocation and
deallocation callbacks to be specified.  These callbacks forward the
allocation and deallocation requests to `_aligned_alloc` and
`_aligned_free`, ensuring that the allocated `png_struct` and
internal `jmp_buf` have the requisite 16-byte alignment.

* src/sfnt/pngshim.c <_WIN64>: Include `malloc.h`.
(malloc_callback, free_callback) <_WIN64>: New functions.
(Load_SBit_Png) <_WIN64>: Use `png_create_read_struct_2` instead of
`png_create_read_struct`
2021-02-27 13:28:13 +01:00
Werner Lemberg f7d7e7f9f7 freetype.h: Documentation typos. 2021-02-27 12:14:02 +01:00
Werner Lemberg ff34ea8eda Improve build documentation.
Fixes #1012.
2021-02-27 11:02:53 +01:00
Werner Lemberg e1f364e509 [woff2] Fix memory leak.
Reported as

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

* src/sfnt/sfwoff2.c (woff2_open_font): Reject fonts that have
multiple tables with the same tag.  While not explicitly forbidden
in the OpenType specification, it is implicitly forbidden by
describing a binary search algorithm for tables that only works
reliably if table tags are unique.
2021-02-25 20:00:07 +01:00
Werner Lemberg df7fcafe6e * CMakeLists.txt: Update location of `LICENSE.TXT`.
Fixes #1035.
2021-02-22 15:33:23 +01:00
Werner Lemberg 111f2f27b5 * builds/unix/ax_pthread.m4: Update from 'autoconf-archive'.
A bunch of fixes were added recently to its git repository.
2021-02-19 20:33:50 +01:00
Werner Lemberg eca35e04fc [unix] Updates for autoconf 2.71.
This fixes warnings reported by autoupdate.

* builds/unix/ax_pthread.m4: Replace `as_echo` with `AS_ECHO`.

* builds/unix/configure.raw: Remove obsolete `AC_HEADER_STDC`.
Don't escape back quotes in messages for `AC_MSG_WARN`.
2021-02-17 21:10:34 +01:00
Werner Lemberg 635d394fe3 * builds/toplevel.mk: Fix previous commit.
<top_level>: Use `TOP_DIR` in `wildcard` function.
(check_out_submodule, copy_submodule): Move down to come after
definition of `all` rule.
Call `mkdir` conditionally.
2021-02-16 19:24:15 +01:00
Werner Lemberg c3a0b43ec6 * builds/toplevel.mk: Use rules for handling 'dlg'.
Suggested by Alexei.

(check_out_submodule, copy_submodule): New targets.
<top-level>: Replace calls to `shell` with rules.
2021-02-16 17:04:51 +01:00
Werner Lemberg dfa7cca5f3 * builds/toplevel.mk: Avoid side effects of `shell`.
We use a dummy variable to catch its output.  Otherwise the `make`
program is going to interpret the return value of `shell`; this can
cause obscure warning or error messages or even be harmful.
2021-02-16 14:29:45 +01:00
Werner Lemberg 92bd99bd25 Move 'dlg' submodule to `subprojects` directory.
This is for future changes with Meson, which doesn't allow a
different name for its `subprojects` directory.  Having both a
`submodules` and a `subprojects` directory is confusing.

* .gitmodules, autogen.sh (copy_submodule_files, DLG_INC_DIR,
DLG_SRC_DIR): Updated.

* builds/toplevel.mk (<top-level>, do-dist),
builds/windows/vc2010/script.bat: Updated.

* src/tools/no-copyright: Updated.
2021-02-16 14:07:18 +01:00
Dominik Röttsches 215ae25330 [sfnt] Update paint format values to support non-variable paints.
* freetype.h (FT_PaintFormat): Update paint format identifiers after
a specification change.  The specification was updated to have
sibling formats, variable and non-variable variants for each.
Reflect that here.

* sfnt/ttcolr.c (read_paint): Remove parsing of variable indices as
the non-variable formats no longer have them.
2021-02-16 13:15:41 +01:00
Daniel E b2aeca5fda * CMakeLists.txt: Improve 'bz2' support.
Not all distributions such as FreeBSD provide a `.pc` file for
'(lib)bz2' so follow autotools and add it to `Libs.private` instead.
2021-02-15 09:09:09 +01:00
Werner Lemberg 7849316ccf * src/tools/update-copyright-year: Fix single-year entry handling.
The fix from 2021-01-17 didn't cover the case where the year to be
updated is identical to the current year.
2021-02-13 09:21:37 +01:00
Werner Lemberg d51452e3ec Add new function `FT_Get_Transform`.
See

  https://github.com/harfbuzz/harfbuzz/issues/2428

for some reasons to introduce this function.

* include/freetype/freetype.h, src/base/ftobjs.c (FT_Get_Transform):
Implement it.
2021-02-13 08:52:58 +01:00
Werner Lemberg d93a011933 Minor editing of last commit; formatting. 2021-02-13 07:50:04 +01:00
Alexei Podtelezhnikov 70fd20e67e Decorate qsort callbacks with cdecl.
* include/freetype/internal/compiler-macros.h (FT_COMPARE_DEF):
Add new macro.
* src/base/ftrfork.c, src/bdf/bdflib.c, src/gxvalid/gxvcommn.c,
src/psaux/afmparse.c, src/psnames/psmodule.c, src/type1/t1afm.c,
src/sfnt/sfwoff.c, src/sfnt/sfwoff2.c: Update qsort callbacks.

Fixes #1026 when compiling FreeType with an unusual calling convention
while the C library qsort still expects cdecl.
2021-02-12 19:28:05 -05:00
Dominik Röttsches 54c5ad5c92 [sfnt] Implement 'COLR' v1 sweep gradients.
* freetype.h (FT_PaintSweepGradient): Add `FT_PaintSweepGradient` to
represent a 'COLR' v1 sweep gradient.
Update format.
(FT_PaintFormat): Update shifted paint formats.
Sync with spec.
* sfnt/ttcolr.c (read_paint): Logic to parse sweep gradients.
Fix struct access in radial gradient implementation.
2021-02-11 14:20:03 +01:00
Werner Lemberg c8dede7b1c [dlg] Update submodule to upstream's current master. 2021-02-10 18:58:21 +01:00
Dominik Röttsches 64f01bfedd [sfnt] Provide optional root transform for 'COLR' v1 glyph graph.
* include/freetype/freetype.h (FT_Get_Color_Glyph_Paint):
Additional function argument root_transform to control whether
root transform should be returned.
(FT_OpaquePaint): Additional tracking field to denote whether
root transform is to be returned.
* include/freetype/internal/sfnt.h
(TT_Get_Color_Glyph_Paint_Func): Propagate additional argument.
* src/base/ftobjs.c (FT_Get_Color_Glyph_Paint): Ditto.
* src/sfnt/ttcolr.c (tt_face_get_colr_glyph_paint): Return root
transform reflecting the size and tranform configured on
FT_Face.
(read_paint): Initialize and track status of insert_root_transform
flag.
2021-02-10 18:51:04 +01:00
Xavier Claessens cc90307d71 * meson.build: s/freetype2_dep/freetype_dep/.
Many projects (e.g., fontconfig, cairo) hardcode the `freetype_dep`
variable name to use FreeType as subproject because that was the
variable name in Centricular's Meson port of FreeType.  While they
should stop hardcoding that variable name, it does not cost us
anything to keep using that name to ease transition.
2021-02-10 18:14:47 +01:00
Xavier Claessens 3dbdb78a25 [meson] Fix handling of HarfBuzz library.
* meson.build (harfbuzz_dep): Do not fall back to HarfBuzz by
default.

Otherwise it causes a dependency cycle:

  cairo => fontconfig => freetype2 => harfbuzz => cairo

Meson will still fall back to HarfBuzz subprojects if the `harfbuzz`
option is set to `enabled` instead of `auto` and a
`subprojects/harfbuzz.wrap` file is present.  In that case it is the
responsibility of the main project to set the proper options on each
subproject to break the dependency cycle.

Fixes: #1028.
2021-02-10 18:10:59 +01:00
Xavier Claessens 2c40559609 Meson: Fix dependency lookup and generate ftconfig.h
[meson] Fix dependency lookup and generate `ftconfig.h`.

- zlib: If not found on the system, meson can build it as a
  subproject.  We thus never use the (outdated) zlib support that
  comes with FreeType.  Doing so has the additional advantage that
  the zlib code can be shared with other projects like GLib if both
  are subprojects of an application.
- harfbuzz: Build as a subproject if not found on the system.
- 'QUESTION: What if the compiler doesn't support `-D` but uses `/D`
  instead as on Windows?'  Answer: Meson translate arguments for us.
- visibility: Replace self-made code with meson-specific solution.

* meson.build (ft2_defines): Rewrite logic to set and handle it.
(process_header_command): New variable, previously called
`ftoption_command`.
(ftoption_command, ftconfig_command): New variables.
(zlib_option): Removed.
(zlib_dep): New variable.
(ft2_deps): Updated.
(harfbuzz_dep): Updated.
(ftconfig_h_in, ftconfig_h): New variables.
(ft2_sources): Updated.
(ft2_lib): Updated, handle visibility.
(summary): Updted.

* meson_options.txt (zlib): Updated.
2021-02-09 16:11:39 +01:00
Xavier Claessens e11cc40a2e * meson.build: Fix resource compilation on Windows.
This is copied from GStreamer's meson port of FreeType.

(ft2_sources): Add both debug and resource file (the latter for
Windows only).
(ft2_debug_src): Removed.
2021-02-09 16:11:39 +01:00
Xavier Claessens 69e0faa893 * meson.build: s/ft2_libtool_version/ft2_pkgconfig_version/.
(freetype2_dep): Use it.

`ft2_libtool_version` would be the shared library version, not the
one we should use in file `freetype2.pc`.
2021-02-09 16:11:39 +01:00
Xavier Claessens 0565c5ba2b * meson.build: Use `meson.override_dependency`.
This is a new meson mechanism to avoid other projects to hard-code
the `freetype2_dep` variable name in their build definition.  It
also ensures that meson does not mix system and subproject versions
of FreeType inside of the same project.

Also remove outdated TODO because `declare_dependency` was already
there.
2021-02-09 16:11:39 +01:00
Xavier Claessens 5c81e09b17 * meson.build (bzip2_dep): Simplify.
We remove `static:false` from `find_library('bz2')`.

I don't know whether the previous code was a workaround for an old
meson bug, but at least with version >=0.55.0 (which FreeType uses)
it picks the shared library when both are available.

With this commit, file `freetype2.pc` no longer contains the full path to
file `libbz2.so`; instead, it correctly uses `-lbz2`.  Note that this is a
meson bug is still present in the current version (0.57.0).
2021-02-09 16:09:04 +01:00
Xavier Claessens 1b69fb9bdb * meson.build: Set project version. 2021-02-09 15:54:54 +01:00
Werner Lemberg 947e475283 [base] Fix Netpbm tracing message.
* src/base/ftobjs.c (FT_Render_Glyph_Internal): Don't emit Netpbm
warning if there is nothing to output.
2021-02-04 10:19:26 +01:00
Werner Lemberg d924a66a5c * src/*: Don't use more than one '\n' in `FT_TRACE` and `FT_ERROR`.
This ensures good logging output, with all lines having a proper
prefix (if requested).

This is a continuation of a similar patch from 2020-12-02, which
missed some locations.
2021-02-04 07:46:46 +01:00
Alexei Podtelezhnikov fd7f92b6f0 * builds/unix/configure.raw [mmap]: Restore default path.
Fixes #1023.
2021-02-03 14:44:14 -05:00
Werner Lemberg 0636dc8af1 [psaux] Fix integer overflow.
Reported as

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

* src/psaux/psblues.c (cf2_blues_capture): Use `SUB_INT32`.
2021-02-03 19:16:02 +01:00
Alexei Podtelezhnikov d3befe1c72 * builds/unix/configure.raw [mmap support]: Explicitly handle Windows.
Fixes #1024.
2021-02-02 23:02:54 -05:00
Werner Lemberg 5635d5edc4 * builds/unix/configure.raw [mmap support]: Correctly handle Windows.
Fixes #1024.
2021-02-02 10:33:53 +01:00
Werner Lemberg 689402418f builds/{unix,windows}/ftsystem.c: Sync comments with `src/base/ftsystem.c`.
Also some minor code formatting.
2021-02-02 09:44:42 +01:00
Werner Lemberg 4554c6da42 * builds/windows/ftdebug.c: Synchronize with `src/base/ftdebug.c`. 2021-01-31 17:17:40 +01:00
Werner Lemberg 324612ceb2 Always provide logging API.
It's easier to have stubs if FT_DEBUG_LOGGING is undefined than to
modify `ftexport.sym` conditionally.

Problem reported by Alexei.

* src/base/ftdebug.c: Include `ftlogging.h`.

(FT_Trace_Set_Level, FT_Trace_Set_Default_Level, FT_Set_Log_Handler,
FT_Set_Default_Log_Handler) [!FT_DEBUG_LOGGING]: Provide stubs.
2021-01-31 14:28:44 +01:00
Werner Lemberg 939e844468 * builds/unix/configure.raw: Fix typo.
Bug introduced in Vincent's last commit bb33f03.

Fixes issue #1021.
2021-01-30 06:32:38 +01:00
Alexei Podtelezhnikov 7ae5609dbe * src/base/ftstroke.c (FT_Stroker_EndSubPath): Ignore tiny gaps.
Fixes bug #1020.
2021-01-27 16:08:08 -05:00
Alexei Podtelezhnikov 4c3bd2ab93 [stroker] Minor clean-up.
* src/base/ftstroke.c (FT_Stroker_{ConicTo,CubicTo}): Reset the last
line length.
(FT_Stroker_EndSubPath): Call `ft_stroker_process_corner'.
2021-01-27 15:54:34 -05:00
Werner Lemberg 601c5a611e Improve ChangeLog entry for last commit. 2021-01-27 13:04:55 +01:00
Vincent Torri bb33f03a71 * builds/windows/ftsystem.c: Add shared memory support on Windows. 2021-01-27 06:43:41 -05:00
Werner Lemberg c7cc947c0f Minor documentation fixes. 2021-01-23 15:45:10 +01:00
Werner Lemberg 209e9841f2 Require HarfBuzz 2.0.0.
This is needed to make commit f1f9705f9 work.

* CMakeLists.txt (HARFBUZZ_MIN_VERSION), builds/unix/configure.raw
(harfbuzz_pkg), meson.build (harfbuzz_dep): Updated.
2021-01-23 14:15:29 +01:00
Alexei Podtelezhnikov 8dc311320c * autogen.sh: Absorb `version.sed'.
* version.sed: Removed.
2021-01-22 20:27:15 -05:00
Werner Lemberg 60ba8fe9e7 Move old ChangeLog files to new `docs/oldlogs` directory. 2021-01-22 09:08:03 +01:00
Werner Lemberg 0606350c2a LICENSE.TXT: Moved to root directory; minor edits.
Fixes issue #1015.
2021-01-22 09:07:51 +01:00
Alexei Podtelezhnikov b594cd90bd * srd/base/ftlcdfil.c (FT_Library_SetLcdGeometry): Fix return value. 2021-01-19 07:35:38 -05:00
Nikolaus Waxweiler f1f9705f93 [afshaper] Fix hb_ot_tags_from_script deprecation warning.
* autofit/afshaper.c (af_shaper_get_coverage): Copy the source code
of the function as suggested in
https://github.com/harfbuzz/harfbuzz/issues/2737 and adjust to handle
at most three tags.
2021-01-17 17:33:50 +00:00
Werner Lemberg d35c7f7cba * src/tools/update-copyright-year: Fix single-year entry handling. 2021-01-17 08:44:00 +01:00
Werner Lemberg b6e8a71266 Update all copyright notices. 2021-01-17 07:18:48 +01:00
Werner Lemberg 4278ee6ca0 no-copyright: Updated. 2021-01-17 07:16:26 +01:00
Alexei Podtelezhnikov 4e7a01840d * builds/unix/unixddef.mk: Remove the second DEVEL_DIR definition. 2021-01-16 12:04:35 -05:00
Werner Lemberg 5e4ed8ba2b Documentation update for repository move to 'freedesktop.org'. 2021-01-16 15:45:13 +01:00
Werner Lemberg b0f86752a5 .gitattributes: New file.
We use this to handle ChangeLog files with the `git-merge-changelog`
program.
2021-01-16 09:13:44 +01:00
Werner Lemberg 89184195b4 README, README.git: First updates due to freedesktop.org migration. 2021-01-16 07:53:09 +01:00
Dominik Röttsches 268bdd7764 CHANGES: Mention 'COLR' v1 support. 2021-01-15 14:49:32 +01:00
Werner Lemberg ba1a6acf28 [sfnt] Additional checks for 'colr' table presence.
* sfnt/ttcolr.c (tt_face_get_colr_glyph_paint,
tt_face_get_colorline_stops, tt_face_get_paint): Additional checks
for whether colr table is present.  Prevents crashes when these
methods are called on non-COLR fonts.
2021-01-15 10:09:00 +01:00
Dominik Röttsches 53fea87745 Add config option to test for 'COLR' v1 support in headers.
* include/freetype/config/ftoption.h (TT_SUPPORT_COLRV1): New macro
so that clients can test whether the FreeType checkout that they are
building against supports the 'COLR' v1 API.  This is intended to be
a temporary solution until 'COLR' v1 support is released in a
FreeType version and such a check can be made by using the version
number instead.
2021-01-14 16:06:03 +01:00
Dominik Röttsches 4b58cf47cc [base] Fill 'COLR' v1 API templates to make them work (#59703).
* src/base/ftobjs.c (FT_Get_Color_Glyph_Paint, FT_Get_Paint_Layers,
FT_Get_Paint, FT_Get_Colorline_Stops): Add basic sanity checks,
check for existence of `FT_Face`, check arguments and delegate calls
for the respective 'COLR' v1 API to the SFNT driver.
2021-01-14 15:56:04 +01:00
Dominik Röttsches d3e95d97a0 [sfnt] Register 'COLR' v1 API in driver (#59703).
* include/freetype/internal/sfnt.h (TT_Get_Color_Glyph_Paint_Func,
TT_Get_Paint_Layers_Func, TT_Get_Colorline_Stops_Func,
TT_Get_Paint_Func): New function pointer types.
(SFNT_Interface): Add them.
(FT_DEFINE_SFNT_INTERFACE): Updated.

* src/sfnt/sfdriver.c (PUT_COLOR_LAYERS_V1): New macro.
(sfnt_interface): Add new function pointers.
2021-01-14 15:56:04 +01:00
Dominik Röttsches 6260b4901c [sfnt] Add 'COLR' v1 API to retrieve color layers (#59703).
* src/sfnt/ttcolr.c (tt_face_get_paint_layers): New function to get
the layers of a `PaintColrLayers` table in the font, using an
`FT_LayerIterator` from an `FT_PaintColrLayers` object retrieved via
`tt_face_get_paint`.

* src/sfnt/ttcolr.h: Updated.
2021-01-14 15:56:04 +01:00
Dominik Röttsches be06a9d002 [sfnt] Add 'COLR' v1 API to iterate color stops (#59703).
* src/sfnt/ttcolr.c (tt_face_get_colorline_stops): New function to
return the current `FT_ColorStop` object from `FT_ColorStopIterator`.
Also increment the iterator.

* src/sfnt/ttcolr.h: Updated.
2021-01-14 15:56:04 +01:00
Dominik Röttsches cdad4db424 [sfnt] Add API to get actual paint from `FT_OpaquePaint` (#59703).
* src/sfnt/ttcolr.c (tt_face_get_paint): New function to resolve an
`FT_OpaquePaint` paint reference into an `FT_COLR_Paint` object of a
certain format, which contains the detailed information stored in a
paint of the respective format.
(read_paint): New function to provide the format specific parsing
and to populate the data members of each specific `FT_COLR_Paint`
subtype.
(read_color_line): New function to parse retrieved color line
information into an `FT_ColorLine` object, which has information
about the color line extend mode as well as an
`FT_ColorStopIterator` object.

* src/sfnt/ttcolr.h: Updated.
2021-01-14 15:56:04 +01:00
Dominik Röttsches 9e422b67c8 [sfnt] Add API to retrieve 'COLR' v1 root paint (#59703).
* src/sfnt/ttcolr.c (BaseGlyphV1Record): New structure.
(tt_face_load_colr): Handle version 1 table header.
(find_base_glyph_v1_record): New auxiliary function.
(tt_face_get_colr_glyph_paint): New function to find the root
`FT_OpaquePaint` object for a given glyph ID.

* src/sfnt/ttcolr.h: Updated.
2021-01-14 15:56:03 +01:00
Dominik Röttsches 08dba4dc35 Add new methods required for 'COLR' v1 to public API (#59703).
* include/freetype/freetype.h (FT_Get_Color_Glyph_Paint): New method
for retrieving the root paint object for a color glyph by specifying
a glyph ID.
(FT_Get_Paint_Layers): New method for retrieving the layers of a
`PaintColorGlyph`.
(FT_Get_ColorLine_Stops): New method for retrieving the stops of a
color.
(FT_Get_Paint): New method for resolving an `FT_OpaquePaint` into an
`FT_COLR_Paint` object.
2021-01-14 15:50:37 +01:00
Dominik Röttsches f57c24db63 Add types required for 'COLR' v1 to public API (#59703).
* include/freetype/freetype.h (FT_PaintFormat, FT_ColorStopIterator,
FT_ColorIndex, FT_ColorStop, FT_PaintExtend, FT_ColorLine,
FT_Affine23, FT_CompositeMode, FT_OpaquePaint, FT_PaintColrLayers,
FT_PaintSolid, FT_PaintLinearGradient, FT_PaintRadialGradient,
FT_PaintGlyph, FT_PaintColrGlyph, FT_PaintTransformed,
FT_PaintTranslate, FT_PaintRotate, FT_PaintSkew, FT_PaintComposite,
FT_COLR_Paint): Adding structs and enum to represent paint format,
color stop information, gradient extend information, structs to
reference paint offsets, and to define transforms and compositions.
Adding a union type to represent the union of the structs,
distinguished by `FT_PaintFormat`.
2021-01-14 15:47:34 +01:00
Werner Lemberg 03ceda9701 * builds/*: s/BUILD_DIR/PLATFORM_DIR/.
The old variable name caused confusion.
2021-01-10 15:34:46 +01:00
Alexei Podtelezhnikov 3431553836 [builds] Revert `FTMODULE_H' changes.
* builds/toplevel.mk, builds/freetype.mk: Revert changes.
2021-01-08 13:22:34 -05:00
Alexei Podtelezhnikov 0901a6f74c Tweak .gitignore. 2021-01-07 19:43:15 -05:00
Alexei Podtelezhnikov 6f24bab68c [builds/windows] Fix up DLG build with VC++.
* builds/windows/vc2010/script.bat: Copy headers to include/.
* builds/windows/vc2010/freetype.vcxproj: Remove DLG paths.
2021-01-07 16:57:13 -05:00
Alexei Podtelezhnikov 576403f22b [builds] Relocate `FTMODULE_H'.
* builds/toplevel.mk: Place `FTMODULE_H' in include/.
* builds/freetype.mk: Simplify included path.
2021-01-07 16:02:32 -05:00
Werner Lemberg cbc14b10e6 Fix ABI incompatibility.
* include/freetype/ftimage.h (FT_Pixel_Mode): Don't insert
`FT_PIXEL_MODE_GRAY16' but append it.

* src/base/ftobjs.c (pixel_modes): Updated.
2021-01-07 10:13:15 +01:00
Werner Lemberg 8afc185433 Fix typos from last commit. 2021-01-07 10:04:24 +01:00
Alexei Podtelezhnikov 6369058eee [dlg] Move the headers to include/dlg to simplify their use.
* autogen.sh, builds/toplevel.mk: Copy headers to incluide/dlg.
* builds/freetype.mk, builds/windows/vc2010/freetype.vcxproj:
Simplify included path.
* include/freetype/internal/ftdebug.h: Simplify #include.
* src/dlg/rules.mk, .gitignore: Updated.
2021-01-07 00:13:23 -05:00
Werner Lemberg f88c00e45a * meson.build: Add summary.
Based on a patch from Vincent Torri <vincent.torri@gmail.com>.
2021-01-06 19:19:29 +01:00
Torsten Hilbrich c6345ca36d * meson.build: Fix 'png' build option (#59458).
Without this patch, 'png' is always required.
2021-01-06 08:55:16 +01:00
Alexei Podtelezhnikov 74f1b6be4a [builds/windows] Add SDF to VC2010 project.
* builds/windows/vc2010/freetype.vcxproj: Updated;
AfterBuild conveniences.
2021-01-04 23:35:01 -05:00
Werner Lemberg c6ff2556c8 [sdf] Use 'counter-clockwise', not 'anti-clockwise'.
We prefer US nomenclature.

* src/sdf/ftsdf.c (SDF_Contour_Orientation):
s/SDF_ORIENTATION-ACW/SDF_ORIENTATION_CCW/.
Update all users.
2020-12-26 10:50:21 +01:00
Werner Lemberg bca740d566 Typo. 2020-12-26 08:55:49 +01:00
Werner Lemberg b6c8542dfc * src/base/ftobjs.c (pixel_modes): Updated. 2020-12-26 08:51:46 +01:00
Anuj Verma 10a5dfec7f [sdf] Remove custom memory tracker.
The internal FreeType memory tracker is sufficient.

* src/sdf/ftsdf.c (FT_DEBUG_INNER, FT_ASSIGNP_INNER, SDF_MemoryUser,
sdf_alloc, sdf_free, SDF_ALLOC, SDF_FREE,
SDF_MEMORY_TRACKER_DECLARE, SDF_MEMORY_TRACKER_SETUP,
SDF_MEMORY_TRACKER_DONE): Removed.

s/SDF_ALLOC/FT_ALLOC/.
s/SDF_FREE/FT_FREE/.

Other updates.
2020-12-26 08:34:38 +01:00
Werner Lemberg a8d3ad3539 .mailmap: Updated and synchronized with 'freetype2-demos' repository. 2020-12-24 08:43:55 +01:00
Werner Lemberg 286e9e0d72 [sdf] Two more copyright notices. 2020-12-24 08:41:12 +01:00
Werner Lemberg 3c983eb84a [sdf] Fix `make multi`.
* src/sdf/ftsdf.c: Include `ftoutln.h`.
2020-12-24 08:36:09 +01:00
Werner Lemberg aa1b5362d3 [sdf] Fix tracing.
* include/freetype/internal.fttrace.h: Add 'bsdf' component.

* src/sdf/ftbsdf.c, src/sdf/ftsdf.c (FT_COMPONENT): Define.
2020-12-24 08:32:04 +01:00
Werner Lemberg 04a6443254 [sdf] Add copyright notices. 2020-12-24 08:29:05 +01:00
Werner Lemberg eb2b5bb107 docs/CHANGES: Mention new SDF module. 2020-12-24 07:44:16 +01:00
Anuj Verma b298a64464 [sdf] Add debugging function.
* src/sdf/ftsdf.c (sdf_shape_dump): New function.
2020-12-24 07:23:48 +01:00
Anuj Verma 6444875f68 [sdf] Add brief technical overview of both rasterizers. 2020-12-24 07:23:48 +01:00
Anuj Verma 6cd6df55c9 [sdf] Add 'bsdf' renderer to 'sdf' module.
* src/sdf/ftsdfrend.c (ft_bsdf_render): New function.

(ft_bitmap_sdf_renderer_class): New structure.
2020-12-24 07:23:48 +01:00
Anuj Verma d27d107f15 [sdf] Add interface functions for the 'bsdf' rasterizer.
* src/sdf/ftsdf.c (bsdf_raster_new, bsdf_raster_reset,
bsdf_raster_set_mode, bsdf_raster_render, bsdf_raster_done): New
functions.

(ft_bitmap_sdf_raster): New variable.

* src/sdf/ftsdf.h: Updated.
2020-12-24 07:23:48 +01:00
Anuj Verma a21134751c [sdf] Add function to copy SDF data into output bitmap.
* src/sdf/ftbsdf.c (finalize_sdf): New function.
2020-12-24 07:23:48 +01:00
Anuj Verma e2ae96b978 [sdf] Add '8-point sequential Euclidean distance mapping' algorithm.
* src/sdf/ftbsdf.c (compare_neighbor, first_pass, second_pass,
edt8): New functions.
2020-12-24 07:23:48 +01:00
Anuj Verma 6b9a8044be [sdf] Add function to copy source bitmap to distance map.
* src/sdf/ftbsdf.c (bsdf_init_distance_map): New function.
2020-12-24 07:23:48 +01:00
Anuj Verma 0f644f38e9 [sdf] Add functions to compute pixel edge distances.
* src/sdf/ftbsdf.c (compute_edge_distance, bsdf_approximate_edge):
New functions.
2020-12-24 07:23:48 +01:00
Anuj Verma c576176461 [sdf] Add function to find edge pixels in a grid of alpha values.
* src/sdf/ftbsdf.c (bsdf_is_edge): New function.
2020-12-24 07:23:48 +01:00
Anuj Verma 9bbb3611b3 [sdf] Add essential structures for the 'bsdf' rasterizer.
* src/sdf/ftbsdf.c (ONE): New macro.
(BSDF_TRaster, ED, BSDF_Worker): New structures.
(zero_ed): New constant.
2020-12-24 07:23:48 +01:00
Anuj Verma c6f394bf7d [sdf] Add 'sdf' module to non-gnumake build systems.
* include/freetype/config/ftmodule.h: Add both the 'sfd' and 'bsfd'
renderers to the list of modules.

* CMakeLists.txt (BASE_SRCS): Add 'sdf' single-object module.
2020-12-24 07:23:48 +01:00
Anuj Verma 05f6088df3 [sdf] Added basic overlapping contour support.
* src/sdf/ftsdf.c (sdf_generate_with_overlaps): New function.
(sdf_raster_render): Enable it.
2020-12-24 07:23:48 +01:00
Anuj Verma 879ca87f0b [sdf] Add build infrastructure.
* src/sdf/module.mk, src/sfd/rules.mk: New files.

* src/sdf/ftsdf.h (ft_sdf_raster): New forward declaration.

* include/freetype/ftmoderr.h (FT_MODERRDEF): Add error definition
for the 'sdf' module.

* include/freetype/internal/fttrace.h (FT_TRACE_DEF): Add trace
definition for the `sdf' module.

* modules.cfg (RASTER_MODULES): Add the `sdf' module to the list of
rasterizers.
2020-12-24 07:23:48 +01:00
Anuj Verma 665ac96792 [sdf] Add interface functions for the 'sdf' rasterizer.
* src/sdf/ftsdf.c (sdf_raster_new, sdf_raster_reset,
sdf_raster_set_mode, sdf_raster_render, sdf_raster_done): New
functions.
(ft_sdf_raster): New structure.
2020-12-24 07:23:48 +01:00
Anuj Verma 1010f2c39c [sdf] Add subdivision and bounding box optimization.
* src/sdf/ftsdf.c (sdf_generate_bounding_box): New function, which
is an optimized version of `sdf_generate`.
(sdf_generate_subdivision): New function.
2020-12-24 07:23:48 +01:00
Anuj Verma 986d3108ac [sdf] Add function to generate SDF.
* src/sdf/ftsdf.c (sdf_generate): New function, currently disabled.
This is a proof-of-concept implementation: It doesn't use any
optimization, it simply checks all grid points against all contours.
2020-12-24 07:23:48 +01:00
Anuj Verma 0d52f4ae0a [sdf] Add functions to get shortest distance from any edge/contour.
* src/sdf/ftsdf.c (sdf_edge_get_min_distance): New function.
(sdf_contour_get_min_distance): New function, currently disabled.
2020-12-24 07:23:48 +01:00
Anuj Verma 81e32986ca [sdf] Add shortest distance finding functions.
* src/sdf/ftsdf.c (get_min_distance_line, get_min_distance_conic,
get_min_distance_cubic): New functions.  Note that
`get_min_distance_conic` comes with two implementations (using an
analytical and an iterative method, to be controlled with the
`USE_NEWTON_FOR_CONIC` macro).
2020-12-24 07:23:48 +01:00
Anuj Verma c918b54f25 [sdf] Add function to resolve corner distances.
* src/sdf/ftsdf.c (resolve_corner): New function.
2020-12-24 07:23:48 +01:00
Anuj Verma a255125fe4 [sdf] Add essential math functions.
* src/sdf/ftsdf.c (cube_root, arc_cos) [!USE_NEWTON_FOR_CONIC]: New
auxiliary functions.

* src/sdf/ftsdf.c (solve_quadratic_equation, solve_cubic_equation)
[!USE_NEWTON_FOR_CONIC]: New functions.
2020-12-24 07:23:48 +01:00
Anuj Verma cd4138458a [sdf] Add utility functions for contours.
* src/sdf/ftsdf.c (get_control_box, get_contour_orientation): New
functions.
(split_conic, split_cubic, split_sdf_conic, split_sdf_cubic,
split_sdf_shape): New functions.
2020-12-24 07:23:47 +01:00
Anuj Verma 2de1b5630d [sdf] Add functions to decompose `FT_Outline`.
* src/sdf/ftsdf.c (sdf_move_to, sdf_line_to, sdf_conic_to,
sdf_cubic_to): New auxiliary decomposition functions.
(sdf_compose_funcs): New structure.
(sdf_outline_decompose): New function.
2020-12-24 07:23:47 +01:00
Anuj Verma cf0464d855 [sdf] Structs, enums, macros, and functions for 'sdf' rasterizer.
* src/sdf/ftsdf.c (FT_DEBUG_INNER, FT_ASSIGNP_INNER)
[FT_DEBUG_LEVEL_TRACE && FT_DEBUG_MEMORY]: New macros.
(SDF_MemoryUser) [FT_DEBUG_LEVEL_TRACE && FT_DEBUG_MEMORY]: New
struct for memory usage tracing.
(sdf_alloc, sdf_free) [FT_DEBUG_LEVEL_TRACE && FT_DEBUG_MEMORY]: New
functions for memory usage tracing.

(SDF_ALLOC, SDF_FREE): New macros for memory management.
(SDF_MEMORY_TRACKER_DECLARE, SDF_MEMORY_TRACKER_SETUP,
SDF_MEMORY_TRACKER_DONE): New macros to set up memory usage tracing.

(USE_NEWTON_FOR_CONIC, MAX_NEWTON_DIVISIONS, MAX_NEWTON_STEPS,
CORNER_CHECK_EPSILON, CG_DIMEN): New configuration macros for
controlling the process of finding the shortest distance.

(MUL_26D6, VEC_26D6_DOT): New auxiliary macros.

(SDF_TRaster, SDF_Edge, SDF_Contour, SDF_Shape, SDF_Signed_Distance,
SDF_Params): New structs for setting up SDF data.
(SDF_Edge_Type, SDF_Contour_Orientation): New enums for SDF data.

(zero_vector, null_edge, null_contour, null_shape, max_sdf): Useful
constants.

(sdf_edge_new, sdf_edge_done, sdf_contour_new, sdf_contour_done,
sdf_shape_new, sdf_shape_done): New constructors and destructors.
2020-12-24 07:23:47 +01:00
Anuj Verma c6ec87ec48 [sdf] Add raster parameters structure.
* src/sdf/ftsdf.h (SDF_Raster_Params): New structure.

* src/sdf/sdf.c: Include source files in order to make a single
object of the module.
2020-12-24 07:23:47 +01:00
Anuj Verma 56d27d32c4 [sdf] Add 'sdf' renderer.
* src/sdf/ftsdf.c: Add 'sdf' renderer along with its interface
functions.
Also add functions to set and get properties.
2020-12-24 07:23:47 +01:00
Anuj Verma 216270327d [sdf] Add common elements for 'sdf' and 'bsdf' renderers.
* src/sdf/ftsdfrend.h (SDF_Rendere_Module, ft_sdf_renderer_class,
ft_bitmap_sdf_renderer_class): New structures.

* src/sdf/ftsdfcommon.h (DEFAULT_SPREAD, MIN_SPREAD_MAX_SPREAD,
USE_SQUARED_DISTANCES): New macros.
(FT_INT_26D6, FT_INT_16D16, FT_26D6_16D16): New macros.
(FT_CALL, VECTOR_LENGTH_16D16): New macros.
(FT_26D6_Vec, FT_16D16_Vec, FT_16D16, FT_26D6, FT_6D10, FT_CBox):
New typedefs.
(square_root): New macro.

* src/sdf/ftsdferrs.h: Add module error setup.
2020-12-24 07:23:47 +01:00
Anuj Verma cd6ff28a17 [sdf] Add files for new 'sdf' module.
Here is a breakdown of what the files will contain.

* src/sdf/ftsdfrend.c, src/sdf/ftsdfrend.h: The 'sdf' and 'bsdf'
renderers.

* src/sdf/ftsdf.c, src/sdf/ftsdf.h: The rasterizer for the 'sdf'
renderer.
* src/sdf/ftbsdf.c, src/sdf/ftbsdf.h: The rasterizer for the 'bsdf'
renderer.

* src/sdf/ftsdfcommon.h: Commmon properties and functions for both
rasterizers.
* src/sdf/ftsdferrs.h: Common error defines.

* src/sdf/sdf.c: For building a single object of the entire module.
2020-12-24 07:23:47 +01:00
Anuj Verma 5a1b9d014b [base] Allow renderers of different formats.
* src/base/ftobjs.c (FT_Render_Glyph_Internal): Do not return if the
glyph's slot format is `FT_GLYPH_FORMAT_BITMAP`.  The forthcoming
'bsdf' renderer will require bitmaps for processing.

* src/base/ftobjs.c (ft_add_renderer, ft_remove_renderer): Remove
renderer's glyph format check before adding and removing them.  The
'bsdf' renderer will have a format `FT_GLYPH_FORMAT_BITMAP`.
2020-12-24 07:23:47 +01:00
Anuj Verma ec9b6c314d Add data types required for the forthcoming 'sdf' module.
* include/freetype/freetype.h (FT_Render_Mode): Add new render mode
`FT_RENDER_MODE_SDF`, which will be used to generate SDF.

* include/freetype/ftimage.h (FT_Pixel_Mode): Add new pixel mode
`FT_PIXEL_MODE_GRAY16`, which will be the output of the 'sdf'
module.
(FT_RASTER_FLAG_SDF): New raster flag to be used internally by the
'sdf' module.

* include/freetype/fttypes.h (FT_F6Dot10): New data type.
2020-12-24 07:23:47 +01:00
Anuj Verma 3b9196c467 [base] Allow renderers of different formats.
* src/base/ftobjs.c (FT_Render_Glyph_Internal): Do not return if the
glyph's slot format is `FT_GLYPH_FORMAT_BITMAP`.  The forthcoming
'bsdf' renderer will require bitmaps for processing.

* src/base/ftobjs.c (ft_add_renderer, ft_remove_renderer): Remove
renderer's glyph format check before adding and removing them.  The
'bsdf' renderer will have a format `FT_GLYPH_FORMAT_BITMAP`.
2020-12-24 07:23:47 +01:00
Werner Lemberg 2373074a2c * builds/windows/detect.mk (COPY): Make it work with `shell`.
Without this patch, we get the error

  builds/toplevel.mk:127: *** missing separator.  Stop.

Reported by Anuj, with a solution from Alexei.
2020-12-23 22:02:48 +01:00
Ignacio Casal Quinteiro 768022b98e meson.build (ft2_defines): Fix builds on Windows. 2020-12-23 11:30:19 +01:00
Tatsuyuki Ishi 0d5f1dd37c [autofit] Fix double division in stem darkening.
The old code used to divide the darkening amount by em_ratio twice,
leading to unnecessarily bold stems on certain fonts with higher
units per em (e.g. Inter). This patch fixes it.

The return value of af_loader_compute_darkening was also changed to
use 16.16 fixed point to get rid of a redundant truncation operation.
This should slightly improve the precision, although it's still
bottlenecked by the emboldening function, which uses 26.6 fixed point.

* src/autofit/afloader.[ch]
(af_loader_compute_darkening): Return FT_Fixed.
(af_loader_embolden_glyph_in_slot): Revise calculations.
2020-12-18 22:10:30 -05:00
Werner Lemberg 7bdf386e75 ftmodapi.h: Replace 0xA0 characters with spaces. 2020-12-17 22:47:05 +01:00
Alexei Podtelezhnikov c948df52e4 * include/freetype/ftmodapi.h (FT_FACE_DRIVER_NAME): New public macro.
The driver name is needed for `FT_Property_Set' and `FT_Property_Get'.
2020-12-17 15:53:51 -05:00
Alexei Podtelezhnikov 84b3616c94 Documentation edits. 2020-12-16 22:07:57 -05:00
Chris Liddell f6be92767d [truetype] Fix incremental metrics (#59503).
* src/truetype/ttgload.c (tt_get_metrics, load_truetype_glyph):
Previously, the code would populate the phantom points before
calling the `get_glyph_metrics` callback.  For formats like PCL XL
format 1, class 2 downloaded fonts (where metrics are removed from
the TTF header), this causes problems when the hinting program uses
the phantom points (misplaced and distorted glyphs) due to the
metrics being unset (all zeros).
(tt_get_metrics_incr_overrides): Renamed to...
(tt_get_metrics_incremental): ... this.  Updated caller

* include/freetype/ftincrem.h: Update the documentation to make it
clearer that `get_glyph_metrics` is to retrieve metrics from a
non-standard source, but *not* for the purpose of imposing custom
metrics.
2020-12-16 06:08:54 +01:00
Alexei Podtelezhnikov 9cc89717be Documentation edits. 2020-12-15 22:36:19 -05:00
Werner Lemberg a3edbfa983 [type42] Pacify static analysis tools (#59682).
* src/type42/t42objs.c (T42_Size_Init, T42_GlyphSlot_Init): Avoid
warnings about uninitialized variables.
2020-12-14 16:11:06 +01:00
Werner Lemberg bd6d8e4204 .mailmap: Add Priyesh. 2020-12-10 20:23:12 +01:00
Werner Lemberg 505943a6a4 * builds/unix/configure.raw: Don't set `FT_DEBUG_LOGGING`.
All debug options are handled exclusively in `ftoption.h`.
2020-12-07 17:08:37 +01:00
Werner Lemberg 272ae5ee2a * src/*: More fixes for using a '\n' in `FT_TRACE` and `FT_ERROR`. 2020-12-07 10:29:24 +01:00
Werner Lemberg 015a9b8d8f */*: s/FT_LOGGING/FT_DEBUG_LOGGING/. 2020-12-07 10:27:42 +01:00
Werner Lemberg 9f94d8533c docs/CHANGES: Mention `FT_LOGGING`. 2020-12-05 09:43:45 +01:00
Werner Lemberg 7d3ab6a7db * builds/toplevel.mk (do-dist): Remove `submodules` directory. 2020-12-05 09:43:45 +01:00
Werner Lemberg a6adb25626 * src/*: Don't use more than one '\n' in `FT_TRACE` and `FT_ERROR`.
This ensures good logging output, with all lines having a proper
prefix (if requested).
2020-12-05 09:43:45 +01:00
Werner Lemberg 74822f64b0 [base] Don't close 'stderr' after logging.
* src/base/ftdebug.c, builds/windows/ftdebug.c (ft_logging_deinit):
Fix it.
2020-12-05 09:43:45 +01:00
Werner Lemberg c764686bc9 * submodules/dlg: Updated to commit 9f0c8b22. 2020-12-05 09:43:45 +01:00
Werner Lemberg 92db149e9c * src/bdf/bdflib.c: Fix `-Wformat` warning. 2020-12-05 09:43:45 +01:00
Werner Lemberg f6b0fd7b79 Improve setup for 'dlg' library.
* autogen.sh (copy_submodule_file), builds/toplevel.mk: Redirect
stderr to `/dev/null`.

* builds/toplevel.mk: Move code block to handle 'dlg' stuff into
`check_platform` conditional.
Also fix wildcard expressions for guarding `git submodule` commands.
Also make file copying work with non-Unix platforms (untested).
2020-12-05 09:43:45 +01:00
Werner Lemberg fcdab61ed1 [build] Use gcc (and clang) in C99 mode.
Other compilers are unchanged.

* builds/compiler/gcc-dev.mk, builds/compiler/gcc.mk (ANSIFLAGS):
s/-ansi/-std=c99/.

* builds/freetype.mk (FT_CFLAGS): Remove `-std=c99`.

* builds/unix/configure.raw: Handle C99.
Remove no longer needed test for gcc 4.6 and earlier.
2020-12-05 09:43:42 +01:00
Werner Lemberg 741a690ad6 Update `.gitignore`. 2020-12-04 16:19:42 +01:00
Werner Lemberg 1c229af2d2 [dlg] Fix compiler warnings.
* src/dlg/dlgwrap.c: Duplicate some feature test macros from
`dlg.c`, which must come first before loading standard headers.  For
example, `freetype.h` loads `stdio.h` if compiled in debug mode.
2020-12-04 16:19:42 +01:00
Werner Lemberg 047f295fac Typos. 2020-12-04 16:19:42 +01:00
Werner Lemberg 7691588098 * src/type42/t42parse.c: Fix `-Wformat` warnings. 2020-12-04 16:19:42 +01:00
Priyesh Kumar 33bd25ca07 [builds/unix] Check for 'pthread' library.
* builds/unix/ax_pthread.m4: New file, taken from 'autoconf-archive'
git repository.

* builds/unix/configure.raw: Check for 'pthread'; also check whether
it works.
2020-12-04 16:19:42 +01:00
Werner Lemberg ce43d808dc [base] Implement vertical alignment of log printing.
Based on a patch by Priyesh.

* include/freetype/internal/fttrace.h (FT_MAX_TRACE_LEVEL_LENGTH):
New macro.

* src/base/ftdebug.c, builds/windows/ftdebug.c (ft_log_handler):
Print logs after a fixed width to handle different lengths of
`FT_COMPONENT` entries.
Use `ft_strrchr` to check for final newline character.
2020-12-04 16:19:42 +01:00
Priyesh Kumar ab0ea068ee Update logging related documentation.
* docs/DEBUG: Updates related to `FT_LOGGING`.

* README.git: Updates related to logging.
2020-12-04 16:19:42 +01:00
Priyesh Kumar 6d9e6b21e5 * src/*: Fix `-Wformat` warnings. 2020-12-04 16:19:42 +01:00
Priyesh Kumar 2a5d8e8ff8 [builds/windows] Changes to build 'dlg' with FreeType on Windows.
We only support Visual C++ 2010 and newer.

* builds/windows/vc2010/script.bat: New windows batch file to copy
necessary 'dlg' files from `submodules/dlg` to `src/dlg`.  This file
is used as a pre-built event in Visual C++.

* builds/windows/ftdebug.c: Synchronize with `src/base/ftdebug.c`.

* builds/windows/vc2010/freetype.vcxproj.filters: Add
`src/dlgwrap.c`.

* builds/windows/vc2010/freetype.vcxproj
(AdditionalIncludeDirectories): Add include files of dlg for 'Debug'
and 'Debug Static' configurations on both 'x64' and 'win32'
platforms.
(PreprocessorDefinitions): Add `FT_LOGGING` for 'Debug' and 'Debug
Static' configurations on both 'x64' and 'win32' platforms.
Add `DLG_STATIC' for 'Debug' configuration on 'x64' and 'win32'
platforms.
(DisableLanguageExtensions): We need to disable the `/Za` option
when building 'dlg' with FreeType as 'dlg' strictly follows the C99
standard.  Visual C++ produces behaves unexpectedly when
compiling a C99 file with `/Za` option enabled.
2020-12-04 16:19:42 +01:00
Priyesh Kumar 2a46d1f04e [base] Add public API to change log handling function.
* include/freetype/ftlogging.h (FT_Custom_Log_Handler): New function
typedef to store the custom callback logging function.
(FT_Set_Log_Handler, FT_Set_Default_Log_Handler): New functions to
set and reset custom log handler.

* include/freetype/internal/ftdebug.h (custom_output_handler): New
variable to support a custom callback logging function.
(FT_Logging_Callback): A new function typedef to print log using
custom callback logging function, which is set using
`FT_Set_Log_Handler`.
(FT_Log): Use it.

* src/base/ftdebug.c (FT_Set_Log_Handler,
FT_Set_Default_Log_Handler, FT_Logging_Callback): Add function
definitions.
2020-12-04 16:19:36 +01:00
Priyesh Kumar 5fea76cf0f [base] Add public API to change the levels of tracing components.
* include/freetype/ftlogging.h: New header file.

* include/freetype/internal/ftdebug.h [FT_LOGGING]: Include
`ftlogging.h`.

* src/base/ftdebug.c (ft_custom_trace_level): New variable.
(ft_debug_init): Update to support change of levels of tracing
components of FreeType at run-time.
(FT_Trace_Set_Level): New function to change the levels of tracing
components at run-time.
(FT_Trace_Set_Default_Level): New function to reset the levels of
tracing components back to default.
2020-12-01 09:25:53 +01:00
Priyesh Kumar d00cbc3f90 [base] Updates to print timestamp and name of `FT_COMPONENT` in logs.
* include/freetype/internal/ftdebug.h (FT_LOGGING_TAG,
FT_LOGGING_TAG_): New macros to resolve the value of `FT_COMPONENT'
into a string.
(ft_add_tag, ft_remove_tag): New functions to add and remove dlg tags.

* src/base/ftdebug.c: Add new variables to control the logging of
timestamp and name of `FT_COMPONENT` along with actual logs.
(ft_add_tag, ft_remove_tag): Add function definitions.
(ft_log_handler): Updates to print timestamp and name of
`FT_COMPONENT`.
(ft_debug_init) [FT_LOGGING]: Users can now control the logging of
timestamp and name of `FT_COMPONENT` by adding tags in the
`FT2_DEBUG` environment variable.
2020-12-01 09:25:53 +01:00
Priyesh Kumar d46bada285 [base] Add functions and variables to print logs to a file.
* include/freetype/internal/ftdebug.h: Added dlg's header files.
(FT_LOG): New macro to redirect trace logs to dlg's API's whenever
`FT_LOGGING' is defined.
(ft_logging_init, ft_logging_deinit): New functions to handle
initialization and uninitialization of logging related variables.
(ft_log_handler): New function to handle logs of FreeType.

* src/base/ftdebug.c: Add necessary logging related variables.
(ft_logging_init, ft_logging_deinit, ft_log_handler): Add function
definitions.

* src/base/ftinit.c (FT_Init_FreeType) [FT_LOGGING]: Call
`ft_logging_init`.
(FT_Done_FreeType) [FT_LOGGING]: Call `ft_logging_deinit`.

* src/base/ftobjs.c (FT_New_Library): Call `ft_debug_init` only if
`FT_LOGGING` is not defined.
2020-12-01 09:25:39 +01:00
Priyesh Kumar 34b1c897c1 [builds] Necessary changes to make 'dlg' compile.
* autogen.sh (copy_submodule_files): New script to copy all the
necessary source and include files from `submodules/dlg` to
`src/dlg`.

* src/dlg/dlgwrap.c: New wrapper file for `src/dlg.c`.  It enables
the build of 'dlg' if the `FT_LOGGING` macro is defined.

* src/dlg/rules.mk: New sub-Makefile.

* builds/freetype.mk (DLG_DIR): New variable to include the
header files of the 'dlg' library.
(INCLUDES): Add `DLG_DIR`.
(FT_CFLAGS): Add `-std=c99' flag.
Include `src/dlg/rules.mk` file to build 'dlg' library.
(OBJ_S, OBJ_M): Add `DLG_OBJS_M` and `DLG_OBJS_S`.

* builds/toplevel.mk: For builds directly from the git repository
we need to copy files from `submodule/dlg` to `src/dlg`.

* include/freetype/config/ftoption.h, devel/ftoption.h (FT_LOGGING):
New macro to enable or disable the logging facility in FreeType.
2020-12-01 09:20:32 +01:00
Priyesh Kumar 8da4b437b4 * .gitmodules: Add 'dlg' library's git repository as submodule. 2020-12-01 09:20:32 +01:00
Werner Lemberg 8cc4d0dc32 * src/tools/chktrcmp.py (trace_use_pat): Update to current use. 2020-12-01 08:48:28 +01:00
Werner Lemberg 56c610b145 builds/meson/*: Add copyright boilerplate. 2020-11-27 15:37:41 +01:00
Werner Lemberg 3facafa44e .mailmap: Updated and sorted. 2020-11-25 11:37:09 +01:00
Alexei Podtelezhnikov 5abd252a0a [cff,cid,type1] Demote old engine for lack of CFF2.
* src/cff/cffobjs.c (cff_iriver_init): Always default to Adobe engine.
* src/cid/cidobjs.c (cid_driver_init): Ditto.
* src/type1/t1objs.c (T1_Driver_Init): Ditto.
2020-11-20 15:24:42 -05:00
Alexei Podtelezhnikov 1286f58c29 Downgrade property tracing. 2020-11-20 14:54:35 -05:00
Werner Lemberg 32b14552d6 * src/type42/t42parse.c (t42_parse_sfnts): More tracing messages. 2020-11-09 21:00:45 +01:00
Werner Lemberg 26e2a89598 * meson.build: Fix .pc file generation.
For backwards compatibility we need the libtool version, not the .so
number.

Reported by Nikolaus.
2020-11-04 21:00:22 +01:00
Werner Lemberg 0bd50c9043 Typo. 2020-11-04 10:16:18 +01:00
Werner Lemberg 5d91600904 docs/CHANGES: Updated. 2020-11-04 09:46:14 +01:00
Jan Alexander Steffens (heftig) 22bb0660a3 Fix documentation build.
The empty line after `* @description:` caused the refdoc build to fail,
see

  https://github.com/freetype/docwriter/issues/77
2020-11-03 22:36:29 +01:00
Alexei Podtelezhnikov b049cadeb1 Mention external modules. 2020-11-02 14:26:44 -05:00
Werner Lemberg 6fca2e5b1b Minor clean-ups of last commit. 2020-10-31 06:52:18 +01:00
Alexei Podtelezhnikov 681c7e2387 Better scan converter documentation. 2020-10-30 23:03:12 -04:00
Alexei Podtelezhnikov 5cbd052dfb Add preamble. 2020-10-30 13:53:17 -04:00
Werner Lemberg e9a7015ec8 Avoid non-ASCII character in public header file. 2020-10-30 08:29:38 +01:00
Werner Lemberg 101e62a286 ftimage.h: Improve description of `FT_Span`.
From Piotr Grochowski <piotrunio-2004@wp.pl>.
2020-10-30 08:07:53 +01:00
Werner Lemberg 804e625def [truetype] Minor update to forthcoming OpenType 1.8.4 standard.
* src/truetype/ttgxvar.c (ft_var_load_item_variation_store): Limit
size of `regionCount`.
2020-10-28 13:34:52 +01:00
Werner Lemberg 40c5681ab9 * meson.build: Fix 'harfbuzz' and 'brotli' build options (#59347).
Without this patch, 'harfbuzz' and 'brotli' are always required.

Patch submitted anonymously in Savannah bug report.
2020-10-26 18:09:56 +01:00
Ben Wagner 007c109b45 * src/sfnt/pngshim.c (Load_SBit_Png): Fix memory leak (#59322).
The issue is that `rows` is allocated but will not be freed in the
event that the call to `png_read_image` fails and calls `longjmp`.
2020-10-23 08:32:30 +02:00
Werner Lemberg 6a2b3e4007 * Version 2.10.4 released.
==========================

Tag sources with `VER-2-10-4'.

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

* README, src/base/ftver.rc, builds/windows/vc2010/index.html,
builds/windows/visualc/index.html,
builds/windows/visualce/index.html,
builds/wince/vc2005-ce/index.html,
builds/wince/vc2008-ce/index.html, docs/freetype-config.1:
s/2.10.3/2.10.4/, s/2103/2104/.

* include/freetype/freetype.h (FREETYPE_PATCH): Set to 4.

* builds/unix/configure.raw (version_info): Set to 23:4:17.
* CMakeLists.txt (VERSION_PATCH): Set to 4.
2020-10-20 07:13:33 +02:00
Werner Lemberg a3bab162b2 [sfnt] Fix heap buffer overflow (#59308).
This is CVE-2020-15999.

* src/sfnt/pngshim.c (Load_SBit_Png): Test bitmap size earlier.
2020-10-19 23:45:28 +02:00
Alexei Podtelezhnikov 840ce58f94 * src/sfnt/tt{colr,cpal}.c: Fix signedness warnings from VC++. 2020-10-18 07:36:57 -04:00
Alexei Podtelezhnikov a93f50b611 * src/sfnt/sfwoff2.c (Read255UShort): Tweak types to please VC++. 2020-10-17 21:58:50 -04:00
Alexei Podtelezhnikov 82d331556c Unnest markdown. 2020-10-11 21:56:50 -04:00
Werner Lemberg 337670af0a * Version 2.10.3 released.
==========================

Tag sources with `VER-2-10-3'.

* docs/VERSION.TXT: Add entry for version 2.10.3.

* README, src/base/ftver.rc, builds/windows/vc2010/index.html,
builds/windows/visualc/index.html,
builds/windows/visualce/index.html,
builds/wince/vc2005-ce/index.html,
builds/wince/vc2008-ce/index.html, docs/freetype-config.1:
s/2.10.2/2.10.3/, s/2102/2103/.

* include/freetype/freetype.h (FREETYPE_PATCH): Set to 3.

* builds/unix/configure.raw (version_info): Set to 23:3:17.
* CMakeLists.txt (VERSION_PATCH): Set to 3.
2020-10-10 18:14:57 +02:00
Werner Lemberg c9f588be56 Document changes to last release. 2020-10-10 12:48:18 +02:00
Werner Lemberg 40479fad93 [autofit] Synchronize with ttfautohint.
This corresponds to the following commits in the ttfautohint git
repository:

  bb6842bd3bd437b7b4a7921b0376c860f5e73d18  Typo, formatting.
  d5c91ddb1cb310257a3dfe9a8e20e1fc51335faa  Add Medefaidrin script.

* src/autofit/afblue.dat: Add blue zone data for Medefaidrin.
* src/autofit/afblue.c, src/autofit/afblue.h: Regenerated.

* src/autofit/afscript.h: Add Medefaidrin standard characters.

* src/autofit/afranges.c, src/autofit/afstyles.h: Add Medefaidrin
data.
2020-09-25 17:44:00 +02:00
Werner Lemberg e8ee98e669 Move `scripts/make_distribution_archives.py` to `src/tools`.
* scr/tools/scripts/make_distribution_archives.py: (_TOP_DIR,
_SCRIPT_DIR): Updated to new location.
(main): s/shutils.copyfile/shutils.copy/ to preserve file
permissions.
(main): Prefix source file paths with `git_dir` while copying files
to allow calls of the script from other places than the top-level
directory.
2020-09-25 08:07:43 +02:00
Werner Lemberg 4f13a43ab3 * src/cff/cffgload.c (cff_slot_load): Scale `vertBearingY`.
Towards the end of the the function there is a call to
`FT_Outline_Get_CBox` that retrieves the glyph bbox in scaled units.
That sets `horiBearing{X,Y}` and `vertBearingX` but `vertBearingY`
is left alone, and is not scaled.

Patch from Eric Muller <emuller@amazon.com>.
2020-09-24 09:35:24 +02:00
Werner Lemberg bed960d948 * src/base/ftobjs.c (FT_Load_Glyph): Trace glyph metrics. 2020-09-24 09:31:56 +02:00
Werner Lemberg 3ce0df52e2 [meson] Move auxiliary scripts to `builds/meson`.
Suggested by Alexei.

* scripts/*.py: Move meson scripts to...
* builds/meson/*.py: ... this new location.

* meson.build: Updated.
2020-09-22 20:05:37 +02:00
David Turner d686f2ff9c Add python script for building tarballs.
* scripts/make_distribution_archives.py: New file.

This standalone Python script should be equivalent to running `make
dist` with the Make-based build system, with the following minor
differences:

- Since `make distclean` doesn't always clean up `objs/` properly,
  `make dist` archives may contain some stale binaries like
  `objs/.libs/libfreetype.so.6` or others.

- `config.guess` and `config.sub` are not updated unless option
  `--gnu-config-dir=DIR` is used to specify the location of these
  files.

- Some bits of the auto-generated reference documentation may
  appear in slightly different order, probably due to issues related
  to mkdocs and docwriter.

As an example, the call

  scripts/make_distribution_archives.py /tmp/freetype2-dist

creates the following files under `/tmp/freetype2-dist`:

  freetype-<version>.tar.gz
  freetype-<version>.tar.xz
  ft<winversion>.zip
2020-09-21 09:27:51 +02:00
Werner Lemberg 46417607e6 * scripts/extract_freetype_version.py: Fix regex typos. 2020-09-21 09:21:46 +02:00
David Turner 66978a5887 Add Meson build project file.
Example usage:

  # Configure Meson build in directory `build-meson` to generate
  # release binaries comparable to to the ones from the
  # autotools/make build system.
  meson setup build-meson \
        --prefix=/usr/local \
        --buildtype=debugoptimized \
        --strip \
        -Db_ndebug=true

  # After configuring the Meson build with the above command,
  # compile and install to `/usr/local/`; this includes a pkg-config
  # file.
  ninja -C build-meson install

  # Alternatively, compile and install to `/tmp/aa/usr/local/...`
  # for packaging.
  DESTDIR=/tmp/aa ninja -C build-meson install

  # Generate documentation under `build-meson/docs`.
  ninja -C build-meson docs

Library size comparison for stripped `libfreetype.so` generated by
all three build systems:

  - Default build (autotools + libtool): 712 KiB
  - CMake build (RelWithDebInfo):        712 KiB
  - Meson build:                         712 KiB

* meson.build: New top-level Meson build file for the library.

* meson_options.txt: New file.  It holds user-selectable options for
the build, which can be printed with `meson configure`, and selected
at `meson setup` or `meson --reconfigure` time with
`-D<option>=<value>`.

* scripts/parse_modules_cfg.py: A script invoked by `meson.build` to
parse `modules.cfg` and extract important information out of it
(i.e., the list of modules).

* scripts/process_ftoption_h.py: New script invoked by `meson.build`
to process the original `ftoption.h` file.  It enables or disables
configuration macro variables based on the available dependencies.
This is similar to what other build systems are using (i.e., Meson's
`configure_file()` command is not used here).

* scripts/extract_freetype_version.py: New script invoked by
`meson.build` to extract the FreeType version number from
`<freetype/freetype.h>`.

* scripts/extract_libtool_version.py: New script invoked by
`meson.build` to extract the libtool `revision_info` data from
`builds/unix/configure.raw`, and to generate the corresponding
shared library suffix.

* scripts/generate_reference_docs.py: New script invoked by
`meson.build` to generate the FreeType 2 reference documentation
(using the `docwriter` and `mkdocs` packages, which must be already
installed).
2020-09-21 07:53:02 +02:00
Alexei Podtelezhnikov ab6a21b733 Documentation updates. 2020-09-18 22:32:20 -04:00
Alexei Podtelezhnikov 20186d1be6 [raster] Improve the second pass (#58373).
Besides dropout control the second horizontal sweep is supposed to
clean up straight horizontal edges that are mishandled by the first
vertical sweep when a line passes through pixel centers.  This line
would present as perfectly aligned span edges in the second sweep.

* src/raster/ftraster.c (Horizontal_Sweep_Span): Replace the old
implementation with a better one focusing on aligned span edges only.
2020-09-11 23:47:54 -04:00
Alexei Podtelezhnikov c3721642f1 [raster] Tune SMART macro (#58352).
Windows seems to perform smart dropout control at 26.6 precision.
To mimick Windows independent of increased precision, we need to tweak
the macro so that some close calls break down rather than up.

* src/raster/ftraster.c (SMART): Tweak the macro.
2020-09-11 23:13:02 -04:00
Alexei Podtelezhnikov cb47331369 [raster] Introduce SMART macro.
* src/raster/ftraster.c (SMART): New macro for smart dropout rounding.
(Verstical_Sweep_Drop, Horizontal_Sweep_Drop): Use it.
2020-09-08 22:41:53 -04:00
Alexei Podtelezhnikov 3594eaee59 [raster] Improve tracing. 2020-09-08 22:20:11 -04:00
Nikolaus Waxweiler fa82803f46 * ChangeLog: Add entry for last commit. 2020-09-03 11:11:41 +01:00
Boris Dalstein 69353a19a1 Export version info (#58935) 2020-09-03 10:57:50 +01:00
Alexei Podtelezhnikov 600d59e343 [truetype] Reduce Infinality footprint (cont'd).
* src/truetype/ttinterp.c (Ins_DELTAP): Shrink variable scope.
(Ins_SHPIX, Ins_MIRP): Revise if-logic.
2020-09-02 15:48:03 -04:00
Alexei Podtelezhnikov 51a5e3389c [truetype] Reduce Infinality footprint.
* src/truetype/ttinterp.c (Ins_SHPIX, Ins_MSIRP, Ins_MIAP, Ins_MDRP,
Ins_MIRP): Shrink variable scopes and consolidate ifdefs.
2020-09-02 00:02:28 -04:00
Alexei Podtelezhnikov e6c7e4b42b [truetype] Refactor compensation color.
* src/truetype/ttinterp.h (TT_Round_Func): Change the last argument.
* src/truetype/ttinterp.c (Ins_ROUND, Ins_NROUND, Ins_MDAP, Ins_MIAP,
Ins_MDRP, Ins_MIRP): Move compensation retrieval from here...
(Round_*): ... to here.
* src/truetype/ttobjs.c (tt_size_init_bytecode): Reserve zero
compensation at color index 3.
2020-09-01 21:49:52 -04:00
Alexei Podtelezhnikov 16ee2a22ab [smooth] Don't set target in direct mode.
* src/smooth/ftsmooth.c (ft_smooth_raster_overlap): Remove assignment.
(ft_smooth_raster_lcd) [!FT_CONFIG_OPTION_SUBPIXEL_RENDERING]: Ditto.
2020-08-28 23:08:42 -04:00
Alexei Podtelezhnikov d8228a0070 Improve FT_Outline_Render docs. 2020-08-28 22:28:47 -04:00
Alexei Podtelezhnikov 6730854c39 * src/smooth/ftsmooth.c (ft_smooth_raster_overlap): Limit width.
Segmentation fault reported as

  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=24729
2020-08-25 23:16:27 -04:00
Werner Lemberg cdc009c24a * src/truetype/ttgload.c (TT_Get_VMetrics): Add tracing message. 2020-08-22 13:30:11 +02:00
Alexei Podtelezhnikov f9f6adb625 [truetype] Retain OVERLAP_SIMPLE and OVERLAP_COMPOUND.
For glyphs with OVERLAP_SIMPLE or OVERLAP_COMPOUND, set
FT_OUTLINE_OVERLAP to render them with direct oversampling, which
mitigates artifacts (see 3bb512bc9f).

* include/freetype/ftimage.h (FT_OUTLINE_OVERLAP): Redefine to rhyme
with OVERLAP_SIMPLE.
* src/base/ftgloadr.c (FT_GlyphLoader_Rewind): Reset outline flags.
* src/truetype/ttgload.c
(TT_Load_Simple_Glyph): Retain OVERLAP_SIMPLE.
(load_truetype_glyph): Retain OVERLAP_COMPOUND.
2020-08-05 08:24:15 -04:00
Alexei Podtelezhnikov 3a1f4b7aaa * src/truetype/ttgload.c (TT_Load_Glyph): More tracing. 2020-08-04 22:17:05 -04:00
Werner Lemberg 8b3601324f Minor typos, formatting. 2020-08-04 10:48:42 +02:00
Alexei Podtelezhnikov 986a340dd5 Unbreak compilation. 2020-07-28 23:20:59 -04:00
Alexei Podtelezhnikov f76f7fdecd Hide internal functions with SunPro.
* include/freetype/internal/compiler-macros.h
(FT_INTERNAL_FUNCTION_ATTRIBUTE) <__SUNPRO_C>: Define as __hidden.
2020-07-28 23:13:51 -04:00
Anuj Verma 3273521f40 Fix static compilation with Visual C.
* include/freetype/internal/compiler-macros.h
(FT_INTERNAL_FUNCTION_ATTRIBUTE) <_WIN32>: Define as empty.
2020-07-28 18:34:37 +02:00
Werner Lemberg fffc303a7f Formatting, improving comments. 2020-07-28 18:33:15 +02:00
Priyesh Kumar 53be1753de Fix `-Wformat' compiler warnings.
* src/*: Fix format specifiers.

* builds/unix/ftsystem.c (FT_Stream_Open): Ditto.
2020-07-28 07:33:40 +02:00
Werner Lemberg 8cfc41ae95 Fix `-Wformat' compiler warnings.
Problem reported by Priyesh kumar <priyeshkkumar@gmail.com>

* src/base/ftoutln.c (FT_Outline_Decompose): Fix number of arguments
to tracing macro.

* src/bdf/bdfdrivr.c (bdf_cmap_char_next, bdf_get_bdf_property):
Ditto.

* src/cache/ftcbasic.c (ftc_basic_family_get_count): Ditto.
Reformulate message.

* src/pcf/pcfdrivr.c (pcf_get_bdf_property): Ditto.

* src/sfnt/sfwoff2.c (woff2_open_font): Ditto.
Trace table offset, too.

* src/truetype/ttgxvar.c (ft_var_apply_tuple): Ditto.
2020-07-25 12:23:22 +02:00
Werner Lemberg b6183ea369 * src/sfnt/sfwoff2.c (woff2_decompress): Fix compiler warning.
Reported by Hin-Tak.
2020-07-23 13:03:22 +02:00
David Turner ee19a6cbbc Add .clang-format file
This file can be used to reformat FreeType sources and commits
using one of these methods:

- Direct formatting of a whole file:

    clang-format -i path/to/file

  For example, to reformat all sources at once:

    echo builds/unix/ftconfig.h.in $(git ls-files *.[hc]) | xargs clang-format -i

- Only reformat the changed lines in the current work directoy:

    git clang-format

The style settings in this file are very close to the FreeType
formatting style, with the following exceptions which are not supported
here:

- Mminimal 2-space margin on each non-empty line.
  (no left margin instead).

- 2 empty lines between variable declarations and statements in C blocks.
  (only 1 is kept).

    {
      int  x = ...;

      foo(x);
    }

  becomes

    {
      int x = ...;

      foo(x);
    }

- Aignment of declarations uses 2 spaces to separate types and variable
  names (only 1 space is kept).

     int  x;    =>   int x;
     int  y;         int y;

- The start used for output parameters in function signature should be
  near the variable name (always near the type).

    void foo(int* input_ptr, int *output_ptr)
      => void foo(int* input_ptr, int* output_ptr)
2020-07-16 15:51:06 +02:00
Werner Lemberg b7c467b6ef [doc] Stem darkening is off by default for CFF driver.
Bug reported by Ishi Tatsuyuki <ishitatsuyuki@gmail.com>.
2020-07-15 09:15:25 +02:00
David Turner 5fe7c044c2 freetype.h (FT_Set_Transform): Minor documentation update.
In order to mention the limited accuracy of `FT_Matrix' coefficients
and encourage client code to perform the transform themselves with
floating point values instead.
2020-07-14 16:25:59 +02:00
Werner Lemberg 95de21ab19 README: Add information on contributing patches. 2020-07-14 08:32:45 +02:00
Werner Lemberg c922ffa5d2 * builds/unix/configure.raw: Fix inclusion of `ftoption.h'. 2020-07-12 07:52:55 +02:00
Ben Wagner b1286b32a9 Document `FT_Face_Rec_::box' with variable fonts (#54969).
As pointed out in the "Note:" in the section of

  https://docs.microsoft.com/en-us/typography/opentype/spec/otvaroverview#variation-data-tables-and-miscellaneous-requirements

  ... the xMin, yMin, xMax, yMax, macStyle and lowestRecPPEM fields in
  the font header ('head') table are not supported by variation data and
  should only be used in relation to the default instance for the font.

Document that `FT_Face_Rec_::box' does not vary with OpenType variable
fonts.
2020-07-10 18:07:11 +02:00
Werner Lemberg 96fb73efd5 Fix clang warnings.
* include/freetype/internal/autohint.h
(FT_DECLARE_AUTOHINTER_INTERFACE): New macro.
* src/autofit/afmodule.h: Use it to declare
`af_autofitter_interface'.

* include/freetype/internal/ftobjs.h (FT_DECLARE_GLYPH): New macro.
* src/base/ftbase.h: Use it to declare `ft_bitmap_glyph_class' and
`ft_outline_glyph_class'.

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

* src/cff/cffparse.c (cff_parser_run): Fix type of `t2_size'.

* src/pcf/pcfdrivr.c (pcf_cmap_char_next): Fix type of `result'.

* src/psaux/psauxmod.c (psaux_module_class): Use `FT_DEFINE_MODULE'.
* src/psaux/psauxmod.h: Declare `afm_parser_funcs',
`t1_cmap_classes', `cff_decoder_funcs', and `psaux_module_class'.

* src/pshinter/pshmod.c: Include `pshmod.h'.

* src/sfnt/sfwoff2.c (ROUND4, WRITE_SHORT): Fix implicit sign
conversion.
(compute_ULong_sum): Fix return type.
Fix implicit sign conversion.
(store_points): Fix type of `last_flag', `repeat_count', and `flag'.
Use casts to avoid warnings.
(reconstruct_glyf): Fix implicit sign conversion.
Use cast to avoid warning.
(get_x_mins): Fix implicit sign conversion.
* src/sfnt/ttcmap.c: Undef `TTCMAPCITEM'.
* src/sfnt/ttcmap.h: Define `TTCMAPCITEM' and include `ttcmapc.h' to
declare cmap classes.

* src/smooth/ftsmooth.c (ft_smooth_overlap_spans): Use cast.

* src/truetype/ttinterp.c (Ins_MIAP): Fix typo.
2020-07-07 16:58:14 +02:00
David Turner 0f35b042e0 [build] Really fix multi and C++ builds.
The following builds were still failing due to previous changes:

  make multi
  make multi CC="c++"
  make CC="c++"

This patch fixes the issues, which were missing includes to get the
right macro definitions in multi-build mode.

Also, `FT_UNUSED' is actually used by third-party code, so move it
back to `public-macros.h' to avoid breaking it.

* include/freetype/config/public-macros.h (FT_EXPORT): Remove
special definition for C++.
(FT_UNUSED): Define here instead of...
* include/freetype/config/compiler-macros.h: ... here.
(FT_FUNCTION_DECLARATION): Remove special definition for C++.
(FT_LOCAL_ARRAY_DEF): Fix definition.

* src/cache/ftccback.h, src/lzw/ftzopen.h, src/gxvalid/gxvmort.h,
src/gxvalid/gxvmorx.h: Add `FT_BEGIN_HEADER' and `FT_END_HEADER'.
2020-07-07 06:51:09 +02:00
David Turner cb4a943bc4 [build] Fix multi and C++ builds.
The following builds were failing due to previous changes:

  make multi
  make multi CC="c++"

* include/freetype/config/ftconfig.h: Remove `FT_END_HEADER'.

* include/freetype/config/ftheader.h (FT_BEGIN_HEADER,
FT_END_HEADER): Protect against redefinition.

* src/cache/ftccache.h, src/cache/ftcmru.h, src/pcf/pcfutil.h,
src/psaux/pserror.h, src/psaux/psft.h, src/psaux/psstack.h,
src/sfnt/woff2tags.h: Include `compiler-macros.h'.

* src/sfnt/woff2tags.c: Include `woff2tags.h'.
2020-07-06 11:49:00 +02:00
Werner Lemberg 2eb8f88626 [psaux] Improve `t1_decoder_parse_metrics' (#58646).
* src/psaux/t1decode.c (t1_decoder_parse_metrics): Copy
corresponding code from old engine's `t1_decoder_parse_charstrings'
function to handle `op_callsubr' and `op_return'.
2020-07-06 09:21:03 +02:00
David Turner b0667d2d36 [build] Improve visibility support of library function names.
* include/freetype/config/public-macros.h
(FT_PUBLIC_FUNCTION_ATTRIBUTE): New macro to tag functions as
public (and thus exportable).
(FT_EXPORT): Use it.

* include/freetype/config/compiler-macros.h
(FT_INTERNAL_FUNCTION_ATTRIBUTE): New macro to tag functions as
internal to the library (and thus hidden).  Note that on ELF
systems, all internal functions have hidden visibility, which avoids
the need to enforce this when invoking the compiler (e.g., with an
option like `-fvisibility=hidden').

(FT_FUNCTION_DECLARATION, FT_FUNCTION_DEFINITION): New base macros
to deal with C and C++ linkage issues at the same time.

(FT_LOCAL, FT_LOCAL_DEF, FT_LOCAL_ARRAY, FT_LOCAL_ARRAY_DEF,
FT_BASE, FT_BASE_DEF, FT_EXPORT_VAR, FT_BASE_CALLBACK,
FT_BASE_CALLBACK_DEF): Redefined using new macros.
2020-07-05 11:03:23 +02:00
David Turner bb66c8d8cf [build] Split off more stuff from `ftconfig.h'.
* builds/unix/ftconfig.h.in, builds/vms/ftconfig.h,
include/freetype/config/ftconfig.h: Split off macro definitions
required by the FreeType API headers to...
* include/freetype/config/public-macros.h: ...this new file.

* builds/unix/ftconfig.h.in, builds/vms/ftconfig.h,
include/freetype/config/ftconfig.h: Split off macro definitions used
by the library but not to be exposed to clients to...
* include/freetype/config/compiler-macros.h: ...this new file.

* include/freetype/internal/*.h, src/raster/ftraster.h: Include
`compiler-macros.h' where needed.
2020-07-05 10:42:23 +02:00
David Turner 0322efb5e5 [build] Move mac support code to `mac-support.h'.
* builds/unix/ftconfig.h.in, builds/vms/ftconfig.h,
include/freetype/config/ftconfig.h: Split off mac-specific stuff
to...
* include/freetype/config/mac-support.h: ...this new file.

* CMakeLists.txt, builds/unix/configure.raw: Remove `/undef ->
#undef' string replacement; the affected code is no longer part of
the `ftconfig.h' template.
2020-07-05 09:59:29 +02:00
David Turner bd7251ac97 [build] Put integer type definitions into `integer-types.h'.
Refactor some of the `ftconfig.h' headers and template to move the
definition of the FreeType integer types (e.g., `FT_Int16') to a
common header file `freetype/config/integer-types.h'.

* builds/unix/ftconfig.h.in, builds/vms/ftconfig.h,
include/freetype/config/ftconfig.h: Split off integer type
definition stuff to...
* include/freetype/config/integer-types.h: ...this new file.

* builds/unix/ftconfig.h.in: Control the definition of
`FT_SIZEOF_INT' and `FT_SIZEOF_LONG' with macro
`FT_USE_AUTOCONF_SIZEOF_TYPES'.  If these are not defined, auto
detection happens in `integer-types.h' as usual based on `INTXX_MAX'
values.  Otherwise the autoconf-detected values are used.

* builds/unix/configure.raw (CPPFLAGS): Don't include path to
`config' directory.  Instead, ...
(FT_CONFIG_STANDARD_LIBRARY_H): Use complete path.
2020-07-05 09:52:23 +02:00
David Turner a4d9206754 [build] Rename `build/unix/ftconfig.in' to `ftconfig.h.in'.
Since we are no longer limited to 8.3 file names, it is simpler to
follow the usual conventions for template files.

* builds/unix/ftconfig.in: Renamed to...
* builds/unix/ftconfig.h.in: ...this.

* CMakeLists.txt, builds/unix/configure.raw: Updated.
2020-07-05 09:51:38 +02:00
Alexei Podtelezhnikov 3bb512bc9f [smooth] Introduce direct oversampling for overlaps.
This implements oversampling to metigate artifacts in pixels partially
covered by overlapping contours.  It turns out that the 4x4
oversampling is sufficient but, at least, quadruples the rendering
time.  The outline has to set FT_OUTLINE_OVERLAP to use this method.

* include/freetype/ftimage.h (FT_OUTLINE_OVERLAP): New flag.
* src/smooth/ftsmooth.c (ft_smooth_render): Check it to...
(ft_smooth_raster_overlap): ... inflate outline and set up direct
rendering for oversampling with...
(ft_smooth_overlap_spans): ... new span function that integrates them.
2020-07-03 22:29:34 -04:00
Alexei Podtelezhnikov 19d39f43d2 [smooth] Use direct rendering mode in Harmony.
Instead of rendering 3 bitmaps side by side and reshuffling, we use
direct rendering to deliver the bitmaps on each third byte.

* src/smooth/ftsmooth.c (ft_smooth_raster_lcd)
[!FT_CONFIG_OPTION_SUBPIXEL_RENDERING]: Set up direct mode with...
(ft_smooth_lcd_spans): ... new span function.
2020-07-03 09:17:22 -04:00
Alexei Podtelezhnikov 2d67511a14 [smooth] Separate LCD paths from gray rendering.
This makes `ft_smooth_render' a lot smaller and easier to follow. It
also cleanly separates Harmony and ClearType-style LCD rendering
algorithms. Now I only wish to move LCD filtering and geometry from
FT_Library to FT_Renderer.

* src/smooth/ftsmooth.c (ft_smooth_render): Move LCD code from here...
(ft_smooth_raster_lcd, ft_smooth_raster_lcdv): ... to here.
[FT_CONFIG_OPTION_SUBPIXEL_RENDERING]: Reorganize #ifdef's.
2020-07-03 09:02:09 -04:00
Sebastian Rasmussen a443474755 [cff] Fix handling of `style_name == NULL' (#58630).
* src/cff/cffobjs.c (cff_face_init): If a call to `cff_strcpy' fails
by returning NULL in `cff_face_init', `remove_style' is still
called.  This means that the NULL pointer is dereferenced, causing a
crash.
2020-06-20 05:31:34 +02:00
Alexei Podtelezhnikov de088b1dfd Simplify unused macro. 2020-06-19 22:46:30 -04:00
Sebastian Rasmussen f594ffdc35 [cff] Fix another two memory leaks (#58629).
* src/cff/cffobjs.c (cff_size_init): If a call to `funcs->create'
fails to allocate one of the `internal->subfont' variables, make
sure to free `internal->topfont' and any successfully allocated
subfonts.
2020-06-19 18:55:49 +02:00
Sebastian Rasmussen 2e2f3cb5ba [psaux] Fix memory leak (#58626).
* src/psaux/psstack.c (cf2_stack_init): If `cf2_stack_init' fails to
allocate the stack, return error early.
2020-06-19 18:51:33 +02:00
Sebastian Rasmussen 09b98060d3 Fix memory leak (#58624).
* src/base/ftobjs.c (FT_New_Size): Avoid trying to free
  `size->internal`, unless `size' has been allocated. This
  mistake appeared in the fix for 58611.
2020-06-19 18:49:36 +02:00
Alexei Podtelezhnikov 6e722f2eaa [base] Rework d1180b5f95 until further notice.
* src/base/ftoutln.c (FT_Outline_Get_Orientation): Reject large
outlines.
2020-06-19 08:39:23 -04:00
Sebastian Rasmussen 8ed5a2477e [cff, cid] Fix segfaults in case of error (#58621).
* src/cff/cffobjs.c (cff_slot_done), src/cid/cidobjs.c
(cid_slot_done): If `ft_glyphslot_init' fails to allocate
`internal', then the class' `done_slot' callback (called by
`ft_glyphslot_done') must not dereference the pointer to `internal'.
2020-06-19 10:37:50 +02:00
Werner Lemberg d1180b5f95 [base] Fix UBSAN error.
Reported as

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

* src/base/ftoutln.c (FT_Outline_Get_Orientation): Avoid values
larger than 32 bits.
2020-06-19 08:18:26 +02:00
Werner Lemberg 4d364b6821 [woff2] Fix segfault.
Reported as

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

* src/sfnt/sfwoff2.c (get_x_mins): Check whether `loca' table
exists.
2020-06-19 05:41:37 +02:00
Stephen McDowell d924c5cf7e [sfnt] Support Intel compilers.
* src/sfnt/pngshim.c (premultiply_data): Intel compilers do not
currently support `__builtin_shuffle'.
2020-06-19 04:14:39 +02:00
Sebastian Rasmussen a4429959b0 [base] Fix memory leak (#58611).
* src/base/ftobjs.c (FT_New_Size): When the call to `clazz->init_size'
fails, make sure to free `size->internal'.
2020-06-19 03:57:21 +02:00
Sebastian Rasmussen 575b78d9e3 [cff] Fix memory leak (#58610).
* src/cff/cffobjs.c (cff_size_init): When the call to
`funcs->create' fails, make sure to free `internal'.
2020-06-19 03:53:27 +02:00
Werner Lemberg 74cebeae12 * src/cff/cffload.c (cff_index_get_pointers): Rename `t' to `tbl'. 2020-06-19 03:41:12 +02:00
Sebastian Rasmussen c8cd139c30 [cff] Free table upon error allocating other data (#58609).
* src/cff/cffload.c (cff_index_get_pointers): When new_bytes fails
to allocate, make sure to free the table.  Do the same for both
allocations if there is a later error.
2020-06-19 03:37:32 +02:00
Werner Lemberg 7438235b42 woff2tags.h: Fix copyright year. 2020-06-17 15:12:30 +02:00
Werner Lemberg 1658685967 Remove redundant inclusion of `ft2build.h'.
* */*: Remove `#include <ft2build.h>' where possible.

* include/freetype/freetype.h: Remove cpp error about missing
inclusion of `ft2build.h'.
2020-06-13 21:15:45 +02:00
David Turner e13391333f Make macros for header file names optional.
We no longer have to take care of the 8.3 file name limit; this
allows us (a) to introduce longer, meaningful file names, and (b) to
avoid macro names in `#include' lines altogether since some
compilers (most notably Visual C++) doesn't support this properly.

*/*: Replace

   #include FOO_H

with

   #include <freetype/foo.h>

or something similar.  Also update the documentation.
2020-06-08 13:31:55 +02:00
Werner Lemberg 9e6e903cc4 * src/sfnt/ttcmap.c (tt_face_build_cmaps): Trace number of cmaps. 2020-06-02 17:14:54 +02:00
David Turner 62fea391fa Remove obsolete HAVE_STDINT_H probing macro.
This macro was updated by the unix configure script and the
`CMakeLists.txt' one, but is never used in the source tree (nor is
<stdint.h> included anywhere).

* CMakeLists.txt, builds/unix/ftconfig.in: Don't handle
`HAVE_STDINT_H'.
2020-05-18 18:42:57 +02:00
David Turner 4eee13404d Remove Jamfile files from the tree.
These have not been used in a very, very long time, so better remove
them.  A corresponding patch will be submitted to the
`freetype2-demos' repository.

* src/Jamfile, src/*/Jamfile, Jamrules: Delete.
2020-05-18 17:56:06 +02:00
Alexei Podtelezhnikov 3f70e6d20c [smooth] Turn on LCD filtering during FreeType initialization.
* src/smooth/ftsmooth.c (ft_smooth_init): Enable LCD filtering.

* include/freetype/ftlcdfil.h: Document it, remove patent warnings.
* include/freetype/freetype.h (FT_Render_Mode): Updated.
* include/freetype/config/ftoption.h, devel/ftoption.h
[FT_CONFIG_OPTION_SUBPIXEL_RENDERING]: Do not mention patents.
2020-05-12 00:38:46 -04:00
Alexei Podtelezhnikov 652f886319 [smooth] Stop using dedicated LCD modules and classes.
The LCD modules were never truly independent. They mostly served as
a way to disable patented LCD rendering, which is no longer necessary.
The `smooth' module now handles LCD modes as well.

* src/smooth/ftsmooth.c (ft_smooth_lcd_renderer_class.
ft_smooth_lcdv_renderer_class): Deleted.
(ft_render_smooth): Reworked from `ft_render_smooth_generic'.
* src/smooth/ftsmooth.h: Remove dedicated LCD classes.
* src/smooth/module.mk: Remove dedicated LCD modules.
* include/freetype/config/ftmodule.h: Ditto.
* builds/amiga/include/config/ftmodule.h: Ditto.
* include/freetype/ftmodapi.h: Do not mention LCD modules.
2020-05-11 23:30:37 -04:00
Alexei Podtelezhnikov 093f87bfe4 Formatting. 2020-05-09 22:32:03 -04:00
Werner Lemberg 132f19b779 * Version 2.10.2 released. ==========================
Tag sources with `VER-2-10-2'.

* docs/VERSION.TXT: Add entry for version 2.10.2.

* README, Jamfile (RefDoc), src/base/ftver.rc,
builds/windows/vc2010/index.html, builds/windows/visualc/index.html,
builds/windows/visualce/index.html,
builds/wince/vc2005-ce/index.html,
builds/wince/vc2008-ce/index.html, docs/freetype-config.1:
s/2.10.1/2.10.2/, s/2101/2102/.

* include/freetype/freetype.h (FREETYPE_PATCH): Set to 2.

* builds/unix/configure.raw (version_info): Set to 23:2:17.
* CMakeLists.txt (VERSION_PATCH): Set to 2.

* docs/CHANGES: Updated.
2020-05-09 07:09:40 +02:00
Jakub Alba a45da25349 * src/truetype/ttinterp.c (TT_RunIns): Adjust loop counter (#58319).
The font that exceeds the old limit is Icono Regular, version
1.00000.
2020-05-08 10:59:37 +02:00
Alexei Podtelezhnikov ed62b12d6c Typo and comment. 2020-05-03 23:22:08 -04:00
Alexei Podtelezhnikov de60e7d3f8 * builds/freetype.mk: Refactor for readability. 2020-05-03 17:11:20 -04:00
Alexei Podtelezhnikov 49967cb610 [builds] Clean up Windows CE project files.
Remove version from filenames that caused a lot of polution in the
release process. Use VERSIONINFO resource instead.

* builds/wince/vc2005-ce/freetype.vcproj,
builds/wince/vc2008-ce/freetype.vcproj,
builds/windows/visualce/freetype.vcproj,
builds/windows/visualce/freetype.dsp: s/2101//g, but add `ftver.rc'.
* builds/wince/vc2008-ce/index.html,
builds/wince/vc2005-ce/index.html,
builds/windows/visualce/index.html: s/2101//g.
2020-05-02 13:50:33 -04:00
Alexei Podtelezhnikov a612da0e8b * devel/ft2build.h: Override FT_CONFIG_MODULES_H here as well. 2020-05-01 22:52:52 -04:00
Alexei Podtelezhnikov 9c850f5611 [builds/unix] Consolidate marco overrides (for the demos to see them).
* builds/unix/unix-cc.in (FT_CONFIG_MODULES_H, FT_CONFIG_OPTIONS_H):
Override them here...
* builds/freetype.mk: ... instead of here.
2020-05-01 22:30:15 -04:00
Werner Lemberg d79946311b Grammar fix for last commit. 2020-04-30 08:37:16 +02:00
Werner Lemberg e6ecce9ae8 CHANGES: We are going to remove Jam. 2020-04-30 07:27:28 +02:00
Werner Lemberg 11beee855e Allow setting `CC' in Unix build (#58051).
* builds/unix/unix-cc.in (CC): Use `override'.  The command line
  value of `CC' (if any) is stored already in `CCraw'.
2020-04-08 09:05:32 +02:00
Nikhil Ramakrishnan 7a019a63ed [woff2] Return if single stream operation fails.
* src/sfnt/sfwoff2.c (get_x_mins): Do it.

* src/sfnt/woff2tags.c: Remove unused include.
2020-04-04 14:06:37 +05:30
Nikhil Ramakrishnan 13c0df80dc [docs] Fix building docs if `srcdir' != `builddir'.
`docs/reference/*' was moved one directory up in commit 237fed6.

* builds/unix/unix-def.in (PIP): Remove variable.

* configure: Create `docs' directory and copy assets from
`docs/markdown'.

* docs/README: Output directory is `reference'.
2020-03-22 23:29:51 +05:30
Nikhil Ramakrishnan 1fd3148713 [docwriter] Drop support for Python < 3.5.
Python versions < 3.5 have reached end-of-life and as such, no
security or bug fixes will be provided for those versions.  See

  https://devguide.python.org/#status-of-python-branches

for more information.

* Jamfile (RefDoc): Add `site' parameter.

* builds/detect.mk (std_setup): Update Python version requirement.

* builds/freetype.mk (refdoc-venv): Use pip as `python -m pip'.

* builds/unix/ax_compare_version.m4,
builds/unix/ax_prog_python_version.m4: Macros to detect Python
version.  New files.

* builds/unix/configure.raw: Check for Python >= 3.5 and remove
check for `pip'.

* docs/CHANGES, docs/INSTALL.GNU, docs/README: Updated.
2020-03-21 20:17:17 +05:30
Moazin Khatti 6a431038c9 [gzip] Support `gzip' encoded header conditionally.
In order to support `gzip' encoded header the call to
`inflateInit2' was modified in commit 6a92b1fadd.
However, this code breaks with the outdated internal version
of zlib.  This is a temporary fix to conditionally support
`gzip' encoded header whenever a system installation of zlib
is being used.

Problem report in

  https://lists.nongnu.org/archive/html/freetype-devel/2020-02/msg00023.html

* src/gzip/ftgzip.c (FT_Gzip_Uncompress): Change the the call to
`inflateInit2' depending on whether the system installation is
being used or the internal copy.
2020-03-02 18:21:27 +05:00
Ben Wagner 11975fe9f6 Fix state of `FT_Face' for buggy `gvar' tables (#57923).
By resetting the blend as implemented with this commit fonts with
invalid `gvar' tables may keep calling into `ft_var_load_gvar' from
`tt_set_mm_blend' and failing, but the font was invalid anyway and
we want to keep seeing the failure in `tt_set_mm_blend'.

* src/truetype/ttgxvar.c (ft_var_load_gvar): Calculate length of
offset array once.
Allocate arrays after `FT_FRAME_ENTER' (extra check before
allocating and avoid needing to free array later if error entering
frame).
Always call `FT_FRAME_EXIT'.
Consistently set counts immediately after array initialized.
Reset the blend (particularly `blend->glyphoffsets') on failure.
2020-02-29 20:29:14 +01:00
Werner Lemberg 149b9055e6 ChangeLog entry for last commit. 2020-02-29 20:28:03 +01:00
Nikhil Ramakrishnan 21c2311e63 Update docwriter stylesheet.
This change is required to support docwriter 1.2.1.

See

  https://github.com/freetype/docwriter/issues/36

for more information.

* docs/markdown/stylesheets/extra.css:
(.md-typeset code) -> (.md-typeset pre>code)
(pre) -> (pre>code)
(p, .md-typeset p, h4): Remove commented styles.
(table.index): Remove unused styles.
2020-03-01 00:37:31 +05:30
Ben Wagner 216e077600 [truetype] Add better checks for loading `gvar' table (#57905).
* src/truetype/ttgxvar.c (ft_var_load_gvar): Delay settings of any
`blend->xxxcount' values until the corresponding data has been
checked.
Also do some sanitizing to avoid a too early exit.

(TT_Vary_Apply_Glyph_Deltas): Improve tracing message.
2020-02-28 07:43:00 +01:00
Werner Lemberg 141da02816 Make `FT_HAS_*' and `FT_IS_*' really return true (#57906).
* include/freetype/freetype.h (FT_HAS_*, FT_IS_*): Implement it.
2020-02-27 09:49:06 +01:00
Dominik Röttsches 5b1a37af56 Fix for CFF space glyph regression (#57541).
* src/psaux/psft.c (cf2_decoder_parse_substrings): Replace early-out
  with FT_OFFSET.
2020-02-25 11:02:28 +01:00
Werner Lemberg fa147af4a5 [woff2] Fix font table access.
Reported as

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

* src/sfnt/sfwoff2.c (get_x_mins): Explicitly check for presence of
`head' table, which might not have been processed yet.
2020-02-22 18:30:46 +01:00
Werner Lemberg 6e49dff005 [psaux] Make `t1_decoder_parse_metrics' handle `op_div' (#57519).
* src/psaux/t1decode.c (t1_decoder_parse_metrics): Copy
corresponding code from old engine's `t1_decoder_parse_charstrings'
function.
2020-02-21 21:00:04 +01:00
Nikolaus Waxweiler 49f3394d7a [autofit] Add support for Hanifi Rohingya script.
* src/autofit/afblue.dat: Add blue zone data for Hanifi Rohingya.
* src/autofit/afblue.c, src/autofit/afblue.h: Regenerated.

* src/autofit/afscript.h: Add Hanifi Rohingya standard character.

* src/autofit/afranges.c, src/autofit/afstyles.h: Add Hanifi
  Rohingya data.
2020-02-19 20:04:31 +01:00
Werner Lemberg 84d56589f0 Require HarfBuzz 1.8.
* builds/unix/configure.raw, CMakeLists.txt: Request HarfBuzz 1.8.0
or newer.

We are going to add auto-hinter support for Hanifi Rohingya, which
was introduced in Unicode 11.0.
2020-02-19 19:22:49 +01:00
Werner Lemberg d09e831559 Minor. 2020-02-16 15:24:27 +01:00
Werner Lemberg 8930cc9618 * src/sfnt/ttcmap.c (tt_face_build_cmaps): Ignore version (#57708). 2020-02-12 18:25:03 +01:00
Werner Lemberg 4a19a53d5a * src/truetype/ttinterp.c (TT_RunIns): Adjust loop counter (#57732).
The font that exceeds the old limit is Constantine, version 1.001.
2020-02-04 13:37:19 +01:00
Werner Lemberg e5038be704 Update all copyright notices. 2020-01-19 17:05:19 +01:00
Werner Lemberg fd03cf8816 [base] Fix `FREETYPE_PROPERTIES=type1:hinting-engine=adobe`.
* src/base/ftpsprop.c (ps_property_set) [hinting-engine]: Avoid an
incorrect return value that caused a warning.  The function did the
right thing, though.
2020-01-04 19:28:36 +01:00
Werner Lemberg 50b013871c Add reference to another oss-fuzz bug report. 2020-01-04 18:42:27 +01:00
Werner Lemberg a99a8e2863 [woff2] Fix memory leaks and a runtime warning.
Reported as

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

* src/sfnt/sfwoff2.c (compute_ULong_sum): Add missing cast.
(reconstruct_hmtx): Add missing deallocation calls.
2020-01-03 18:09:12 +01:00
Dominik Röttsches 10d8de7541 [truetype] Fix UBSan warning on offset to nullptr (#57501).
* src/truetype/ttinterp.c (Ins_CALL): Fail if `exc->FDefs' is null.
2020-01-02 11:14:01 +01:00
Nikhil Ramakrishnan a4df0373c7 [woff2] Allow bitmap-only fonts (#57394).
* src/sfnt/sfwoff2.c (reconstruct_font): Fix test for `glyf' and
`loca' tables.
2019-12-31 16:04:01 +01:00
Hugh McMaster 496601e504 [docs] (2/2) Fix generation of API documentation (#56745).
Creating the API Reference in the (new) `reference' sub-directory is
consistent with other documentation sub-topics, such as `design',
`glyphs' and `tutorial'.

This patch fixes broken hyperlinks in the documentation pointing to
and from the API Reference.  It also allows web assets to load from
their relative paths.

* builds/freetype.mk (DOC_DIR): Adjust.
(refdoc, refdoc-venv): Add `--site' argument.

* builds/toplevel.mk (do-dist): Updated.
2019-12-21 19:18:54 +01:00
Hugh McMaster 237fed6d5a [docs] (1/2) Move static web assets (#56745).
* docs/reference/*: Move ...
* docs: ... one directory up.
2019-12-21 19:13:37 +01:00
Dominik Röttsches 8cee1dde4e Fix more UBSan warnings on adding offset to nullptr (#57432).
* src/truetype/ttinterp.c (Ins_LOOPCALL), src/psaux/psft.c
(cf2_initLocalRegionBuffer): Use `FT_OFFSET'.
2019-12-21 19:03:48 +01:00
Werner Lemberg 7e1b39f6cd [truetype] Fix UBSan warnings on adding offsets to nullptr.
Reported as

  https://bugs.chromium.org/p/chromium/issues/detail?id=1032152

* src/truetype/ttinterp.c (Ins_FDEF, Ins_IDEF): Use `FT_OFFSET'.
2019-12-16 11:07:58 +01:00
Werner Lemberg 0c14a3adb0 [truetype] Fix integer overflow.
Reported as

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

* src/truetype/ttinterp.c (Ins_MIRP): Use `ADD_LONG'.
2019-12-14 00:04:01 +01:00
Werner Lemberg 2c9a2d58ca Another bunch of UBSan warnings on adding offsets to nullptr.
Reported as

  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=19427
  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=19433
  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=19441
  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=19451
  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=19452
  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=19457

* src/autofit/aflatin.c (af_latin_hints_compute_segments,
af_latin_hints_compute_edges): Use `FT_OFFSET'.

* src/base/ftstream.c (FT_Stream_EnterFrame): Use `FT_OFFSET'.

* src/psaux/cffdecode.c (cff_decoder_parse_charstrings): Exit early
if there is no charstring.

* src/psaux/psobjs.c (t1_decrypt): Use `FT_OFFSET'.

* src/smooth/ftsmooth.c (ft_smooth_render_generic): Exit early for
zero bitmap dimensions.
2019-12-13 23:56:25 +01:00
Dominik Röttsches 11d4ce23ac Fix more UBSan warnings on adding offset to nullptr (#57384)
* src/smooth/ftsmooth.c (ft_smooth_render_generic),
src/psaux/psobjs.c (ps_table_add): Use `FT_OFFSET'.
2019-12-09 13:11:41 +01:00
Werner Lemberg dfc9a049de * src/truetype/ttinterp.c (TT_RunIns): Use `FT_OFFSET'.
Reported as

  https://bugs.chromium.org/p/chromium/issues/detail?id=1030614
2019-12-05 08:44:30 +01:00
Werner Lemberg 551bd3a90e More nullptr offset UBSan warnings (#57331, #57347).
* src/autofit/afcjk.c (af_cjk_hints_compute_segments),
src/psaux/psft.c (cf2_getSeacComponent), src/truetype/ttinterp.c
(Ins_UNKNOWN): Use `FT_OFFSET'.
2019-12-03 11:52:48 +01:00
Dominik Röttsches 4270e9f324 Avoid more nullptr offset UBSan warnings (#57316).
* src/base/ftoutln.c (FT_Outline_Transform): Bail on empty points.
* src/cff/cffload.c (cff_subfont_load): Use `FT_OFFSET'.
* src/psaux/psft.c (cf2_decoder_parse_substrings): Early out if
`charstring_base' or `charstring_len' are null.
* src/sfnt/ttload.c (tt_face_load_name): Use `FT_OFFSET'.
2019-11-29 06:26:18 +01:00
John Stracke d4f9c24989 [base] Really fix #57194.
Apply accidentally missed second part of patch.

* src/base/ftgloadr.c (FT_GlyphLoader_CheckPoints): Call
`FT_GlyphLoader_CreateExtra'.
2019-11-23 11:25:28 +01:00
Werner Lemberg 9df460b632 [truetype] Avoid sanitizer warning (#57289).
* src/truetype/ttpload.c (tt_face_get_device_metrics): Use
`FT_OFFSET'.
2019-11-23 11:09:40 +01:00
Armin Hasitzka c67b9a1c5b [truetype] Fix integer overflow (#57287).
* src/truetype/ttgload.c (compute_glyph_metrics): Use `SUB_LONG'.
2019-11-23 11:01:18 +01:00
Ben Wagner 3cb7b3f7cb [sfnt] Avoid sanitizer warning (#57286).
* src/sfnt/ttcmap.c (tt_face_build_cmaps): Avoid possible `NULL +
offset' computation.
Tag `table' as `const'.
2019-11-23 10:54:51 +01:00
John Stracke 2d1d60aac6 [base] Fix `NULL + offset' sanitizer warnings (#57194).
* src/base/ftgloadr.c (FT_GlyphLoader_Adjust_Points,
FT_GlyphLoader_Adjust_Subglyphs): Use `FT_OFFSET'.
(FT_GlyphLoader_CreateExtra): Add short cut if some values are zero.
2019-11-23 10:42:04 +01:00
Werner Lemberg 26d0f579c0 * include/freetype/internal/ftmemory.h (FT_OFFSET): New macro.
Use this for `base + offset' pointer calculations where `base' can
be NULL (triggering a sanitizer warning even if the resulting
pointer gets never dereferenced since it is undefined behaviour
in C).

Suggested by Ben Wagner.
2019-11-23 10:28:37 +01:00
Ben Wagner 9b0179597e [sfnt] Ensure OTTO fonts have tables (#57285).
* src/sfnt/ttload.c (tt_face_load_font_dir): Add test.
2019-11-23 10:07:48 +01:00
Behdad Esfahbod 07c8d8bbdb Minor fixes for recent compilers.
* src/gzip/infutil.h (inflate_mask): Add `const'.

* src/autofit/aflatin2.c: Include `ft2build.h'.
2019-11-23 10:00:02 +01:00
Nikolaus Waxweiler 3aaae716b2 CMakeLists.txt: minor doc additions, compile builds/unix/ftsystem.c on UNIX 2019-11-07 23:39:41 +00:00
Werner Lemberg b75031a26e * src/sfnt/sfwoff2.c (woff2_open_font): Check `num_fonts' for TTCs.
Reported as

  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=18494
2019-10-25 21:29:13 +02:00
Filip Filmar 0a3d2bb99b [doc] FT_Open_Args: Clarify the ownership of `pathname'.
Don't expect the function to deallocate the buffer.  This may be obvious
in C, but it is not so obvious in FFI bindings for FreeType 2.
2019-10-22 17:23:52 +02:00
Werner Lemberg 3b8bc65c50 * src/sfnt/sfwoff2.c (woff2_open_font): Avoid undefined shift.
Also improve tracing.

Reported as

  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=18390
2019-10-22 08:07:05 +02:00
Alexei Podtelezhnikov 90a30f154a * src/sfnt/pngshim.c (premultiply_data): Optimize for __SSE__ only. 2019-10-10 22:04:50 -04:00
Werner Lemberg 545a481a74 * src/sfnt/sfwoff2.c (reconstruct_glyf): Check `triplet_size'.
Reported as

  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=18108
2019-10-10 13:11:06 +02:00
John Tytgat 1e9229f0fc [cff] Fix FT_FACE_FLAG_GLYPH_NAMES for CFF2 based fonts (#57023).
* src/cff/cffobjs.c (cff_face_init): Don't set FT_FACE_FLAG_GLYPH_NAMES
for CFF2 based fonts.
2019-10-09 15:37:19 +02:00
Werner Lemberg 5a1a79c0e8 [woff2] Fix SFNT table checks.
Also reduce number of SFNT table lookups.

Reported as

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

* include/freetype/internal/wofftypes.h (WOFF2_InfoRec): Add fields
`glyf_table', `loca_table', and `head_table'.

* src/sfnt/sfwoff2.c (reconstruct_glyf): Update signature.
Use table pointers in `info' parameter.
(get_x_mins): Check `maxp_table'
Use table pointers in `info' parameter.
(reconstruct_font):  Use and set table pointers in `info' parameter.
Fix check for `glyf' and `loca' tables.
Update call to `reconstruct_glyf'.
(woff2_open_font): Updated.
2019-10-08 11:12:18 +02:00
Werner Lemberg 1167bff3e9 * src/sfnt/sfwoff2 (reconstruct_glyf): Fix reallocation.
Reported as

  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=18046
2019-10-06 23:22:34 +02:00
Werner Lemberg 0fcf486e0d Improve memory debugging.
* include/freetype/internal/ftmemory.h (FT_MEM_FREE): Use
`FT_DEBUG_INNER' to set source code file name and line.

* src/base/ftdbgmem.c (ft_mem_table_remove): Better formatting of
tracing message.
2019-10-06 21:12:42 +02:00
Werner Lemberg d355a73aa3 docs/DEBUG: Document environment variable `FT2_KEEP_ALIVE'.
Also do some formatting and minor edits.
2019-10-06 20:07:09 +02:00
Werner Lemberg 1f4e5bcb19 * src/sfnt/sfwoff2 (reconstruct_font): Fix reallocation.
Reported as

  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=17966
2019-10-03 21:07:16 +02:00
Alexei Podtelezhnikov c912690d22 * src/base/ftstroke.c (ft_stroker_inside): Speed up. 2019-09-30 22:45:34 -04:00
Werner Lemberg 94815d6efa * src/sfnt/sfwoff2 (woff2_open_font): Initialize `woff2.ttc_fonts'.
Reported as

  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=17804
2019-10-01 00:15:25 +02:00
Werner Lemberg 839a023619 * src/sfnt/sfwoff2.c (reconstruct_font): Fix memory leak.
Reported as

  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=17812
2019-09-30 07:41:57 +02:00
Werner Lemberg 12696dcf9b [woff2] Reject fonts without `head' table.
Also fix memory deallocation in case of error.

`head' problem reported as

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

* src/sfnt/sfwoff2.c (reconstruct_glyf): Don't use `stream_close'.
Abort if `head_table' is NULL.
Don't free `transformed_buf' in case of error.
(woff2_open_font): Don't set `uncompressed_buf' to NULL.
2019-09-30 07:27:55 +02:00
Werner Lemberg ba06adafcd [woff2] Fix compiler warnings.
Problem reported by Alexei.

* src/sfnt/sfwoff2.c (reconstruct_glyf): Initialize `x_min'.
(reconstruct_font): Initialize `num_hmetrics'.
(woff2_open_font): Initialize `info'.
2019-09-29 13:29:21 +02:00
Werner Lemberg c37a501458 * src/sfnt/sfwoff2.c (woff2_open_font): Fix sanity check.
Correct thinkos in patch from 2019-09-01.
2019-09-28 07:42:34 +02:00
Werner Lemberg 2bf603bde6 [woff2] Fix memory leaks.
One of them reported as

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

* src/sfnt/sfwoff2.c (woff2_open_font): Free `info->x_mins' and
`woff2->ttc_fonts'.

(reconstruct_glyf): Initialize `info->x_mins'.
2019-09-28 07:38:16 +02:00
Alexei Podtelezhnikov b39576f984 * src/base/ftstroke.c (ft_stroker_cap): Speed up caps. 2019-09-27 19:18:49 -04:00
Alexei Podtelezhnikov 432efa25b3 * src/base/ftstroke.c (ft_stroker_outside): Speed up clipped miter.
* include/freetype/ftstroke.h: Wordsmith miter docs.
2019-09-25 21:50:16 -04:00
Werner Lemberg db4083fd7f * src/sfnt/sfwoff2.c (woff2_open_font): Check (sum of) table sizes.
Reported as

  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=17684
2019-09-25 08:48:26 +02:00
Alexei Podtelezhnikov 4881f75b7c * src/base/ftstroke.c (ft_stroke_border_arcto): Speed up calculations. 2019-09-23 22:57:00 -04:00
Nikhil Ramakrishnan 5327092bb2 [woff2] Fix memory leaks.
Reported as

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

* src/sfnt/sfwoff2.c (woff2_open_font): Fix error handling.
Free `uncompressed_buf'.
(reconstruct_font): Free `transformed_buf'.
2019-09-20 06:30:28 +02:00
Werner Lemberg 04ebb2a000 * src/otvalid/otvcommon.c (otv_Coverage_get_last): Guard `count'.
Problem reported by Marc Schönefeld <marc.schoenefeld@gmx.org>.
2019-09-17 19:46:59 +02:00
Werner Lemberg 99f23d6ff2 * src/sfnt/sfwoff2.c (woff2_open_font): Check table index.
Reported as

  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=17100
2019-09-17 13:22:28 +02:00
Avi Halachmi (:avih) cc17f852d5 [cmake] Don't fail if brotli is missing (#56894).
The libs which cmake controls are commented out at

  include/freetype/config/ftoption.h

and cmake un-comment each enabled library, but the brotli option was
not commented out, therefore `FT_CONFIG_OPTION_USE_BROTLI' remained
defined even if brotli was missing/disabled/etc.

Comment it such that cmake can control it, which means leaving it
undefined if brotli is missing.

* include/freetype/config/ftoption.h: Fix typo.
2019-09-15 18:52:13 +02:00
Werner Lemberg 3de1b8d0b0 [cmake] Add brotli support.
* CMakeLists.txt (FT_WITH_BROTLI): New option.

* builds/cmake/FindBrotliDec.cmake: New file.
2019-09-05 14:10:01 +02:00
Werner Lemberg bbb14361db FindHarfBuzz.cmake: Change indentation to two spaces; shorten lines. 2019-09-05 12:38:17 +02:00
Werner Lemberg 87f5225256 Fix handling of `AF_CONFIG_OPTION_INDIC'.
* devel/ftoption.h, include/freetype/config/ftoption.h:
`AF_CONFIG_OPTION_INDIC' needs `AF_CONFIG_OPTION_CJK'.
2019-09-05 12:14:03 +02:00
Werner Lemberg 12351eeefa CMakeLists.txt: Fix generation of DLL related stuff (#56852).
Extract `version_info' variable from `builds/unix/configure.raw' and
use the data to correctly set `LIBRARY_VERSION' and
`LIBRARY_SOVERSION'.

Also use the data to set `ft_version' field in `freetype2.pc'.
Also fix the needed minimum version of HarfBuzz in `freetype2.pc'.
2019-09-05 12:07:01 +02:00
Werner Lemberg 3fa35aa420 * src/sfnt/sfwoff2.c (compute_ULong_sum): Fix undefined shift.
Reported as

  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=16933
2019-09-03 21:10:20 +02:00
Werner Lemberg 543a3b939d * src/sfnt/sfwoff2.c (woff2_open_font): Add sanity check.
Don't trust `totalSfntSize' unconditionally.

Reported as

  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=16893
2019-09-01 23:03:09 +02:00
Dominik Röttsches cbee985a2b [woff2] Don't use `FT_UInt64' (#56815).
* src/sfnt/sfwoff2.c (woff2_open_font): Use `FT_UInt32' for
`file_offset'.  This fixes builds on platforms where `FT_LONG64' is
not defined while still being sufficient to store a file offset.
2019-08-27 19:17:56 +02:00
Werner Lemberg 594156586b [truetype] Prevent crash in `TT_Set_Named_Instance' (#56813).
* src/truetype/ttgxvar.c (TT_Set_Named_Instance): Fix error
handling.
2019-08-27 14:07:14 +02:00
Werner Lemberg ed7e8194e0 CHANGES: Updated. 2019-08-27 14:07:05 +02:00
Werner Lemberg eef5c1dd14 [woff2] Fix compiler warnings.
* src/sfnt/sfwoff2.c (read_num_hmetrics): Remove unused argument
`table_len'.
Update caller.
(triplet_decode, compute_bbox, store_loca, reconstruct_glyf): Make
`i' variable unsigned.
(reconstruct_glyph): Remove condition which is always false.
(reconstruct_html): Removed unused argument `transformed_size'.
Update caller.

* src/sfnt/woff2tags.c (woff2_known_tags): Remove condition which is
always false.
2019-08-27 10:43:32 +02:00
Werner Lemberg 60c52f0edb [woff2] Formatting; some comments. 2019-08-27 10:29:59 +02:00
Nikhil Ramakrishnan 86803acd2a [woff2] Check whether known tag is in array bounds.
If table tag is not 0x3f, we expect a value between 0 and 62.  If
this is not the case, exit with errors.

* src/sfnt/sfwoff2/c: Check whether table tag makes sense.

* src/sfnt/woff2tags.c: Return 0 if tag is out of bounds.
2019-08-27 10:06:03 +02:00
Nikhil Ramakrishnan d2681a4977 [woff2] More formatting and documentation.
* include/freetype/internal/wofftypes.h, src/sfnt/sfwoff2.c: Implement
formatting changes suggested as

  https://lists.nongnu.org/archive/html/freetype-devel/2019-08/msg00052.html
2019-08-27 10:03:19 +02:00
Nikhil Ramakrishnan 1a10301532 * src/sfnt/sfwoff2.c: Improve trace comments.
Adjust tracing levels for comments, and more formatting.
2019-08-27 10:03:06 +02:00
Nikhil Ramakrishnan 97616704aa [woff2] Formatting.
* src/sfnt/sfobjs.c, src/sfnt/sfwoff2.c: Better formatting.
2019-08-27 09:59:46 +02:00
Nikhil Ramakrishnan 2a23dc7fb3 [woff2] Support `hmtx' reconstruction when `glyf' is untransformed.
`reconstruct_hmtx' requires `info->x_mins' and `info->num_glyphs' to
reconstruct the hmtx table.  In case glyf is not transformed, we
call `get_x_mins' which does the necessary work.

* src/sfnt/sfwoff2.c (get_x_mins): New function.
(reconstruct_font): Call get_x_mins.
2019-08-27 09:59:29 +02:00
Nikhil Ramakrishnan 5367e0ca01 [sfnt] Support `face->num_faces' for WOFF2 fonts.
Set correct value of `face->num_faces' for WOFF2 fonts.  This is
being handled separately because we only load the tables for the
requested font face in `woff2_open_font' and create a single-face
sfnt stream.

The full discussion is at:

  https://lists.gnu.org/archive/html/freetype-devel/2019-08/msg00000.html

* src/sfnt/sfobjs.c (sfnt_open_font): Add parameter
`woff2_num_faces'.
(sfnt_init_face): Introduce variable `woff2_num_faces', and change
`face->root.num_faces' if `woff2_num_faces' is set.

* src/sfnt/sfwoff2.c (woff2_open_font): Validate requested face
index and handle negative face indices.

* src/sfnt/sfwoff2.h (woff2_open_font): Add parameter `num_faces' to
declaration.
2019-08-27 09:56:36 +02:00
Nikhil Ramakrishnan bb7668d7c3 [woff2] Improve memory and error handling.
Free up memory after use, and improve error handling.

* src/sfnt/sfwoff2.c (reconstruct_font, woff2_open_font): Implement
changes.
2019-08-27 09:53:45 +02:00
Nikhil Ramakrishnan 1e02076815 [woff2] Avoid too many calls to `FT_REALLOC'.
We do this by using `totalSfntSize' as an initial reference, and
extending the buffer when required.  This reduces rendering time
considerably.

* include/freetype/internal/wofftypes.h (WOFF2_HeaderRec): Add
`totalSfntSize', rename `total_sfnt_size' to `actual_sfnt_size'.

* src/sfnt/sfwoff2.c (write_buf): Add parameter `dst_size' to keep
track of and update total size of stream.

(WRITE_SFNT_BUF, WRITE_SFNT_BUF_AT): Modify macros accordingly.

(pad4, store_loca, reconstruct_glyf, reconstruct_hmtx,
reconstruct_font): Update parameters to accept `sfnt_size'.

(woff2_open_font): Add variable `sfnt_size'.  Use WOFF2 header field
`totalSfntSize' as initial reference (if value makes sense) and
allocate `totalSfntSize' bytes for the sfnt stream.  `write_buf'
handles reallocation if and when required.  Also resize the stream
to `actual_sfnt_size' after reconstruction.
2019-08-27 09:50:48 +02:00
Nikhil Ramakrishnan 4d9b3d1d50 [woff2] Reconstruct `loca', `hmtx', and swap out stream.
Add necessary functions to reconstruct loca and hmtx tables (the two
remaining tables that can have a transform).  `woff2_open_font' is
now capable of loading a woff2 font face.  This code may still need
more refining and better memory management.

* include/freetype/internal/wofftypes.h (WOFF2_HeaderRec): Add total
(final) size of sfnt stream.

(WOFF2_InfoRec): Add header checksum value.

* src/sfnt/sfobjs.c (sfnt_open_font): Change `face_instance_index'
parameter to its pointer so its value can be modified by
`woff2_open_font'.

* src/sfnt/sfwoff2.c: (WRITE_SFNT_BUF_AT): New macro to write into
sfnt buffer at given position.

(write_buf): Add parameter `extend_buf' which allows caller to
specify whether buffer should be reallocated before copying data.

(WRITE_SFNT_BUF): Updated.

(pad4, store_loca, reconstruct_htmx): New functions.

(reconstruct_glyf): Calculate loca values and store them.

(reconstruct_font): Call `reconstruct_hmtx', write table record
entries, and calculate table checksums.  Also calculate font
checksum and update `checksumAdjustment' entry in head table.

(woff2_open_font): Open stream for sfnt buffer, swap out input
stream and return.

* src/sfnt/sfwoff2.h (woff2_open_font): Modify parameter to accept
pointer to `face_index'.
2019-08-27 09:46:47 +02:00
Nikhil Ramakrishnan e3953e5410 [woff2] Reconstruct transformed `glyf' table.
Reconstruct `glyf' table if it is transformed in the uncompressed
table stream.  Also add necessary structures, macros and functions.

* include/freetype/internal/wofftypes.h (WOFF2_InfoRec,
WOFF2_SubstreamRec, WOFF2_PointRec): New structures.
(WOFF2_TableRec): s/OrigLength/dst_length/.

* src/sfnt/sfwoff2.c (READ_255USHORT, READ_BASE128): Use
`FT_SET_ERROR' to set implicit `error' variable.

(WRITE_SHORT): New macro.

(N_CONTOUR_STREAM, N_POINTS_STREAM, FLAG_STREAM, GLYPH_STREAM,
COMPOSITE_STREAM, BBOX_STREAM, INSTRUCTION_STREAM): New macros to
refer to substreams of the transformed `glyf' tables.

(Read255UShort, ReadBase128): Return errors set by `FT_READ_XXX'
macros.

(with_sign, safe_int_addition): New functions to add sign to values
based on a flag and perform safe addition respectively.

(triplet_decode): Decode variable-length (flag, xCoordinate,
yCoordinate) triplet for a simple glyph.   See

  https://www.w3.org/TR/WOFF2/#triplet_decoding

(store_points, compute_bbox, composteGlyph_size, reconstruct_glyf):
New functions.

(reconstruct_font): Call `reconstruct_glyf'.

* src/sfnt/sfwoff2.h: Add required constants.

* src/sfnt/woff2tags.h: Move out constants to `sfwoff2.h'.
2019-08-27 09:39:18 +02:00
Nikhil Ramakrishnan 81cf5326d5 [woff2] Copy un-transformed tables to sfnt stream.
Copy un-transformed tables to the sfnt stream.

* src/sfnt/sfwoff2.c: (WRITE_SFNT_BUF): New macro.
(write_buf): New function.  Extend memory of `dst' buffer and copy
bytes from `src'.
(compute_ULong_sum): New function.  Calculate checksum of table.
(reconstruct_font): Change `FT_Byte* sfnt' to `FT_Byte**
sfnt_bytes'.  This has been done because we reallocate memory to
`sfnt' multiple times, which may change the pointer value of `sfnt'.
This new pointer must be propogated back to the caller.  Same reason
for using a double pointer in `write_buf'.

* src/sfnt/woff2tags.h (WOFF2_DEFAULT_MAX_SIZE): New macro used for
overflow checking.
2019-08-27 09:31:13 +02:00
Nikhil Ramakrishnan 106bacf502 [woff2] Create stream for uncompressed buffer.
Uncompressed buffer is now an `FT_Stream'.

Perform basic checks and start iterating over tables.

* src/sfnt/sfwoff2.c (stream_close, find_table, read_num_hmetrics):
New functions.
(reconstruct_font): Modify parameters and iterate over tables.
(woff2_open_font): Updated.
2019-08-27 09:26:44 +02:00
Nikhil Ramakrishnan 18f6ff11f9 [woff2] Handle TTCs and start reconstructing font.
We `handle' TTCs by modifying the `indices' array to point to only
those tables that are part of the requested `face_index'.

Set and use `num_tables' in `WOFF2_TtcFont'.

* src/sfnt/sfwoff2.c (reconstruct_font): New function.
(woff2_open_font): Start reconstruction of font.
2019-08-27 09:23:55 +02:00
Nikhil Ramakrishnan 7a1639bc1e [woff2] Get known tags from function.
Change `KnownTags' to a function (`woff2_known_tags').  This avoids
introducing a global constant array.  This function returns the
specified index without *any* checks.  The caller must ensure that
`index' is within array limits.

* src/sfnt/sfwoff2.c (woff2_open_font): Change `KnownTags[...]'
notation to `woff2_known_tags( ...  )'.

* src/sfnt/woff2tags.c: Perform changes.

* src/sfnt/woff2tags.h: Update definitions.
2019-08-27 09:20:34 +02:00
Nikhil Ramakrishnan c6c2c0b574 [woff2] Minor.
* src/sfnt/sfwoff2.c (woff2_uncompress): Add error message
(woff2_open_font): Free `uncompressed_buf'.
2019-08-27 09:18:18 +02:00
Nikhil Ramakrishnan fc65d45a62 [woff2] Uncompress Brotli streams and `face_index' support.
WOFF2 compressed stream is now uncompressed if Brotli is available.
This data is stored in a separate buffer (uncompressed_buf) because
it does not contain direct table data.  Certain tables have
transformations applied to them, and they must be reconstructed
before we can write those tables to the SFNT stream.

`face_index' is now being passed as a parameter to
`woff2_open_font'.

* src/sfnt/sfobjs.c (sfnt_open_font): Add parameter
`face_instance_index'.

* src/sfnt/sfwoff2.c (woff2_uncompress): New function.
(woff2_open_font): Call `woff2_uncompress'.
(compute_first_table_offset): Fix return type.

* src/sfnt/sfwoff2.h (woff2_open_font): Modify declaration.
2019-08-27 09:15:28 +02:00
Nikhil Ramakrishnan 732da8a4b7 * builds/unix/configure.raw: Change argument name to `brotli'. 2019-08-27 09:11:37 +02:00
Nikhil Ramakrishnan 9443a1bc3e Add Brotli dependency and required checks.
Brotli is required for decompressing WOFF2 font directory streams.
The library is thus being added as an optional dependency for
FreeType.

* builds/unix/configure.raw: Add checks for `libbrotlidec'.
(REQUIRES_PRIVATE, LIBS_PRIVATE, LIBSSTATIC_CONFIG): Updated.

* devel/ftoption.h, include/freetype/config/ftoption.h
(FT_CONFIG_OPTION_USE_BROTLI): New macro.
2019-08-27 09:09:48 +02:00
Nikhil Ramakrishnan 76c64f6ba1 [woff2] Write SFNT Offset table.
* src/sfnt/sfwoff2.c (WRITE_USHORT, WRITE_ULONG): New macros.
(compare_tags): New function.
(woff2_open_font): Implement it.
2019-08-27 09:06:36 +02:00
Nikhil Ramakrishnan e09fe4cc79 * src/sfnt/sfwoff2.c: #undef macros. 2019-08-27 09:04:16 +02:00
Nikhil Ramakrishnan e496cb2980 [woff2] Read table and collection directory.
* include/freetype/internal/wofftypes.h (WOFF2_TtcFontRec): New
structure.
(WOFF2_HeaderRec): Add more fields.

* src/sfnt/sfwoff2.c (READ_255USHORT, READ_BASE128, ROUND4): New
macros.
(Read255UShort, CollectionHeaderSize, compute_first_table_offset):
New functions.
(ReadBase128): Use `FT_READ_BYTE'.
(woff2_open_font): Add functionality to read table directory and
collection directory (if present).
2019-08-27 09:02:33 +02:00
Nikhil Ramakrishnan 8c1e3fc339 [sfnt] Include `woff2tags.c' for building.
* src/sfnt/rules.mk (SFNT_DRV_SRC): Add `woff2tags.c'.

* src/sfnt/sfnt.c: Include `woff2tags.c'.
2019-08-27 08:58:20 +02:00
Nikhil Ramakrishnan b45c7dd5e2 [sfnt] Add WOFF2 constants.
Add constants required for WOFF2, and known table tags as defined in
the specification.  See

  https://www.w3.org/TR/WOFF2/#table_dir_format

for details.

* src/sfnt/woff2tags.c, src/sfnt/woff2tags.h: New files.
2019-08-27 08:56:10 +02:00
Nikhil Ramakrishnan 2fa573c1b0 [sfnt] Read WOFF 2 header.
Check for WOFF2 tag, call `woff2_open_font', and implement it to read
header according to specification.

* include/freetype/internal/fttrace.h: Add `sfwoff2.c'.

* src/sfnt/rules.mk (SFNT_DRV_SRC): Add `sfwoff2.c'.

* src/sfnt/sfnt.c: Include `sfwoff2.c'.

* src/sfnt/sfobjs.c (sfnt_open_font): Check for `wOF2' tag and call
`woff2_open_font'.

* src/sfnt/sfwoff2.c, src/sfnt/sfwoff2.h: New files.
2019-08-27 08:53:51 +02:00
Nikhil Ramakrishnan 83dba0e9ec Add structures for WOFF2.
Add structures and macro for WOFF 2 header and table directory.

* include/freetype/internal/wofftypes.h (WOFF2_HeaderRec,
WOFF2_TableRec_): New structures.

* include/freetype/tttags.h (TTAG_wOF2): New macro.
2019-08-27 08:48:53 +02:00
Werner Lemberg 9adc3b35f1 * src/psaux/cffdecode.c (cff_operator_seac): Fix numeric overflow.
Reported as

  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=16470
2019-08-26 20:36:19 +02:00
Werner Lemberg 7d1d3b9a0e [type1] Fix `FT_Get_Var_Axis_Flags' (#56804).
* src/type1/t1load.c (T1_Get_MM_Var): Allocate space for axis flags.
Also remove redundant assignment.
2019-08-26 09:08:56 +02:00
Werner Lemberg 734d60f63c Another minor documentation improvement. 2019-08-06 20:38:17 +02:00
Werner Lemberg ad3443c931 Minor documentation improvement. 2019-08-05 10:00:41 +02:00
Alexei Podtelezhnikov 12af46b649 * src/base/ftbbox.c (cubic_peak): Sanitize left shift (#56586). 2019-07-23 22:38:30 -04:00
Weiyi Wu d5522ac060 * src/cid/cidload.c (cid_hex_to_binary): Fix typo (#56653). 2019-07-22 09:49:22 +02:00
Werner Lemberg b110acba9e [sfnt, winfonts] Avoid memory leaks in case of error (#56587).
* src/sfnt/sfwoff.c (woff_open_font): Call `FT_FRAME_EXIT' in case
of error.

* src/winfonts/winfnt.c (fnt_face_get_dll_font): Ditto.
2019-07-12 11:36:12 +02:00
Ben Wagner 12e4307dc7 Properly handle phantom points for variation fonts (#56601).
* src/truetype/ttgload.c (TT_Process_Simple_Glyph): Scale phantom
points if HVAR and/or VVAR is present.
2019-07-12 10:48:10 +02:00
Werner Lemberg 05439f5cc6 [psaux] (2/2) Handle fonts that use SEAC for ligatures (#56580).
The same as previous commit but for the old engine.

* src/psaux/t1decode.c (t1operator_seac): Implement it.
2019-07-04 14:28:04 +02:00
Chris Liddell f2b64583cb [psaux] (1/2) Handle fonts that use SEAC for ligatures (#56580).
As originally intended, a Type 1 SEAC charstring would be used for
an accented glyph (like `acaron' or `uumlaut'), where the advance
width of the SEAC glyph is the same as that of the `base' glyph
(like `a' or `u').  In this case it is not uncommon for the SEAC
glyph to not use an (H)SBW opcode of its own but to rely on the
value from the base glyph.

However, out-of-spec fonts also use SEAC glyphs for ligatures (like
`oe' or `fi'), and in those cases the overall advance width is
greater than that of the `base' glyph.  For this reason we have to
allow that the SEAC glyph can have an (H)SBW value of its own, and
if it has, retain this value, rather than the one from the base
glyph.

* src/psaux/psintrp.c (cf2_interpT2CharString) <cf2_escSEAC>:
Implement it.
2019-07-04 14:26:10 +02:00
Werner Lemberg 8cf046c38d * Version 2.10.1 released.
==========================

Tag sources with `VER-2-10-1'.

* docs/VERSION.TXT: Add entry for version 2.10.1.

* README, Jamfile (RefDoc), src/base/ftver.rc,
builds/windows/vc2010/freetype.vcxproj,
builds/windows/vc2010/index.html,
builds/windows/visualc/freetype.dsp,
builds/windows/visualc/freetype.vcproj,
builds/windows/visualc/index.html,
builds/windows/visualce/freetype.dsp,
builds/windows/visualce/freetype.vcproj,
builds/windows/visualce/index.html,
builds/wince/vc2005-ce/freetype.vcproj,
builds/wince/vc2005-ce/index.html,
builds/wince/vc2008-ce/freetype.vcproj,
builds/wince/vc2008-ce/index.html: s/2.10.0/2.10.1/, s/2100/2101/.

* include/freetype/freetype.h (FREETYPE_PATCH): Set to 1.

* builds/unix/configure.raw (version_info): Set to 23:1:17.
* CMakeLists.txt (VERSION_PATCH): Set to 1.

* include/freetype/fterrors.h (FT_Error_String): Fix C++ compilation.
2019-07-01 15:56:34 +02:00
Alexei Podtelezhnikov 7b1c7585d7 * src/bdf/bdfdrivr.c (bdf_cmap_char_{index,next}): Fix inequality.
Reported by Armin Hasitzka.
2019-06-26 20:18:00 -04:00
Alexei Podtelezhnikov 81445c034a Doc polishing. 2019-06-22 22:54:57 -04:00
Alexei Podtelezhnikov a41e560b21 Minor. 2019-06-19 22:29:55 -04:00
Werner Lemberg 1e20a37f64 docs/CHANGES: Updated. 2019-06-19 16:45:39 +02:00
Werner Lemberg 983a87c6ec * src/tools/apinames.c: Formatting, minor edits. 2019-06-16 16:04:12 +02:00
Werner Lemberg 47ca5cb69d [autofit] Disable hinting if no blue zones are available (#56450).
* src/autofit/afglobal.c (af_face_global_get_metrics): Start again
(with dummy hinter module) if no blue zones are present.

* src/autofit/aflatin.c (af_latin_metrics_init_blues): Change
signature to return error code.
If no blue zones are found, update `glyph_styles' array to hold
AF_STYLE_NONE_DFLT instead of the current style.
(af_latin_metrics_init): Return internal error code if no blue zones
are found.
2019-06-16 15:33:32 +02:00
Werner Lemberg 82e4090431 Towards better VMS support.
More to come.

* builds/vms/LIBS.OPT_IA64, builds/vms/_LINK.OPT_IA64,
builds/vms/vmslib.dat: New files provided by Jouk Jansen
<joukj@hrem.nano.tudelft.nl>.

* builds/vms/ftconfig.h: Update, also from Jouk.
2019-06-16 10:11:46 +02:00
Werner Lemberg 3736b28af9 * src/autofit/aflatin.c (af_latin_metrics_init_widths): Minor. 2019-06-13 13:45:05 +02:00
Werner Lemberg 8acd9800ed Add memory access macro summary. 2019-06-13 11:12:26 +02:00
Alexei Podtelezhnikov e7ac9288ac [smooth] Restore the span buffering for direct mode only.
The buffer size FT_MAX_GRAY_SPANS is set to 10 spans, which should be
enough to cover the entire scanline for simple glyphs in most cases:
each slightly slanted edge needs up to two spans, plus a filling span
in-between.  This is not new, we used to do it before cb4388783c.

* src/smooth/ftgrays.c (gray_TWorker): Add `spans' and `num_spans'.
(gray_hline, gray_sweep): Implement the span buffering.
(gray_raster_render): Use negative `num_spans' to avoid the direct
mode.
2019-06-13 00:17:36 -04:00
Alexei Podtelezhnikov 59e0c6f92e * include/freetype/ftmodapi.h (FT_DebugHook_Func): Return error.
Fix a warning by adding a return value as in `TT_RunIns',
which should not be a compatibility issue.
2019-06-12 22:30:21 -04:00
Alexei Podtelezhnikov bdac4cbe6f Rendering considerations. 2019-06-12 21:58:35 -04:00
Alexei Podtelezhnikov d1b16325e2 * src/truetype/ttobjs.c (tt_check_trickyness_family): Add `const'. 2019-06-11 21:43:47 -04:00
Moazin Khatti 6a92b1fadd [gzip] Add support for `gzip' encoded header (#9812). 2019-06-11 21:29:52 +05:00
Alexei Podtelezhnikov 78c02bc110 [type1,type42] Use `const' for string literals.
* include/freetype/internal/psaux.h (PS_Table_FuncsRec): Updated.
* include/freetype/internal/t1types.h (T1_EncodingRec): Updated.
* src/psaux/psobjs.[ch] (ps_table_add): Updated.
* src/type1/t1load.c (T1_Open_Face, parse_encoding): Updated.
* src/type42/t42objs.c (T42_Open_Face): Updated.
* src/type42/t42parse.c (t42_parse_encoding): Updated.

* src/cff/cffobjs.c (cff_face_init): Minor.
2019-06-10 23:09:49 -04:00
Alexei Podtelezhnikov afaf3f1de9 [bdf,pcf] Use `const' for string literals.
* src/bdf/bdf.h (bdf_property_t): Updated `name'.
* src/bdf/bdflib.c (_bdf_list_split,bdf_create_property,
_bdf_add_property,_bdf_ato*): Updated.
* src/bdf/bdfdrivr.c (bdf_interpret_style): Updated.
* src/pcf/pcfread.c (pcf_intrpret_style): Ditto.
2019-06-10 22:27:39 -04:00
Werner Lemberg 7fde521bd9 Update CHANGES file. 2019-06-10 15:37:33 +02:00
Philip Race 711b593e4b * src/base/ftinit.c (FT_Set_Default_Properties): Fix crash.
Terminate loop at end of environment.
2019-06-07 09:15:28 +02:00
Alexei Podtelezhnikov c949ab0757 Minor. 2019-06-04 20:17:05 -04:00
Alexei Podtelezhnikov e13c1f46dc Solidify VC2005 builds.
* include/freetype/internal/ftcalc.h (FT_MSB) [_MSC_VER]: Explicitly
declare `_BitScanReverse' intrinsic.
* builds/windows/visualc/freetype.vcproj [Debug]: Disable intrinsics.
2019-05-31 22:31:47 -04:00
Nikhil Ramakrishnan 7b275a5af1 [sfnt] Separate WOFF sources and headers.
Move WOFF sources and headers to separate files.

* include/freetype/internal/wofftypes.h, src/sfnt/sfwoff.c,
src/sfnt/sfwoff.h: New files.

* include/freetype/internal/fttrace.h: Register `sfwoff.c'.

* include/freetype/internal/internal.h: Define
FT_INTERNAL_WOFF_TYPES_H.

* include/freetype/internal/sfnt.h: Include FT_INTERNAL_WOFF_TYPES_H.

* include/freetype/internal/tttypes.h: Move out WOFF structures.

* src/sfnt/rules.mk: Add `sfwoff.c'.

* src/sfnt/sfnt.c: Include `sfwoff.c'.

* src/sfnt/sfobjs.c: Include `sfwoff.h', move out WOFF sources.
2019-05-30 23:57:34 +05:30
Werner Lemberg f0de218ced [base] Fix `make multi'.
Reported by Nikhil.

* src/base/fterrors.c: Include FT_INTERNAL_DEBUG_H.
2019-05-30 08:43:45 +02:00
Ben Wagner f37083edf0 [truetype] Fix copy-and-paste error (#56409).
* src/truetype/ttgload.c (load_truetype_glyph): Use correct indices
into `unrounded' array for phantom points.
2019-05-29 08:15:38 +02:00
Werner Lemberg 49079ce297 [truetype] Fix 32bit builds (#56404).
Patch suggested by Ben Wagner <bungeman@google.com>.

* src/truetype/ttgxvar.c (FT_fixedToInt, FT_fixedToFdot6): Remove
harmful cast to unsigned type.
2019-05-29 08:08:53 +02:00
Werner Lemberg 9159128a92 Silence gcc 7's fall-through warnings in `switch' blocks.
Instead of an intentionally missing `break' statement there must be a
comment line containing `fall through' (and nothing else) right before the
next `case' statement.

See

  https://stackoverflow.com/questions/45129741/gcc-7-wimplicit-fallthrough-warnings-and-portable-way-to-clear-them
2019-05-29 07:51:59 +02:00
Ben Wagner 86d997e5b1 * src/truetype/ttgload.c (TT_Process_Simple_Glyph): Improve accuracy. 2019-05-26 09:37:41 -04:00
Nikhil Ramakrishnan e55f969869 * src/sfnt/sfobjs.h: Minor. 2019-05-25 20:56:54 +05:30
Werner Lemberg 306d2f6ccb [truetype] Draw glyphs without deltas in variation font (#56374).
* src/truetype/ttgxvar.c (TT_Vary_Apply_Glyph_Deltas): Always fill
`unrounded' array.
2019-05-23 14:41:57 +02:00
Werner Lemberg c3be6f06b7 src/truetype/ttinterp.c: Give order of operations for some instructions. 2019-05-21 11:23:36 +02:00
Werner Lemberg 262fce445a * src/truetype/ttinterp.c (opcode_name): Improve mnemonics. 2019-05-21 09:58:51 +02:00
Werner Lemberg 8eafa52830 ttinterp.c: Improve documentation of engine compensation. 2019-05-21 09:57:38 +02:00
Alexei Podtelezhnikov 141e3173db Rendering considerations. 2019-05-20 23:09:59 -04:00
Werner Lemberg b0522701f8 [truetype] Actually scale varied CVT values.
Up to now, only the unscaled CVT values were varied; in other words,
the `CVAR' data was never used for bytecode hinting.

* src/truetype/ttgxvar.c (tt_cvt_ready_iterator): New auxiliary
function.
(tt_face_vary_cvt): Use it to trigger rescaling of CVT values.
2019-05-16 12:52:57 +02:00
Werner Lemberg 37580053b4 [truetype] Use 26.6 format for storing unscaled CVT values.
If `CVAR' data is applied to variation fonts, fractional values are
possible.

* include/freetype/internal/tttypes.h (TT_FaceRec): Change type of
`cvt' from `FT_Short' to `FT_Int32'.

* src/truetype/ttgxvar.c (FT_fdot6ToFixed): New macro.
(tt_face_vary_cvt): Use it to update code to 26.6 format.

* src/truetype/ttobjs.c (tt_size_run_prep): Update code to 26.6
format.

* src/truetype/ttpload.c (tt_face_load_cvt): Stora data in 26.6
format.
2019-05-16 12:15:54 +02:00
Werner Lemberg ac335cd586 * src/truetype/ttgload.c (load_truetype_glyph): Init `unrounded'.
This fixes linear advance width values for spacing glyphs.  Bug
introduced 2019-05-09.
2019-05-16 10:15:53 +02:00
Werner Lemberg 535b687e58 [truetype] Avoid code duplication.
* src/truetype/ttobjs.c (tt_size_run_prep): Scale CVT values in this
function.
(tt_size_ready_bytecode): Updated.
* src/truetype/ttgload.c (tt_loader_init): Updated.
2019-05-16 09:55:16 +02:00
Werner Lemberg 787db7c048 * vms_make.com: Updated. Handle `bzip2' directory, too. 2019-05-13 22:22:57 +02:00
Werner Lemberg 03f3f8ab9e * src/psaux/psfont.c (cf2_font_setup): Fix compiler warning. 2019-05-13 06:53:19 +02:00
Werner Lemberg 94ebc24865 [truetype] Doh. Fix last commit to make it work.
Very embarassing :-)

Reported as

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

* src/truetype/ttgload.c (IS_DEFAULT_INSTANCE): Move up and add
argument; update all callers.
(TT_Process_Simple_Glyph): Use it.  The `unrounded' array is active
for variation fonts only, thus also enclose related code with
`#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT ...  #endif' where
necessary.
Revert commit a113e5d from 2019-05-09, and don't use `extra_points2'
but allocate a temporary array.
Speed up the scaling of the `unrounded' array.

* src/truetype/ttgxvar.c (FT_fixedToInt, FT_FixedToFdot6): Fix type
conversions and rounding.  The unsigned type must have more or equal
bits to the signed type.
2019-05-13 06:34:33 +02:00
Werner Lemberg 1178227b39 [truetype] Increase precision of font variation (#54371).
This patch make FreeType use font units in 26.6 format internally
instead of integers.

* src/truetype/ttgxvar.c (FT_fixedToFdot6): New macro.
(TT_Vary_Apply_Glyph_Deltas): Add argument to output unrounded font
coordinates.
* src/truetype/ttgxvar.h: Updated.

* src/truetype/ttgload.c (TT_Process_Simple_Glyph): Use
`extra_points2' array to temporarily hold unrounded point
coordinates; use them to compute scaled coordinates and linear
advance width and height.
(load_truetype_code): Adjust similarly.
2019-05-11 10:01:57 +02:00
Werner Lemberg a113e5df0c * src/truetype/ttgload.c (TT_Process_Simple_Glyph): Minor. 2019-05-09 11:37:58 +02:00
Alexei Podtelezhnikov bc3b5281ed [smooth] Faster fractions.
* src/smooth/ftgrays.c (SUBPIXELS): Replace with...
(FRACT): A fractional coordinate macro to use in...
(gray_render_line, gray_render_scanline): ... here.
2019-05-08 22:08:40 -04:00
Alexei Podtelezhnikov 0c6f61ab12 * src/raster/ftraster.c (Draw_Sweep): Unbreak. 2019-05-07 19:07:11 -04:00
Alexei Podtelezhnikov ea7e20fba6 * src/raster/ftraster.c: Clean-ups. 2019-05-07 07:00:38 -04:00
Werner Lemberg dc39f76cb7 * src/truetype/ttgxvar.c: More use of `FT_fdot14ToFixed'. 2019-05-07 10:09:55 +02:00
Alexei Podtelezhnikov 8172577380 * src/smooth/ftgrays.c (gray_render_line): Small shortcut. 2019-05-04 08:11:20 -04:00
Werner Lemberg 7b84104720 Various clang 8.0 static analyzer fixes.
Reported by Sender Ghost <lightside@gmx.com>.

* src/autofit/afcjk.c (af_cjk_hints_compute_edges): Catch a corner
case where `edge->first' could be NULL.

* src/pfr/pfrobjs.c (pfr_slot_load): Remove unnecessary test of
`size'.

* src/raster/ftraster.c (Draw_Sweep): Catch a corner case where
`draw_right' might be NULL.

* src/sfnt/ttmtx.c (tt_face_get_metrics): Fix limit test for
`aadvance'.
Ensure `abearing' always hold a meaningful result.

* src/truetype/ttgload.c (load_truetype_glyph): Ensure `subglyph' is
not NULL before accessing it.
* src/truetype/ttgxvar.c (TT_Set_Named_Instance): Remove unnecessary
test of `namedstyle'.

* src/type42/t42parse.c (t42_parser_done): Ensure
`parser->root.funcs.done' is not NULL before accessing it.
2019-05-04 08:13:22 +02:00
Alexei Podtelezhnikov 300458eb94 Miscellaneous macro updates.
* src/base/ftoutln.c (SCALED): Updated.
* src/smooth/ftgrays.c (SCALED): Ditto.
(FLOOR, ROUND, CEILING): Removed.
* src/psaux/psfixed.h (cf2_fracToFixed): Updated.
2019-05-03 23:16:42 -04:00
Alexei Podtelezhnikov 65f9516bc7 Tweak LCD filtering.
* src/base/ftlcdfil.c (ft_lcd_filter_fir, _ft_lcd_filter_legacy):
Choose direction from bitmap's pixel_mode.
* include/freetype/internal/ftobjs.c (FT_Bitmap_LcdFilterFunc):
Updated.
* src/smooth/ftsmooth.c (ft_smooth_render_generic): Updated.
2019-05-02 23:06:55 -04:00
Werner Lemberg 65e4925af4 * vms_make.com: Updated (#56253).
Remove no longer existing directories (`autohint', `otlayout').
Update used base extensions.
Activate `autofit' module.
Add `gxvalid' module.
Update copyright notices.
2019-05-02 07:21:34 +02:00
Alexei Podtelezhnikov 2ea511eed8 [smooth] Simplify cubic Bézier flattening.
The previous implementation is correct but it is too complex.
The revised algorithm is based on the fact that each split moves
the control points closer to the trisection points on the chord.
The corresponding distances are good surrogates for the curve
deviation from the straight line.

This cubic flattening algorithm is somewhat similar to the conic
algorithm based the distance from the control point to the middle of
the chord.  The cubic distances, however, decrease less predictably
but are easy enough to calculate on each step.

* src/smooth/ftgrays.c (gray_render_cubic): Replace the split
condition.
2019-04-29 22:49:15 -04:00
Alexei Podtelezhnikov 80475edead [smooth] Bithacks and cosmetics.
* src/smooth/ftgrays.c (gray_record_cell, gray_set_cell, gray_hline,
gray_render_conic, gray_convert_glyph_inner): Updated.
2019-04-26 21:53:00 -04:00
Alexei Podtelezhnikov 7a81b63abc Optimize Bézier bisections.
* src/raster/ftraster.c (Split_Conic, Split_Cubic): Use shifts and
refactor.
* src/smooth/ftgrays.c (gray_split_conic, gray_split_cubic): Ditto.
* src/base/ftstroke.c (ft_conic_split, ft_cubic_split): Ditto.
* src/base/ftbbox.c (cubic_peak): Use shifts.
2019-04-25 22:06:33 -04:00
Alexei Podtelezhnikov 432bb50ff5 Clarify docs. 2019-04-23 21:51:42 -04:00
Werner Lemberg 6abce2c2b0 * src/sfnt/ttcmap.c (tt_cmap12_next): Remove dead code.
Found by clang 8.0's static analyzer and reported by Sender Ghost
<lightside@gmx.com>.
2019-04-23 06:52:07 +02:00
Werner Lemberg 4166c45360 [base] Fix thinko in previous commit.
* src/base/ftbitmap.c (FT_Bitmap_Blend): Check final width, not
target pitch.

Problem reported by Sender Ghost <lightside@gmx.com>.
2019-04-23 06:49:56 +02:00
Werner Lemberg 9f6ed10545 * src/base/ftbitmap.c (FT_Bitmap_Blend): Check target pitch.
Problem reported by Sender Ghost <lightside@gmx.com>.
2019-04-22 08:11:28 +02:00
Werner Lemberg af400438b7 Fix return value of `FT_Set_Named_Instance' (#56186).
* src/truetype/ttgxvar.c (TT_Set_Named_Instance): Correctly handle
internal return value -1 of `TT_Set_Var_Design'.
2019-04-22 07:44:01 +02:00
Werner Lemberg d74106e233 Typo. 2019-04-19 07:07:01 +02:00
Werner Lemberg c149f7397e [pcf] Fix handling of undefined glyph (#56067).
This commit fixes the changes from 2018-07-21, which broke charmap
iteration.  We now add the default character as a new glyph with
index 0, thus increasing the number of glyphs by one (as before).

* src/pcf/pcfread.c (pcf_get_metrics): Adjust to new artificial
glyph with index 0.
Limit number of elements to 65534.
(pcf_get_bitmaps): Ditto.
Unify two loops into one; this avoids allocation of an intermediate
array.
(pcf_get_encodings): Don't flip indices but copy glyph metrics of
default character to index 0.
Also handle invalid default character.

* docs/CHANGES: Updated.
2019-04-19 07:02:37 +02:00
Minmin Gong ebe3750812 * CMakeLists.txt: Avoid rewriting of unchanged configuration files.
Reported as

  https://savannah.nongnu.org/patch/index.php?9755
2019-04-15 10:46:19 +02:00
JDG 8837ac26d0 * src/tools/apinames.c (main): Fix error message.
Reported as

  https://savannah.nongnu.org/patch/?9796
2019-04-15 10:10:38 +02:00
Werner Lemberg 01aed76c68 Minor. 2019-04-14 09:39:28 +02:00
Werner Lemberg 9e9bc9dade Split off ChangeLog.29. 2019-04-12 06:19:25 +02:00
Alexei Podtelezhnikov 1f271751a3 [smooth] Fix segfault in direct mode (#56092).
* src/base/ftoutln.c (FT_Outline_Render): Set missing clip_box for
direct mode.
* src/smooth/ftgrays.c (gray_raster_render): Use it.
2019-04-11 23:48:21 -04:00
Werner Lemberg f0384d5fb0 Minor. 2019-04-09 11:01:24 +02:00
Werner Lemberg 885b4c2475 * src/sfnt/ttcmap.c (tt_get_glyph_name): Pacify compiler (#56061).
This is for Visual Studio 2019 on ARM.
2019-04-06 07:07:37 +02:00
Werner Lemberg 74e9ca6d2e For distribution, replace `.tar.bz2' with `.tar.xz' bundles.
* builds/toplevel.mk (build): Do it.

* README, docs/CHANGES, docs/release: Updated.
2019-04-06 06:51:08 +02:00
Antony Lee 3ad1c93ac1 Make `glyph_name' parameter to `FT_Get_Name_Index' a `const'.
* include/freetype/freetype.h (FT_Get_Name_Index),
include/freetype/internal/ftobjs.h (FT_Face_GetGlyphNameIndexFunc),
include/freetype/internal/services/svgldict.h
(FT_GlyphDict_NameIndexFunc), src/base/ftobjs.c (FT_Get_Name_Index),
src/cff/cffdrivr.c (cff_get_name_index), src/sfnt/sfdriver.c
(sfnt_get_name_index), src/type1/t1driver.c (t1_get_name_index),
src/type42/t42drivr.c (t42_get_name_index): Add `const' to second
argument.
2019-04-06 06:38:16 +02:00
Armin Hasitzka 6986ddac1e [cff] Fix boundary checks.
642bc7590c introduced dynamically
allocated memory when parsing CFF files with the "old" engine.  Bounds
checks have never been updated, however, leading to pointless
comparisons of pointers in some cases.  This commit presents a
solution for bounds checks in the CFF module with an extended logic
for the "old" engine while staying as concise as possible for the
"new" one.

* src/cff/cffparse.h: Introduce the struct `CFF_T2_StringRec' and
the additional field `t2_strings' within `CFF_ParserRec'.

* src/cff/cffparse.c (cff_parser_within_limits): Move all boundary
checks into this new function and update the rest of `cffparse.c' to
use it.

Reported as

  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=12137
2019-03-31 11:08:49 +01:00
Werner Lemberg fdb10e8b50 Improve link. 2019-03-21 13:53:43 +01:00
Werner Lemberg df266d3e6b [autofit] Fix Mongolian blue zone characters.
* src/autofit/afblue.dat: Use U+200D (ZERO-WIDTH JOINER) characters
to get medial forms for some Mongolian characters.
* src/autofit/afblue.c, src/autofit/afblue.h: Regenerated.
2019-03-20 07:04:06 +01:00
Werner Lemberg dde03eec37 [autofit] Add support for Mongolian script.
As a de-facto standard, layouts using this script are constructed
horizontally line by line, then the lines are rotated clockwise for
vertical display.

* src/autofit/afblue.dat: Add blue zone data for Mongolian.
* src/autofit/afblue.c, src/autofit/afblue.h: Regenerated.

* src/autofit/afscript.h: Add Mongolian standard characters.

* src/autofit/afranges.c, src/autofit/afstyles.h: Add Mongolian
data.
2019-03-19 10:50:38 +01:00
Werner Lemberg fbbcf50367 * Version 2.10.0 released.
==========================

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

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

* README, Jamfile (RefDoc), src/base/ftver.rc,
builds/windows/vc2010/freetype.vcxproj,
builds/windows/vc2010/index.html,
builds/windows/visualc/freetype.dsp,
builds/windows/visualc/freetype.vcproj,
builds/windows/visualc/index.html,
builds/windows/visualce/freetype.dsp,
builds/windows/visualce/freetype.vcproj,
builds/windows/visualce/index.html,
builds/wince/vc2005-ce/freetype.vcproj,
builds/wince/vc2005-ce/index.html,
builds/wince/vc2008-ce/freetype.vcproj,
builds/wince/vc2008-ce/index.html: s/2.9.1/2.10.0/, s/291/2100/.

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

* builds/unix/configure.raw (version_info): Set to 23:0:17.
* CMakeLists.txt (VERSION_MINOR): Set to 10.
(VERSION_PATCH): Set to 0.

* builds/toplevel.mk (version, winversion): Since the minor version
number has two digits now, never omit the patch number.  We would
get ambiguous zip file names otherwise.
(dist): Remove remnants of `docmaker' tool.
(do-dist): Remove unused intermediate files.

* src/cff/cffparse.c (destrict_c2s_item): Guard function with
CFF_CONFIG_OPTION_OLD_ENGINE macro.
2019-03-15 07:56:49 +01:00
Werner Lemberg 4e64d9d3da CHANGES: Minor fixes. 2019-03-08 00:13:08 +01:00
Andrei Alexeyev 2f4b740ce4 Fix invalid function pointer casts.
This change should allow Freetype to work on WASM/Emscripten without
needing `-s EMULATE_FUNCTION_POINTER_CASTS=1'.

* src/autofit/afdummy.c (af_dummy_hints_apply): Fix signature.

* src/cid/cidload.c (cid_parse_font_matrix, parse_fd_array,
parse_expansion_factor, parse_font_name): Return `void', not
`FT_Error'.

* include/freetype/internal/ftobjs.h (FT_CMap_CharVarIsDefaultFunc):
Fix signature.
2019-03-07 09:43:05 +01:00
Werner Lemberg 31757f969f [base] Handle numeric overflow (#55827).
* src/base/ftglyph.c (FT_Glyph_Get_CBox): Use `FT_PIX_CEIL_LONG'.
2019-03-05 11:35:03 +01:00
Sebastian Rasmussen 6a4718a3a0 Fix use of uninitialized memory.
* src/psaux/psintrp.c (cf2_interpT2CharString): The call to
`cf2_arrstack_setCount' may fail because the allocator ran out of
memory.  When this happens the stack is still written to before the
error condition is checked.  This means that FreeType writes outside
of allocated memory.  This commit moves the error check prior to the
stack assignment, hence the function now properly returns with an
error condition.
2019-03-05 11:28:19 +01:00
Nikhil Ramakrishnan 6d65c60fca Minor formatting. 2019-03-02 16:05:51 +05:30
Werner Lemberg bf04c59249 Minor doc fixes. 2019-02-25 06:32:26 +01:00
Werner Lemberg 4d51f78de9 More documentation updates.
In particular, mark the new behaviour of `FT_LOAD_COLOR' as experimental.
2019-02-23 11:21:48 +01:00
Werner Lemberg 6ab36880ce * src/base/ftbitmap.c (FT_Bitmap_Blend): No fractional offsets.
The function only provided a framework without an actual
implementation, which this commits removes.
2019-02-23 11:18:39 +01:00
Werner Lemberg 7585997024 Update all copyright notices. 2019-02-23 10:07:09 +01:00
Werner Lemberg fd8fc64efb * src/tools/update-copyright-year: Insert `(C)'. 2019-02-23 10:05:37 +01:00
Armin Hasitzka b77826e139 Triage 8ea854bfe9. 2019-02-21 10:23:15 +00:00
Armin Hasitzka 8ea854bfe9 [truetype] Mask numeric overflows.
* src/truetype/ttinterp.c (Move_CVT, Move_CVT_Stretched, Ins_MIRP):
Mask numeric overflows.

Reported as

  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=11681
  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=11734
2019-02-21 10:14:57 +00:00
Armin Hasitzka 5e3a38b194 [psaux] Mask numeric overflow.
* src/psaux/cffdecode.c (cff_decoder_parse_charstrings): Mask numeric
overflow.

Reported as

  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=13041
2019-02-21 10:04:28 +00:00
Werner Lemberg a346abc093 s/`....`/'....'/ for SFNT table tags in documentation. 2019-02-21 09:19:47 +01:00
Werner Lemberg 8de11f3def s/NULL/`NULL`/ in documentation. 2019-02-20 16:19:19 +01:00
Werner Lemberg f92fa39341 Minor documentation fixes. 2019-02-20 16:04:48 +01:00
Werner Lemberg de8de1ce0e Minor (whitespace, spelling, doc update). 2019-02-20 12:48:36 +01:00
Wink Saville 0ac6921109 * src/autofit/afwarp.h (af_warper_compute): Fix declaration. 2019-02-16 07:05:39 +01:00
Werner Lemberg 29b302ad36 Minor. 2019-02-16 07:05:24 +01:00
Werner Lemberg b66d6a9112 CHANGES: Document recent metrics change from Nikolaus. 2019-02-06 07:38:25 +01:00
Nikolaus Waxweiler a6feefdfef [truetype] Apply MVAR hasc, hdsc and hlgp metrics to current FT_Face metrics.
Instead of setting typo or win metrics as the new FT_Face metrics
indiscriminately, apply only typo deltas to the currently active FT_Face
metrics. This prevents line height differences when e.g. the default
outlines were used as the regular face and instances for everything else.

* src/truetype/ttgxvar.c (tt_apply_mvar): Implement.
2019-02-02 15:50:57 +00:00
Nikolaus Waxweiler f72b00746c [sfnt] Use typo metrics if OS/2 fsSelection USE_TYPO_METRICS bit is set.
If the OS/2 table exists and fsSelection bit 7 (USE_TYPO_METRICS) is set,
use the sTypo* set of values to compute the FT_Face's ascender, descender
and height. Otherwise, fall back to old behavior.

* src/sfnt/sfobjs.c (sfnt_load_face): Implement.
2019-02-02 15:45:31 +00:00
Werner Lemberg f686ad46a3 Update copyright years. 2019-01-22 20:31:44 +01:00
John Tytgat f61f49fef7 [sfnt] Handle TT fonts having two PostScript font names (#55471).
* src/sfnt/sfdriver.c (sfnt_get_name_id): Prefer English over any
other language found for PostScript font names.
2019-01-18 13:25:23 +01:00
Alexei Podtelezhnikov 1e7a8f30c2 [psaux, type1] Align tracing. 2019-01-08 20:54:13 -05:00
Chris Liddell b75abeb5e6 [psaux] Fix closepath (#55414).
All of the Type 1 path building is done with code common to the
revised CFF engine, with the exception of closepath, which was still
calling ps_builder_close_contour(), thus previously cached segments
were not always written to the path, and glyph corruption, or even
invalid outlines were possible.

* src/psauc/psinterp.c (cf2_interpT2CharString) <cf2_cmdCLOSEPATH>:
Switch to calling `cf2_glyphpath_closeOpenPath'.
2019-01-08 20:51:39 -05:00
Nikhil Ramakrishnan 2875ada197 Minor documentation fix. 2018-12-30 20:02:08 +05:30
Werner Lemberg b89166cc4d * src/autofit/aflatin2.c: Some fixes from `aflatin.c' (#55310). 2018-12-29 08:55:01 +01:00
suzuki toshiya 0238237508 * builds/mac/README: Fix a hyperlink to defunct www.gyve.org. 2018-12-26 12:04:39 +09:00
Werner Lemberg afa043de9c Fix links (mostly http -> https). 2018-12-25 22:44:05 +01:00
Werner Lemberg 5e02965905 * src/psaux/cffdecode.c (cff_operaor_seac): Fix numeric overflow.
Reported as

  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=11915
2018-12-25 19:24:06 +01:00
Werner Lemberg ec439711b1 [gxvalid] Fix compiler warnings.
* src/gxvalid/gxvjust.c (gxv_just_check_max_gid),
src/gxvalid/gxvmort.c (gxv_mort_coverage_validate): Use `FT_UNUSED'.
2018-12-12 19:59:42 +01:00
Werner Lemberg e8bbef85c0 Fix documentation of TrueType bytecode interpreter debug hook. 2018-12-12 14:05:47 +01:00
Werner Lemberg 2b4e61e4d6 Minor documentation fixes. 2018-12-12 09:36:39 +01:00
Werner Lemberg 3e8a2283f5 * src/truetype/ttgload.c (TT_Hint_Glyph): Remove useless test.
`control_len' only gets its value from `n_ins' (and vice versa),
which is always read as `unsigned short' and thus can't be larger
than 0xFFFF.
2018-12-11 23:54:17 +01:00
Werner Lemberg 0c83ba6d61 Minor documentation updates and fixes. 2018-12-10 12:14:13 +01:00
Alexei Podtelezhnikov d01e28f41f Important doc fix. 2018-12-06 08:12:27 -05:00
Werner Lemberg f1b6183f36 [bdf] Ignore data after `ENDFONT'.
Reported as

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

* src/bdf/bdflib.c (_bdf_parse_end): New function.
(_bdf_parse_glyphs): Switch to `_bdf_parse_end' after `ENDFONT' has
been encountered.
2018-12-04 11:51:15 +01:00
Alexei Podtelezhnikov 456e9c8fce * builds/windows/visualc/freetype.dsp: Dust off. 2018-12-02 23:40:55 -05:00
Nikhil Ramakrishnan c1e58b4d93 * include/freetype/ftmm.h: Minor. 2018-11-29 12:57:35 +05:30
Alexei Podtelezhnikov 3dd4e76b19 * builds/windows/vc2010/freetype.vcxproj: Simplify. 2018-11-27 23:22:52 -05:00
Chris Liddell 78a1e69517 [type1,cff] Add FT_{Set,Get}_MM_WeightVector API calls.
For multiple master fonts, common usage (in Postscript) is to modify
the WeightVector of an existing font instance, this addition
supports that use.

* include/freetype/ftmm.h, src/base/ftmm.c (FT_Set_MM_WeightVector,
FT_Get_MM_WeightVector): New API functions.

* include/freetype/internalservices/svmm.h
(FT_Set_MM_WeightVector_Func, FT_Get_MM_WeightVector_Func): New
function types.
(MultiMasters): Add `set_mm_weightvector' and `get_mm_weightvector'
members.
(FT_DEFINE_SERVICE_MULTIMASTERSREC): Updated.

* src/cffcffdrivr.c (cff_set_mm_weightvector,
cff_get_mm_weightvector): New functions.
(cff_service_multi_masters): Register them.

* src/truetype/ttdriver.c (tt_service_gx_multi_masters): Updated.
This driver doesn't use the new interface.

* src/type1/t1load.c (T1_Set_MM_WeightVector,
T1_Get_MM_WeightVector): New functions.
* src/type1/t1driver.c (t1_service_multi_masters): Register them.
* src/type1/t1load.h: Updated.
2018-11-27 22:24:06 +01:00
Ben Wagner 1fc6937f7f [cff] Fix compiler warning (#55105).
* src/cff/cffparse.c (cff_parser_run): Guard label only used if
CFF_CONFIG_OPTION_OLD_ENGINE is active.
2018-11-27 18:02:44 +01:00
Ben Wagner 74cdd75f6f [truetype] Fix numeric overflow (#55103).
* src/truetype/ttgload.c (compute_glyph_metrics): Use `SUB_LONG'.
2018-11-27 17:56:25 +01:00
Alexei Podtelezhnikov 1c4004bb34 [builds] Belated DLL support with vc2002-vc2008.
The solution and project files should be automatically upgraded for
the approriate Visual C++ version.

* builds/windows/visualc/freetype.{sln,vcproj}: Major upgrades.
* builds/windows/visualc/index.html: Document the change.
* builds/windows/vc2005, builds/windows/vc2008: Removed as redundant.
2018-11-25 23:19:39 -05:00
Armin Hasitzka 55b35cd611 * src/cff/cffparse.c: Please the compiler. 2018-11-22 11:43:48 +00:00
Armin Hasitzka 642bc7590c [cff] Fix memory overflow.
Reported as

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

* src/cff/cffparse.c (destruct_t2s_item, cff_parser_run): Store
evaluated T2 charstrings in separately allocated memory.
2018-11-22 10:29:35 +00:00
Alexei Podtelezhnikov 81f43a9d36 * builds/windows/{visualc,vc2005,vc2008}/freetype.vcproj: Fix it. 2018-11-18 14:47:32 -05:00
Alexei Podtelezhnikov 8d517e679b Clarification. 2018-11-10 15:47:48 -05:00
Alexei Podtelezhnikov 78db9eecff [smooth] Placeholder only for library-enabled LCD filtering.
* src/smooth/ftsmooth.c (ft_smooth_init): Add disabled
`FT_Library_SetLcdFilter' call.
2018-11-10 15:39:19 -05:00
Werner Lemberg 58e48e9287 [psaux] Add safety guard (#54985).
* src/psaux/psobjs.c (cff_builder_close_contour): Do it.
2018-11-09 12:14:35 +01:00
Alexei Podtelezhnikov 3b6e65f7bf * builds/unix/configure.raw: Require `windows.h' for windres. 2018-11-08 23:36:37 -05:00
Alexei Podtelezhnikov 181033d396 [ftstroke] Fix unpredictable failures (#54986).
* src/base/ftstroke.c (ft_sroke_border_lineto): Fix lineto check.
2018-11-08 21:04:56 -05:00
Alexei Podtelezhnikov 81c31f62cb [ftstroke] Fix unpredictable failures (#54976).
* src/base/ftstroke.c (ft_sroke_border_close): Set the start tags.
2018-11-08 07:54:47 -05:00
Ben Wagner fb0d66d04c [truetype] Fix VF check from 2018-09-12 (#54973).
* src/truetype/ttgxvar.c (TT_Vary_Apply_Glyph_Deltas): Use correct
offsets for estimates.
2018-11-07 00:47:44 +01:00
Werner Lemberg fbd2452346 [pshinter] Fix numeric overflow.
Reported as

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

* src/pshinter/pshrec.c (ps_dimension_add_t1stem): Implement it.
2018-11-06 11:15:31 +01:00
Werner Lemberg 5b86f53dd6 [psaux] Fix timeout in old CFF engine.
Reported as

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

* src/psaux/cffdecode.c (cff_decoder_parse_charstrings)
<cff_op_sqrt> [CFF_CONFIG_OPTION_OLD_ENGINE]: Fix potential endless
loop.
2018-11-06 11:08:41 +01:00
Alexei Podtelezhnikov cc288e383b Minor. 2018-11-04 22:09:16 -05:00
Alexei Podtelezhnikov 1f43affc09 * src/truetype/ttgxvar.c: Use enum definitions. 2018-11-04 13:11:16 -05:00
Alexei Podtelezhnikov d95a12b88d * src/truetype/ttgxvar.c (ft_var_apply_tuple): Adjust condition. 2018-11-03 23:02:58 -04:00
Alexei Podtelezhnikov 547f82f20e * src/truetype/ttgxvar.c (ft_var_apply_tuple): Tracing tweaks. 2018-11-03 23:00:36 -04:00
Alexei Podtelezhnikov ce3feb0b9d Revert due to specs: [truetype] Speed up variation IUP.
This reverts commit 1e4496c54c.
2018-11-03 22:43:21 -04:00
Alexei Podtelezhnikov dfa86d65e5 Revert "[truetype] Speed up variation IUP."
This reverts commit 1e4496c54c.
2018-11-03 22:36:52 -04:00
Alexei Podtelezhnikov 61d50756b6 * src/truetype/ttgxvar.c (ft_var_get_item_delta): Fixed logic.
Reported and tested by Behdad.
2018-11-02 20:42:25 -04:00
Shailesh Mistry 339c451ad0 [autofit] Prevent SEGV.
See

  https://bugs.ghostscript.com/show_bug.cgi?id=697545

for more details on how the bug was found.

* src/autofit/afloader.c (af_loader_load_glyph): Propagate error
code.
2018-11-02 10:10:10 +01:00
Alexei Podtelezhnikov 1e4496c54c [truetype] Speed up variation IUP.
* src/truetype/ttgxvar.c (tt_delta_interpolate): Separate trivial
snapping to the same position from true interpolation.
2018-10-31 23:17:33 -04:00
Alexei Podtelezhnikov ba03310b5a * src/type1/t1load.c (t1_set_mm_blend): Optimized. 2018-10-31 22:01:36 -04:00
Alexei Podtelezhnikov 300da33d61 * src/truetype/ttgxvar.c (ft_var_get_item_delta): Optimized. 2018-10-31 21:55:40 -04:00
Werner Lemberg c13635ee4b [base] Fix numeric overflow.
Reported as

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

* src/base/ftoutln.c (FT_Outline_Get_Orientation): Use `MUL_LONG'.
2018-10-29 21:25:10 +01:00
Werner Lemberg ba62f9d8f5 [cff] Fix numeric overflow.
Reported as

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

* src/cff/cffparse.c (cff_parser_run)
[CFF_CONFIG_OPTION_OLD_ENGINE]: Use `NEG_LONG'.
2018-10-29 21:11:36 +01:00
Alexei Podtelezhnikov acb19ed4e9 Comment on timestamp storage. 2018-10-28 14:19:33 -04:00
Alexei Podtelezhnikov 3e8ec291ff [sfnt] Make `head' timestamps unsigned.
It's been more than 2^31 seconds since 1904.

* include/freetype/tttables.h (TT_Header): Change field types.
* src/sfnt/ttload.c (tt_face_load_generic_header): Updated.
2018-10-26 23:23:48 -04:00
Alexei Podtelezhnikov d71f2bc159 Revert "Align FreeType with standard C memory management."
This reverts commit 877aa1b2cc.
2018-10-26 22:52:25 -04:00
Werner Lemberg bfe5329475 [psaux] Fix numeric overflow.
Triggered by

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

* src/psaux/cffdecode.c (cff_decoder_parse_charstrings) <cff_op_blend>
[CFF_CONFIG_OPTION_OLD_ENGINE]: Fix integer overflow.
2018-10-27 00:07:53 +02:00
Werner Lemberg f56830ed40 Avoid endless loop while tracing (#54858).
* src/type1/t1load.c (parse_buildchar): Guard tracing stuff with
FT_DEBUG_LEVEL_TRACE.
2018-10-20 07:27:47 +02:00
Werner Lemberg 0c4feb72cf * CMakeLists.txt: Specify `RUNTIME DESTINATION'.
This is needed for DLL builds.
2018-10-17 11:25:32 +02:00
Werner Lemberg 428854931e Minor. 2018-10-10 12:21:10 +02:00
Werner Lemberg 912e174c66 A missing Unicode cmap is not a fatal error.
This is a follow-up to the previous commit.

* src/cff/cffobjs.c (cff_face_init), src/sfnt/sfobjs.c
(sfnt_load_face), src/type1/t1objs.c (T1_Face_Init),
src/type42/t42objs.c (T42_Face_Init): Implement it.
2018-10-07 09:28:52 +02:00
Werner Lemberg 885f5b0b4e Fix handling of FT_CONFIG_OPTION_ADOBE_GLYPH_LIST (#54794).
* src/cff/cffcmap.c (cff_cmap_unicode_init), src/psaux/t1cmap.c
(t1_cmap_unicode_init), src/sfnt/ttcmap.c (tt_cmap_unicode_init):
Check `unicodes_init' field.
2018-10-07 09:03:05 +02:00
Werner Lemberg 0a178144e8 Whitespace. 2018-10-07 08:59:56 +02:00
Werner Lemberg f262d15d0a Minor comment improvement. 2018-10-07 07:40:37 +02:00
Werner Lemberg 9817571cc9 [ftgrays] Fix typo in stand-alone mode (#54771).
* src/smooth/ftgrays.c (FT_THROW) [STANDALONE_ &&
FT_DEBUG_LEVEL_TRACE]: Fix call to `FT_ERR_CAT'.
2018-10-03 08:04:55 +02:00
Werner Lemberg d280ae1e8c [psaux] Fix segfault.
Reported as

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

* src/psaux/cffdecode.c (cff_decoder_parse_charstrings)
<cff_op_callothersubr> [CFF_CONFIG_OPTION_OLD_ENGINE]: Check
argument.
2018-10-02 20:45:16 +02:00
Werner Lemberg 6b660f1215 [psaux] Fix numeric overflow.
Reported as

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

* src/psaux/cffdecode.c (cff_decoder_parse_charstrings) <cff_op_roll>
[CFF_CONFIG_OPTION_OLD_ENGINE]: Use NEG_INT.
2018-10-02 16:48:59 +02:00
Werner Lemberg 83fc524dfc [pshinter] Handle numeric overflow.
Reported as

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

* src/pshinter/pshglob.c (psh_blues_snap_stem): Mask numeric
overflow.
2018-10-02 16:36:49 +02:00
Alexei Podtelezhnikov 877aa1b2cc Align FreeType with standard C memory management.
* include/freetype/ftsystem.h: Include FT_TYPES_H.
(*FT_Alloc_Func, *FT_Realloc_Func): Use size_t for the size arguments.
* src/raster/ftmisc.h: Ditto.

* builds/amiga/src/base/ftsystem.c, builds/unix/ftsystem.c,
* builds/vms/ftsystem.c, src/base/ftsystem.c (ft_alloc, ft_realloc):
Use size_t for the size arguments.

* src/base/ftdbgmem.c (ft_mem_debug_alloc, ft_mem_debug_realloc): Use
FT_Offset, aka size_t, for the size arguments.
2018-09-27 21:17:36 -04:00
Alexei Podtelezhnikov 4500c701c2 Typo. 2018-09-26 22:04:50 -04:00
Werner Lemberg efe7f64898 Typo. 2018-09-25 09:16:45 +02:00
Werner Lemberg a9af691481 Fix handing of `FT_Bool'.
Before this commit we had code like

  (FT_Bool)( globals->glyph_styles[gindex] & 0x8000)

Since `FT_Bool' is defined to be an `unsigned char', the code
evaluated to something like

  (unsigned char)( 0x8532 & 0x8000)

which in turn expanded to

  (unsigned char)( 0x8000)

and finally yielded 0x00 – i.e., false – not as expected.

Problem reported and analyzed by Tony Smith <tony.smith@macro4.com>.

* include/freetype/fttypes.h (FT_BOOL): Add a comparison against
zero so that we always have a Boolean expression.

*/*: Replace castings to `FT_Bool' with calls to `FT_BOOL' where
possible.
2018-09-25 09:10:09 +02:00
Alexei Podtelezhnikov 0f122fef34 [bdf] Speed up charmap access.
This makes FT_Get_Char_Index and FT_Get_Next_Char 4-5 times faster.

* src/bdf/bdfdrivr.c (bdf_cmap_char_{index,next}): Help binary search
with continuous prediction.
2018-09-23 21:46:26 -04:00
Alexei Podtelezhnikov 793a9ff9f5 * src/base/ftobjs.c (ft_glyphslot_reset_bimap): Another tweak.
This one should be clearer. When the rounded monochrome bbox collapses
we add a pixel that covers most if not all original cbox.
2018-09-22 14:38:00 -04:00
Alexei Podtelezhnikov f26d57753f * src/base/ftobjs.c (ft_glyphslot_reset_bimap): Further tweak. 2018-09-21 20:34:58 -04:00
Werner Lemberg abd997aa7c Improve documentation of `FT_LOAD_NO_RECURSE'. 2018-09-21 12:50:32 +02:00
Ben Wagner 335528e11e Improve auto-hinter handling of bitmap fonts (#54681).
For bitmap fonts, `FT_Load_Glyph' should either return an error or
not set the format to `FT_GLYPH_FORMAT_OUTLINE'.  However, in this
case `FT_Load_Glyph' calls into the auto-hinter which calls back
into `FT_Load_Glyph' with `FT_LOAD_NO_SCALE' in the flags, which
marks the glyph as `FT_GLYPH_FORMAT_OUTLINE' with an empty path
(even though it doesn't have any path).  It appears that the
auto-hinter should not be called when the face doesn't have
outlines.  The current test for using the auto-hinter in
`FT_Load_Glyph' checks if the driver supports scalable outlines, but
not if the face supports scalable outlines.

* src/base/ftobjs.c (FT_Load_Glyph): Directly check whether we have
scalable outlines.
2018-09-21 11:27:50 +02:00
Werner Lemberg c168cc3b1b [raster] Fix disappearing vertical lines (#54589).
* src/raster/ftraster.c (Vertical_Sweep_Span): Handle special case
where both left and right outline exactly pass pixel centers.
2018-09-21 11:09:27 +02:00
Werner Lemberg 493aa68f5c [base] Some comments. 2018-09-21 08:32:22 +02:00
Alexei Podtelezhnikov 2a9850c4fc * src/base/ftobjs.c (ft_glyphslot_reset_bimap): Tiny rounding tweak.
This adds pixels in case a contour goes through the center
and they need to be turned on in the b/w rasterizer.
2018-09-20 22:40:32 -04:00
Alexei Podtelezhnikov c1b21f47b4 [pcf] Replace charmap implementation.
PCF comes with charmap lookup table, aka PCF encodings.  Using it
directly makes FT_Get_Char_Index and FT_Get_Next_Char 4-5 times
faster than the original BDF-like binary searches.

* src/pcf/pcf.h (PCF_EncodingRec): Removed.
(PCF_FaceRec): Remove `nencodings' and `encodings'.
* src/pcf/pcfdrivr.c (pcf_cmap_char_{index,next}): Replaced.
* src/pcf/pcfread.c (pcf_get_encodings): Store data differently.
2018-09-20 22:14:46 -04:00
Werner Lemberg 8e95068053 [base] Remove unused function `FT_GlyphLoader_CopyPoints'.
* include/freetype/internal/ftgloadr.h, src/base/ftgloadr.c
(FT_GlyphLoader_CopyPoints): Do it.
2018-09-20 06:26:34 +02:00
Alexei Podtelezhnikov 7f93c977e7 [pcf] Prepare to replace charmap implementation.
* src/pcf/pcf.h (PCF_Face): Updated to include...
(PCF_EncRec): ... this new structure to store charmap geometry.

* src/pcf/pcfread.c (pcf_get_encodings): Store charmap geometry.
2018-09-19 22:45:45 -04:00
Alexei Podtelezhnikov d629c2ba24 Remove unused fields.
* src/pcf.h (PCF_FaceRec): Remove `charmap' and `charmap_handle'.
* src/bdfdrvr.h (BDF_FaceRec): Ditto.
* src/winfonts/winfnt.h (FNT_FaceRec): Ditto.
2018-09-18 17:11:48 -04:00
Werner Lemberg dfddc2d975 [pshinter] Handle numeric overflow.
Reported as

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

* src/pshinter/pshglob.c: Include FT_INTERNAL_CALC_H.
(psh_blues_snap_stems): Mask numeric overflow.
2018-09-17 08:03:57 +02:00
Werner Lemberg b8dd404d13 freetype.h: Add warning w.r.t. B/W hinting and rendering (#54589). 2018-09-16 07:22:23 +02:00
Werner Lemberg de0aabcd0d [sfnt] Comment fix. 2018-09-15 06:14:18 +02:00
Werner Lemberg 10e54d04b9 [truetype] Some fixes for VF checks.
Reported as

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

* src/truetype/ttgxvar.c (ft_var_load_gvar): Properly exit memory
frame if we have invalid glyph variation data offsets.
(tt_face_vary_cvt): Protect against missing `tuplecoords' array.
Fix typo.
2018-09-13 21:47:35 +02:00
Werner Lemberg 7665914ccd * src/sfnt/sfdriver.c (sfnt_get_var_ps_name): Fix last commit. 2018-09-13 08:58:49 +02:00
Werner Lemberg a5818ed1e1 * src/sfnt/sfdriver.c (sfnt_get_var_ps_name): Check `result'.
Reported as

  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=10316
2018-09-13 08:46:44 +02:00
John Tytgat 6b53300b01 [sfnt] Better PS name handling (#54629).
* src/sfnt/sfdriver (IS_WIN, IS_APPLE): Omit language ID checks.
(get_win_string, get_apple_string): Return NULL when the PostScript
font name characters is not according to specification.
(get_win_string): Make trace output work if the high byte if
non-zero.
(sfnt_get_var_ps_name, sfnt_get_ps_name): Previously we preferred
Win PS name (when there is also an Apple PS name); change this into
a fallback to Apple PS name in case the Win PS name is invalid.
2018-09-12 08:08:09 +02:00
Werner Lemberg 65681e6dc1 [truetype] Improve VF check.
Triggered by

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

* src/truetype/ttgxvar.c (ft_var_load_gvar): Use better limit check
for `tupleCount'.
2018-09-12 07:40:49 +02:00
Werner Lemberg 53c5e4bd87 * src/truetype/ttgxvar.c (ft_var_load_gvar): Check `glyphoffsets'. 2018-09-12 07:27:30 +02:00
Armin Hasitzka 7b855ed9cf * src/pshinter/pshrec.c (t2_hints_stems): Mask numeric overflow.
Reported as

  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=10215
2018-09-10 23:41:04 +01:00
Werner Lemberg fea435fbf8 [sfnt] Comment improvement. 2018-09-09 09:46:29 +02:00
Ben Wagner 0805c4a488 * builds/freetype.mk (refdoc-venv): Ensure python version (#54631). 2018-09-09 09:25:58 +02:00
Werner Lemberg 7bf2028250 Typo. 2018-09-07 06:43:19 +02:00
Werner Lemberg 1c04eed76f [truetype] Fix assertion failure.
Triggered by

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

* src/truetype/ttgload.c (load_truetype_glyph): Reintroduce
`opened_frame' (removed in a change from 2018-08-26) to handle
dealloation of the second frame.
2018-09-07 06:40:55 +02:00
Werner Lemberg f8af8fba78 Synchronize `ftdebug.c' files.
* builds/amiga/src/base/ftdebug.c, builds/wince/ftdebug.c,
builds/windows/ftdebug.c: Synchronize with `src/base/ftdebug.c'.
2018-09-05 12:16:56 +02:00
Werner Lemberg 97c7944f9e Synchronize `ftconfig' files. 2018-09-05 11:45:05 +02:00
Nikhil Ramakrishnan a748ae4635 * docs/DOCGUIDE: Minor. 2018-09-05 11:12:01 +05:30
Nikhil Ramakrishnan 77aa02660e Add documentation guidelines file.
* docs/DOCGUIDE: New file.
2018-09-05 11:07:20 +05:30
Werner Lemberg 48f93e648e * devel/ftoption.h: Synchronize with master `ftoption.h'. 2018-09-04 21:19:26 +02:00
Werner Lemberg c485bece6b Typo (#54618). 2018-09-04 21:05:06 +02:00
Werner Lemberg 9789c75b1a More '...' vs. `...` fixes in API documentation. 2018-09-04 10:37:44 +02:00
Werner Lemberg 01a5d326bb Make `/****...' comments in public headers uniformly end on column 77. 2018-09-04 08:00:58 +02:00
Alexei Podtelezhnikov 6a4229c4b0 * docs/DEBUG: s/trace_//. 2018-09-03 22:43:39 -04:00
Nikhil Ramakrishnan 7da5589c75 [docwriter] Don't break code snippets accross lines.
Reported as

  http://lists.nongnu.org/archive/html/freetype-devel/2018-08/msg00124.html

* docs/reference/markdown/stylesheets/extra.css (.md-typeset code):
Add rule `white-space'.
2018-09-03 16:45:28 +05:30
Werner Lemberg 1061748256 include/freettype/config:*.*: Convert comments to Markdown syntax.
Also some minor documentation fixes.
2018-09-03 10:37:57 +02:00
Werner Lemberg 76a52465c1 */*: s/PSNames/psnames/.
Only tracing messages are affected.
2018-09-03 09:08:47 +02:00
Werner Lemberg 475f6d25cb [sfnt] Fix heap buffer overflow in CPAL handling.
* src/sfnt/ttcpal.c (tt_face_palette_set): Fix boundary test.
(tt_face_load_cpal): Updated.
2018-09-03 09:00:58 +02:00
Werner Lemberg 9be656bb0c Remove `FT_Outline_{New,Done}_Internal'.
These public API functions(!) were always undocumented and have
escaped all clean-up efforts until now.

* include/freetype/ftoutln.h (FT_Outline_New_Internal,
FT_Outline_Done_Internal): Removed.

* src/base/ftoutln.h (FT_Outline_New_Internal,
FT_Outline_Done_Internal): Merge into...
(FT_Outline_New, FT_Outline_Done): ... these functions.

* docs/README: Updated.
2018-09-01 11:04:58 +02:00
Alexei Podtelezhnikov 809d5125af * src/base/ftobjs.c (ft_glyphslot_preset_bitmap): Check glyph format. 2018-08-31 22:49:19 -04:00
Armin Hasitzka 4b49a8079f [errors] Refine the macro logic surrounding `FT_Error_String'.
* include/freetype/fterrors.h (FT_INCLUDE_ERR_PROTOS,
FT_ERR_PROTOS_DEFINED): Undefine `FT_INCLUDE_ERR_PROTOS' after
checking it and introduce a new macro that takes proper care of
multiple-inclusion protection.
2018-08-31 20:26:46 +01:00
Werner Lemberg c6df41e319 Whitespace. 2018-08-31 20:10:38 +02:00
Werner Lemberg 9a323e4762 * src/base/ftdebug.c (FT_Throw): Restore missing `FT_UNUSED' calls. 2018-08-31 20:09:21 +02:00
Werner Lemberg aff04e91f6 * src/base/ftdebug.c (FT_Throw): Reduce chattiness. 2018-08-31 14:57:36 +02:00
Werner Lemberg 83525bdd10 Minor comments. 2018-08-31 07:37:15 +02:00
Werner Lemberg d91f752b77 Whitespace. 2018-08-31 07:34:30 +02:00
Werner Lemberg 423fce2e3e Add link to OpenType's composite glyph description. 2018-08-31 06:59:44 +02:00
Werner Lemberg 0d4ca13865 * src/autofit/afhints.c (af_glyph_hints_reload): Add initialization. 2018-08-31 06:53:52 +02:00
Alexei Podtelezhnikov 1dacbd893d Consolidate bitmap presetting and size assessment.
* include/freetype/internal/ftobjs.h (ft_glyphslot_preset_bitmap):
Change return type.
* src/base/ftobjs.c (ft_glyphslot_preset_bitmap): Return the bitmap
size assessment.

* src/raster/ftrend1.c (ft_raster1_render): Use it to refuse the
rendering of enourmous or far-fetched outlines.
* src/smooth/ftsmooth.c (ft_smooth_render_generic): Ditto.
2018-08-30 23:28:30 -04:00
Alexei Podtelezhnikov ca980b4cf1 * src/base/ftobjs.c (ft_glyphslot_preset_bitmap): Correct mono. 2018-08-30 21:51:18 -04:00
Armin Hasitzka 35efb103fe [errors] Introduce a macro to control `FT_Error_String'.
* devel/ftoption.h (FT_CONFIG_OPTION_ERROR_STRINGS),
include/freetype/config/ftoption.h (FT_CONFIG_OPTION_ERROR_STRINGS):
New macro.
2018-08-30 14:30:46 +02:00
Armin Hasitzka d20dc3928b [errors] Introduce `FT_Error_String'.
* include/freetype/fterrors.h (FT_Error_String),
src/base/fterrors.c (FT_Error_String): Implement `FT_Error_String'.

* src/base/ftbase.c, src/base/Jamfile (_source),
src/base/rules.mk (BASE_SRC): Add `fterrors.c' to the build logic.

* src/base/ftdebug.c (FT_Throw): Use `FT_Error_String'.
2018-08-30 14:09:04 +02:00
Werner Lemberg c0ccf75012 [autofit] Trace `before' and `after' edges of strong points.
* src/autofit/afhints.h (AF_PointRec) [FT_DEBUG_AUTOFIT]: New arrays
`before' and `after'.

* src/autofit/afhints.c (af_get_strong_edge_index): New auxiliary
function.
(af_glyph_hints_dump_points): Trace `before' and `after' edges.
(af_glyph_hints_align_strong_points) [FT_DEBUG_AUTOFIT]: Set
`before' and `after' information.
2018-08-30 09:56:09 +02:00
Werner Lemberg 21c2b3905c Minor. 2018-08-30 09:52:08 +02:00
Alexei Podtelezhnikov 5d93a3fc8d [base] Overflow-resistant bitmap presetting.
* src/base/ftobjs.c (ft_glyphslot_preset_bitmap): Implement it.
2018-08-30 01:12:22 -04:00
Werner Lemberg 19be8620ec Doc fix. 2018-08-29 18:15:03 +02:00
Armin Hasitzka 934a6159ba Fix numeric overflows.
* src/pshint/pshalgo.c (psh_hint_align, psh_hint_align_light,
psh_hint_table_find_strong_points): Fix numeric overflows.

Reported as

  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=10083
2018-08-29 15:28:21 +02:00
Werner Lemberg 14dff08f37 ftoption.h: s/precendence/precedence/ in documentation (#54586). 2018-08-29 06:56:21 +02:00
Werner Lemberg 3915a18b8c [cff] Fix handling of `roll' op in old engine.
Reported as

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

* src/psaux/cffdecode.c (cff_decoder_parse_charstrings) <cff_op_roll>
[CFF_CONFIG_OPTION_OLD_ENGINE]: Use modulo for loop count, as
documented in the specification.
2018-08-29 06:53:54 +02:00
Werner Lemberg 2c8e6279a7 Minor doc fix. 2018-08-28 08:02:13 +02:00
Werner Lemberg ae3afbc471 * src/truetype/ttobjs.c (tt_size_read_bytecode): Trace CVT values. 2018-08-26 15:40:16 +02:00
Werner Lemberg 2095772144 ChangeLog*: s/\t/ /. 2018-08-26 15:15:56 +02:00
Nikhil Ramakrishnan f87b711746 * configure: Copy assets required by docwriter.
Copy directory `docs/reference/markdown' when FreeType is compiled in a
different directory.

Fixes `make refdoc' if builddir != srcdir.

Reported as

  http://lists.nongnu.org/archive/html/freetype-devel/2018-08/msg00083.html
2018-08-26 17:46:25 +05:30
Werner Lemberg 13034e54aa * src/pshint/pshalgo.c (psh_hint_overlap): Fix numeric overflow.
Reported as

  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=10057
2018-08-26 12:22:51 +02:00
Werner Lemberg 4738dcc4df Minor tracing adjustments.
* src/base/ftstream.c (FT_Stream_EnterFrame, FT_Stream_ExitFrame):
Trace.

* src/truetype/ttgload.c (TT_Access_Glyph_Frame): Remove tracing.
2018-08-26 12:03:33 +02:00
Werner Lemberg 6e339b8d8e [truetype] Avoid nested frames.
Triggered by

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

* src/truetype/ttgload.c (load_truetype_glyph): Don't use variable
`opened_frame' to trace whether a frame must be closed at the end of
function: This fails because `TT_Vary_Apply_Glyph_Deltas' (which
gets called for space glyphs) uses a frame by itself.  Instead,
close the frame after loading the header, then use another frame for
the remaining part of the glyph later on.

Also avoid calling `tt_get_metrics' twice under some circumstances.
2018-08-26 12:01:14 +02:00
Werner Lemberg b287c80b6a Various minor clean-ups.
* src/base/ftapi.c: Remove.  Unused.
* src/base/Jamfile (_sources): Updated.

* src/base/ftstream.c (FT_Stream_ReleaseFrame): Remove redundant
code.
2018-08-26 06:39:43 +02:00
Werner Lemberg c98aa9b78a Add missing ChangeLog entry for the last four commits. 2018-08-25 17:02:20 +02:00
Nikhil Ramakrishnan c962db28ea * builds/*/*: Prepare build system for docwriter.
Add checks, rules and variables to the build system for docwriter.

* Running `make' will warn if Python/PIP/docwriter are not available.

* Running `make refdoc' will generate static documentation site on the
current Python environment.

* Running `make refdoc-venv' will generate static documentation site
using a virtual environment, using the pip package `virtualenv'.
2018-08-25 16:18:26 +05:30
Nikhil Ramakrishnan 195728d5ba * src/tools/docmaker: Remove `docmaker'.
`Docmaker' has now upgraded to `docwriter', a pip package available at

  https://pypi.org/project/docwriter/
2018-08-25 16:18:21 +05:30
Nikhil Ramakrishnan 53c69ce04f * docs/reference: Add resources for `docwriter'.
Add the required resources (images, JS, CSS) for `docwriter'.

* docs/reference/.gitignore: Update to ignore `site' folder and other
files generated by docwriter.

* docs/reference/README: Add docwriter usage information and
troubleshooting tips.

* docs/reference/markdown: New directory to hold generated markdown
files and other resources.
2018-08-25 16:17:52 +05:30
Nikhil Ramakrishnan ae5d1a4cec * include/*.*: Convert comments to markdown.
This commit was created by applying scripts `markify.py' and
`markdown-format.bash' to all C header files, followed by minor
clean-up.

No change in functionality, of course.

Scripts used:
https://github.com/nikramakrishnan/freetype-docs.git: Commit dfce31e.

http://lists.nongnu.org/archive/html/freetype-devel/2018-08/msg00013.html:
With patches applied.
2018-08-25 16:16:56 +05:30
Werner Lemberg 77f0814a31 Add macros for handling over-/underflowing `FT_Int64' values.
* include/freetype/internal/ftcalc.h (ADD_INT64, SUB_INT64,
MUL_INT64, DIV_INT64) [FT_LONG64]: New macros.

* src/base/ftcalc.c (ft_corner_orientation) [FT_LONG64]: Use
`SUB_INT64' and `MUL_INT64'.

Reported as

  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=10028
2018-08-23 17:53:54 +02:00
Werner Lemberg c90cc6443b ftbitmap.h: Improve documentation. 2018-08-23 13:13:20 +02:00
Werner Lemberg 45524679c6 [truetype] Improve legibility of `glyf' parsing.
* src/truetype/ttgload.c (ON_CURVE_POINT, X_SHORT_VECTOR,
Y_SHORT_VECTOR, REPEAT_FLAG, X_POSITIVE, SAME_X, Y_POSITIVE, SAME_Y,
OVERLAP_SIMPLE): New macros.
(TT_Load_Simple_Glyph): Use new macros to make code more readable.
Remove useless adjustment of `outline->tags' elements.
2018-08-22 10:31:05 +02:00
Werner Lemberg a3e842f9c6 Minor formatting and documentation fixes. 2018-08-22 10:30:08 +02:00
Werner Lemberg 0a33b44e6e * src/sfnt/ttcpal.c (tt_face_load_cpal): Add missing safety check.
Reported as

  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=9981
2018-08-21 10:52:14 +02:00
Werner Lemberg 4873eb1d31 Update `CHANGES' file. 2018-08-19 07:27:21 +02:00
Werner Lemberg 4dc0d48f7b [psaux] Avoid slow PS font parsing in case of error.
Reported as

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

* src/psaux/psobjs.c (ps_parser_to_bytes): Set `parser->cursor' even
in case of error to avoid potential re-scanning.
2018-08-18 14:39:20 +02:00
Werner Lemberg 2550fc75a5 [cff] Fix heap buffer overflow in old engine.
Reported as

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

* src/psaux/cffdecode.c (cff_decoder_parse_charstrings)
<cff_op_blend> [CFF_CONFIG_OPTION_OLD_ENGINE]: `num_designs' must be
non-zero.
2018-08-18 13:38:48 +02:00
Young Xiao c94162a220 * builds/mac/ftmac.c (parse_fond): Fix buffer overrun.
Reported as bug #54515, duplicate of #43540.
2018-08-16 08:25:47 -04:00
Werner Lemberg 33cd1eedcf * builds/*/ftsystem.c (FT_COMPONENT): Updated also. 2018-08-16 05:55:18 +02:00
Alexei Podtelezhnikov efa2a3babf Revert BDF copyright years. 2018-08-15 23:49:07 -04:00
Alexei Podtelezhnikov af9662e60b Ouch. BDF copyright year. 2018-08-15 22:58:11 -04:00
Alexei Podtelezhnikov 923fcbcdd8 [bdf] Don't track duplicate encodings.
There is no harm except some umbiguity in broken fonts with duplicate
encodings.

* src/bdf/bdflib.c (_bdf_parse_glyphs): Remove duplicate tracking.
(_bdf_parse_t): Remove large `have' bitfield.
2018-08-15 22:50:06 -04:00
Werner Lemberg a0dd16fb3d Don't use `trace_' prefix for FT_COMPONENT arguments.
* include/freetype/internal/ftdebug.h (FT_TRACE_COMP,
FT_TRACE_COMP_): New auxiliary macros to add `trace_' prefix.
(FT_TRACE): Use `FT_TRACE_COMP'.

*/* (FT_COMPONENT): Updated.
2018-08-15 18:13:17 +02:00
Werner Lemberg 1d7b034cd8 Use formatting string in FT_TRACEX calls for non-simple arguments.
* src/psaux/cffdecode.c (cff_decoder_parse_charstrings)
<cff_op_hstem, cff_op_hintmask, cff_op_hlineto, cff_op_vhcurveto>:
Do it.

* src/psaux/pshints.c (cf2_hintmap_build): Ditto.

* src/psaux/psintrp.c (cf2_interpT2CharString) <cf2_cmdHSTEM,
cf2_cmdVSTEM, cf2_cmdHLINETO, cf2_cmdRRCURVETO, cf2_cmdCALLSUBR,
cf2_escHSTEM3, cf2_cmdHINTMASK, cf2_cmdHVCURVETO>: Ditto.

* src/truetype/ttinterp.c (TT_RunIns): Ditto.
2018-08-14 15:56:28 +02:00
Alexei Podtelezhnikov e001a17d73 [bdf] Remove unused fields.
* src/bdf/bdf.h (bdf_font_t): Remove `nmod', `umod', and `modified',
which were set but never used.
* src/bdf/bdflib.c (_bdf_parse_{glyphs,properties}, bdf_load_font):
Updated accordingly.
2018-08-14 07:10:57 -04:00
Werner Lemberg 44db1addd8 [cff] Fix another segv in old engine.
Reported as

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

* src/psaux/cffdecode.c (cff_decoder_parse_charstrings)
[CFF_CONFIG_OPTION_OLD_ENGINE]: Disallow invalid T1 opcodes in
dictionaries.
2018-08-14 10:01:00 +02:00
Werner Lemberg 1937b55734 [cff] Fix missing error handling.
Reported as

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

* src/psaux/cffparse.c (cff_parser_run)
[CFF_CONFIG_OPTION_OLD_ENGINE]: Don't ignore return value of
`parse_charstrings_old'.
2018-08-14 07:54:25 +02:00
Alexei Podtelezhnikov ac2ea865f3 [bdf] Remove unused overflow storage.
* src/bdf/bdf.h (bdf_glyphlist_t): Remove this type.
(bdf_font_t): Remove `overflow' field.
* src/bdf/bdflib.c (bdf_free_font): Remove `overflow' freeing.
2018-08-13 21:33:24 -04:00
Werner Lemberg 757bdf1aef [cff] Fix segv.
Reported as

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

* src/psaux/cffdecode.c (cff_decoder_parse_charstrings)
<cff_op_random> [CFF_CONFIG_OPTION_OLD_ENGINE]: Use top dict's
`random' field directly if parsing dictionaries.
2018-08-14 02:02:26 +02:00
Alexei Podtelezhnikov f5fe6e2f17 [bdf] Use unsigned types.
* src/bdf/bdf.h (bdf_glyph_t): Unsign `encoding'.
(bdf_font_t): Unsign `default_char'.
* src/bdf/bdfdrivr.h (BDF_encoding_el): Unsign `enc'.

* src/bdf/bdflib.c (_bdf_add_property, _bdf_parse_glyphs,
_bdf_parse_start): Updated accordingly.
* src/bdf/bdfdrivr.c (bdf_cmap_char_{index,next}): Ditto.
2018-08-13 09:01:53 -04:00
Werner Lemberg 50486df1e6 * src/type42/t42parse.c (t42_parse_sfnts): One more format check.
Reported as

  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=9832
2018-08-13 08:46:53 +02:00
Armin Hasitzka 37c7b81794 Remove deprecated constant in documentation.
* include/freetype/ftdriver.h: Suggest using `FT_HINTING_ADOBE' since
`FT_CFF_HINTING_ADOBE' is deprecated.
2018-08-12 01:42:00 +02:00
Werner Lemberg 5b904409fc * src/base/ftcalc.c (FT_Matrix_Check): Fix integer overflow.
Reported as

  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=9811
2018-08-11 06:41:35 +02:00
Alexei Podtelezhnikov 88c0e12109 * src/sfnt/ttsbit.c (tt_sbit_decoder_load_compound): Follow specs. 2018-08-10 21:24:40 -04:00
Ben Wagner 96b5e50090 * src/sfnt/sfobjs.c (sfnt_done_face): Fix memory leak (#54435). 2018-08-10 22:24:26 +02:00
Nikhil Ramakrishnan 1a21ca7b91 Minor formatting. 2018-08-10 19:32:31 +05:30
Werner Lemberg 1aa73fa83d * src/base/ftobjs.c (FT_Render_Glyph_Internal): Improve tracing. 2018-08-10 05:41:32 +02:00
Werner Lemberg c8ef0fd07c Fix clang warnings.
* src/base/ftdebug.c (ft_trace_level_enabled,
ft_trace_level_disabled): Add `static' keyword.
2018-08-10 04:44:22 +02:00
Alexei Podtelezhnikov e16bfbec4c [raster, smooth] Reinstate bitmap size limits.
This again moves outline and bitmap size checks one level up.

* src/base/ftoutln.c (FT_Outline_Render): Explicitly reject enormous
outlines.
* src/raster/ftrend1.c (ft_raster1_render): Reject enormous bitmaps
and, therefore, outlines that require them.
* src/smooth/ftsmooth.c (ft_smooth_render_generic): Ditto.

* src/raster/ftraster.c (ft_black_render): Remove outline size checks.
* src/smooth/ftgrays.c (gray_raster_render): Ditto.
[STANDALONE]: Remove `FT_Outline_Get_CBox' copy.
2018-08-09 22:18:00 -04:00
Alexei Podtelezhnikov 6a97c95800 [pcf] Revert massive unsigning. 2018-08-08 22:17:35 -04:00
Werner Lemberg f60c98feaf [smooth] Improve tracing.
* src/smooth/ftgrays.c (gray_convert_glyph_inner): Only use tracing
if called the first time.
(gray_convert_glyph): Updated.
2018-08-08 18:15:53 +02:00
Werner Lemberg c9bbc2419a Add internal functions `FT_Trace_Disable' and `FT_Trace_Enable'.
It sometimes makes sense to suppress tracing informations, for
example, if it outputs identical messages again and again.

* include/freetype/internal/ftdebug.h: Make `ft_trace_levels' a
pointer.
(FT_Trace_Disable, FT_Trace_Enable): New declarations.

* src/base/ftdebug.c (ft_trace_levels): Rename to...
(ft_trace_levels_enabled): ... this.
(ft_trace_levels_disabled): New array.
(ft_trace_levels): New pointer.
(FT_Trace_Disable, FT_Trace_Enable): Implement.
(ft_debug_init): Updated.
2018-08-08 18:12:31 +02:00
Werner Lemberg 2e3dec5509 Debugging improvements.
* src/base/ftobjs.c (pixel_modes): Move this array to top level
from ...
(FT_Load_Glyph): ... here.
(FT_Render_Glyph_Internal): Use `width' x `height' in trace message.
Use `pixel_modes'.
2018-08-08 13:51:18 +02:00
Alexei Podtelezhnikov c633378a5e [pcf] Massive unsigning (part 2).
Treat all size related properties as unsigned values.

* src/pcf/pcf.h (PCF_ParsePropertyRec): Use unsigned `name' and
`value'.
* src/pcf/pcfread.c (pcf_get_propeerties, pcf_load_font): Updated
parsing code and handling of AVERAGE_WIDTH, POINT_SIZE, PIXEL_SIZE,
RESOLUTION_X and RESOLUTION_Y.
2018-08-08 01:21:54 -04:00
Alexei Podtelezhnikov 3d4ab6bac1 [pcf] Massive unsigning (part 1).
Unofficial specifications hesitate to use unsigned 32-bit integers.
Negative values caused a lot of trouble in the past and it is safer
and easier to treat some properties as unsigned.

* src/pcf/pcf.h (PCF_AccelRec): Use unsigned values for `fontAscent',
`fontDescent', and `maxOverlap'.
* src/pcf/pcfread.c (pcf_load_font, pcf_get_accel): Updated.
* src/pcf/pcfdrivr.c (PCF_Glyph_Load, PCF_Size_Select,
PCF_Size_Request): Updated.
2018-08-08 00:09:16 -04:00
Alexei Podtelezhnikov 705bac50d3 * src/pcf/pcfread.c (pcf_get_bitmaps): Unsign `offsets' and `bitmapSizes'. 2018-08-07 22:49:55 -04:00
Werner Lemberg 7ec9598f47 More comment formattings.
This helps in the forthcoming transition to markdown syntax.
2018-08-06 17:35:14 +02:00
Werner Lemberg b09e773591 * devel/ftoption.h: Synchronize with main `ftoption.h'. 2018-08-06 11:02:51 +02:00
Alexei Podtelezhnikov f24dbb2811 [pcf] Use unsigned types.
* src/pcf/pcf.h (PCF_Encoding): Use unsigned `enc'.
* src/pcf/pcfdrivr.c (pcf_cmap_char_{index,next}): Ditto.
* src/pcf/pcfread.c (pcf_get_encodings): Use unsigned types.
2018-08-06 04:58:18 -04:00
Werner Lemberg 86e7385342 Minor comment formatting. 2018-08-06 10:24:08 +02:00
Werner Lemberg 720ae67f35 * src/truetype/ttgload.c (compute_glyph_metrics): Fix overflow.
Reported as

  https://bugs.chromium.org/p/chromium/issues/detail?id=777151
2018-08-05 07:21:10 +02:00
Werner Lemberg ced9c311f6 Ditto. 2018-08-04 07:03:57 +02:00
Werner Lemberg be81acc4bf * src/truetype/ttinterp.c (opcode_name): Fix typos. 2018-08-04 07:01:04 +02:00
Werner Lemberg 799d27b0b6 Fix clang warnings.
* src/base/ftoutln.c (FT_Outline_EmboldenXY): Fix type of
`orientation'.

* src/gxvalid/gxvcommn.c (gx_lookup_value_read): Fix signature.

* src/pcf/pcfread.c (pcf_get_encodings): Fix type of some variables.
Add cast.

* src/type1/t1load.c (parse_weight_vector): Fix cast.
2018-08-04 06:39:11 +02:00
Werner Lemberg 1897186fb7 * src/cid/cidtoken.h: Handle `XUID' keyword. 2018-07-31 10:48:07 +02:00
Werner Lemberg 8e57746c4b [cid] Trace PostScript dictionaries.
* src/cid/cidload.c: Include FT_INTERNAL_POSTSCRIPT_AUX_H
(cid_load_keyword, cid_parse_font_matrix, parse_fd_array,
parse_expansion_factor, cid_parse_dict): Add tracing calls.
(parse_font_name): New function to trace `/FontName' keywords in
/FDArray dict.
(cid_field_records): Register `parse_font_name'.
2018-07-31 10:46:57 +02:00
Werner Lemberg 85e8bea4fd Minor documentation improvement. 2018-07-31 10:42:21 +02:00
Werner Lemberg 578bcf103a [cff] Fix typo.
Reported as

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

* src/cff/cffdrivr.c (cff_get_cid_from_glyph_index): Fix boundary
check.
2018-07-30 11:28:04 +02:00
Werner Lemberg 00968d8fd6 * src/pcf/pcfread.c (pcf_get_encodings): Another thinko.
Reported as

  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=9608
2018-07-29 10:22:59 +02:00
Alexei Podtelezhnikov 0f8aebfd51 * builds/unix/configure.raw: Minor. 2018-07-28 23:21:28 -04:00
Alexei Podtelezhnikov 2c3e895c74 [smooth] Fix Harmony memory management.
Reported as

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

* src/smooth/ftgrays.c (ft_smooth_render_generic): Restore buffer
after each rendering in case of failure.
2018-07-28 22:00:59 -04:00
Werner Lemberg 6e44d78cc1 [type1] Avoid segfaults with `FT_Get_PS_Font_Value'.
Reported as

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

* src/type1/t1driver.c (t1_ps_get_font_value): Protect against NULL.
2018-07-28 22:23:16 +02:00
Werner Lemberg c9edca8ee9 [truetype] Make `TT_Set_MM_Blend' idempotent (#54388).
* src/truetype/ttgxvar.c (tt_set_mm_blend): Correctly set
`face->doblend' if the current call to the function yields the same
blend coordinates as the previous call.
2018-07-27 10:44:01 +02:00
Werner Lemberg d277bfc985 [psaux, type1]: More tracing improvements.
* src/psaux/psintrp.c (cf2_interpT2CharString): Trace skipped
outline commands.

* src/psaux/t1decode.c (t1_decoder_parse_charstring): Fix
missing case.
(t1_decoder_parse_metrics): Make tracing output more compact.

* src/type1/t1gload.c (T1_Compute_Max_Advance): Be less verbose.
(T1_Get_Advances): Add tracing.
2018-07-27 09:15:43 +02:00
Werner Lemberg 6e6acdcb0e Document FT_Module_Class's `module_interface' field. 2018-07-26 07:22:43 +02:00
Werner Lemberg 8ed5346877 [psaux, type1] Trace PostScript dictionaries and other things.
The tracing of /Encoding, /Subrs, and /Charstrings is rudimentary
right now.

* src/psaux/psobjs.c (ps_parser_load_field,
ps_parser_load_field_table): Add tracing calls.

* src/psaux/t1decode.c (t1_decoder_parse_charstrings): Make tracing
output more compact.

* src/type1/t1gload.c (T1_Compute_Max_Advance, T1_Get_Advances): Add
tracing messages.

* src/type1/t1load.c (parse_blend_axis_types,
parse_blend_design_positions, parse_blend_design_map,
parse_weight_vector, t1_load_keyword, t1_parse_font_matrix,
parse_encoding, parse_subrs, parse_charstrings, T1_Open_Face): Add
tracing calls.

* src/type1/t1objs.c (T1_Face_Init): Add tracing call.

* src/sfnt/sfobjs.c (sfnt_init_face): Make tracing message more
verbose.
2018-07-25 22:07:22 +02:00
Werner Lemberg 580c94d8f7 Fix minor ASAN run-time warnings.
* src/base/ftutil.c (ft_mem_alloc, ft_mem_realloc): Only call
`FT_MEM_ZERO' if we actually have a buffer.
(ft_mem_dup): Only call `ft_memcpy' if we actually have a buffer.
2018-07-25 07:03:07 +02:00
Alexei Podtelezhnikov 4b97ab98a8 [build] Fortify dllexport/dllimport attributes (#53969,#54330).
We no longer use predefined _DLL, which can be defined for static
builds too with /MD. We use DLL_EXPORT and DLL_IMPORT instead,
following libtool convention.

* CMakeLists.txt [WIN32], builds/windows/vc2010/freetype.vcxproj:
Define DLL_EXPORT manually.

* include/freetype/config/ftconfig.h, builds/unix/ftconfig.in,
builds/vms/ftconfig.h, builds/windows/vc2010/index.html,
src/base/ftver.rc: /_DLL/d, s/FT2_DLLIMPORT/DLL_IMPORT/.
2018-07-24 23:01:34 -04:00
Werner Lemberg d8ea52dee5 [type1] Check relationship between number of axes and designs.
For Multiple Masters fonts We don't support intermediate designs;
this implies that

  number_of_designs == 2 ^^ number_of_axes

Reported as

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

* src/type1/t1load.c (T1_Open_Face): Ensure above constraint.
(T1_Get_MM_Var): Remove now redundant test.
2018-07-24 23:03:06 +02:00
Hin-Tak Leung 71e29fe1c9 [truetype] Match ttdebug's naming of instruction mnemonics.
* src/truetype/ttinterp.c: The form used in ttdebug,
"MDRP[G,B,W,?]", etc., is slightly more readable than
"MDRP[00,01,02,03]".
2018-07-24 10:04:23 +02:00
Werner Lemberg ff1c28f6c0 * src/pcf/pcfread.c (pcf_get_encodings): Thinko.
Reported as

  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=9561
2018-07-24 09:59:23 +02:00
Werner Lemberg b98133a4e9 * src/pcf/pcfread.c (pcf_get_encodings): Check index of defaultChar.
Reported as

  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=9527
2018-07-22 13:06:20 +02:00
Werner Lemberg 9be385c94d * src/pcf/pcfread.c (pcf_load_font): Fix number of glyphs.
This is an oversight of the module change 2018-07-21.

Reported as

  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=9524
2018-07-22 12:49:25 +02:00
Werner Lemberg a5acdce100 [cid] Sanitize `BlueShift' and `BlueFuzz'.
This code is taken from the type1 module.

Reported as

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

* src/cid/cidload.c (parse_fd_array): Set some private dict default
values.
(cid_face_open): Do the sanitizing.
Fix some tracing messages.
2018-07-22 12:11:52 +02:00
Werner Lemberg 5434faadf4 Fix links.
Reported by Ankit and Nikhil.
2018-07-22 07:34:53 +02:00
Werner Lemberg 9395558533 Minor comment improvement. 2018-07-21 23:46:19 +02:00
Werner Lemberg cba72a0b0f [pcf] Fix handling of the undefined glyph.
This change makes the driver use the `defaultChar' property of PCF
files.

* src/pcf/pcf.h (PCF_FaceRec): Change type of `defaultChar' to
unsigned.

* src/pcf/pcfread.c (pcf_get_encodings): Read `defaultChar' as
unsigned.
Validate `defaultChar'.
If `defaultChar' doesn't point to glyph index zero, swap glyphs with
index zero and index `defaultChar' and adjust the encodings
accordingly.

* src/pcf/pcfdrivr.c (pcf_cmap_char_index, pcf_cmap_char_next,
PCF_Glyph_Load): Undo change from 2002-06-16 which always enforced
the first character in the font to be the default character.
2018-07-21 23:45:32 +02:00
Werner Lemberg a2370f21b5 Improve stream extraction macro documentation. 2018-07-21 07:38:13 +02:00
Armin Hasitzka 154832d466 Move the legacy fuzz target to the `freetype-testing' repository.
It can now be found at

  https://github.com/freetype/freetype2-testing/tree/master/fuzzing/src/legacy

* src/tools/ftfuzzer: Remove this folder and its contents from the
repository.
2018-07-20 19:32:13 +02:00
Werner Lemberg 14032290bf [cff] Avoid left-shift of negative numbers (#54322).
* src/cff/cffgload.c (cff_slot_load): Use multiplication.
2018-07-20 06:44:13 +02:00
Werner Lemberg 8f09eb5ce0 Allow FT_ENCODING_NONE for `FT_Select_Charmap'.
This is a valid encoding tag for BDF, PCF, and Windows FNT, and
there is no reason to disallow it for these formats.

* src/base/ftobjs.c (FT_Select_Charmap): Implement it.
2018-07-17 21:45:24 +02:00
Werner Lemberg 9e69987aaa * src/pcf/pcfread.c (pcf_get_encodings): Trace `defaultChar'. 2018-07-17 19:54:25 +02:00
Armin Hasitzka fda356b742 * include/freetype/internal/ftcalc.h: Add macros for handling
harmless over-/underflowing `FT_Int' values.

* src/sfnt/sfdriver.c (fixed2float): Fix negation of
`(int)(-2147483648)'.

Reported as

  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=9423
2018-07-16 18:45:23 +02:00
Werner Lemberg 839cb404cf * src/truetype/ttgxvar.c (tt_set_mm_blend): Fix off-by-one error.
Reported as

  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=9412
2018-07-16 05:47:27 +02:00
Werner Lemberg 9f15370e56 * src/base/ftoutln.c (FT_Outline_Get_Orientation): Init `cbox'.
Taken from patch #9667, written by Steve Langasek
<vorlon@debian.org>.

This fixes a build failure (most probably a bug in gcc) on ppc64el
when building with -O3.
2018-07-12 07:31:26 +02:00
Werner Lemberg b532d7ce70 Fix typo (#54238).
* src/base/ftcolor.c (FT_Palette_Set_Foreground_Color)
[!TT_CONFIG_OPTION_COLOR_LAYERS]: Add return value.
2018-07-05 23:13:35 +02:00
Werner Lemberg 0767d5362f Adjust table size comparisons (#54242).
* src/sfnt/ttcpal.c (tt_face_load_cpal): Implement it.
2018-07-05 23:05:53 +02:00
Werner Lemberg 6ceeb87f5d Fix more 32bit issues (#54208)
* src/cff/cffload.c (cff_blend_build_vector): Convert assertion into
run-time error.

* src/truetype/ttgxvar.c (ft_var_to_normalized): Protect against
numeric overflow.
2018-07-05 22:31:10 +02:00
Werner Lemberg 29f05fd02d Fix 32bit build warnings (#54239).
* src/base/ftbitmap.c (FT_Bitmap_Blend): Add casts to avoid signed
vs. unsigned comparisons.

* srb/sfnt/ttcolr.c (tt_face_get_colr_layer): Ditto.
2018-07-04 11:49:47 +02:00
Jeff Carey d9d300ab6b * src/psnames/psmodule.c (ps_unicodes_init): Fix alloc debugging. 2018-07-02 22:27:57 +02:00
Werner Lemberg 396051daee s/xxx specific foo/xxx-specific foo/. 2018-07-02 15:52:36 +02:00
Werner Lemberg 7edc937fe6 s/palette_types/palette_flags/.
Suggested by Behdad.
2018-07-02 11:50:04 +02:00
Werner Lemberg 4e3b2473d8 Make `FT_Get_Color_Glyph_Layer' return FT_Bool.
* include/freetype/freetype.h, src/base/ftobjs.c
(FT_Get_Color_Glyph_Layer, FT_Render_Glyph_Internal): Updated.

* include/freetype/internal/sfnt.h (TT_Get_Colr_Layer_Func),
src/sfnt/ttcolr.h, src/sfnt/ttcolr.c (tt_face_get_colr_layer):
Updated.
2018-07-02 11:41:44 +02:00
Werner Lemberg f6ccb524af * src/base/ftobjs.c (FT_Get_Color_Glyph_Layer): Guard SFNT function.
Reported by Behdad.
2018-07-01 12:31:57 +02:00
Alexei Podtelezhnikov 1fc776b5f1 * src/base/fttrigon.c (FT_Tan): Improve accuracy.
(FT_Vector_Rotate): Simplify.
2018-06-28 21:42:26 -04:00
Alexei Podtelezhnikov 4f11209f5c * src/base/ftobjs.c (FT_Set_Charmap): Robustify. 2018-06-28 21:31:35 -04:00
Werner Lemberg 207ca38fb5 [truetype] Fix memory leak.
* src/truetype/ttgxvar.c (TT_Vary_Apply_Glyph_Deltas): Add initializers.
Fix typo in `goto' destination.

Reported as

  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=9071
2018-06-25 18:50:00 +02:00
Werner Lemberg 589d1f0899 * src/truetype/ttgxvar.c (tt_face_vary_cvt): Add initializers.
Reported as

  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=9070
2018-06-25 18:38:04 +02:00
Werner Lemberg a632fb547e [truetype] Increase precision while applying VF deltas.
It turned out that we incorrectly round CVT and glyph point deltas
before accumulation, leading to severe positioning errors if there
are many delta values to sum up.

Problem reported by Akiem Helmling <akiem@underware.nl> and analyzed
by Behdad.

* src/truetype/ttgxvar.c (ft_var_readpackeddelta): Return deltas in
16.16 format.
(tt_face_var_cvt): Collect deltas in `cvt_deltas', which is a 16.16
format array, and add the accumulated values to the CVT at the end
of the function.
(TT_Vary_Apply_Glyph_Deltas): Store data in `points_org' and
`points_out' in 16.16 format.
Collect deltas in `point_deltas_x' and `point_deltas_y', which are
16.16 format arrays, and add the accumulated values to the glyph
coordinates at the end of the function.
2018-06-24 15:22:10 +02:00
Werner Lemberg cc3333902b New base function `FT_Matrix_Check' (#54019).
* src/base/ftcalc.c (FT_Matrix_Check): New base function to properly
reject degenerate font matrices.

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

* src/cff/cffparse.c (cff_parse_font_matrix), src/cid/cidload.c
(cid_parse_font_matrix), src/type1/t1load.c (t1_parse_font_matrix),
src/type42/t42parse.c (t42_parse_font_matrix): Use
`FT_Matrix_Check'.
2018-06-24 06:26:09 +02:00
Werner Lemberg d7393e22ee Fix typo.
Reported by Behdad.

* src/base/ftcolor.c (FT_Palette_Data_Get)
[!TT_CONFIG_OPTION_COLOR_LAYERS]: s/apalette/apalette_data/.
2018-06-23 17:25:58 +02:00
Werner Lemberg 9027233f75 s/FT_PALETTE_USABLE_WITH_/FT_PALETTE_FOR_/.
* include/freetype/ftcolor.h, include/freetype/internal/sfnt.h,
src/sfnt/ttcolr.c: Do it.
2018-06-21 00:21:09 +02:00
Werner Lemberg a6b77ba2b3 [sfnt] Fix CPAL heap buffer overflow.
Reported as

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

* src/sfnt/ttcpal.c (tt_face_load_cpal): Guard CPAL version 1
offsets.
2018-06-19 20:09:31 +02:00
Werner Lemberg 7915fd51f1 Doh. Don't use CPAL or COLR data if tables are missing.
Reported by Alexei.

* src/sfnt/ttcolr.c (tt_face_get_colr_layer): Return immediately if
`colr' is NULL.

* src/sfnt/ttcpal.c (tt_face_palette_set): Return immediately, if
`cpal' is NULL.
2018-06-19 07:15:21 +02:00
Werner Lemberg a56e4bf7a2 Oops! 2018-06-18 23:18:07 +02:00
Nikhil Ramakrishnan 779c8c4050 Some more minor doc fixes. 2018-06-18 15:17:13 +05:30
Werner Lemberg 95f7341d81 More minor doc fixes. 2018-06-18 11:10:14 +02:00
Werner Lemberg ce8517b474 Minor documentation fixes. 2018-06-18 10:22:42 +02:00
Werner Lemberg 877d80944b Introduce `@example:' subsections. 2018-06-18 10:08:17 +02:00
Werner Lemberg fc40469a6f Add example for `FT_Get_Color_Glyph_Layer'. 2018-06-18 09:23:18 +02:00
Alexei Podtelezhnikov b1a3c59f8d [base] Introduce `FT_New_Glyph'.
This function facilitates access to full capabilities of FreeType
rendering engine for custom glyphs. This can be quite useful for
consistent rendering of mathematical and chemical formulas, e.g.

  https://bugs.chromium.org/p/chromium/issues/detail?id=757078

* include/freetype/ftglyph.h, src/base/ftglyph.c (FT_New_Glyph): New
function.
2018-06-17 22:33:29 -04:00
Nikhil Ramakrishnan e13599a036 Change documentation markup tags to lowercase.
Implemented as per discussion in

  http://lists.nongnu.org/archive/html/freetype-devel/2018-06/msg00073.html

No change in functionality, of course.
2018-06-18 03:40:29 +05:30
Werner Lemberg d573a46f77 Typo. 2018-06-17 23:23:36 +02:00
Armin Hasitzka 0f6be06444 [bdf] Fix underflow of an unsigned value.
bdflib.c:1562 could be reached with `font->glyphs_used == 0'.  That
caused an underflow of the unsigned value which results in undefined
behaviour.

* src/bdf/bdflib.c (src/bdf/bdflib.c): Bail out earlier than before
if the `ENCODING' keyword cannot be found.
2018-06-17 20:27:42 +02:00
Werner Lemberg 19d8687f0b Fix documentation indentation; s/@const/@enum/; harmonize doc keywords. 2018-06-17 11:22:37 +02:00
Werner Lemberg da84691914 [base] Add tracing for `FT_Bitmap_Blend'.
* include/freetype/internal/fttrace.h (trace_bitmap): New
enumeration.

* src/base/ftbitmap.c (FT_COMPONENT): Define.
(FT_Bitmap_Blend): Add `FT_TRACE5' calls.
2018-06-17 09:30:05 +02:00
Werner Lemberg e361cc6a75 s/trace_bitmap/trace_checksum/.
* include/freetype/internal/fttrace.h: s/bitmap/checksum/.

* src/base/ftobjs.c (FT_COMPONENT): s/trace_bitmap/trace_checksum/.
Adjust code.
2018-06-17 09:13:37 +02:00
Werner Lemberg 9960e7beab [sfnt] Fix color glyph layer loading.
* src/sfnt/ttcolr.c (Colr): Add `table_size' field.
(tt_face_load_colr): Set it.
(tt_face_get_colr_layer): Check pointer limit for layer entries.
2018-06-16 22:16:03 +02:00
Werner Lemberg 1079063701 [sfnt] Fix color palette loading.
Reported as

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

* src/sfnt/ttcpal.c (Cpal): Add `table_size' field.
(tt_face_load_cpal): Set it.
(tt_face_palette_set): Check pointer limit for color entries.
2018-06-16 21:45:13 +02:00
Werner Lemberg 8f403ab8a8 Minor formatting. 2018-06-16 21:30:24 +02:00
Nikhil Ramakrishnan a150b5ab53 Minor formatting. 2018-06-16 15:53:15 +05:30
Werner Lemberg 9d8e6c2980 * src/base/ftbitmap.c (FT_Bitmap_Blend): Avoid integer overflow. 2018-06-16 10:11:58 +02:00
Werner Lemberg 68bc56f864 Add `FT_Bitmap_Blend' API.
Still missing: Support for negative bitmap pitch and subpixel offset
of source bitmap.

* include/freetype/ftbitmap.h, src/base/ftbitmap.c
(FT_Bitmap_Blend): New function.
2018-06-16 09:39:29 +02:00
Werner Lemberg 9b31c44620 Replace `FT_Get_GlyphLayers' with `FT_Get_Color_Glyph_Layer'.
This avoids any additional allocation of COLR related structures in
a glyph slot.

* include/freetype/freetype.h (FT_Glyph_Layer, FT_Glyph_LayerRec,
FT_Get_GlyphLayers): Removed.

* include/freetype/internal/ftobjs.h (FT_Colr_InternalRec): Removed.
(FT_Slot_InternalRec): Remove `color_layers'.

* include/freetype/internal/sfnt.h (TT_Load_Colr_Layer_Func):
Removed.
(SFNT_Interface, FT_DEFINE_SFNT_INTERFACE): Remove
`load_colr_layer'.

* src/base/ftobjs.c (ft_glyph_slot_done): Updated.
(FT_Render_Glyph_Internal): Use `FT_Get_Color_Glyph_Layer'.
(FT_Get_GlyphLayers): Removed.

* src/sfnt/sfdriver.c (sfnt_interface): Updated.

* src/sfnt/ttcolr.c (tt_face_load_colr_layers): Removed.
* src/sfnt/ttcolr.h: Updated.

* src/truetype/ttgload.c (TT_Load_Glyph): Updated.
2018-06-14 21:30:43 +02:00
Werner Lemberg f9d05eb326 Provide iterative API to access `COLR' data.
This solution doesn't store any data in an `FT_GlyphSlot' object.

* include/freetype/freetype.h (FT_LayerIterator): New structure.
(FT_Get_Color_Glyph_Layer): New function.

* include/freetype/internal/sfnt.h (TT_Get_Colr_Layer_Func): New
function type.
(SFNT_Interface, FT_DEFINE_SFNT_INTERFACE): Add it.

* src/base/ftobjs.c (FT_Get_Color_Glyph_Layer): Implement it.

* src/sfnt/ttcolr.c (tt_face_get_colr_layer): New function.
* src/sfnt/ttcolr.h: Updated.

* src/sfnt/sfdriver.c (sfnt_interface): Updated.
2018-06-14 21:17:17 +02:00
Werner Lemberg 33ac83e376 Add glyph index and glyph load flags to glyph slot.
* include/freetype/freetype.h (FT_GlyphSlotRec): Rename unused
`reserved' field to `glyph_index'.

* include/freetype/internal/ftobjs.h (FT_Slot_InternalRec): Add
`load_flags' field.

* src/base/ftobjs.c (FT_Load_Glyph): Set new fields.
2018-06-14 21:00:23 +02:00
Werner Lemberg a44e20879c [sfnt] Move `CPAL' stuff into separate files.
* src/sfnt/sfdriver.c: Include `ttcpal.h'.
* src/sfnt/sfnt.c: Include `ttcpal.c'.

* src/sfnt/ttcolr.c, src/sfnt/ttcolr.h: Move CPAL stuff to ...
* src/sfnt/ttcpal.c, src/sfnt/ttcpal.c: ... these new files.

* src/sfnt/Jamfile (_sources), src/sfnt/rules.mk (SFNT_DRV_SRC):
Updated.

* include/freetype/internal/fttrace.h: Add support for `colr' and
`cpal'.
Sort entries.
2018-06-14 11:32:47 +02:00
Werner Lemberg 54b332aaf9 [sfnt] Separate `CPAL' and `COLR' table handling.
Later on we want to support the `SVG' table also, which needs `CPAL'
(but not `COLR').

* include/freetype/internal/sfnt.h (SFNT_Interface): Add `load_cpal'
and `free_cpal' fields.
(FT_DEFINE_SFNT_INTERFACE): Updated.

* include/freetype/internal/tttypes.h (TT_FaceRec): Replace
`colr_and_cpal' fields with `cpal' and `colr'.

* src/sfnt/sfdriver.c (sfnt_interface): Updated.

* src/sfnt/sfobjs.c (sfnt_load_face, sfnt_done_face): Updated.

* src/sfnt/ttcolr.c (Colr, Cpal): Add `table' field.
(ColrCpal): Removed.
(tt_face_load_colr): Split off CPAL handling into...
(tt_face_load_cpal): ... this new function.
(tt_face_free_colr): Split off CPAL handling into...
(tt_face_free_cpal): ... this new function.
(tt_face_load_colr_layers, tt_face_palette_set): Updated.

* src/sfnt/ttcolr.h: Updated.

* src/truetype/ttgload.c (TT_Load_Glyph): Updated.
2018-06-13 08:46:27 +02:00
Werner Lemberg c07ca2a1b3 [sfnt] Fix `sizeof' thinko.
* src/sfnt/ttcolr.c (tt_face_load_colr, tt_face_palette_set): Don't
use `sizeof' for computing array limit.
2018-06-13 06:11:28 +02:00
Werner Lemberg 22d1be3f2c Finish CPAL/COLR support (4/4).
* src/sfnt/ttcolr.c (tt_face_find_color): Removed.
(tt_face_colr_blend_layer): Use `face->palette' instead of calling
`tt_face_find_color'.
Use and set text foreground color.
2018-06-13 06:11:28 +02:00
Werner Lemberg 45145d348f Finish CPAL/COLR support (3/4).
* src/base/ftcolor.c: Include FT_INTERNAL_SFNT_H.
(FT_Palette_Select, FT_Palette_Set_Foreground_Color): Implement
functions.
2018-06-13 06:11:28 +02:00
Werner Lemberg b85d4e8f04 Finish CPAL/COLR support (2/4).
* src/sfnt/ttcolr.c (tt_face_palette_set): New function.
(tt_face_load_colr): Allocate `face->palette' and call
`tt_face_palette_set'.
Adjust return error code in case of error.

* src/sfnt/ttcolr.h: Updated.

* include/freetype/internal/sfnt.h (TT_Set_Palette_Func): New
function type.
(SFNT_Interface, FT_DEFINE_SFNT_INTERFACE): Add it.

* src/sfnt/sfdriver.c (sfnt_interface), src/sfnt/sfobjs.c
(sfnt_done_face): Updated.
2018-06-13 06:11:28 +02:00
Werner Lemberg 7542f030ec Finish CPAL/COLR support (1/4).
* include/freetype/internal/tttypes.h (TT_FaceRec): New fields
`palette_index', `palette', `have_foreground_color' and
`foreground_color'.
2018-06-13 06:11:27 +02:00
Werner Lemberg 7de877bbc6 [sfnt] Minor.
* src/sfnt/ttcolr.c (tt_face_load_colr_layers):
s/palette_index/palette_entry_index/ for consistency.
Adjust return error code in case of error.
2018-06-13 06:11:27 +02:00
Alexei Podtelezhnikov 04338a5e52 Doc fixes and improvements. 2018-06-12 21:59:15 -04:00
Alexei Podtelezhnikov eaa5a42a12 [raster] Clean up.
* src/raster/ftraster.c (black_TWorker, SCALED, Set_High_Precision):
Clean up after 5-level gray removal (8dc8635874).
(Vertical_Sweep_Span): Be brief.
2018-06-11 21:56:23 -04:00
Werner Lemberg b18f5e7c62 Minor doc fixes. 2018-06-11 09:02:25 +02:00
Werner Lemberg a698dbf868 [sfnt] Fix compiler warnings.
* src/sfnt/ttcolr.c (tt_face_load_colr, tt_face_load_colr_layers,
tt_face_colr_blend_layer): Add `NULL' initializers.
2018-06-10 21:43:51 +02:00
Werner Lemberg d8b8b6e34e s/FT_Palette/FT_Palette_Data/, s/palette/palette_data/.
* include/freetype/ftcolor.h, include/freetype/internal/tttypes.h,
src/base/ftcolor.c, src/sfnt/sfobjs.c, src/sfnt/ttcolr.c: Updated.
2018-06-10 21:37:15 +02:00
Nikolaus Waxweiler bfbde7926f CMakeLists: also accept IOS_PLATFORM=SIMULATOR64
This might be needed to build FreeType for the iOS simulator. See
https://savannah.nongnu.org/bugs/index.php?54048. Patch contributed
by Steve Robinson.

* CMakeLists.txt: Accept IOS_PLATFORM=SIMULATOR64
2018-06-10 13:29:01 +01:00
Werner Lemberg 6732f05593 Implement `FT_Palette_Get'.
* src/base/ftcolor.c: New file.

* src/base/Jamefile (_sources), src/base/rules.mk (BASE_SRC),
src/base/ftbase.c: Add `ftcolor.c'.
2018-06-10 09:13:13 +02:00
Werner Lemberg 56be5f721b * src/sfnt/ttcolr.c (tt_face_load_colr): Improve overflow checks. 2018-06-10 06:59:39 +02:00
Alexei Podtelezhnikov 50fda0be3f [raster] Deal with pitch sign earlier.
* src/raster/ftraster.c (black_TWorker): Remove unused `traceG',
s/bTarget/bOrigin/.
(Render_Glyph): Set `ras.bOrigin' at the bottom-left corner.
(Vertical_Sweep_Init, {Vertical,Horizontal}_Sweep_{Span,Drop}):
Updated accordingly.
2018-06-09 22:52:43 -04:00
Werner Lemberg c412de52fb [sfnt] Read `CPAL' version 1 tables.
* include/freetype/internal.tttypes.h: Include FT_COLOR_H.
(TT_FaceRec): Add `palette' field.

* src/sfnt/ttcolr.c: Include FT_COLOR_H.
(Cpal): Remove all data covered by the new `palette' field in
`TT_FaceRec'.
(tt_face_load_colr): Updated.
Read `CPAL' version 1 data.
(tt_face_load_colr_layers, tt_face_find_color): Updated.

* src/sfnt/sfobjs.c (sfnt_done_face): Free glyph color palette data.
2018-06-09 23:56:21 +02:00
Alexei Podtelezhnikov 8f1ed54877 [base] API for Harmony LCD rendering.
This introduces `FT_Library_SetLcdGeometry' for setting up arbitrary
LCD subpixel geometry including non-striped patterns.

* src/base/ftlcdfil.c (FT_Library_SetLcdGeometry): New function.
* include/freetype/ftlcdfil.h: Document it.
* include/freetype/freetype.h: Minor.
* include/freetype/ftchapters.h: Minor.
2018-06-07 02:48:48 -04:00
Werner Lemberg 44580515d8 Minor. 2018-06-07 06:49:44 +02:00
Werner Lemberg f87ced9dc9 ftcolor.h: Redesign API.
While going to implement it I noticed that I need access to most of
the `CPAL' elements; I thus plan to add a `cpal' field to
`TT_FaceRec', which makes most of the previously suggested API
functions obsolete because the fields will be directly accessable.
2018-06-06 17:49:17 +02:00
Werner Lemberg 7c7004d60c New `ftcolor.h' draft. 2018-06-06 17:37:51 +02:00
Werner Lemberg 172904ee3a Minor. 2018-06-06 13:29:09 +02:00
Parth Wazurkar 89d2f42918 [bdf, pcf] Removed deprecated FT_FACE_FLAG_FAST_GLYPHS flag.
* src/bdf/bdfdrivr.c (BDF_Face_Init): Removed deprecated FT_FACE_FLAG_FAST_GLYPHS flag.

* src/pcf/pcfread.c  (pcf_load_font): Removed deprecated FT_FACE_FLAG_FAST_GLYPHS flag.
2018-06-06 16:53:54 +05:30
Werner Lemberg ca4e707aa1 [smooth, raster] Limit bitmap size (#54019).
* src/raster/ftraster.c [STANDALONE] (FT_Outline_Get_CBox): Add
function.
[!STANDALONE]: Include FT_OUTLINE_H.
(ft_black_render): Compute CBox and reject glyphs larger than
0xFFFF x 0xFFFF.

* src/smooth/ftgrays.c (gray_raster_render): Reject glyphs larger
than 0xFFFF x 0xFFFF.
2018-06-06 08:18:23 +02:00
Nikhil Ramakrishnan 78d85b9c84 Restore missing comment lines and other minor fixes 2018-06-04 20:33:56 +05:30
Sender Ghost cc62677224 Restore accidentally removed, commented-out configuration options. 2018-06-04 10:49:23 +02:00
Werner Lemberg f999375a9a [GSoC] include/*.*, devel/*.*: Convert block comments to `light' style.
This second and final monster commit was created by applying Nikhil's
scripts `docconverter.py' and `markify.py' to all C header and source files,
followed up by minor manual clean-up.

No change in functionality, of course.

I used commit f7419907bc6044b9b7057f9789866426c804ba82 from
https://github.com/nikramakrishnan/freetype-docs.git.
2018-06-03 22:00:42 +02:00
Werner Lemberg dc170dea33 Typos. 2018-06-03 21:23:52 +02:00
Armin Hasitzka 80ac364530 * src/smooth/ftgrays.c (gray_convert_glyph): Remove unused variables. 2018-06-03 18:31:58 +02:00
Werner Lemberg 64bf5d48eb Minor formatting. 2018-06-03 09:20:09 +02:00
Werner Lemberg 02842872de * src/tools/glnames.py (main): Emit header in `light' comment style. 2018-06-03 09:17:55 +02:00
Werner Lemberg 9ac9060df0 [GSoC] src/*.*: Convert block comments to `light' style.
This monster commit was created by applying Nikhil's scripts
`docconverter.py' and `markify.py' to all C header and source files,
followed up by minor manual clean-up.

No change in functionality, of course.

I used commit f7419907bc6044b9b7057f9789866426c804ba82 from
https://github.com/nikramakrishnan/freetype-docs.git.
2018-06-03 09:08:41 +02:00
Alexei Podtelezhnikov ae24803410 [smooth] Attempt to mitigate bug #54019.
The robust rendering of estra large glyphs came with unbearable cost.
The old way of bisecting should fail but fail faster.

* src/smooth/ftgrays.c (gray_convert_glyph): Switch back to bisecting
in y-direction.
2018-06-02 21:42:44 -04:00
Werner Lemberg 67994e8221 * src/truetype/ttinterp.c (Ins_MIRP): Use SUB_LONG; avoid FT_ABS.
Reported as

  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=8706
2018-06-02 19:51:03 +02:00
Werner Lemberg fab10b6fc2 * src/autofit/afwarp.h: Use AF_CONFIG_OPTION_USE_WARPER (#54033). 2018-06-02 09:53:58 +02:00
Werner Lemberg 125b84800a * src/raster/ftraster.c (black_TWorker_): Remove `gTarget' field.
This is no longer used.
2018-05-31 10:49:05 +02:00
Alexei Podtelezhnikov 250b0c624a Shorten LCD filtering docs. 2018-05-30 23:29:41 -04:00
Werner Lemberg 0589f6e6ee [sfnt] Get colors from `CPAL' table in right order (#54015).
* src/sfnt/ttcolr.c (tt_face_find_color): Fix it.
2018-05-31 00:34:38 +02:00
Werner Lemberg db7c406084 ftcolor.h: Improve API design, fix typos (#54011, #54014).
* include/freetype/ftcolor.h (FT_Palette_Get_Names): Replace with...
(FT_Palette_Get_Name_IDs): ... this function.
(FT_Palette_Get_Entry_Names): Replace with...
(FT_Palette_Get_Entry_Name_IDs): ... this function
s/FT_Palette_Set_Foreground_COlor/FT_Palette_Set_Foreground_Color/.
2018-05-30 21:23:10 +02:00
Armin Hasitzka d45d4b97e6 Beautify a3cfed5e87.
* src/autofit/afloader.c (af_loader_load_glyph): Move the
initialisation and declaration of variables into the if-block.
2018-05-30 17:38:14 +02:00
Armin Hasitzka a3cfed5e87 Fix pointer underflow.
The declaration of `edge2' can be reached with `edge1 == NULL' and
`axis->edges == 0' which results in undefined behaviour.

* src/autofit/afloader.c (af_loader_load_glyph): Initialise `edge2'
after checking `axis->num_edges > 1'.  `edge1 != NULL' can be assumed.
2018-05-30 12:37:46 +02:00
Werner Lemberg ae2cd1b749 Various minor color fixes.
* include/freetype/config/ftheader.h (FT_COLOR_H): New macro.

* include/freetype/internal/ftobjs.h (FT_Colr_Internal): Change
type of `load_flags' to `FT_Int32'.

* include/freetype/internal/sfnt.h (TT_Load_Colr_Layer_Func): Change
type of `idx' to `FT_UInt'.
(TT_Blend_Colr_Func): Change type of `color_index' to `FT_UInt'.

* src/base/ftobjs.c (FT_Render_Glyph_Internal): Change type of
`load_flags' to `FT_Int32'.

* src/sfnt/ttcolr.c (find_base_glyph_record,
tt_face_load_colr_layers): Change type of `glyph_id' to `FT_UInt'.
(tt_face_find_color, tt_face_colr_blend_layer): Change type of
`color_index' to `FT_UInt'.
Fix signedness and type issues.

* src/sfnt/ttcolr.h: Updated.
2018-05-30 09:34:57 +02:00
Nikhil Ramakrishnan 51fee65583 [docmaker] Fix missing `Defined in (...)' under Windows/Cygwin.
This platform uses backslashes for paths, which docmaker didn't
understand correctly.

* src/tools/docmaker/tohtml.py (HtmlFormatter::blockEnter): Use
`os.path.normpath' to normalize the path for the platform being
used.
2018-05-25 22:19:18 +02:00
Alexei Podtelezhnikov 7b73cb0707 [smooth] Formalize Harmony LCD rendering.
This generalizes magic outline shifts that make Harmony LCD
rendering work in terms of precise two-dimensional RGB subpixel
positions. These coordinates are now set in time of the `smooth'
module initialization and later used to shift a glyph outline for
rendering. FT_RENDER_MODE_LCD and FT_RENDER_MODE_LCD_V use the same
coordinates. The letter, however, rotates them before using.
The LCD bitmap padding is also calculated using these coordinates.

* include/freetype/internal/ftobjs.h (FT_LibraryRec): New array field
`lcd_geometry'.
* src/base/ftlcdfil.c (ft_lcd_padding): Reworked.
* src/base/ftobjs.c (ft_glyphslot_preset_bitmap): Updated accordingly.

* src/smooth/ftsmooth.c [!FT_CONFIG_OPTION_SUBPIXEL_RENDERING]
(ft_smooth_init): Initialize `lcd_geometry'.
(ft_smooth_render_generic): Formalize outline shifts.
2018-05-24 22:38:24 -04:00
Werner Lemberg 3fcb4cfa26 Oops! 2018-05-22 09:12:21 +02:00
Werner Lemberg 3360ca5853 [truetype] Reject elements of composites with invalid glyph indices.
Reported as

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

* src/truetype/ttgload.c (TT_Load_Composite_Glyph): Implement it.
2018-05-22 09:06:24 +02:00
Werner Lemberg 3c99016f8f * src/truetype/ttgload.c (TT_Load_Simple_Glyph): Trace # of points. 2018-05-22 07:53:49 +02:00
Werner Lemberg 93363cd737 * include/freetype/ftcolor.h: New file.
This is an interface to the `CPAL' OpenType table.  No
implementation yet.
2018-05-20 22:50:36 +02:00
Alexei Podtelezhnikov af28249862 Autoformatting. 2018-05-20 06:27:08 -04:00
Alexei Podtelezhnikov 2f218a4c3a * include/freetype/internal/ftcalc.h (FT_MSB): Verified `_MSC_VER'.
Actually `_BitScanReverse' is available since VS2005.
2018-05-18 08:57:30 -04:00
Werner Lemberg 840b844301 * include/freetype/internal/ftcalc.h (FT_MSB): Use `_MSC_VER' value.
Older VC versions don't provide `_BitScanReverse'.  We test for VC
2013.

Reported by John Emmas <john@creativepost.co.uk>.
2018-05-18 10:57:51 +02:00
Werner Lemberg 3331b84fc2 Minor comment fixes. 2018-05-18 07:19:57 +02:00
Werner Lemberg 2cac1c3542 s/inline/__inline/ for MSVC.
Reported by John Emmas <john@creativepost.co.uk>.

* include/freetype/internal/ftcalc.h (FT_MSB) [_MSC_VER]: Do it.
2018-05-17 19:40:44 +02:00
Werner Lemberg 583dabf291 Add function `FT_Get_GlyphLayers' to access `COLR' table data.
* include/freetype/internal/ftobjs.h (FT_Glyph_LayerRec): Move this
structure to...
* include/freetype/freetype.h (FT_Glyph_LayerRec): ... this
header file.
(FT_Glyph_Layer): New typedef.
Update code to use it where appropriate.

* src/base/ftobjs.c (FT_Get_GlyphLayers): New function.
2018-05-16 21:21:18 +02:00
Alexei Podtelezhnikov f1458d2e44 [base] Fix mono bitmap presetting (#53896).
It is rather fundamental to set monochrome bitmap based on rounded
CBox because the b/w rasterizer turns on pixels when their centers are
inside the glyph outline. The dropout control is unpredictable and can
distort narrow glyphs if the bitmap is too wide.

Reported by Chris Liddell.

* src/base/ftobjs.c (ft_glyphslot_preset_bitmap): If BBox boundaries
are too close, adjust them before rounding.
2018-05-15 21:47:18 -04:00
Werner Lemberg 49c5e24a14 [psaux] Fix compiler warning (#53915).
* src/psaux/psft.c (cf2_freeT1SeacComponent): Do it.
2018-05-15 21:55:28 +02:00
Werner Lemberg befee11296 [sfnt] Fix memory leak in handling `COLR' data.
* src/truetype/ttgload.c (TT_Load_Glyph): Free old `layers' array
before reassigning allocated memory.
Only allocate `color_layers' if we don't have one already.
2018-05-15 17:01:22 +02:00
Werner Lemberg 5fd125640a Grammar fixes. 2018-05-15 11:30:49 +02:00
Werner Lemberg 2dd2091611 [sfnt] If `COLR' is present, don't assume that all glyphs use it.
* src/sfnt/ttcolr.c (tt_face_load_colr_layers): Return FT_Err_Ok if
current glyph is not a `COLR' base glyph.

* src/truetype/ttgload.c (TT_Load_Glyph): Don't allocate
`color_layers' if there are no color layers.
2018-05-15 09:06:58 +02:00
Werner Lemberg 06820637e2 * src/base/ftobjs.c (FT_Load_Glyph): Fix signature of `pixel_modes'. 2018-05-14 09:45:16 +02:00
Werner Lemberg c5a8a5350a Provide dummy functions if `TT_CONFIG_OPTION_SFNT_NAMES' is not set.
* src/base/ftsnames.c [!TT_CONFIG_OPTION_SFNT_NAMES]: Implement it.
2018-05-14 09:43:38 +02:00
Werner Lemberg 78db8a2570 Typo. 2018-05-13 11:53:01 +02:00
Werner Lemberg 1b2abda9d2 * src/base/ftobjs.c (FT_Load_Glyph): Improve tracing. 2018-05-13 10:58:49 +02:00
Shao Yu Zhang f04d81751a [sfnt] Preliminary support of coloured layer outlines.
This commit enables OpenType's COLR/CPAL table handling; a typical
application are color emojis that can be scaled to any size.

If the color palette does not exist or is invalid, the rendering
step rasterizes the outline instead.  The current implementation
assumes that the foreground is black.

Enable this by defining option TT_CONFIG_OPTION_COLOR_LAYERS.

There are still some issues with metrics; additionally, an API to
fetch color layers is missing.

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

* include/freetype/internal/ftobjs.h (FT_Glyph_LayerRec,
FT_Colr_InternalRec): New structures.
(FT_Slot_InternalRec): Add `color_layers' field.

* include/freetype/internal/sfnt.h (TT_Load_Colr_Layer_Func,
TT_Blend_Colr_Func): New function types.
(SFNT_Interface): Add `load_colr', `free_colr', `load_colr_layer',
and `colr_blend' fields.

* include/freetype/internal/tttypes.h (TT_FaceRec): Add
`colr_and_cpal' field.

* include/freetype/internal/tttags. (TTAG_COLR, TTAG_CPAL): New
macros.

* src/sfnt/ttcolr.c, src/sfnt/ttcolr.h: New files.

* src/base/ftobjs.c (ft_glyphslot_done, FT_Render_Glyph_Internal):
Handle glyph color layers.

* src/sfnt/Jamfile (_sources), src/sfnt/rules.mk (SFNT_DRV_SRC): Add
`ttcolr.c'.

* src/sfnt/sfdriver.c: Include `ttcolr.h'.
(PUT_COLOR_LAYERS): New macro.
Update call to `FT_DEFINE_SFNT_INTERFACE'.

* src/sfnt/sfnt.c: Include `ttcolr.c'.

* src/sfnt/sfobjs.c (sfnt_load_face): Load `COLR' and `CPAL' tables.
(sfnt_done_face): Updated.

* src/truetype/ttgload.c (TT_Load_Glyph): Handle color layers.
2018-05-13 03:25:09 +02:00
Arkady Shapkin 84eebf4802 Use MS VC++'s _BitScanReverse to calculate MSB (patch #9636).
* include/freetype/internal/ftcalc.h (FT_MSB) [_MSC_VER]: Implement
it.
2018-05-12 06:18:07 +02:00
Parth Wazurkar fb742477b2 [pcf]Documentation Typo. 2018-05-11 23:27:06 +05:30
Alan Coopersmith 9e345c9117 Further fix to visibility flag testing with Solaris Studio compilers.
AC_COMPILE_IFELSE only tries to compile a `*.c' to a `*.o'.  The
Solaris Studio 12.1 through 12.5 compilers see the
`-fvisibility=hidden' flag, but ignore it with a warning of:

  cc: Warning: Option -fvisibility=hidden passed to ld,
               if ld is invoked, ignored otherwise

AC_LINK_IFELSE does the compile and then tries to link the result,
at which point the Solaris linker will issue an error:

  ld: fatal: option '-fvisibility=hidden' is incompatible with
      building a dynamic executable

If we don't use AC_LINK_IFELSE to catch the error, then configure
will fail further tests which attempt to link, such as those testing
dependencies like `libbz2'.

Also, don't try adding `-fvisibility' if we have already added
`-xldscope', just use one of them, since Sun Studio 12 and earlier
compilers only issue a warning, and don't try passing through to the
linker to generate an error, so AC_LINK_IFELSE doesn't catch them.

Tested on Solaris 11.4 beta with compiler versions:

  Sun Studio 8 (Sun C 5.5)
  Sun Studio 10 (Sun C 5.7)
  Sun Studio 11 (Sun C 5.8)
  Sun Studio 12 (Sun C 5.9)
  Sun Studio 12.1 (Sun C 5.10)
  Oracle Solaris Studio 12.2 (Sun C 5.11)
  Oracle Solaris Studio 12.3 (Sun C 5.12)
  Oracle Solaris Studio 12.4 (Sun C 5.13)
  Oracle Developer Studio 12.5 (Sun C 5.14)
  Oracle Developer Studio 12.6 (Sun C 5.15)
  gcc 5.5.0
  gcc 7.3.0

and verified the libfreetype.so.6 generated by each of those
compilers exported the same set of symbols.

* builds/unix/configure.raw: Implement it.
2018-05-10 10:13:18 +02:00
Werner Lemberg e0015f7612 [autofit] Avoid potential SEGV if running out of memory.
Problem reported by Shailesh Mistry <shailesh.mistry@hotmail.co.uk>.

* src/autofit/afshaper.c (af_shaper_buf_create,
af_shaper_buf_destroy) [!FT_CONFIG_OPTION_USE_HARFBUZZ]: Don't
allocate and free a four-byte buffer.  Instead, make those functions
no-ops; the calling functions will provide a pointer to a buffer
instead.

* src/autofit/afcjk.c (af_cjk_metrics_init_widths,
af_cjk_metrics_init_blues, af_cjk_metrics_check_digits),
src/autofit/aflatin.c (af_latin_metrics_init_widths,
af_latin_metrics_init_blues, af_latin_metrics_check_digits)
[!FT_CONFIG_OPTION_USE_HARFBUZZ]: Use pointer to local variable for
`shaper_buf'.
2018-05-08 11:51:16 +02:00
Nikolaus Waxweiler f7b4fb3a21 CMake: Allow using project as subfolder in other project
* CMakeLists.txt: Test for CMake build directory being diffent from
source directory. Provide other parts of the build system access the
full include directory.
2018-05-08 07:46:19 +01:00
Werner Lemberg 7702edf793 [build] Suppress configure's `nothing to be done' message.
This is due to calling the configure script via `make' (within the
top-level `configure' wrapper script).  The same can happen for all
other secondary make targets that are used to only modify the
primary one, e.g., `make setup devel'.

* builds/dos/detect.mk (emx, turboc, watcom, borlandc, borlandc16),
builds/os2/detect (visualage, watcom, borlandc, devel),
builds/unix/detect.mk (devel, lcc, unix), builds/windows/detect.mk
(visualc, watcom, visualage, lcc, mingw32, bcc32, devel-bcc,
devel-gcc): Use no-op recipe.
2018-05-07 08:54:34 +02:00
suzuki toshiya 2b3e0ef6c0 Support symbol visibility features of Sun / Oracle C compilers.
Reported by Kiyoshi Kanazawa:
https://lists.gnu.org/archive/html/freetype-devel/2018-05/msg00008.html
Thanks to the suggestions by Alexei and Alan Coopersmith.

* builds/unix/configure.raw: Check if "-xldscope=hidden" is
accepted, and if so, it is added to CFLAGS.  This is the option
making Sun / Oracle C compilers hide the symbols from global
scope.
* include/freetype/config/ftconfig.h: Use "__global" prefix
for FT_EXPORT() macro, if SunPro C is newer than Sun ONE
Studio 8 (2003).
* builds/unix/ftconfig.in: Ditto.
* builds/vms/ftconfig.h: Ditto.
2018-05-04 12:55:48 +09:00
Nikolaus Waxweiler 660afb5ce8 Unbreak CMake Windows installation
* CMakeLists.txt: Generate ftconfig.h on non-UNIX.
2018-05-02 23:39:28 +01:00
Werner Lemberg 9514959241 Remove FT_CONFIG_OPTION_PIC and related code.
*/* [FT_CONFIG_OPTION_PIC]: Remove all code guarded by this
preprocessor symbol.

*/*: Replace `XXX_GET' macros (which could be either a function in
PIC mode or an array in non-PIC mode) with `xxx' arrays.

* include/freetype/internal/ftpic.h, src/autofit/afpic.c,
src/autofit/afpic.h, src/base/basepic.c, src/base/basepic.h,
src/base/ftpic.c, src/cff/cffpic.c, src/cff/cffpic.h,
src/pshinter/pshpic.c, src/pshinter/pshpic.h, src/psnames/pspic.c,
src/psnames/pspic.h, src/raster/rastpic.c, src/raster/rastpic.h,
src/sfnt/sfntpic.c, src/sfnt/sfntpic.h, src/smooth/ftspic.c,
src/smooth/ftspic.h, src/truetype/ttpic.c, src/truetype/ttpic.h:
Removed.
2018-05-02 20:27:48 +02:00
Werner Lemberg 86bc8a9505 * Version 2.9.1 released.
=========================

Tag sources with `VER-2-9-1'.

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

* README, Jamfile (RefDoc), builds/windows/vc2005/freetype.vcproj,
src/base/ftver.rc, builds/windows/vc2005/index.html,
builds/windows/vc2008/freetype.vcproj,
builds/windows/vc2008/index.html,
builds/windows/vc2010/freetype.vcxproj,
builds/windows/vc2010/index.html,
builds/windows/visualc/freetype.dsp,
builds/windows/visualc/freetype.vcproj,
builds/windows/visualc/index.html,
builds/windows/visualce/freetype.dsp,
builds/windows/visualce/freetype.vcproj,
builds/windows/visualce/index.html,
builds/wince/vc2005-ce/freetype.vcproj,
builds/wince/vc2005-ce/index.html,
builds/wince/vc2008-ce/freetype.vcproj,
builds/wince/vc2008-ce/index.html: s/2.9/2.9.1/, s/29/291/.

* include/freetype/freetype.h (FREETYPE_PATCH): Set to 1.

* builds/unix/configure.raw (version_info): Set to 22:1:16.
* CMakeLists.txt (VERSION_PATCH): Set to 1.

* include/freetype/ftgasp.h: Use FT_BEGIN_HEADER and FT_END_HEADER.
2018-05-01 20:37:24 +02:00
Werner Lemberg ac97a29653 Another fix for handling invalid format 2 cmaps.
Sigh.

Reported as

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

* src/sfnt/ttcmap.c (tt_cmap2_char_next): Adjust condition to avoid
an endless loop.
2018-04-26 09:04:39 +02:00
Ben Wagner 2157d8fa6f [base] Avoid undefined behaviour in lcd filtering code (#53727).
* src/base/ftlcdfil.c (ft_lcd_filter_fir, _ft_lcd_filter_legacy):
Ensure `height > 0'.
2018-04-24 10:29:19 +02:00
Werner Lemberg 67697d0076 * src/base/ftoutln.c (FT_Outline_Decompose): Improve error tracing. 2018-04-22 21:15:10 +02:00
Alexei Podtelezhnikov 3b88576ba0 [base] Fix bitmap emboldening.
Bug introduced after release 2.8.

* src/base/ftbitmap.c (ft_bitmap_assure_buffer): We use
`FT_QALLOC_MULT', which doesn't zero out the buffer.  Adjust the
bitmap copying code to take care of this fact.
2018-04-22 17:22:35 +02:00
Werner Lemberg c2e2a8e5d9 Revert "[base] Fix bitmap copying where the new pitch is smaller."
This reverts commit c0f1adedcf.
2018-04-22 17:13:50 +02:00
Werner Lemberg c0f1adedcf [base] Fix bitmap copying where the new pitch is smaller.
* src/base/ftbitmap.c (ft_bitmap_assure_buffer): Handle it.
2018-04-22 11:44:24 +02:00
Werner Lemberg 38ecc949ce Another fix for handling invalid format 2 cmaps.
The previous commit was incomplete.

Reported as

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

* src/sfnt/ttcmap.c (tt_cmap2_char_next): Adjust condition to avoid
an endless loop.
2018-04-22 10:14:03 +02:00
Alexei Podtelezhnikov 92e4662ba6 Documentation tweaks. 2018-04-19 17:57:42 -04:00
Werner Lemberg e4b6d85326 [autofit] Add support for Georgian Mtavruli characters.
This will be part of the forthcoming Unicode 11.0.

* src/autofit/afblue.dat: Add blue zone data for Mtavruli.
* src/autofit/afblue.c, src/autofit/afblue.h: Regenerated.

* src/autofit/afscript.h: Add Mtavruli standard character.
2018-04-19 17:43:03 +02:00
Werner Lemberg 1655e00fce Fix handling of invalid format 2 cmaps.
The problem was introduced after the last release.

Reported as

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

* src/sfnt/ttcmap.c (tt_cmap2_char_next): Avoid endless loop.
2018-04-19 14:45:19 +02:00
Werner Lemberg 2a1597826a [truetype] Integer overflow issues.
Reported as

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

* src/truetype/ttinterp.c (Ins_CEILING): Use FT_PIX_CEIL_LONG.
2018-04-17 12:25:17 +02:00
Werner Lemberg 632a11f91f CHANGES: Mention CVE-2018-6942. 2018-04-16 19:51:37 +02:00
Werner Lemberg 70ac167c47 [truetype] Integer overflow issues.
Reported as

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

* src/truetype/ttinterp.c (Ins_MIRP): Use ADD_LONG.
2018-04-16 10:39:10 +02:00
Ankit Dhankhar 939bbee1c0 [docmaker] Make it work with python3.
* src/tools/docmaker (*.py): Use parentheses around arguments of `print'.
Remove unused imports.
2018-04-15 22:35:40 +02:00
Alexei Podtelezhnikov 843193b9d5 [build] Use `info' function of make 3.81.
* configure, docs/INSTALL, docs/INSTALL.CROSS, docs/INSTALL.GNU,
docs/INSTALL.UNIX, docs/MAKEPP: Bump make version requirements.

* builds/detect.mk (std_setup): Replace `echo' with `info'.
(dos_setup): Removed.
* builds/unix/install.mk, builds/modules.mk, builds/dos/detect.mk,
builds/windows/detect.mk, builds/os2/detect.mk: Updated.
* builds/newline: No longer needed.
2018-04-15 16:27:10 -04:00
Werner Lemberg 235b1e2fe6 [truetype]: Limit `SLOOP' bytecode argument to 16 bits.
This fixes

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

* src/truetype/ttinterp.c (Ins_SLOOP): Do it.
2018-04-15 21:55:04 +02:00
Werner Lemberg 827ca3bcf2 [truetype] Integer overflow issues.
Reported as

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

* src/truetype/ttinterp.c (Ins_MDAP): Use SUB_LONG.
2018-04-14 07:20:31 +02:00
Werner Lemberg 576670b779 [autofit] Update to Unicode 11.0.0.
But no support new scripts (volunteers welcomed).

* src/autofit/afranges.c (af_arab_nonbase_uniranges,
af_beng_nonbase_uniranges, af_cakm_nonbase_uniranges,
af_deva_nonbase_uniranges, af_geor_uniranges,
af_gujr_nonbase_uniranges, af_mlym_nonbase_uniranges,
af_nkoo_nonbase_uniranges, af_telu_nonbase_uniranges,
af_hani_uniranges): Add new data.
2018-04-14 07:00:30 +02:00
Nikolaus Waxweiler 029721d69c Modernize CMake build.
* CMakeLists.txt, builds/cmake/FindHarfBuzz.cmake: Extensive
  modernization measures.

* .gitignore: Add build/, as that's the example directory used in
  CMakeLists.txt.

This brings up the minimum required CMake version to 2.8.12.

The installation paths follow the GNU defaults now, e.g. installing on a
64 bit host will place binaries into the lib64/ folder on e.g. Fedora.

Symbols are hidden by default (e.g. `-fvisibility=hidden' on GCC).

CMake will no longer look for a C++ compiler.

Library and .so version now match the Autotools build.

Comments in the build file and informational messages now use platform
agnostic example commands.

ftoption.h and ftconfig.h are written directly without a redundant
`-new' copy.

External dependencies are expressed as option()s and will turn up as
such in cmake-gui.

Internal: Properties such as dependencies and include directories are
now privately set on the freetype library instead of globally.

The CPack definitions have been cleaned up, the `make dist' has been
removed. Source packages generated with CPack don't contain Autotools
files and aren't used by the maintainters anyway.

On Windows, src/base/ftver.rc is compiled to decorate the library with
version and copyright information.

A pkg-config file is now generated and installed.
2018-04-10 22:31:10 +01:00
Werner Lemberg bd9400bd46 [truetype] Integer overflow issues.
Reported as

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

* src/truetype/ttinterp.c (Round_Super, Round_Super_45): Use
ADD_LONG and SUB_LONG.
2018-04-09 21:28:37 +02:00
Alexei Podtelezhnikov cdddeff02f [windows, wince] Clean up legacy project files.
* builds/wince/vc2005-ce/freetype.vcproj,
builds/wince/vc2008-ce/freetype.vcproj,
builds/windows/vc2005/freetype.vcproj,
builds/windows/vc2008/freetype.vcproj,
builds/windows/visualce/freetype.vcproj,
builds/windows/visualce/freetype.dsp,
builds/windows/visualc/freetype.vcproj,
builds/windows/visualc/freetype.dsp: Remove per-file compile flags.
2018-04-06 21:01:50 -04:00
Werner Lemberg 3b8f16803c [cff, type1] Sanitize `BlueFuzz' and `BlueShift'.
Reported as

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

* src/cff/cffload.c (cff_load_private_dict): Sanitize
`priv->blue_shift' and `priv->blue_fuzz' to avoid overflows later
on.

* src/type1/t1load.c (T1_Open_Face): Ditto.
2018-04-04 20:26:08 +02:00
suzuki toshiya 26ad1acbcb * src/truetype/ttobjs.c (trick_names): Add 3 tricky fonts (#53554),
`DFHei-Md-HK-BF', `DFKaiShu-Md-HK-BF' and `DFMing-Bd-HK-BF'.
(tt_check_trickyness_sfnt_ids): Add checksums for 3 tricky fonts
in above.
2018-04-04 16:39:42 +09:00
Werner Lemberg 578dafd6b4 Minor comment improvement. 2018-04-03 11:31:22 +02:00
Werner Lemberg 7109495c5e * builds/toplevel.mk (work): Use $(SEP).
This fixes the `make refdoc' using Cygwin: $(CAT) is `type' on this
platform, and this program only understands backslashes in paths.

Reported by Nikhil Ramakrishnan <ramakrishnan.nikhil@gmail.com>.
2018-04-01 13:24:59 +02:00
Werner Lemberg 597cb3b442 [truetype] Fix memory leak (only if tracing is on).
* src/truetype/ttgxvar.c (TT_Get_MM_Var) [FT_DEBUG_LEVEL_TRACE}: Fix
it.
2018-03-30 13:46:03 +02:00
Alexei Podtelezhnikov fa6da7bf6d Documentation improvement. 2018-03-26 21:40:18 -04:00
Werner Lemberg 61ee69a66e Typo. 2018-03-24 05:53:22 +01:00
Kushal K S V S e1122047ae Fixing cmake command format 2018-03-23 13:12:07 +05:30
Ben Wagner 34e467332b [sfnt] Correctly handle missing bitmaps in sbix format (#53404).
* src/sfnt/ttfsbit.c (tt_face_load_sbix_image): Fix return value.
2018-03-23 06:13:25 +01:00
Ben Wagner 43d4852ec6 [truetype] Fix advance of empty glyphs in bitmap fonts (#53393).
* src/truetype/ttgload.c (TT_Load_Glyph): Apply scaling to metrics
for empty bitmaps.
2018-03-23 06:07:24 +01:00
Werner Lemberg af89e445f8 Remove `ftlcdfil.c' and `ftfntfmt.c' from build files (#53415).
builds/amiga/makefile, builds/amiga/makefile.os4,
builds/amiga/smakefile, builds/mac/FreeType.m68k_cfm.make.txt,
builds/mac/FreeType.m68k_far.make.txt,
builds/mac/FreeType.ppc_carbon.make.txt,
builds/mac/FreeType.ppc_classic.make.txt,
builds/symbian/freetype.mmp, builds/wince/vc2005-ce/freetype.vcproj,
builds/wince/vc2008-ce/freetype.vcproj,
builds/windows/vc2005/freetype.vcproj,
builds/windows/vc2008/freetype.vcproj,
builds/windows/vc2010/freetype.vcxproj,
builds/windows/vc2010/freetype.vcxproj.filters,
builds/windows/visualc/freetype.dsp,
builds/windows/visualc/freetype.vcproj,
builds/windows/visualce/freetype.dsp,
builds/windows/visualce/freetype.vcproj, vms_make.com: Do it.
2018-03-22 06:00:55 +01:00
Werner Lemberg 5bd76524ef * src/sfnt/ttcmap.c (tt_cmap2_validate): Fix potential numeric
overflow.
2018-03-13 11:11:16 +01:00
Werner Lemberg 78cded2c5c Fix cmap format 2 handling (#53320).
The patch introduced for #52646 was not correct.

* src/sfnt/ttcmap.c (tt_cmap2_char_next): Adjust condition.
2018-03-13 11:09:44 +01:00
Nikolaus Waxweiler 098dd70cb1 * CMakeLists.txt (BASE_SRCS): Update to changes from 2018-03-05. 2018-03-10 14:51:17 +01:00
Chun-wei Fan 6f854692a8 * CMakeLists.txt [win32]: Allow MSVC DLL builds (#53287).
Do not limit DLL builds to MinGW, since we already have
`__declspec(dllexport)' directives in `ftconfig.h'.
Also suppress more warnings for POSIX functions.
2018-03-09 06:51:38 +01:00
Werner Lemberg e277267c52 Typo. 2018-03-08 11:33:31 +01:00
Werner Lemberg b0a93839b5 CHANGES: Document `--enable-freetype-config'. 2018-03-08 06:36:47 +01:00
Hugh McMaster a7833f26c4 Make installation of `freetype-config' optional (#53093).
Signed-off-by: Hugh McMaster <hugh.mcmaster@outlook.com>
2018-03-08 06:25:13 +01:00
Werner Lemberg ccec889229 Minor: Update `CHANGES' and improve documentation in `modules.cfg'. 2018-03-08 06:09:17 +01:00
Werner Lemberg 733a21bdbc Make `ftlcdfil.c' part of the `base' module.
`ftobjs.c' needs `ft_lcd_padding'.

Problem reported by duhuanpeng <548708880@qq.com>.

* modules.cfg (BASE_EXTENSIONS): Don't include `ftlcdfil.c'.

* src/base/ftbase.c: Include `ftlcdfil.c'.
* src/base/rules.mk (BASE_SRC): Add `ftlcdfil.c'.
* src/base/Jamfile (_sources): Adjusted.

* docs/INSTALL.ANY: Updated.
2018-03-05 23:37:17 +01:00
Werner Lemberg f4a3531655 Make `ftfntfmt.c' part of the `base' module.
`ftobjs.c' needs `FT_Get_Font_Format'.

Problem reported by duhuanpeng <548708880@qq.com>.

* modules.cfg (BASE_EXTENSIONS): Don't include `ftfntfmt.c'.

* src/base/ftbase.c: Include `ftfntfmt.c'.
* src/base/rules.mk (BASE_SRC): Add `ftfntfmt.c'.
* src/base/Jamfile (_sources): Adjusted.

* docs/INSTALL.ANY: Updated.
2018-03-05 20:45:12 +01:00
Werner Lemberg 5955b77b1d Minor documentation improvement. 2018-03-03 09:21:59 +01:00
Werner Lemberg efd13c5d1b * src/truetype/ttinterp.c (TT_RunIns): Fix tracing arguments. 2018-03-01 22:17:54 +01:00
Werner Lemberg 0206479158 * builds/unix/configure.raw: Need HarfBuzz 1.3.0 or newer.
Problem reported by Alan Coopersmith <alan.coopersmith@oracle.com>.
2018-03-01 21:34:57 +01:00
Werner Lemberg 713d68ee9f [sfnt] Prefer `CBDT'/`CBLC' over `glyf' table (#53154). 2018-02-17 18:35:15 +01:00
Werner Lemberg 9fbd0041ca Split off ChangeLog.28. 2018-02-17 10:37:10 +01:00
Werner Lemberg 63aaf89cec s/sub-pixel/subpixel/. 2018-02-17 10:34:47 +01:00
Werner Lemberg 4a03f17449 [truetype] Integer overflow issues.
Reported as

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

* src/truetype/ttinterp.c (Ins_MSIRP, Ins_MIAP, Ins_MIRP): Use
SUB_LONG; avoid FT_ABS.
2018-02-06 02:23:19 +01:00
Alexei Podtelezhnikov f4a3255d45 [unix] Use -fvisibility=hidden.
It is now widely recommended that ELF shared libraries hide symbols
except those with explicit __attribute__((visibility("default"))).
This is supported by all major compilers and should rather be an
option in libtool.

* builds/unix/configure.raw: Add -fvisibility=hidden to CFLAGS.
* builds/unix/ftconfig.in, builds/vms/ftconfig.h,
include/freetype/config/ftconfig.h (FT_EXPORT): Use visibility
attribute.
2018-02-04 00:09:02 -05:00
Werner Lemberg 036bdc0c9a [truetype] Minor typo. 2018-01-28 00:05:46 +01:00
Werner Lemberg 68dddcdcbe [truetype] Better protection against invalid VF data.
Reported as

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

Bug introduced in commit 08cd62deed.

* src/truetype/ttgxvar.c (TT_Set_Var_Design): Always initialize
`normalizedcoords'.
2018-01-27 23:59:30 +01:00
Werner Lemberg 29c759284e * src/truetype/ttinterp.c (Ins_GETVARIATION): Avoid NULL reference.
Reported as

  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=5736
2018-01-27 14:43:43 +01:00
Werner Lemberg f438e06972 * src/truetype/ttgxvar.c (tt_set_mm_blend): Minor. 2018-01-27 14:39:15 +01:00
Werner Lemberg ef48653023 [truetype] Better trace VF instances.
* src/truetype/ttgxvar.c (ft_var_to_normalized): Don't emit number
of coordinates.
(TT_Get_MM_Var): Trace instance indices names.
(TT_Set_Var_Design): Updated.
2018-01-27 13:58:02 +01:00
Werner Lemberg 5f94c90f19 Fix comment. 2018-01-27 10:52:13 +01:00
Werner Lemberg 50f693a78b [truetype] Beautify tracing of VF axis records.
* src/truetype/ttgxvar.c (TT_Get_MM_Var): Show axis records in a
table-like manner.
2018-01-27 10:15:58 +01:00
Werner Lemberg 994eb2b349 [truetype] Fix multiple calls of `FT_Get_MM_Var' (#52955).
* src/truetype/ttgxvar.c (TT_Get_MM_Var): Set
`face->blend->num_axis' in case we have to initialize the
`face->blend'.
2018-01-26 23:17:43 +01:00
Alexei Podtelezhnikov b1e0209829 [apinames] Anonymous version map for GNU linker.
* src/tools/apinames.c (PROGRAM_VERSION): Set to 0.3.
(OutputFormat): Add `OUTPUT_GNU_VERMAP'.
(names_dump): Handle it.
(usage): Updated.
(main): Handle new command line flag `-wL'.
2018-01-23 22:29:45 -05:00
Alexei Podtelezhnikov c6a965b4d3 [unix] Call libtool to clean up.
* builds/unix/install.mk (clean_project_unix, distclean_project_unix):
Use libtool.
* builds/freetype.mk: Minor.
2018-01-21 14:29:58 -05:00
Alexei Podtelezhnikov 6ce6685659 * src/base/ftver.rc: Fix mingw-w64 compilation. 2018-01-18 21:29:48 -05:00
Alexei Podtelezhnikov 4b8ccc56d8 [build] Enable VERSIONINFO resource for Cygwin/MinGW.
* builds/unix/configure.raw: Check for resource compiler.
* builds/unix/unix-cc.in: Conditionally set up resource compiler.
* builds/freetype.mk: Add conditional rule for `ftver.rc'.
* src/base/ftver.rc: Copyright notice and year update.
2018-01-18 04:32:52 -05:00
Alexei Podtelezhnikov fd8000f040 [build] Move VERSIONINFO resource.
* builds/windows/vc2010/freetype.vcxproj: Updated.
* builds/windows/ftver.rc: Move file from here...
* src/base/ftver.rc: ... to here.
2018-01-18 03:58:34 -05:00
Alexei Podtelezhnikov d2d1750e08 [build] Expand dllexport/dllimport to Cygwin/MinGW.
* include/freetype/config/ftconfig.h: Respect DLL_EXPORT,
s/_MSC_VER/_WIN32/.
* builds/unix/ftconfig.in: Replicate here.
* builds/vms/ftconfig.h: Replicate here.
2018-01-12 23:01:49 -05:00
Alexei Podtelezhnikov e8b38f899c [build] Improve and document MSVC build.
* include/freetype/config/ftconfig.h: Guard dllexport/dllimport
attributes with _DLL and FT2_DLLIMPORT.
* builds/windows/vc2010/index.html: Update documentation.
2018-01-12 08:57:08 -05:00
Steve Robinson 707cd028b2 * CMakeLists.txt [win32]: Suppress warnings for POSIX functions. 2018-01-10 07:49:43 +01:00
Ewald Hew cc2f3cdecf [psaux] Correctly handle Flex features (#52846).
* src/psaux/psintrp.c (cf2_interpT2CharString) <cf2_cmdVMOVETO,
cf2_cmdHMOVETO>: Do not move if doing Flex.
2018-01-10 13:28:36 +08:00
Alexei Podtelezhnikov 3f96c0bcc1 * builds/windows/vc2010/freetype.sln: Synchronize with the project. 2018-01-09 22:22:19 -05:00
Werner Lemberg 67a42aa887 * Version 2.9 released.
=======================

Tag sources with `VER-2-9'.

* docs/VERSION.TXT: Add entry for version 2.9.

* README, Jamfile (RefDoc), builds/windows/vc2005/freetype.vcproj,
builds/windows/vc2005/index.html,
builds/windows/vc2008/freetype.vcproj,
builds/windows/vc2008/index.html,
builds/windows/vc2010/freetype.vcxproj,
builds/windows/vc2010/index.html,
builds/windows/visualc/freetype.dsp,
builds/windows/visualc/freetype.vcproj,
builds/windows/visualc/index.html,
builds/windows/visualce/freetype.dsp,
builds/windows/visualce/freetype.vcproj,
builds/windows/visualce/index.html,
builds/windows/ftver.rc,
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.8.1/2.9/, s/281/29/.

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

* builds/unix/configure.raw (version_info): Set to 22:0:16.
* CMakeLists.txt (VERSION_PATCH): Set to 1.
2018-01-08 12:30:04 +01:00
Werner Lemberg 9e7b24f290 Next release will be 2.9. 2018-01-08 11:16:11 +01:00
Werner Lemberg 1d6773e6d9 Add check for librt, needed for `ftbench' (#52824).
* builds/unix/configure.raw: Call AC_USE_SYSTEM_EXTENSIONS.
(LIB_CLOCK_GETTIME): Define; this will hold `-lrt' if necessary.

* builds/unix/unix-cc.in (LIB_CLOCK_GETTIME): New variable.
2018-01-07 19:06:19 +01:00
Ewald Hew 21bd9c2f8c [psaux] Fix Type 1 glyphs with too many stem hints.
According to the CFF specification, charstrings can have up to 96 stem
hints. Due to hint replacement routines in Type 1 charstrings, some
glyphs are rejected by the Adobe engine, which implements the above
limit. This fix turns off hinting for such glyphs.

* src/psaux/pshints.c (cf2_hintmap_build): Reset the error from calling
`cf2_hintmask_setAll' on a problematic Type 1 charstring and turn off
hinting.
2018-01-07 16:38:54 +08:00
Werner Lemberg 3758aed760 Add `FT_Done_MM_Var'.
This is necessary in case the application's memory routines differ
from FreeType.  A typical example is a Python application on Windows
that calls FreeType compiled as a DLL via the `ctypes' interface.

* include/freetype/ftmm.h, src/base/ftmm.c (FT_Done_MM_Var): Declare
and define.

* docs/CHANGES: Updated.
2018-01-06 08:39:36 +01:00
Werner Lemberg b720070988 Minor doc fixes. 2018-01-06 08:39:30 +01:00
Werner Lemberg 029c9b2391 [truetype] Round offsets of glyph components only if hinting is on.
* src/truetype/ttgload.c (TT_Process_Composite_Component): Implement
it.
2018-01-03 19:05:20 +01:00
Werner Lemberg 55d6abea5d * src/truetype/ttgxvar.c (ft_var_to_design): Remove dead code.
This is a better fix than the previous commit, which is now
reverted.
2018-01-03 19:01:15 +01:00
Alexei Podtelezhnikov 20b3e34846 Move internal LCD-related declarations.
* include/freetype/ftlcdfil.h (ft_lcd_padding, ft_lcd_filter_fir):
Move from here...
* include/freetype/internal/ftobjs.h: ... to here.
2018-01-02 22:12:09 -05:00
Alexei Podtelezhnikov c94d042be6 * include/freetype/config/ftconfig.h (FT_EXPORT, FT_EXPORT_DEF)
[_MSC_VER]: Limit Visual C++ attributes.
2018-01-02 21:38:35 -05:00
Werner Lemberg ecfdfd4498 [truetype] Make blend/design coordinate round-tripping work.
Behdad reported that setting blend coordinates, then getting design
coordinates did incorrectly return the default instance's
coordinates.

* src/truetype/ttgxvar.c (tt_set_mm_blend): Fix it.
2018-01-03 00:20:11 +01:00
Werner Lemberg 0a0c22569d Update copyright year. 2018-01-02 09:33:57 +01:00
Werner Lemberg a9a5aa573e Update `CHANGES' file with demo program news. 2017-12-31 11:16:36 +01:00
Werner Lemberg 3f090c6843 * src/sfnt/ttcmap.c (tt_cmap2_char_next): Fix endless loop.
Reported as

  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=4838
2017-12-31 10:32:08 +01:00
Werner Lemberg 0268bf35f0 Synchronize other Windows project files.
* builds/windows/*: Add missing files.
2017-12-31 08:21:08 +01:00
Werner Lemberg 7f82c6db84 Update Visual C 2010 project files.
Problem reported by Hin-Tak.

* builds/windows/vc2010/freetype.vcxproj: Add files `ftbdf.c' and
`ftcid.c'.
Sort entries.
* builds/windows/vc2010/freetype.vcxproj.filter: Ditto.
Fix members of `FT_MODULE' group.
2017-12-31 08:00:16 +01:00
Werner Lemberg 8470cee8aa Updated `CHANGES' file. 2017-12-30 20:50:50 +01:00
Werner Lemberg ff5c9928bd * builds/vms/ftconfig.h: Synchronize with unix `ftconfig.in' file. 2017-12-30 01:46:52 +01:00
Werner Lemberg 4f983ab9d0 * builds/unix/ftconfig.in: Synchronize with main `ftconfig.h' file.
Reported by Nikolaus.
2017-12-28 21:55:01 +01:00
Werner Lemberg 14cd073437 Fix compiler warnings.
* src/base/ftbitmap.c (ft_bitmap_assure_buffer): Make `pitch' and
`new_pitch' unsigned.

* src/base/ftpsprop.c: Include FT_INTERNAL_POSTSCRIPT_PROPS_H.
2017-12-27 08:59:46 +01:00
Werner Lemberg 3cc88e2e44 Fixes for `make multi'.
* include/freetype/internal/ftpsprop.h: Use `FT_BASE_CALLBACK'.
(ps_property_get): Harmonize declaration with corresponding
function typedef.

* include/freety[e/internal/fttrace.h: Add `trace_psprops'.

* src/base/ftpsprop.c: Include necessary header files.
(FT_COMPONENT): Define.
(ps_property_set): Tag with `FT_BASE_CALLBACK_DEF'.
(ps_property_get): Tag with `FT_BASE_CALLBACK_DEF'.
Harmonize declaration with corresponding function typedef.
2017-12-27 08:19:09 +01:00
Werner Lemberg 1063690174 Provide support for intra-module callback functions.
This is needed especially for `make multi' with C++.

* include/freetype/config/ftconfig.h (FT_BASE_CALLBACK,
FT_BASE_CALLBACK_DEF): New macros.
2017-12-27 08:13:13 +01:00
Werner Lemberg dd6330d74b Add missing ChangeLog entry, copyright notices, whitespace, formatting. 2017-12-27 08:06:47 +01:00
Ewald Hew a956e36c8d Move PostScript drivers' property handlers to `base'
This reduces the amount of duplicated code across PostScript drivers.

* src/cff/cffdrivr.c, src/cid/cidriver.c, src/type1/t1driver.c
({cff,cid,t1}_property_{get,set}): Moved to...
* include/freetype/internal/ftpsprop.h: ...this new file.
(ps_property_{get,set}): New functions to replace moved ones.
* src/base/ftpsprop.c: Implement above functions.

* include/freetype/internal/internal.h (FT_INTERNAL_POSTSCRIPT_PROPS_H):
New macro.
* src/cff/cffdrivr.c, src/cid/cidriver.c, src/type1/t1driver.c: Updated.

* src/base/Jamfile, src/base/rules.mk, src/base/ftbase.c: Updated.
2017-12-25 12:53:21 +08:00
Werner Lemberg 08cd62deed Speed up FT_Set_Var_{Design,Blend}_Coordinates if curr == new.
We exit early if the current design or blend coordinates are
identical to the new ones.

* src/truetype/ttgxvar.c (tt_set_mm_blend, TT_Set_Var_Design):
Implement it, returning internal error code -1 if there will be no
variation change.

* src/type1/t1load.c (t1_set_mm_blend): Ditto.

* src/base/ftmm.c (FT_Set_Var_Design_Coordinates,
FT_Set_MM_Blend_Coordinates, FT_Set_Var_Blend_Coordinates): Updated.
2017-12-20 22:06:19 +01:00
Werner Lemberg 0579d545af Update incorrect ChangeLog entry. 2017-12-18 23:45:58 +01:00
Werner Lemberg 2df73b397d [sfnt] Fix charmap type 2 iterator (#52646).
The subsetted demo font of the report that exhibits the bug has a
very unusual type 2 cmap for Unicode(!): It contains only two
sub-headers, one for one-byte characters (covering the range 0x20 to
0xFA), and a second one for higher byte 0x01 (just for character
code U+0131).

Before this commit, the iterator wasn't able to correctly handle a
sub-header for higher byte 0x01.

* src/sfnt/ttcmap.c (tt_cmap2_char_next): Fix character increment
for outer loop.
2017-12-18 23:32:32 +01:00
Matthias Clasen bdab6578af [truetype] Minor code beautification.
* src/truetype/ttgxvar.c (ft_var_to_normalized): Trace number of
design coordinates.
Simplify code.
2017-12-18 20:45:17 +01:00
Werner Lemberg 068a7a03aa * src/*/*: Only use `ft_' and `FT_' variants of stdc library stuff. 2017-12-18 20:34:05 +01:00
Werner Lemberg 2fe272aca6 * src/truetype/ttgxvar.c (tt_face_vary_cvt): Add size guard (#52688). 2017-12-18 19:43:18 +01:00
Werner Lemberg d062c54ce7 [truetype] Fix previous commit.
* src/truetype/ttgload.c (TT_Process_Simple_Glyph): Correctly handle
unhinted phantom points, which must be properly scaled.
2017-12-18 09:41:17 +01:00
Werner Lemberg e7935f2910 [truetype] Don't apply HVAR and VVAR deltas twice (#52683).
* src/truetype/ttgload.c (TT_Process_Simple_Glyph): Always adjust
`pp1' to `pp4', except if we have an HVAR and/or VVAR table.

* src/truetype/ttgxvar.c (TT_Vary_Apply_Glyph_Deltas): Handle
alternative code branch identically w.r.t. presence of an HVAR
and/or VVAR table.
2017-12-18 07:29:57 +01:00
Jonathan Kew 361af72eea [truetype] Correctly handle variation font phantom points (#52683).
* src/truetype/ttgxvar.c (TT_Vary_Apply_Glyph_Deltas): Fix phantom
point indices.
2017-12-18 07:28:31 +01:00
Jonathan Kew 7d3dfcd4a5 Fix incorrect advance width scaling (#52683).
* src/base/ftadvance.c (FT_Get_Advances): Always respect the
FT_LOAD_NO_SCALE flag if present.
2017-12-17 08:19:51 +01:00
Alexei Podtelezhnikov d019097bd2 * builds/windows/vc2010/freetype.vcxproj: AfterBuild copy.
* objs/.gitignore: Ignore almost everything.
2017-12-16 22:00:40 -05:00
Werner Lemberg 2c048a8a62 Fix compiler warning (#52640).
* src/base/ftbitmap.c (ft_bitmap_assure_buffer): Remove unused
variable.
2017-12-11 19:24:30 +01:00
Azzuro a998d48401 * builds/windows/vc2010/freetype.vcxproj: Adjust output directory.
This allows builds with different configurations in parallel.
2017-12-09 14:22:35 +01:00
Werner Lemberg 286b0c9f33 Fix `make setup dos', second try (#52622).
* builds/detect.mk (dos_setup): Don't use literal `>' character at
all.  Mixing the different escaping rules from make, dos, and
windows is too fragile.
2017-12-09 09:41:45 +01:00
Werner Lemberg 81dea49321 Documentation fixes for the last few commits. 2017-12-08 20:32:23 +01:00
Werner Lemberg ea68f1c8d3 [docmaker] Fix code section parsing.
Stuff like

  {
    <bla>
  }

confused the parser, which incorrectly treated `<bla>' as a markup
tag.

* src/tools/docmaker/content.py (ContentProcessor::process_content):
Apply `re_markup_tags' only outside of code sections.
2017-12-08 20:15:15 +01:00
Werner Lemberg 98ba0c4a37 New `ftdriver.h' file, covering all driver modules.
This reduces redundancy and increases synergy; it also reduces the
number of header files.

* include/freetype/config/ftheader.h (FT_DRIVER_H): New macro.
(FT_AUTOHINTER_H, FT_CFF_DRIVER_H, FT_TRUETYPE_DRIVER_H,
FT_PCF_DRIVER_H, FT_TYPE1_DRIVER_H): Make them aliases to
FT_DRIVER_H.

* include/freetype/ftautoh.h, include/freetype/ftcffdrv.h,
include/freetype/ftpcfdrv.h, include/freetype/ftt1drv.h,
include/freetype/ftttdrv.h: Replaced with...
* include/freetype/ftdriver.h: ...this new file.
(FT_CFF_HINTING_ADOBE, FT_T1_HINTING_ADOBE): Renamed to...
(FT_HINTING_ADOBE): ... this new macro.
(FT_CFF_HINTING_FREETYPE, FT_T1_HINTING_FREETYPE): Renamed to...
(FT_HINTING_FREETYPE): ... this new macro.

* src/*/*: Updated accordingly.
2017-12-08 18:41:49 +01:00
Werner Lemberg bef8de2a85 Move `ftdriver.h' to `ftdrv.h'.
* include/freetype/internal/ftdriver.h: Renamed to...
* include/freetype/internal/ftdrv.h: ... this name.

* include/freetype/internal/internal.h (FT_INTERNAL_DRIVER_H):
Updated.
2017-12-08 10:02:12 +01:00
Werner Lemberg e1090c608b Fix access to uninitalized memory (#52613).
Also reported as

  https://bugs.chromium.org/p/chromium/issues/detail?id=791317

* src/base/ftbitmap.c (ft_bitmap_assure_buffer): If increasing the
bitmap size needs a larger bitmap buffer, assure that the new memory
areas are initialized also.
2017-12-08 09:54:36 +01:00
Werner Lemberg 99df4919fd Fix `make setup dos' (#52622).
* builds/detect.mk (dos_setup): Properly escape literal `>'
character.
2017-12-08 09:48:18 +01:00
Werner Lemberg 430e9c375a .mailmap: Add Ewald. 2017-12-07 19:27:29 +01:00
Werner Lemberg c3cbb440af Use ASCII only in public header files (#50858). 2017-12-07 16:26:36 +01:00
Werner Lemberg d21f995aea Fix C++ compilation.
* src/psaux/psauxmod.h: Use FT_CALLBACK_TABLE macro where necessary.

* src/smooth/ftsmooth.c (ft_smooth_render_generic): Fix warning.
2017-12-07 14:49:03 +01:00
Werner Lemberg 63b91548e0 Fix `make multi'.
* include/freetype/internal/fttrace.h: Remove unused tracing macros.
s/pshalgo2/pshalgo/.
Add `trace_cffdecode'.
* src/pshinter/pshalgo.c (FT_COMPONENT): Updated.

* src/cff/cffload.c: Include FT_INTERNAL_POSTSCRIPT_AUX_H.
* src/cff/cffobjs.c: Include FT_SERVICE_METRICS_VARIATIONS_H and
FT_SERVICE_CFF_TABLE_LOAD_H.

* src/cid/cidriver.c: Include FT_INTERNAL_POSTSCRIPT_AUX_H.

* src/psaux/cffdecode.c: Include FT_FREETYPE_H and
FT_INTERNAL_DEBUG_H.
(FT_COMPONENT): Define.
* src/psaux/cffdecode.h: Include FT_INTERNAL_POSTSCRIPT_AUX_H.
* src/psaux/psauxmod.h: Include FT_INTERNAL_POSTSCRIPT_AUX_H.
Declare `cff_builder_funcs' and `ps_builder_funcs'.
* src/psaux/psft.c: Include `psobjs.h' and `cffdecode.h'.
* src/psaux/psobjs.c : Include `psauxmod.h'.
2017-12-07 14:33:44 +01:00
Werner Lemberg 7ec1345d13 * include/freetype/config/ftheader.h: Some clean-up.
This commit removes documentation of deprecated macros and does some
minor streamlining.
2017-12-07 14:21:39 +01:00
Werner Lemberg b85ff56417 * builds/symbian/bld.inf: Updated. 2017-12-06 23:17:23 +01:00
Werner Lemberg ed7f091323 New header file `ftparams.h' that collects all parameter tags.
* include/freetype/config/ftheader.h (FT_PARAMETER_TAGS_H): New
macro.
(FT_TRUETYPE_UNPATENTED_H, FT_UNPATENTED_HINTING_H): Define it to
`ftparams.h'.

* include/freetype/ftautoh.h, include/freetype/ftcffdrv.h,
include/freetype/ftincrem.h, include/freetype/ftlcdfil.h,
include/freetype/ftsnames.h, include/freetype/ftt1drv.h: Include
FT_PARAMETER_TAGS_H.
Move FT_PARAM_TAG_XXX definitions to...
* include/freetype/ftparams.h: ...this new file.

* include/freetype/ttunpat.h: Remove.  No longer needed.
2017-12-06 23:15:54 +01:00
Werner Lemberg 71fecc539e Improve tracing messages by using singular and plural forms.
* src/*/*.c: Implement it.
2017-12-05 12:06:29 +01:00
Werner Lemberg 87ddad2007 Update or fix links to use the https protocol instead of http. 2017-12-04 20:43:30 +01:00
Werner Lemberg 337e49cfe2 [truetype] Allow shared points in `cvar' table (#52532).
* src/truetype/ttgxvar.c (tt_face_vary_cvt): Implement it by copying
and adjusting the corresponding code from
`TT_Vary_Apply_Glyph_Deltas'.
2017-12-04 12:36:07 +01:00
Werner Lemberg c18c391b68 [truetype] Improving tracing of composite glyphs.
* src/truetype/ttgload.c (TT_Load_Composite_Glyph)
[FT_DEBUG_LEVEL_TRACE]: Show composite glyph information.
2017-11-28 12:43:45 +01:00
Werner Lemberg 40db4a9954 Allow (again) encoding vectors with more than 256 elements (#52464).
In version 2.6.1, this has been disallowed to better reject
malformed fonts; however, this restriction was too strong.  This
time, we only take the first 256 elements into account, since
encoding arrays are always accessed with a 8bit integer, according
to the PostScript Language Reference.

* src/type1/t1load.c (parse_encoding): Implement it.
2017-11-27 22:17:41 +01:00
Jan Alexander Steffens (heftig) 7d81ba7e17 Fix last commit (#52522).
* builds/freetype.mk: Set `FT_OPTION_H' and `FTOPTION_FLAG'
properly if we have `ftoption.h' in `BUILD_DIR'.
2017-11-27 07:15:04 +01:00
Werner Lemberg 8f4851997b [unix] Install a massaged `ftoption.h' file (#51780).
* builds/unix/configure.raw (ftoption_set, ftoption_unset): New
auxiliary functions to construct...
(FTOPTION_H_SED): ... this new variable.
Apply it as a sed argument while copying `ftoption.h' to the
`builds/unix' directory (using `AC_CONFIG_FILES').
Simplify code of test that checks cpp's computation of bit length
(the test previously created an empty `ftoption.h' file and deleted
it immediately afterwards); without this change, it can happen on my
GNU/Linux box that `configure's execution of `config.status' doesn't
create `ftoption.h' (no idea why this happens).

* builds/unix/install.mk (install): Install
`builds/unix/ftoption.h'.

* builds/unix/unix-def.in (DISTCLEAN): Updated.

* builds/unix/.gitignore: Updated.
2017-11-25 11:30:38 +01:00
Werner Lemberg 0d0e5bb1e6 Minor. 2017-11-23 20:42:57 +01:00
Tor Andersson 2f1863cfb7 Silence unused function warnings.
Some static function declarations cause unused function warnings if
certain config options are turned off via `ftoption.h'.

* src/base/ftbase.h, src/base/ftrfork.c, src/sfnt/ttbdf.h,
src/truetype/ttgxvar.h: Add #ifdef guards around these sections.
2017-11-23 20:40:52 +01:00
Ewald Hew bec14f6889 * src/psaux/psft.c (cf2_setGlyphWidth): Check format before setting.
Reported as

  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=4377
2017-11-22 18:59:36 +08:00
Ewald Hew b9bd2d14e2 [psaux] Fix CFF advance widths. (#52466)
Glyph advance widths were being written to the new `PS_Decoder' but not
saved to the underlying format specific decoder. This caused pure CFF
fonts to have bad advance width.

* include/freetype/internal/psaux.h (PS_Decoder): Change `glyph_width'
field to pointer.
Remove unused fields.
* src/psaux/psobjs.c (ps_decoder_init): Change `glyph_width' from copy
to reference.
Remove unused.
* src/psaux/psft.c (cf2_setGlyphWidth): Update code.
2017-11-22 12:38:36 +08:00
Vlad Tsyrklevich 954710ddd7 * include/freetype/ftrender.h: Fix `FT_Renderer_RenderFunc' type. 2017-11-15 23:06:29 +01:00
Nikolaus Waxweiler a364e38ae7 Use Adobe hinting engine for `light' hinting of both CFF and Type 1.
Since Ewald Hew factored the Adobe hinting engine out of the CFF
driver code, we can now use it on Type 1 (and CID) font formats, as
both have the same hinting philosophy.

This change activates the Adobe hinter when in LIGHT mode, and
therefore always unless explicitly asking for the auto-hinter.  This
makes LIGHT behavior consistent with CFF fonts.  As of this commit,
the hinting engine table looks as follows.

             LIGHT  NORMAL
  -------------------------
   TrueType  Auto   v40
   CFF       Adobe  Adobe
   Type 1    Adobe  Adobe
2017-11-14 07:54:53 +01:00
yuri_levchenko af585ad4fe * CMakeLists.txt: Add `DISABLE_FORCE_DEBUG_PREFIX' option. 2017-11-10 00:07:32 +01:00
Alexei Podtelezhnikov 8f5568bfc4 * src/base/ftobjs.c (FT_Load_Glyph): Relocate condition. 2017-11-06 21:42:46 -05:00
Alexei Podtelezhnikov ab6fe0768f * src/smooth/ftgrays.c (gray_set_cell): Fix uninitialized variables. 2017-11-06 21:34:56 -05:00
Ewald Hew cdab9cfae9 [psaux] Fix PostScript interpreter rewinding in Type 1 mode. (#52251)
The interpreter in Type 1 mode rewinds the charstring after collecting
all hints for building the initial hintmap (commit d52dd7f). However,
some charstrings use `endchar' in a final subroutine call, rewinding to
the start of that subroutine, and only a small section of the actual
glyph is drawn.

* src/psaux/psintrp.c (cf2_interpT2CharString) <cf2_cmdENDCHAR>:
Ensure we are on the top level charstring before rewinding.
2017-11-03 15:23:12 +08:00
suzuki toshiya 77b34e01ed [truetype] Add more tricky fonts.
See the report by Yang Yinsen.
https://lists.gnu.org/archive/html/freetype-devel/2017-11/msg00000.html

* src/truetype/ttobjs.c (trick_names): Add `DFGothic-EB',
`DFGyoSho-Lt', `DFHSGothic-W5', `DFHSMincho-W3' and `DFHSMincho-W7'.
(tt_check_trickyness_sfnt_ids): Add checksums for DFGothic-EB,
DFGyoSho-Lt, DFHSGothic-W5, DFHSMincho-W3 and DFHSMincho-W7.  Also
add checksums for DLCLiShu and DLCHayBold which their family names
were already listed but their checksums were previously unknown.
2017-11-03 16:14:27 +09:00
Alexei Podtelezhnikov 816516360c [smooth] Fix complex rendering at high ppem.
We used to split large glyphs into horizontal bands and continue
bisecting them still horizontally if that was not enough.  This is
guaranteed to fail when a single scanline cannot fit into the
rendering memory pool.  Now we bisect the bands vertically so that
the smallest unit is a column of the band height, which is guranteed
to fit into memory.

* src/smooth/ftgrays.c (gray_convert_glyph): Implement it.
2017-11-01 22:51:03 -04:00
Alexei Podtelezhnikov 91015cb41d [smooth] Improve complex rendering at high ppem.
At large sizes almost but not exactly horizontal segments can quickly
drain the rendering pool. This patch at least avoids filling the pool
with trivial cells. Beyond this, we can only increase the pool size.

Reported, analyzed, and tested by Colin Fahey.

* src/smooth/ftgrays.c (gray_set_cell): Do not record trivial cells.
2017-10-21 22:57:43 -04:00
Alexei Podtelezhnikov d74440a327 [base] Improve tracing in FT_Load_Glyph, FT_*_Size.
* src/base/ftobjs.c (FT_Load_Glyph): Tag tracing messages with
function name, glyph index, and load flags.
(FT_Select_Metrics, FT_Request_Metrics): Remove all tracing.
(FT_Select_Size, FT_Request_Size): Improve tracing.
2017-10-20 16:27:33 -04:00
Alexei Podtelezhnikov c10e7800d7 [base] Improve tracing in FT_Render_Glyph.
* src/base/ftobjs.c (FT_Render_Glyph_Internal): Add total coverage
calculations and downgrade Netpbm dump to bitmap:7.
2017-10-18 23:05:51 -04:00
Ewald Hew 94f6d57a4c [cff] Fix segfault on missing `psaux' (#52218)
* src/cff/cffload.c (cff_done_blend): Add a check for possible nullptr.

* modules.cfg: Update dependency list.
2017-10-16 19:17:30 +08:00
Alexei Podtelezhnikov ccb0f7998d [base, cff] Fix MSVC warnings.
* src/base/ftobjs.c (FT_New_Library): C4702: unreachable code.
(ft_glyphslot_preset_bitmap): C4244: possible loss of data.
* src/cff/cffload.c (cff_blend_doBlend): C4244: possible loss of data.
Turn `sum' into unsigned.
2017-10-15 14:19:13 -04:00
Alexei Podtelezhnikov 6bea49e026 [base] Netpbm image tracing.
* src/base/ftobjs.c (FT_Load_Glyph): Trace bitmap size.
(FT_Render_Glyph_Internal): Trace bitmap in Netpbm format.

* src/smooth/ftgrays.c (gray_sweep): Sweep remnants of span tracing.
2017-10-14 22:45:11 -04:00
Alexei Podtelezhnikov 7384085201 * builds/windows/ftdebug.c (FT_Message): Print to stderr.
* builds/wince/ftdebug.c (FT_Message): Ditto.
2017-10-14 22:22:27 -04:00
Behdad Esfahbod 90461c0137 [afshaper] Delay creating `hb_set' objects until needed.
In runs on Noto Naskh Arabic, this results in 89 sets created
instead of 340 before.  Makes auto-hinter setup with HarfBuzz
enabled 20% to 30% faster.

* src/autofit/afshaper.c (af_shaper_get_coverage): Implement it.
2017-10-14 08:42:07 +02:00
Ewald Hew d2b3b9e682 * devel/ftoption.h: Enable T1_CONFIG_OPTION_OLD_ENGINE by default. 2017-10-12 18:48:57 +08:00
Ewald Hew 7e23568b16 [type1, cid] Add hinting engine switch.
Implement property service in `type1' and `cid' drivers to allow
switching between FreeType or Adobe hinting engine when both are
available.

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

* src/cid/cidobjs.c (cid_driver_init), src/type1/t1objs.c
(T1_Driver_Init): Add default property values.
2017-10-12 18:32:50 +08:00
Ewald Hew dff40d03df Add T1_CONFIG_OPTION_OLD_ENGINE configuration option.
This controls whether the old Type 1 engine gets compiled into FreeType.
It is disabled by default.

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

* include/freetype/internal/psaux.h (PS_Decoder): Remove unused field.
* include/freetype/internal/psaux.h, src/cid/cidgload.c
(cid_load_glyph), src/psaux/psauxmod.c, src/psaux/psobjs.c
(ps_builder_add_point), src/psaux/t1decode.c
(t1_lookup_glyph_by_stdcharcode, t1_decoder_parse_glyph,
t1operator_seac, t1_decoder_parse_charstrings), src/psaux/t1decode.h,
src/type1/t1gload.c (T1_Parse_Glyph_And_Get_Char_String): Surround
relevant code with macro.
Minor code changes.
2017-10-12 18:32:50 +08:00
Ewald Hew 78df3c27b6 Extract width parsing from Type 1 parser.
Duplicate the fast advance width calculations from the old parser. This
is to facilitate adding options for compiling out the old parser.

* src/psaux/t1decode.{c,h} (t1_decoder_parse_metrics): New function.
* include/freetype/internal/psaux.h (T1_Decoder_Funcs): New entry
`parse_metrics'.
* src/psaux/psauxmod.c: Set the new entry.

* src/type1/t1gload.c (T1_Parse_Glyph_And_Get_Char_String),
src/cid/cidgload.c (cid_load_glyph): Separate
conditional for selecting engine.
2017-10-12 18:32:50 +08:00
Werner Lemberg 8768536c89 [autofit] Better visualize table tracing in source code. 2017-10-12 00:13:51 +02:00
Werner Lemberg 6498551921 * src/base/ftoutln.c (FT_Outline_Translate): Fix integer overflow.
Reported as

  https://bugs.chromium.org/p/chromium/issues/detail?id=772775
2017-10-09 07:45:03 +02:00
Werner Lemberg b7e43f7d7d * src/base/ftobjs.c (ft_glyphslot_preset_bitmap): Integer overflows.
Reported as

  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=3579
2017-10-08 11:58:39 +02:00
Werner Lemberg 08e2e311ef Document global size metrics needed for native bytecode hinting (#52165). 2017-10-08 10:37:50 +02:00
Werner Lemberg 91448669a2 Prevent creation of an incorrect documentation entry. 2017-10-08 10:23:47 +02:00
Werner Lemberg 7bfcaacaf5 [sfnt] Adjust behaviour of PS font names for variation fonts.
* src/sfnt/sfdriver.c (sfnt_get_var_ps_name): Use a named instance's
PS name only if no variation is applied.
2017-10-07 13:14:38 +02:00
Werner Lemberg f89c67f043 [cff, truetype] Adjust behaviour of named instances.
This commit completely separates the interaction between named
instances and variation functions.  In particular, resetting the
variation returns to the current named instance (if set) and not to
the base font.

As a side effect, variation functions no longer change the named
instance index.

* src/cff/cffobjs.c (cff_face_init): Use MM service's `set_instance'
function.
Also apply `MVAR' table to named instances.

* src/truetype/ttgxvar.c (TT_Get_MM_Var): Add cast.
(tt_set_mm_blend): No longer check whether requested variation
coincides with a named instance.
(TT_Set_Var_Design): Use current named instance for default
coordinates.
* src/truetype/ttobjs.c (tt_face_init): Use `TT_Set_Named_Instance'.
2017-10-07 13:10:53 +02:00
Werner Lemberg e9ef538a4f Make `FT_Set_Named_Instance' work.
* src/cff/cffdrivr.c (cff_set_instance): New function.
(cff_service_multi_masters): Register it.

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

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

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

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

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

* src/type1/t1load.c (T1_Set_MM_Blend, T1_Set_MM_Design): Handle
`FT_FACE_FLAG_VARIATION'.
2017-10-07 12:12:49 +02:00
Werner Lemberg dd8539ef82 New function `FT_Set_Named_Instance'.
No effect yet.

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

* include/freetype/ftmm.h: Updated.
2017-10-07 11:40:03 +02:00
Werner Lemberg b3f9c4f2f6 Add macros for checking whether a font variation is active.
* include/freetype/freetype.h (FT_FACE_FLAG_VARIATION,
FT_IS_VARIATION): New macros.
No effect yet.
2017-10-07 11:34:23 +02:00
Werner Lemberg e23fe2adbc Add framework for setting named instance in MM service.
* include/freetype/internal/services/svmm.h (FT_Set_Instance_Func):
New function typedef.
(MultiMasters): Add `set_instance' member.
(FT_DEFINE_SERVICE_MULTIMASTERSREC): Updated.

* src/cff/cffdrivr.c (cff_service_multi_masters),
src/truetype/ttdriver (tt_service_gx_multi_masters),
src/type1/t1driver.c (t1_service_multi_masters): Updated.
2017-10-07 11:25:04 +02:00
Werner Lemberg f06456a82d [type1] Minor code shuffling.
* src/type1/t1load.c (T1_Set_MM_Blend): Make it a wrapper of...
(t1_set_mm_blend): ...this new function.
(T1_Set_MM_Design): Use `t1_set_mm_blend'.
2017-10-07 10:35:11 +02:00
Werner Lemberg c3083e4595 * src/base/ftobjs.c (ft_glyphslot_preset_bitmap): Fix integer
overflow.

Reported as

  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=3539
2017-10-05 14:32:24 +02:00
Werner Lemberg 2e58808d48 Fix compiler warnings.
* src/cff/cffdrivr.c (cff_ps_get_font_extra): Avoid code that relies
on numeric overflow.
Add cast.

* src/smooth/ftsmooth.c (ft_smooth_render_generic): Fix variable
types, add cast.
2017-10-05 14:26:33 +02:00
John Tytgat 1df35d94c7 [cff] Add support for `FSType'.
* include/freetype/internal/cfftypes.h (CFF_FontRec): Add
`font_extra' entry.

* src/cff/cffdrivr.c (cff_ps_get_font_extra): New function to
retrieve FSType info from the embedded PostScript data.
(cff_service_ps_info): Register function.

* src/cff/cffload.c (cff_font_done): Free `font_extra'.
2017-10-04 22:46:36 +02:00
Werner Lemberg 4a5c0b1456 CHANGES: Formatting. 2017-10-02 06:09:50 +02:00
Werner Lemberg af03d1eaa1 [smooth,type1] Formatting, whitespace. 2017-10-01 09:23:42 +02:00
Werner Lemberg 179caf5a61 [psaux] Formatting, minor fixes, whitespace, copyright notices. 2017-10-01 01:40:12 +02:00
Werner Lemberg 9b549fa69a [base,cff,cid] Whitespace, formatting. 2017-10-01 00:41:07 +02:00
Werner Lemberg 2127f07624 [include] Whitespace. 2017-10-01 00:41:07 +02:00
Alexei Podtelezhnikov c8d8e15803 Signedness fixes in bitmap presetting.
Reported as

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

* src/raster/ftrend1.c (ft_raster1_render): Exlicitly signed height.
* src/smooth/ftsmooth.c (ft_smooth_render_generic): Ditto.
* src/base/ftobjs.c (ft_glyphslot_preset_bitmap): Explicitly unsigned
subtraction.
2017-09-30 14:28:58 -04:00
Alexei Podtelezhnikov c26f7f975b Bitmap metrics presetting [2/2].
* src/base/ftobjs.c (FT_Load_Glyph): Preset the bitmap metrics when
appropriate but `FT_Render_Glyph' is not called.
* include/freetype/freetype.h (FT_GlyphSlotRec): Document the change.
2017-09-29 00:13:19 -04:00
Alexei Podtelezhnikov ae7dc1f62d [smooth, raster] Miscellaneous cleanups.
* src/raster/ftrend1.c (ft_raster1_render): Clean up the exit.
* src/smooth/ftsmooth.c (ft_smooth_render_generic): Reduce
translations and clean up the exit.
(ft_smooth_render_lcd, ft_smooth_render_lcd): Remove unused `error'..
2017-09-28 22:59:31 -04:00
Ben Wagner c06b9cf56d [truetype] Really, really fix #52082.
* src/truetype/ttinterp.c (Ins_MDRP): Correct conditional.
2017-09-28 19:08:38 +02:00
Werner Lemberg ec7d2e5f68 * src/psaux/psintrp.c (cf2_doStems): Fix integer overflow.
Reported as

  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=3510
2017-09-28 14:21:34 +02:00
Ewald Hew 97cd12657d * src/cid/cidgload.c (cid_slot_load_glyph): Fix memory leak.
Reported as

  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=3489
2017-09-28 08:29:33 +02:00
Alexei Podtelezhnikov 61d1818b5e Bitmap metrics presetting [1/2].
This mainly just extracts the code for presetting the bitmap metrics
from the monochrome, grayscale, and LCD renderers into a separate
function.

* src/base/ftobjs.c (ft_glyphslot_preset_bitmap): New function that
calculates prespective bitmap metrics for the given rendering mode.
* include/freetype/internal/ftobjs.h (ft_glyphslot_preset_bitmap):
Declare it.

* src/base/ftlcdfil.c (ft_lcd_padding): New helper function that adds
padding to CBox taking into account pecularities of LCD rendering.
* include/freetype/ftlcdfil.h (ft_lcd_padding): Declare it.

* src/raster/ftrend1.c (ft_raster1_render): Reworked to use
`ft_glyphslot_preset_bitmap'.
* src/smooth/ftsmooth.c (ft_smooth_render_generic): Ditto.
(ft_smooth_render_lcd, ft_smooth_render_lcd): The pixel_mode setting
is moved to `ft_glyphslot_preset_bitmap'.
2017-09-28 00:20:50 -04:00
Ewald Hew dd40d10e81 Fix compiler warning.
* src/psaux/pshints.c (cf2_hintmap_dump): Add switch for tracing code.
2017-09-28 10:49:38 +08:00
Werner Lemberg 693a1181d6 * src/sfnt/ttload.c (tt_face_load_font_dir): Fix compiler warning. 2017-09-27 08:42:50 +02:00
Werner Lemberg 12ae57d992 Copyright notices, formatting, whitespace, minor doc fixes. 2017-09-26 12:53:41 +02:00
Werner Lemberg 4cdbac05b9 Fix compiler warnings.
* src/psaux/psft.c (cf2_initLocalRegionBuffer): Remove redundant
test.

* src/psaux/psintrp.c (cf2_interpT2CharString)
<cf2_escCALLOTHERSUBR>: Add casts.

* src/psaux/psobjs.c (ps_decoder_init): Add cast.
2017-09-25 09:26:59 +02:00
Ewald Hew a1a6a1f679 Minor fixes.
* include/freetype/internal/psaux.h, src/psaux/psobjs.{c,h}:
Rearrange `ps_builder_init' arguments to conventional order.

* src/psaux/psft.c (cf2_decoder_parse_charstrings): Add a check and
notice for `SubFont' in Type 1 mode.
2017-09-25 09:26:59 +02:00
Ewald Hew 6e7da50bc3 Documentation fixes. 2017-09-25 09:26:59 +02:00
Ewald Hew ebb1735aa7 Move `psdecode' into `psobjs'.
As the former only contains a single procedure, move it into
`psobjs' for simplicity.  Also change the parameter order to the
conventional one.

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

* include/freetype/internal/psaux.h (PSAux_ServiceRec): Update
`ps_decoder_init' function signature.

* src/cff/cffgload.c, src/cid/cidgload.c, src/type1/t1gload.c:
Update calls.

* src/psaux/psaux.c, src/psaux/psauxmod.c: Update includes.

* src/psaux/Jamfile (_sources), src/psaux/rules.mk (PSAUX_DRV_SRC):
Update file references.
2017-09-25 09:26:59 +02:00
Ewald Hew d52dd7f31d Fix Type 1 hinting.
Type 1 hinting breaks sometimes when mid-charstring hints should
have been in the initial hintmap.  This fix adds a preprocessing
pass that reads all hints and builds the correct initial hintmap
first, before proceeding to build the glyph outline.

* src/psaux/psintrp.c (cf2_interpT2CharString): New
`initial_map_ready' boolean flag.
Ignore outline commands and hint changes on first pass.
<cf2_cmdENDCHAR>: Add section to build hintmap and rewind.
2017-09-25 09:26:59 +02:00
Ewald Hew 2f0e114068 Add tracing for hints.
* src/psaux/pshints.c (cf2_hintmap_dump): New function.
(cf2_hintmap_insertHint): Trace incoming and inserted hints.
(cf2_hintmap_build): Dump hintmap before and after hint adjustment.
2017-09-25 09:26:59 +02:00
Ewald Hew 999a75b6db Minor fixes.
* src/psaux/psintrp.c (cf2_interpT2CharString): Fix check for pop
results.
s/font->decoder/decoder/ where necessary.
<cf2_cmdHSTEM, cf2_cmdVSTEM, cf2_escHSTEM3, cf2_escVSTEM3>: Use
offset parameter in `cf2_doStems' instead of doing correction for
left-sidebearing.
2017-09-25 09:26:59 +02:00
Ewald Hew 0e53cf6d67 Use the new engine.
* src/cid/cidgload.c: Update includes.
(cid_load_glyph, cid_slot_load_glyph): Implement changes to glyph
loading code as with `type1' module.
2017-09-25 09:26:59 +02:00
Ewald Hew a5c02f49b5 Add Adobe engine configuration.
This is similar to what was done in the `type1' module.

* src/cid/cidriver.c (t1cid_driver_class): Update declaration.
* src/cid/cidobjs.c: Include FT_TYPE1_DRIVER_H.
(cid_driver_init): Update code.
2017-09-25 09:26:59 +02:00
Ewald Hew 93e3cffddf Change subfont synthesis for CID fonts.
Change `t1_make_subfont' to take in the Private dict record as an
argument.  This is because Type 1 and CID font records in FreeType
have this in different places.

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

* include/freetype/internal/psaux.h, src/psaux/psobjs.h: Update
declaration.

* src/type1/t1gload.c (T1_Parse_Glyph_And_Get_Char_String): Update
call.
2017-09-25 09:26:59 +02:00
Ewald Hew e28550af18 Switch to Adobe engine.
* src/type1/t1objs.c (T1_Driver_Init): Set default to Adobe engine.
2017-09-25 09:26:59 +02:00
Ewald Hew d813b5da59 Extend Adobe interpreter (seac).
This concludes the changes needed to add Type 1 support.

* src/psaux/psintrp.c: Update includes.
(cf2_interpT2CharString) <cf2_escSEAC>: Implement this similarly to
implied seac for CFF.

* src/psaux/t1decode.c (t1_lookup_glyph_by_stdcharcode_ps): New
function to look up the glyph index.

* src/psaux/psft.c (cf2_getT1SeacComponent,
cf2_freeT1SeacComponent): New functions to get the charstrings for
seac components.

* src/psaux/t1decode.h, src/psaux/psft.h: Update declarations.
2017-09-25 09:26:59 +02:00
Ewald Hew d55a701de6 Extend Adobe interpreter (flex in callothersubr).
* src/psaux/psintrp.c (cf2_interpT2CharString)
<cf2_escCALLOTHERSUBR>: Fix Flex feature handling (OtherSubrs 0, 1,
2).
<cf2_cmdRMOVETO>: Do not actually move the `glyphPath' while doing
flex.  This is to avoid closing the current contour.
2017-09-25 09:26:59 +02:00
Ewald Hew 9668255965 Extend Adobe interpreter (callothersubr).
* src/psaux/psintrp.c (cf2_interpT2CharString)
<cf2_escCALLOTHERSUBR>: Copy code from
`t1_decoder_parse_charstrings' (in `t1decode.c').
OtherSubr 3 (change hints) should reset the hintmask, so that the
new hints are applied.
Fix function calls and stack access.
2017-09-25 09:26:59 +02:00
Ewald Hew 77c1b331f6 Extend Adobe interpreter (pop).
* src/psaux/psintrp.c (cf2_interpT2CharString): Change how unhandled
OtherSubr results are stored.  Implement the PostScript stack using
an array.
<cf2_escPOP>: Ensure that the stack is not cleared after getting
`OtherSubr' results.
Fix stack access.
2017-09-25 09:26:59 +02:00
Ewald Hew 1e4d3dc8ea Extend Adobe interpreter (callsubr).
* src/psaux/psintrp.c (cf2_interpT2CharString) <cf2_cmdCALLSUBR>:
Type 1 mode.

* src/psaux/psft.c (cf2_initLocalRegionBuffer): Add Type 1 mode.
2017-09-25 09:26:59 +02:00
Ewald Hew 4b58c518c9 Extend Adobe interpreter (div, four-byte numbers).
* src/psaux/psintrp.c (cf2_interpT2CharString) <cf2_escDIV>: Add
Type 1 mode.  Type 1 requires large integers to be followed by
`div'; cf. `Adobe Type 1 Font Format', section 6.2.
<op == 255>: Push Type 1 four-byte numbers as `Int' always.  This is
to ensure `div' and `callsubr' get values they can use.
2017-09-25 09:26:59 +02:00
Ewald Hew 81b86c459c Extend Adobe interpreter (hstem, vstem, hstem3, vstem3).
* src/psaux/psintrp.c (cf2_interpT2CharString) <cf2_cmdHSTEM,
cf2_cmdVSTEM>: Add correction for left sidebearing in Type 1 mode.
Allow adding hints mid-charstring.
<cf2_escVSTEM3, cf2_escHSTEM3>: Translate into equivalent commands
for three normal stem hints.  This requires some recalculation of
stem positions.
Correction for left sidebearing.
2017-09-25 09:26:59 +02:00
Ewald Hew e180afa951 Extend Adobe interpreter (hsbw, sbw).
* src/psaux/psintrp.c (cf2_doStems): `hsbw' or `sbw' must be the
first operation in a Type 1 charstring.
(cf2_interpT2CharString): Remove unused variables.
<cf2_cmdHMOVETO, cf2_cmdVMOVETO, cf2_cmdRMOVETO>: `hsbw' or `sbw'
must be the first operation in a Type 1 charstring.
<cf2_cmdHSBW, cf2_escSBW>: Fix data access and add correction for
left sidebearing.
2017-09-25 09:26:59 +02:00
Ewald Hew 2f4abaec38 Extend Adobe interpreter (setcurrentpoint).
* src/psaux/psintrp.c (cf2_interpT2CharString)
<cf2_escSETCURRENTPT>: Fix stack access.
2017-09-25 09:26:59 +02:00
Ewald Hew 4ed1b98dbd Extend Adobe interpreter (closepath).
* src/psaux/psintrp.c (cf2_interpT2CharString) <c2f_cmdCLOSEPATH>:
Use the right builder function.  We can use the `haveWidth' boolean
already present, instead of implementing `parse_state'.
2017-09-25 09:26:59 +02:00
Ewald Hew 37ed70f628 Add Type 1 operations to Adobe CFF interpreter.
The following Type 1 specific ops have been added (copied from
`t1decode'):

  closepath
  vstem3
  hstem3
  seac
  sbw
  callothersubr
  pop
  setcurrentpoint
  hsbw

The following require a Type 1 mode, because of differences in
specification:

  hstem
  vstem
  vmoveto
  callsubr
  div
  rmoveto
  hmoveto
  Numbers

The subsequent commits will implement these changes and adapt
accesses of data and objects to the new interpreter.

NOTE: Will not compile in the meantime!

* src/psaux/psintrp.c: Add opcodes to enum.
(cf2_interpT2CharString): Copy relevant code over from
`t1_decoder_parse_charstrings' (in `t1decode.c').
2017-09-25 09:26:59 +02:00
Ewald Hew 283ef28505 Fixes for rendering.
The Type 1 advance width calculation passes null for glyph slot,
etc, which can cause null pointer access in the new interpreter.
Fall back to the old one for now.

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

* src/type1/t1gload.c (T1_Parse_Glyph_And_Get_Char_String): Add a
check for metrics_only.
Set the `force_scaling' flag.
(T1_Parse_Glyph): Updated.
(T1_Load_Glyph): Add `hinting' and `scaled' flags.
2017-09-25 09:26:59 +02:00
Ewald Hew 6eb03f8f5a Add missing objects (2/2).
Synthesize a `SubFont' object for Type 1 fonts.  This is used in the
interpreter to access Private dict data, which are stored in
different places for Type 1 and CFF.  This allows the same data to
be used in either mode.

* src/psaux/psobjs.c (t1_make_subfont): New procedure to copy
required values to a dummy `CFF_SubFont' object.  This is similar to
`cff_make_private_dict'.
* src/psaux/psobjs.h: Add the new declaration.

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

* src/type1/t1gload.c: Include FT_INTERNAL_CFF_TYPES_H.
(T1_Parse_Glyph_And_Get_Char_String): Add the call.
2017-09-25 09:26:59 +02:00
Ewald Hew cb3f4c610d Add missing objects for Type 1 (1/2).
Move `CF2_Font' instance to `PS_Decoder'.  This is the context for
the interpreter and since it is currently stored in `CFF_Font', is
unavailable in Type 1 mode.

* include/freetype/internal/psaux.h (T1_Decoder, PS_Decoder): New
`cf2_instance' field.

* src/psaux/psdecode.c (ps_decoder_init): Copy `cf2_instance' to
`PS_Decoder'.

* src/psaux/t1decode.c (t1_decoder_done): Add finalization code.

* src/psaux/psft.c (cf2_decoder_parse_charstrings): Update accesses.
2017-09-25 09:26:59 +02:00
Ewald Hew 7e185dcd79 Allow `type1' module to use the Adobe engine.
Add the callback and some conditionals to switch between the two
engines.

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

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

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

* src/cid/cidgload.c (cid_load_glyph): Update call.
* src/base/ftobjs.c, src/psaux/psobjs.c, src/type1/t1gload.c: Update
includes.
2017-09-25 09:26:59 +02:00
Ewald Hew 97704b158e Add Adobe engine configuration.
Use the previously changed PS_Driver in type1 module to store
hinting engine configuration.

* include/freetype/ftt1drv.h: New file.
Duplicate and rename config options from CFF.
* include/freetype/config/ftheader.h (FT_TYPE1_DRIVER_H): New macro.

* src/type1/t1driver.c (t1_driver_class): Update declaration.
* src/type1/t1objs.c: Include FT_TYPE1_DRIVER_H.
(T1_Driver_Init): Update code.
2017-09-25 09:26:59 +02:00
Ewald Hew 645d1b86ad Move and rename `CFF_Driver'.
This is so that we can use the same hinting engine parameters for
Type 1.

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

* src/cff/cffdrivr.c, src/cff/cffgload.c, src/cff/cffload.c,
src/cff/cffobjs.c, src/cff/cffobjs.h, src/psaux/psft.c,
src/psaux/psobjs.c: Update references.
2017-09-25 09:26:59 +02:00
Ewald Hew d23affe1ef Reorganize object fields.
Make some fields more generic, so that we can access them the same
way regardless of Type 1 or CFF.

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

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

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

* src/psaux/psobjs.c (ps_builder_init, ps_builder_add_point):
Updated with above changes.
2017-09-25 09:26:59 +02:00
Ewald Hew 9428ee42c0 Prepare for Type 1 mode.
Add some checks for Type 1 data passing through.

* src/psaux/psfont.h (CF2_Font): Add `isT1' flag.
* src/psaux/psfont.c (cf2_font_setup): Skip the variations and blend
code which is not applicable for Type 1.

* src/psaux/psft.c (cf2_decoder_parse_charstrings): Avoid accessing
`decoder->cff' in Type 1 mode.
Copy `is_t1' flag to `CF2_Font'.
2017-09-25 09:26:59 +02:00
Ewald Hew 0589e3c012 Use the new objects.
* include/freetype/internal/psaux.h, src/psaux/psauxmod.c: Fix
switching between new and old engines.

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

* src/psaux/psblues.c, src/psaux/psfont.c, src/psaux/psfont.h,
src/psaux/psft.c, src/psaux/psft.h, src/psaux/psintrp.c: Update all
to use new objects.
2017-09-25 09:26:59 +02:00
Ewald Hew 43c015823f Objects for new interpreter (part 2).
Make the new objects copy over values.  They are essentially wrapper
types for the different decoders/builders.

* include/freetype/internal/psaux.h: Update declarations.
(PS_Builder): Add `is_t1' flag.
(PS_Decoder_{Get,Free}_Glyph_Callback): Renamed to...
(CFF_Decoder_{Get,Free}_Glyph_Callback: ... this.
(PS_Decoder): Updated.
Add `t1_parse_callback' member.
(PSAux_ServiceRec): Add `ps_decoder_init' member.

* src/psaux/psdecode.h, src/psaux/psobjs.h: Update declarations.

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

* src/psaux/psauxmod.c: Add builder and decoder functions to `PSAux'
service.
2017-09-25 09:26:59 +02:00
Ewald Hew eba54c28dc Add objects for new interpreter.
Introduce `PS_Decoder' and `PS_Builder' which include all fields
from either Type 1 or CFF decoders/builders.

* include/freetype/internal/psaux.h (PS_Builder, PS_Decoder): New
structs.

* src/psaux/psobjs.c, src/psaux/psobjs.h: Add `PS_Builder'
functions.

* src/psaux/psdecode.c, src/psaux/psdecode.h: New files to hold
`PS_Decoder' initialization functions.

* src/psaux/psaux.c, src/psaux/Jamfile (_sources),
src/psaux/rules.mk (PSAUX_DRV_SRC): Updated.
2017-09-25 09:26:59 +02:00
Ewald Hew 766f529a31 Rename files.
Replace the `cf2' file name prefix with `ps' as the Adobe engine
will be used for both PostScript Types 1 and 2 (CFF) instead of just
CFF.

s/cf2/ps/ for all following.

* src/psaux/cf2*: Rename files.
* src/psaux/*: Update includes.

* src/psaux/Jamfile (_sources), src/psaux/rules.mk (PSAUX_DRC_SRC,
PSAUX_DRV_H): Update file references.
2017-09-25 09:26:59 +02:00
Ewald Hew 8a1b5c0c6d Minor fix.
Use `MultiMasters' service in `psaux' instead of a call to `cff'.
The project builds if CFF_CONFIG_OPTION_OLD_ENGINE is not defined.

* src/psaux/cf2ft.c: Update includes.
(cf2_getNormalizedVector): Use `mm->get_var_blend' instead of
`cff_get_var_blend'.
2017-09-25 09:26:59 +02:00
Ewald Hew b624868b8e Move `cff_random' into `psaux' service.
NOTE: Does not compile!

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

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

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

* src/cff/cffload.c, src/psaux/cf2intrp.c: Update code.
2017-09-25 09:26:59 +02:00
Ewald Hew df11628b76 Move struct declarations to `freetype/internal'.
NOTE: Does not compile!

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

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

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

* include/freetype/internal/internal.h (FT_INTERNAL_CFF_TYPES_H,
FT_INTERNAL_CFF_OBJECT_TYPES_H): New macros.

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

* src/cff/rules.mk (CFF_DRV_H): Updated.
2017-09-25 09:26:59 +02:00
Ewald Hew edacde60e3 Add new service for inter-module calls.
NOTE: Does not compile!

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

* include/freetype/internal/services/svcfftl.h: New file, setting up
a `CFFLoad' service.

* include/freetype/internal/ftserv.h (FT_DEFINE_SERVICEDESCREC10,
FT_DEFINE_SERVICEDESCREC): New macros.
(FT_SERVICE_CFF_TABLE_LOAD_H): New macro.

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

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

* src/cff/cffobjs.c, src/psaux/cf2font.c, src/psaux/cf2ft.c,
src/psaux/cf2intrp.c, src/psaux/cffdecode.c: Use the new service.
2017-09-25 09:26:59 +02:00
Ewald Hew 9578e07a83 Add callbacks for inter-module calls.
NOTE: Does not compile!

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

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

* src/cff/cffgload.c (cff_compute_max_advance, cff_slot_load):
Update calls to pass in callbacks.
* src/psaux/cf2ft.c, src/psaux/cffdecode.c: Use them.
2017-09-25 09:26:59 +02:00
Ewald Hew 1487be586e Create new `PSAux' service interface entries.
NOTE: Does not compile!

* include/freetype/internal/psaux.h: Include
FT_INTERNAL_TRUETYPE_TYPES_H.
(CFF_Builder_FuncsRec, CFF_Decocer_FuncsRec): New function tables.
(CFF_Builder): Updated.
Fix for forward declaration.
(PSAux_ServiceRec): New field `cff_decoder_funcs'.

* src/psaux/psauxmod.c (cff_builder_funcs, cff_decoder_funcs): New
function tables.
(PSAux_Interface): Updated.

* include/freetype/internal/tttypes.h (TT_FaceRec): Add `psaux'
service interface.

* src/cff/cffgload.c, src/cff/cffobjs.c, src/cff/cffparse.c: Update
function calls to use psaux service.
2017-09-25 09:26:59 +02:00
Ewald Hew 816c9c1f83 Move CFF builder components into `psaux' module.
NOTE: Does not compile!

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

* src/cff/cffgload.h: Move corresponding declarations to
`src/psaux/psobjs.h'.

* src/cff/cffgload.h (CFF_Builder): Move struct declaration to...
* include/freetype/internal/psaux.h: Here.
2017-09-25 09:26:59 +02:00
Ewald Hew 705bbe7c7b Move CFF decoder components into `psaux' module.
NOTE: Does not compile!

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

* src/cff/cffgload.h: Move corresponding declarations to...
* src/psaux/cffdecode.h: This new file.

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

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

* src/psaux/psaux.c, src/psaux/rules.mk (PSAUX_DRV_SRC): Update with
the new file.
2017-09-25 09:26:59 +02:00
Ewald Hew 62f095f046 [psaux, cff] Move Adobe's engine components into `psaux' module.
This is the first patch of a sequence to move the Type 2 charstring
processing capability from the `cff' module to the `psaux' module.

NOTE: Does not compile!

* src/cff/cf2*: Move these files to...
* src/psaux/cf2*: Here.

* src/cff/Jamfile (_sources), src/cff/rules.mk (CFF_DRV_SRC,
CFF_DRV_H), src/cff/cff.c, src/cff/cffgload.c: Remove file
references.

* src/psaux/Jamfile (_sources), src/psaux/rules.mk, src/psaux/psaux.c
(PSAUX_DRV_SRC, PSAUX_DRV_H): Add file references.
2017-09-25 09:25:55 +02:00
Alexei Podtelezhnikov 02e80da609 Tweak per-face LCD filtering controls.
Thing are simpler with a NULL-function pointer.

* include/freetype/internal/ftobjs.h (FT_Face_InternalRec): New
pointer to the filter function.
(FT_LibraryRec): Remove unused `lcd_filter'.
(FT_Bitmap_LcdFilterFunc, ft_lcd_filter_fir):  Move from here...
* include/freetype/ftlcdfil.h (FT_Bitmap_LcdFilterFunc,
ft_lcd_filter_fir): ... to here.

* src/base/ftobjs.c (ft_open_face_internal): NULL-initialize the
per-face filter.
(FT_Face_Properties): Set it.
* src/smooth/ftsmooth.c (ft_smooth_render_generic): Simplify.

* src/base/ftlcdfil.c (ft_lcd_filter_fir, FT_Libary_SetLcdFilter):
Minor.
2017-09-24 22:18:34 -04:00
Werner Lemberg 6f2b6f8f72 Split off ChangeLog.27. 2017-09-24 17:42:38 +02:00
Jonathan Kew 0d1262a41e [sfnt] Fix `premultiply_data' (#52092).
* src/sfnt/pngshim.c (premultiply_data): Don't use vector extension
if we have less than 16 bytes of data.
2017-09-24 17:36:47 +02:00
Werner Lemberg e720206925 Minor. 2017-09-24 09:16:39 +02:00
Werner Lemberg 6d403d089d Fix handling of ValueRecords.
For GPOS pair positioning format 1 the description of ValueRecords
in the OpenType specification (1.8.2, from today) is wrong – the
offset has to be taken from the parent structure; in this case the
`PairSet' table.

* src/otvalid/otvgpos.c (otv_PairSet_validate): Set `extra3'.
(otv_PairPos_validate): Adjust.
2017-09-24 09:15:11 +02:00
Werner Lemberg 0da0faf0fb [otvalid] Handle `GSUB' and `GPOS' v1.1 tables.
* src/otvalid/otvgsub.c (otv_GSUB_validate), src/otvalid/otvgpos.c
(otv_GPOS_validate): Implement it.
2017-09-24 09:15:11 +02:00
Werner Lemberg 2b79d25f22 [otvalid] Update common table handling to OpenType 1.8.2.
* src/otvalid/otvcommn.c (otv_Device_validate): Handle
VariationIndex subtable.
(otv_Lookup_validate): Handle MarkFilteringSet.
2017-09-24 09:15:11 +02:00
Alexei Podtelezhnikov e7ac8e40e8 [build] Windows-style DLL versioning.
* build/windows/ftver.rc: New VERSIONINFO resource.
* build/windows/vc2010/freetype.vcxproj: Further improvements.
2017-09-23 14:04:49 -04:00
Ben Wagner 63be40bccf [truetype] Really fix #52082.
* src/truetype/ttinterp.c (Ins_MDRP): Correct conditional.
2017-09-23 00:44:59 +02:00
Werner Lemberg b0103677be [otvalid] Handle `GDEF' v1.2 and v1.3 tables.
No validation of variation stuff yet.

* src/otvalid/otvgdef.c (otv_MarkGlyphSets_validate): New function.
(otv_GDEF_validate): Implement it.
2017-09-23 00:40:28 +02:00
Werner Lemberg 6756a18578 [otvalid] Handle `BASE' v1.1 table.
No validation of variation stuff yet.

* src/otvalid/otvbase.c (otv_BASE_validate): Implement it.
2017-09-23 00:36:49 +02:00
Werner Lemberg 3645982ac2 [otvalid] Macros for 32bit offset support.
* src/otvalid/otvcommn.h (OTV_OPTIONAL_TABLE32,
OTV_OPTIONAL_OFFSET32, OTV_SIZE_CHECK32): New macros.
2017-09-22 07:53:25 +02:00
Werner Lemberg 21c235ecf1 [otvalid] Whitespace. 2017-09-22 07:28:25 +02:00
Alexei Podtelezhnikov 3be8e34714 [build] Simplify Visual C++ 2010 project.
* build/windows/vc2010/freetype.vcxproj: Remove fake singlethreaded
configurations and tweak.
2017-09-21 23:12:59 -04:00
Werner Lemberg 6d04bd991b [truetype] Integer overflow (#52082).
* src/truetype/ttinterp.c (Ins_MDRP): Avoid FT_ABS.
2017-09-21 21:22:51 +02:00
Werner Lemberg 1ad07c1c79 Add some `since' fields (back to version 2.4.8). 2017-09-21 14:56:58 +02:00
Werner Lemberg cf64e338dd [sfnt] Fix postscript name for default instance of variation fonts.
Problem reported by Behdad.

* src/sfnt/sfdriver.c (sfnt_get_ps_name): Test
`is_default_instance'.
2017-09-21 11:42:48 +02:00
Werner Lemberg b19cdc9c81 [truetype] Fix `mmvar' array pointers, part 2.
The previous commit was incomplete.

* src/truetype/ttgxvar.c: Properly initialize sub-array offsets for
`master' also.
2017-09-21 11:02:35 +02:00
Werner Lemberg 3b3cb32dd2 [truetype] Fix `mmvar' array pointers.
Without this change, clang's AddressSanitizer reports many runtime
errors due to misaligned addresses.

* src/truetype/ttgxvar.c (TT_Get_MM_Var): Use multiples of pointer
size for sub-array offsets into `mmvar'.
2017-09-21 09:03:20 +02:00
Alexei Podtelezhnikov 843e0dc92b Restore FT_EXPORT documentation. 2017-09-20 22:19:01 -04:00
Werner Lemberg eaa9adf325 [truetype] Integer overflows.
Changes triggered by

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

* src/truetype/ttinterp.c (Ins_SHPIX, Ins_DELTAP): Use NEG_LONG.
(Ins_MIAP): Use SUB_LONG.
2017-09-20 08:00:05 +02:00
Alexei Podtelezhnikov 74f442394f [build] Fix DLL builds in Visual C++ project.
* build/windows/vc2010/freetype.vcxproj: Use DynamicLibrary in Debug
and Release configurations.
* include/freetype/config/ftconfig.h (FT_EXPORT, FT_EXPORT_DEF)
[_DLL]: Use Visual C++ extensions.
2017-09-19 23:41:27 -04:00
John Tytgat b00be9f609 [cff] Fix family name logic of pure CFF fontdata (#52056).
1. If `FamilyName' is present in the CFF font, use this for
   FT_Face's `family_name'.
2. Otherwise, use the face name and chop off any subset prefix.
3. If at this point FT_Face's `family_name' is set, use this
   together with the full name to determine the style.
4. Otherwise, use `CIDFontName' as FT_Face's `family_name'.
5. If we don't have a valid style, use "Regular".

Previously, FT_Face's `family_name' entry for pure CFF fontdata
nearly always was the fontname itself, instead of the `FamilyName'
entry in the CFF font (assuming there is one).

* src/cff/cffobjs.c (cff_face_init) [pure_cff]: Implement it.
2017-09-19 07:12:03 +02:00
Alexei Podtelezhnikov 8b0d2e9e02 [build] Declutter Visual C++ 2010-2017 project.
* build/windows/vc2010/freetype.vcxproj: Use MaxSpeed (/02)
optimization for Release configuration throughout the project.
2017-09-18 22:54:49 -04:00
Werner Lemberg 39ce3ac499 * Version 2.8.1 released.
=========================

Tag sources with `VER-2-8-1'.

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

* README, Jamfile (RefDoc), builds/windows/vc2005/freetype.vcproj,
builds/windows/vc2005/index.html,
builds/windows/vc2008/freetype.vcproj,
builds/windows/vc2008/index.html,
builds/windows/vc2010/freetype.vcxproj,
builds/windows/vc2010/index.html,
builds/windows/visualc/freetype.dsp,
builds/windows/visualc/freetype.vcproj,
builds/windows/visualc/index.html,
builds/windows/visualce/freetype.dsp,
builds/windows/visualce/freetype.vcproj,
builds/windows/visualce/index.html,
builds/wince/vc2005-ce/freetype.vcproj,
builds/wince/vc2005-ce/index.html,
builds/wince/vc2008-ce/freetype.vcproj,
builds/wince/vc2008-ce/index.html: s/2.8/2.8.1/, s/28/281/.

* include/freetype/freetype.h (FREETYPE_PATCH): Set to 1.

* builds/unix/configure.raw (version_info): Set to 21:0:15.
* CMakeLists.txt (VERSION_PATCH): Set to 1.
2017-09-16 19:08:17 +02:00
Alexei Podtelezhnikov c28e9c9b3e Typos. 2017-09-15 22:23:01 -04:00
Alexei Podtelezhnikov 1264d9a64b Minor. 2017-09-15 21:49:34 -04:00
Werner Lemberg 17eb240698 Update fuzzer-bot URL. 2017-09-14 22:39:51 +02:00
Werner Lemberg 7cb6f2173a Formatting. 2017-09-14 12:09:37 +02:00
suzuki toshiya b757ddb162 [sfnt] lowest gcc for vectors ( e1d0249e ) is changed to 4.7.
__builtin_shuffle() was introduced in gcc-4.7.  The lowest
gcc to enable vector operation is delayed from 4.6 to 4.7.

* src/sfnt/pngshim.c (premultiply_data): Fix cpp-macro to
enable the vector operation, to change the lowest gcc version
from 4.6 to 4.7.
2017-09-13 22:17:03 +09:00
suzuki toshiya 5ad845771a [cache] Fix a possible overflow by signed integer comparison.
Improve the code by 5d3ff05615 ,
issues are found by Behdad Esfahbod and Werner Lemberg.

* src/cache/ftcbasic.c (FTC_ImageCache_Lookup): Replace
a subtraction to check higher bit by a bit operation,
and cpp-conditionalize for appropriate systems.  Add better
documentation to the comment.
(FTC_ImageCache_LookupScaler): Ditto.
(FTC_SBitCache_Lookup): Ditto.
(FTC_SBitCache_LookupScaler): Ditto.
2017-09-13 15:49:15 +09:00
Werner Lemberg 96dcc8ad6e [autofit] Really fix #41334 (#52000).
* src/autofit/aflatin.c (af_latin_hints_compute_segments): Set
`segment->delta' everywhere.
2017-09-13 08:16:23 +02:00
suzuki toshiya 21658c31f7 [autofit, sfnt] Fix for `make multi'.
* src/autofit/afshaper.c: Include FT_ADVANCE_H, to use
FT_Get_Advance() in it.
* src/sfnt/ttcmap.c: Include FT_SERVICE_POSTSCRIPT_CMAPS_H
to use PS_Unicodes in it, also include `ttpost.h' to use
tt_face_get_ps_name() in it.
2017-09-12 15:59:18 +09:00
Azzuro babe13ec5c [build] Improve builds with different MS Visual Studio versions.
* builds/windows/vc2010/freetype.vcxproj: Switch platform toolset
according to the Visual Studio version.
2017-09-11 10:47:29 +02:00
Werner Lemberg 3e4b79970e * src/sfnt/ttkern.c (tt_face_load_kern): Reject format 2 tables.
Reported by Behdad.
2017-09-11 08:51:44 +02:00
Alexei Podtelezhnikov d1b6c6e211 Typo. 2017-09-10 22:35:21 -04:00
Alexei Podtelezhnikov 0683f0df7c Warping CHANGES. 2017-09-09 13:01:11 -04:00
Werner Lemberg 0ab2b62d3f [autofit] Improve communication with ftgrid.
* src/autofit/afhints.c (af_glyph_hints_get_segment_offset):
Provide values in font units.
2017-09-09 08:08:47 +02:00
Werner Lemberg e2e56f9dd5 Officially announce end of 16bit compiler support. 2017-09-09 06:31:03 +02:00
Alexei Podtelezhnikov 33b390a63b Warping documentation updates. 2017-09-08 21:34:47 -04:00
suzuki toshiya 3ef59e59e0 [base] Remove a check for resource ID in the resource fork driver.
LastResort.dfont has a marginal resource ID 0xFFFF for sfnt
resource.  Inside Macintosh: More Macintosh Toolbox, `Resource IDs'
(1-46), tells that some IDs are reserved and should not be used.
FreeType2 just uses resource ID to sort the fragmented resource.
To accept the marginal fonts, the checking is removed.

* src/base/ftrfork.c (FT_Raccess_Get_DataOffsets): Remove res_id
validity check, fix a trace message format.
2017-09-09 01:28:24 +09:00
suzuki toshiya 71f661804e ChangeLog for last commit. 2017-09-09 01:05:44 +09:00
suzuki toshiya 5c4e40d7fd [sfnt, truetype] Register the tags for marginal fonts.
The first 32bit of standard TrueType variants is 0x00010000,
`OTTO', `ttcf', `true' or `typ1'.  2 marginal dfonts on legacy Mac
OS X, Keyboard.dfont and LastResort.dfont, have the sfnt resources
starting 0xA5 followed by `kbd' or `lst'.  Considering the following
data could be parsed as conventional TrueType fonts, the header
checking is updated to allow these tags.  It seems that recent Mac
OS X has already switched to normal TTF for these fonts.

See the discussion at
http://u88.n24.queensu.ca/exiftool/forum/index.php?topic=3931.0

* include/freetype/tttags.h (TTAG_0xA5kbd, TTAG_0xA5lst): New header
tags for Keyboard.dfont and LastResort.dfont.
* src/sfnt/sfobjs.c (sfnt_open_font): Accept the sfnt resource
starts with TTAG_0xA5kbd or TTAG_0xA5lst.
* src/truetype/ttobjs.c (tt_face_init): Accept the face with the
format tag is TTAG_0xA5kbd or TTAG_0xA5lst.
2017-09-09 01:03:26 +09:00
Alexei Podtelezhnikov 22a7f5b8af Branding fixes. 2017-09-07 22:36:02 -04:00
Alexei Podtelezhnikov e0b480d191 s/&nbsp;/~/ 2017-09-06 21:21:14 -04:00
Werner Lemberg a3dd6d99a4 Fix multiple calls of `FT_Bitmap_Convert'.
The documentation of `FT_Bitmap_Convert' says that multiple calls do
proper reallocation of the target FT_Bitmap object.  However, this
failed for the sequence

  non-empty bitmap
  empty bitmap
  non-empty bitmap

Reason was that `FT_Bitmap_Convert' only reallocated the bitmap
buffer if it became too small; it didn't make the buffer smaller.
For an empty bitmap following a non-empty one, only the buffer
dimension got set to zero, without deallocation.  If the next call
was a non-empty buffer again, an assertion in `ft_mem_qrealloc' was
triggered.

* src/base/ftbitmap.c (FT_Bitmap_Convert): Always reallocate target
buffer to the correct size.

* docs/CHANGES: Document it.
2017-09-05 23:02:04 +02:00
Werner Lemberg 7d017ba810 [bdf] Fix size and resolution handling.
* src/bdf/bdfdrivr.c (BDF_Face_Init): Use `SIZE' values if
`POINT_SIZE', `RESOLUTION_X', or `RESOLUTION_Y' properties are
missing.

* docs/CHANGES: Document it.
2017-09-05 15:28:21 +02:00
Alexei Podtelezhnikov f0898b9259 Swap `ALLOC_MULT' arguments (#51833).
* src/base/ftbitmap.c (ft_bitmap_assure_buffer): Updated.
* src/winfonts/winfnt.c (FNT_Load_Glyph): Updated.
* src/raster/ftrend1.c (ft_raster1_render): Updated.
2017-08-25 21:40:01 -04:00
Werner Lemberg 587264cfd5 Typo. 2017-08-23 09:14:14 +02:00
Werner Lemberg e1d0249e5a [sfnt] Fix clang compilation (#51788).
* src/sfnt/pngshim.c (premultiply_data): Use vectors instead of
scalars.
(vector_shuffle): New macro to take of a different built-in function
name on clang.
2017-08-23 08:18:22 +02:00
Werner Lemberg bd28952e23 [base] Don't zero out allocated memory twice (#51816).
Patch applied from bug report.

* src/base/ftutil.c (ft_mem_qrealloc): Use low-level allocation to
avoid unnecessary overhead.
2017-08-22 08:41:03 +02:00
Werner Lemberg 0aca17cf53 [truetype] Integer overflow.
Changes triggered by

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

* src/truetype/ttinterp.c (Ins_MDRP, Ins_MIRP, Ins_ALIGNPTS): Use
NEG_LONG.
2017-08-22 08:25:14 +02:00
Alexei Podtelezhnikov 7653c76533 [sfnt] Avoid synthetic unicode for symbol fonts with PUA.
Reported as

  https://bugs.chromium.org/p/chromium/issues/detail?id=754574

* src/sfnt/sfobjs.c (sfnt_load_face): Check for FT_ENCODING_MS_SYMBOL.
2017-08-17 21:28:32 -04:00
Werner Lemberg cadd29de08 * src/sfnt/pngshim.c (premultiply_data): Fix compiler warnings. 2017-08-16 13:32:17 +02:00
Behdad Esfahbod c9d7c03fa1 [sfnt] Speed up PNG image loading.
This reduces the overhead of `premultiply_data' by 60%.

* src/sfnt/pngshim.c (premultiply_data): Provide code which uses
gcc's (and clang's) `vector_byte' attribute to process 4 pixels at a
time.
2017-08-16 05:46:10 +02:00
Werner Lemberg f53ccf6f8f Minor comment fix. 2017-08-16 05:46:10 +02:00
Alexei Podtelezhnikov 10ad11ab95 Harmony CHANGES. 2017-08-13 23:08:39 -04:00
Werner Lemberg 9f5783bb1a Minor. 2017-08-13 09:40:48 +02:00
Werner Lemberg b45043c440 [sfnt, truetype] Improve handling of missing sbits.
Requested by Behdad.

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

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

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

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

* docs/CHANGES: Updated.
2017-08-10 12:56:50 +02:00
Werner Lemberg c87fec0299 [psnames] Really fix issue #49949.
We now use a separate preprocessor macro to handle both definition
and declaration of the glyph name arrays.

* src/psnames/psmodule.c (DEFINE_PS_TABLE_DATA): New macro.

* src/tools/glnames.py (StringTable::dump,
StringTable::dump_sublist): Use `DEFINE_PS_TABLE_DATA'.
(dump_encoding): Ditto.
(main): Use `wb' mode for writing the output file, which works on
Windows also.

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

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

* include/freetype/ftlcdfil.h, include/freetype/freetype.h,
include/freetype/config/ftoption.h, devel/ftoption.h: Updated
documentation.
2017-08-08 22:29:51 -04:00
Alexei Podtelezhnikov 5710ef989d * src/smooth/ftsmooth.c (ft_smooth_render_generic): Clean up. 2017-08-08 22:00:35 -04:00
Alexei Podtelezhnikov a9d8e90caf * src/sftnt/ttpost.c (format): Use otspec-compliant versions. 2017-08-08 21:42:37 -04:00
Werner Lemberg 986a21b73a CHANGES update suggested by Nikolaus. 2017-08-06 06:35:19 +02:00
Werner Lemberg 17196b7c74 [truetype] Integer overflow.
Reported as

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

* src/truetype/ttinterp.c (Ins_ALIGNRP): Use NEG_LONG.
2017-08-05 18:58:34 +02:00
Werner Lemberg f43b3094ef [base, truetype] New function `FT_Get_Var_Axis_Flags'.
The reserved `flags' field got a value in OpenType version 1.8.2;
unfortunately, the public `FT_Var_Axis' structure misses the
corresponding element.  Since we can't add a new field, we add an
access function.

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

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

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

* docs/CHANGES: Updated.
2017-08-05 18:22:17 +02:00
Nikolaus Waxweiler 24e256ab00 [truetype] Fix metrics of B/W hinting in v40 mode.
Phantom points are now saved outside v40 backwards compatibility
mode.  This fixes the jumping glyphs when switching between v35 and
v40 monochrome mode.

* src/truetype/ttgload.c (TT_Hint_Glyph): Fix inversed bool logic.
2017-08-04 08:25:31 +02:00
Nikolaus Waxweiler 7f44c2db24 [truetype] Do not set any ClearType flags in v40 monochrome mode.
This fixes weird behavior of instructions that resulted in rendering
differences between v35 and v40 in monochrome mode, e.g., in
`timesbi.ttf'.

* src/truetype/ttinterp.c (Ins_GETINFO)
[TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL]: Check
`subpixel_hinting_lean'.
2017-08-03 06:15:30 +02:00
Werner Lemberg 7e50824288 * src/truetype/ttgxvar.c (TT_Get_MM_Var): Fix thinko. 2017-08-01 12:44:35 +02:00
Werner Lemberg e6b9b6bafc Update CHANGES file. 2017-08-01 09:34:24 +02:00
Behdad Esfahbod 55bbb98f5c [truetype] Fix loading of named instances.
* src/truetype/ttgxvar.c (TT_Get_MM_Var): Preserve file position
while loading the `avar' table.
2017-08-01 09:17:02 +02:00
Werner Lemberg ce367774d2 [sfnt, truetype] Minor adjustments for OpenType 1.8.2.
* src/sfnt/sfobjs.c (sfnt_load_face): The units per EM value has now
(tighter) limits.

* src/truetype/ttgload.c (load_truetype_glyph): The new OpenType
version explicitly allows all negative values for the number of
contours if we have a composite glyph (this is for better backwards
compatibility I guess), but it still recommends value -1.
2017-08-01 08:24:51 +02:00
Werner Lemberg 933f4cbe79 [cff] Integer overflow.
Reported as

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

* src/cff/cf2hints.c (cf2_glyphpath_computeOffset,
cf2_glyphpath_curveTo): Use ADD_INT32.
2017-07-26 23:32:32 +02:00
Werner Lemberg 38bdf22bfe [truetype] Improve code comment. 2017-07-13 10:28:09 +02:00
Werner Lemberg fe0a7d9df5 [base] Fix memory leak.
Reported as

  https://bugs.chromium.org/p/chromium/issues/detail?id=738362

* src/base/ftglyph.c (FT_Get_Glyph): Do proper deallocation in case
of error.
2017-07-13 10:25:42 +02:00
Werner Lemberg 134de096e0 [base] Integer overflow.
Reported as

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

* src/base/ftobjs.c (ft_glyphslot_grid_fit_metrics): Use
FT_PIX_CEIL_LONG and FT_PIX_ROUND_LONG.
2017-07-12 22:16:37 +02:00
Werner Lemberg b5cab5c9ca Document how to scale manually. 2017-07-12 21:58:35 +02:00
Werner Lemberg 229a5535b5 CHANGES: Add information on global metrics rounding.
I missed to add this important information.
2017-07-12 10:48:41 +02:00
Werner Lemberg 3d083fc213 * src/truetype/ttpload.c (tt_face_get_location): Off-by-one typo.
Also improve tracing message.

Problem reported as

  https://bugs.chromium.org/p/chromium/issues/detail?id=738919
2017-07-12 00:24:48 +02:00
Hin-Tak Leung 39af82ebbf Changelog: typo, chromium issue id is 2276 instead of 2278
Signed-off-by: Hin-Tak Leung <htl10@users.sourceforge.net>
2017-07-11 23:43:08 +02:00
Werner Lemberg 9ea83c7889 [cff] Integer overflow.
Reported as

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

* src/cff/cf2blues.c (cf2_blues_capture): Use SUB_INT32.
2017-07-07 17:09:43 +02:00
Alexei Podtelezhnikov 762de5e285 Tweak suggested use of `lsb_delta' and `rsb_delta'. 2017-07-06 22:31:57 -04:00
Werner Lemberg cf8d9b4ce3 * src/sfnt/ttcmap.c (tt_cmap_unicode_class_rec): Fix warning. 2017-07-05 23:07:01 +02:00
Werner Lemberg 4261e497d8 * src/truetype/ttgxvar.c (FT_Stream_SeekSet): Fix warning (#51395). 2017-07-05 23:00:23 +02:00
Werner Lemberg 1c85479d2d [truetype] Prevent address overflow (#51365).
* src/truetype/ttgxvar.c (FT_Stream_SeekSet): Add guard.
2017-07-04 08:08:54 +02:00
Alexei Podtelezhnikov c56d8851ea * src/base/ftlcdfil.c (ft_lcd_filter_fir): Improve code. 2017-07-03 22:49:07 -04:00
Werner Lemberg ca799e9be5 [truetype] Integer overflow.
Reported as

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

* src/truetype/ttinterp.c (Ins_SCFS): Use SUB_LONG.
2017-07-03 06:27:52 +02:00
Alexei Podtelezhnikov abeb28f161 * src/sfnt/sfobjs.c (sfnt_load_face): Ignore No_Unicode_Glyph_Name. 2017-07-01 16:48:32 -04:00
Ben Wagner 7819aeb622 Avoid Microsoft compiler warnings (#51331).
While clang's sanitizer recommends a cast to unsigned for safe
negation (to handle -INT_MIN), both MSVC and Visualc emit warning
C4146 if an unsigned value gets negated.

* include/freetype/internal/ftcalc.h (NEG_LONG, NEG_INT32),
src/base/ftcalc.c (FT_MOVE_SIGN): Replace negation with a
subtraction.
2017-06-28 22:57:41 +02:00
Werner Lemberg 2e7bb5e825 * src/cff/cffparse.c (do_fixed): Fix typo.
Spotted by chris <chris@gcjd.org>.
2017-06-27 16:56:38 +02:00
Werner Lemberg dde8f5abbe [truetype] Integer overflows.
Reported as

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

* src/base/ftcalc.c (FT_MulDiv, FT_MulDiv_No_Round, FT_DivFix): Use
NEG_LONG.

* src/truetype/ttinterp.c (Ins_SxVTL): Use NEG_LONG.
2017-06-27 06:16:04 +02:00
Werner Lemberg b27cef27ff [truetype] Integer overflows.
Reported as

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

* src/truetype/ttinterp.c (Ins_ISECT): Use NEG_LONG.
2017-06-24 20:17:46 +02:00
Werner Lemberg 298e2ea5a6 [cff, truetype] Integer overflows.
Reported as

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

* src/cff/cf2blues.c (cf2_blues_capture): Use ADD_INT32 and
SUB_INT32.

* src/truetype/ttinterp.c (Ins_SDPVTL): Use SUB_LONG and NEG_LONG.
2017-06-22 11:52:43 +02:00
Alexei Podtelezhnikov 75cb071b3f [sfnt] Synthesize a Unicode charmap if one is missing.
* src/sfnt/ttcmap.h (tt_cmap_unicode_class_rec): Declare it.
* src/sfnt/ttcmap.c (tt_get_glyph_name, tt_cmap_unicode_init,
tt_cmap_unicode_done, tt_cmap_unicode_char_index,
tt_cmap_unicode_char_next, tt_cmap_unicode_class_rec): Implement
synthetic Unicode charmap class.
(tt_get_cmap_info): Make sure the callback is available.

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

* include/freetype/config/ftoption.h: Document it.
* devel/ftoption.h: Ditto.
2017-06-21 22:52:37 -04:00
Werner Lemberg 390048fa46 Remove deprecated comment. 2017-06-20 18:03:20 +02:00
Tony Theodore c8829e4bc1 Fix pkg-config in freetype-config for cross-compiling (#51274).
* builds/unix/unix-def.in (PKG_CONFIG): New variable.
(freetype-config): Use it in sed expression.

* builds/unix/freetype-config.in: s/pkg-config/%PKG_CONFIG%/.
2017-06-20 12:24:05 +02:00
Werner Lemberg 8c763fb1be [cff, truetype] Integer overflows.
Reported as

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

* src/cff/cf2hints.c (cf2_hintmap_adjustHints): Use ADD_INT32.

* src/truetype/ttinterp.c (Ins_ABS): Avoid FT_ABS.
2017-06-20 07:49:52 +02:00
Alexei Podtelezhnikov 7b7278334c [base, smooth] LCD filtering cleanups.
* src/base/ftlcdlil.c (ft_lcd_filter_fir, _ft_lcd_filter_legacy):
Clean up, start filtering from the bottom-left origin.

* src/smooth/ftsmooth.c (ft_smooth_render_generic): Updated.
2017-06-17 23:28:14 -04:00
Werner Lemberg 4dc00cf5c0 [truetype] Integer overflows.
Reported as

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

* src/truetype/ttinterp.c (Ins_MDRP, _iup_worker_interpolate): Use
ADD_LONG and SUB_LONG.
2017-06-16 13:33:09 +02:00
Werner Lemberg dbeb7bce7f [bdf, cff] Integer overflows.
Reported as

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

* src/bdf/bdfdrivr.c (BDF_Face_Init): Replace calls to FT_ABS with
direct code to avoid value negation.

* src/cff/cf2blues.c (cf2_blues_capture): Use SUB_INT32 and
ADD_INT32.
2017-06-15 19:39:50 +02:00
Werner Lemberg 79e3789f81 * src/winfonts/winfnt.c (FNT_Face_Init): Don't set active encoding.
FreeType only sets a default active encoding for Unicode.
2017-06-14 07:51:04 +02:00
Werner Lemberg 5c402d97af [cff, truetype] Integer overflows.
Reported as

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

* src/cff/cf2fixed.h (cf2_fixedAbs): Use NEG_INT32.

* src/truetype/ttinterp.c (Ins_IP): Use SUB_LONG.
2017-06-13 06:56:48 +02:00
Werner Lemberg 3ed3a96181 [cff] Integer overflows.
Reported as

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

* src/cff/cf2hints.c (cf2_hintmap_insertHint): Use SUB_INT32 and
ADD_INT32.

* src/cff/cf2intrp.c (cf2_interpT2CharString) <cf2_cmdVMOVETO>: Use
ADD_INT32.
2017-06-11 13:50:37 +02:00
Werner Lemberg 5f2a72cbc7 [truetype] Fix TT_Set_Var_Design.
Reported by Nikolaus Waxweiler <madigens@gmail.com>.

* src/truetype/ttgxvar.c (TT_Set_Var_Design): Correctly handle the
case where we have less input coordinates than axes.
2017-06-10 11:29:24 +02:00
Werner Lemberg 2c4fba9c91 * src/base/ftcalc.c (FT_DivFix): Fix embarrassing typo.
Bug introduced 2017-05-28.
2017-06-10 11:03:41 +02:00
Werner Lemberg 9038837ee2 [cff, truetype] Integer overflows.
Reported as

  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2144
  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2151
  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2153
  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2173
  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2186

* src/cff/cf2blues.c (cf2_blues_init): Use SUB_INT32.

* src/truetype/ttinterp.c (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): Use ADD_LONG,
SUB_LONG, NEG_LONG, FT_PIX_ROUND_LONG, FT_PIX_CEIL_LONG,
FT_PAD_ROUND_LONG
(Ins_SxVTL, Ins_MIRP): Use SUB_LONG.
(_iup_worker_shift): Use SUB_LONG and ADD_LONG.
2017-06-09 20:42:46 +02:00
Werner Lemberg 96d26926d1 Provide more macros for flooring, ceiling, and rounding.
These versions don't produce run-time errors due to integer
overflow.

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

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

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

* src/truetype/ttinterp.c (PROJECT, DUALPROJ): Use
OVERFLOW_SUB_LONG.
2017-06-07 17:08:01 +02:00
Werner Lemberg 24848a3d58 [cff] Integer overflow.
Reported as

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

* src/cff/cf2blues.c (cf2_blues_init): Use OVERFLOW_SUB_INT32.

* src/cff/cf2hints.c (cf2_hintmap_map): Synchronize if-else
branches.
2017-06-06 12:05:04 +02:00
Werner Lemberg 8667042997 [cff] Integer overflow.
Reported as

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

* src/cff/cffload.c (cff_blend_doBlend): User OVERFLOW_ADD_INT32.
2017-06-05 06:20:53 +02:00
Werner Lemberg 9fa8a2997f [cff, truetype] Integer overflows.
Reported as

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

* src/cff/cf2font.c (cf2_font_setup): Use OVERFLOW_MUL_INT32.

* src/truetype/ttinterp.c (Ins_ISECT): Use OVERFLOW_MUL_LONG,
OVERFLOW_ADD_LONG, and OVERFLOW_SUB_LONG.
2017-06-04 20:43:08 +02:00
Werner Lemberg addb2dddb6 [base, cff, truetype] Integer overflows.
Reported as

  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2060
  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2062
  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2063
  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2068

* src/base/ftobjs.c (ft_glyphslot_grid_fit_metrics): Use
OVERFLOW_ADD_LONG and OVERFLOW_SUB_LONG.

* src/cff/cf2blues.c (cf2_blues_capture), src/cff/cf2hints.c
(cf2_hintmap_adjustHints): Use OVERFLOW_SUB_INT32.

* src/truetype/ttgload.c (compute_glyph_metrics): User
OVERFLOW_SUB_LONG.

* src/truetype/ttinterp.c (Direct_Move, Direct_Move_Orig,
Direct_Move_X, Direct_Move_Y, Direct_Move_Orig_X,
Direct_Move_Orig_Y, Move_Zp2_Point, Ins_MSIRP): Use
OVERFLOW_ADD_LONG and OVERFLOW_SUB_LONG.
2017-06-03 21:05:42 +02:00
Werner Lemberg c9a9cf5915 * builds/unix/freetype-config.in: Fix pkg-config test (#51162).
Patch directly taken from bug report.
2017-06-03 09:41:50 +02:00
Werner Lemberg 2c2e6403b7 [bdf] Synchronize sanity checks with pcf driver.
Reported as

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

* src/bdf/bdfdrivr.c (BDF_Face_Init): Check font ascent and descent.
Check AVERAGE_WIDTH, POINT_SIZE, PIXEL_SIZE, RESOLUTION_X, and
RESOLUTION_Y properties.
2017-06-03 07:38:11 +02:00
Werner Lemberg 1ea343228d [cff, truetype] Integer overflows.
Reported as

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

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

* src/truetype/ttinterp.c (Ins_ADD): Use OVERFLOW_ADD_LONG.
(Ins_SUB): Use OVERFLOW_SUB_LONG.
(Ins_NEG): Use NEG_LONG.
2017-06-03 06:52:13 +02:00
Werner Lemberg c5a225413f ftcalc.h: Avoid left-shift of negative numbers.
Reported as

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

* include/freetype/internal/ftcalc.h (INT_TO_F26DOT6,
INT_TO_F2DOT14, INT_TO_FIXED, F2DOT14_TO_FIXED): Use multiplication.
2017-06-03 06:13:10 +02:00
Werner Lemberg 0716c6ab7a [cff] Even more integer overflows.
Reported as

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

* src/cff/cf2intrp.c (cf2_doStems, cf2_interpT2CharString): Use
OVERFLOW_ADD_INT32.
2017-06-02 19:24:03 +02:00
Werner Lemberg 7a4276fb90 [cff] More integer overflows.
Reported as

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

* src/cff/cf2blues.c (cf2_blues_init): Use OVERFLOW_SUB_INT32.
2017-06-02 09:21:37 +02:00
Werner Lemberg 03b0cc2ea9 [bdf] Don't left-shift negative numbers.
Reported as

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

* src/bdf/bdfdrivr.c (BDF_Face_Init): Use multiplication.
2017-06-02 09:16:52 +02:00
Werner Lemberg 47a03e9b23 [bdf] Fix integer scanning routines.
Reported as

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

* src/bdf/bdflib.c (_bdf_atoul, _bdf_atol, _bdf_atous, _bdf_atos):
Stop scanning if result would overflow.
2017-06-02 09:06:36 +02:00
Werner Lemberg 3802ca8b64 [cff] Fix integer overflows.
Reported as

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

* src/cff/cf2hints.c (cf2_hintmap_insertHint), src/cff/cf2intrp.c
(cf2_doFlex): Use OVERFLOW_ADD_INT32 and OVERFLOW_SUB_INT32.
2017-06-02 08:44:20 +02:00
Werner Lemberg cd02d359a6 [smooth] Some 32bit integer overflow run-time errors.
* src/smooth/ftgrays.c [STANDALONE] (OVERFLOW_ADD_LONG,
OVERFLOW_SUB_LONG, OVERFLOW_MUL_LONG, NEG_LONG): New macros.
[!STANDALONE]: Include FT_INTERNAL_CALC_H.
(gray_render_cubic): Use those macros where appropriate.
2017-06-01 17:05:39 +02:00
Werner Lemberg a607e3919d Minor comment. 2017-06-01 17:03:07 +02:00
Werner Lemberg 0ad3262366 * src/base/ftglyph.c (FT_Get_Glyph): Check `slot->advance'. 2017-06-01 17:00:37 +02:00
Werner Lemberg 4a1f1a6d2a [psaux] 32bit integer overflow tun-time errors (#46149).
* src/psaux/t1decode.c (t1_decoder_parse_charstrings): Use
OVERFLOW_ADD_LONG and OVERFLOW_SUB_LONG where appropriate.
2017-06-01 13:15:54 +02:00
Werner Lemberg 8d435c463d * src/truetype/ttinterp.c (TT_RunIns): Adjust loop counter again.
Problem reported by Marek Kašík <mkasik@redhat.com>.

The problematic font that exceeds the old limit is Padauk-Bold,
version 3.002, containing bytecode generated by a buggy version of
ttfautohint.
2017-06-01 07:09:44 +02:00
Werner Lemberg e66d7300fe [cff] 32bit integer overflow run-time errors 2/2 (#46149).
This commit handles the new engine.

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

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

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

* src/cff/cf2intrp.c (cf2_doFlex, cf2_doBlend,
cf2_interpT2CharString): Ditto.
Also add some other code where needed to avoid overflow.
2017-05-31 16:16:50 +02:00
Werner Lemberg 9b710cd56e [cff] 32bit integer overflow run-time errors 1/2 (#46149).
This commit handles the old engine.

* src/cff/cffgload.c: Include FT_INTERNAL_CALC_H.
(cff_decoder_parse_charstrings): Use OVERFLOW_ADD_LONG and
OVERFLOW_SUB_LONG where needed.

* src/cff/cffparse.c: Include FT_INTERNAL_CALC_H.
(power_ten_limits): New static array.
(do_fixed): Use it to prevent multiplication overflow.
(cff_parser_run): Use OVERFLOW_ADD_LONG.
2017-05-30 22:35:41 +02:00
Werner Lemberg 0e7b9f864f [psaux] Correctly handle sequences of multiple number signs.
* src/psaux/psconv.c (PS_Conv_Strtol, PS_Conv_ToFixed): Return zero
if we encounter more than a single sign.
2017-05-30 22:22:19 +02:00
Werner Lemberg f01463297f [pcf] 32bit integer overflow run-time errors (#46149).
* src/pcf/pcfread.c (pcf_get_accel): Add sanity checks for
`fontAscent' and `fontDescent'.
(pcf_load_font): Add sanity checks for global height.
Add sanity checks for AVERAGE_WIDTH, POINT_SIZE, PIXEL_SIZE,
RESOLUTION_X, and RESOLUTION_Y properties.
2017-05-29 21:04:27 +02:00
Werner Lemberg fbe2fe4c75 Handle some integer overflow run-time errors (#46149, #48979).
This commit (mainly for 32bit CPUs) is the first of a series of
similar commits to handle known integer overflows.  Basically, all
of them are harmless, since they affect rendering of glyphs only,
not posing security threats.  It is expected that fuzzying will show
up more overflows, to be fixed in due course.

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

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

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

* src/base/ftoutln.c (FT_Outline_Get_Orientation): Use new macros.
2017-05-29 13:29:28 +02:00
Werner Lemberg 9d04fa7015 * include/freetype/internal/ftcalc.h (FLOAT_TO_FIXED): Remove.
This macro is not used.
2017-05-28 07:57:24 +02:00
Werner Lemberg 2e4188d833 [cff] s/cf2_floatToFixed/cf2_doubleToFixed/.
The new name better describes what the macro actually does;
additionally, we don't need a trailing `f' for literals (there was
only a single such instance in the code, but this caused a clang
warning because the macro itself uses `double' literals).

* src/cff/cf2blues.c, src/cff/cf2blues.h, src/cff/cf2fixed.h,
src/cff/cf2font.c, src/cff/cf2hints.c: Updated.
2017-05-28 07:46:22 +02:00
Werner Lemberg 9357219082 Fix negation of INT_MIN and LONG_MIN (#46149).
* src/base/ftcalc.c (FT_MOVE_SIGN): Add argument to pass unsigned
value, to be used as the result.
(FT_MulDiv, FT_MulDiv_No_Round, FT_DivFix, FT_MulFix,
FT_Vector_NormLen): Updated.
2017-05-28 07:20:09 +02:00
Werner Lemberg a9331c0f4d [truetype] Fix handling of design coordinates (#51127).
* src/truetype/ttgxvar.c (tt_set_mm_blend): Compute all design
coordinates if we have to create the `blends->coord' array.
(TT_Get_MM_Blend, TT_Get_Var_Design): Select default instance
coordinates if no instance is selected yet.
2017-05-27 15:50:25 +02:00
Werner Lemberg 082f2faf50 [bdf, pcf] Support ISO646.1991-IRV character encoding (aka ASCII).
Problem reported by Marek Kašík <mkasik@redhat.com>, cf.

  https://bugzilla.redhat.com/show_bug.cgi?id=1451795

* src/bdf/bdfdrivr.c (BDF_Face_Init), src/pcf/pcfdrivr.c
(PCF_Face_Init): Implement it.
2017-05-24 07:40:46 +02:00
Nikolaus Waxweiler a0455468fd [truetype] Always use interpreter v35 for B/W rendering (#51051).
* src/truetype/ttgload.c (tt_loader_init)
[TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL]: Adjust
`subpixel_hinting_lean', `grayscale_cleartype', and
`vertical_lcd_lean' accordingly.

* src/truetype/ttinterp.c (Ins_GETINFO): Updated.
(TT_RunIns): Update `backward_compatibility' flag.
2017-05-20 07:28:46 +02:00
Alexei Podtelezhnikov ab2599ea3f [smooth] Implement minimal dynamic padding for LCD filtering.
Extra bitmap padding for LCD filtering depends on the filter.  The
default 5-tap filter needs 2 extra subpixels.  The light 3-tap filter
needs only 1 extra subpixel.  This space could be already available
due to rounding.  In order to optimize the padding, we now expand
CBox for the given filter weights before rounding.

This change breakes current Skia (and Firefox).

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

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

* src/smooth/ftsmooth.c (ft_smooth_render_generic): Implement dymanic
LCD padding.
2017-05-20 00:35:21 -04:00
Werner Lemberg 881f64475f [autofit] More code sorting. 2017-05-17 07:56:53 +02:00
Werner Lemberg 548704f426 Code sorting. 2017-05-17 07:40:50 +02:00
Werner Lemberg 5efda13f60 [sfnt] Return proper scaling values for SBIX bitmaps.
Problem reported by Hin-Tak Leung <htl10@users.sourceforge.net>.

* src/sfnt/ttsbit.c (tt_face_load_strike_metrics): Implement it.
2017-05-15 21:26:01 +02:00
Werner Lemberg 6e5445a232 [truetype] Fix error handling for embedded bitmaps.
Problem reported by Hin-Tak Leung <htl10@users.sourceforge.net>.

* src/truetype/ttgload.c (TT_Load_Glyph)
[TT_CONFIG_OPTION_EMBEDDED_BITMAPS]: Handle error if font is not
scalable.
2017-05-15 21:24:04 +02:00
Alexei Podtelezhnikov a7f276a281 [autofit] Make autohint warping NORMAL option.
This moves warping option from LIGHT to NORMAL mode.  This makes LIGHT
truly void of hinting in x-direction, with left side bearing never
changed and right side bearing only altered by advance rounding.
Therefore, LIGHT is now ready to return fractional advance.  As a
NORMAL option, warping substitutes normal hinting.

* src/autofit/afcjk.c (af_cjk_hints_apply): Updated.
* src/autofit/aflatin.c (af_latin_hints_apply): Updated.
* src/autofit/aflatin2.c (af_latin2_hints_apply): Updated.

* src/autofit/afloader.c (af_loader_load_glyph): Handle warping
phantom points as normal.
2017-05-15 00:25:37 -04:00
Werner Lemberg e99b26aada Remove remnants of raster pool.
* include/freetype/internal/ftobjs.h (FT_LibraryRec): Remove
`raster_pool' and `raster_pool_size' fields.

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

Tag sources with `VER-2-8'.

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

* README, Jamfile (RefDoc), builds/windows/vc2005/freetype.vcproj,
builds/windows/vc2005/index.html,
builds/windows/vc2008/freetype.vcproj,
builds/windows/vc2008/index.html,
builds/windows/vc2010/freetype.vcxproj,
builds/windows/vc2010/index.html,
builds/windows/visualc/freetype.dsp,
builds/windows/visualc/freetype.vcproj,
builds/windows/visualc/index.html,
builds/windows/visualce/freetype.dsp,
builds/windows/visualce/freetype.vcproj,
builds/windows/visualce/index.html,
builds/wince/vc2005-ce/freetype.vcproj,
builds/wince/vc2005-ce/index.html,
builds/wince/vc2008-ce/freetype.vcproj,
builds/wince/vc2008-ce/index.html: s/2.7.1/2.8/, s/271/28/.

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

* builds/unix/configure.raw (version_info): Set to 20:0:14.
* CMakeLists.txt (VERSION_MINOR): Set to 8.
(VERSION_PATCH): Set to 0.
2017-05-13 06:29:04 +02:00
Werner Lemberg 538d571a99 formats.txt: Properly document PFB. 2017-05-13 06:28:08 +02:00
Hin-Tak Leung 603121c050 Fix `FT_UINT_TO_POINTER' macro for Windows.
* builds/unix/ftconfig.in, builds/vms/ftconfig.h,
include/freetype/config/ftconfig.h (FT_UINT_TO_POINTER) [_WIN64]:
Fix definition.
2017-05-12 07:52:36 +02:00
Werner Lemberg 2e209c6cbe Update CHANGES file. 2017-05-11 00:28:05 +02:00
Werner Lemberg 9de936d343 s/AF_BLUE_STRINGSET_CANADIAN_SYLLABICS/AF_BLUE_STRINGSET_CANS/. 2017-05-11 00:11:59 +02:00
Sascha Brawer ac0eed8646 [autofit] Add support for Chakma script.
* src/autofit/afblue.dat: Add blue zone data for Chakma.
* src/autofit/afblue.c, src/autofit/afblue.h: Regenerated.

* src/autofit/afscript.h: Add Chakma standard character.

* src/autofit/afranges.c, src/autofit/afstyles.h: Add Chakma data.
2017-05-11 00:06:37 +02:00
Sascha Brawer d19859f16f [autofit] Add support for Kayah Li script.
* src/autofit/afblue.dat: Add blue zone data for Kayah Li.
* src/autofit/afblue.c, src/autofit/afblue.h: Regenerated.

* src/autofit/afscript.h: Add Kayah Li standard character.

* src/autofit/afranges.c, src/autofit/afstyles.h: Add Kayah Li data.
2017-05-10 23:38:05 +02:00
Sascha Brawer 87218c9950 [autofit] Add support for Bamum script.
* src/autofit/afblue.dat: Add blue zone data for Bamum.
* src/autofit/afblue.c, src/autofit/afblue.h: Regenerated.

* src/autofit/afscript.h: Add Bamum standard character.

* src/autofit/afranges.c, src/autofit/afstyles.h: Add Bamum data.
2017-05-10 12:39:33 +02:00
Sascha Brawer 4aa1aec1a3 [autofit] Add support for Saurashtra script.
* src/autofit/afblue.dat: Add blue zone data for Saurashtra.
* src/autofit/afblue.c, src/autofit/afblue.h: Regenerated.

* src/autofit/afscript.h: Add Saurashtra standard character.

* src/autofit/afranges.c, src/autofit/afstyles.h: Add Saurashtra
data.
2017-05-10 09:36:13 +02:00
Werner Lemberg 53f3824452 [autofit] Add support for Buhid script.
* src/autofit/afblue.dat: Add blue zone data for Buhid.
* src/autofit/afblue.c, src/autofit/afblue.h: Regenerated.

* src/autofit/afscript.h: Add Buhid standard character.

* src/autofit/afranges.c, src/autofit/afstyles.h: Add Buhid data.
2017-05-10 09:13:20 +02:00
Sascha Brawer 44c6117ea7 [autofit] Add support for Shavian script.
* src/autofit/afblue.dat: Add blue zone data for Shavian.
* src/autofit/afblue.c, src/autofit/afblue.h: Regenerated.

* src/autofit/afscript.h: Add Shavian standard character.

* src/autofit/afranges.c, src/autofit/afstyles.h: Add Shavian data.
2017-05-08 20:31:52 +02:00
Sascha Brawer a9e5e6e5b6 [autofit] Add support for Vai script.
* src/autofit/afblue.dat: Add blue zone data for Vai.
* src/autofit/afblue.c, src/autofit/afblue.h: Regenerated.

* src/autofit/afscript.h: Add Vai standard character.

* src/autofit/afranges.c, src/autofit/afstyles.h: Add Vai data.
2017-05-08 19:57:16 +02:00
Sascha Brawer acc6b6dff8 [autofit] Add support for Osmanya script.
* src/autofit/afblue.dat: Add blue zone data for Osmanya.
* src/autofit/afblue.c, src/autofit/afblue.h: Regenerated.

* src/autofit/afscript.h: Add Osmanya standard character.

* src/autofit/afranges.c, src/autofit/afstyles.h: Add Osmanya data.
2017-05-08 15:08:46 +02:00
Sascha Brawer f27ebb1ec4 [autofit] Add support for Coptic script.
* src/autofit/afblue.dat: Add blue zone data for Coptic.
* src/autofit/afblue.c, src/autofit/afblue.h: Regenerated.

* src/autofit/afscript.h: Add Coptic standard character.

* src/autofit/afranges.c, src/autofit/afstyles.h: Add Coptic data.
2017-05-08 10:22:26 +02:00
Sascha Brawer db0fe73331 [autofit] Add support for Carian script.
* src/autofit/afblue.dat: Add blue zone data for Carian.
* src/autofit/afblue.c, src/autofit/afblue.h: Regenerated.

* src/autofit/afscript.h: Add Carian standard character.

* src/autofit/afranges.c, src/autofit/afstyles.h: Add Carian data.
2017-05-08 10:00:16 +02:00
Werner Lemberg ec4cb04b31 [truetype] Add tricky font `DFGirl-W6-WIN-BF' (from Dynalab).
Reported by Roy Tam <roytam@gmail.com>.

* src/truetype/ttobjs.c (tt_check_trickyness_family): Implement it.
2017-05-07 13:06:36 +02:00
Roy Tam 0ed9fef032 [truetype] More tricky fonts (mainly from Dynalab).
* src/truetype/ttobjs.c (tt_check_trickyness_family,
tt_check_trickyness_sfnt_ids): Add them.
2017-05-07 08:32:58 +02:00
Werner Lemberg f784a5653a [truetype] Add tricky font `DLCHayMedium' (from Dynalab).
Reported by Roy Tam <roytam@gmail.com>.

* src/truetype/ttobjs.c (tt_check_trickyness_family): Implement it.
2017-05-07 00:45:05 +02:00
Werner Lemberg 8cd31eb7b0 */*: s/backwards compatibility/backward compatibility/. 2017-05-03 23:54:29 +02:00
Sascha Brawer c9e7063a01 [autofit] Add support for Unified Canadian Syllabics script.
* src/autofit/afblue.dat: Add blue zone data for Unified Canadian
Syllabics.
* src/autofit/afblue.c, src/autofit/afblue.h: Regenerated.

* src/autofit/afscript.h: Add Unified Canadian Syllabics standard
character.

* src/autofit/afranges.c, src/autofit/afstyles.h: Add Unified
Canadian Syllabics data.
2017-05-03 23:21:13 +02:00
Sascha Brawer 0483fb3861 [autofit] Add blue-zone support for Sundanese script.
This essentially moves the Sundanese script from the `Indic' hinter
to the `Latin' hinter.

* src/autofit/afblue.dat: Add blue zone data for Sundanese.

* src/autofit/afblue.c, src/autofit/afblue.h: Regenerated.

* src/autofit/afscript.h: Add Sundanese standard character and move
data out of AF_CONFIG_OPTION_INDIC block.

* src/autofit/afranges.c: Move Sundanese data out of
AF_CONFIG_OPTION_INDIC block.

* src/autofit/afstyles.h: Update Sundanese data; in particular, use
AF_WRITING_SYSTEM_LATIN.
2017-05-03 20:16:24 +02:00
Sascha Brawer 14ae17a25f [autofit] Add support for Avestan script.
* src/autofit/afblue.dat: Add blue zone data for Avestan.
* src/autofit/afblue.c, src/autofit/afblue.h: Regenerated.

* src/autofit/afscript.h: Add Avestan standard character.

* src/autofit/afranges.c, src/autofit/afstyles.h: Add Avestan data.
2017-05-03 18:35:13 +02:00
Behdad Esfahbod 60bf264ee2 [truetype] Make `IUP' gvar deltas do the same as Apple (#50832).
When points are not touched by gvar interpolation deltas, FreeType
gave a slightly different result than Apple's CoreText.

The OpenType working group will update the specification to document
the following behaviour: If the two points with deltas to the `left'
and `right' of the untouched point have the same coordinate, then
the inferred delta for the untouched point should be zero.

* src/truetype/ttgxvar.c (tt_delta_interpolate): Implement new
behaviour.
2017-05-02 14:38:54 +02:00
Werner Lemberg ba40054c2d [autofit] Remove `slight' auto-hint mode again.
A poll on freetype-devel favoured changes directly applied to
`light'.

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

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

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

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

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

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

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

* docs/CHANGES: Updated.
2017-05-02 12:32:19 +02:00
Werner Lemberg 7abf0cb758 [autofit] Fix metrics computation.
Problem reported by Markus Trippelsdorf <markus@trippelsdorf.de> and
Nikolaus Waxweiler <madigens@gmail.com>.

* src/base/ftobjs.c (FT_Request_Size): Trigger recomputation of
auto-hinter metrics.  Without this change, multiple size changing
calls for a single face fail.
2017-04-30 17:25:11 +02:00
Werner Lemberg 785833d96e * src/truetype/ttdriver.c (tt_size_request): Properly check `error'.
Reported by Earnestly <zibeon@googlemail.com> in

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

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

Noted by Alexei.
2017-04-26 13:41:40 +02:00
Werner Lemberg 5f18d867c0 [truetype] Do linear scaling for FT_LOAD_NO_HINTING (#50470).
* src/truetype/ttobs.h (TT_SizeRec): Add field `hinted_metrics' to
hold hinted metrics.
Make `metrics' a pointer so that `tt_glyph_load' can easily switch
between metrics.

* src/truetype/ttdriver.c (tt_size_request): Updated.
(tt_glyph_load): Use top-level metrics if FT_LOAD_NO_HINTING is
used.

* src/truetype/ttgload.c (TT_Hint_Glyph, TT_Process_Simple_Glyph,
TT_Process_Composite_Component, load_truetype_glyph,
compute_glyph_metrics, TT_Load_Glyph): Updated.

* src/truetype/ttinterp.c (TT_Load_Context): Updated.

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

* src/truetype/ttsubpix.c (sph_set_tweaks): Updated.
2017-04-26 11:40:28 +02:00
Werner Lemberg 5aa6716a5e Add new `slight' auto-hinting mode.
This mode uses fractional advance widths and doesn't scale glyphs
horizontally, only applying vertical scaling and hinting.

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

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

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

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

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

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

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

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

* src/smooth/ftsmooth.c (ft_smooth_render): Updated.
2017-04-26 11:39:53 +02:00
Werner Lemberg 69da54cacc Document that some FT_Size_Metrics values are always rounded. 2017-04-26 09:58:28 +02:00
Werner Lemberg ba86636b14 And another CVE for an older FreeType version. 2017-04-26 09:35:39 +02:00
Werner Lemberg 7752c68c50 Document CVE-2017-8105. 2017-04-26 09:16:45 +02:00
Werner Lemberg 7fa5743ae6 freetype.h: Avoid non-ASCII character (#50858). 2017-04-23 13:57:37 +02:00
Werner Lemberg 5412d8869b Introduce `FT_Size_InternalRec' structure.
We are going to extend this later on.

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

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

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

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

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

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

* src/type1/t1objs.c (T1_Size_Done, T1_Size_Init, T1_Size_Request):
Use `size->internal->module_data' instead of `size->internal'.
2017-04-22 12:48:50 +02:00
Alexei Podtelezhnikov eb5e0fb7ee * src/smooth/ftsmooth.h: Remove unused guards and declaration. 2017-04-21 22:53:39 -04:00
Alexei Podtelezhnikov c5d9735d85 Typos. 2017-04-21 22:27:49 -04:00
Alexei Podtelezhnikov 71d289da3b Typos. 2017-04-19 23:50:29 -04:00
Alexei Podtelezhnikov eb0683129b Typos. 2017-04-16 23:41:26 -04:00
Hin-Tak Leung 5efba4c4dc Fix tracing messages.
* src/base/ftobjs.c (FT_Face_GetCharVariantIndex,
FT_Face_GetCharVariantIsDefault, FT_Face_GetVariantsOfChar): Print
correct function name.
2017-04-16 07:23:24 +02:00
Alexei Podtelezhnikov 05e1aa5fc0 Typos. 2017-04-15 23:48:59 -04:00
Werner Lemberg 90ccab3d78 [autofit] Add support for Old Turkic script.
* src/autofit/afblue.dat: Add blue zone data for Old Turkic.
* src/autofit/afblue.c, src/autofit/afblue.h: Regenerated.

* src/autofit/afscript.h: Add Old Turkic standard characters.

* src/autofit/afranges.c, src/autofit/afstyles.h: Add Old Turkic data.
2017-04-08 17:58:57 +02:00
Sascha Brawer df2a7cd198 [autofit] Add support for Gothic script.
* src/autofit/afblue.dat: Add blue zone data for Gothic.
* src/autofit/afblue.c, src/autofit/afblue.h: Regenerated.

* src/autofit/afscript.h: Add Gothic standard characters.

* src/autofit/afranges.c, src/autofit/afstyles.h: Add Gothic data.
2017-04-08 16:11:44 +02:00
Sascha Brawer 5bf4b1aaf7 [autofit] Add support for Cypriot script.
* src/autofit/afblue.dat: Add blue zone data for Cypriot.
* src/autofit/afblue.c, src/autofit/afblue.h: Regenerated.

* src/autofit/afscript.h: Add Cypriot standard characters.

* src/autofit/afranges.c, src/autofit/afstyles.h: Add Cypriot data.
2017-04-08 11:38:52 +02:00
Sascha Brawer d79fc79422 [autofit] Add support for Deseret script.
* src/autofit/afblue.dat: Add blue zone data for Deseret.
* src/autofit/afblue.c, src/autofit/afblue.h: Regenerated.

* src/autofit/afscript.h: Add Deseret standard characters.

* src/autofit/afranges.c, src/autofit/afstyles.h: Add Deseret data.
2017-04-08 07:06:24 +02:00
Werner Lemberg 32efd8c008 [autofit] Fix invalid character range description (#50745).
Also reported as

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

* src/autofit/afranges.c (af_glag_nonbase_uniranges): Fix typo in
recent commit.
2017-04-07 17:22:59 +02:00
Werner Lemberg 04e00b8a3d [ftfuzzer] Fix clang warnings.
* src/tools/ftfuzzer/ftfuzzer.cc (LLVMFuzzerTestOneInput): Add
casts.
2017-04-07 17:13:38 +02:00
Sascha Brawer 2c256e6dac [autofit] Add support for Lisu script.
* src/autofit/afblue.dat: Add blue zone data for Lisu.
* src/autofit/afblue.c, src/autofit/afblue.h: Regenerated.

* src/autofit/afscript.h: Add Lisu standard characters.

* src/autofit/afranges.c, src/autofit/afstyles.h: Add Lisu data.
2017-04-06 17:05:47 +02:00
Sascha Brawer 2b9114765a [autofit] Add support for Osage script.
* src/autofit/afblue.dat: Add blue zone data for Osage.
* src/autofit/afblue.c, src/autofit/afblue.h: Regenerated.

* src/autofit/afscript.h: Add Osage standard characters.

* src/autofit/afranges.c, src/autofit/afstyles.h: Add Osage data.
2017-04-06 16:49:39 +02:00
Sascha Brawer 628e2850b2 [autofit] Add support for Glagolitic script.
* src/autofit/afblue.dat: Add blue zone data for Glagolitic.
* src/autofit/afblue.c, src/autofit/afblue.h: Regenerated.

* src/autofit/afscript.h: Add Glagolitic standard characters.

* src/autofit/afranges.c, src/autofit/afstyles.h: Add Glagolitic data.
2017-04-06 12:47:27 +02:00
Sascha Brawer 6967eb93f8 [autofit] Add support for Tai Viet script.
* src/autofit/afblue.dat: Add blue zone data for Tai Viet.
* src/autofit/afblue.c, src/autofit/afblue.h: Regenerated.

* src/autofit/afscript.h: Add Tai Viet standard characters.

* src/autofit/afranges.c, src/autofit/afstyles.h: Add Tai Viet data.
2017-04-06 11:35:07 +02:00
Sascha Brawer 837f112566 [autofit] Add support for Tifinagh script.
* src/autofit/afblue.dat: Add blue zone data for Tifinagh.
* src/autofit/afblue.c, src/autofit/afblue.h: Regenerated.

* src/autofit/afscript.h: Add Tifinagh standard characters.

* src/autofit/afranges.c, src/autofit/afstyles.h: Add Tifinagh data.
2017-04-06 08:44:08 +02:00
Sascha Brawer 134246b72b [autofit] Add support for N'Ko script.
* src/autofit/afblue.dat: Add blue zone data for N'Ko.
* src/autofit/afblue.c, src/autofit/afblue.h: Regenerated.

* src/autofit/afscript.h: Add N'Ko standard characters.

* src/autofit/afranges.c, src/autofit/afstyles.h: Add N'Ko data.
2017-04-06 07:06:32 +02:00
Sascha Brawer ba9cee479a [autofit] Add support for Adlam script.
* src/autofit/afblue.dat: Add blue zone data for Adlam.
* src/autofit/afblue.c, src/autofit/afblue.h: Regenerated.

* src/autofit/afscript.h: Add Adlam standard characters.

* src/autofit/afranges.c, src/autofit/afstyles.h: Add Adlam data.
2017-04-06 05:50:44 +02:00
Sascha Brawer 8210ee4b69 [autofit] Add support for Ol Chiki script.
* src/autofit/afblue.dat: Add blue zone data for Ol Chiki.
* src/autofit/afblue.c, src/autofit/afblue.h: Regenerated.

* src/autofit/afscript.h: Add Ol Chiki standard character.

* src/autofit/afranges.c, src/autofit/afstyles.h: Add Ol Chiki data.
2017-04-06 05:39:51 +02:00
Werner Lemberg 093c182058 [truetype] Avoid reexecution of `fpgm' and `prep' in case of error.
Reported as

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

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

* src/truetype/ttinterp.c (Ins_FDEF, Ins_IDEF): Prohibit execution
of these two opcodes in `glyf' bytecode.
(TT_RunIns): Don't enforce reexecution of `fpgm' and `prep' bytecode
in case of error since function tables can no longer be modified
(due to the changes in `Ins_FDEF' and `Ins_IDEF').  This change can
enormously speed up handling of broken fonts.
2017-04-03 11:37:33 +02:00
Alexei Podtelezhnikov e7b013044e [autofit] Disable metrics adjustment for `FT_LOAD_TARGET_LCD'.
* src/autofit/aflatin.c (af_latin_hints_init): Updated.
* src/autofit/aflatin2.c (af_latin2_hints_init): Ditto.
2017-04-02 22:01:47 -04:00
Werner Lemberg bb6c037bae * src/truetype/ttgload.c: Include FT_CONFIG_CONFIG_H.
Otherwise FT_UINT_TO_POINTER might not be defined.

Problem reported by Alexei.
2017-04-01 09:49:11 +02:00
Alexei Podtelezhnikov 54b58097ee [autofit] Disable stem adjustment for `FT_LOAD_TARGET_LCD'.
* include/freetype/freetype.h (FT_LOAD_TARGET_LCD): Document it.
* src/autofit/afcjk.c (af_cjk_hints_init): Updated.
* src/autofit/aflatin.c (af_latin_hints_init): Ditto.
* src/autofit/aflatin2.c (af_latin2_hints_init): Ditto.
2017-03-31 22:41:53 -04:00
Werner Lemberg 5a3490e054 * src/cff/cffload.c (cff_font_load): Improve fix from 2017-01-04.
Allow CFFs containing a single font to have an empty font name.

Problem reported by 張俊芝 <418092625@qq.com> in

  http://lists.nongnu.org/archive/html/freetype-devel/2017-03/msg00074.html
2017-03-31 09:35:58 +02:00
Werner Lemberg c8c6763988 * src/cff/cffparse.h (CFF2_DEFAULT_STACK): Set to 513 also.
Requested by Dave Arnold.
2017-03-30 21:07:17 +02:00
Werner Lemberg da38be831d [truetype] Fix HVAR and VVAR handling (#50678).
* src/truetype/ttgxvar.c (tt_hvadvance_adjust): Handle
glyph indices larger than `mapCount' as described in the
specification.
2017-03-30 13:24:03 +02:00
Werner Lemberg bcc74f4daf [truetype] Allow linear scaling for unhinted rendering (#50470).
* src/truetype/ttdriver.c (tt_size_request): Revert change from
2011-07-16; the intended metrics fix seems now to be implemented in
a different way, making the patch unnecessary.  Note that this
change was usually patched out by all major GNU/Linux distributions
due to heavy side effects.

* src/truetype/ttgload.c (compute_glyph_metrics, TT_Load_Glyph):
Refer to the metrics of the `TT_Size' object.
2017-03-30 13:14:43 +02:00
Werner Lemberg 1ede3674cb [truetype] Fix thinko related to PS name of default named instance.
* src/truetype/ttgxvar.c (TT_Get_MM_Var): `strid' and `psid' are
name ID values, not indices into the array of name entries.
2017-03-30 00:26:31 +02:00
Werner Lemberg 4c1b5dc152 s/index/idx/ where appropriate. 2017-03-27 21:00:17 +02:00
Werner Lemberg 208e712de0 [cid, truetype] Don't use `index' as a variable name.
At least on FreeBSD there is a global declaration of `index' in file
`/usr/include/strings.h'.

* src/cff/cf2intrp.c, src/truetype/ttgload.c: s/index/idx/ where
appropriate.
2017-03-27 20:56:23 +02:00
Wojciech Mamrak 565f5a7d19 [sfnt] Minor improvement for handling kern tables.
* src/sfnt/ttkern.c (tt_face_load_kern): Don't check for
cross-stream kerning tables since we reject format 2 tables later
on anyways.
Modify code for limit test...
(tt_face_get_kerning): ... to avoid a limit test here.
2017-03-27 09:19:14 +02:00
Werner Lemberg c22a9aa245 [pcf] Fix compiler warnings.
Reported by Alexander Hedges <ahedges@student.ethz.ch>.

* src/pcf/pcfdrivr.c (pcf_property_set, pcf_property_get): Tag
`property_name' with `FT_UNUSED' where necessary.
2017-03-27 07:57:24 +02:00
Werner Lemberg 3774fc08b5 * src/psaux/psobjs.c (t1_builder_close_contour): Add safety guard.
Reported as

  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=941
2017-03-26 08:32:09 +02:00
Werner Lemberg f958c48ee4 [psaux] Better protect `flex' handling.
Reported as

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

* src/psaux/t1decode.c (t1_decoder_parse_charstrings)
<callothersubr>: Since there is not a single flex operator but a
series of subroutine calls, malformed fonts can call arbitrary other
operators after the start of a flex, possibly adding points.  For
this reason we have to check the available number of points before
inserting a point.
2017-03-24 09:15:10 +01:00
Werner Lemberg 913f436d12 [sfnt] Fix check for default named instance.
* src/sfnt/sfobjs.c (sfnt_init_face): A `fixed' number needs four
bytes, not two...
2017-03-23 18:37:06 +01:00
Werner Lemberg 67ff7664e4 Make MM fonts work (again).
* src/base/ftmm.c (FT_Set_Var_Design_Coordinates,
FT_Set_MM_Blend_Coordinates, FT_Set_Var_Blend_Coordinates): Ignore
return value of `ft_face_get_mvar_service'; instead, check whether a
service is actually returned.
2017-03-23 12:41:30 +01:00
Werner Lemberg 683e3ad936 [truetype] Some variable renamings.
Too much local variables holding different structures were called
`metrics'.

* src/truetype/ttdriver.c (tt_size_select): s/metrics/size_metrics/.

* src/truetype/ttgload.c (tt_get_metrics_incr_overrids,
compute_glyph_metrics): s/metrics/incr_metrics/.
(load_sbit_image): s/metrics/sbit_metrics/.

* src/truetype/ttobjs.c (tt_size_run_fpgm): s/metrics/size_metrics/.
(tt_size_init_bytecode): s/metrics/tt_metrics/.
(tt_size_reset): s/metrics/size_metrics/.
2017-03-21 19:49:11 +01:00
Werner Lemberg 6342da9a8d [sfnt] Don't add instances to non-variation fonts.
* src/sfnt/sfobjs.c (sfnt_init_face): Fix it.
2017-03-20 05:36:41 +01:00
Werner Lemberg dd64a6227c * src/cff/cffgload.c (cff_builder_init): Add safety guard (#50578). 2017-03-20 05:34:02 +01:00
Werner Lemberg 7aeee3c50f Introduce FT_UINT_TO_POINTER macro (#50560).
We have to make a separate case for Windows 64's LLP64 data model.

* builds/unix/ftconfig.in, builds/vms/ftconfig.h,
include/freetype/config/ftconfig.h (FT_UINT_TO_POINTER): New macro.

* src/truetype/ttgload.c (load_truetype_glyph): Use it.
2017-03-18 17:30:42 +01:00
Werner Lemberg 3e79254ae7 * src/truetype/ttinterp.c (TT_RunIns): Adjust loop counter (#50573).
The problematic font that exceeds the old limit is Lato-Regular,
version 2.007, containing bytecode generated by a buggy version of
ttfautohint.
2017-03-18 10:06:15 +01:00
Werner Lemberg 13fa85a246 [truetype] Another limitation for bytecode loop count maximum.
Reported as

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

* src/truetype/ttinterp.c (TT_RunIns): Limit `loopcall_counter_max'
by number of glyphs also.
2017-03-18 09:42:58 +01:00
Werner Lemberg ab840e6a4c [ftfuzzer] Minor improvement.
* src/tools/ftfuzzer/ftfuzzer.cc: Don't set intermediate axis if
bitmap strikes are active.
2017-03-18 08:50:42 +01:00
Werner Lemberg 9931175dcc Improve `make multi'.
* src/autofit/aflatin2.c: Guard file with FT_OPTION_AUTOFIT2.

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

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

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

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

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

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

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

* src/autofit/autofit.c, src/base/ftbase.c, src/cache/ftcache.c,
src/cff/cff.c, src/cid/type1cid.c, src/gxvalid/gxvalid.c,
src/pcf/pcf.c, src/pfr/pfr.c, src/psaux/psaux.c,
src/pshinter/pshinter.c, src/psnames/psnames.c, src/raster/raster.c,
src/sfnt/sfnt.c, src/smooth/smooth.c, src/truetype/truetype.c,
src/type1/type1.c, src/type42/type42.c: Remove conditionals; sort
entries.
2017-03-18 07:06:49 +01:00
Werner Lemberg d5bfa053f5 Fixes for conditional compilation.
* src/autofit/afcjk.c, src/autofit/afindic.c: Include `afcjk.h'
earlier.

* src/sfnt/sfobjs.c (sfnt_init_face): Put `memory' variable into
TT_CONFIG_OPTION_GX_VAR_SUPPORT block.
(sfnt_done_face): Protect some code with
TT_CONFIG_OPTION_GX_VAR_SUPPORT.

* src/sfnt/ttsbit.c (tt_face_load_sbix_image): Remove compiler
warning.

* src/truetype/ttgload.c (TT_Load_Simple_Glyph): Put `tmp' variable
into TT_USE_BYTECODE_INTERPRETER block.

(tt_loader_init): Put `error' variable into
TT_USE_BYTECODE_INTERPRETER block.
2017-03-17 21:47:54 +01:00
Werner Lemberg e5595784f4 Fix preprocessor warning.
* devel/ftoption.h, include/freetype/config/ftoption.h: Test whether
TT_CONFIG_OPTION_SUBPIXEL_HINTING is defined before checking its
value.
2017-03-17 21:34:08 +01:00
Werner Lemberg bffb7fe90b `make multi' fixes; compiler warnings.
* src/base/ftsnames.c: Include FT_INTERNAL_DEBUG_H.

* src/cff/cffobjs.c [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include
FT_MULTIPLE_MASTERS_H and FT_SERVICE_MULTIPLE_MASTERS_H.

* src/sfnt/sfdriver.c [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include
FT_MULTIPLE_MASTERS_H and FT_SERVICE_MULTIPLE_MASTERS_H.
(get_win_string, get_apple_string): Initialize `result'.
2017-03-17 07:52:30 +01:00
Dave Arnold fdbef538f4 [cff] Fix potential bugs in default NDV for CFF2.
* src/cff/cffload.c (cff_blend_build_vector): Explicitly build blend
vector when `lenNDV' is zero; don't rely on zero-init.
Save `lenNDV' as part of cache key even when `lenNDV' is zero.
2017-03-17 07:28:11 +01:00
Dave Arnold 0bf95b585e [cff] Fix CFF2 stack allocation.
* src/cff/cffparse.c (cff_parser_init) add 1 for operator.
2017-03-17 07:22:55 +01:00
Werner Lemberg d9ff6f20ad * src/truetype/ttgxvar.c (tt_done_blend): Free `vvar_table'.
Reported as

  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=883
2017-03-16 20:20:51 +01:00
Werner Lemberg 981c23b75e Remove clang compiler warnings (#50548).
* include/freetype/internal/tttypes.h (TT_FaceRec): Make
`var_postscript_prefix_len' unsigned.

* src/autofit/afwarp.c (af_warper_compute_line_best): Remove
redundant assignment.

* src/cff/cffload.c (cff_subfont_load): Add casts.

* src/cff/cffparse.c (cff_parse_blend): Remove redundant assignment.

* src/sfnt/sfdriver.c (fmix32, murmur_hash_3_128): Add `static'
keyword.
Add casts.
(fixed2float): Add cast.
(sfnt_get_var_ps_name): Make `p' always initialized.
Add casts.

* src/truetype/ttgxvar.c (TT_Get_MM_Var): Add casts.
2017-03-15 11:35:26 +01:00
Werner Lemberg 3f92048ab1 [ftfuzzer] Limit number of tested faces and instances.
This is inspired by the discussion in and analysis of

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

* src/tools/ftfuzzer/ftfuzzer.cc (LLVMFuzzerTestOneInput): Use only
up to 20 face indices.
Use only up to 20 instance indices.
2017-03-15 09:18:22 +01:00
Werner Lemberg f87269c35c * src/tools/ftfuzzer/ftfuzzer.cc: Improve readability; formatting. 2017-03-15 08:03:16 +01:00
Werner Lemberg 9357ef80ff Typo: s/stroke/strike/. 2017-03-15 07:56:22 +01:00
Werner Lemberg 34010f7c47 [sfnt] Implement PS names for font instances [3/3].
Everything is guarded with TT_CONFIG_OPTION_GX_VAR_SUPPORT.

* include/freetype/internal/tttypes.h (TT_FaceRec): New fields
`var_postscript_prefix' and `var_postscript_prefix_len'.

* src/sfnt/sfdriver.c: Include FT_TRUETYPE_IDS_H.
(sfnt_is_alphanumeric): New wrapperfunction for `ft_isalnum'.
(get_win_string, get_apple_string): Remove `const' from return
value.
(MAX_VALUE_DESCRIPTOR_LEN, MAX_PS_NAME_LEN): New macros.
(hexdigits): New array.
(sfnt_get_var_ps_name): New function, implementing Adobe TechNote
5902 to construct a PS name for a variation font instance.
(sfnt_get_ps_name): Call `sfnt_get_var_ps_name' for font instances.

* src/sfnt/sfobjs.c (sfnt_done_face): Updated.

* src/truetype/ttgxvar.c (tt_set_mm_blend): Reset
`face->postscript_name' to trigger recalculation for new instance
parameters.
2017-03-14 21:50:22 +01:00
Werner Lemberg 4fd9cc73e6 [sfnt] Implement PS names for font instances [2/3].
* src/sfnt/sfdriver.c (fix2float) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]:
New function to find the shortest representation of a 16.16
fractional number.
2017-03-14 19:40:50 +01:00
Werner Lemberg 4a32dce92a [sfnt] Implement PS names for font instances [1/3].
Add 128bit MurmurHash 3 function.

Everything is guarded with TT_CONFIG_OPTION_GX_VAR_SUPPORT.

* src/sfnt/sfdriver.c (ROTL32): New macro.
(fmix32, murmur_hash_3_128): New functions.
2017-03-14 19:32:12 +01:00
Werner Lemberg 447a0b6263 [truetype] Ignore invalid MVAR tags.
Reported as

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

* src/truetype/ttgxvar.c (ft_var_load_mvar): Ignore value and emit
warning for invalid tags.
(tt_apply_mvar): Ignore invalid tags.
2017-03-13 07:42:34 +01:00
Werner Lemberg 5eb0fd5e97 [truetype] Store and use design coordinates also.
* include/freetype/internal/services/svmm.h (FT_Get_Var_Blend_Func):
Add `normalizedcoords' argument.

* src/truetype/ttgxvar.h (GX_BlendRec): Add `coords' field to store
the design coordinates of the current instance.
Updated.

* src/truetype/ttgxvar.c (TT_Set_MM_Blend): Move functionality to...
(tt_set_mm_blend): ... New function.
Convert data in `normalizedcoords' array to `coords' array on
demand.
(TT_Set_Var_Design): Store argument data in `coords' array.
(TT_Get_Var_Design): Get data from `coords' array.
(tt_get_var_blend): Updated.
(tt_done_blend): Updated.

* src/cff/cffload.c, src/cff/cffload.h (cff_get_var_blend): Updated.

* src/cff/cf2ft.c (cf2_getNormalizedVector): Updated.

* src/cff/cffobjs.c (cff_face_init): Updated.
2017-03-12 20:46:56 +01:00
Werner Lemberg 8dd9e9675d Document `GX_BlendRec'. 2017-03-12 10:47:20 +01:00
Werner Lemberg 4a62922bf8 src/truetype/ttgxvar.[ch]: s/avar_checked/avar_loaded/. 2017-03-12 10:19:53 +01:00
Werner Lemberg 7bbb91fbf4 [sfnt] Another fix for buggy variation fonts.
Reported as

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

* src/sfnt/sfobjs.c (sfnt_init_face): While setting number of
instances to zero for `CFF' fonts table, ensure that there is no
`CFF2' present also (which gets priority).
2017-03-08 15:10:19 +01:00
Alexei Podtelezhnikov 7d7aae1de3 Typos. 2017-03-07 22:21:26 -05:00
Werner Lemberg 7793097442 [sfnt] Improve handling for buggy variation fonts.
Reported as

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

* src/sfnt/sfobjs.c (sfnt_init_face): While setting number of
instances to zero for `CFF' fonts table, ensure that there is no `glyf'
present also (which gets priority).
2017-03-07 17:27:58 +01:00
Werner Lemberg 27fee7f8c6 [sfnt, truetype] Always provide default instance.
As documented in the OpenType specification, an entry for the
default instance may be omitted in the named instance table.  In
particular this means that even if there is no named instance table
in the font we actually do have a named instance, namely the default
instance.

For consistency, we always want the default instance in our list of
named instances.  If it is missing, we try to synthesize it.

* src/sfnt/sfobjs.c (sfnt_init_face): Check whether the default
instance is in the table of named instances.  Otherwise adjust
number of instances.

* src/truetype/ttgxvar.c: Include FT_TRUETYPE_IDS_H.
(TT_Get_MM_Var): Use `face->root.style_flags' as the number of named
instances.
Sythesize a named instance entry if necessary.
(tt_done_blend): Free `normalized_stylecoords'.
2017-03-06 20:45:44 +01:00
Werner Lemberg f27992f295 Minor documentation fixes. 2017-03-06 20:45:08 +01:00
Werner Lemberg b1a98f9e0a Minor. 2017-03-06 20:29:26 +01:00
Werner Lemberg c1b000da00 [sfnt] Remove redundant code.
* src/sfnt/sfobjs.c (sfnt_init_face): Remove second test for
`num_instances', which will always succeed.
2017-03-05 20:23:35 +01:00
Werner Lemberg 0c7fb43d05 [sfnt] Add `get_name_id' service.
* include/freetype/internal/sfnt.h (TT_Get_Name_ID_Func): New
typedef.
(SFNT_Interface): Add `get_name_id' field.
(FT_DEFINE_SFNT_INTERFACE): Updated.

* src/sfnt/sfdriver.c (search_name_id): Rename to...
(sfnt_get_name_id): ... this.
(sfnt_get_ps_name, sfnt_interface): Udpated.
2017-03-05 19:06:41 +01:00
Werner Lemberg 99fb3c3ab8 Comment updates. 2017-03-05 11:32:41 +01:00
Werner Lemberg 588e38e070 [truetype] Make `TT_Set_MM_Blend' set named instance index.
* src/truetype/ttgxvar.h (GX_Blend): New array
`normalized_stylecoords'.

* src/truetype/ttgxvar.c (TT_Get_MM_Var): Allocate and fill
`normalized_stylecoords'.
(TT_Set_MM_Blend): Check instance tuple and adjust `face_index'
accordingly.
2017-03-04 11:04:24 +01:00
Werner Lemberg 4717696c12 [truetype] Split off designer/normalized conversion routines.
* src/truetype/ttgxvar.c (TT_Set_Var_Design): Split off conversion
code designer->normalized coordinates to...
(ft_var_to_normalized): ... New function.
(TT_Get_Var_Design): Split off conversion code normalized->designer
coordinates to...
(ft_var_to_design): ... New function.
2017-03-02 21:42:14 +01:00
Werner Lemberg b553fcb514 [sfnt] Further generalize `sfnt_get_ps_name'; report invalid data.
* src/sfnt/sfdriver.c (sfnt_ps_map): New array.
(sfnt_is_postscript): New function.
(char_type_func): New typedef.
(get_win_string, get_apple_string): Add argument to specify
character checking function.
Add argument whether argument checking failures should be reported.
Update callers.
(search_name_id): Fix return value.
2017-02-28 15:27:43 +01:00
Werner Lemberg b653a23079 [sfnt] Split off another bit of `sfnt_get_ps_name'.
* src/sfnt/sfdriver.c (sfnt_get_ps_name): Split off some
functionality into...
(search_name_id): ... New function.
2017-02-28 15:27:43 +01:00
Werner Lemberg c1abd6aa47 [sfnt] Modularize `sfnt_get_ps_name'.
* src/sfnt/sfdriver.c (sfnt_get_ps_name): Split off some
functionality into...
(IS_WIN, IS_APPLE): ... New macros.
(get_win_string, get_apple_string): ... New functions.
2017-02-28 15:27:43 +01:00
Werner Lemberg 01f315f076 [truetype] Minor improvement.
* src/truetype/ttgload.c (TT_Process_Simple_Glyph,
load_truetype_glyph): Remove unnecessary tests.
2017-02-28 15:27:43 +01:00
Alexei Podtelezhnikov d4b6a2053f Typo. 2017-02-24 21:54:01 -05:00
Werner Lemberg f0cee1a22c * include/freetype/internal/tttypes.h (TT_Face): s/isCFF2/is_cff2/.
For orthogonality with other structure field names.

Update all users.
2017-02-23 08:23:39 +01:00
Alexei Podtelezhnikov 761d9e418b * src/smooth/ftgrays.c (gray_hline): Improve code. 2017-02-22 22:41:36 -05:00
Alexei Podtelezhnikov 73a7ce3d00 * include/freetype/freetype.h (FT_Face_Properties): Fix bad example, typo. 2017-02-21 21:43:37 -05:00
Dominik Röttsches b31053476c Fix some `ttnameid.h' entries (#50313).
* include/freetype/ttnameid.h:
s/TT_MS_LANGID_SPANISH_INTERNATIONAL_SORT/TT_MS_LANGID_SPANISH_SPAIN_INTERNATIONAL_SORT/,
s/TT_MS_LANGID_MONGOLIAN_MONGOLIA_MONGOLIA/TT_MS_LANGID_MONGOLIAN_MONGOLIA_MONGOLIAN/.
2017-02-20 12:29:59 +01:00
Werner Lemberg 9cc476a217 Update `CHANGES' file. 2017-02-20 09:58:43 +01:00
Werner Lemberg e706798d43 [cff] Finish support for `random' operator.
* src/cff/cfftypes.h (CFF_SubFontRec): Add `random' field.

* src/cff/cffobjs.c: Updated.
(cff_driver_init): Initialize random seed value.

* src/cff/cffload.c (cff_random): New function.
(cff_subfont_load): Add `face' argument.
Update all callers.
Initialize random number generator with a proper seed value.
(cff_font_load): Add `face' argument.
Update all callers.

* src/cff/cffload.h: Updated.

* src/cff/cf2intrp.c (CF2_FIXME): Removed.
(cf2_interpT2CharString) <cf2_escRANDOM>: Implement opcode.

* src/cff/cffgload.c (cff_decoder_parse_charstrings): Don't
initialize random seed value.
<cff_op_random>: Use new random seed framework.
2017-02-20 09:15:13 +01:00
Werner Lemberg 156b30b1aa [cff] Sanitize `initialRandomSeed'.
* src/cff/cffload.c (cff_load_private_dict): Make
`initial_random_seed' value always positive.
2017-02-20 09:06:22 +01:00
Werner Lemberg 753e1131ee [cff] Introduce `random-seed' property (2/2).
* src/base/ftobjs.c: Include `FT_CFF_DRIVER_H'.
(open_face): Initialize `face->internal->random_seed'.
(FT_Face_Properties): Handle `FT_PARAM_TAG_RANDOM_SEED'.

* src/cff/cffdrivr.c (cff_property_set): Handle `random-seed'
property.
2017-02-20 09:01:14 +01:00
Werner Lemberg ca1486c32a [cff] Introduce `random-seed' property (1/2).
We need this for support of the `random' operator.

* include/freetype/ftcffdrv.h (FT_PARAM_TAG_RANDOM_SEED): New macro.

* include/freetype/internal/ftobjs.h (FT_Face_InternalRec): New
field `random_seed'.

* src/cff/cffobjs.h (CFF_DriverRec): New field `random_seed'.
2017-02-20 08:55:26 +01:00
Werner Lemberg d22f5ec563 Formatting. 2017-02-18 10:43:10 +01:00
Werner Lemberg 467b026cd5 Remove clang warnings.
* src/autofit/aflatin.c (af_latin_sort_blue): Add missing `static'
keyword.

* src/base/ftmm.c (FT_Set_Var_Design_Coordinates,
FT_Set_MM_Blend_Coordinates, FT_Set_Var_Blend_Coordinates):
Initialize some variables.
2017-02-18 10:42:48 +01:00
Nikolaus Waxweiler 2b0ac18990 Add face property for stem darkening.
* include/freetype/ftautoh.h (FT_PARAM_TAG_STEM_DARKENING): New
macro.

* include/freetype/internal/ftobjs.h (FT_Face_InternalRec): Add
`no_stem_darkening' field.

* src/autofit/afloader.c (af_loader_load_glyph),
src/autofit/afmodule.c (af_property_set): Updated.

* src/base/ftobjs.c: Include FT_AUTOHINTER_H.
(ft_open_face_internal): Updated.
(FT_Face_Properties): Handle FT_PARAM_TAG_STEM_DARKENING.

* src/cff/cf2ft.c (cf2_decoder_parse_charstrings): Updated.

* src/cff/cffdrivr.c (cff_property_set): Updated.
2017-02-18 10:42:23 +01:00
Nikolaus Waxweiler 2e9519885b Add face property for LCD filter weights.
* include/freetype/ftlcdfil.h (FT_PARAM_TAG_LCD_FILTER_WEIGHTS,
FT_LCD_FILTER_FIVE_TAPS): New macros.
(FT_LcdFiveTapFilter): New typedef.

* include/freetype/ftobjs.h (FT_Face_InternalRec)
[FT_CONFIG_OPTION_SUBPIXEL_RENDERING]: Add `lcd_weights' field.
(FT_Bitmap_LcdFilterFunc): Change third argument to weights array.
(ft_lcd_filter_fir): New prototype.
(FT_LibraryRec): Updated.

* src/base/ftlcdfil.c (_ft_lcd_filter_fir): Renamed to...
(ft_lcd_filter_dir): ... this base function.
Updated.
(_ft_lcd_filter_legacy): Updated.
(FT_Library_SetLcdFilterWeights, FT_Library_SetLcdFilter): Updated.

* src/base/ftobjs.c (ft_open_face_internal): Updated.
(FT_Face_Properties): Handle FT_PARAM_TAG_LCD_FILTER_WEIGHTS.

* src/smooth/ftsmooth.c (ft_smooth_render_generic)
[FT_CONFIG_OPTION_SUBPIXEL_RENDERING: Handle LCD weights from
`FT_Face_Internal'.
2017-02-16 20:45:45 +01:00
Nikolaus Waxweiler 64cdee7348 Add new function `FT_Face_Properties'.
This commit provides the framework, to be filled with something
useful in the next commits.

* include/freetype/freetype.h (FT_Face_Properties): Declare.

* src/base/ftobjs.c (FT_Face_Properties): New function.
2017-02-15 08:06:35 +01:00
Werner Lemberg e432ebf2e2 Minor doc issue. 2017-02-14 12:52:32 +01:00
Alexei Podtelezhnikov e756e21758 Typos. 2017-02-14 00:17:58 -05:00
Werner Lemberg 319125d4c2 [autofit] Prevent overlapping blue zones.
Problem reported as

  https://github.com/google/fonts/issues/632

The font in question (Nunito) has values 705 and 713 for the
reference and overshoot values, respectively, of the first blue
zone.  Blue zone 2, however, has value 710 for both the reference
and overshoot.  At 12ppem, reference and overshoot of blue zone 0
becomes 8px, while blue zone 2 becomes 9px.

A peculiarity of this font is that the tops of isolated vertical
stems like `N' have a slight overshoot also.  The auto-hinter tries
to find the nearest blue zone using the *original* coordinates.  For
vertical stems, this is value 713.  For normal horizontal tops like
in character `E', this is value 710.  Since value 713 is mapped to
8px but value 710 to 9px, `N' and similar characters are one pixel
higher than `E', which looks very bad.

This commit sanitizes blue zones to avoid such a behaviour.

* src/autofit/aflatin.c (af_latin_sort_blue): New function.
(af_latin_metrics_init_blues): Sort blue values and remove overlaps.
2017-02-13 09:34:17 +01:00
Alexei Podtelezhnikov fcd47b3d3e * src/smooth/ftgrays.c (gray_sweep): Improve code. 2017-02-12 23:07:29 -05:00
Werner Lemberg faa3c88254 [truetype] Implement `VVAR' table support.
* src/truetype/ttgxvar.h (GX_HVarTable): Renamed to...
(GX_HVVarTable): ...This.
(GX_Blend): Add fields for `VVAR' table handling.
Other minor updates.

* src/truetype/ttgxvar.c (ft_var_load_hvar): Renamed to...
(ft_var_load_hvvar): ...This.
Handle VVAR loading also (controlled by an additional parameter).
(tt_hadvance_adjust): Renamed to...
(tt_hvadvance_adjust): ...This.
Handle application of advance height also (controlled by an
additional parameter).
(tt_hadvance_adjust, tt_vadvance_adjust): Wrappers for
`tt_hvadvance_adjust'.

* src/truetype/ttdriver.c (tt_service_metrics_variations): Updated.
2017-02-06 13:13:02 +01:00
Werner Lemberg 144d10873d Add comment that we don't use VORG table. 2017-02-06 07:54:59 +01:00
Werner Lemberg 1dee4bf9f7 [autofit] Use better blue zone characters for lowercase latin.
The number of lowercase characters for computing the top flat blue
zone value was too small (in most cases only `x' and `z').  If one
of the two characters has a large serif, say, it can happen that
FreeType must select between two different values, having a 50%
chance to use the wrong one.  As a result, rendering at larger PPEM
values could yield uneven lowercase glyph heights.

Problem reported by Christoph Koeberlin <christoph@koe.berlin>.

* src/autofit/afblue.dat (AF_BLUE_STRING_LATIN_SMALL): Replaced
with...
(AF_BLUE_STRING_LATIN_SMALL_TOP, AF_BLUE_STRING_LATIN_SMALL_BOTTOM):
... New, extended sets.
(AF_BLUE_STRINGSET_LATN): Updated.

* src/autofit/afblue.c, scr/autofit/afblue.h: Regenerated.
2017-02-05 08:33:10 +01:00
Werner Lemberg a18f5e1002 Typo. 2017-02-04 20:33:53 +01:00
Werner Lemberg 1c513fbb88 Make `freetype-config' a wrapper of `pkg-config' if possible.
Based on ideas taken from

  http://pkgs.fedoraproject.org/cgit/rpms/freetype.git/tree/freetype-multilib.patch
  http://pkgs.fedoraproject.org/cgit/rpms/freetype.git/tree/freetype-2.5.3-freetype-config-prefix.patch

* builds/unix/freetype-config.in: Rewritten.  Use `pkg-config' to
set output variables if program is available.

* docs/CHANGES, docs/freetype-config.1: Updated.
2017-02-04 20:30:40 +01:00
Werner Lemberg 790428905d * builds/unix/unix-def.in (freetype-config): Fix permissions. 2017-02-04 16:08:08 +01:00
Werner Lemberg 68a738db83 Comments. 2017-02-03 21:32:21 +01:00
Werner Lemberg 0a1169f7c3 * src/autofit/afglobal.c (af_face_globals_free): Erase useless code. 2017-02-03 19:38:20 +01:00
Werner Lemberg 5a7f2ff520 * include/freetype/ftgasp.h (FT_GASP_SYMMETRIC_GRIDFIT): Fix value.
Reported by Behdad.
2017-02-03 08:31:18 +01:00
Werner Lemberg 1dc8cc3303 Minor documentation improvements. 2017-02-02 21:51:07 +01:00
Werner Lemberg e6699596af [truetype] Fix MVAR post-action handling.
Reported as

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

* src/truetype/ttobjs.c (tt_size_reset): Do nothing for CFF2.  This
is important to make `tt_size_reset_iterator' (called in
`tt_apply_mvar') always work.
2017-02-02 11:38:04 +01:00
Werner Lemberg dadc50a467 Make compilation with FT_CONFIG_OPTION_PIC work again.
All code committed here is guarded with `FT_CONFIG_OPTION_PIC'.

* include/freetype/internal/services/svmetric.h
(FT_DEFINE_SERVICE_METRICSVARIATIONSREC): Remove trailing semicolon.

* src/autofit/aflatin.c (af_latin_hints_compute_edges,
af_latin_hint_edges): Provide `globals' variable.

* src/autofit/afloader.c (af_loader_load_glyph): Remove shadowing
variable.

* src/autofit/afmodule.c (AF_SCRIPT_CLASSES_GET,
AF_STYLE_CLASSES_GET): Redefine.

* src/autofit/aftypes.h (AF_DEFINE_WRITING_SYSTEM_CLASS): Fix typo.

* src/cff/cffparse.c (CFF_FIELD_BLEND): Provide it.

* src/cff/cffpic.h (CffModulePIC): Fix typo.
2017-02-02 07:13:29 +01:00
Alexei Podtelezhnikov a3754d6626 Comment. 2017-02-01 22:36:16 -05:00
Alexei Podtelezhnikov 2ca5b07d4f * src/smooth/ftgrays.c (gray_render_scanline): Improve code. 2017-01-31 23:13:50 -05:00
Werner Lemberg fa437d8d3c [cff] Provide metrics variation service interface (#50196).
Only now I've got an OTF with an HVAR table for testing...

The code in `ftmm.c' uses `FT_FACE_LOOKUP_SERVICE' to get the
metrics variations interface.  However, this didn't work with
`FT_FACE_FIND_GLOBAL_SERVICE' used in `sfnt_init_face'.

* src/cff/cffdrivr.c: Include FT_SERVICE_METRICS_VARIATIONS_H.
(cff_hadvance_adjust, cff_metrics_adjust): Wrapper functions for
metric service functions from the `truetype' module.
(cff_service_metrics_variations): New service.
(cff_services): Updated.

* src/cff/cffpic.h (CFF_SERVICE_METRICS_VAR_GET): New macro.
[FT_CONFIG_OPTION_PIC]: Synchronize code.

* src/sfnt/sfobjs.c (sfnt_init_face): Replace call to
FT_FACE_FIND_GLOBAL_SERVICE with `ft_module_get_service' to always
load the service from the `truetype' module.
2017-01-31 23:06:38 +01:00
Werner Lemberg 4058939cb1 Add framework to support services with 9 functions.
* include/freetype/internal/ftserv.h (FT_DEFINE_SERVICEDESCREC9):
New macro.
2017-01-31 19:11:56 +01:00
Werner Lemberg 1e55060109 [base] Fix error handing in MM functions.
* src/base/ftmm.c (FT_Set_Var_Design_Coordinates,
FT_Set_MM_Blend_Coordinates, FT_Set_Var_Blend_Coordinates):
Implement it.
2017-01-31 18:47:10 +01:00
Werner Lemberg e80e4d811a [truetype] Fix sanity check for `gvar' table (#50184).
* src/truetype/ttgxvar.c (ft_var_load_gvar): There might be missing
variation data for some glyphs.
2017-01-31 08:32:07 +01:00
Werner Lemberg 31f8055390 [autofit] Avoid uninitialized jumps (#50191).
* src/autofit/afcjk.c (af_cjk_metrics_check_digits),
src/autofit/aflatin.c (af_latin_metrics_check_digits): Initialize
`advance'.
2017-01-31 08:10:04 +01:00
Werner Lemberg 9db55ad1af Typo. 2017-01-30 07:35:06 +01:00
Werner Lemberg 1c19b54999 freetype.h: Improve Unicode Variation Sequence documentation. 2017-01-28 11:39:51 +01:00
Werner Lemberg 464b16ba46 s/GB2312/PRC/.
* include/freetype/freetype.h (FT_ENCODING_PRC): New enum value.
(FT_ENCODING_GB2312): Deprecated.

* include/freetype/ttnameid.h (TT_MS_ID_PRC): New macro.
(TT_MS_ID_GB2312): Deprecated.

* src/sfnt/sfobjs.c (sfnt_find_encoding): Updated.

* docs/CHANGES: Updated.
2017-01-27 08:45:46 +01:00
Werner Lemberg f4253366f1 [base] Add `FT_Get_Sfnt_LangTag' function.
* include/freetype/ftsnames.h (FT_SfntLangTag): New structure.
(FT_Get_Sfnt_LangTag): New declaration.

* src/base/ftsnames.c (FT_Get_Sfnt_LangTag): New funtion.

* docs/CHANGES: Updated.
2017-01-27 00:06:52 +01:00
Werner Lemberg 939df42072 [sfnt] Support `name' table format 1.
* include/freetype/internal/tttypes.h (TT_LangTagRec): New
structure.
(TT_NameTableRec): Add fields `numLangTagRecords' and `langTags'.

* src/sfnt/ttload.c (tt_face_load_name): Add support for language
tags.
Reduce array size of name strings in case of invalid entries.
(tt_face_free_name): Updated.

* docs/CHANGES: Updated.
2017-01-26 21:41:38 +01:00
Werner Lemberg f4e5696643 [sfnt] s/TT_NameEntry/TT_Name/.
* include/freetype/internal/tttypes.h (TT_NameEntryRec): Renamed
to...
(TT_NameRec): This.
(TT_NameTableRec): Updated.

* src/base/ftsnames.c (FT_Get_Sfnt_Name): Updated.

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

* src/sfnt/sfobjs.c (tt_name_entry_ascii_from_utf16,
tt_name_entry_ascii_from_other): Renamed to...
(tt_name_ascii_from_utf16, tt_name_entry_ascii_from_other): This,
respectively.
(TT_NameEntry_ConvertFunc): Renamed to...
(TT_Name_ConvertFunc): This.
(tt_face_get_name): Updated.

* src/sfnt/ttload.c (tt_face_load_name, tt_face_free_names):
Updated.
2017-01-25 15:08:41 +01:00
Werner Lemberg d66c3645fc Minor: Use `FT_ERR' macro. 2017-01-25 12:53:06 +01:00
Alexei Podtelezhnikov 983fb0df5a Typos. 2017-01-24 23:56:59 -05:00
Werner Lemberg 143971202a [sfnt] Fix Postscript name service for symbol fonts.
* src/sfnt/sfdriver.c (sfnt_get_ps_name): Accept PID/EID=3/0
entries also.
2017-01-24 20:48:50 +01:00
Werner Lemberg 141f0ea5ab [truetype] For OpenType 1.7: s/preferred/typographic/ (sub)family.
* include/freetype/ftsnames.h
(FT_PARAM_TAG_IGNORE_TYPOGRAPHIC_FAMILY,
FT_PARAM_TAG_IGNORE_TYPOGRAPHIC_SUBFAMILY): New macros.
(FT_PARAM_TAG_IGNORE_PREFERRED_FAMILY,
FT_PARAM_TAG_IGNORE_PREFERRED_SUBFAMILY): Deprecated.

* include/freetype/ttnameid.h (TT_NAME_ID_TYPOGRAPHIC_FAMILY,
TT_NAME_ID_TYPOGRAPHIC_SUBFAMILY): New macros.
(TT_NAME_ID_PREFERRED_FAMILY, TT_NAME_ID_PREFERRED_SUBFAMILY):
Deprecated.

* src/sfnt/sfobjs.c (sfnt_load_face): Updated.

* docs/CHANGES: Updated.
2017-01-24 17:00:36 +01:00
Werner Lemberg 693f56ffcd [base] Add `FT_Set_Default_Properties' (#49187).
* include/freetype/ftmodapi.h: Add declaration.

* src/base/ftinit.c (ft_set_default_properties): Renamed to...
(FT_Set_Default_Properties): ... this.
(FT_Init_FreeType): Updated.

* docs/CHANGES: Updated.
2017-01-23 12:53:18 +01:00
Werner Lemberg f502092bcd [truetype] Minor updates for OpenType 1.8.1.
* src/truetype/ttgxvar.h (GX_MVarTable): `axisCount' has been
removed frem the specification; it is now reserved.

* src/truetype/ttgxvar.c (ft_var_load_mvar): Updated.
(GX_FVar_Head): Remove `countSizePairs'; the corresponding data
field in the `MVAR' table is now reserved.
(fvar_fields): Updated.
2017-01-23 11:47:40 +01:00
Werner Lemberg 79d52b9a8d [truetype] Avoid segfault for invalid variation data.
* src/truetype/ttgxvar.c (ft_var_load_item_variation_store): Assure
`itemCount' is not zero.

Reported as

  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=441
2017-01-23 07:43:56 +01:00
Alexei Podtelezhnikov 15c6e8d6c5 Typos. 2017-01-22 23:09:05 -05:00
Werner Lemberg 43061d6a93 * src/truetype/ttinterp.c (TT_RunIns): Adjust loop detector limits. 2017-01-20 10:16:38 +01:00
Alexei Podtelezhnikov a32270ae0e Typos. 2017-01-19 23:01:44 -05:00
Alexei Podtelezhnikov 236bbdbef9 Typos. 2017-01-18 23:12:31 -05:00
Alexei Podtelezhnikov ca472220a4 Typos. 2017-01-17 23:45:08 -05:00
Werner Lemberg 8013d89f7f ftsnames.h, ttnameid.h, tttables.h: Revise documentation.
Show more macros in the reference: TT_MAC_LANGID_XXX, TT_MS_LANGID_XXX,
TT_NAME_ID_XXX, TT_UCR_XXX.

This commit is viewed best with

  git diff --color-words='[^*/ ]+'
2017-01-17 12:39:53 +01:00
Werner Lemberg ba6f3e18d0 * include/freetype/ttnameid.h: Updated to OpenType 1.8.1.
(TT_APPLE_ID_FULL_UNICODE): New macro.

(TT_MS_LANGID_BOSNIAN_BOSNIA_HERZ_CYRILLIC,
TT_MS_LANGID_UPPER_SORBIAN_GERMANY,
TT_MS_LANGID_LOWER_SORBIAN_GERMANY, TT_MS_LANGID_IRISH_IRELAND,
TT_MS_LANGID_INUKTITUT_CANADA_LATIN, TT_MS_LANGID_BASHKIR_RUSSIA,
TT_MS_LANGID_LUXEMBOURGISH_LUXEMBOURG,
TT_MS_LANGID_GREENLANDIC_GREENLAND, TT_MS_LANGID_MAPUDUNGUN_CHILE,
TT_MS_LANGID_MOHAWK_MOHAWK, TT_MS_LANGID_BRETON_FRANCE,
TT_MS_LANGID_OCCITAN_FRANCE, TT_MS_LANGID_CORSICAN_FRANCE,
TT_MS_LANGID_ALSATIAN_FRANCE, TT_MS_LANGID_YAKUT_RUSSIA,
TT_MS_LANGID_KICHE_GUATEMALA, TT_MS_LANGID_KINYARWANDA_RWANDA,
TT_MS_LANGID_WOLOF_SENEGAL, TT_MS_LANGID_DARI_AFGHANISTAN): New
macros.

(TT_MS_LANGID_SERBIAN_BOSNIA_HERZ_CYRILLIC): Fix value.

(TT_MS_LANGID_GERMAN_LIECHTENSTEIN, TT_MS_LANGID_CATALAN_CATALAN,
TT_MS_LANGID_CHINESE_MACAO, TT_MS_LANGID_SPANISH_SPAIN_MODERN_SORT,
TT_MS_LANGID_KOREAN_KOREA, TT_MS_LANGID_ROMANSH_SWITZERLAND,
TT_MS_LANGID_SLOVENIAN_SLOVENIA, TT_MS_LANGID_BASQUE_BASQUE,
TT_MS_LANGID_SETSWANA_SOUTH_AFRICA,
TT_MS_LANGID_ISIXHOSA_SOUTH_AFRICA,
TT_MS_LANGID_ISIZULU_SOUTH_AFRICA, TT_MS_LANGID_KAZAKH_KAZAKHSTAN,
TT_MS_LANGID_KYRGYZ_KYRGYZSTAN, TT_MS_LANGID_KISWAHILI_KENYA,
TT_MS_LANGID_TATAR_RUSSIA, TT_MS_LANGID_ODIA_INDIA,
TT_MS_LANGID_MONGOLIAN_PRC, TT_MS_LANGID_TIBETAN_PRC,
TT_MS_LANGID_WELSH_UNITED_KINGDOM, TT_MS_LANGID_GALICIAN_GALICIAN,
TT_MS_LANGID_SINHALA_SRI_LANKA, TT_MS_LANGID_TAMAZIGHT_ALGERIA,
TT_MS_LANGID_SESOTHO_SA_LEBOA_SOUTH_AFRICA, TT_MS_LANGID_YI_PRC,
TT_MS_LANGID_UIGHUR_PRC): New aliases.

Remove commented out code.

(TT_NAME_ID_LIGHT_BACKGROUND, TT_NAME_ID_DARK_BACKGROUND,
TT_NAME_ID_VARIATIONS_PREFIX): New macros.

(HAVE_LIMIT_ON_IDENTS): Remove macro (which was useless since many
years), use guarded long macros by default and define short versions
as aliases for the long ones.
2017-01-17 11:50:09 +01:00
Werner Lemberg 66725768cd ftmm.h: Revise documentation.
This commit is viewed best with

  git diff --color-words='[^*/ ]+'
2017-01-15 16:17:26 +01:00
Werner Lemberg 8665e3f4af freetype.h: Revise documentation.
This commit is viewed best with

  git diff --color-words='[^*/ ]+'
2017-01-15 15:23:06 +01:00
Werner Lemberg 322b3be514 * src/truetype/ttgxvar.c (tt_apply_var): Handle underline parameters
also.
2017-01-15 13:57:25 +01:00
Werner Lemberg eae29d9155 Minor documentation updates. 2017-01-13 10:33:09 +01:00
Werner Lemberg c529885b0b * src/base/ftobjs.c (ft_open_face_internal): Improve tracing. 2017-01-12 08:42:55 +01:00
Werner Lemberg 56645f8a8b Fix documentation of `FT_Get_Sfnt_Name'.
Problem reported by 張俊芝 <418092625@qq.com>.
2017-01-11 16:25:52 +01:00
Werner Lemberg cb93704796 Document MVAR handling. 2017-01-11 14:21:47 +01:00
Werner Lemberg 723aafb5e3 [truetype] Actually use metrics variation service.
* src/base/ftmm.c: Include FT_SERVICE_METRICS_VARIATIONS_H.
(ft_face_get_mvar_service): New auxiliary function to look up
metrics variation service.
(FT_Set_Var_Design_Coordinates, FT_Set_MM_Blend_Coordinates,
FT_Set_Var_Blend_Coordinates): Call metrics variation service.

* src/truetype/ttobjs.c (tt_face_init): Use metrics variations for
named instances.
2017-01-11 14:21:26 +01:00
Werner Lemberg d718ac4ead [truetype] Provide metrics variation service.
* include/freetype/internal/services/svmetric.h
(FT_Metrics_Adjust_Func): Reduce number of necessary parameters.

* src/truetype/ttgxvar.c: Include FT_LIST_H.
(tt_size_reset_iterator): New auxiliary function for...
(tt_apply_var): New function.

* src/truetype/ttgxvar.h: Updated.

* src/truetype/ttdriver.c (tt_service_metrics_variations): Add
`tt_apply_mvar'.

* include/freetype/internal/ftserv.h (FT_ServiceCache): Add metrics
variation service.
2017-01-11 14:12:34 +01:00
Werner Lemberg 07ee1d250c [truetype] Parse `MVAR' table.
* src/truetype/ttgxvar.h (MVAR_TAG_XXX): New macros for MVAR tags.
(GX_Value, GX_MVarTable): New structures.
(GX_Blend): Add it.

* src/truetype/ttgxvar.c (GX_VALUE_SIZE, GX_VALUE_CASE,
GX_GASP_CASE): New macros.
(ft_var_get_value_pointer): New auxiliary function to get a pointer
to a value from various SFNT tables already stored in `TT_Face'.
(ft_var_load_mvar): New function.
(TT_Get_MM_Var): Call it.
(tt_done_blend): Updated.
2017-01-11 12:50:51 +01:00
Werner Lemberg 8ab08cff63 [truetype] More preparations for MVAR support.
* src/truetype/ttobjs.c (tt_size_reset): Add argument to make
function only recompute ascender, descender, and height.

* src/truetype/ttobjs.h: Updated.

* src/truetype/ttdriver.c (tt_size_select, tt_size_request):
Updated.
2017-01-11 10:05:27 +01:00
Werner Lemberg 7ccca6aec1 [pcf] Disable long family names by default.
* include/freetype/config/ftoption.h
(PCF_CONFIG_OPTION_LONG_FAMILY_NAMES): Comment out.
2017-01-09 19:54:44 +01:00
Werner Lemberg 08fd250e1a [pcf] Make long family names configurable.
The change from 2016-09-29 was too radical (except for people using
the openSuSE GNU/Linux distribution).  To ameliorate the situation,
PCF_CONFIG_OPTION_LONG_FAMILY_NAMES gets introduced which controls
the feature; if set, a new PCF property option
`no-long-family-names' can be used to switch this feature off.

* include/freetype/config/ftoption.h, devel/ftoption.h
(PCF_CONFIG_OPTION_LONG_FAMILY_NAMES): New option.

* include/freetype/ftpcfdrv.h: New header file (only containing
comments currently, used for building the documentation).

* include/freetype/config/ftheader.h (FT_PCF_DRIVER_H): New macro.

* src/pcf/pcf.h (PCF_Driver): Add `no_long_family_names' field.

* src/pcf/pcfdrivr.c: Include FT_SERVICE_PROPERTIES_H and
FT_PCF_DRIVER_H.
(pcf_property_set, pcf_property_get): New functions.
(pcf_service_properties): New service.
(pcf_servives): Updated.
(pcf_driver_init) [PCF_CONFIG_OPTION_LONG_FAMILY_NAMES]: Handle
`no_long_family_names'.

* src/pcf/pcfread.c (pcf_load_font): Handle `no_long_family_names'
and PCF_CONFIG_OPTION_LONG_FAMILY_NAMES.

* docs/CHANGES: Updated.
2017-01-09 11:30:32 +01:00
Werner Lemberg f837a50ec3 [pcf] Introduce a driver structure.
To be filled later on with something useful.

* src/pcf/pcf.h (PCF_Driver): New structure.

* src/pcf/pcfdrivr.c (pcf_driver_init, pcf_driver_done): New dummy
functions.
(pcf_driver_class): Updated.
2017-01-09 10:49:03 +01:00
Werner Lemberg 469ced7f7f [truetype] Again some GX code shuffling.
We need this later on for MVAR also.

* src/truetype/ttgxvar.c (tt_hadvance_adjust): Split off computing
an item store variation delta into...
(ft_var_get_item_delta): ...new function.
2017-01-08 09:28:34 +01:00
Werner Lemberg 6812f17472 [truetype] Adjust font variation flags for MVAR.
* include/freetype/internal/tttypes.h (TT_FACE_FLAG_VAR_XXX):
Remove all flags related to MVAR; replace it with...
(TT_FACE_FLAG_VAR_MVAR): ...this new macro.
(TT_Face): Remove `mvar_support' field (which was still unused).
2017-01-08 07:33:05 +01:00
Werner Lemberg 21a0457707 Comment. 2017-01-07 12:00:18 +01:00
Werner Lemberg 0291913491 [truetype] More GX code shuffling.
We need this later on for MVAR also.

* src/truetype/ttgxvar.c (tt_done_blend): Split off handling of item
variation store into...
(ft_var_done_item_variation_store): ...new function.
2017-01-07 07:45:28 +01:00
Werner Lemberg fb90f00cbd [truetype] More generalization of GX stuff.
We need this later on for MVAR also.

* src/truetype/ttgxvar.c (ft_var_load_delta_set_index_mapping): Add
parameters for delta-set index mapping and item variation store.
(ft_var_load_item_variation_store): Add parameter for item variation
store.
s/hvarData/varData/.
Move allocation of `hvar_table' to...
(ft_var_load_hvar): ...this function.
Updated.
2017-01-06 22:23:52 +01:00
Werner Lemberg 0bd0112f4e [truetype] Some GX structure renames for generalization.
We need this later on for MVAR also.

* src/truetype/ttgxvar.h (GX_HVarData): Renamed to...
(GX_ItemVarData): ...this.
(GX_HVarRegion): Renamed to...
(GX_VarRegion): ...this.
(GX_HVStore): Renamed to...
(GX_ItemVarStore): ...this.
(GX_WidthMap): Renamed to...
(GX_DeltaSetIdxMap): ...this.

(GX_HVarTable): Updated.

* src/truetype/ttgxvar.c: Updated.
2017-01-06 21:32:49 +01:00
Werner Lemberg 9c814704c0 [truetype] Code shuffling.
* src/truetype/ttgxvar.c (): Split off loading of item variation
store and delta set index mapping into...
(ft_var_load_item_variation_store,
ft_var_load_delta_set_index_mapping): ... new functions.
2017-01-06 21:13:36 +01:00
Werner Lemberg 7e1cce58b5 [truetype] Add HVAR access without advance width map.
* src/truetype/ttgxvar.c (ft_var_load_hvar): Handle case where
`offsetToAdvanceWidthMapping' is zero.
(tt_hadvance_adjust): Implement direct deltaSet access by glyph
index.
2017-01-06 20:31:22 +01:00
Werner Lemberg 8b755445bb [pcf] Revise driver.
This commit improves tracing and handling of malformed fonts.  In
particular, the changes to `pcf_get_properties' fix

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

* src/pcf/pcfread.c (tableNames): Use long names for better
readability.
(pcf_read_TOC): Allow at most 9 tables.
(pcf_get_properties): Allow at most 256 properties.
Limit strings array length to 256 * (65536 + 1) bytes.
Better tracing.
(pcf_get_metric): Trace metric data.
(pcf_get_metrics): Allow at most 65536 metrics.
Fix comparison of `metrics->ascent' and `metrics->descent' to avoid
potential overflow.
Better tracing.
(pcf_get_bitmaps): Allow at most 65536 bitmaps.
Better tracing.
(pcf_get_encodings, pcf_get_accel): Better tracing.

* src/pcf/pcfdrivr.c (PCF_Glyph_Load): Don't trace `format' details.
These are now shown by `pcf_get_bitmaps'.
2017-01-06 11:47:55 +01:00
Werner Lemberg 348d39c68a Comment. 2017-01-05 12:29:55 +01:00
Werner Lemberg 563ae78022 Update copyright year. 2017-01-04 20:16:34 +01:00
Werner Lemberg a7c2f44b45 * src/pcf/pcfdrivr.c (PCF_Face_Init): Trace compression format. 2017-01-04 13:12:03 +01:00
Werner Lemberg c9d477242c [cff] More consistency checks for pure CFFs.
Reported as

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

* src/cff/cffload.c (cff_font_load): Check element number and size
of Name and Top DICT indices.
2017-01-04 10:00:49 +01:00
Werner Lemberg 025226ae14 [cff, truetype] Minor tracing improvement.
* src/cff/cffobjs.c (cff_face_init), src/truetype/ttobjs.c
(tt_face_init): Indent first tracing message from SFNT driver.
2017-01-04 07:45:44 +01:00
Werner Lemberg 8982405f0c [truetype] Various minor fixes.
* src/truetype/ttgload.c (TT_Load_Simple_Glyph): Check instruction
size only if we do native hinting.
(TT_Load_Glyph): Trace returned error code.

* src/truetype/ttobjs.c (tt_size_run_fpgm, tt_size_run_prep): Trace
returned error code.
(tt_size_ready_bytecode): Don't run `prep' table if `fpgm' table is
invalid.
2017-01-03 09:46:19 +01:00
Werner Lemberg 624b680289 [sfnt] Don't fail if PCLT, EBLC (and similar tables) are invalid.
These tables are optional.

* src/sfnt/sfobjs.c (sfnt_load_face): Implement it.
2017-01-03 09:42:41 +01:00
Werner Lemberg 69414e7afd * src/cff/cffparse.c (cff_parse_num): Simplify. 2017-01-03 06:53:13 +01:00
Werner Lemberg 248eaa4f60 Various fixes for clang's undefined behaviour sanitizer.
* src/cff/cffload.c (FT_fdot14ToFixed): Fix casting.
(cff_blend_doBlend): Don't left-shift negative numbers.
Handle 5-byte numbers byte by byte to avoid alignment issues.

* src/cff/cffparse.c (cff_parse): Handle 5-byte numbers byte by byte
to avoid alignment issues.

* src/cid/cidload (cid_read_subrs): Do nothing if we don't have any
subrs.

* src/psaux/t1decode.c (t1_decode_parse_charstring): Fix tracing.

* src/tools/glnames.py (main): Put `DEFINE_PSTABLES' guard around
definition of `ft_get_adobe_glyph_index'.

* src/psnames/pstables.h: Regenerated.

* src/psnames/psmodule.c: Inlude `pstables.h' twice to get both
declaration and definition.

* src/truetype/ttgxvar.c (FT_fdot14ToFixed, FT_intToFixed): Fix
casting.
2017-01-03 00:27:07 +01:00
Werner Lemberg bdec162d92 [cff] Handle multiple `blend' operators in a row correctly.
Reported as

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

* src/cff/cffload.c (cff_blend_doBlend): Adjust `parser->stack'
pointers into `subFont->blend_stack' after reallocation.
2017-01-01 20:51:55 +01:00
Werner Lemberg 63765a8f2a [sfnt] Return correct number of named instances for TTCs.
Without this patch, requesting information for face index N returned
the data for face index N+1 (or index 0).

* src/sfnt/sfobjs.c (sfnt_init_face): Correctly adjust `face_index'
for negative `face_instance_index' values.
2017-01-01 10:43:41 +01:00
Werner Lemberg 24be60b5f1 */*: Use hex numbers for errors in tracing messages. 2017-01-01 08:20:38 +01:00
Werner Lemberg e9a154e700 [truetype] Check axis count in HVAR table.
Reported as

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

* src/truetype/ttgxvar.c (ft_var_load_hvar): Check axis count.
(ft_var_load_avar): Fix tracing message.
2016-12-31 21:41:08 +01:00
Werner Lemberg 069083cccd * Version 2.7.1 released.
=========================

Tag sources with `VER-2-7-1'.

* docs/VERSION.TXT: Add entry for version 2.7.1.

* README, Jamfile (RefDoc), builds/windows/vc2005/freetype.vcproj,
builds/windows/vc2005/index.html,
builds/windows/vc2008/freetype.vcproj,
builds/windows/vc2008/index.html,
builds/windows/vc2010/freetype.vcxproj,
builds/windows/vc2010/index.html,
builds/windows/visualc/freetype.dsp,
builds/windows/visualc/freetype.vcproj,
builds/windows/visualc/index.html,
builds/windows/visualce/freetype.dsp,
builds/windows/visualce/freetype.vcproj,
builds/windows/visualce/index.html,
builds/wince/vc2005-ce/freetype.vcproj,
builds/wince/vc2005-ce/index.html,
builds/wince/vc2008-ce/freetype.vcproj,
builds/wince/vc2008-ce/index.html: s/2.7/2.7.1/, s/27/271/.

* include/freetype/freetype.h (FREETYPE_PATCH): Set to 1.

* builds/unix/configure.raw (version_info): Set to 19:0:13.
* CMakeLists.txt (VERSION_PATCH): Set to 1.
2016-12-30 21:16:46 +01:00
Werner Lemberg 8fb9d22a6b [ftfuzzer] Replace `rand' with an xorshift algorithm.
* src/tools/ftfuzzer/ftfuzzer.cc: Don't include `stdlib.h'.
(Random): Implement and use a 32bit `xorshift' algorithm.
2016-12-30 19:51:37 +01:00
Werner Lemberg c9de4bf6ba Typo. 2016-12-30 10:07:23 +01:00
Werner Lemberg 6b21d1281e [ftfuzzer] Restrict number of tested bitmap strikes.
Malformed fonts often have large values for the number of bitmap
strikes, and FreeType doesn't check the validity of all bitmap
strikes in advance.

Reported as

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

* src/tools/ftfuzzer/ftfuzzer.cc: Include `stdlib.h' for `rand'.
(Random): Small class to provide n randomly selected numbers
(without repitition) out of the value set [0,N].
(LLVMFuzzerTestOneInput): Use it to test only up to 10 bitmap
strikes.
2016-12-30 10:00:54 +01:00
Werner Lemberg 7591bf11d1 [truetype] Variation font API stability issues.
Make some functions work before a call to `TT_Set_MM_Blend'.

* src/truetype/ttgxvar.c (tt_hadvance_adjust): Exit immediately if
we don't blend.
(TT_Get_MM_Blend, TT_Get_Var_Design): Return default values if we
don't blend.
2016-12-29 21:39:06 +01:00
Werner Lemberg 91fc3bd7c9 * src/truetype/ttgxvar.c (TT_Get_MM_Var): Check axis data.
Reported as

  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=348
2016-12-29 21:34:46 +01:00
Werner Lemberg 180185109b [truetype] Tracing fixes.
* src/truetype/ttgxvar.c (tt_hadvance_adjust): Emit correct
information.
(TT_Set_Var_Design): Fix typo.
(TT_Get_Var_Design): Fix typos.
2016-12-29 21:30:06 +01:00
Werner Lemberg 84b0d9927b */*: Use `0.5f' for tracing 16.16 numbers. 2016-12-29 10:38:51 +01:00
Werner Lemberg 346b141762 [pcf] Protect against gzip bombs.
Fix suggested by Kostya; reported as

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

* src/pcf/pcfread.c (pcf_read_TOC): Limit number of TOC entries to
1024.
2016-12-29 06:03:40 +01:00
Werner Lemberg 6fb549ddab [psnames] Only declare, not define, data in `pstables.h' (#49949).
Pdfium includes `pstables.h' a second time; moving the definition
from `pstables.h' to `psmodule.c' saves more than 60kByte data
segment space for this case.

* src/tools/glnames.py (StringTable::dump,
StringTable::dump_sublist, dump_encoding, dump_array): Emit
additional code to only define tables if `DEFINE_PS_TABLES' is set.

* src/psnames/pstables.h: Regenerated.
* src/psnames/psmodule.c (DEFINE_PS_TABLES): Define.
2016-12-28 22:23:33 +01:00
Werner Lemberg c4a1ef3c94 [cff] Catch `blend' op in non-variant fonts.
Reported as

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

* src/cff/cf2intrp.c (cf2_interpT2CharString) <cf2_cmdBLEND>: Don't
allow `blend' op for non-variant fonts.
2016-12-28 21:22:45 +01:00
Werner Lemberg c4cd34a9e0 [cff] Better check of number of blends.
* src/cff/cf2intrp.c (cf2_interpT2CharString) <cf2_cmdBLEND>,
src/cff/cffparse.c (cff_parse_blend): Compare number of blends with
stack size.
2016-12-28 08:33:35 +01:00
Werner Lemberg 48fd5bb2b6 Documentation updates.
* docs/CHANGES: Add missing information.

* docs/formats.txt: Rewritten and updated.
2016-12-27 10:20:23 +01:00
Werner Lemberg 0a943b6362 Formatting. 2016-12-27 07:50:22 +01:00
Werner Lemberg e5e3556fa2 [truetype, type1] Implement `FT_Get_Var_Design_Coordinates'.
* src/truetype/ttgxvar.c (TT_Get_Var_Design): Implement.
(TT_Set_Var_Design): Fix tracing.

* src/type1/t1load.c (T1_Get_Var_Design): Implement.
2016-12-27 06:49:37 +01:00
Werner Lemberg f80c4473b6 Replace `++foo' and `--foo' with `foo++' and `foo--', resp. 2016-12-26 23:57:45 +01:00
Werner Lemberg 4441f7b246 Replace `foo == NULL' and `foo != NULL' with `!foo' and `foo', resp.
Other minor formatting.
2016-12-26 17:08:17 +01:00
Werner Lemberg 37c72f66a5 Minor formatting. 2016-12-25 22:55:25 +01:00
Werner Lemberg a300c1c3af * src/truetype/ttpload.c (tt_face_load_hdmx): Ignore `version'.
Problem reported by 張俊芝 <418092625@qq.com>.
2016-12-24 09:27:15 +01:00
Werner Lemberg d1db57c284 * src/sfnt/ttsbit.c (tt_face_load_sbit): Allow more version values.
Some fonts seem to have the `version' field in the wrong byte order.

Problem reported by 張俊芝 <418092625@qq.com>.
2016-12-24 09:05:16 +01:00
Werner Lemberg fde0b78cce * src/truetype/ttpload.c (tt_face_load_loca): Sanitize table length.
This trivial fix allows us to accept more fonts.

Problem reported by 張俊芝 <418092625@qq.com>.
2016-12-24 08:17:19 +01:00
Werner Lemberg 1fecdfe346 * src/sfnt/sfobjs.c (sfnt_init_face): Fix tracing. 2016-12-24 07:50:45 +01:00
Werner Lemberg 8d37efbc79 Add missing ChangeLog entry for commit d44daf9e. 2016-12-22 20:48:28 +01:00
Werner Lemberg 18bd176a65 * CMakeLists.txt: Make it work with cmake 2.8.11.2 (#49909). 2016-12-22 12:24:23 +01:00
Werner Lemberg 06d61b487a Ensure used preprocessor symbols are defined (#49790).
* builds/unix/ftconfig.in, builds/vms/ftconfig.h,
include/freetype/config/ftconfig.h: Check `__GNUC__', `__IBMC__',
and `__SUNPRO_C' correctly.
2016-12-22 10:43:46 +01:00
Werner Lemberg 7f7333990c * src/base/ftrfork.c (FT_Raccess_Get_DataOffsets): Check `count'.
Reported as

  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=308
2016-12-22 10:12:17 +01:00
Werner Lemberg b44e6c2035 [cff] Protect against invalid `vsindex' and `blend' values.
Reported as

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

* src/cff/cf2intrp.c (cf2_interpT2CharString) <cf2_cmdVSINDEX,
cf2_cmdBLEND>: Implement it.
2016-12-22 08:30:15 +01:00
Werner Lemberg ada8297175 [ftfuzzer] Always use Adobe CFF engine.
* src/tools/ftfuzzer/ftfuzzer.cc (FT_Global::FT_Global): Implement
it.
2016-12-22 08:25:42 +01:00
Werner Lemberg 7209110345 * src/truetype/ttgxvar.c (TT_Vary_Apply_Glyph_Deltas): Thinko.
I should really stop coding late in the evening...

Thanks again to Ben for checking.
2016-12-21 23:46:29 +01:00
Werner Lemberg d44daf9e9b * src/truetype/ttgxvar.c (TT_Vary_Apply_Glyph_Deltas): Thinko.
Don't apply deltas twice for non-phantom points.

Spotted by Ben Wagner.
2016-12-21 23:03:48 +01:00
Werner Lemberg e6a429e2c7 [cff, truetype] Another try for #49829.
* src/cff/cffdrivr.c: Don't include
`FT_SERVICE_METRICS_VARIATIONS_H'.
(cff_get_advances): Use `ttface->variation_support'.

* src/truetype/ttdriver.c (tt_get_advances): Use
`ttface->variation_support'.

* src/truetype/ttgload.c (TT_Process_Simple_Glyph,
load_truetype_glyph): Use `ttface->variation_support'.
2016-12-21 20:27:48 +01:00
Werner Lemberg 64a91137f1 [truetype, sfnt] Introduce font variation flags to `TT_Face'.
* include/freetype/internal/tttypes.h (TT_FACE_FLAG_VAR_XXX):
New macros describing available functionality of various OpenType
tables related to font variation.
(TT_Face): New fields `variation_support' and `mvar_support',
replacing and extending `use_fvar'.

* src/sfnt/sfobjs.c (sfnt_init_face, sfnt_load_face): Use
`variation_support'.

* src/truetype/ttgxvar.c (ft_var_load_hvar): Set `variation_support'
field.
(TT_Vary_Apply_Glyph_Deltas): Updated.
2016-12-21 19:30:33 +01:00
Werner Lemberg 57a6733dcf [base] Improve sanity check for Mac resources (#49888).
* src/base/ftobjs.c (Mac_Read_sfnt_Resource): Abort if `rlen' is not
positive.
2016-12-21 06:52:23 +01:00
Werner Lemberg ded4bdb5d0 [base] More sanity checks for Mac resources.
We use

  https://github.com/kreativekorp/ksfl/wiki/Macintosh-Resource-File-Format

and

  https://developer.apple.com/legacy/library/documentation/mac/pdf/MoreMacintoshToolbox.pdf#page=151

as references.

* include/freetype/internal/ftrfork.h (FT_RFork_Ref): Use FT_Short
for `res_id'.

* src/base/ftrfork.c (FT_Raccess_Get_HeaderInfo): Extract map length
and use it to improve sanity checks.
Follow the specification more closely;in particular, all data types
are signed, not unsigned.
(FT_Raccess_Get_DataOffsets): Follow the specification more closely;
in particular, all data types are signed, not unsigned.
Add some sanity checks.
2016-12-20 23:26:38 +01:00
Werner Lemberg b55730320c ftobjs.c: Formatting. 2016-12-20 23:22:06 +01:00
Werner Lemberg d5fe8da774 Spelling. 2016-12-20 22:03:40 +01:00
Werner Lemberg d678b37e8a Another minor ChangeLog addition. 2016-12-20 12:45:31 +01:00
Werner Lemberg 70704b34ac [truetype] Improve logic for getting fast advance widths.
* src/cff/cffdrivr.c (cff_get_advances), src/truetype/ttdriver.c
(tt_get_advances): Use `is_default_instance' for test; this gets
recomputed after changing blend coordinates.
2016-12-20 12:27:22 +01:00
Werner Lemberg 59b0b3a76c Add bug reference to previous commit. 2016-12-20 11:39:52 +01:00
Ben Wagner cc576f8002 [truetype] Fix linear metrics of GX variation fonts.
When asking for an unhinted non-default variations,
`linearVertAdvance' is currently the value from the `hmtx' table
instead of the actual value after applying the variation.  `HVAR'
support fixes this, but fonts will exist without that table and will
need sane fallback.

* src/truetype/ttgload.c (TT_Process_Simple_Glyph,
load_truetype_glyph): Implement linear advance adjustments if `HVAR'
or `VVAR' tables are missing.
2016-12-20 11:37:42 +01:00
Werner Lemberg a1e85f11c8 [cff, truetype] Fast advance width retrieval for fonts with HVAR.
Everything is guarded with TT_CONFIG_OPTION_GX_VAR_SUPPORT.

* src/base/ftadvanc.c (LOAD_ADVANCE_FAST_CHECK): Don't handle MM.

* src/cff/cffdrivr.c: Include FT_SERVICE_METRICS_VARIATIONS_H.
(cff_get_advances): Test for HVAR and VVAR.

* src/truetype/ttdriver.c (tt_get_advances): Test for HVAR and VVAR.
2016-12-20 10:52:26 +01:00
Werner Lemberg 5743df7718 [base] Fix invalid mac font recursion.
Reported as

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

* src/base/ftobjs.c (FT_Open_Face): Code moved to...
(ft_open_face_internal): ... this function.
Add a parameter to control whether we try special Mac font handling
in case of failure.
(FT_Open_Face, FT_New_Face, FT_New_Memory_Face,
open_face_from_buffer): Use `ft_open_face_internal'.
2016-12-18 21:01:03 +01:00
Werner Lemberg ca3d401993 * src/cff/cffobjs.c (cff_face_init): Make named instances work. 2016-12-18 18:23:19 +01:00
Werner Lemberg a8652c59da [truetype, cff] Extend `get_var_blend' function of MM service.
In particular, we need access to named instance data.

* include/freetype/internal/services/svmm.h (FT_Get_Var_Blend_Func):
Add argument for `FT_MM_Var'.

* src/cff/cffload.c (cff_get_var_blend): Updated.
* src/cff/cffload.h: Updated.

* src/cff/cf2ft.c (cf2_getNormalizedVector): Updated.

* src/truetype/ttgxvar.c (tt_get_var_blend): Updated.
Accept value `NULL' for arguments.
* src/truetype/ttgxvar.h: Updated.
2016-12-18 18:12:03 +01:00
Werner Lemberg 25f3ac2b9e [sfnt] Handle `fvar' with zero axes as a non-MM font.
This is better behaviour than exiting with an error.

* include/freetype/internal/tttypes.h (TT_Face): Add `use_fvar'
field.

* src/sfnt/sfobjs.c (sfnt_init_face): Compute `use_fvar', also
updating the validation code.
Use `use_fvar' to compute FT_FACE_FLAG_MULTIPLE_MASTERS.

* src/truetype/ttgxvar.c (TT_Get_MM_Var): Remove `fvar' validation
code.
2016-12-18 15:50:18 +01:00
Werner Lemberg eb6d02087b Minor GX code shuffling.
* include/freetype/internal/tttypes.h (TT_Face): Move
`is_default_instance' into TT_CONFIG_OPTION_GX_VAR_SUPPORT
block.

* src/sfnt/sfobjs.c (sfnt_init_face): Updated.
* src/truetype/ttgload.c (IS_DEFAULT_INSTANCE): New macro.
(TT_Load_Glyph): Use it.
2016-12-18 09:29:58 +01:00
Werner Lemberg 8f633a08f1 [cff] Better handling of non-CFF font formats.
* src/cff/cffload.c (cff_font_load): Pure CFFs don't have a
signature, so return `FT_Err_Unknown_File_Format' more often.
2016-12-18 06:42:31 +01:00
Werner Lemberg 4cd6817951 * src/cff/cffload.c (cff_build_blend_vector): Remove redundant code. 2016-12-17 22:52:50 +01:00
Werner Lemberg 6949797d60 More code formatting. 2016-12-17 21:05:54 +01:00
Werner Lemberg 5d664b6d51 Use FT_SET_ERROR where useful. Other minor code formatting. 2016-12-17 20:47:42 +01:00
Werner Lemberg db17ceb4c0 * src/truetype/ttobjs.c (tt_face_init): Simplify conditional code. 2016-12-17 13:39:31 +01:00
Werner Lemberg 7c75b166c8 [sfnt, truetype] Various sanitizing fixes.
* src/sfnt/sfobjs.c (sfnt_init_face): If the axis count in `fvar' is
zero, set `num_instances' to zero.

* src/truetype/ttgxvar.c (TT_Get_MM_Var): Handle `fvar' table with
zero axes as invalid.

* src/truetype/ttobjs.c (tt_face_init): Improve logic of loading
`loca', `cvt', `fpgm', and `prep' table.
2016-12-17 13:28:24 +01:00
Werner Lemberg 3b125e9594 Improve tracing of `FT_Open_Face'.
* src/base/ftobjs.c (FT_Open_Face): Return info on number of
available faces and numbered instances, or the indices of the
requested face and numbered instance.

* src/sfnt/sfobjs. (sfnt_open_font): Trace number of subfonts.
2016-12-17 10:02:19 +01:00
Werner Lemberg 50ff6c1eab * src/cff/cffload.c (cff_load_private_dict): Always init `blend'.
Reported as

  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=295
2016-12-17 07:44:46 +01:00
Werner Lemberg df2cf43e94 [truetype] Fix `cvar' sanity test.
Reported by Dave Arnold.

* src/truetype/ttgxvar.c (tt_face_vary_cvt): Use tuple count mask.
2016-12-16 11:38:20 +01:00
Werner Lemberg 6862024854 [cff, truetype] Remove compiler warnings; fix `make multi'.
* src/cff/cf2font.h: Include `cffload.h'.

* src/cff/cffload.c: Include FT_MULTIPLE_MASTERS_H and
FT_SERVICE_MULTIPLE_MASTERS_H.
(cff_vstore_load): Eliminate `vsSize'.
(cff_load_private_dict): Tag as `FT_LOCAL_DEF'.

* src/cff/cffload.h: Include `cffobjs.h'.
Provide declaration for `cff_load_private_dict'.

* src/truetype/ttgxvar.c (ft_var_load_hvar): Eliminate
`minorVersion' and `map_offset'.
2016-12-16 11:15:17 +01:00
Werner Lemberg beecf80a6d [cff] Fix heap buffer overflow (#49858).
* src/cff/cffparse.c (cff_parser_run): Add one more stack size
check.
2016-12-16 08:52:03 +01:00
Werner Lemberg 01658be6fb Fix clang warnings.
* src/cff/cffload.c (cff_blend_doBlend): Add cast.
(cff_subfont_load): Set `error' correctly.

* src/sfnt/ttmtx.c (tt_face_get_metrics): Typo.
2016-12-15 23:10:59 +01:00
Dave Arnold edf4014854 [cff] Implement CFF2 support (2/2).
The font variation code.  All parts dependent on the GX code in the
`truetype' module are guarded with TT_CONFIG_OPTION_GX_VAR_SUPPORT.
In other words, you can still compile the `cff' module without
defining TT_CONFIG_OPTION_GX_VAR_SUPPORT (which brings you CFF2
support without font variation).

* src/cff/cf2font.c (cf2_font_setup): Add support for font
variation.
* src/cff/cf2font.h (CF2_Font): Add fields for variation data.

* src/cff/cf2ft.c (cf2_free_instance): Free blend data.
(cf2_getVStore, cf2_getNormalizedVector): New functions.
* src/cff/cf2ft.h: Updated.

* src/cff/cf2intrp.c: Include `cffload.h'.
(cf2_cmdRESERVED_15, cf2_cmdRESERVED_16): Replace with...
(cf2_cmdVSINDEX, cf2_cmdBLEND): ... this new enum values.
(cf2_doBlend): New function.
(cf2_interpT2CharString): Handle `vsindex' and `blend' opcodes.

* src/cff/cffload.c (FT_fdot14ToFixed): New macro.
(cff_vstore_done, cff_vstore_load): New functions.
(cff_blend_clear, cff_blend_doBlend, cff_blend_build_vector,
cff_blend_check_vector): New functions.
(cff_load_private_dict): Add arguments for blend vector.
Handle blend data.
(cff_subfont_load, cff_subfont_done): Updated.
(cff_font_load): Handle CFF2 variation store data.
(cff_font_done): Updated.
* src/cff/cffload.h: Include `cffparse.h'.
Updated.

* src/cff/cffobjs.c (cff_face_done): Updated.

* src/cff/cffparse.c: Include `cffload.h'.
(cff_parse_num): Handle internal value 255.
(cff_parse_vsindex, cff_parse_blend): New functions.
(CFF_FIELD_BLEND): New macro.
(cff_parser_run): Updated.
* src/cff/cffparse.h (cff_kind_blend): New enum value.

* src/cff/cfftoken.h: Handle `vstore', `vsindex', and `blend'
dictionary values.

* src/cff/cfftypes.h (CFF_VarData, CFF_AxisCoords, CFF_VarRegion,
CFF_VStore, CFF_Blend): New structures.
(CFF_FontRecDict): Add `vstore_offset' field.
(CFF_Private): Add `vsindex' field.
(CFF_SubFont): Add fields for blend data.
(CFF_Font): Add `vstore' field.

* src/truetype/ttgxvar.c (TT_Get_MM_Var): `CFF2' is equal to `gvar',
since glyph variation data is directly embedded.
(TT_Set_MM_Blend): Don't load `gvar' table for CFF2 fonts.
2016-12-15 21:56:44 +01:00
Dave Arnold 9f62d2ca06 [cff] Implement CFF2 support (1/2).
This commit does not contain the blend code for font variation
support, which follows in another commit.

You should ignore whitespace while inspecting this commit.

* include/freetype/internal/tttypes.h (TT_Face): Add `isCFF2'
member.

* src/cff/cf2font.h (CF2_Font): Add `isCFF2' member.

* src/cff/cf2ft.c (cf2_decoder_parse_charstrings): Handle `isCFF2'
flag.
(cf2_getMaxstack): New function.
* src/cff/cf2ft.h: Updated.

* src/cff/cf2intrp.c (cf2_escRESERVED_38): New enum.
(cf2_interpT2CharString): Handle CFF2 differences.
Add tracing message for errors.

* src/cff/cffdrivr.c (cff_get_glyph_name, cff_get_name_index):
Update for CFF2.

* src/cff/cffload.c (FT_FIXED_ONE): New macro.
(cff_index_init, cff_index_load_offsets, cff_index_access_element,
cff_index_get_name, cff_ft_select_get, cff_load_private_dict,
cff_subfont_load, cff_font_load): Handle CFF2.
* src/cff/cffload.h: Updated.

* src/cff/cffobjs.c (cff_face_init): Handle CFF2.

* src/cff/cffparse.c (cff_parse_maxstack): New function.
(CFFCODE_TOPDICT, CFFCODE_PRIVATE): Removed
* src/cff/cffparse.h (CFF2_MAX_STACK, CFF2_DEFAULT_STACK): New
macros.
(CFF2_CODE_TOPDICT, CFF2_CODE_FONTDICT, CFF2_CODE_PRIVATE): New
macros.

* src/cff/cfftoken.h: Add fields for CFF2 dictionaries (but no blend
stuff).

* src/cff/cfftypes.h (CFF_Index): Add `hdr_size' field.
(CFF_FontRecDict): Add `maxstack' field.
(CFF_Private): Add `subfont' field.
(CFF_Font): Add `top_dict_length' and `cff2' fields.

* src/sfnt/sfobjs.c (sfnt_load_face): Handle `CFF2' table.
2016-12-15 20:27:47 +01:00
Werner Lemberg 3bd79cc257 [truetype] Provide HVAR advance width variation as a service.
Everything is guarded with TT_CONFIG_OPTION_GX_VAR_SUPPORT.

* src/truetype/ttdriver.c (tt_service_metrics_variations): Updated.

* src/truetype/ttgxvar.c (TT_Vary_Apply_Glyph_Deltas): Prevent
double adjustment of advance width.

* src/sfnt/ttmtx.c: Include FT_SERVICE_METRICS_VARIATIONS_H.
(tt_face_get_metrics): Apply metrics variations.
2016-12-15 14:34:57 +01:00
Dave Arnold aa0c4b4f55 [truetype] Provide function to apply `HVAR' advance width variation.
* src/truetype/ttgxvar.c (tt_hadvance_adjust): New function.
* src/truetype/ttgxvar.h: Updated.
2016-12-15 14:04:51 +01:00
Dave Arnold 097cd874ee [truetype] Add `HVAR' table parsing.
Note that this is not complete yet; it only handles advance width
variation.

Activation of the code follows in another commit.

* include/freetype/ftmm.h (FT_Var_Named_Style): Add `psid' member.

* src/truetype/ttgxvar.h (GX_HVarData, GX_AxisCoords, GX_HVarRegion,
GX_HVStore, GX_WidthMap): New auxiliary structures for...
(GX_HVarTable): ... HVAR main structure.
(GX_BlendRec): Add data for HVAR loading.

* src/truetype/ttgxvar.c (FT_FIXED_ONE, FT_fdot14ToFixed,
FT_intToFixed, FT_fixedToInt): New macros.
(ft_var_load_hvar): New function.
(TT_Get_MM_Var): Updated.
(tt_done_blend): Deallocate HVAR data.
2016-12-15 12:58:26 +01:00
Dave Arnold abd5858102 [cff] Extend number parsing.
The forthcoming CFF2 support needs a dynamic parsing limit.

* src/cff/cffparse.c (cff_parse_num, do_fixed, cff_parse_fixed,
cff_parse_fixed_scaled, cff_parse_fixed_dynamic): Add argument for
parser.
(cff_parse_font_matrix, cff_parse_font_bbox, cff_parse_private_dict,
cff_parse_multiple_master, cff_parse_cid_ros, cff_parser_run): Updated.

* src/cff/cffparse.h (cff_parse_num): Export locally.
2016-12-15 12:17:22 +01:00
Dave Arnold 010e0614f2 [cff] Implement dynamic stack size for Adobe engine.
This also adds `cf2_stack_setReal' and `cf2_stack_pop', needed for
the forthcoming CFF2 support.

* src/cff/cf2stack.c (cf2_stack_init): Add argument for stack size.
(cf2_stack_free): Deallocate stack.
(cf2_stack_count, cf2_stack_pushInt, cf2_stack_pushFixed,
cf2_stack_popInt, cf2_stack_popFixed, cf2_stack_getReal,
cf2_stack_clear): Updated.
(cf2_stack_setReal, cf2_stack_pop): New functions.

* src/cff/cf2stack.h (CF2_Stack): Add `stackSize' member.
Update function declarations.

* src/cff/cf2intrp.c (cf2_interpT2CharString): Updated.

* src/cff/cffparse.c (cff_parser_init): Add parameter for stack
size; return error code.
(cff_parser_done): New function.
(cff_parser_run): Updated.

* src/cff/cffparse.h (CFF_Parser): Add `stackSize' member and make
`stack' a pointer.
Update function declarations.

* src/cff/cffload.c (cff_load_private_dict, cff_subfont_load):
Updated.
2016-12-15 11:22:15 +01:00
Dave Arnold 41533b958c [cff] Code shuffling.
* src/cff/cfftypes.h (CFF_Font): Add `library' and `base_offset'
fields.

* src/cff/cffload.c (cff_subfont_load): Change last argument to
`CFF_Font'
Split off parsing of private dictionary into...
(cff_load_private_dict): ...this new function.
(cff_font_load): Updated.
2016-12-15 00:00:45 +01:00
Werner Lemberg 0918325e3f [sfnt, truetype] Add framework for Metrics Variations service.
No effect yet; service functions will be implemented later on.

Everything is guarded with TT_CONFIG_OPTION_GX_VAR_SUPPORT.

* include/freetype/internal/services/svmetric.h: New file.

* include/freetype/internal/ftserv.h
(FT_SERVICE_METRICS_VARIATIONS_H): New macro.

* include/freetype/internal/tttypes.h (TT_Face): New field `var'.

* src/sfnt/sfobjs.c: Include FT_SERVICE_METRICS_VARIATIONS_H.
(sfnt_init_face): Initialize `face->var'.

* src/truetype/ttdriver.c: Include FT_SERVICE_METRICS_VARIATIONS_H.
(tt_service_metrics_variations): New service.
(tt_services): Updated.

* src/truetype/ttpic.h: Updated.
2016-12-14 20:44:11 +01:00
Werner Lemberg c628a7dfba [cff] Add Multiple Masters service.
The code simply uses the MM functions from the `truetype' module.

Everything is guarded with TT_CONFIG_OPTION_GX_VAR_SUPPORT.

* include/freetype/internal/tttypes.h (TT_Face): New field `mm'.

* src/cff/cffdrivr.c: Include FT_SERVICE_MULTIPLE_MASTERS_H.
(cff_set_mm_blend, cff_get_mm_blend, cff_get_mm_var,
cff_set_var_design, cff_get_var_design): New functions.
(cff_service_multi_masters): New service.
(cff_services): Updated.

* src/cff/cffload.c (cff_get_var_blend, cff_done_blend): New
functions.
* src/cff/cffload.h: Updated.

* src/cff/cffpic.h (CFF_SERVICE_MULTI_MASTERS_GET): New macro.

* src/sfnt/sfobjs.c: Include FT_SERVICE_MULTIPLE_MASTERS_H.
(sfnt_init_face): Initialize `face->mm'.
2016-12-14 19:31:42 +01:00
Werner Lemberg a7dc0c3554 Extend functionality of `ft_module_get_service'.
It can now differentiate between local and global searches.

* src/base/ftobjs.c (ft_module_get_service): Add `global' argument.
(FT_Get_TrueType_Engine_Type): Updated.

* src/cff/cffdrivr.c (cff_get_ps_name, cff_get_cmap_info): Updated.

* include/freetype/internal/ftobjs.h: Updated.
* include/freetype/internal/ftserv.h (FT_FACE_FIND_GLOBAL_SERVICE):
Updated.
2016-12-14 18:54:21 +01:00
Werner Lemberg ab22b43bac * src/truetype/ttgxvar.c (tt_get_var_blend): Fix compiler warning. 2016-12-14 18:34:55 +01:00
Werner Lemberg 4e07516e90 [sfnt, cff] Minor preparations.
* include/freetype/tttags.h (TTAG_CFF2, TTAG_HVAR, TTAG_MVAR,
TTAG_VVAR): New SFNT table tags.

* src/cff/cf2fixed.h (CF2_FIXED_ONE, CF2_FIXED_EPSILON): Add cast.
2016-12-14 18:25:44 +01:00
Werner Lemberg 8b174b4b96 [truetype, type1] Add `get_var_blend' to MM service.
For internal use; we want to share code between the forthcoming CFF2
support and TrueType.

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

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

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

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

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

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

* src/truetype/ttdriver.c (tt_service_gx_multi_masters): Updated.
* src/type1/t1driver.c (t1_service_multi_masters): Updated.
2016-12-10 09:56:03 +01:00
Werner Lemberg 3205a44d01 [sfnt] Revert change from 2016-12-08.
I missed the functionality of `ft_module_get_service', which makes
the change unnecessary.
2016-12-09 06:55:34 +01:00
Werner Lemberg 4191b7761b Add framework to support services with 8 functions.
We will need this for CFF variation font support.

* include/freetype/internal/ftserv.h (FT_DEFINE_SERVICEDESCREC8):
New macro.
2016-12-08 22:33:46 +01:00
Werner Lemberg 29aa957767 [sfnt] Add `get_glyph_name' and `get_name_index' to SFNT interface.
CFF2 fonts will need access to those two functions.

* include/freetype/internal/sfnt.h: Include FT_SERVICE_GLYPH_DICT_H.
(SFNT_Interface): Add `get_glyph_name' and `get_name_index' members.
(FT_DEFINE_SFNT_INTERFACE): Updated.

* src/sfnt/sfdriver.c (sfnt_get_glyph_name, sfnt_get_name_index):
Fix signatures to exactly correspond to the glyph dict service
function typedefs.
(sfnt_interface): Updated.
2016-12-08 08:59:34 +01:00
Werner Lemberg ffd8f62236 [cff] Code shuffling.
This is a preparation for better integrating Dave Arnold's changes.
2016-12-07 09:25:26 +01:00
Dave Arnold bcae657482 Add `FT_Get_Var_Design_Coordinates' function.
Note that the low-level functions aren't implemented yet.

* include/freetype/ftmm.h: Declare.

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

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

* src/truetype/ttdriver.c: Updated.

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

* src/type1/t1driver.c: Updated.

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

Reported as

  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=231
2016-12-06 11:13:19 +01:00
Werner Lemberg 602be7c810 [gzip] Improve building with external zlib (#49673).
Building FreeType with external zlib 1.2.8 makes msvc 14 stop with
the following error.

  ftgzip.c
  zlib-1.2.8\zlib.h(86): error C2061:
                         syntax error: identifier 'z_const'
  zlib-1.2.8\zlib.h(94): error C2054:
                         expected '(' to follow 'z_const'
  zlib-1.2.8\zlib.h(94): error C2085:
                         'msg': not in formal parameter list
  ...
  zlib-1.2.8\zlib.h(877): fatal error C1003:
                          error count exceeds 100; stopping compilation

The error happens because FreeType keeps an own copy of zlib-1.1.4
under `src/gzip'.  When building `src/gzip/ftgzip.c' with
FT_CONFIG_OPTION_SYSTEM_ZLIB defined, it uses

  #include <zlib.h>

which correctly finds an external `zlib.h', but `zlib.h' itself has
a line

  #include "zconf.h"

which makes Visual Studio 2015 find `src/gzip/zconf.h' while
compiling the files in `src/gzip'.

* src/gzip/zconf.h: Rename to...
* src/gzip/ftzconf.h: ... this.
* src/gzip/zlib.h, src/gzip/rules.mk (GZIP_DRV_SRCS): Updated.
2016-12-01 11:36:37 +01:00
Oleksandr Chekhovskyi 255828c891 [autofit] Fix Emscripten crash (patch #9180).
Function calls through pointers must use a matching signature to
work on Emscripten, since such calls are dispatched through lookup
tables grouped by signature.

* src/autofit/aftypes.h (AF_WritingSystem_ApplyHintsFunc): Fix
typedef.
2016-12-01 07:07:22 +01:00
Werner Lemberg 1d28f697d2 [smooth] Revert previous commit. Already fixed with 6ca54c64. 2016-11-29 18:45:22 +01:00
Werner Lemberg d949a3db58 [smooth] Avoid conditional jump on uninitialized value (#49711).
* src/smooth/ftgrays.c (gray_raster_render): Initialize `worker'.
2016-11-29 12:09:56 +01:00
Nikolaus Waxweiler b37b799c56 [autofit] Code shuffling.
Also improve some comments and remove unused code.

No functional change.

* src/autofit/afloader.c (af_loader_load_g): Merged with...
(af_loader_load_glyph): ...this function.
Split off emboldening code into...
(af_loader_embolden_glyph_in_slot): ... this function.
2016-11-27 16:30:53 +01:00
Werner Lemberg 7815050334 Better support of LLP64 systems with gcc (and clang).
* builds/unix/configure.raw: Call `AC_TYPE_LONG_LONG_INT'.

* builds/unix/ftconfig.in (FT_LONG64): Enable for LLP64 systems (and
suppress warnings) even without `FT_CONFIG_OPTION_FORCE_INT64'.
2016-11-17 12:00:20 +01:00
Werner Lemberg 9e7748f55c Improve documentation of `lsb_delta' and `rsb_delta' (#19044). 2016-11-17 08:04:52 +01:00
Werner Lemberg 48c77da382 Add minor comment to avoid confusion (#19044). 2016-11-17 07:37:50 +01:00
Werner Lemberg dd26e3d07c Fix `lcd_weights' array size.
* include/freetype/internal/ftobjs.h (FT_LibraryRec): Do it.

Reported by Nikolaus.
2016-11-10 12:03:32 +01:00
Werner Lemberg e1ee5476a4 * src/base/ftobjs.c (FT_Render_Glyph_Internal): Fix tracing. 2016-11-06 12:39:05 +01:00
Werner Lemberg 1c6fd99437 [sfnt] Improve FT_LOAD_BITMAP_METRICS_ONLY for `sbix' format.
It's unavoidable to call the PNG engine, but to get the metrics it
is sufficient to read the PNG image's header only.

* src/sfnt/pngshim.c (Load_SBit_Png): Add argument to control the
allocation of the glyph slot.
* src/sfnt/pngshim.h: Updated.
* src/sfnt/ttsbit.c (tt_sbit_decoder_load_png,
tt_face_load_sbix_image, tt_face_load_sbit_image): Updated.
2016-11-06 12:37:55 +01:00
Werner Lemberg 565db95b5c [sfnt] Speed up `sbix' lookup.
This also fixes a bug introduced in 2016-10-01 which prevents
display of embedded bitmap fonts that use the `sbix' format.

* src/sfnt/ttsbit.c (tt_face_load_sbit): Store `sbix' size and
offset also in `ebdt_size' and `ebdt_start', respectively.  This
makes the test for an embedded bitmap data table succeed for this
format.

(tt_face_load_strike_metrics) <TT_SBIT_TABLE_TYPE_SBIX>: Use
`ebdt_size' and `ebdt_start'
(tt_face_load_sbix_image): Ditto.
2016-11-06 12:33:51 +01:00
Werner Lemberg d8a83232af Minor documentation improvement. 2016-11-06 12:33:18 +01:00
Werner Lemberg 37e193e935 Introduce a way of quickly retrieving (embedded) bitmap metrics.
`FT_Load_Glyph' doesn't generate a bitmap for a non-bitmap glyph
until the user calls `FT_Render_Glyph'.  However, it always
allocates memory for bitmaps and copies or decodes the contents of a
bitmap glyph, which can be quite slow for PNG data.

* include/freetype/freetype.h (FT_LOAD_BITMAP_METRICS_ONLY): New
macro.

* src/base/ftobjs.c (FT_Load_Glyph): Unset FT_LOAD_RENDER if
FT_LOAD_BITMAP_METRICS_ONLY is used.

* src/sfnt/ttsbit.c (tt_sbit_decoder_alloc_bitmap,
tt_sbit_decoder_load_bitmap): Add argument to control allocation of
the glyph slot.
(tt_sbit_decoder_load_image, tt_sbit_decoder_load_compound,
tt_face_load_sbit_image): Updated.

* src/pcf/pcfdrivr.c (PCF_Glyph_Load): Quickly exit if
`FT_LOAD_BITMAP_METRICS_ONLY' is set.

* src/pfr/pfrsbit.c, src/pfr/pfrsbit.h (pfr_slot_load_bitmap): Add
argument to control allocation of the glyph slot.
* src/pfr/pfrobjs (pfr_slot_load): Updated.

* src/winfonts/winfnt.c (FNT_Load_Glyph): Ditto.

* docs/CHANGES: Updated.
2016-11-06 12:32:51 +01:00
Werner Lemberg 57f73d1f77 Synchronize with gnulib (#49448).
* include/freetype/config/ftconfig.h, builds/unix/ftconfig.in,
builds/vms/ftconfig.h (FT_TYPEOF): Update code to use definition in
current version of `intprops.h'.
Other minor synchronization to reduce code differences between the
three files.
2016-11-06 06:06:30 +01:00
Behdad Esfahbod b72858c992 [truetype] Clamp variation requests to valid range.
This is required by OpenType 1.8; it also avoids rounding surprises.

* src/truetype/ttgxvar.c (TT_Set_Var_Design): Clamp design coordinates
outside of the allowed range to always stay within the range instead
of producing an error.
2016-11-03 06:41:00 +01:00
Werner Lemberg 328d68449d [truetype] Remove clang warnings.
* src/truetype/ttinterp.h (TT_ExecContextRec): Using `FT_ULong' for
loop counter handling.

* src/truetype/ttinterp.c: Updated.
(Ins_SCANTYPE): Use signed constant.
(TT_RunIns): Ensure `num_twilight_points' is 16bit.
2016-10-29 00:18:56 +02:00
Werner Lemberg ddf3872699 [truetype] Fix commit from 2014-11-24.
Problem reported by Hin-Tak Leung  <htl10@users.sourceforge.net>.

* src/truetype/ttpload.c (tt_face_load_hdmx): Fix file checking
logic.
2016-10-27 07:27:27 +02:00
Werner Lemberg 9c45ac3966 Add `FT_Get_{MM,Var}_Blend_Coordinates' functions.
* include/freetype/ftmm.h: Declare.

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

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

* src/truetype/ttdriver.c: Updated.

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

* src/type1/t1driver.c: Updated.

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

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

  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=81
2016-10-26 08:10:59 +02:00
Alexei Podtelezhnikov c5f1bc4b36 [cff] Correct cmap format reporting (#24819).
* src/cff/cffdrivr.c (cff_get_cmap_info): Throw an error on synthetic
charmap instead of guessing its format and language.
2016-10-25 22:31:42 -04:00
Werner Lemberg 5081674c5f [truetype] Fix SCANTYPE instruction (#49394).
* src/truetype/ttinterp.c (Ins_SCANTYPE): Only use lower 16bits.
2016-10-22 19:16:08 +02:00
Werner Lemberg 577414030a [sfnt] Improve handling of invalid post 2.5 tables [#49393].
* src/sfnt/ttpost.c (load_format_25): We need at least a single
table entry.
2016-10-22 18:34:48 +02:00
Werner Lemberg 7eeaf986b5 [truetype] Fix handling of `cvar' table data.
Reported as

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

* src/truetype/ttgxvar.c (tt_face_vary_cvt): Ignore invalid CVT
indices.
2016-10-14 08:58:17 +02:00
Alexei Podtelezhnikov 8370295755 URL updates. 2016-10-13 22:52:40 -04:00
Werner Lemberg 9c54d1246a [psaux] Fix handling of invalid flex subrs.
Problem reported as

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

* src/psaux/t1decode.c (t1_decoder_parse_charstrings)
<op_callothersubr>: Set `flex_state' after error checking.
2016-10-11 08:57:55 +02:00
Werner Lemberg 922812281c * src/truetype/ttgxvar.c (tt_done_blend): Fix deallocation. 2016-10-11 07:12:12 +02:00
Werner Lemberg 6b35493115 * src/cid/cidload.c (cid_face_open): Properly propagate `error'. 2016-10-08 20:26:59 +02:00
Werner Lemberg d61b042568 [cid] Fix parsing of subr offsets.
Bug introduced 2016-05-16.

* src/cid/cidparse.c (cid_parser_new): Fix off-by-one error.
2016-10-08 19:20:33 +02:00
Werner Lemberg fcc0ee80e1 [sfnt] Disable bitmap strikes if we don't have a bitmap data table.
* src/sfnt/ttsbit.c (tt_face_load_sbit): Check whether we have
a bitmap data table.
2016-10-01 20:12:25 +02:00
Alexei Podtelezhnikov b0aacff474 [smooth] Remove impossibility.
* src/smooth/ftgrays.c (TWorker): Rearrange fields.
(gray_convert_glyph): Remove impossible condition and clean up.
2016-10-01 12:55:33 -04:00
Werner Lemberg 3576487add [pcf] Enrich family name with foundry name and glyph width info.
This is a very old patch from openSuSE (from 2006, submitted to
FreeType in 2011) that I forgot to apply.

  https://build.opensuse.org/package/view_file/openSUSE:Factory/freetype2/freetype2-bitmap-foundry.patch

Prepend the foundry name plus a space to the family name.  There are
many fonts just called `Fixed' which look completely different, and
which have nothing to do with each other.  When selecting `Fixed' in
KDE or Gnome one gets results that appear rather random, the style
changes often if one changes the size and one cannot select some
fonts at all.

We also check whether we have `wide' characters; all put together,
we get family names like `Sony Fixed' or `Misc Fixed Wide'.

* src/pcf/pcfread.c (pcf_load_font): Implement it.

* docs/CHANGES: Document it.
2016-09-30 08:11:52 +02:00
Werner Lemberg 71b617d8b7 [ftfuzzer] Speed up.
* src/tools/ftfuzzer/ftfuzzer.cc (LLVMFuzzerTestOneInput): Don't
check for embedded bitmaps if we have a non-default instance.
2016-09-29 19:53:39 +02:00
Werner Lemberg bfa83bdc27 Comments. 2016-09-29 19:51:28 +02:00
Werner Lemberg 2067c6985a [truetype] Disallow bitmap strokes for non-default instances.
Also speed up access of default instances if GX variations are
active.

* include/freetype/internal/tttypes.h (TT_FaceRec): Add
`is_default_instance' member.

* src/sfnt/sfobjs.c (sfnt_init_face): Initialize
`is_default_instance'.

* src/truetype/ttgload.c (TT_Process_Simple_Glyph,
load_truetype_glyph): Add test for default instance.
(TT_Load_Glyph): Load embedded bitmaps for default instance only.

* src/truetype/ttgxvar.c (TT_Set_MM_Blend): Compute
`is_default_instance'.
2016-09-29 19:49:07 +02:00
Werner Lemberg bf90239ca5 [truetype] Clean up `TT_Face' structure.
* include/freetype/internal/tttypes.h (TT_FaceRec): Remove unused
fields `horz_metrics' and `vert_metrics'.
Update documentation.

* src/sfnt/sfobjs.c (sfnt_done_face): Updated.
2016-09-29 13:04:46 +02:00
Werner Lemberg 45cad2e5e1 More FT_ZERO usage.
* src/gxvalid/gxvcommn.c (gxv_ClassTable_validate):
s/ft_memset/FT_MEM_ZERO/.

* src/psaux/t1decode.c (t1_decoder_parse_charstrings):
s/ft_memset/FT_ARRAY_ZERO/.

* src/raster/ftraster.c (FT_ZERO): Define.
(ft_black_new): Use it.
* src/raster/ftrend1.c (ft_raster1_get_cbox):
s/FT_MEM_ZERO/FT_ZERO/.

* src/smooth/ftgrays.c (FT_ZERO): Define.
(gray_raster_new): Use it.
* src/smooth/ftsmooth.c (ft_smooth_get_cbox):
s/FT_MEM_ZERO/FT_ZERO/.
2016-09-28 19:10:52 +02:00
Werner Lemberg 2ecf89b481 */*: s/FT_MEM_ZERO/FT_ZERO/ where appropriate. 2016-09-28 19:06:21 +02:00
Werner Lemberg a3e2c83234 [truetype] Trace number of executed opcodes.
* src/truetype/ttinterp.c (TT_RunIns): Implement it.
2016-09-27 21:42:02 +02:00
Werner Lemberg e27b8a5598 [truetype] Speed up `TT_Load_Glyph'.
This avoids additional calls to `tt_face_lookup_table' for the
`glyf' table, which can be expensive.

* include/freetype/internal/tttypes.h (TT_LoaderRec): Move
`glyf_offset' field to ...
(TT_FaceRec): ... this structure.
* src/truetype/ttgload.c (load_truetype_glyph): Updated.
(tt_loader_init): Move initialization of `glyf_offset' to ...
* src/truetype/ttpload.c (tt_face_load_loca): .. this function.
2016-09-27 21:21:01 +02:00
Werner Lemberg 0d94592942 [truetype] Introduce dynamic limits for some bytecode opcodes.
This speeds up FreeType's handling of malformed fonts.

* src/truetype/ttinterp.c (TT_RunIns): Set up limits for the number
of twilight points, the total number of negative jumps, and the
total number of loops in LOOPCALL opcodes.  The values are based on
the number of points and entries in the CVT table.
(Ins_JMPR): Test negative jump counter.
(Ins_LOOPCALL): Test loopcall counter.

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

* docs/CHANGES: Updated.
2016-09-27 08:44:31 +02:00
Werner Lemberg a764963f26 [truetype] Sanitize only last entry of `loca' table.
Without this patch, a loca sequence like `0 100000 0 100000 ...',
where value 100000 is larger than the `glyf' table size, makes
FreeType handle the whole `glyf' table as a single glyph again and
again, which is certainly invalid (and can be very slow, too).

* src/truetype/ttpload.c (tt_face_get_location): Implement.
Improve tracing messages.
2016-09-25 16:29:05 +02:00
Werner Lemberg d11e8b6e6d * src/tools/ftfuzzer/ftfuzzer.cc (LLVMFuzzerTestOneInput): Fix typo. 2016-09-25 15:32:04 +02:00
Werner Lemberg 2f2e73c50c [autofit] Tracing fixes.
* src/autofit/afmodule.c (af_autofitter_load_glyph): Call dumping
functions only if we actually do tracing.
2016-09-24 22:42:58 +02:00
Alexei Podtelezhnikov 53ae7a542d [smooth] Reduce divisions in the line renderer.
We don't need some divisions if a line segments stays within a single
row or a single column of pixels.

* src/smooth/ftgrays.c (gray_render_line) [FT_LONG64]: Make divisions
conditional.
2016-09-22 22:48:15 -04:00
Werner Lemberg c95b7652d8 s/0/NULL/ for function pointers; comments, formatting. 2016-09-17 17:12:50 +02:00
Alexei Podtelezhnikov d5f7533e8e * src/smooth/ftgrays.c (gray_sweep): Remove check for empty table. 2016-09-15 00:13:36 -04:00
Alexei Podtelezhnikov ad47550b80 [smooth] Another tiny speed-up.
* src/smooth/ftgrays.c (gray_find_cell): Merge into...
(gray_record_cell): ... this function.
2016-09-14 23:15:03 -04:00
Alexei Podtelezhnikov c38be52bf8 * src/smooth/ftgrays.c (gray_{find,set}_cell): Remove dubious code. 2016-09-11 22:44:44 -04:00
Alexei Podtelezhnikov 6ca54c6430 [smooth] Fix valgrind warning and reoptimize.
The algorithm calls `gray_set_cell' at the start of each new contour
or when the contours cross the cell boundaries. Double-checking for
that is wasteful.

* src/smooth/ftgrays.c (gray_set_cell): Remove check for a new cell.
(gray_convert_glyph): Remove initialization introduced by 44b172e88.
2016-09-11 16:00:52 -04:00
Werner Lemberg e421a0bffc [sfnt] Fix previous commit.
Problems reported as

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

We now map the strike index right before accessing the physical
data, not earlier.

* src/sfnt/sfobjs.c (sfnt_load_face): Set `face->sbit_strike_map'
after creating the map so that...

* src/sfnt/ttsbit.c (tt_face_load_strike_metrics): ... this function
can be used before and after setting up `sbit_strike_map'.
(tt_face_set_sbit_strike): Revert change.
(tt_sbit_decoder_init, tt_face_load_sbix_image): Map strike index.

* src/truetype/ttdriver.c (tt_size_select): Revert change.
2016-09-10 08:02:30 +02:00
Werner Lemberg deb261556a [ftfuzzer] Minor improvements.
* src/tools/ftfuzzer/ftfuzzer.cc (LLVMFuzzerTestOneInput): Ignore
invalid strikes.
Use better values for call to `FT_Set_Char_Size'.
2016-09-09 22:13:33 +02:00
Werner Lemberg d609b7c158 [sfnt] Don't provide (completely) broken strike data.
FreeType tries to sanitize strike header data; we now reject
completely broken ones.

* include/freetype/internal/tttypes.h (TT_FaceRec): New
`sbit_strike_map' array pointer.

* src/base/ftobjs.c (FT_Match_Size): Reject matches where either
width or height would be zero.
Add tracing message in case of error.

* src/sfnt/sfobjs.c (sfnt_load_face): Populate `sbit_strike_map',
only using (more or less) valid strike header data for
FT_Face's `available_sizes' array.
(sfnt_done_face): Updated.

* src/sfnt/ttsbit.c (tt_face_set_sbit_strike): Use
`sbit_strike_map'.
(tt_face_load_strike_metrics): Improve tracing.

* src/truetype/ttdriver.c (tt_size_select): Use `sbit_strike_map'.
2016-09-09 22:11:07 +02:00
Werner Lemberg d2d5968aed * Version 2.7 released.
=======================

Tag sources with `VER-2-7'.

* docs/VERSION.TXT: Add entry for version 2.7.

* README, Jamfile (RefDoc), builds/windows/vc2005/freetype.vcproj,
builds/windows/vc2005/index.html,
builds/windows/vc2008/freetype.vcproj,
builds/windows/vc2008/index.html,
builds/windows/vc2010/freetype.vcxproj,
builds/windows/vc2010/index.html,
builds/windows/visualc/freetype.dsp,
builds/windows/visualc/freetype.vcproj,
builds/windows/visualc/index.html,
builds/windows/visualce/freetype.dsp,
builds/windows/visualce/freetype.vcproj,
builds/windows/visualce/index.html,
builds/wince/vc2005-ce/freetype.vcproj,
builds/wince/vc2005-ce/index.html,
builds/wince/vc2008-ce/freetype.vcproj,
builds/wince/vc2008-ce/index.html: s/2.6.5/2.7/, s/265/27/.

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

* builds/unix/configure.raw (version_info): Set to 18:6:12.
* CMakeLists.txt (VERSION_MINOR): Set to 7.
(VERSION_PATCH): Set to 0.

* docs/CHANGES: Updated.
2016-09-08 09:04:32 +02:00
Werner Lemberg b1e7b68efe * src/truetype/ttinterp.c: Include `ttgxvar.h'.
This fixes the `multi' build.
2016-09-08 08:56:34 +02:00
Werner Lemberg 8160b20195 Split off ChangeLog.26. 2016-09-08 08:42:10 +02:00
Werner Lemberg 9749f269e2 [autofit] Another improvement to Armenian support.
Suggested by Hrant H Papazian <hpapazian@gmail.com>.

* src/autofit/afscript.h: Use better suited characters to derive
default stem widths.
2016-09-08 07:51:03 +02:00
Alexei Podtelezhnikov a0b92bcb47 * src/smooth/ftgrays.c (gray_hline): Microptimize. 2016-09-07 23:19:57 -04:00
Alexei Podtelezhnikov 9d0a3bd848 [smooth] Operate in absolute bitmap coordinates.
Simpler bitmap addressing improves performance by 1.5%.

* src/smooth/ftgrays.c (gray_TWorker): Remove count fields.
(gray_dump_cells, gray_find_cell, gray_set_cell, gray_hline,
gray_sweep, gray_convert_glyph, gray_raster_render): Updated.
2016-09-06 23:59:33 -04:00
Alexei Podtelezhnikov 44b172e883 [smooth] Improve contour start (take 2).
* src/smooth/ftgrays.c (gray_move_to): Call `gray_set_cell' directly
instead of...
(gray_start_cell): ... this function, which is removed.
(gray_convert_glyph): Make initial y-coordinate invalid.
2016-09-06 23:24:17 -04:00
Werner Lemberg ebbb8b2e19 [type1] MM fonts support exactly zero named instances (#48748).
* src/type1/t1load.c (T1_Get_MM_Var): Set `num_namedstyles' to zero.
2016-09-06 16:28:57 +02:00
Werner Lemberg 1656752ee5 Minor documentation improvements. 2016-09-06 12:29:18 +02:00
Jonathan Kew a15133e6ef [cff] Fix uninitialized memory.
Problem reported as

  https://bugzilla.mozilla.org/show_bug.cgi?id=1270288

* src/cff/cf2interp.c (cf2_interpT2CharString): Initialize `storage'
array to handle a `get' opcode without a previous `put'.
2016-09-06 06:33:36 +02:00
Alexei Podtelezhnikov 9773d5f721 * src/smooth/ftgrays.c (gray_move_to, gray_start_cell): Revert. 2016-09-05 23:33:35 -04:00
Alexei Podtelezhnikov 7effc279b0 [smooth] Improve contour start.
* src/smooth/ftgrays.c (gray_move_to): Call `gray_set_cell' directly
instead of...
(gray_start_cell): ... this function, which is removed.
2016-09-05 21:58:56 -04:00
Werner Lemberg 3ebfe3c545 [cff] Fix memory initialization.
* src/cff/cf2stack.c (cf2_stack_init): Use `FT_NEW'.  The `Q'
variants of FreeType's memory allocation macros don't do zeroing.
2016-09-05 10:55:07 +02:00
Werner Lemberg 1c8bb63299 [ftrandom] Minor improvements.
* src/tools/ftrandom/ftrandom.c (_XOPEN_SOURCE): New macro, set to
500.

* src/tools/ftrandom/Makefile (CFLAGS): Split off include
directories to ...
(INCLUDES): ... this new variable.
(LDFLAGS): New variable.
(ftrandom.o, ftrandom): Updated.
2016-09-05 08:13:42 +02:00
Werner Lemberg c9adf1a14d [autofit] Improve Armenian support.
Thanks to Hrant H Papazian <hpapazian@gmail.com> for help.

* src/autofit/afblue.dat (AF_BLUE_STRING_ARMENIAN_*): Improve
selection of characters.

* src/autofit/afblue.c, src/autofit/afblue.h: Regenerated.
2016-09-05 07:32:37 +02:00
Werner Lemberg 4b28f6ac42 [ftrandom] Improve Makefile.
It now supports both a normal build (`./configure && make') and a
development build (`make devel').

* src/tools/ftrandom/Makefile (VPATH): Set it so that
`libfreetype.a' gets searched in both `objs' (for the development
build) and `objs/.libs' (for a normal build which uses libtool).
(LIBS): Add missing libraries.
(ftrandom.o): New rule.
(ftrandom): Use automatic variables.
2016-09-04 19:05:45 +02:00
Werner Lemberg 4e659d7ead [truetype] More fixes for handling of GX deltas.
Problems reported by Bob Taylor <Bob.Taylor@monotype.com>.

* src/truetype/ttgxvar.c (TT_Vary_Apply_Glyph_Deltas): Fix rough
sanity test for glyph variation array header size.
Always set stream position before reading packed x and y deltas.
Fix thinko w.r.t. `localpoints' array.
2016-09-03 18:14:00 +02:00
Werner Lemberg ca8e98d94a [ftrandom] Various fixes.
* src/tools/ftrandom/ftrandom.c (GOOD_FONTS_DIR): Provide better
default.
(error_fraction): Make it of type `double' to work as advertized –
this was completely broken.
Update all related code.
(error_count, fcnt): Make it unsigned to fix compiler warnings.
Update all related code.
(fontlist): Change `len' member to `long' to fix compiler warnings.
(FT_MoveTo, FT_LineTo, FT_ConicTo, FT_CubicTo, abort_test): Tag
unused variables.
(TestFace, FindFonts, copyfont, do_test): Fix compiler warnings.
(ExecuteTest): Ditto.
Call `FT_Done_FreeType'.
(getErrorCnt): Replace `ceil' with an ordinary cast to `unsigned
int'.
(usage): Improve output.
(main): Fix compiler warnings.

* src/tools/ftrandom/README: Updated.
2016-09-03 13:06:16 +02:00
Werner Lemberg b98dfda392 [base] Avoid negative bitmap stroke dimensions (#48985).
* src/base/ftobjs.c (FT_Open_Face): Check whether negation was
actually successful.  For example, this can fail for value
-32768 if the type is `signed short'.  If there are problems,
disable the stroke.
2016-09-03 08:20:31 +02:00
Werner Lemberg f0fa7a67bf [cff] Avoid null pointer passed to FT_MEM_COPY (#48984).
* src/cff/cffload.c (cff_index_get_name): Check `byte_len'.
2016-09-03 06:33:36 +02:00
Werner Lemberg d87bb9160a [unix] Enable 64bit support in file system access (#48962).
* builds/unix/configure.raw: Call `AC_SYS_LARGEFILE'.
2016-09-02 23:56:27 +02:00
Werner Lemberg d8ef726611 [sfnt] Avoid left shift of negative value (#48980).
* src/sfnt/ttsbit.c (tt_sbit_decoder_load_bit_aligned): Use unsigned
constant.
2016-09-02 23:27:50 +02:00
Werner Lemberg 16583ccde9 * src/smooth/ftgrays.c (gray_hline): Fix clang compiler warnings. 2016-09-02 22:45:14 +02:00
Werner Lemberg 77e4d1b22e Improve documentation of `FT_Outline_Decompose'. 2016-09-02 12:16:29 +02:00
Werner Lemberg 7a13dc008b Some preparations for the next release.
* include/freetype/config/ftoption.h
(TT_CONFIG_OPTION_SUBPIXEL_HINTING): Enable.

* docs/CHANGES: Updated.
2016-09-02 08:24:01 +02:00
Werner Lemberg 7ba2ae7a59 Synchronize `ftoption.h' comments. 2016-09-02 08:21:18 +02:00
Alexei Podtelezhnikov 11d3336af3 [smooth] Simplify span rendering more.
It turns out that there is significant cost associated with `FT_Span'
creation and calls to `gray_render_span' because it happerns so
frequently. This removes these steps from our internal use but leaves
it alone for `FT_RASTER_FLAG_DIRECT" to preserve API. The speed gain
is about 5%.

* src/smooth/ftgrays.c (gray_render_span): Removed. The code is
migrated to...
(gray_hline): ... here.
2016-09-01 22:56:24 -04:00
Alexei Podtelezhnikov f44ddfda45 [smooth] Streamline pixmap drawing a bit more.
Zero coverage is unlikely (1 out of 256) to warrant checking. This
gives 0.5% speed improvement in dendering simple glyphs.

* src/smooth/ftgrays.c (gray_hline, gray_render_span): Remove checks.
2016-08-30 23:21:23 -04:00
Alexei Podtelezhnikov e73055c791 [smooth] Streamline pixmap drawing.
This gives 2% speed improvement in rendering simple glyphs.

* src/smooth/ftgrays.c (TPixmap): Reduced pixmap descriptor with a
pointer to its bottom-left and pitch to be used in...
(gray_TWorker): ... here.
(gray_render_span): Move pixmap flow check from here...
(gray_raster_render): .. to here.
2016-08-29 23:15:35 -04:00
Werner Lemberg a6ee6fe67b s/PIC/FT_CONFIG_OPTION_PIC/ to avoid confusion. 2016-08-28 18:51:50 +02:00
Werner Lemberg bffe5fd6e4 [cff] Minor comment. 2016-08-28 13:16:37 +02:00
Werner Lemberg 516283130c Clarify usage of FT_CONFIG_OPTION_PIC. 2016-08-28 12:38:25 +02:00
Werner Lemberg 3ec64654c4 Explain how to build a PIC-enabled version of FreeType. 2016-08-28 11:02:00 +02:00
Alexei Podtelezhnikov 4d3f7ca8ce [smooth] Reduce stack of band boundaries.
* src/smooth/ftgrays.c (gray_TBand): Removed.
(gray_convert_glyph): Updated to stack band boundaries concisely.
2016-08-27 23:25:54 -04:00
Werner Lemberg 57aa83911a * src/cid/cidload.c (cid_face_open): Improve handling of `SDBytes'. 2016-08-26 11:59:50 +02:00
Werner Lemberg 3c61a2f51d [cid] Fix commit from 2016-05-16.
* src/cid/cidparse.c (cid_parser_new): Fix off-by-one errors.
2016-08-26 11:50:09 +02:00
Werner Lemberg f3e71bab9e [sfnt] Cache offset and size to bitmap data table.
This commit avoids `EBDT' and friends being looked up again and
again while loading a single embedded bitmap.

* include/freetype/internal/tttypes.h (TT_FaceRec)
[TT_CONFIG_OPTION_EMBEDDED_BITMAPS]: New fields `ebdt_start' and
`ebdt_size'.

* src/sfnt/ttsbit.c (tt_sbit_decoder_init): Move table lookup to ...
(tt_face_load_sbit): ... this function; also store the table size
and offset.
2016-08-26 10:31:30 +02:00
Werner Lemberg 1034ff4ac0 [sfnt] Comments. 2016-08-26 08:42:27 +02:00
Alexei Podtelezhnikov 9a444f0547 * src/smooth/ftgrays.c (gray_raster_render): Minor tweaks. 2016-08-25 22:36:01 -04:00
Werner Lemberg a660e3de42 [type1] Fix heap buffer overflow.
Reported as

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

* src/type1/t1load.c (parse_charstrings): Reject fonts that don't
contain glyph names.
2016-08-26 00:23:27 +02:00
Werner Lemberg 69ce97391c [sfnt] Fix previous commit (#48901).
* src/sfnt/ttcmap.c (tt_cmap4_char_map_binary): Thinkos.
2016-08-25 19:49:52 +02:00
Werner Lemberg acd1879897 [sfnt] Speed up handling of invalid format 4 cmaps.
* src/sfnt/ttcmap.c (tt_cmap4_next, tt_cmap4_char_map_binary): Add
tests for `num_glyph' from `tt_cmap4_char_map_linear'.
2016-08-25 17:12:46 +02:00
Werner Lemberg 327f2e3e55 * include/freetype/internal/ftdriver.h: Remove unused typedefs. 2016-08-25 12:46:08 +02:00
Alexei Podtelezhnikov cb4388783c [smooth] Simplify span rendering.
This removes unnecessary complexity of span merging and buffering.
Instead, the spans are rendered as they come, speeding up the
rendering by about 5% percents as a result.

* src/smooth/ftgrays.c [FT_MAX_GRAY_SPANS]: Macro removed.
(gray_TWorker): Remove span buffer and related fields.
(gray_sweep, gray_hline): Updated.

* include/freetype/ftimage.h: Remove documentation note about
`FT_MAX_GRAY_SPANS', which was never in `ftoption.h' and is now gone.
2016-08-22 23:06:45 -04:00
Werner Lemberg a4c2a31138 [truetype] Fix `MPS' instruction.
According to Greg Hitchcock, MPS in DWrite really returns the point
size.

* src/truetype/ttobjs.h (TT_SizeRec): Add `point_size' member.

* src/truetype/ttdriver.c (tt_size_request): Set `point_size'.

* src/truetype/ttinterp.h (TT_ExecContextRec): Add `pointSize'
member.

* src/truetype/ttinterp.c (TT_Load_Context): Updated.
(Ins_MPS): Fix instruction.
2016-08-22 19:32:34 +02:00
Werner Lemberg 4927953f6c MInor. 2016-08-22 07:30:38 +02:00
Werner Lemberg 6432b8c490 Update documentation of size requests. 2016-08-21 10:50:46 +02:00
Werner Lemberg 8521ad99b0 [lzw] Optimize last commit.
* src/lzw/ftzopen.c (ft_lzwstate_get_code): Move check into
conditional clause.
2016-08-16 13:44:38 +02:00
Werner Lemberg 6df68335f1 minor. 2016-08-16 09:50:07 +02:00
Werner Lemberg 548f68d805 [lzw] Avoid invalid left shift.
* src/lzw/ftzopen.c (ft_lzwstate_get_code): Limit `num_bits'.
2016-08-16 09:46:40 +02:00
Werner Lemberg 8d7b9198e3 [lzw] Avoid buffer overrun.
Reported as

  https://bugzilla.mozilla.org/show_bug.cgi?id=1273283

* src/lzw/ftzopen.c (ft_lzwstate_refill): Ensure `buf_size' doesn't
underflow.
2016-08-16 08:07:58 +02:00
Werner Lemberg cf4224adb9 [truetype] Fix compiler warning.
* src/truetype/ttgload.c (load_truetype_glyph): Add cast.
2016-08-16 06:44:23 +02:00
Werner Lemberg 248f5629d8 [winfonts] Avoid zero bitmap width and height.
Reported as

  https://bugzilla.mozilla.org/show_bug.cgi?id=1272173

* src/winfonts/winfnt.c (FNT_Face_Init): Check zero pixel height.
(FNT_Load_Glyph): Check for zero pitch.
2016-08-13 06:53:53 +02:00
Alexei Podtelezhnikov 125f2b63a5 * src/truetype/ttinterp.c (Pop_Push_Count): Revert changes. 2016-08-11 23:40:05 -04:00
Alexei Podtelezhnikov 49d474f6f6 * src/truetype/ttinterp.c (TT_RunIns): Minor and formatting. 2016-08-11 23:03:09 -04:00
Alexei Podtelezhnikov dce554b1bd * src/truetype/ttinterp.c (Pop_Push_Count): Fix some entries. 2016-08-11 07:29:19 +02:00
Peter Klotz 3b37bfc4b5 * src/smooth/ftgrays.c (gray_hline): Fix uninitialized access. 2016-08-10 22:38:08 -04:00
Werner Lemberg 5224aae8bb [sfnt] Use correct type for `italicAngle' field (#48732).
* src/sfnt/ttload.c (tt_face_load_post): Fix types.
2016-08-10 19:47:29 +02:00
Werner Lemberg 53059f92d6 [sfnt] Fix `FT_Get_Advance' for bitmap strikes.
`FT_Get_Advance' returns 0 for bitmap fonts.  It first gets the
advance value from the font table and then scales it by the
`font->size->metrics->x_scale' field.  But `FT_Select_Size' doesn't
set that value for bitmap fonts and the advance gets scaled to zero.

Taken from

  https://github.com/behdad/harfbuzz/issues/252

* src/sfnt/ttsbit.c (tt_face_load_strike_metrics)
<TT_SBIT_TABLE_TYPE_EBLC>: Set scale values.
2016-08-07 09:01:33 +02:00
Behdad Esfahbod 8183eeb18d [truetype] Fix GX variation handling of composites.
* src/truetype/ttgload.c (load_truetype_glyph)
[TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Check `ARGS_ARE_XY_VALUES' flag.
2016-08-06 23:12:55 +02:00
Alexei Podtelezhnikov 97718f3c91 [smooth] Minor refactoring.
* src/smooth/ftgrays.c (gray_render_scanline, gray_render_line):
Updated.
2016-08-05 23:36:16 -04:00
Werner Lemberg 053943a757 [truetype] Comment. 2016-07-30 00:27:48 +02:00
Werner Lemberg fae4ec0525 [sfnt, truetype] Don't abort on invalid `maxComponentDepth'.
Since 2016-05-16 we detect infinite recursion directly.

* src/sfnt/ttload.c (tt_face_load_maxp): Don't adjust
`maxComponentDepth'.
* src/truetype/ttgload.c (load_truetype_glyph): Don't abort if
`maxComponentDepth' is not valid.  Instead, simply adjust its value
and emit a tracing message.
2016-07-29 06:43:32 +02:00
Werner Lemberg d9c7f5aa6e * src/autofit/aflatin.c (af_latin_metrics_scale_dim): Minor.
No functional change.
2016-07-26 20:20:27 +02:00
Hin-Tak Leung 3a528bbe5a [truetype] Record the end of IDEFs.
To match the logic in FDEF.  The value of the end is only used for
bound-checking in `Ins_JMPR', so it may not have been obvious that
it was not recorded.  Tested (as part of Font Validator 2.0) all the
fonts on Fedora and did not see any change.

* src/truetype/ttinterp.c (Ins_IDEF): Updated.
2016-07-22 06:59:36 +02:00
Werner Lemberg 7f63105c07 [truetype] Sanitizer fix, second try.
* src/truetype/ttgxvar.c (ft_var_readpackedpoints): Fix boundary
tests and use only one slot more.
2016-07-19 21:35:58 +02:00
Werner Lemberg 9f6426eb16 Thinko; fix previous commit. 2016-07-19 07:23:38 +02:00
Werner Lemberg e69f34b1e2 [truetype] Sanitizer fix.
* src/truetype/ttgxvar.c (ft_var_readpackedpoints): Increase array
to fix nested loops.
2016-07-19 07:06:19 +02:00
Werner Lemberg a3b70d76ba [truetype] Make GETDATA work only for GX fonts.
* src/truetype/ttinterp.c (opcode_name): Updated.
(Ins_GETDATA): Only define for `TT_CONFIG_OPTION_GX_VAR_SUPPORT'.
(TT_RunIns): Updated.
2016-07-18 06:23:36 +02:00
Werner Lemberg 8c93013ca3 [truetype] Add support for Apple's
GETDATA[], opcode 0x92

bytecode instruction.  It always returns 17, and we have absolutely
no idea what it is good for...

* src/truetype/ttinterp.c (Pop_Push_Count, opcode_name): Updated.
(Ins_GETDATA): New function.
(TT_RunIns): Add it.
2016-07-17 22:40:31 +02:00
Werner Lemberg e084360961 [truetype] Add bytecode support for GX variation fonts.
This commit implements undocumented (but confirmed) stuff from
Apple's old bytecode engine.

  GETVARIATION[], opcode 0x91
    This opcode pushes normalized variation coordinates for all axes
    onto the stack (in 2.14 format).  Coordinate of first axis gets
    pushed first.

  GETINFO[], selector bit 3
    If GX variation support is enabled, bit 10 of the result is set
    to 1.

* src/truetype/ttinterp.c: Include FT_MULTIPLE_MASTERS_H.
(opcode_name) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Updated.
(Ins_GETINFO) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Handle selector
bit 3, checking support for variation glyph hinting.
(Ins_GETVARIATION) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: New function
to implement opcode 0x91.
(TT_RunIns) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Handle opcode 0x91.
2016-07-16 18:46:28 +02:00
Werner Lemberg 32a320625e [truetype] Fix GETINFO bytecode instruction.
* src/truetype/ttinterp.c (Ins_GETINFO): Fix return value for
stretching information.
2016-07-16 16:39:26 +02:00
Behdad Esfahbod 69446ddcce [truetype] Make all glyphs in `Zycon' GX font work.
* src/truetype/ttgxvar.c (ft_var_readpackedpoints): Fix boundary
tests.
2016-07-16 10:52:38 +02:00
Werner Lemberg a3b61253a7 [truetype] Fix GX delta tracing.
* src/truetype/ttgxvar.c (TT_Vary_Apply_Glyph_Deltas): Trace
relative point movements.
2016-07-16 08:16:16 +02:00
Werner Lemberg f147fb2881 [truetype] More fixes for GX.
This finally fixes the rendering of the cyclist and the lizard in
the `Zycon' font.

* src/truetype/ttgxvar.c (ft_var_readpackedpoints): `first' point
index is always cumulative.

(tt_handle_deltas): Rename to...
(tt_interpolate_deltas): ... This.
Add new parameter for output point array.
Update caller.

(TT_Vary_Apply_Glyph_Deltas): Add `points_out' array; it now holds
the intermediate results of `tt_interpolate_deltas' that are to be
added to `outline->points'.
2016-07-16 07:06:21 +02:00
Werner Lemberg aafff57428 * src/autofit/aflatin.c (af_latin_hints_compute_segments): Thinko.
`max_pos' is always larger than `min_pos' so `FT_ABS' is not needed.

Reported by Alexei.
2016-07-16 06:41:39 +02:00
Nikolaus Waxweiler 86eb43a994 * src/truetype/ttinterp.c (Ins_MIRP): Fix copy-and-paste error.
Problem reported by Hin-Tak Leung.
2016-07-16 06:37:57 +02:00
Werner Lemberg 1831e6f068 [autofit] Update and improve segment and edge tracing.
* src/autofit/afhints.c (af_glyph_hints_dump_segments): Trace
`delta' also.
Don't show first point of segment as a replacement for `pos'; this
is (a) misleading, since the difference to `pos' can be almost
arbitrarily large in corner cases, and (b) it is better to have all
segment data in font units instead of a single value given in output
space coordinates.
Improve layout.
(af_glyph_hints_dump_edges): Show px->units and units->px conversion
values for convenience.
Improve layout.
2016-07-15 10:35:32 +02:00
Werner Lemberg 894c0228ca [autofit] For edges, reject segments wider than 1px (#41334).
* src/autofit/afhints.h (AF_SegmentRec): New member `delta'.

* src/autofit/aflatin.c (af_latin_hints_compute_segments): Compute
`delta'.
(af_latin_hints_compute_edges): Reject segments with a delta larger
than 0.5px.
2016-07-15 10:23:11 +02:00
Werner Lemberg ff655437e3 * include/freetype/freetype.h (FT_IS_NAMED_INSTANCE): New macro. 2016-07-14 15:01:55 +02:00
Werner Lemberg ee3f36f6b3 [sfnt] Fix `face_index' value in `FT_Face' for named instances.
* src/sfnt/sfobjc.s (sfnt_init_face): Don't strip off higher 16bits.
2016-07-14 10:25:20 +02:00
Werner Lemberg 631e218147 * src/truetype/ttgxvar.c (TT_Vary_Apply_Glyph_Deltas): Fix tracing. 2016-07-14 06:25:05 +02:00
Behdad Esfahbod 0f9ddf20c8 [truetype] Fix gxvar delta interpolation.
The coordinates of the base font should be used for interpolation
purposes, NOT the current points (i.e., the result of accumulation
of previous deltas).

* src/truetype/ttgxvar.c (TT_Vary_Apply_Glyph_Deltas): Initialize
`points_org' before looping over all tuples.
2016-07-14 06:08:39 +02:00
Werner Lemberg 4261103e35 Minor. 2016-07-14 06:03:52 +02:00
Werner Lemberg 17fa9f714f Merge branch '2.6.5'. 2016-07-12 08:06:23 +02:00
Werner Lemberg f9b1871ded * Version 2.6.5 released.
=========================

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

* include/freetype/config/ftoption.h
(TT_CONFIG_OPTION_SUBPIXEL_HINTING): Comment out.

* docs/VERSION.TXT: Add entry for version 2.6.5.

* README, Jamfile (RefDoc), builds/windows/vc2005/freetype.vcproj,
builds/windows/vc2005/index.html,
builds/windows/vc2008/freetype.vcproj,
builds/windows/vc2008/index.html,
builds/windows/vc2010/freetype.vcxproj,
builds/windows/vc2010/index.html,
builds/windows/visualc/freetype.dsp,
builds/windows/visualc/freetype.vcproj,
builds/windows/visualc/index.html,
builds/windows/visualce/freetype.dsp,
builds/windows/visualce/freetype.vcproj,
builds/windows/visualce/index.html,
builds/wince/vc2005-ce/freetype.vcproj,
builds/wince/vc2005-ce/index.html,
builds/wince/vc2008-ce/freetype.vcproj,
builds/wince/vc2008-ce/index.html: s/2.6.4/2.6.5/, s/264/265/.

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

* builds/unix/configure.raw (version_info): Set to 18:5:12.
* CMakeLists.txt (VERSION_PATCH): Set to 5.

* docs/CHANGES: Updated.
2016-07-12 06:18:49 +02:00
Werner Lemberg 605946af6d Conditionally compile environment support.
* include/freetype/internal/ftobjs.h, src/autofit/afmodule.c,
src/base/ftobjs.c, src/cff/cffdrivr.c, src/truetype/ttdriver.c:
Decorate with `FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES' where
necessary.
2016-07-11 16:14:36 +02:00
Werner Lemberg 8f8ae8c52d Handle properties in `FREETYPE_PROPERTIES' environment variable.
This commit covers the most important one.

* src/autofit/afmodule.c (af_property_set): Handle `warping',
`darkening-parameters', and `no-stem-darkening'.

* src/cff/cffdrivr.c (cff_property_set): Handle
`darkening-parameters', `hinting-engine', and `no-stem-darkening'.

* src/truetype/ttdriver.c (tt_property_set): Handle
`interpreter-version'.
2016-07-11 15:11:38 +02:00
Werner Lemberg c3e83b4662 Replace calls to `atol' with `strtol'.
We later on need strtol's `endptr' feature.

* include/freetype/config/ftstdlib.h (ft_atol): Replace with...
(ft_strtol): ... this.

* src/base/ftdbgmem.c (ft_mem_debug_init): Updated.
* src/cid/cidparse.c (cid_parser_new): Ditto.
* src/type42/t42drivr.c (t42_get_name_index), src/type42/t42objs.c
(T42_GlyphSlot_Load): Ditto.
2016-07-11 05:56:26 +02:00
Werner Lemberg 84d3df7501 Implement handling of `FREETYPE_PROPERTIES' environment variable.
Recognizing properties follows in another commit.

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

* include/freetype/config/ftstdlib.h (ft_getenv): New macro.

* src/base/ftinit.c (ft_set_default_properties): New function to
parse `FREETYPE_PROPERTIES' and calling `ft_property_string_set'.
(FT_Init_FreeType): Updated.
2016-07-11 00:12:11 +02:00
Werner Lemberg c3beb30a21 Add function `ft_property_string_set'.
This is a preparation for handling an `FREETYPE_PROPERTIES'
environment variable to control (some) driver properties.

No change in functionality.

* src/base/ftobjs.c (ft_property_do): Add `value_is_string'
parameter.
(ft_property_string_set): New function.
(FT_Property_Set, FT_Property_Get): Updated.

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

* include/freetype/internal/services/svprop.h
(FT_Properties_SetFunc): Add `value_is_string' parameter.

* src/autofit/afmodule.c (af_property_set), src/cff/cffdrivr.c
(cff_property_set), src/truetype/ttdriver.c (tt_property_set):
Updated, emitting an error currently if `value_is_string' is set.
2016-07-10 07:11:45 +02:00
suzuki toshiya 83c877f11c [mac] Fix ftexport.sym target in Jamfile.
* Jamfile: Update the directories of the header files scanned for
ftexport.sym.  They were incorrect since the migration of the
header files, on 2015-06-22.  Either inexisting include/cache
(removed on 2006-03-20) is not needed to be listed explicitly.
Now ftmac.h is scanned only in the case of Mac OS & Mac OS X.
2016-07-09 13:45:50 +09:00
Werner Lemberg 971f10b63a Formatting. 2016-07-08 06:59:31 +02:00
Werner Lemberg 109d1662d4 Revert "Formatting."
This reverts commit a0f3a1f25a.
2016-07-08 06:58:46 +02:00
Werner Lemberg a0f3a1f25a Formatting. 2016-07-08 06:53:46 +02:00
Alexei Podtelezhnikov 4a2f8f1faf [smooth] Sub-banding protocol revision.
Rasterization sub-banding is utilized at large sizes while using
rather small fixed memory pool. Indeed it is possible to make an
educated guess how much memory is necessary at a given size for a
given glyph. It turns out that, for large majority of European glyphs,
you should store about 8 times more boundary pixels than their height.
Or, vice versa, if your memory pool can hold 800 pixels the band
height should be 100 and you should sub-band anything larger than
that. Should you still run out of memory, FreeType bisects the band
but you have wasted some time. This is what has been implemented in
FreeType since the beginning.

It was overlooked, however, that the top band could grow to twice the
default band size leading to unnecessary memory overflows there. This
commit fixes that. Now the bands are distributed more evenly and
cannot exceed the default size.

Now the magic number 8 is really suitable for rather simple European
scripts. For complex Chinese logograms the magic number should be 13
but that is subject for another day.

* src/smooth/ftgrays.c (gray_convert_glyph): Revise sub-banding
protocol.
2016-07-08 00:16:07 -04:00
suzuki toshiya 783cbcd67d [mac] Fix Savannah bug #48417.
Mac OS X linker throws errors when `-exported_symbol_list' input
file includes non-existing symbols.  Reported by Ryan Schmidt.

* builds/exports.mk: Exclude ftmac.h from the headers for apinames
by default.  Include it when ftmac.c would be compiled.
2016-07-07 18:55:37 +09:00
Werner Lemberg 474682ff87 * src/truetype/ttinterp.c (TInstruction_Function): Removed, unused. 2016-07-06 08:54:35 +02:00
Werner Lemberg d80fe69651 * Version 2.6.4 released.
=========================

Tag sources with `VER-2-6-4'.

* docs/VERSION.TXT: Update documentation and bump version number to
2.6.4.

* README, Jamfile (RefDoc), builds/windows/vc2005/freetype.vcproj,
builds/windows/vc2005/index.html,
builds/windows/vc2008/freetype.vcproj,
builds/windows/vc2008/index.html,
builds/windows/vc2010/freetype.vcxproj,
builds/windows/vc2010/index.html,
builds/windows/visualc/freetype.dsp,
builds/windows/visualc/freetype.vcproj,
builds/windows/visualc/index.html,
builds/windows/visualce/freetype.dsp,
builds/windows/visualce/freetype.vcproj,
builds/windows/visualce/index.html,
builds/wince/vc2005-ce/freetype.vcproj,
builds/wince/vc2005-ce/index.html,
builds/wince/vc2008-ce/freetype.vcproj,
builds/wince/vc2008-ce/index.html: s/2.6.3/2.6.4/, s/263/264/.

* include/freetype/freetype.h (FREETYPE_PATCH): Set to 4.

* builds/unix/configure.raw (version_info): Set to 18:4:12.
* CMakeLists.txt (VERSION_PATCH): Set to 4.

* docs/CHANGES: Updated.
2016-07-05 15:40:19 +02:00
Werner Lemberg adfec0af94 * src/pfr/pfrsbit.c (pfr_lookup_bitmap_data): Fix compiler warning. 2016-07-05 07:38:52 +02:00
Alexei Podtelezhnikov d1876e5832 [smooth] Variable type revision (part 2).
* src/smooth/ftgrays.c (TArea): Restore original definition as `int'.
(gray_render_line) [FT_LONG64]: Updated.
(gray_convert_glyph): 32-bit band bisection stack should be 32 bands.
(gray_convert_glyph_inner): Trace successes and failures.
2016-07-04 23:46:53 -04:00
Werner Lemberg 5e353f0786 [autofit] Handle single-point contours as segments.
Doing so allows us to link them to edges – some fonts like
`NotoSansGurmukhi-Regular' have such isolated points sitting exactly
on other outlines.

* src/autofit/aflatin.c (af_latin_hints_compute_segments): Don't
ignore one-point contours but handle them specially as one-point
segments.
(af_latin_hints_compute_edges): Append one-point segments to edges
if possible.
2016-07-04 14:59:22 +02:00
Werner Lemberg 8b8c4408dd [autofit] Remove unused structure members.
* src/autofit/afhints.h (AF_SegmentRec, AF_EdgeRec): Remove
`num_linked'.

* src/autofit/afcjk.c (af_cjk_hints_link_segments): Updated.
2016-07-02 18:35:50 +02:00
Werner Lemberg aab2b8d83e [autofit] Update to Unicode 9.0.0.
* src/autofit/afranges.c (af_arab_nonbase_uniranges,
af_cyrl_uniranges): Add new data.
2016-07-02 08:37:44 +02:00
Alexei Podtelezhnikov 597c69596c [smooth] Variable type revision (part 1).
This patch restores original `TCoord' definition as `int' so that the
rendering pool is used more efficiently on LP64 platforms (unix).

* src/smooth/ftgrays.c (gray_TWorker, TCell, gray_TBand): Switch some
fields to `TCoord'.
(gray_find_cell, gray_render_scanline, gray_render_line, gray_hline,
gray_sweep, gray_convert_glyph): Updated.
2016-07-01 23:27:41 -04:00
Alexei Podtelezhnikov ef0a3e7e65 [smooth] Minor clean-ups.
* src/smooth/ftgrays.c (gray_TWorker): Remove redundant `ycount'.
(gray_sweep, gray_convert_glyph, gray_dump_cells): Updated.
2016-06-28 22:56:22 -04:00
Alexei Podtelezhnikov c9cf359fd2 [smooth] Minor clean-ups.
* src/smooth/ftgrays.c (gray_convert_glyph): Do not use volatile
qualifier.
(gray_raster_render): Move span initializations from here.
(gray_sweep): ... to here and remove unused `target' argument.
2016-06-28 00:30:58 -04:00
Alexei Podtelezhnikov 999bcee2d7 [pcf] Fix handling of very large fonts (#47708).
* src/pcf/pcfread.c (pcf_get_encodings): Make `encodingOffset' an
unsigned short.
Only reject `0xFFFF' as an invalid encoding offset.
2016-06-26 08:27:29 +02:00
Werner Lemberg 8ba407a7fe [truetype] Really fix deallocation in case of error (#47726).
* src/truetype/ttgload.c (load_truetype_glyph): Thinko; initialize
`outline.points' also.
2016-06-25 18:09:22 +02:00
Werner Lemberg d89f64627b More info on `FT_Err_Glyph_Too_Big'. 2016-06-25 08:14:36 +02:00
Alexei Podtelezhnikov 25e82bc2b5 [smooth] Consolidate memory management.
* src/smooth/ftgrays.c (gray_init_cells): Remove function.
(gray_TWorker): Remove fields that become local variables.
(gray_raster_render): Move rendering buffer declaration from here.
(gray_convert_glyph): ... to here and update accordingly.
2016-06-23 23:17:39 -04:00
Alexei Podtelezhnikov e22334812f [smooth] Consolidate boundary checks.
Removing the checks from `gray_hline' shaves 1% off rendering speed.

* src/smooth/ftgrays.c [STANDALONE_]: Duplicate `FT_MIN' and `FT_MAX'.
(gray_TWorker): No need to store `clip_box'.
(gray_hline): Remove unnecessary boundary checks.
(gray_convert_glyph): Move boundary checks from here.
(gray_raster_render): ... to here and consolidate.
2016-06-22 23:14:26 -04:00
Alexei Podtelezhnikov 78e8fc0dad [smooth] Use `FT_Outline_Get_CBox'.
* src/smooth/ftgrays.c [STANDALONE_]: Duplicate `FT_Outline_Get_CBox'.
(gray_compute_cbox): Remove this function.
(gray_convert_glyph): Update to use `FT_Outline_Get_CBox'.
2016-06-22 00:04:08 -04:00
Alexei Podtelezhnikov c05a1c3f04 Typos. 2016-06-21 23:12:54 -04:00
Werner Lemberg 20c6ef4c25 [smooth] Remove compiler warnings.
* src/smooth/ftgrays.c (gray_convert_glyph): Fix reports from clang.
2016-06-21 11:39:34 +02:00
Alexei Podtelezhnikov e3a1c46768 Typos. 2016-06-20 23:09:39 -04:00
Alexei Podtelezhnikov 6d07034609 Typos. 2016-06-20 01:09:18 -04:00
Alexei Podtelezhnikov 3c64af98ff [smooth] Sanitize memory managenent.
* src/smooth/ftgrays.c (gray_convert_glyph): Cleaned up.
2016-06-20 00:01:55 -04:00
Alexei Podtelezhnikov 74fd251b4a [smooth] Remove `band_shoot' that never worked.
* src/smooth/ftgrays.c (gray_TWorker): Remove `band_shoot'.
(gray_convert_glyph): Updated.
2016-06-18 22:31:26 -04:00
Alexei Podtelezhnikov 3e1f7bc506 Fresh typos. 2016-06-18 22:13:23 -04:00
Alexei Podtelezhnikov 72a0653142 [raster, smooth] Handle FT_RENDER_POOL_SIZE better.
* src/raster/ftraster.c (FT_MAX_BLACK_POOL): New macro.
(ft_black_render): Updated.
* src/smooth/ftgrays.c (FT_MAX_GRAY_POOL): New macro.
(gray_raster_render): Updated.
2016-06-17 23:10:22 -04:00
Alexei Podtelezhnikov 44341d279b Encoding tweaks. 2016-06-16 22:57:24 -04:00
Werner Lemberg 1e36c2e203 * src/base/md5.c: Updated to recent version. 2016-06-16 06:17:54 +02:00
Alexei Podtelezhnikov 7f569f4574 Move function. 2016-06-14 23:49:31 -04:00
Alexei Podtelezhnikov 32acceff83 * src/smooth/ftgrays.c (gray_hline): Optimize if-condition. 2016-06-14 23:38:17 -04:00
Werner Lemberg 05a55a56e2 [autofit] Add support for Cherokee script.
* src/autofit/afblue.dat: Add blue zone data for Cherokee.

* src/autofit/afblue.c, src/autofit/afblue.h: Regenerated.

* src/autofit/afscript.h: Add Cherokee standard characters.

* src/autofit/afranges.c: Add Cherokee data.

* src/autofit/afstyles.h: Add Cherokee data.
2016-06-13 12:16:45 +02:00
David Capello f40d7d2b6d [cmake] Avoid modifying `ftconfig.h' and `ftoption.h' files.
* CMakeLists.txt: Each time cmake is run those files are
modified and the whole FreeType library is recompiled.  With this
change we change the files only if there are real modifications, so
we can avoid recompilations.
2016-06-09 10:55:52 +02:00
Werner Lemberg b6b26f4535 [bdf] Check number of properties (#48166).
* src/bdf/bdflib.c (_bdf_parse_start): Implement.
2016-06-09 06:53:48 +02:00
Alexei Podtelezhnikov 77180c7adc [smooth] Re-enable new line renderer on 64-bit archs.
* src/smooth/ftgrays (gray_render_line): Conditionally re-enable new
implementation, where it is safe from overflows.
2016-06-08 23:31:28 -04:00
Alexei Podtelezhnikov 9cf232ed66 [smooth] Minor clean-ups.
* src/smooth/ftgrays.c (gray_dump_cells): Move out of the way.
(gray_render_span): Remove spurious casts and streamline.
2016-06-08 23:19:41 -04:00
Werner Lemberg 223d002c63 [autofit] Add support for Ethiopic script.
* src/autofit/afblue.dat: Add blue zone data for Ethiopic.

* src/autofit/afblue.c, src/autofit/afblue.h: Regenerated.

* src/autofit/afscript.h: Add Ethiopic standard characters.

* src/autofit/afranges.c: Add Ethiopic data.

* src/autofit/afstyles.h: Add Ethiopic data.
2016-06-07 13:52:14 +02:00
Werner Lemberg 15eab36340 [autofit] Fix compilation with VS2016 (#48126).
This compiler doesn't recognize the end-of-comment sequence `*/' if
it immediately follows non-ASCII characters.

* src/autofit/afscript.h: Ensure whitespace before `*/'.
2016-06-07 10:36:27 +02:00
Alexei Podtelezhnikov 04e7c7447b ChangeLog fixes. 2016-06-04 23:05:59 -04:00
Werner Lemberg 969960cc90 Comment. 2016-06-04 07:02:46 +02:00
Werner Lemberg 5485a34c77 [truetype] Fix missed test for named instances (#48122).
* src/truetype/ftobjs.c (Mac_Read_sfnt_Resource): Implement.
2016-06-04 06:57:32 +02:00
Nikolaus Waxweiler b459882804 [truetype] Let SHPIX move points in the twilight zone in v40.
* src/truetype/ttinterp.c (Ins_SHPIX): Allow SHPIX to move points in
the twilight zone.  Otherwise, treat SHPIX the same as DELTAP.
Unbreaks various fonts such as older versions of Rokkitt and DTL
Argo T Light that would glitch severly after calling ALIGNRP after a
blocked SHPIX.
2016-05-31 08:39:52 +02:00
Werner Lemberg d28eac249a [type42] Support `CharStrings' entry format as created by LilyPond.
* src/type42/t42parse.c (t42_parse_charstrings): Handle entries
having the format

  (foo) cvn 12345 def
2016-05-30 00:23:59 +02:00
Werner Lemberg 46d36904b0 * src/autofit/afranges.c: Remove `UL' postfix from hex numbers.
Suggested by Alexei.  `UL' is only needed for 16bit compilers, but
it seems noone is using this anymore (and we no longer test whether
FreeType compiles in such an environment).  Otherwise, it is easy to
add the postfix to the `AF_UNICODE_RANGE' macro.
2016-05-28 19:38:43 +02:00
Alexei Podtelezhnikov e9f950938f [smooth] Shrink bisection stack.
The convergence of Bézier flatteners is fast with the deviation
from straight line being assymptotically cut 4-fold on each bisection.
This justifies smaller bisection stack size.

* src/smooth/ftgrays.c (gray_TWorker): Remove common `bez_stack'.
(gray_render_conic): Create and use conic `bez_stack'. Move back the
band analysis from...
(gray_conic_to): ... here.
(gray_render_cubic): Create and use cubic `bez_stack'. Move back the
band analysis from...
(gray_cubic_to): ... here.
(gray_move_to): Updated.
2016-05-26 23:46:38 -04:00
Werner Lemberg e97918c57b [autofit] Fixes for Armenian and Gujarati ranges.
* src/autofit/afranges.c (af_armn_uniranges): Corrected.
(af_guru_nonbase_uniranges): Make U+0A3E a base character.
2016-05-25 07:13:29 +02:00
Werner Lemberg 1dcda70ef9 [autofit] Ordering, whitespace. 2016-05-24 23:10:44 +02:00
Werner Lemberg a74f40f9e7 [autofit] Add support for Armenian script.
* src/autofit/afblue.dat: Add blue zone data for Armenian.

* src/autofit/afblue.c, src/autofit/afblue.h: Regenerated.

* src/autofit/afscript.h: Add Armenian standard characters.

* src/autofit/afranges.c: Add Armenian data.

* src/autofit/afstyles.h: Add Armenian data.
2016-05-24 18:27:18 +02:00
Werner Lemberg 771d3c8ae2 * builds/unix/unix-cc.in (LINK_LIBRARY): Use `-export-symbols'.
This was commented about 10 years ago – I think the reason then to
disable libtool's `-export-symbols' option was to give some badly
programmed applications access to internal FreeType functions.

I believe that we should no longer take care of such programs; the
number of symbols exported should be rather restricted as much as
possible.
2016-05-23 06:49:38 +02:00
Werner Lemberg 9d179e3d70 [autofit] Add blue-zone support for Gurmukhi script.
This essentially moves the Gurmukhi script from the `Indic' hinter to
the `Latin' hinter.

* src/autofit/afblue.dat: Add blue zone data for Gurmukhi.

* src/autofit/afblue.c, src/autofit/afblue.h: Regenerated.

* src/autofit/afscript.h: Add Gurmukhi standard characters and move
data out of AF_CONFIG_OPTION_INDIC block.

* src/autofit/afranges.c: Move Gurmukhi data out of
AF_CONFIG_OPTION_INDIC block.

* src/autofit/afstyles.h: Update Gurmukhi data; in particular, use
AF_WRITING_SYSTEM_LATIN.
2016-05-22 08:38:41 +02:00
Werner Lemberg d583561e1d Minor clang++ fixes.
* src/base/ftobjs.c (FT_Add_Module), src/psaux/psobjs.c
(ps_parser_load_field), src/type1/t1load.c (parse_subrs): Add
initializer.

* src/cache/ftccache.h (FTC_CACHE_TRYLOOP_END): Avoid implicit
conversion from NULL to boolean.
2016-05-21 11:20:42 +02:00
Werner Lemberg 6e80a098e7 Work around a bug of the C 8.0.0.1 compiler on AIX 5.3 (#47955).
* include/freetype/internal/ftmemory.h (cplusplus_typeof): Use
braces for `extern "C++"'.
2016-05-21 10:58:40 +02:00
Alexei Podtelezhnikov 2a4c823f89 Parentheses. 2016-05-20 22:04:01 -04:00
Nikolaus Waxweiler 01de37e54f [truetype] Make TT_LOADER_SET_PP support subpixel hinting [3/3].
* src/truetype/ttgload.c (TT_LOADER_SET_PP): Replace macro with...
(tt_loader_set_pp): ... this new function.
Update all callers.
2016-05-18 07:07:44 +02:00
Nikolaus Waxweiler ed1d8983f3 [truetype] New implementation of v38 bytecode interpreter [2/3].
This patch actually modifies the bytecode interpreter.

See added comments in `ttinterp.h' for more information on this and
the following commit in the series.

* src/truetype/ttinterp.c (SUBPIXEL_HINTING): Replaced by...
(NO_SUBPIXEL_HINTING, SUBPIXEL_HINTING_INFINALITY,
SUBPIXEL_HINTING_MINIMAL): ...new macros.
(Direct_Move, Direct_Move_X, Direct_Move_Y): Handle backwards
compatibility.
Updated.
(Ins_RS, Ins_FDEF, Ins_ENDF, Ins_CALL, Ins_LOOPCALL, Ins_MD):
Updated.
(Ins_INSTCTRL): Handle native ClearType mode flag.
Updated.
(Ins_FLIPPT, Ins_FLIPRGON, Ins_FLIPRGOFF): Handle backwards
compatibility.
(Move_Zp2_Point): Ditto.
(Ins_SHP): Updated.
(Ins_SHPIX): Handle backwards compatibility.
Updated.
(Ins_MSIRP, Ins_MDAP, Ins_MIAP, Ins_MDRP, Ins_MIRP): Updated.
(Ins_ALIGNRP): Updated.
(Ins_IUP, Ins_DELTAP): Handle backwards compatibility.
Updated.
(Ins_GETINFO): Handle v38 flags.
Updated.
(TT_RunIns): Handle backwards compatibility mode.
Updated.
2016-05-18 06:58:44 +02:00
Nikolaus Waxweiler 596157365a [truetype] New implementation of v38 bytecode interpreter [1/3].
This patch prepares data structures and the like.

See added comments in `ttinterp.h' for more information on this and
the following commits in the series.

* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_OPTION_SUBPIXEL_HINTING): Assign values to differentiate
between subpixel versions.
(TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY,
TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL): New macros.

* include/freetype/ftttdrv.h (TT_INTERPRETER_VERSION_40): New macro.

* include/freetype/internal/tttypes.h (TT_FaceRec): Updated.

* src/truetype/ttinterp.h (TT_ExecContextRec): Define new fields
`subpixel_hinting_lean', `vertical_lcd_lean',
`backwards_compatibility', `iupx_called', iupy_called', and
`grayscale_cleartype' for new hinting mode.

* src/truetype/ttdriver.c (tt_property_set): Handle v38 and v40
interpreters conditionally.

* src/truetype/ttgload.c (TT_Hint_Glyph): Save phantom points unless
in v38 backwards compatibility mode.
Updated.
(compute_glyph_metrics): Add v38 backwards compatibility mode
constraint for adjusting advance widths.
Updated.
(tt_loader_init): Handle new flags `subpixel_hinting_lean',
`grayscale_cleartype', and `vertical_lcd_lean'.
Updated.
(tt_get_metrics, TT_Process_Simple_Glyph, TT_LOADER_SET_PP):
Updated.

* src/truetype/ttobjs.c (tt_driver_init): Conditionally set
default interpreter version number.

* src/truetype/ttsubpix.c, src/truetype/ttsubpix.h: Updated.
2016-05-18 06:57:59 +02:00
Werner Lemberg 119e8e41ef [cff] Fix matrix scaling (#47848).
* include/freetype/config/ftstdlib.h (FT_LONG_MIN): New macro.

* src/cff/cffparse.c (cff_parse_font_matrix): Use largest scaling
value of all matrix coefficients to scale matrix.

* src/cff/cffobjs.c (cff_face_init): Use `matrix->yx' member for
matrix normalization if `matrix->yy' is zero.
2016-05-17 19:54:09 +02:00
Werner Lemberg 533887a947 Whitespace, formatting. 2016-05-16 20:38:41 +02:00
Werner Lemberg bebac3cf5b [base] Reject invalid sfnt Mac resource (#47891).
* src/base/ftobjs.c (open_face_PS_from_sfnt_stream): Check validity
of `CID ' and `TYPE1' table offset and length.
2016-05-16 20:16:35 +02:00
Werner Lemberg 09f0e0fcbe [cid] Fix scanning for `StartData' and `/sfnts' (#47892).
* src/cid/cidparse.c (STARTDATA, STARTDATA_LEN, SFNTS, SFNTS_LEN):
New macros.
(cid_parser_new): Fix and document algorithm.
2016-05-16 19:44:19 +02:00
suzuki toshiya a7d8bdbcfe [truetype] Improve the recursive reference detector.
The previous fix for #46372 misunderstood a composite glyph referring
same component twice as a recursive reference.  See the discussion

http://lists.gnu.org/archive/html/freetype/2016-05/msg00000.html

Thanks to Khaled Hosny for finding this issue.

* src/truetype/ttgload.c (ft_list_get_node_at): A function to get
the i-th node from FT_List.  (load_truetype_glyph): In the traversal
scan of the reference tree in the composite glyph, we clear the
nodes filled by previous sibling chain.
2016-05-16 21:57:26 +09:00
Alexei Podtelezhnikov cdc8f4d933 Duplicates. 2016-05-07 23:17:57 -04:00
Alexei Podtelezhnikov 500bcbdded Duplicates. 2016-05-07 22:28:43 -04:00
Werner Lemberg 7ae9b9996b [cache] Allow value 0 for face ID.
We never dereference `face_id', and some implementations might use a
running number instead of a pointer.  Additionally, disallowing
value zero was undocumented.

* src/cache/ftccmap.c (FTC_CMapCache_Lookup), src/cache/ftcmanag.c
(FTC_Manager_LookupFace, FTC_Manager_RemoveFaceID): Remove test for
`face_id'.
2016-05-07 16:24:03 +02:00
Alexei Podtelezhnikov 6e88087d69 [smooth] More efficient accounting of conic splits and draws.
A single decrement counter of segments to draw, instead of an array,
contains all the information necessary to decide when to split and
when to draw a conic segment. The number of splits before each draw is
equal to the number of trailing zeros in the counter.

* src/smooth/ftgrays.c (gray_TWorker): Remove `lev_stack'.
(gray_render_conic): Updated to use decrement counter of segments.
2016-05-05 23:41:03 -04:00
Werner Lemberg 0b3cb8a8af [cff, truetype] Fix logic for `FT_Property_Set'.
Otherwise some properties could be set to arbitrary values, which is
harmless, but querying could give wrong positive results.

* src/cff/cffdrivr.c (cff_property_set) [hinting-engine],
* src/truetype/ttdriver.c (tt_property_set) [interpreter-version]:
Only allow defined values.
2016-05-05 12:28:48 +02:00
Werner Lemberg 22167629d1 [autofit] Add blue-zone support for Gujarati script.
This essentially moves the Gujarati script from the `Indic' hinter to
the `Latin' hinter.

* src/autofit/afblue.dat: Add blue zone data for Gujarati.

* src/autofit/afblue.c, src/autofit/afblue.h: Regenerated.

* src/autofit/afscript.h: Add Gujarati standard characters and move
data out of AF_CONFIG_OPTION_INDIC block.

* src/autofit/afranges.c: Move Gujarati data out of
AF_CONFIG_OPTION_INDIC block.

* src/autofit/afstyles.h: Update Gujarati data; in particular, use
AF_WRITING_SYSTEM_LATIN.
2016-04-25 21:18:24 +02:00
Werner Lemberg d9fb2175c4 Minor.
* include/freetype/freetype.h (FT_HAS_*, FT_IS_*): Protect macro
argument with parentheses.
2016-04-24 15:27:32 +02:00
Werner Lemberg 432e00db2e [truetype] Fix deallocation in case of error (#47726).
* src/truetype/ttgload.c (load_truetype_glyph): Initialize fields in
`outline' that are going to be deallocated in case of error.
2016-04-24 08:14:07 +02:00
Werner Lemberg 80afef8bd6 [autofit] Improve Georgian blue zone characters.
Suggested by Akaki Razmadze <razmadzekoko@gmail.com>.

* src/autofit/afblue.dat (AF_BLUE_STRING_GEORGIAN_MKHEDRULI_BOTTOM):
Updated.

* src/autofit/afblue.c: Regenerated.
2016-04-23 21:34:15 +02:00
David Capello 9224f05393 [cmake] Honor SKIP_INSTALL_* settings (as used in zlib).
As FreeType depends on zlib, if we don't install zlib (e.g., because
we defined SKIP_INSTALL_ALL), FreeType cannot be installed, too
(cmake triggers an error saying that FreeType cannot be installed
because zlib target isn't in the export set).

* CMakeLists.txt: Honor `SKIP_INSTALL_HEADERS',
`SKIP_INSTALL_LIBRARIES', and `SKIP_INSTALL_ALL' settings.
2016-04-16 10:24:24 +02:00
Behdad Esfahbod 99eff67824 [truetype] Another fix for non-intermediate GX tuples.
* src/truetype/ttgxvar.c (ft_var_apply_tuple): Add some missing
cases.
2016-04-16 07:32:23 +02:00
Alexei Podtelezhnikov 213f0ca3e3 Remove forgotten macro.
* include/freetype/internal/internal.h
[FT_INTERNAL_POSTSCRIPT_GLOBALS_H]: Remove.
2016-04-13 00:19:54 -04:00
Alexei Podtelezhnikov bbcb97793e Typos. 2016-04-13 00:11:52 -04:00
Alexei Podtelezhnikov f46b282d4d Typos. 2016-04-11 23:22:57 -04:00
Werner Lemberg c8c7ad7910 [autofit] Add support for Georgian scripts.
Georgian is problematic, since `uppercase' forms of Mkhedruli
(called Mtavruli) are not yet defined in Unicode, which means that
proper blue zones can't be defined.  However, there is already a
proposal submitted to Unicode; see

  http://www.unicode.org/L2/L2016/16034-n4707-georgian.pdf

Additionally, due to historical reasons, Unicode treats Khutsuri as
the same script as Mkhedruli, and so does OpenType.  However, since
the two scripts have completely different shapes it can happen that
blue zones differ considerably.  The tag `geok' used here (derived
from ISO 15924) to differentiate the two scripts is not an OpenType
tag in use.  If we now have a font that contains both glyphs for
Mkhedruli and Khutsuri, and it uses OpenType features for both also,
HarfBuzz unavoidably treats all glyphs as `geor'.  As a consequence,
blue zones for `geok' are not used for glyphs involved in the
OpenType features.

An issue not yet resolved is which OpenType feature should be used
to access Mtavruli glyph shapes; right now, FreeType doesn't set up
support for them, but it is easy to add them later on as soon as
more information is available.

* src/autofit/afblue.dat: Add blue zone data for Georgian.

* src/autofit/afblue.c, src/autofit/afblue.h: Regenerated.

* src/autofit/afscript.h: Add Georgian standard characters.

* src/autofit/afranges.c: Add Georgian data.

* src/autofit/afstyles.h: Add Georgian data.
2016-04-09 08:24:00 +02:00
Alexei Podtelezhnikov e85422606d Typos. 2016-04-08 23:21:34 -04:00
Alexei Podtelezhnikov 34207080c6 Typos. 2016-04-08 00:38:49 -04:00
Alexei Podtelezhnikov c6d99a42b9 Typos. 2016-04-08 00:05:50 -04:00
Alexei Podtelezhnikov bbb60965f9 Typos. 2016-04-07 01:29:44 -04:00
Werner Lemberg bf8f100d2c [autofit] Provide dummy blue zone for pseudo script `none'.
Even if the dummy hinter is used as the handler for `none' (which
doesn't use blue zones), it is more consistent than the old value
(which was 0), pointing to Arabic...

* src/autofit/afblue.dat: Add `AF_BLUE_STRINGSET_NONE'.
* src/autofit/afblue.c, src/autofit/afblue.h: Regenerated.

* src/autofit/afstyles.h (none_dflt): Use AF_BLUE_STRINGSET_NONE.
2016-04-05 11:43:58 +02:00
Werner Lemberg fb550bf466 * src/pfr/pfrload.c (pfr_aux_name_load): Thinko (#47567). 2016-03-30 18:55:27 +02:00
Werner Lemberg aff6ebb9a6 * src/pfr/pfrload.c (pfr_log_font_count): Better font size estimate. 2016-03-30 09:11:02 +02:00
Werner Lemberg ccd771cdf6 * src/pfr/pfrload.c (pfr_aux_name_load): Fix memory leak (#47567). 2016-03-30 08:44:46 +02:00
Werner Lemberg ff82747e6d * src/base/ftadvance.c (FT_Get_Advances): Fix invalid left shift. 2016-03-29 09:19:22 +02:00
Werner Lemberg 351fc4b4a4 [pfr] Fix binary search (#47514).
* src/pfr/pfrsbit.c (pfr_lookup_bitmap_data): Handle border
conditions correctly.
2016-03-29 09:13:13 +02:00
Werner Lemberg 2a03e5d9fb [pfr] Minor.
* src/pfr/pfrsbit.c (pfr_lookup_bitmap_data): Replace `left',
`right', and `middle' with `min', `max', and `mid' as used in other
FreeType binary search code.
(pfr_load_bitmap_metrics): Fix invalid left shift.
2016-03-29 08:56:03 +02:00
Werner Lemberg 31dc8f98f6 * src/pfr/pfrtypes.h: Replace all enums with macros.
We need `~FOO' to unset bits, and only with unsigned values (which
`enum' isn't normally) this works cleanly.
2016-03-29 08:37:07 +02:00
Werner Lemberg f73a993750 [autofit] Mark `aflatin2.[ch]' as not compilable. 2016-03-26 22:42:13 +01:00
Werner Lemberg b069a590a9 [pfr] Robustify bitmap strike handling (#47514).
We did a binary search for a charcode without ensuring that the
searched data is ordered.  Validating the order is now done lazily,
this is, the first access to a bitmap glyph triggers the order check
in the corresponding bitmap strike.

* src/pfr/pfrtypes.h (PFR_BitmapFlags): New values
`PFR_BITMAP_VALID_CHARCODES' and `PFR_BITMAP_CHARCODES_VALIDATED'.

* src/pfr/pfrsbit.c (pfr_lookup_bitmap_data): Make `flags' argument
a pointer.  Handle new PFR_BITMAP_XXX flags.
(pfr_slot_load_bitmap): Updated.
2016-03-26 22:42:13 +01:00
Werner Lemberg 0003cb9162 [pfr] Fix handling of compound glyphs.
Extra items are indicated with different bit positions.

* src/pfr/pfrtypes.h (PFR_GlyphFlags): Replace
`PFR_GLYPH_EXTRA_ITEMS' with `PFR_GLYPH_SIMPLE_EXTRA_ITEMS' and
`PFR_GLYPH_COMPOUND_EXTRA_ITEMS'.

* src/pfr/pfrgload.c (pfr_glyph_load_simple,
pfr_glyph_load_compound): Use them.
2016-03-26 22:42:13 +01:00
Werner Lemberg 2aa6956565 [pfr] Minor.
* src/pfr/pfrsbit.c, srf/pfr/pfrobjs.c: Use flag names instead of
bare numbers.
2016-03-26 22:42:13 +01:00
Werner Lemberg 59828f72a2 [pfr] Various clang sanitizer fixes.
* src/pfr/pfrsbit.c (pfr_load_bitmap_metrics): Correctly handle
signed nibbles.
(pfr_slot_load_bitmap): Correctly exit frame in case of error.
Fix invalid left shifts.
2016-03-26 22:42:13 +01:00
Alexei Podtelezhnikov 98967b77e5 Add comment. 2016-03-23 23:07:24 -04:00
Werner Lemberg 6e89ad4141 Rename `VERSION.DLL' (#47472).
* docs/VERSION.DLL: Renamed to...
* docs/VERSIONS.TXT: ...this.
2016-03-23 07:40:12 +01:00
Werner Lemberg 31f2dc1946 [raster, smooth] Directly test outline size (#47500).
This improves stand-alone compilation.

* src/base/ftoutln.c (FT_Outline_Render): Move cbox size test to...

* src/raster/ftraster.c (ft_black_render), src/smooth/ftgrays.c
(gray_raster_render): ...these functions.
2016-03-23 07:31:59 +01:00
Werner Lemberg e9181aba2c [raster, smooth] Fix some clang sanitizer runtime issues.
* src/raster/ftraster.c (ft_black_reset, ft_black_set_mode,
ft_black_render): Harmonize signatures with `ftimage.h'.

* src/smooth/ftgrays.c (gray_raster_render, gray_raster_reset):
Ditto.
2016-03-23 06:58:20 +01:00
Werner Lemberg b663307320 * src/truetype/ttgload.c (TT_Load_Simple_Glyph): Minor.
This fixes an AddressSanitizer issue:

  ttgload.c:430:7: runtime error: null pointer passed as argument 1,
                   which is declared to never be null
2016-03-22 08:26:55 +01:00
Werner Lemberg 614a8f17c7 * src/autofit/afhints.c (af_glyph_hints_reload): Thinko.
This fixes the previous commit to this file.
2016-03-21 19:39:14 +01:00
Alexei Podtelezhnikov 3beccbdf39 [smooth] Partly revert recent changes.
* src/smooth/ftgrays.c (gray_conic_to, gray_cubic_to): Rework
conditions to fix rendering issues.
2016-03-21 00:07:47 -04:00
Werner Lemberg 709486db7f [autofit] Show `near' points in tracing.
* src/autofit/afhints.h (AF_FLAG_NEAR): New macro.

* src/autofit/afhints.c (af_glyph_hints_dump_points): Implement it.
(af_glyph_hints_reload): Handle AF_FLAG_NEAR.
2016-03-20 22:20:32 +01:00
Alexei Podtelezhnikov 8e8bb126d1 [smooth] Minor refactoring and microoptimizations.
* src/smooth/ftgrays.c (gray_render_conic, gray_render_cubic): Move
band clipping from here.
(gray_conic_to, gray_cubic_to): ... to here.
(gray_rander_line, gray_render_scanline): Initialize variables closer
to their use.
2016-03-18 23:21:59 -04:00
Alexei Podtelezhnikov 84b2c63374 [smooth] Minor refactoring.
* src/smooth/ftgrays.c (gray_render_conic, gray_render_cubic): Move
upscaling from here...
(gray_conic_to, gray_cubic_to):... to here.
2016-03-17 00:53:09 -04:00
Werner Lemberg da86b73f03 * src/autofit/aflatin.c (af_latin_compute_stem_width): Optimize. 2016-03-15 07:55:05 +01:00
Alexei Podtelezhnikov 1865575a71 [smooth] Temporarily revert 6eb6158dd7 (#47114).
* src/smooth/ftgrays.c (gray_render_line): Old implementation.
2016-03-14 22:39:22 -04:00
Werner Lemberg ee6b4115d2 [ftfuzzer] Improve coverage of rasterfuzzer.
* src/tools/ftfuzzer/rasterfuzzer.cc (LLVMFuzzerTestOneInput): Use
input data for `tags' array also.
Trim input data to get more positive hits.
2016-03-12 23:48:13 +01:00
Werner Lemberg 10265db114 Fix CMake issues for iOS (patch #8941).
* CMakeLists.txt (CMAKE_TOOLCHAIN_FILE): Fix directory.
* builds/cmake/iOS.cmake: No longer enforce gcc.
2016-03-11 06:50:23 +01:00
Behdad Esfahbod 74c0a72d52 [truetype] Fix handling of non-intermediate GX tuples.
We probably did not notice this as all fonts we tested had only
tuple_coords[i] be +1 or -1 for non-intermediate tuples.

* src/truetype/ttgxvar.c (ft_var_apply_tuple): Implement it.
2016-03-09 20:35:27 +01:00
Alexei Podtelezhnikov 495de6cc72 [base] Refuse to render enormous outlines (#47114).
The goal is to avoid integer overflows in the rendering algorithms.
The limit is chosen arbitrarily at some 2^18 pixels, which should be
enough for modern devices including printers.

* src/base/ftoutln.c (FT_Outline_Render): Check CBox and reject
enormous outlines.
2016-03-06 23:54:34 -05:00
Alexei Podtelezhnikov d0b0e31ed7 [smooth] Replace left shifts with multiplications (#47114).
* src/smooth/ftgrays.c (SUBPIXELS, UPSCALE, DOWNSCALE): Do it.
2016-03-06 23:01:50 -05:00
Werner Lemberg caa48b0db1 [autofit] Avoid excessive stem length rounding (#25392).
* src/autofit/aflatin.c (af_latin_compute_stem_width): Add argument
to pass difference between hinted and unhinted position of base
point; use this to adjust the stem width depending on the PPEM so
that it doesn't become too large under certain circumstances.
Update all callers using value 0 for this argument except...
(af_latin_align_linked_edge): Pass position delta of base point to
`af_latin_compute_stem_width'.
2016-03-05 19:47:07 +01:00
J Raynor 1fd2bc8c37 Make FreeType compile on AIX out of the box.
* builds/unix/configure.raw (XX_ANSIFLAGS): Don't use `-ansi' on
AIX.
2016-03-05 16:38:35 +01:00
Werner Lemberg a8b956227b [ftfuzzer] Add unit for testing smooth and black rasterizers.
* src/tools/ftfuzzer/rasterfuzzer.cc: New file.
2016-03-01 09:37:12 +01:00
Werner Lemberg 3eb6f66a37 [autofit] Fix reallocation error introduced in 2016-02-27 (#47310).
* src/autofit/aflatin.c (af_latin_hints_compute_segments): Reassign
`prev_segment' after reallocation.
2016-03-01 07:10:30 +01:00
Werner Lemberg 015c6e08a1 Fix clang warnings.
* src/autofit/aflatin.c (af_latin_hints_compute_segments): Use
FT_UShort for `min_flags' and `max_flags'.
Initialize `prev_*' variables.

* src/cff/cffobjs.c (cff_face_init) [FT_DEBUG_LEVEL_TRACE]: Fix
types of local variables.

* src/smooth/ftgrays.c (gray_dump_cells) [FT_DEBUG_LEVEL_TRACE]:
Update `printf' format string.

* src/tools/ftfuzzer/ftfuzzer.cc (setIntermediateAxis): Add cast.
(LLVMFuzzerTestOneInput): Fix loop type.
2016-03-01 06:45:52 +01:00
Werner Lemberg 5c7646d226 [autofit] Add blue-zone support for Sinhala script.
This essentially moves the Sinhala script from the `Indic' hinter to
the `Latin' hinter.

* src/autofit/afblue.dat: Add blue zone data for Sinhala.

* src/autofit/afblue.c, src/autofit/afblue.h: Regenerated.

* src/autofit/afscript.h: Add Sinhala standard character and move data
out of AF_CONFIG_OPTION_INDIC block.

* src/autofit/afranges.c: Move Sinhala data out of
AF_CONFIG_OPTION_INDIC block.

* src/autofit/afstyles.h: Update Sinhala data; in particular, use
AF_WRITING_SYSTEM_LATIN.
2016-02-29 09:12:35 +01:00
Werner Lemberg f216947813 [autofit] Properly handle spikes pointing to the x-axis.
An example that gets better rendered is glyph `uusignTaml' (glyph
index 2286) in font `FreeSerif.ttf' (Version 0412.2263) at 22ppem.

* src/autofit/aflatin.c (af_latin_hints_compute_segments): Properly
handle segments where the last point of the first segment is
identical to the first point in the second one.  This can happen for
malformed fonts or spikes.  We either merge the new segment with the
previous one (both segments point into the same direction), or we
discard the shorter segment if they point into different directions.
2016-02-28 22:48:34 +01:00
Werner Lemberg ce48664579 [autofit] Minor code clean-up.
* src/autofit/aflatin.c (af_latin_hints_compute_segments): Change
some local variable names to better differentiate between values
along a segment and values orthogonal to it.
2016-02-27 15:01:49 +01:00
Werner Lemberg ebfd7ce52f [autofit] Improve BOUND action.
In complex glyph shapes, the original logic was too simple to cater
for situations that would actually need something similar to PS Hint
masks.  This fix should alleviate the worst cases.

* src/autofit/aflatin.c (af_latin_hint_edges): Don't allow
complete disappearance of stems.
2016-02-26 08:10:41 +01:00
Werner Lemberg 44324b3746 [autofit] Add blue-zone support for Tamil script.
This essentially moves the Tamil script from the `Indic' hinter to
the `Latin' hinter.

* src/autofit/afblue.dat: Add blue zone data for Tamil.

* src/autofit/afblue.c, src/autofit/afblue.h: Regenerated.

* src/autofit/afscript.h: Add Tamli standard character and move data
out of AF_CONFIG_OPTION_INDIC block.

* src/autofit/afranges.c: Move Tamil data out of
AF_CONFIG_OPTION_INDIC block.

* src/autofit/afstyles.h: Update Tamil data; in particular, use
AF_WRITING_SYSTEM_LATIN.
2016-02-25 06:58:47 +01:00
Werner Lemberg a5952d3049 [autofit] Add blue-zone support for Malayalam script.
This essentially moves the Malayalam script from the `Indic' hinter
to the `Latin' hinter.

* src/autofit/afblue.dat: Add blue zone data for Malayalam.

* src/autofit/afblue.c, src/autofit/afblue.h: Regenerated.

* src/autofit/afscript.h: Add Malayalam standard characters and move
data out of AF_CONFIG_OPTION_INDIC block.

* src/autofit/afranges.c: Move Malayalam data out of
AF_CONFIG_OPTION_INDIC block.

* src/autofit/afstyles.h: Update Malayalam data; in particular, use
AF_WRITING_SYSTEM_LATIN.
2016-02-18 12:56:38 +01:00
Alexei Podtelezhnikov 08e89b734c [smooth] Fix integer overflow (#47114).
* src/smooth/ftgrays.c (TArea): Make it unconditionally `long'.
2016-02-16 22:32:13 -05:00
Werner Lemberg 3a5e507838 * src/cff/cffparse.c (cff_parse_multiple_master): Improve tracing. 2016-02-15 22:21:01 +01:00
Werner Lemberg 2873010d15 [cff] Handle T2 operator only with old CFF engine (#47157).
* src/cff/cffparse.c (cff_parser_run) <opcode 31>: Enclose with
2016-02-15 20:53:22 +01:00
Werner Lemberg 8ed9eaf1cc [cff] Partially handle `load' and `store' ops in old CFF engine.
Now all glyphs of MM CFFs like `ITCGaramondMM-It.otf' can be
displayed.

* src/cff/cffgload.c (cff_decoder_parse_charstrings) <cff_op_store,
cff_op_load>: Partially implement it.

* src/cff/cffparse.c (cff_parser_init): Add new parameter to pass
the number of Multiple Master axes.
Update all callers.
(cff_parse_multiple_master): Get number of axes.
(cff_parser_run) <opcode 31>: Updated.
* src/cff/cffparse.h: Updated.
(CFF_ParserRec): Add `num_axes' field.

* src/cff/cffload.c: Updated.

* src/cff/cfftypes.h (CFF_FontRecDictRec): Add `num_axes' field.
2016-02-15 20:41:58 +01:00
Werner Lemberg 658f530ef5 [cff] Correctly trace SIDs that contain NULL bytes.
We need this to properly trace Multiple Master CFFs, which contain
two SIDs that are charstrings.

This commit makes FreeType also show the last SID, omitted
previously due to a bug.

* src/cff/cfftypes.h (CFF_FontRec): Add `string_pool_size' field.

* src/cff/cffload.c (cff_index_get_pointers): Add argument to return
the pool size.
Update all callers.

* src/cff/cffobjs.c (cff_face_init) [FT_DEBUG_LEVEL_TRACE]: Directly
access `cff->strings' to display the non-default strings.
2016-02-15 14:28:28 +01:00
Werner Lemberg 3295039107 Whitespace. 2016-02-15 12:54:40 +01:00
Werner Lemberg 3101f89825 [cff] Fix comment. 2016-02-15 08:48:50 +01:00
Werner Lemberg e411d38e71 * src/base/fthash.c: Include FT_INTERNAL_MEMORY_H. 2016-02-14 20:48:59 +01:00
Werner Lemberg dc5b2e828c * src/cff/cffparse.c: Include `cffgload.h'.
Problem reported by Colin Walters <walters@verbum.org>.
2016-02-14 20:47:28 +01:00
Werner Lemberg 813aca51d2 [cff] Make old CFF engine show MM CFFs (without variations).
The new code only displays the first master in the font.

* src/cff/cffgload.c (cff_decode_parse_charstrings): Add new
parameter to allow function calls from dictionaries also.
<cff_op_blend>: Partially implement it.
Update all callers.
* src/cff/cffgload.h: Updated.

* src/cff/cffparse.c (cff_parser_init): Add new parameter to pass the
number of Multiple Master designs.
Update all callers.
(cff_parse_multiple_master): New function to rudimentarily parse
operator.
(cff_parser_run): Handle `T2' operator.
* src/cff/cffparse.h: Updated.
(CFF_ParserRec): Add `num_designs' field.

* src/cff/cffload.c: Updated.

* src/cff/cfftoken.h: Handle `MultipleMaster' operator.

* src/cff/cfftypes.h (CFF_FontRecDictRec): Add `num_designs' field.

* src/sfnt/sfobjs.c (sfnt_init_face): Don't handle `fvar' table for
MM CFFs.
2016-02-14 16:03:15 +01:00
Werner Lemberg 4b3ea5ca8f [docmaker] Don't emit trailing newlines.
* src/tools/docmaker/tohtml.py (HtmlFormatter::make_html_code):
Use `rstrip'.
2016-02-09 08:08:17 +01:00
Werner Lemberg 1a0716deb0 Typo. 2016-02-09 08:05:55 +01:00
Werner Lemberg 44accb9e2e Version 2.6.3 released. 2016-02-08 19:51:40 +01:00
Werner Lemberg 78371bd641 Fix another runtime error found by clang's sanitizer (#47082).
* src/base/ftstroke.c (ft_stroke_border_export): Properly handle
empty input buffer.
2016-02-07 21:06:59 +01:00
Werner Lemberg 0d053bac84 Fix runtime errors found by clang's sanitizer (#47082).
* src/base/ftobjs.c (FT_Render_Glyph_Internal), src/base/ftoutln.c
(FT_Outline_Copy), src/cache/ftcsbits.c (ftc_sbit_copy_bitmap):
Properly handle empty input buffer.
2016-02-07 19:25:56 +01:00
Werner Lemberg 4c00dfb458 Whitespace. 2016-02-07 11:43:03 +01:00
Werner Lemberg a1460704d9 [cff] Minor.
* src/cff/cffgload.c (cff_decoder_parse_charstrings) <cff_op_sqrt>:
Remove dead code.
2016-02-07 11:42:37 +01:00
Werner Lemberg 950f16969e [cff] Implement missing operators in new engine (except `random').
* src/cff/cf2font.h (CF2_STORAGE_SIZE): New macro.

* src/cff/cf2intrp.c (cf2_interpT2CharString): Implement the
following operators: abs, add, and, div, drop, dup, eq, exch, get,
ifelse, index, mul, neg, not, or, put, roll, sqrt, sub.

* src/cff/cf2stack.h, src/cff/cf2stack.c (cf2_stack_roll): New
auxiliary function for `roll' operator.
2016-02-07 11:39:54 +01:00
Werner Lemberg 1a95d00210 Whitespace. 2016-02-07 00:39:03 +01:00
Werner Lemberg 5c8a8cb54c [cff] Fix some Type 2 operators in old CFF engine.
* src/cff/cffgload.c (cff_decoder_parse_charstrings): Fix `eq'
operator, add `not' and (unsupported) `blend' operators.
2016-02-06 08:03:03 +01:00
Sebastian Rasmussen ae7c55d98e Make direct call of `make install' work (#47072).
* builds/unix/unix-def.in (freetype-config): Make sure
`freetype-config' is generated for both make targets (`all' and
`install').
2016-02-05 18:42:19 +01:00
Werner Lemberg 710ac3dda0 [base] Fix advance width loading for MM and GX fonts (#47064).
* src/base/ftadvanc.c (LOAD_ADVANCE_FAST_CHECK): Return false for
MM and GX fonts.
Update callers.
2016-02-05 12:47:29 +01:00
Werner Lemberg 9cc2d46785 Minor. 2016-02-05 11:52:50 +01:00
Werner Lemberg cd346da588 [cff] Fix handling of face_index == -1 for pure CFF.
* src/cff/cffobjs.c (cff_face_init): Return correct number of faces.
2016-02-03 19:32:03 +01:00
Werner Lemberg f380d743f2 Typo. 2016-01-30 11:16:04 +01:00
Werner Lemberg baa41ff204 [autofit] Minor tracing improvement.
* src/autofit/afhints.c (af_glyph_hints_dump_points): Insert newline
at the start of a new contour.
2016-01-30 07:44:30 +01:00
Nikolaus Waxweiler 1d8d0b4ef9 Remove unpatented hinter (3/3).
* include/freetype/config/ftoption.h
(TT_CONFIG_OPTION_UNPATENTED_HINTING): Remove.

* include/freetype/internal/ftobjs.h (FT_Face_InternalRec): Remove
`ignore_unpatented_hinter' field.
Update users.
(FT_DEBUG_HOOK_UNPATENTED_HINTING): Remove.
Update users.

* include/freetype/internal/tttypes.h (TT_FaceRec): Remove
`unpatented_hinting' field.
Update users.

* src/base/ftpatent.c (_tt_check_patents_in_range,
_tt_check_patents_in_table, _tt_face_check_patents): Remove.
(FT_Face_CheckTrueTypePatents, FT_Face_SetUnpatentedHinting):
Replace code with dummies.

* src/truetype/ttobjs.c (tt_face_init): Remove now defunct code.
* src/truetype/ttobjs.h (TT_GraphicsState): Remove `both_x_axis'
field.
2016-01-28 14:11:14 +01:00
Nikolaus Waxweiler 5b7871be12 Remove unpatented hinter (2/3).
* devel/ftoption.h (TT_CONFIG_OPTION_UNPATENTED_HINTING): Remove.
2016-01-28 12:27:46 +01:00
Nikolaus Waxweiler 6875093a17 Remove unpatented hinter (1/3).
* src/truetype/ttinterp.c [TT_CONFIG_OPTION_UNPATENTED_HINTING]:
Remove all code related to this macro.
2016-01-28 12:24:36 +01:00
Werner Lemberg 8d810097fd [autofit] Add blue-zone support for Kannada script.
This essentially moves the Kannada script from the `Indic' hinter to
the `Latin' hinter.

* src/autofit/afblue.dat: Add blue zone data for Kannada.

* src/autofit/afblue.c, src/autofit/afblue.h: Regenerated.

* src/autofit/afscript.h: Add Kannada standard characters and move
data out of AF_CONFIG_OPTION_INDIC block.

* src/autofit/afranges.c: Move Kannada data out of
AF_CONFIG_OPTION_INDIC block.

* src/autofit/afstyles.h: Update Kannada data; in particular, use
AF_WRITING_SYSTEM_LATIN.
2016-01-28 10:13:24 +01:00
Alexei Podtelezhnikov c272070381 Typo. 2016-01-22 23:36:47 -05:00
Alexei Podtelezhnikov e4c69d226c Better access to 64-bit integers for C99 compilers.
* include/freetype/config/ftconfig.h [FT_LONG64]: Use
__STDC_VERSION__ to define 64-bit integers.
* builds/unix/ftconfig.in [FT_LONG64]: Ditto.
* builds/vms/ftconfig.h [FT_LONG64]: Ditto.
2016-01-22 23:35:49 -05:00
Werner Lemberg fc4523bd00 [gxvalid] Remove commented out code.
* src/gxvalid/gxvcommn.c (gxv_EntryTable_validate): Do it.
2016-01-21 06:20:20 +01:00
Werner Lemberg fb672897f8 [autofix] Complete last autofit commit.
Problem reported by Kostya Serebryany <kcc@google.com>.

* src/autofit/afshaper.c (af_shaper_get_coverage)
[!FT_CONFIG_OPTION_USE_HARFBUZZ]: Update signature.
2016-01-20 21:13:16 +01:00
Werner Lemberg 24fbed052f Still handle `__FTERRORS_H__'.
We need this for backwards compatibility.

Problem reported by John Emmas <johne53@tiscali.co.uk>.

* include/freetype/fterrors.h: Fix inclusion guard so that
undefining either `FTERRORS_H_' or `__FTERRORS_H__' works as
expected.
2016-01-20 21:10:41 +01:00
Alexei Podtelezhnikov 1409b3e0aa * include/freetype/ftlcdfil.h: Documentation tweak. 2016-01-19 22:54:59 -05:00
Werner Lemberg ec776596ce [autofit] Fix handling of default script.
Patch taken from ttfautohint, commit
071ae2c00e0d67f9d19418f4fade1c23d27dc185.

There were two bugs.

  - We now use non-standard script tags like `khms' for special
    purposes.  However, HarfBuzz maps such tags to `DFLT', and
    without this commit the associated lookups were incorrectly
    assigned to the non-standard tags.

  - Let's assume we have a Bengali font, and the font's `DFLT'
    script tag handles the necessary lookups for Bengali, too.
    Without this commit, the `DFLT' lookups were assigned to
    ttfautohint's default script (usually `latn') before the
    standard lookups for Bengali were handled.

    We now have the following order while searching for covered
    glyph indices.

      special features of scripts (e.g. `sups' for Cyrillic)
      Unicode mappings of scripts
      remaining features of scripts (especially important for Indic
        scripts)
      default features of default script

* src/autofit/afshaper.c, src/autofit/afshaper.h
(af_shaper_get_coverage): Add boolean parameter to indicate default
script.
Update all callers.

* src/autofit/afglobal.c (af_face_globals_compute_style_coverage):
Fix search order for coverages.
2016-01-19 19:33:57 +01:00
Werner Lemberg fc11af1ea2 Various minor clang fixes.
* src/autofit/afcjk.c (af_cjk_metrics_init_widths),
src/autofit/aflatin.c (af_latin_metrics_init_widths): Initialize
`ch'.

* src/base/ftcalc.c (FT_MulFix) [FT_LONG64]: Add cast.

* src/base/ftdbgmem.c (ft_mem_table_destroy): Add cast.

* src/base/fthash.c (hash_num_lookup): Add cast.

* src/base/fttrigon.c (ft_trig_downscale) [FT_LONG64]: Fix cast.

* src/gxvalid/gxvcommn.c (gxv_EntryTable_validate): Comment out
redundant code.

* src/type1/t1driver.c (t1_get_ps_font_value) <PS_DICT_SUBR>: Add
cast.

* src/type1/t1load.c (parse_subrs): Fix type of `count'.
2016-01-19 19:15:54 +01:00
Derek B. Noonburg 4cdfefd4bd [truetype] Add another tricky font.
* src/truetype/ttobjs.c (TRICK_SFNT_IDS_NUM_FACES): Increase.
(sfnt_id): Add variant of `DFKaiShu'.
2016-01-19 07:12:44 +01:00
Alexei Podtelezhnikov 32760d33d0 [base] Empower `FT_Library_SetLcdFilterWeights'.
* src/base/ftlcdfil.c (FT_Library_SetLcdFilterWeights): Enable filter
in addition to setting weights.
(FT_Library_SetLcdFilter): Clean out FT_FORCE_LIGHT_LCD_FILTER and
FT_FORCE_LEGACY_LCD_FILTER.
* include/freetype/ftlcdfil.h: Documentation update.
2016-01-14 23:31:08 -05:00
Alexei Podtelezhnikov 441506656f * include/freetype/ftlcdfil.h: Documentation tweak. 2016-01-14 22:55:36 -05:00
Alexei Podtelezhnikov 21eb64ebeb * include/freetype/ftlcdfil.h: Documentation tweak. 2016-01-14 00:05:53 -05:00
Werner Lemberg 9adeab6452 Update copyright year. 2016-01-13 11:54:10 +01:00
Werner Lemberg c09a90a2f1 Don't use macro names that start with `_[A-Z]' [3/3].
Such macro names are reserved for both C and C++.

* src/cache/ftccache.h: s/_FTC_FACE_ID_HASH/FTC_FACE_ID_HASH/.
Update all callers.
(FTC_CACHE_LOOKUP_CMP): Replace `_XXX' with `XXX_'.
* src/cache/ftcmru.c (FTC_MRULIST_LOOKUP_CMP): Ditto.
2016-01-12 22:28:14 +01:00
Werner Lemberg 9d0b76d7f6 Don't use macro names that start with `_[A-Z]' [2/3].
Such macro names are reserved for both C and C++.

* include/freetype/ftimage.h, src/raster/ftraster.c,
src/smooth/ftgrays.c, src/smooth/ftgrays.h:
s/_STANDALONE_/STANDALONE_/.
2016-01-12 22:27:29 +01:00
Werner Lemberg 758587dbdb Don't use macro names that start with `_[A-Z]' [1/3].
Such macro names are reserved for both C and C++.

* src/bdf/bdflib.c: Replace macros of the form `_BDF_XXX' with
`BDF_XXX_'.
2016-01-12 22:20:06 +01:00
Werner Lemberg 2e9d2660b3 Don't use macro names that contain `__' [2/2].
Such macro names are reserved for both C and C++.

* src/cache/*: s/__/_/.
2016-01-12 21:40:53 +01:00
Werner Lemberg 37412ff9f4 Don't use macro names that contain `__' [1/2].
Such macro names are reserved for both C and C++.

*/*: Replace macros of the form `__XXX_H__' with `XXX_H_'.
2016-01-12 21:37:13 +01:00
Jered Gray f53bab9381 [cff] Fix usage of `|' operator.
* src/cff/cf2intrp.c (cf2_interpT2CharString) [cf2_cmdEXTENDEDNMBR,
default]: `|' is not guaranteed to be processed from left to right
by the compiler.  However, the code repeatedly calls
`cf2_buf_readByte' to get the arguments to `|' ...  Fix this.
2016-01-10 12:03:36 +01:00
Werner Lemberg 2e09812c51 [autofit] Make top-to-bottom hinting work in latin auto-hinter.
This improves rendering of scripts like Bengali or Devanagari.

* src/autofit/afhints.c (af_axis_hints_new_edge): Add parameter to
pass top-to-bottom hinting flag.  This makes the function sort edges
in descending vertical position.

* src/autofit/afhints.c: Updated.

* src/autofit/aflatin.c (af_latin_hints_compute_edges,
af_latin_hint_edges): Use `top_to_bottom_hinting' flag.

* src/autofit/afcjk.c (af_cjk_hints_compute_edges),
src/autofit/aflatin2.c (af_latin2_hints_compute_edges): Updated.
2015-12-25 08:05:30 +01:00
Werner Lemberg 172db3254c [autofit] Add hinting direction to `AF_ScriptClassRec'.
Still unused.

* src/autofit/afglobal.c (SCRIPT): Handle hinting direction.

* src/autofit/aftypes.h (AF_ScriptClassRec): Add
`top_to_bottom_hinting' field.
(AF_HINTING_BOTTOM_TO_TOP, AF_HINTING_TOP_TO_BOTTOM): New macros.
(AF_DEFINE_SCRIPT_CLASS): Updated.
2015-12-24 08:17:51 +01:00
Werner Lemberg b0de5a82f1 [autofit] Start implementing hinting direction (up/down, down/up).
Right now, it does nothing.

* src/autofit/afscript.h: Add another parameter to `SCRIPT',
specifying hinting direction.

* src/autofit/afglobal.c, scr/autofit/afglobal.h,
src/autofit/afpic.c, src/autofit/afranges.h, src/autofit/afshaper.c,
src/autofit/aftypes.h: Extend `SCRIPT' definitions.
2015-12-23 23:25:03 +01:00
Werner Lemberg 9c1a2b0439 * src/type1/t1load.c (parse_subrs): Fix memory leak (#46744). 2015-12-22 12:05:46 +01:00
Werner Lemberg 7ce6c43c3e [base] Make hash interface symmetric.
Use `num' and `str' infixes everywhere.

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

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

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

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

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

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

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

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

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

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

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

* src/cid/cidgload.c (cid_load_glyph): Updated.
2015-12-20 19:36:04 +01:00
Werner Lemberg 1caf629eef [base] Thinko: Remove free function pointer.
We don't copy keys or values while hashing.

* include/freetype/internal/fthash.h (FT_Hash_FreeFunc): Removed.
(FT_HashRec): Remove `free' field.

* src/base/fthash.c (hash_str_free): Removed.
(ft_hash_init, ft_hash_free): Updated.
2015-12-20 19:00:35 +01:00
Werner Lemberg 76e79ec9a5 [base, bdf] Don't expose `FT_Hashnode' in hash functions.
* src/base/fthash.c (hash_lookup, ft_hash_str_lookup,
ft_hash_num_lookup): Return pointer to `size_t' instead of
`FT_Hashnode'.

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

* src/bdf/bdflib.c (bdf_get_property, _bdf_add_property,
bdf_get_font_property): Updated.
2015-12-20 09:03:15 +01:00
Werner Lemberg ad306eaa5e [base, bdf] Add number hashing.
* src/base/fthash.c (hash_num_lookup, hash_num_compare): New
functions.
(ft_hash_init): Add argument to select between number and string
hashing.
(ft_hash_num_insert, ft_hash_num_lookup): New functions.

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

* src/bdf/bdflib.c (_bdf_parse_start): Updated.
2015-12-20 08:33:21 +01:00
Werner Lemberg 1b7549ccc7 [base] Introduce hash lookup, compare, and free function pointers.
* include/freetype/internal/fthash.c (FT_Hash_LookupFunc,
FT_Hash_CompareFunc, FT_Hash_FreeFunc): New typedefs.
(FT_HashRec): Add `lookup', `compare', and `free' fields.

* src/base/fthash.c (hash_str_lookup, hash_str_compare,
hash_str_free): New functions.
(ft_hash_init): Set function pointers.
(hash_bucket, ft_hash_free): Use them.
2015-12-20 08:00:33 +01:00
Werner Lemberg 609546c4b8 [base, bdf] Use a union as a hash key.
We want to support both an integer and a string key later on.

* include/freetype/internal/fthash.h (FT_Hashkey): New union.
(FT_HashnodeRec): Updated.
(ft_hash_insert, ft_hash_lookup): Renamed to ...
(ft_hash_str_insert, ft_hash_str_lookup): ... this.

* src/base/fthash.c (hash_bucket): Updated.
(ft_hash_insert, ft_hash_lookup): Renamed to ...
(hash_insert, hash_lookup): ... this.
(ft_hash_str_insert, ft_hash_str_lookup): New wrapper functions.

* src/bdf/bdflib.c: Updated.
2015-12-20 07:17:29 +01:00
Werner Lemberg 762b23281d Minor clean-ups. 2015-12-20 06:39:38 +01:00
Werner Lemberg 313435657d [bdf] Use new hash functions.
* src/bdf/bdf.h: Include FT_INTERNAL_HASH_H.
(hashnode, hashtable): Removed.
(bdf_font_t): Use `FT_HashRec' type for `proptbl'.

* src/bdf/bdflib.c: Remove all hash functions.
Update code for new hash structure and function names.
2015-12-19 17:02:13 +01:00
Werner Lemberg c98a40f99d [bdf, base] Lift hash functions from bdf driver to base module.
* src/base/fthash.c, include/freetype/internal/fthash.h: New files,
containing (massaged) code from `bdflib.c' and `bdf.h'.

* include/freetype/internal/internal.h (FT_INTERNAL_HASH_H): New
macro.

* src/base/ftbase.c: Include `fthash.c'.

* src/base/Jamfile (_sources): Add `fthash'.

* src/base/rules.mk (BASE_SRC): Add `fthash.c'.

* docs/LICENSE.TXT: Updated.
2015-12-19 16:59:40 +01:00
Werner Lemberg 1f80c8152b Whitespace. 2015-12-16 08:22:42 +01:00
Werner Lemberg 02451c7917 [autofit] Add blue-zone support for Bengali script.
This essentially moves the Bengali script from the `Indic' hinter to
the `Latin' hinter.

* src/autofit/afblue.dat: Add blue zone data for Bengali.

* src/autofit/afblue.c, src/autofit/afblue.h: Regenerated.

* src/autofit/afscript.h: Add Bengali standard characters and move
data out of AF_CONFIG_OPTION_INDIC block.

* src/autofit/afranges.c: Move Bengali data out of
AF_CONFIG_OPTION_INDIC block.

* src/autofit/afstyles.h: Update Bengali data; in particular, use
AF_WRITING_SYSTEM_LATIN.
2015-12-15 17:53:46 +01:00
Ben Wagner a512b0fe7a [bdf] Remove dead code (#46625).
The BDF specification only allows decimal numbers, no octal or
hexidecimal decoding is needed.

* src/bdf/bdflib.c (_bdf_atoul, _bdf_atol, _bdf_atous,
_bdf_atos): Remove unused code and parameters.
Update all callers.
(odigits): Remove.
2015-12-14 09:19:52 +01:00
Werner Lemberg 4099281f6e [base] Fix calls to `FT_Stream_Seek'.
* src/base/ftobjs.c (Mac_Read_sfnt_Resource, FT_Open_Face): Set
`error'.
2015-12-14 07:51:25 +01:00
Werner Lemberg 0063649d54 Whitespace, `.mailmap' update. 2015-12-14 07:02:56 +01:00
Ben Wagner f0cc1738e2 [base] Check error when seeking to data supplied offset (#46635).
* src/base/ftobjs.c (open_face_PS_from_sfnt_stream):
`ft_lookup_PS_in_sfnt_stream' returns offset and and length from
user supplied data.  Use of this these values must be checked.
2015-12-14 07:00:41 +01:00
Werner Lemberg d8f9a453b2 [autofit] Add support for Myanmar script.
* src/autofit/afblue.dat: Add blue zone data for Myanmar.

* src/autofit/afblue.c, src/autofit/afblue.h: Regenerated.

* src/autofit/afscript.h: Add Myanmar standard characters.

* src/autofit/afranges.c: Add Myanmar data.

* src/autofit/afstyles.h: Add Myanmar data.
2015-12-13 15:54:17 +01:00
Werner Lemberg 868d5a0eaf * src/autofit/aflatin.c (af_latin_metrics_init_blues): Minor. 2015-12-12 07:28:22 +01:00
Werner Lemberg 79a42ad283 * src/autofit/afscript.h: Avoid potential crash. 2015-12-12 07:27:14 +01:00
Werner Lemberg 4fe3b55d0b [autofit] Restore OpenType feature check.
This was removed while rewriting the HarfBuzz interface.

* src/autofit/afglobal.h (AF_FaceGlobalsRec): Add `hb_buf' field to
hold internal HarfBuzz buffer, needed for feature comparison.

* src/autofit/afglobal.c (af_face_globals_new,
af_face_globals_free): Initialize and destroy `hb_buf'.

* src/autofit/afshaper.c (af_shaper_get_cluster): Compare character
(cluster) with and without applied feature.

* src/autofit/aflatin.c (af_latin_metrics_init_blues): Fix tracing
message.
2015-12-11 08:08:48 +01:00
Werner Lemberg 3c3d7c212e Another typo. 2015-12-10 11:54:41 +01:00
Werner Lemberg 93fdf4eb89 Formatting. 2015-12-10 11:52:08 +01:00
Werner Lemberg bbe84ed972 [autofit] Remove redundant code.
* src/autofit/aflatin.c (af_latin_metrics_init_widths): Do it.
2015-12-10 09:33:41 +01:00
Werner Lemberg 5330e3de15 [autofit] Minor. 2015-12-10 08:32:58 +01:00
Werner Lemberg dd305f31f0 [autofit] Thinko.
* src/autofit/aflatin.c (af_latin_metrics_init_blues): Don't count
empty blue zones (bug introduced 2015-12-06).
2015-12-09 21:00:33 +01:00
Werner Lemberg 0164d934b6 [autofit] Introduce subscript top blue zones.
This feature is mainly for Khmer: The idea is to avoid a clash
between the top of subscript glyphs and the bottom of normal
baseline glyphs.

This only works for character clusters mapped to multiple glyphs.

* src/autofit/afblue.dat: Add subscript top blue zone for Khmer.

* src/autofit/afblue.hin (AF_BLUE_PROPERTY_LATIN_SUB_TOP): New
macro.

* src/autofit/afblue.c, src/autofit/afblue.h: Regenerated.

* src/autofit/aflatin.h (AF_LATIN_IS_SUB_TOP_BLUE,
AF_LATIN_BLUE_SUB_TOP): New macros.

* src/autofit/aflatin.c (af_latin_metrics_init_blues): Handle new
blue zone property.
Update tracing messages.
(af_latin_metrics_scale_dim): Handle new blue zone property.
(af_latin_hints_compute_blue_edges): Updated.
2015-12-09 20:04:18 +01:00
Werner Lemberg f02e1df7ac [autofit] Fix tracing message.
* src/autofit/aflatin.c (af_latin_metrics_scale_dim): Display
inactive blue zones also.
2015-12-09 14:45:30 +01:00
Werner Lemberg c13526e6af * src/autofit/afblue.dat: Add more Khmer clusters.
Some fonts have incorrect ligatures; we need more samples to get a
good mean value.

* src/autofit/afblue.c, src/autofit/afblue.h: Regenerated.
2015-12-08 09:48:50 +01:00
Werner Lemberg b38ca3cbeb [autofit] Typos.
* src/autofit/afshaper.c (af_shaper_buf_create, af_shaper_get_elem)
[!FT_CONFIG_OPTION_USE_HARFBUZZ]: Make it compile.
2015-12-06 19:48:31 +01:00
Werner Lemberg facb79abdc [autofit] Add support for Khmer script.
We split Khmer into two auto-hinter scripts: `Khmer' (`khmr') and
`Khmer symbols' (`khms', U+19E0-U+19FF).

* src/autofit/afblue.dat: Add blue zone data for Khmer.

* src/autofit/afblue.c, src/autofit/afblue.h: Regenerated.

* src/autofit/afscript.h: Add Khmer standard characters.

* src/autofit/afranges.c: Add Khmer data.

* src/autofit/afstyles.h: Add Khmer data.
2015-12-06 19:34:59 +01:00
Werner Lemberg 24aa9c665e [autofit] Rewrite HarfBuzz interface to support character clusters.
Scripts like Khmer have blue zones that can't be directly
represented by Unicode characters.  Instead, it is necessary to let
HarfBuzz convert character clusters into proper glyph representation
forms, then deriving the blue zone information from the resulting
glyphs.

* src/autofit/hbshim.c, src/autofit/hbshim.h: Replaced by...
* src/autofit/afshaper.c, src/autofit/afshaper.h: ... these two new
files, providing a new API to access HarfBuzz.

The new API manages a HarfBuzz buffer with `af_shaper_buf_create'
and `af_shaper_buf_destroy'.  The buffer receives a UTF8 encoded
string with function `af_shaper_get_cluster', and the resulting
glyph data (indices, advance widths, vertical offsets) can be
iteratively accessed with function `af_shaper_get_elem'.

* src/autofit/afcjk.c (af_cjk_metrics_init_widths,
af_cjk_metrics_init_blues, af_cjk_metrics_check_digits): Updated.

* src/autofit/aflatin.c (af_latin_metrics_init_widths,
af_latin_metrics_init_blues, af_latin_metrics_check_digits):
Updated.

* include/freetype/internal/fttrace.h: s/afharfbuzz/afshaper/.

* src/autofit/afglobal.c: s/hbshim.h/afshaper.h/.
(af_face_globals_compute_style_coverage): Updated.

* src/autofit/afglocal.h: s/hbshim.h/afshaper.h/.

* src/autofit/autofit.c: s/hbshim.c/afshaper.c/.

* src/autofit/Jamfile, src/autofit/rules.mk (AUTOF_DRV_SRC):
Updated.
2015-12-06 18:52:41 +01:00
Werner Lemberg de5999411a [autofit] Prepare forthcoming changes.
This makes it easier to control the commits.

* src/autofit/aflatin.c (af_latin_metrics_init_blues): Add dummy
loop.  No functional change.
2015-12-06 18:18:02 +01:00
Werner Lemberg f45c0bf963 [autofit] Use string of standard characters.
This is more flexible; additionally, it would allow character
clusters.

* src/autofit/aftypes.h (SCRIPT, AF_DEFINE_SCRIPT_CLASS): Updated.
(AF_ScriptClassRec): Replace `standard_char[123]' with
`standard_charstring'.

* src/autofit/afscript.h: Replace last three character arguments
of the `SCRIPT' calls with a string parameter, holding the standard
characters (in UTF-8 encoding) separated with spaces.

* src/autofit/afglobal.c, src/autofit/afglobal.h,
src/autofit/afpic.c, src/autofit/afranges.c, src/autofit/hbshim.c
(SCRIPT): Updated.

* src/autofit/afcjk.c (af_cjk_metrics_init_widths),
src/autofit/aflatin.c (af_latin_metrics_init_widths): Updated.
2015-12-06 09:58:18 +01:00
Werner Lemberg a8a54c3060 * src/autofit/afblue.dat: Separate blue zone characters with spaces.
Another preparation for character cluster support.

* src/autofit/afblue.c, src/autofit.afblue.h: Regenerated.
2015-12-05 13:26:44 +01:00
Werner Lemberg 453722db8e * src/tools/afblue.pl (convert_ascii_chars): Don't ignore spaces.
Instead, reduce multiple spaces to a single one.  We need this later
for supporting character clusters in `afblue.dat'.
2015-12-05 13:20:30 +01:00
Werner Lemberg f7e6d51a75 * src/autofit/afblue.hin (GET_UTF8_CHAR): Use `do...while(0)'.
* src/autofit/afblue.h: Regenerated.
2015-12-05 13:08:45 +01:00
Werner Lemberg 53696f03ce * src/autofit/afwarp.c: s/INT_MIN/FT_INT_MIN/. 2015-12-05 07:44:16 +01:00
Werner Lemberg a415473820 * builds/unix/install.mk (install): Remove stale `ft2build.h'. 2015-12-03 07:49:46 +01:00
Alexei Podtelezhnikov 1b740a0076 Minor rearrangement. 2015-12-02 00:30:57 -05:00
Werner Lemberg 5b05bc6638 [type1] Avoid dangling pointer (#46572).
* src/type1/t1afm.c (T1_Read_Metrics): Properly reset
`face->afm_data'.
2015-12-01 12:09:02 +01:00
Alexei Podtelezhnikov f8c2057789 * include/freetype/ftlcdfil.h: Documentation tweak. 2015-11-28 22:43:33 -05:00
Werner Lemberg 66cf29b1bc * Version 2.6.2 released.
=========================

Tag sources with `VER-2-6-2'.

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

* README, Jamfile (RefDoc), builds/windows/vc2005/freetype.vcproj,
builds/windows/vc2005/index.html,
builds/windows/vc2008/freetype.vcproj,
builds/windows/vc2008/index.html,
builds/windows/vc2010/freetype.vcxproj,
builds/windows/vc2010/index.html,
builds/windows/visualc/freetype.dsp,
builds/windows/visualc/freetype.vcproj,
builds/windows/visualc/index.html,
builds/windows/visualce/freetype.dsp,
builds/windows/visualce/freetype.vcproj,
builds/windows/visualce/index.html,
builds/wince/vc2005-ce/freetype.vcproj,
builds/wince/vc2005-ce/index.html,
builds/wince/vc2008-ce/freetype.vcproj,
builds/wince/vc2008-ce/index.html: s/2.6.1/2.6.2/, s/261/262/.

* include/freetype/freetype.h (FREETYPE_PATCH): Set to 2.

* builds/unix/configure.raw (version_info): Set to 18:2:12.
* CMakeLists.txt (VERSION_PATCH): Set to 2.

* docs/CHANGES: Updated.
2015-11-28 19:08:05 +01:00
Werner Lemberg 4679bf83a6 Fix C++ compilation.
* src/autofit/afloader.c: Include FT_INTERNAL_CALC_H.

* src/truetype/ttgload.c (load_truetype_glyph): Pacify compiler.
2015-11-28 19:05:36 +01:00
Nikolaus Waxweiler 25b1330a4d Minor documentation improvements. 2015-11-28 18:07:53 +01:00
Nikolaus Waxweiler 01ce1c6a99 Change default LCD filter to be normalized and color-balanced.
Update documentation.

* src/base/ftlcdfil.c (FT_Library_SetLcdFilter): Update
`default_filter'.
2015-11-28 12:04:28 +01:00
Werner Lemberg 98afe3f5c8 [docmaker] Allow references to section names.
In the reference, we show the section's title enclosed in single
quotes.

* src/tools/docmaker/formatter.py (Formatter::__init__): Collect
section names as identifiers.

* src/tools/docmaker/tohtml.py (section_title_header): Split into...
(section_title_header1, section_title_header2): ... these two
strings.
(HtmlFormatter::make_block_url, make_html_word, html_source_quote):
Handle sections.
(HtmlFormatter::section_enter): Updated to add `id' HTML attribute.
2015-11-28 11:58:49 +01:00
Tamas Kenez 30fdfe6c66 [cmake] Add script to test the config module.
* builds/cmake/testbuild.sh: New file.
2015-11-27 23:16:08 +01:00
Tamas Kenez c80620c7fe * CMakeLists.txt: Create `freetype-config.cmake' config module. 2015-11-27 18:37:21 +01:00
Tamas Kenez 9d0544f25f * CMakeLists.txt: Set CMAKE_DEBUG_POSTFIX to `d'. 2015-11-27 18:28:31 +01:00
Tamas Kenez da97b4c43e [cmake] Add better control of library dependencies.
* CMakeLists.txt: Add `WITH_*' variables to force/auto/omit
ZLIB/BZip2/PNG/HarfBuzz.
2015-11-27 07:11:42 +01:00
Tamas Kenez 4854df62f7 [cmake] Make `FindHarfbuzz' observe the REQUIRED option.
* builds/cmake/FindHarfBuzz.cmake: Implement it.
2015-11-27 07:04:31 +01:00
Werner Lemberg 5b3446b012 [cmake] Collect files specific to cmake in `builds/cmake'.
* builds/FindHarfBuzz.cmake: Move to ...
* builds/cmake/FindHarfBuzz.cmake: ... this place.

* CMakeLists.txt (CMAKE_MODULE_PATH): Updated.
2015-11-27 06:47:13 +01:00
Alexander Bock 8f982b3881 CMakeLists.txt: Honour new command line flag `FREETYPE_NO_DIST'. 2015-11-27 06:34:39 +01:00
Werner Lemberg 7696e337ee Use new docmaker syntax for identifiers with identical names. 2015-11-26 14:31:08 +01:00
Werner Lemberg 97b808fdad [docmaker] Allow `foo[bar]' as identifier.
We need this to handle equally named properties in different
modules.

* src/tools/docmaker/content.py (re_identifier),
src/tools/docmaker/sources.py (re_crossref): Allow `foo[bar]'.

* src/tools/docmaker/tohtml.py (HtmlFormatter::make_html_word,
HtmlFormatter::index_exit, HtmlFormatter::section_enter,
HtmlFormatter::block_enter): Handle `foo[bar]'.
2015-11-26 14:29:17 +01:00
Werner Lemberg 4a15013a29 * src/bdf/bdflib.c (bdf_load_font): Fix small memory leak (#46480).
(_bdf_parse_glyphs): Always reset `p->glyph_name' after moving its
contents.
2015-11-25 07:53:49 +01:00
Werner Lemberg d8fc009dbb Update `CHANGES' file. 2015-11-21 13:12:06 +01:00
Werner Lemberg 663f2d7a23 * include/freetype/internal/ftcalc.h: Don't use `register' keyword.
This fixes compiler warnings.

Reported by Behdad.
2015-11-21 06:30:43 +01:00
Werner Lemberg b96af12eb6 Add `FT_LCD_FILTER_LEGACY1' enum value.
This does the same as `FT_LCD_FILTER_LEGACY'.

See

  https://bugs.freedesktop.org/show_bug.cgi?id=92981

for the reasoning.

* include/freetype/ftlcdfil.h (FT_LcdFilter): New value
`FT_LCD_FILTER_LEGACY1'.

* src/base/ftlcdfil.c (FT_Library_SetLcdFilter): Use it.
2015-11-20 16:03:09 +01:00
Werner Lemberg 68fb4789a5 * src/autofit/afhints.c (af_get_segment_index): Fix it.
The old code was too simple, returning invalid values in most cases
where a segment crosses the contour start.
2015-11-15 13:06:48 +01:00
Werner Lemberg 94cacac594 * src/bdf/bdflib.c (bdf_load_font): Fix small memory leak (#46439). 2015-11-15 04:45:42 +01:00
Werner Lemberg 49984c9bc0 Documentation typo. 2015-11-12 22:48:51 +01:00
Werner Lemberg 75722f8929 [cff, autofit] Switch off stem darkening by default.
* src/autofit/afmodule.c (af_autofitter_init), src/cff/cffobjs.c
(cff_driver_init): Do it.
2015-11-11 09:55:16 +01:00
Jan Alexander Steffens (heftig) ccd3188af1 Allow native CFF hinter in FT_RENDER_MODE_LIGHT.
Both the native CFF hinter and the auto-hinter now have a very
similar rendering style.

* include/freetype/freetype.h: Mention that FT_LOAD_TARGET_LIGHT no
longer implies FT_LOAD_FORCE_AUTOHINT.

* include/freetype/ftmodapi.h (FT_MODULE_DRIVER_HINTS_LIGHTLY): New
macro.

* include/freetype/internal/ftobjs.h (FT_DRIVER_HINTS_LIGHTLY): New
macro.

* src/cff/cffdrivr.c (cff_driver_class): Use it.

* src/base/ftobjs.c (FT_Load_Glyph): Update auto-hinter selection
logic.
2015-11-10 22:33:45 +01:00
Werner Lemberg 2985e4fa30 * src/cid/cidload.c (cid_face_open): Fix GDBytes guard (#46408). 2015-11-09 21:37:40 +01:00
Werner Lemberg 837285e407 [truetype] Remove integer to pointer conversion compiler warning.
Problem reported by Alexei.

* src/truetype/ttgload.c (load_truetype_glyph): Use a solution found
in the glib library to fix the issue.
2015-11-09 09:20:08 +01:00
Behdad Esfahbod abb33121ee [sfnt] Accept version 3 of `EBLC' and `CBLC' tables also.
* src/sfnt/ttsbit.c (tt_face_load_sbit): Implement it.
2015-11-08 10:00:34 +01:00
Philipp Knechtges be32b168ac [autofit] Don't distort (latin) glyphs too much (#46195).
* src/autofit/aflatin.h (AF_LatinBlueRec): Add `ascender' and
`descender' fields.

* src/autofit/aflatin.c (af_latin_metrics_init_blues): Collect
ascender and descender data for blue zones.
(af_latin_metrics_scale_dim): Reject vertical scaling values that
change the result by more than two pixels.
2015-11-08 08:37:51 +01:00
Werner Lemberg 7363414b9d [ftfuzzer] Add copyright notices; do some formatting. 2015-11-07 06:32:46 +01:00
Werner Lemberg 0f0a6bb8aa [sfnt] Ignore embedded bitmaps with zero size (#46379).
* src/sfnt/ttsbit.c (tt_sbit_decoder_load_bit_aligned): Implement
it.
2015-11-05 13:48:11 +01:00
Werner Lemberg 758d55e522 [truetype] Catch infinite recursion in subglyphs (#46372).
* include/freetype/internal/tttypes.h (TT_LoaderRec): New field
`composites'.

* src/truetype/ttgload.c: Include FT_LIST_H.
(load_truetype_glyph): Add composite subglyph index to a list;
abort if index is already in list.
(tt_loader_init): Updated.
(tt_loader_done): New function.
(TT_Load_Glyph): Call `tt_loader_done'.
2015-11-04 11:44:47 +01:00
Werner Lemberg 040edaf5fb [truetype] Better tracing of composite glyphs.
* src/truetype/ttgload.c (TT_Load_Composite_Glyph,
load_truetype_glyph): Implement it.
2015-11-04 07:35:51 +01:00
Werner Lemberg aae8808780 [sfnt] Protect against zero-size bitmaps (#46345).
* src/sfnt/ttsbit.c (tt_sbit_decoder_load_bitmap): Check
`glyph_size'.
2015-11-03 17:30:36 +01:00
Nikolaus Waxweiler b6fd5bc06c * src/autofit/afloader.c (af_loader_load_g): Implement emboldening. 2015-11-03 10:40:58 +01:00
Nikolaus Waxweiler bf2ba9e3d4 [autofit] Implement darkening computation function.
This is a crude adaption of the original `cf2_computeDarkening'
function.

* src/autofit/afloader.c (af_intToFixed, af_fixedToInt,
af_floatToFixed): New macros, taken from `cf2fixed.h'.
(af_loader_compute_darkening): New function.
* src/autofit/afloader.h: Updated.
2015-11-02 13:12:34 +01:00
Nikolaus Waxweiler 37c401ac0a [autofit] Add functions to get standard widths for writing systems.
We need the computed standard horizontal and vertical widths for the
emboldening calculation.  This method provides a convenient way to
extract it from writing-system-specific metrics structures, which
all script definitions must implement.

* src/autofit/aftypes.h (AF_WritingSystem_GetStdWidthsFunc): New
function type.
(AF_WritingSystemClassRec): New member `style_metrics_getstdw'.
(AF_DEFINE_WRITING_SYSTEM_CLASS): Updated.

* src/autofit/afcjk.c (af_cjk_get_standard_width): New function.
(af_cjk_writing_system_class): Updated.
* src/autofit/afdummy.c	(af_dummy_writing_system_class): Updated.
* src/autofit/afindic.c (af_cjk_get_standard_width): New function.
(af_indic_writing_system_class): Updated.
* src/autofit/aflatin.c (af_latin_get_standard_width): New function.
(af_indic_writing_system_class): Updated.
* src/autofit/aflatin.c (af_latin_get_standard_width): New function.
(af_indic_writing_system_class): Updated.
2015-11-02 09:32:26 +01:00
Nikolaus Waxweiler b2a85ad32b [autofit] Extend `AF_FaceGlobalsRec' to hold emboldening data.
* src/autofit/afglobal.h (AF_FaceGlobalsRec): Add fields.

* src/autofit/afglobal.c (af_face_globals_new): Initialize new
fields.
(af_face_globals_free): Reset new fields.
2015-11-02 09:20:32 +01:00
Nikolaus Waxweiler d682e51062 [autofit] Add stem-darkening properties.
Actual code follows in a later commit.

* include/freetype/ftautoh.h: Document `no-stem-darkening' and
`darkening-parameters'.

* src/autofit/afmodule.h: New fields `no_stem_darkening' and
`darken_params'.

* src/autofit/afmodule.c (af_property_set, af_property_get):
Handle them.
(af_autofitter_init): Initialize them.
2015-11-02 09:06:36 +01:00
Werner Lemberg 6bda921da0 [ftfuzzer] Update README file. 2015-11-02 06:53:48 +01:00
Werner Lemberg bcf618b256 [ftfuzzer] Add support for multiple files (patch #8779).
Currently, libFuzzer only supports mutation of a single file.  We
circumvent this problem by using an uncompressed tar archive as
multiple-file input for the fuzzer.

This patch enables tests of `FT_Attach_Stream' and AFM/PFM parsing;
a constructed tarball should contain a font file as the first
element, and files to be attached as further elements.

* src/tools/ftfuzzer/ftfuzzer.cc: Include libarchive headers.
(archive_read_entry_data, parse_data): New functions.
(LLVMFuzzerTestOneInput): Updated.

* src/tools/ftfuzzer/ftmutator.cc: New file, providing a custom
mutator for libFuzzer that can mutate tarballs in a sensible way.
2015-11-02 06:50:49 +01:00
Werner Lemberg 40cb1dc3ac Formatting. 2015-10-31 19:08:27 +01:00
Werner Lemberg 57cbb8c148 [sfnt] Fix cmap 14 validation (#46346).
* src/sfnt/ttcmap.c (tt_cmap14_validate): Check limit before
accessing `numRanges' and `numMappings'.
Fix size check for non-default UVS table.
2015-10-31 18:47:26 +01:00
Werner Lemberg 009cc15035 [sfnt] Handle infinite recursion in bitmap strikes (#46344).
* src/sfnt/ttsbit.c (TT_SBitDecoder_LoadFunc,
tt_sbit_decoder_load_bitmap, tt_sbit_decoder_load_byte_aligned,
tt_sbit_decoder_load_bit_aligned, tt_sbit_decoder_load_png): Add
argument for recursion depth.
(tt_sbit_decoder_load_compound): Add argument for recursion depth.
Increase recursion counter for recursive call.
(tt_sbit_decoder_load_image): Add argument for recursion depth.
Check recurse depth.
(tt_face_load_sbit_image): Updated.
2015-10-31 17:52:56 +01:00
Werner Lemberg 4188deacf3 Comments. 2015-10-30 08:07:56 +01:00
Werner Lemberg 02cfd71498 * src/autofit/afhints.c (af_glyph_hints_dump_points): Minor. 2015-10-29 20:50:57 +01:00
Werner Lemberg 017db03ec5 * CMakeLists.txt: Remove code to set MSVC's /FD compiler switch.
Problem reported by David Capello <davidcapello@gmail.com>; see

  http://lists.nongnu.org/archive/html/freetype-devel/2015-10/msg00108.html

for details.
2015-10-29 05:52:09 +01:00
Werner Lemberg fba29fabb3 [pfr] Add some safety guards (#46302).
* src/pfr/pfrload.h (PFR_CHECK): Rename to...
(PFR_CHECK_SIZE): ... this.
(PFR_SIZE): [!PFR_CONFIG_NO_CHECKS]: Define to PFR_CHECK_SIZE.

* src/pfr/pfrload.c (pfr_log_font_count): Check `count'.
(pfr_extra_item_load_kerning_pairs): Remove tracing message.
(pfr_phy_font_load): Use PFR_CHECK_SIZE where appropriate.
Allocate `chars' after doing a size checks.

* src/pfr/pfrsbit.c (pfr_load_bitmap_bits): Move test for invalid
bitmap format to...
(pfr_slot_load_bitmap): ... this function.
Check bitmap size.
2015-10-27 21:04:48 +01:00
Werner Lemberg 4a3fce93c2 [pfr] Formatting, improving comments. 2015-10-27 19:27:39 +01:00
Werner Lemberg 6a19a7d332 [truetype] Fix sanitizing logic for `loca' (#46223).
* src/truetype/ttpload.c (tt_face_load_loca): A thinko caused an
incorrect adjustment of the number of glyphs, most often using far
too large values.
2015-10-26 15:40:22 +01:00
Werner Lemberg 7f00fa6462 [autofit] Improve tracing.
* src/autofit/afhints.c (af_print_idx, af_get_segment_index,
af_get_edge_index): New functions.

(af_glyph_hints_dump_points): Remove unnecessary `|', `[', and `]'.
Add segment and edge index for each point.
Slightly change printing order of some elements.
Don't print `-1' but `--' for missing elements.

(af_glyph_hints_dump_segments, af_glyph_hints_dump_edges): Remove
unnecessary `|', `[', and `]'.
Don't print `-1' but `--' for missing elements.
2015-10-25 10:59:59 +01:00
Werner Lemberg 07f27e1e43 Thinkos and omissions. 2015-10-24 15:22:13 +02:00
Werner Lemberg 6f09011fe6 [sfnt] Sanitize bitmap strike glyph height.
Problem reported by Nikolay Sivov <bunglehead@gmail.com>.

* src/sfnt/ttsbit.c (tt_face_load_strike_metrics): Avoid zero value
for `metrics->height' by applying some heuristics.
2015-10-24 10:10:22 +02:00
Werner Lemberg e93d326c8b [sfnt, type42] Fix clang compiler warnings.
* src/sfnt/sfobjs.c (sfnt_init_face): Initialize `offset'.

* src/type42/t42parse.c (t42_parse_sfnts): Use proper cast.
2015-10-22 10:17:20 +02:00
Werner Lemberg f1c93439b9 [cff] Avoid overflow/module arithmetic.
This modifies the addition of subroutine number to subroutine bias
from unsigned to signed, but does not change any results.

* src/cff/cf2ft.c (cf2_initGlobalRegionBuffer,
cf2_initLocalRegionBuffer): Change variable names from (unsigned)
`idx' to (signed) `subrNum', since it is not an index until after
the bias is added.
* src/cff/cf2ft.h: Updated.

* src/cff/cf2intrp.c (cf2_interpT2CharString) <cf2_cmdCALLSUBR>:
Updated similarly.
2015-10-22 10:11:23 +02:00
Werner Lemberg 59ae73fe16 [cid] Better check of `SubrCount' dictionary entry (#46272).
* src/cid/cidload.c (cid_face_open): Add more sanity tests for
`fd_bytes', `gd_bytes', `sd_bytes', and `num_subrs'.
2015-10-22 09:26:00 +02:00
Werner Lemberg 5dedbc048f Improve documentation of `FT_Get_MM_Var' and `FT_MM_Var'. 2015-10-22 07:22:55 +02:00
Werner Lemberg e484d36b2b [base] Pacify compiler (#46266).
* src/base/ftoutln.c (FT_Outline_EmboldenXY): Initialize `in' and
`anchor'.
2015-10-21 20:48:27 +02:00
Werner Lemberg 87fefc594e [type42] Fix heap buffer overflow (#46269).
* src/type42/t42parse.c (t42_parse_sfnts): Fix off-by-one error in
bounds checking.
2015-10-21 20:29:12 +02:00
Dave Arnold 3cfd51233c [cff] Fix limit in assert for max hints.
* src/cff/cf2interp.c (cf2_hintmask_setAll): Allow mask equal to the
limit (96 bits).
2015-10-21 14:07:25 +02:00
Werner Lemberg 3066f5f53d Revert erroneously applied commits. 2015-10-21 14:05:41 +02:00
Dave Arnold 748e368173 [cff] Remove an assert (#46107).
* src/cff/cf2hints.c (cf2_hintmap_insertHint): Ignore paired edges
in wrong order.
2015-10-21 13:58:43 +02:00
Werner Lemberg e6593389cf [sfnt] Avoid unnecessarily large allocation for WOFFs (#46257).
* src/sfnt/sfobjs.c (woff_open_font): Use WOFF's `totalSfntSize'
only after thorough checks.
Add tracing messages.
2015-10-21 08:04:29 +02:00
Werner Lemberg 649ca5562d [type42] Better check invalid `sfnts' array data (#46255).
* src/type42/t42parse.c (t42_parse_sfnts): Table lengths must be
checked individually against available data size.
2015-10-21 07:01:45 +02:00
Werner Lemberg 3eccc3a3f8 [cid] Add a bunch of safety checks.
* src/cid/cidload.c (parse_fd_array): Check `num_dicts' against
stream size.
(cid_read_subrs): Check largest offset against stream size.
(cid_parse_dict): Move safety check to ...
(cid_face_open): ... this function.
Also test length of binary data and values of `SDBytes',
`SubrMapOffset', `SubrCount', `CIDMapOffset', and `CIDCount'.
2015-10-20 22:31:57 +02:00
Werner Lemberg d47d372c96 [cid] Avoid segfault with malformed input (#46250).
* src/cid/cidload.c (cid_read_subrs): Return a proper error code for
unsorted offsets.
2015-10-20 12:24:36 +02:00
StudioEtrange 5cf83a5335 * CMakeLists.txt: Enable shared library builds on MinGW (#46233). 2015-10-20 07:19:44 +02:00
Werner Lemberg 3c582060b2 * src/type1/t1afm.c (T1_Read_Metrics): Fix memory leak (#46229). 2015-10-20 06:57:28 +02:00
Bungeman ba8a528b19 [cid] Better handle invalid glyph stream offsets (#46221).
* src/cid/cidgload.c (cid_load_glyph): Check minimum size of glyph
length.
2015-10-19 23:27:06 +02:00
Werner Lemberg 2961b66c70 Typo. 2015-10-19 23:17:25 +02:00
Werner Lemberg 24cee3a8a3 [psaux] Fix tracing of negative numbers.
Due to incorrect casting negative numbers were shown as very large
(positive) integers on 64bit systems.

* src/psaux/t1decode.c (t1_decoder_parse_charstrings) <op_none>:
Use division instead of shift.
2015-10-19 23:00:28 +02:00
Werner Lemberg 5179c89f61 Comments. 2015-10-19 08:49:25 +02:00
Werner Lemberg 14213b5409 [truetype] Improve TT_CONFIG_OPTION_MAX_RUNNABLE_OPCODES (#46223).
* devel/ftoption.h, include/freetype/config/ftoption.h: Surround it
with #ifndef ... #endif, as suggested in the tracker issue.
2015-10-18 18:15:04 +02:00
Werner Lemberg dcfc4d9c21 [truetype] Better protection against malformed `fpgm' (#46223).
* src/truetype/ttobjs.c (tt_size_init_bytecode): Don't execute a
malformed `fpgm' table more than once.
2015-10-18 16:47:06 +02:00
Werner Lemberg 7643b5839b * src/cid/cidgload.c (cid_load_glyph): Fix memory leak.
Reported by Kostya Serebryany <kcc@google.com>.
2015-10-17 15:51:29 +02:00
Werner Lemberg b185747dd6 [bdf] Prevent memory leak (#46217).
* src/bdf/bdflib.c (_bdf_parse_glyphs) <STARTCHAR>: Check
_BDF_GLYPH_BITS.
2015-10-17 14:21:41 +02:00
Werner Lemberg 797ca5acb5 Typo. 2015-10-17 11:57:16 +02:00
Werner Lemberg e1ca18d449 [bdf] Use stream size to adjust number of glyphs.
* src/bdf/bdflib.c (ACMSG17): New message macro.
(_bdf_parse_t): Add member `size'.
(bdf_load_font): Set `size'.
(_bdf_parse_glyphs): Adjust `cnt' if necessary.
2015-10-17 11:51:27 +02:00
Werner Lemberg 0af21dcf13 * src/cid/cidload.c (cid_parse_dict): Check `[FG]DBytes' size. 2015-10-17 09:29:52 +02:00
Werner Lemberg 38a3dd5566 Typo. 2015-10-17 09:15:37 +02:00
Werner Lemberg 0ba98da472 * src/cid/cidgload.c (cid_glyph_load): Check file offsets (#46222). 2015-10-17 09:11:02 +02:00
Werner Lemberg 8edfcbed53 [psaux] Fix heap buffer overflow (#46221).
* src/psaux/t1decode.c (t1_decoder_parse_charstring) <operator 12>:
Fix limit check.
2015-10-17 08:11:16 +02:00
Werner Lemberg a5ecfb4ce6 * src/cid/cidload.c (cid_parse_dict): Handle invalid input (#46220). 2015-10-17 06:15:55 +02:00
Kostya Serebryany 266976b163 add src/tools/ftfuzzer/README 2015-10-15 22:15:53 -07:00
Bungeman 65d8980491 [bdf] Fix memory leak (#46213).
* src/bdf/bdflib.c (bdf_load_font): Always go to label `Fail' in
case of error.
2015-10-15 23:50:16 +02:00
Werner Lemberg 24a1fcdfce [truetype] Add TT_CONFIG_OPTION_MAX_RUNNABLE_OPCODES (#46208).
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_OPTION_MAX_RUNNABLE_OPCODES): New configuration macro.

* src/truetype/ttinterp.c (MAX_RUNNABLE_OPCODES): Removed.
(TT_RunIns): Updated.
2015-10-15 21:50:15 +02:00
Werner Lemberg 911171ac49 Minor. 2015-10-15 21:22:16 +02:00
Werner Lemberg 837ad9d411 * src/truetype/ttinterp.c (TT_RunIns): Fix bytecode stack tracing.
The used indices were off by 1.
2015-10-15 21:15:45 +02:00
Werner Lemberg 8b76eaf092 * src/tools/ftfuzzer/ftfuzzer.cc: Handle fixed sizes (#46211). 2015-10-15 18:28:43 +02:00
Werner Lemberg e03214e166 [base] Compute MD5 checksums only if explicitly requested.
This improves profiling accuracy.

* src/base/ftobjs.c (FT_Render_Glyph_Internal): Implement it.
2015-10-15 16:58:13 +02:00
Werner Lemberg 6de2a355ff Minor. 2015-10-15 08:40:12 +02:00
Werner Lemberg 2a20c92c4b [base] Use `FT_' namespace for MD5 functions (#42366).
* src/base/ftobjs.c (MD5_*): Define as `FT_MD5_*'.
Undefine HAVE_OPENSSL.
2015-10-14 15:23:15 +02:00
Werner Lemberg 8539915d18 [type1] Correctly handle missing MM axis names (#46202).
* src/type1/t1load.c (T1_Get_MM_Var): Implement it.
2015-10-13 20:43:19 +02:00
Werner Lemberg 58b61b6e05 [pcf] Quickly exit if font index < 0.
Similar to other font formats, this commit makes the parser no
longer check the whole PCF file but only the header and the TOC if
we just want to get the number of available faces (and a proper
recognition of the font format).

* src/pcf/pcfdrivr.c (PCF_Face_Init): Updated.
Exit quickly if face_index < 0.

* src/pcfread.c (pcf_load_font): Add `face_index' argument.
Exit quickly if face_index < 0.

* src/pcf/pcf.h: Updated.
2015-10-13 18:26:18 +02:00
Werner Lemberg bdb56bba86 [ftfuzzer] Handle TTCs and MM/GX variations.
This patch also contains various other improvements.

* src/tools/ftfuzzer/ftfuzzer.cc: Add preprocessor guard to reject
pre-C++11 compilers.
(FT_Global): New class.  Use it to provide a global constructor and
destructor for the `FT_Library' object.
(setIntermediateAxis): New function to select an (arbitrary)
instance.
(LLVMFuzzerTestOneInput): Loop over all faces and named instances.
Also call `FT_Set_Char_Size'.
2015-10-13 11:51:13 +02:00
Werner Lemberg 43a96eb26f [truetype] Refine some GX sanity tests.
Use the `gvar' table size instead of the remaining bytes in the
stream.

* src/truetype/ttgxvar.h (GX_BlendRec): New field `gvar_size'.

* src/truetype/ttgxvar.c (ft_var_load_gvar): Set `gvar_size'.
(ft_var_readpackedpoints, ft_var_readpackeddeltas: New argument
`size'.
(tt_face_vary_cvt, TT_Vary_Apply_Glyph_Deltas): Updated.
2015-10-13 11:18:55 +02:00
Werner Lemberg 052f6c5649 [truetype] Another GX sanity test.
* src/truetype/ttgxvar.c (TT_Vary_Apply_Glyph_Deltas): Check
`tupleCount'.
Add tracing message.
2015-10-13 08:24:32 +02:00
Werner Lemberg 7ef0d8661a [truetype] Fix memory leak for broken GX fonts (#46188).
* src/truetype/ttgxvar.c (TT_Vary_Apply_Glyph_Deltas): Fix scope of
deallocation.
2015-10-13 08:14:20 +02:00
Werner Lemberg f96094eef0 [truetype] Fix commit from 2015-10-10.
* src/truetype/ttgxvar.c (ft_var_load_gvar): Add missing error
handling body to condition.
2015-10-13 07:13:56 +02:00
Werner Lemberg b9880aa0f8 [unix] Make MKDIR_P actually work.
* builds/unix/configure.raw: Fix underquoting of `INSTALL' and
`MKDIR_P'.

Problem reported by Dan Liddell <lddll@yahoo.com>.
2015-10-12 10:13:26 +02:00
Werner Lemberg 4f7f6f6e47 [sfnt] Improve extraction of number of named instances.
* src/sfnt/sfobjs.c (sfnt_init_face)
[TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Check number of instances against
`fvar' table size.
2015-10-11 07:55:25 +02:00
Werner Lemberg a724dcf5c3 Split off ChangeLog.25. 2015-10-11 05:50:07 +02:00
Alexei Podtelezhnikov c14ae9c5fd * src/base/ftoutln.c (FT_Outline_Get_Orientation): Fix overflow (#46149). 2015-10-10 22:28:26 -04:00
Werner Lemberg 8de39a7919 [sfnt] Fix infinite loops with broken cmaps (#46167).
* src/sfnt/ttcmap.c (tt_cmap8_char_next, tt_cmap12_next): Take care
of border condidions (i.e., if the loops exit naturally).
2015-10-10 13:34:11 +02:00
Werner Lemberg da34673e54 [truetype] More sanity tests for GX handling.
These tests should mainly help avoid unnecessarily large memory
allocations in case of malformed fonts.

* src/truetype/ttgxvar.c (ft_var_readpackedpoints,
ft_var_readpackeddeltas): Check number of points against stream
size.
(ft_var_load_avar): Check `pairCount' against table length.
(ft_var_load_gvar): Check `globalCoordCount' and `glyphCount'
against table length.
(tt_face_vary_cvt): Check `tupleCount' and `offsetToData'.
Fix trace.
(TT_Vary_Apply_Glyph_Deltas): Fix trace.
Free `sharedpoints' to avoid memory leak.
2015-10-10 10:21:27 +02:00
Werner Lemberg c220d8b498 [truetype] Better protection against malformed GX data (#46166).
* src/truetype/ttgxvar.c (TT_Vary_Apply_Glyph_Deltas): Correctly
handle empty `localpoints' array.
2015-10-10 08:13:04 +02:00
Werner Lemberg d353f6e012 * src/pcf/pcfread.c (pcf_read_TOC): Check stream size (#46162). 2015-10-10 06:54:46 +02:00
Werner Lemberg c12956e700 * src/gzip/ftgzip.c (FT_Stream_OpenGzip): Use real stream size. 2015-10-09 09:38:32 +02:00
Werner Lemberg d98053c997 [pcf] Protect against invalid number of TOC entries (#46159).
* src/pcf/pcfread.c (pcf_read_TOC): Check number of TOC entries
against size of data stream.
2015-10-08 23:17:41 +02:00
Werner Lemberg 06c2d3324e [type42] Protect against invalid number of glyphs (#46159).
* src/type42/t42parse.c (t42_parse_charstrings): Check number of
`CharStrings' dictionary entries against size of data stream.
2015-10-08 21:31:57 +02:00
Werner Lemberg 983b00ec86 [sfnt] Fix some signed overflows (#46149).
* src/sfnt/ttsbit.c (tt_face_load_strike_metrics)
<TT_SBIT_TABLE_TYPE_SBIX>: Use `FT_MulDiv'.
2015-10-08 18:44:45 +02:00
Werner Lemberg 121122416d [type1] Protect against invalid number of subroutines (#46150).
* src/type1/t1load.c (parse_subrs): Check number of
`Subrs' dictionary entries against size of data stream.
2015-10-08 08:55:15 +02:00
Kostya Serebryany dde84f2539 [ftfuzzer] Add support for LLVM's LibFuzzer.
* src/tools/ftfuzzer/ftfuzzer.cc, src/tools/runinput.cc: New files.
2015-10-07 22:18:22 +02:00
Alexei Podtelezhnikov 6eb6158dd7 [smooth] Faster alternative line renderer.
This implementation renders the entire line segment at once without
subdividing it into scanlines.  The main speed improvement comes from
reducing the number of divisions to just two per line segment, which
is a bare minimum to calculate cell coverage in a smooth rasterizer.
Notably, the progression from cell to cell does not itself require any
divisions at all.  The speed improvement is more noticeable at larger
sizes.

* src/smooth/ftgrays.c (gray_render_line): New implementation.
2015-10-06 22:39:54 -04:00
Werner Lemberg 066a49139b [cff] Return correct PS names from pure CFF (#46130).
* src/cff/cffdrivr.c (cff_get_ps_name): Use SFNT service only for
SFNT.
2015-10-06 07:55:32 +02:00
Werner Lemberg 30fe5e762e [base] Replace left shifts with multiplication (#46118).
* src/base/ftglyph.c (ft_bitmap_glyph_bbox, FT_Get_Glyph): Do it.
2015-10-04 13:08:08 +02:00
Werner Lemberg 8cabd919ca * Version 2.6.1 released.
=========================

Tag sources with `VER-2-6-1'.

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

* README, Jamfile (RefDoc), builds/windows/vc2005/freetype.vcproj,
builds/windows/vc2005/index.html,
builds/windows/vc2008/freetype.vcproj,
builds/windows/vc2008/index.html,
builds/windows/vc2010/freetype.vcxproj,
builds/windows/vc2010/index.html,
builds/windows/visualc/freetype.dsp,
builds/windows/visualc/freetype.vcproj,
builds/windows/visualc/index.html,
builds/windows/visualce/freetype.dsp,
builds/windows/visualce/freetype.vcproj,
builds/windows/visualce/index.html,
builds/wince/vc2005-ce/freetype.vcproj,
builds/wince/vc2005-ce/index.html,
builds/wince/vc2008-ce/freetype.vcproj,
builds/wince/vc2008-ce/index.html: s/2.6/2.6.1/, s/26/261/.

* include/freetype/freetype.h (FREETYPE_PATCH): Set to 1.

* builds/unix/configure.raw (version_info): Set to 18:1:12.
* CMakeLists.txt (VERSION_PATCH): Set to 1.

* src/autofit/afmodule.c [AF_DEBUG_AUTOFIT]: Ensure C linking for
dumping functions.
2015-10-04 08:18:01 +02:00
Werner Lemberg b260dc9fab [bzip2, gzip] Avoid access of unitialized memory (#46109).
* src/bzip2/ftbzip2.c (ft_bzip2_file_fill_input), src/gzip/ftgzip.c
(ft_gzip_file_fill_input): In case of an error, adjust the limit to
avoid copying uninitialized memory.
2015-10-04 07:39:22 +02:00
Werner Lemberg 53838ce016 [bzip2, gzip] Avoid access of unitialized memory (#46109).
* src/bzip2/ftbzip2.c (ft_bzip2_file_fill_output), src/gzip/ftgzip.c
(ft_gzip_file_fill_output): In case of an error, adjust the limit to
avoid copying uninitialized memory.
2015-10-03 21:12:25 +02:00
Alexei Podtelezhnikov e2dae8fead [smooth] Clean up worker.
* src/smooth/ftgrays.c (gray_TWorker): Remove never used fields.
2015-10-01 22:03:34 -04:00
Werner Lemberg 90e437e3cd [sfnt] Make `tt_cmap4_char_map_linear' more robust (#46078).
* src/sfnt/ttcmap.c (tt_cmap4_char_map_linear): Take care of
border conditions (i.e., if the loop exits naturally).
2015-10-01 20:00:27 +02:00
Werner Lemberg feb1f138b7 CHANGES: Updated. 2015-10-01 17:39:31 +02:00
Werner Lemberg fab67b85ec * src/autofit/afranges.c (af_deva_nonbase_uniranges): Fix ranges.
They should be a subset of `af_deva_uniranges'.
2015-10-01 16:47:05 +02:00
Werner Lemberg f68bd40836 afranges.c: Add some comments. 2015-10-01 16:43:45 +02:00
Werner Lemberg 5f8f44d218 [sfnt] Make `tt_cmap4_char_map_linear' faster (#46078).
* src/sfnt/ttcmap.c (tt_cmap4_char_map_linear): Use inner loop to
reject too large glyph indices.
2015-10-01 14:16:03 +02:00
Alexei Podtelezhnikov 8bbcfb2c2f [smooth] Clean up worker.
* src/smooth/ftgrays.c (gray_TWorker): Remove lightly used `last_ey'.
(gray_start_cell, gray_render_line): Update.
2015-09-30 23:08:53 -04:00
Werner Lemberg dbd04269dc [autofit] Replace `no-base' with `non-base'.
* src/autofit/*: Do it.
2015-09-30 17:52:42 +02:00
Werner Lemberg 2ff83a5c99 [sfnt] Rewrite `tt_cmap4_char_map_linear' (#46078).
* src/sfnt/ttcmap.c (tt_cmap4_char_map_linear): Add code to better
skip invalid segments.
If searching the next character, provide a more efficient logic to
speed up the code.
2015-09-30 14:44:29 +02:00
Werner Lemberg 8651f37ad5 [truetype] Adjust number of glyphs for malformed `loca' tables.
* src/truetype/ttpload.c (tt_face_load_loca): Implement it.
2015-09-30 10:26:10 +02:00
Werner Lemberg 52aad9dfc6 [raster] Minor style fix. 2015-09-29 12:38:11 +02:00
Werner Lemberg 483007fcd9 [pshinter] Avoid harmless overflow (#45984).
* src/pshinter/pshglob.c (psh_blues_set_zones): Fix it.
2015-09-29 11:22:15 +02:00
Werner Lemberg a3046567bc [autofit] Add support for Lao script.
Thanks to Danh Hong <danhhong@gmail.com> for guidance with blue zone
characters!

* src/autofit/afblue.dat: Add blue zone data for Lao.

* src/autofit/afblue.c, src/autofit/afblue.h: Regenerated.

* src/autofit/afscript.h: Add Lao standard characters.

* src/autofit/afranges.c: Add Lao data.

* src/autofit/afstyles.h: Add Lao data.
2015-09-28 09:45:56 +02:00
suzuki toshiya fb5268cf7b [base] Fix a leak by broken sfnt-PS or resource fork (#46028).
open_face_from_buffer() frees passed buffer if valid font
is not found.  But if copying to the buffer is failed,
the allocated buffer should be freed within the caller.

* src/base/ftobjs.c (open_face_PS_from_sfnt_stream): Free
the buffer `sfnt_ps' if an error caused before calling
open_face_from_buffer().
(Mac_Read_sfnt_Resource): Free the buffer `sfnt_data' if
an error caused before calling open_face_from_buffer();
2015-09-28 02:01:43 +09:00
suzuki toshiya 8a05d250df [mac] Fix buffer size calculation for LWFN font.
* src/base/ftmac.c (read_lwfn): Cast post_size to FT_ULong
to prevent confused copy by too large chunk size.
2015-09-28 01:40:21 +09:00
Alexei Podtelezhnikov 3dffe8ef16 Add ChangeLog entry. 2015-09-27 11:30:17 -04:00
Alexei Podtelezhnikov d8a44ff932 Remove unused macro. 2015-09-26 22:33:55 -04:00
Werner Lemberg 19188a9a19 [autofit] Minor tracing improvement.
* src/autofit/aflatin.c (af_latin_metrics_scale_dim): Don't emit
blue zones header line if there are no blue zones.
2015-09-26 16:57:17 +02:00
Werner Lemberg 4187753970 [bzip2, gzip, lzw] Harmonize function signatures with prototype.
Suggested by Hin-Tak Leung.

* src/bzip2/ftbzip2.c (ft_bzip2_stream_io), src/gzip/ftgzip.c
(ft_gzip_stream_io), src/lzw/ftlzw.c (ft_lzw_stream_io): Do it.
2015-09-26 15:19:54 +02:00
Hin-Tak Leung b839872055 Stray character in ChangeLog.21.
Signed-off-by: Hin-Tak Leung <htl10@users.sourceforge.net>
2015-09-26 14:57:27 +02:00
Hin-Tak Leung 265ade8e80 Add new FT_LOAD_COMPUTE_METRICS load flag.
* include/freetype/freetype.h (FT_LOAD_COMPUTE_METRICS): New macro.
* src/truetype/ttgload.c (compute_glyph_metrics): Usage.
2015-09-26 14:51:30 +02:00
Werner Lemberg d57f227121 * src/base/ftobjs.c (Mac_Read_sfnt_Resource): Add cast. 2015-09-26 08:44:26 +02:00
Werner Lemberg d7f456ee17 Formatting, minor comment corrections. 2015-09-26 08:37:14 +02:00
Werner Lemberg 2439c515a7 [type1] Protect against invalid number of glyphs (#46029).
* src/type1/t1load.c (parse_charstrings): Check number of
`CharStrings' dictionary entries against size of data stream.
2015-09-25 16:54:28 +02:00
Werner Lemberg 5339c75ee6 [sfnt] Better checks for invalid cmaps (2/2) (#46019).
While the current code in `FT_Get_Next_Char' correctly rejects
out-of-bounds glyph indices, it can be extremely slow for malformed
cmaps that use 32bit values.  This commit tries to improve that.

* src/sfnt/ttcmap.c (tt_cmap8_char_next, tt_cmap12_next,
tt_cmap12_char_map_binary, tt_cmap13_next,
tt_cmap13_char_map_binary): Reject glyph indices larger than or
equal to the number of glyphs.
2015-09-24 13:39:44 +02:00
Werner Lemberg c409eb18ae [base, sfnt] Better checks for invalid cmaps (1/2).
* src/base/ftobjs.c (FT_Get_Char_Index): Don't return out-of-bounds
glyph indices.
(FT_Get_First_Char): Updated.

* src/sfnt/ttcmap.c (tt_cmap6_char_next): Don't return character
codes greater than 0xFFFF.

(tt_cmap8_char_index): Avoid integer overflow in computation of
glyph index.
(tt_cmap8_char_next): Avoid integer overflows in computation of
both next character code and glyph index.

(tt_cmap10_char_index): Fix unsigned integer logic.
(tt_cmap10_char_next): Avoid integer overflow in computation of
next character code.

(tt_cmap12_next): Avoid integer overflows in computation of both
next character code and glyph index.
(tt_cmap12_char_map_binary): Ditto.
(tt_cmap12_char_next): Simplify.

(tt_cmap13_char_map_binary): Avoid integer overflow in computation
of next character code.
(tt_cmap13_char_next): Simplify.
2015-09-24 12:39:38 +02:00
Werner Lemberg cbdf13e5ca Formatting, documentation improvements. 2015-09-24 12:14:38 +02:00
suzuki toshiya e982f5b78a [base] Check too long POST and sfnt resource (#45919).
* src/base/ftbase.h (FT_MAC_RFORK_MAX_LEN): Maximum length
of the resource fork for Mac OS.  The resource fork larger
than 16 MB can be written but could not be handled
correctly, at least in Carbon routine.
See https://support.microsoft.com/en-us/kb/130437

* src/base/ftobjs.c (Mac_Read_POST_Resource): No need `0x'
for `%p' formatter.

* src/base/ftbase.c (Mac_Read_POST_Resource): Check the
fragment and total size of the concatenated POST resource
before buffer allocation.
(Mac_Read_sfnt_Resource): Check the declared size of
sfnt resource before buffer allocation.

* src/base/ftmac.c (read_lwfn, FT_New_Face_From_SFNT):
Check the total resource size before buffer allocation.
2015-09-21 23:12:09 +09:00
Werner Lemberg 730b6d7468 [sfnt] Improve handling of invalid SFNT table entries (#45987).
This patch fixes weaknesses in function `tt_face_load_font_dir'.

- It incorrectly assumed that valid tables are always at the
  beginning.  As a consequence, some valid tables after invalid
  entries (which are ignored) were never seen.

- Duplicate table entries (this is, having the same tag) were not
  rejected.

- The number of valid tables was sometimes too large, leading to
  access of invalid tables.

* src/sfnt/ttload.c (check_table_dir): Add argument to return number
of valid tables.
Add another tracing message.
(tt_face_load_font_dir): Only allocate table array for valid
entries as returned by `check_table_dir'.
Reject duplicate tables and adjust number of valid tables
accordingly.
2015-09-19 12:41:12 +02:00
Werner Lemberg cb7a5122e1 [pcf] Improve `FT_ABS' fix from 2015-09-17 (#45999).
* src/pcf/pcfread.c (pcf_load_font): Do first the cast to FT_Short,
then take the absolute value.
Also apply FT_ABS to `height'.
2015-09-19 07:58:03 +02:00
Werner Lemberg f28c95c4a4 [type42] Fix memory leak (#45989).
* src/type42/t42parse.c (t42_parse_charstrings): Allow only a single
`CharStrings' array.
2015-09-17 19:30:26 +02:00
Werner Lemberg 4942c2bb72 [psaux] Fix memory leak (#45986).
* src/psaux/psobjs.c (ps_parser_load_field) <T1_FIELD_TYPE_MM_BBOX>:
Free `temp' in case of error.
2015-09-17 17:56:53 +02:00
Werner Lemberg 7d364b7e51 [psaux] Improve tracing message.
* src/psaux/psobjs.c (ps_parser_load_field) <T1_FIELD_TYPE_MM_BBOX>:
Handle plural correctly.
2015-09-17 16:31:58 +02:00
Werner Lemberg c838c4f7b5 [pcf] Fix integer overflows (#45985).
* src/pcf/pcfread.c (pcf_load_font): Use FT_MulDiv.
2015-09-17 16:22:40 +02:00
Werner Lemberg 9db9adda0f [pcf] Use FT_ABS for some property values (#45893).
* src/pcf/pcfread.c (pcf_load_font): Take absolute values for
AVERAGE_WIDTH, POINT_SIZE, PIXEL_SIZE, RESOLUTION_X, and
RESOLUTION_Y.  In tracing mode, add warnings.
2015-09-17 13:42:59 +02:00
Werner Lemberg bd0438a461 Minor fixes for some clang warnings.
* src/base/ftoutln.c (FT_Outline_EmboldenXY): Cast, possible missing
initialization.

* src/truetype/ttgload.c (TT_Process_Composite_Component): Cast.
2015-09-16 18:05:43 +02:00
Werner Lemberg 19cb1127d4 [type1, type42] Fix memory leaks (#45966).
* src/type1/t1load.c (parse_blend_axis_types): Handle multiple axis
names.
(parse_blend_design_map): Allow only a single design map.
(parse_encoding): Handle multiple encoding vectors.

* src/type42/t42parse.c (t42_parse_encoding): Handle multiple
encoding vectors.
2015-09-15 08:52:36 +02:00
Werner Lemberg 7f0f40116d [truetype] Fix integer type (#45965).
* src/truetype/ttobjs.c (tt_synth_sfnt_checksum): Implement it.
2015-09-15 07:23:53 +02:00
Werner Lemberg 577daf1c30 * src/pcf/pcfread.c (pcf_load_font): Fix integer overflow (#45964). 2015-09-15 07:10:16 +02:00
Werner Lemberg 581c7e2a51 [type1, type42] Check encoding array size (#45961).
* src/type1/t1load.c (parse_encoding), src/type42/t42parse.c
(t42_parse_encoding): Do it.
2015-09-15 06:49:06 +02:00
Alexei Podtelezhnikov 3ea0d2c65a * src/base/ftcalc.c (FT_MulFix) [FT_LONG64]: Improve. 2015-09-13 23:19:34 -04:00
Werner Lemberg 7962a15d64 [type1] Fix another potential buffer overflow (#45955).
* src/type1/t1parse (T1_Get_Private_Dict): Assure that check for
`eexec' doesn't exceed `limit'.
2015-09-14 00:38:26 +02:00
Werner Lemberg ff7d640404 Replace `mkinstalldirs' with AC_PROG_MKDIR_P.
* builds/unix/mkinstalldirs: Removed, no longer needed.

* builds/unix/configure.raw: Call `AC_PROG_MKDIR_P'.
Update pwd call for `$INSTALL'.

* builds/unix/unix-def.in (MKINSTALLDIRS): Use `@MKDIR_P@'.

* autogen.sh: Updated.
2015-09-13 23:53:16 +02:00
Werner Lemberg 3df92aa04c [winfonts] Check alignment shift count for resource data (#45938).
* src/winfonts/winfnt.c (fnt_face_get_dll_font): Implement it.
2015-09-13 09:21:52 +02:00
Werner Lemberg e3058617f3 [type1] Fix potential buffer overflow (#45923).
* src/type1/t1parse.c (T1_Get_Private_Dict): Assure `cur' doesn't
point to end of file buffer.
2015-09-13 08:41:43 +02:00
Werner Lemberg e40e8b33a1 [gzip] Fix access of small compressed files (#45937).
* src/gzip/ftgzip.c (ft_gzip_stream_close): Avoid memory leak.

(ft_gzip_get_uncompressed_file): Correct byte order while reading
unsigned long value.  Without this change, the whole optimization of
accessing small files in `FT_Stream_OpenGzip' is never executed!  As
a consequence, access to PCF files in general (which are normally
small files) should be much improved now as originally intended.
2015-09-13 08:05:50 +02:00
Werner Lemberg db5a4a9ae7 [psaux] Fix potential buffer overflow (#45922).
* src/psaux/psobjs.c (ps_parser_skip_PS_token): If a token is
enclosed in balanced expressions, ensure that the cursor position
doesn't get larger than the current limit.
2015-09-12 08:32:55 +02:00
Werner Lemberg 19b82cfbed [base] Avoid crash while tracing `load_mac_face'.
Reported in Savannah bug #45919.

* src/base/ftobjs.c (load_mac_face): Honour FT_OPEN_MEMORY while
tracing.
2015-09-11 20:25:32 +02:00
Werner Lemberg 23423bc6f9 [type42] Fix endless loop (#45920).
* src/type42/t42parse.c (t42_parse_encoding): Synchronize with
type1's `parse_encoding'.
2015-09-11 08:28:27 +02:00
Werner Lemberg b6eef5ae7b Better document various TrueType hinting modes.
Text based on private communication with Greg Hitchcock and added to the
repository with his permission.
2015-09-10 07:44:48 +02:00
Werner Lemberg e5a27a7596 [docmaker] Allow `-' in bold and italic markup.
* src/tools/docmaker/sources.py (re_italic, re_bold): Adjust
accordingly.
2015-09-10 07:44:11 +02:00
Alexei Podtelezhnikov 09948e426e * src/base/ftcalc.c (FT_RoundFix): Improve. 2015-09-09 21:30:15 -04:00
Werner Lemberg 4d406e3907 Update `CHANGES' file. 2015-09-09 08:02:47 +02:00
Wojciech Mamrak 822acb0252 * src/base/ftcalc.c (FT_CeilFix, FT_FloorFix): Normalize.
This commit makes the functions behave as expected, this is,
rounding towards plus or minus infinity.
2015-09-09 07:59:10 +02:00
Wojciech Mamrak 5578199a68 Minor documentation corrections. 2015-09-09 07:52:17 +02:00
Alexei Podtelezhnikov b002f6882d * src/smooth/ftgrays.c (gray_render_line): Simplify clipping. 2015-09-07 13:47:36 -04:00
Alexei Podtelezhnikov 5a6dc87240 [raster,smooth] Microoptimizations.
* src/raster/ftraster.c (Insert_Y_Turn, Finalize_Profile_Table,
Beziier_Up, ): Use do-while loops.

* src/smooth/ftgrays.c (gray_render_scanline, gray_render_line,
gray_convert_glyph): Ditto.
2015-09-04 23:14:46 -04:00
Alexei Podtelezhnikov a9f6f04e56 [autofit] Missing piece. 2015-09-04 22:28:13 -04:00
Werner Lemberg d3cba0ed30 [autofit] Redesign code ranges (2/2).
This commit adds two fallback scripts (`latb', `latp') and
implements support for the no-base character ranges introduced in
the previous commit.

* src/autofit/aftypes.h (AF_ScriptClassRec): Add
`script_uni_nobase_ranges' field.
(AF_DEFINE_SCRIPT_CLASS): Updated.

* src/autofit/afscript.h, src/autofit/afstyles.h: Add `latb' and
`latp' fallback scripts.

* src/autofit/afblue.dat: Add blue zones for Latin subscript and
superscript fallback scripts.

* src/autofit/afblue.c, src/autofit/afblue.h: Regenerated.

* src/autofit/afglobal.h (AF_NOBASE): New style flag for no-base
characters.
(AF_STYLE_MASK): Updated.

* src/autofit/afglobal.c (SCRIPT): Updated.
(af_face_globals_compute_style_coverage): Handle new style flag.

* src/autofit/aflatin.c (af_latin_hints_apply): Handle new style
flag.

* src/autofit/afranges.h (SCRIPT): Use it to export no-base ranges.
2015-09-04 10:28:53 +02:00
Werner Lemberg 696b712691 [autofit] Redesign code ranges (1/2).
This patch introduces auxiliary code ranges that identify no-base
characters; they refer to glyphs of a script that should be hinted
without alignments to blue zones (mostly diacritics).

It also splits off ranges for fallback scripts that handle subscript
and superscript characters not covered by OpenType features.  For
example, this greatly helps improve the hinting of various phonetic
alphabets, which contain a large amount characters that look like
superscript glyphs.

Finally, code ranges are updated to Unicode 8.0, and enclosed
characters are removed in general since they normally look better if
they stay unhinted.

* src/autofit/afranges.c (af_latn_uniranges): Updated to Unicode
8.0.
Split off superscript-like and subscript-like glyphs into...

(af_latb_uniranges, af_latp_uniranges): ... these two new arrays.

(af_xxxx_nobase_uniranges): New arrays that hold no-base characters
of the corresponding character ranges.
2015-09-04 10:10:59 +02:00
Werner Lemberg 8cbbcf6b98 [autofit] Pass glyph index to hinting function.
No functionality change yet.

* src/autofit/aftypes.h (AF_WritingSystem_ApplyHintsFunc): Pass
glyph index.

* src/autofit/afcjk.c, src/autofit/afcjk.h (af_cjk_hints_apply),
src/autofit/afdummy.c (af_dummy_hints_apply), src/autofit/afindic.c
(af_indic_hints_apply), src/autofit/aflatin.c
(af_latin_hints_apply), src/autofit/aflatin2.c
(af_latin2_hints_apply), src/autofit/afloader.c (af_loader_load_g):
Updated.
2015-09-03 06:47:30 +02:00
Werner Lemberg 40103a3af0 [autofit] Code clean-up.
* src/autofit/afglobal.h (AF_STYLE_MASK): New macro.
(AF_STYLE_UNASSIGNED): Use AF_STYLE_MASK for definition.

* src/autofit/afglobal.c (af_face_globals_compute_style_coverage):
Updated.
2015-09-02 05:59:35 +02:00
Werner Lemberg 87c81f0460 [autofit] Make glyph style array use 16bit values.
* include/freetype/ftautoh.h (FT_Prop_GlyphToScriptMap): Use
`FT_UShort' for `map' field.

* src/autofit/afglobal.c (af_face_globals_compute_style_coverage,
af_face_globals_new), src/autofit/hbshim.c, src/autofit/hbshim.h
(af_get_coverage): Use FT_UShort for `glyph_styles' array.

* src/autofit/afglobal.h (AF_STYLE_UNASSIGNED, AF_DIGIT): Extend to
16 bits.
(AF_FaceGlobalsRec): Use `FT_UShort' for `glyph_styles' field.
2015-09-02 05:59:35 +02:00
Alexei Podtelezhnikov 0963526435 Minor. 2015-08-31 23:14:46 -04:00
Alexei Podtelezhnikov 6ec0434ec9 Minor refactoring. 2015-08-30 22:50:48 -04:00
Werner Lemberg 633d8ed2c9 * builds/unix/configure.raw: Need harfbuzz >= 0.9.21 (#45828). 2015-08-26 06:18:47 +02:00
Werner Lemberg 78b014031d [base] Improve kerning tracing and documentation.
* src/base/ftobjs.c (FT_Get_Kerning): Emit tracing message if
scaled-down kerning values differ.
2015-08-25 07:23:01 +02:00
Werner Lemberg 55fed89e3b Remove obsolete comment.
Found by Akira Kakuto <kakuto@fuk.kindai.ac.jp>.
2015-08-24 06:00:49 +02:00
Nikolaus Waxweiler f4b61a6a5d Minor documentation fix. 2015-08-19 06:51:06 +02:00
Werner Lemberg 91d59169a8 [raster] Remove last remnants of `raster5' driver.
* src/raster/ftrend1.h (ft_raster5_renderer_class): Removed.

* src/raster/rastpic.c, src/raster/rastpic.h
(ft_raster5_renderer_class_pic_init,
ft_raster5_renderer_class_pic_free): Removed.
2015-08-18 06:04:36 +02:00
Werner Lemberg 340e59da3a Minor formatting. 2015-08-18 05:56:51 +02:00
Alexei Podtelezhnikov a0172d10e8 [base] Improve emboldener (#45596).
* src/base/ftoutln.c (FT_Outline_EmboldenXY): Correct displacement
of zero-lenght segments.
2015-08-17 22:58:59 -04:00
Alexei Podtelezhnikov 815c32469b Minor. 2015-08-17 21:48:46 -04:00
Alexei Podtelezhnikov 00d899507c [base] Reoptimize aritmetic.
* src/base/ftcalc.c (FT_MulDiv, FT_MulFix) [!FT_LONG64]: Remove
special cases that slow down the general use.
2015-08-16 22:57:34 -04:00
pazer f0ed30e6e6 Fix C++ compilation (#45762).
* src/base/ftstroke.c (ft_outline_glyph_class): Use
FT_CALLBACK_TABLE.
2015-08-15 06:53:09 +02:00
Alexei Podtelezhnikov ae258aa088 [truetype] Clean up.
* src/truetype/ttgload.c (TT_Process_Composite_Component): Use
`FT_Outline_Transform' and `FT_Outline_Translate'.
(translate_array): Dropped.
2015-08-14 23:23:18 -04:00
Werner Lemberg d0d7ee047b * builds/unix/detect.mk (CONFIG_SHELL): Don't handle it (#44261). 2015-08-14 14:30:58 +02:00
Werner Lemberg 14d6b5d748 [truetype] Introduce named instance access to GX fonts.
For functions querying a face, bits 16-30 of the face index can hold
the named instance index if we have a GX font.  The indices start
with value 1; value 0 indicates font access without GX variation
data.

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

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

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

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

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

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

* docs/CHANGES: Updated.
2015-08-13 15:22:17 +02:00
Alexei Podtelezhnikov 4afc0a54ed Comment typos. 2015-08-12 23:51:02 -04:00
Alexei Podtelezhnikov 4a46686508 [type1,cff,cid] Streamline font matrix application.
* src/type1/t1gload.c (T1_Load_Glyph): Directly modify advances only
if font matrix is not trivial.
* src/cff/cffgload.c (cff_slot_load): Ditto.
* sff/cid/cidgload.c (cid_slot_load_glyph): Ditto for advances and the
entire outline.
2015-08-12 23:45:40 -04:00
Werner Lemberg 7ebe6ac87c [builds/unix] Minor.
* builds/unix/configure.raw:
s/lib{priv,staticconf}/libs{priv,staticconf}/ for orthogonality with
similarly named uppercase variables.
2015-08-11 06:47:25 +02:00
Alexei Podtelezhnikov a37da21a49 [type1,cid,type42] Minor improvements.
* src/type1/t1load.c (t1_parse_font_matrix): Scale units per EM only
when necessary. Refresh comments.
* src/cid/cidload.c (cid_parse_font_matrix): Ditto.
* src/type42/t42parse.c (t42_parse_font_matrix): Refresh comments.
2015-08-10 23:05:02 -04:00
Werner Lemberg bd75a517dc [type42] Fix glyph access.
This is a severe bug: We've missed one level of indirection, as
described in the Type 42 specification.  As a result, ftview
sometimes showed incorrect glyphs for given glyph names, and even
displayed `error 0x0006' (invalid argument!) in case the number of
glyph indices differed between the Type 42 font and the embedded
TTF.

Apparently, noone ever noticed it; this shows how much Type 42 fonts
are in use...

* src/type42/t42objs.c (T42_GlyphSlot_Load): Map Type 42 glyph index
to embedded TTF's glyph index.
2015-08-08 08:39:45 +02:00
Werner Lemberg e5f4469359 [type42] Minor clean-up.
* src/type42/t42parse.c (t42_parse_font_matrix): Remove unused
variable.
2015-08-08 07:45:03 +02:00
Alexei Podtelezhnikov fd70512eee [type42] Parse FontMatrix according to specifications.
* src/type42/t42parse.c (t42_parse_font_matrix): Type 42 FontMatrix
does not need scaling by 1000. Units_per_EM are taken from the
embedded TrueType.
2015-08-06 21:49:08 -04:00
Werner Lemberg ff406e2e58 [autofit] Improve Arabic hinting.
Problem reported by Titus Nemeth <tn@tntypography.eu> (by using
ttfautohint).

* src/autofit/afblue.dat: Add neutral blue zone for the tatweel
character.

* src/autofit/afblue.c, src/autofit/afblue.h: Regenerated.
2015-08-06 07:34:50 +02:00
Alexei Podtelezhnikov 98e8e99986 [truetype] Clean up types.
* src/truetype/ttobjs.c (TT_Size): Move declaration from here.
* include/freetype/internal/tttypes.h (TT_Size): ... to here.
(TT_LoaderRec): Switch to appropriate types for `face' and `size'.
* src/truetype/ttgload.c: Remove corresponding type casts.
* src/truetype/ttsubpix.c: Ditto.
2015-08-06 00:06:14 -04:00
Werner Lemberg 15e2a4f790 [autofit] Improve recognition of flat vs. rounded segments.
Lower the flatness threshold from upem/8 to upem/14, making the
auto-hinter accept shorter elements.

Synchronize flat/round stem selection algorithm with blue zone code.

* src/autofit/aflatin.c (FLAT_THRESHOLD): New macro.
(af_latin_metrics_init_blues): Use it.
(af_latin_hints_compute_segments): Collect information on maximum
and minimum coordinates of `on' points; use this to add a constraint
for the flat/round decision similar to
`af_latin_metrics_init_blues'.
2015-08-05 21:53:50 +02:00
Werner Lemberg eb22ef26d9 Another left-shift bug (#45681).
* src/base/ftobjs.c (IsMacBinary): Only accept positive values for
`dlen'.
2015-08-04 06:50:04 +02:00
Alexei Podtelezhnikov 7e6c321a58 [base] Fix `ft_corner_orientation'.
Remove casting from `FT_Long' to `FT_Int' that might change the sign
of the return value and make it faster too.

* src/base/ftcalc.c (ft_corner_orientation): On 32-bit systems, stay
with 32-bit arithmetic when safe. Use plain math on 64-bit systems.
* src/pshinter/pshalgo.c: Remove old unused code.
2015-08-03 23:26:13 -04:00
Werner Lemberg 8dfc760161 * src/truetype/ttgload.c (load_truetype_glyph)
[TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Fix crash for composite glyphs
having a depth greater than 1.
2015-08-03 12:23:30 +02:00
Werner Lemberg ca6a5cf4b8 Fix typo in clang bug from 2015-07-31 (#45678).
* src/base/ftrfork.c (FT_Raccess_Get_HeaderInfo): Fix inequality.
2015-08-03 08:51:18 +02:00
Werner Lemberg a82c45d53b * CMakeLists.txt: Improve shared library support.
Based on a patch from John Cary <cary@txcorp.com>.
2015-08-02 18:35:49 +02:00
Werner Lemberg 682c27195b * builds/unix/freetype-config.in (enable_shared): Remove. Unused. 2015-08-02 15:46:26 +02:00
Werner Lemberg 4f009174d8 Comment typo. 2015-08-02 10:05:00 +02:00
Werner Lemberg 70e9d81577 Fix more invalid left-shifts.
* src/pfr/pfrgload.c (pfr_glyph_load_compound): Use multiplication,
not left-shift.

* src/truetype/ttgxvar.c (ft_var_load_avar, ft_var_load_gvar,
tt_face_vary_cvt, TT_Vary_Apply_Glyph_Deltas): Use multiplication,
not left-shift.
2015-08-02 09:42:12 +02:00
Werner Lemberg 6343ba22a3 Fix some bugs found by clang's `-fsanitize=undefined' (#45661).
* src/base/ftrfork.c (FT_Raccess_Get_HeaderInfo): Only accept
positive values from header.
Check overflow.

* src/base/ftoutln.c (SCALED): Correctly handle left-shift of
negative values.

* src/bdf/bdf.h (_bdf_glyph_modified, _bdf_set_glyph_modified,
_bdf_clear_glyph_modified): Use unsigned long constant.

* src/bdf/bdfdrivr.c (BDF_Size_Select, BDF_Glyph_Load): Don't
left-shift values that can be negative.

* src/pcf/pcfdrivr.c (PCF_Size_Select, PCF_Glyph_Load): Don't
left-shift values that can be negative.

* src/raster/ftraster.c (SCALED): Correctly handle left-shift of
negative values.

* src/sfnt/ttsbit.c (tt_face_load_strike_metrics): Don't left-shift
values that can be negative.

* src/truetype/ttgload.c (TT_Load_Composite_Glyph,
compute_glyph_metrics, load_sbit_image): Don't left-shift values
that can be negative.
2015-08-01 07:53:48 +02:00
Werner Lemberg 5d1b8ab4d0 Define FT_LONG_MAX.
* include/freetype/config/ftstdlib.h (FT_LONG_MAX): New macro.
* src/cff/cf2arrst.c (cf2_arrstack_setNumElements): Use it.
2015-07-31 21:49:07 +02:00
Alexei Podtelezhnikov 2b07a5ae3d * src/base/ftcalc.c (FT_Vector_NormLen): Clarify. 2015-07-28 23:14:30 -04:00
Werner Lemberg a50a045890 Minor. 2015-07-28 07:37:19 +02:00
Werner Lemberg 0e60b67faf Minor. 2015-07-28 06:44:40 +02:00
Alexei Podtelezhnikov e8b186eedb * src/base/ftcalc.c (FT_Vector_NormLen): Explicate type conversions. 2015-07-27 23:22:34 -04:00
Werner Lemberg c1c0720cc3 Document previous bug fix. 2015-07-27 05:43:19 +02:00
Matthias Clasen b650dfbb0b [cff] Don't use `hmtx' table for LSB (#45520).
* src/cff/cffgload.c (cff_slot_load): Use `htmx' table for advance
width only.  Bug introduced 2015-04-10.
2015-07-26 21:08:34 +02:00
Werner Lemberg b3fce59d52 Describe error values and strings in the documentation. 2015-07-23 13:35:07 +02:00
Werner Lemberg f9be567f5f Better support of user-supplied C++ namespaces.
See

  http://lists.nongnu.org/archive/html/freetype-devel/2015-07/msg00008.html

for a rationale.

* src/autofit/afpic.h, src/base/basepic.h, src/cff/cffpic.h,
src/pshinter/pshpic.h, src/psnames/pspic.h, src/raster/rastpic.h,
src/sfnt/sfntpic.h, src/smooth/ftspic.h, src/truetype/ttpic.h
(FT_BEGIN_HEADER, FT_END_HEADER): Move macro calls to not enclose
header files that contain FT_{BEGIN,END}_HEADER macros by
themselves.

* src/autofit/aftypes.h [FT_DEBUG_AUTOFIT]: Include
FT_CONFIG_STANDARD_LIBRARY_H earlier.

* src/truetype/ttpic.h: Include FT_INTERNL_PIC_H.
2015-07-09 15:10:31 +02:00
Werner Lemberg 1cdac10d3a [sfnt] Make `tt_face_get_name' member of the SFNT interface.
* include/freetype/internal/sfnt.h (TT_Get_Name_Func): New
prototype.
(SFNT_Interface, FT_DEFINE_SFNT_INTERFACE): New member `get_name'.

* src/sfnt/sfdriver.c (sfnt_interface): Updated.

* src/sfnt/sfobjs.c (tt_face_get_name): Tag it with `LOCAL_DEF'.
* src/sfnt/sfobjs.h: Add prototype for it.
2015-07-07 14:04:44 +02:00
Werner Lemberg 6f91896980 Minor documentation issue. 2015-07-04 11:35:28 +02:00
Werner Lemberg eb1bba9be4 Fix some clang compiler warnings.
* src/base/ftoutln.c (FT_Outline_EmboldenXY), src/cff/cf2intrp.c
(cf2_interpT2CharString), src/truetype/ttgload.c
(load_truetype_glyph), src/truetype/ttgxvar.c (tt_handle_deltas),
src/truetype/ttinterp.c (Ins_INSTCTRL): Fix signedness issues.
2015-06-30 09:46:39 +02:00
Alexei Podtelezhnikov 5aaabb44bc [truetype] Speed up bytecode interpreter.
* src/truetype/ttinterp.c (Normalize): Use `FT_Vector_NormLen'.
2015-06-29 22:46:54 -04:00
Alexei Podtelezhnikov 9ef02bd41a [base] Speed up emboldening.
* src/base/ftoutln.c (FT_Outline_EmboldenXY): Use `FT_Vector_NormLen'.
2015-06-29 22:39:10 -04:00
Alexei Podtelezhnikov 884e4e67ee [base] Implement fast vector normalization.
The function uses Newton's iterations instead of dividing vector
components by its length, which needs a square root. This is,
literally, a bit less accurate but a lot faster.

* src/base/ftcalc.c (FT_Vector_NormLen): New function.
2015-06-29 22:32:05 -04:00
Werner Lemberg 7cdc77f229 * CMakeLists.txt: Always create `ftconfig.h'.
For non-UNIX builds, the file stays unmodified.  However, it's
better to have the main configuration files at the same place
regardless of the OS.
2015-06-28 11:40:02 +02:00
Werner Lemberg 050553725d Update comments. 2015-06-28 11:07:07 +02:00
Werner Lemberg 2c89e2c97b * CMakeLists.txt: Improve MSVC support (#43737). 2015-06-28 11:06:47 +02:00
Werner Lemberg 52c9b1aaf3 [cmake] Check for libraries and create `ftoption.h'.
* builds/FindHarfBuzz.cmake: New file, taken from

  https://trac.webkit.org/browser/trunk/Source/cmake/FindHarfBuzz.cmake

* CMakeLists.Txt: Add path to local cmake modules.
Find dependencies for zlib, bzip2, libpng, and harfbuzz.
Create `ftoption.h' file.
Set up include and linker stuff for libraries.
2015-06-28 11:03:10 +02:00
Werner Lemberg 97b757de4b * CMakeLists.txt: Fix creation of `ftconfig.h'.
Check for UNIX header files using `check_include_file'.
Set up correct header include directories.
2015-06-28 10:42:47 +02:00
Werner Lemberg 22479ca825 * CMakeLists.txt: Disallow in-source builds. 2015-06-28 10:26:33 +02:00
Werner Lemberg 802f6a9abd * src/tools/docmaker/utils.py (check_output): Add missing `\n'. 2015-06-27 07:12:42 +02:00
Werner Lemberg 1982a88d5c Fix ChangeLog file.
Correct result of `git pull -r'.
2015-06-26 06:52:34 +02:00
Werner Lemberg 94c79c2029 * CMakeLists.txt: Select platform-dependend `ftdebug.c'. 2015-06-26 06:48:01 +02:00
Werner Lemberg 68222dd122 * CMakeLists.txt: Use cmake functions for generating `ftconfig.h'.
Additionally, do this for UNIX only.
2015-06-26 06:48:01 +02:00
Werner Lemberg 5ef5a4fd8b * CMakeLists.txt (BASE_SRCS): Use `ftbase.c' and `psnames.c'. 2015-06-26 06:48:01 +02:00
Werner Lemberg 392cf22f8a Another adjustment to header locations.
This change is a result of a discussion thread on freetype-devel

  http://lists.nongnu.org/archive/html/freetype-devel/2015-06/msg00041.html

Re-introduce the `freetype2' subdirectory for all FreeType header
files after installation, and rename the `freetype2' subdirectory in
the git repository to `freetype'.

* include/freetype2: Renamed to...
* include/freetype: This.

* CMakeLists.txt (PUBLIC_HEADERS, PUBLIC_CONFIG_HEADERS,
PRIVATE_HEADERS): Updated.
Update creation of `ftconfig.h'.
Install generated `ftconfig.h'.

* Jamfile (HDRMACRO, RefDoc), autogen.sh: Updated.

* builds/amiga/include/config/ftconfig.h, builds/freetype.mk
(PUBLIC_DIR), builds/symbian/bld.inf, builds/toplevel.mk (work),
builds/unix/freetype2.in: Updated.

* builds/unix/freetype-config.in: Updated.
* builds/unix/configure.raw: Don't check for `rmdir'.
* builds/unix/unix-def.in (DELDIR): Use `rm -rf', which is portable
according to the autoconf info manual.
* builds/unix/install.mk (install, uninstall,
distclean_project_unix): Update and simplify.

* builds/wince/*, builds/windows/*: Updated.

* devel/ft2build.h, include/ft2build.h: Updated.

* include/freetype2/config/ftheader.h,
include/freetype2/internal/ftserv.h,
include/freetype2/internal/internal.h: Update all header file
macros.

* src/tools/chktrcmp.py (TRACE_DEF_FILES): Updated.

* docs/*: Updated.
2015-06-26 06:48:00 +02:00
Alexei Podtelezhnikov 41bfbadcd3 * src/bdf/bdflib.c (_bdf_parse_start): Disallow 0 bpp. 2015-06-24 23:57:19 -04:00
Alexei Podtelezhnikov 4308b7b1af * src/bdf/bdflib.c (_bdf_parse_start): Simplify bpp parsing. 2015-06-24 23:31:17 -04:00
Werner Lemberg 5931268eec s/TYPEOF/FT_TYPEOF/ (#45376).
* builds/unix/ftconfig.in, builds/vms/ftconfig.in,
include/freetype2/config/ftconfig.h,
include/freetype2/internal/ftobjs.h, src/autofit/afwarp.h: Do it.
2015-06-23 09:24:48 +02:00
Werner Lemberg 75a941098f Typo. 2015-06-22 06:50:38 +02:00
Werner Lemberg 8502c98b15 Fix Savannah bug #45097.
We no longer `pollute' the namespace of possible header file names;
instead we move `ft2build.h' up by one level so that it gets
installed in the default include directory (e.g.,
/usr/local/include).  After this commit, only `ft2build.h' stays in
the compiler's include path.

No visible changes for the user who follows the standard FreeType
header inclusion rules.

* include/*: Move to ...
* include/freetype2/*: This directory, except `ft2build.h'.

* CMakeLists.txt (PUBLIC_HEADERS, PUBLIC_CONFIG_HEADERS,
PRIVATE_HEADERS), Jamfile (HDRMACRO, RefDoc), autogen.sh: Updated.

* builds/amiga/include/config/ftconfig.h, builds/freetype.mk
(PUBLIC_DIR), builds/symbian/bld.inf, builds/toplevel.mk (work),
builds/unix/install.mk (install, uninstall),
builds/unix/freetype2.in: Updated.

* builds/unix/freetype-config.in: Updated.
Emit -I directory only if it is not `/usr/include'.

* builds/wince/*, builds/windows/*: Updated.

* devel/ft2build.h, include/ft2build.h: Updated.

* include/freetype2/config/ftheader.h,
include/freetype2/internal/ftserv.h,
include/freetype2/internal/internal.h: Update all header file
macros.

* src/tools/chktrcmp.py (TRACE_DEF_FILES): Updated.

* docs/*: Updated.
2015-06-22 06:35:23 +02:00
Werner Lemberg 31d97df99f Make Jam support work again.
This is just very basic stuff and just a little bit tested on
GNU/Linux only.  I won't delve into this since I'm not a Jam user.

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

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

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

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

* src/base/Jamfile, src/cff/Jamfile, src/sfnt/Jamfile,
src/truetype/Jamfile (_sources): Add missing files.
2015-06-21 19:12:12 +02:00
Werner Lemberg 5025ed7b00 Minor documentation improvement. 2015-06-18 06:24:28 +02:00
Werner Lemberg 1a147ac004 Fix Savannah bug #45326.
* src/sfnt/sfntpic.h (SFNT_SERVICES_GET): Remove duplicate
definitions.
2015-06-16 10:20:07 +02:00
Werner Lemberg e186230678 * Version 2.6 released.
=======================

Tag sources with `VER-2-6'.

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

* README, Jamfile (RefDoc), builds/windows/vc2005/freetype.vcproj,
builds/windows/vc2005/index.html,
builds/windows/vc2008/freetype.vcproj,
builds/windows/vc2008/index.html,
builds/windows/vc2010/freetype.vcxproj,
builds/windows/vc2010/index.html,
builds/windows/visualc/freetype.dsp,
builds/windows/visualc/freetype.vcproj,
builds/windows/visualc/index.html,
builds/windows/visualce/freetype.dsp,
builds/windows/visualce/freetype.vcproj,
builds/windows/visualce/index.html,
builds/wince/vc2005-ce/freetype.vcproj,
builds/wince/vc2005-ce/index.html,
builds/wince/vc2008-ce/freetype.vcproj,
builds/wince/vc2008-ce/index.html: s/2.5.5/2.6/, s/255/26/.

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

* builds/unix/configure.raw (version_info): Set to 18:0:12.
* CMakeLists.txt (VERSION_MINOR): Set to 0.
(VERSION_PATCH): Set to 6.

* src/autofit/afmodule.c [!FT_MAKE_OPTION_SINGLE_OBJECT]: Add
declarations for dumping functions.

* src/truetype/ttinterp.c (TT_New_Context): Pacify compiler.

* builds/toplevel.mk: Use `freetype.mk's code to compute the version
string.
Don't include a zero patch level in version string.
* builds/freetype.mk: Remove code for computing the version string.
2015-06-07 16:11:18 +02:00
Werner Lemberg 701f604cb8 Minor. 2015-06-06 23:52:42 +02:00
Ashish Azad 472119ac56 Fix Savannah bug #45260.
* src/pfr/pfrdrivr.c (pfr_get_kerning): Fix typo.
2015-06-06 05:45:17 +02:00
Werner Lemberg 75534a0432 [truetype] Fix memory leak.
Problem reported by Grissiom <chaos.proton@gmail.com>; in

  http://lists.nongnu.org/archive/html/freetype/2015-05/msg00013.html

there is an example code to trigger the bug.

* src/truetype/ttobjs.c (tt_size_init_bytecode): Free old `size'
data before allocating again.  Bug most probably introduced four
years ago in version 2.4.3.
2015-06-03 00:54:09 +02:00
Werner Lemberg d1ade6d11a [raster] Add more tracing.
* src/raster/ftraster.c (FT_TRACE7) [_STANDALONE_]: Define.
(Vertical_Sweep_Span, Vertical_Sweep_Drop, Horizontal_Sweep_Span,
Horizontal_Sweep_Drop, Render_Glyph): Add tracing calls.
2015-06-02 11:44:52 +02:00
Werner Lemberg 54d042861b [truetype] While tracing opcodes, show code position and stack.
* src/truetype/ttinterp.c: Change all existing TRACE7 calls to
TRACE6.
(opcode_name): Add string lengths.
(TT_RunIns): Implement display of code position and stack.
2015-06-01 12:12:06 +02:00
Werner Lemberg 764ddcc164 Update `CHANGES' file. 2015-05-31 12:32:11 +02:00
Werner Lemberg e9df4e47e3 [truetype] In GX, make private point numbers work correctly.
This is completely missing in Apple's documentation: If a `gvar'
tuple uses private point numbers (this is, deltas are specified for
some points only), the uncovered points must be interpolated for
this tuple similar to the IUP bytecode instruction.  Examples that
need this functionality are glyphs `Oslash' and `Q' in Skia.ttf.

* src/truetype/ttgxvar.c (tt_delta_shift, tt_delta_interpolate,
tt_handle_deltas): New functions.
(TT_Vary_Get_Glyph_Deltas): Renamed to...
(TT_Vary_Apply_Glyph_Deltas): ... this; it directly processes the
points and does no longer return an array of deltas.
Add tracing information.
Call `tt_handle_deltas' to interpolate missing deltas.
Also fix a minor memory leak in case of error.

* src/truetype/ttgxvar.h: Updated.

* src/truetype/ttgload.c (TT_Process_Simple_Glyph,
load_truetype_glyph): Updated.
2015-05-31 12:21:34 +02:00
Werner Lemberg 9845c1d4e9 [truetype] In GX, make intermediate tuplets work at extrema.
* src/truetype/ttgxvar.c (ft_var_apply_tuple): Fix range condition.
2015-05-31 11:57:31 +02:00
Werner Lemberg cdee7d1423 [truetype] Add tracing information to GX code.
* src/truetype/ttgxvar.c (ft_var_load_avar, ft_var_load_gvar,
ft_var_apply_tuple, TT_Get_MM_Var, TT_Set_MM_Blend,
TT_Set_Var_Design, tt_face_vary_cvt): Do it.
2015-05-31 11:54:42 +02:00
Werner Lemberg a678560dc2 Minor. 2015-05-28 17:31:15 +02:00
Werner Lemberg 366b2ea748 * src/tools/apinames.c (names_dump): Fix invalid reference.
Problem reported by Guzman Mosqueda, Jose R
<jose.r.guzman.mosqueda@intel.com>.
2015-05-28 10:58:40 +02:00
Werner Lemberg a5e1f6f39b [truetype] Fix commit from 2015-05-22.
* src/truetype/ttgload.c, src/truetype/ttinterp.c: Guard new code
with `TT_CONFIG_OPTION_SUBPIXEL_HINTING'.

Problem reported by Nikolaus Waxweiler <madigens@gmail.com>.
2015-05-24 23:29:23 +02:00
Werner Lemberg 7f0994820b [truetype] Fix return values of GETINFO bytecode instruction.
* src/truetype/ttinterp.h (TT_ExecContextRec): New fields
`vertical_lcd' and `gray_cleartype'.

* src/truetype/ttgload.c (tt_loader_init): Initialize new fields.
Change `symmetrical smoothing' to TRUE, since FreeType produces
exactly this.

* src/truetype/ttinterp.c (Ins_GETINFO): Fix selector/return bit
values for symmetrical smoothing, namely 11/18.
Handle bits for vertical LCD subpixels (8/15) and Gray ClearType
(12/19).
2015-05-24 09:50:24 +02:00
Werner Lemberg 25a9bd9be0 Clean up and improve description of MS hinting engine versions. 2015-05-24 09:21:31 +02:00
Werner Lemberg bb435da213 [truetype] Minor.
* src/truetype/ttinterp.h (TT_ExecContext):
 s/subpixel/subpixel_hinting.

* src/truetype/ttgload.c, src/truetype/ttgload.h: Updated.
2015-05-23 07:21:25 +02:00
Werner Lemberg c61cad868b [truetype] Support selector index 3 of the INSTCTRL instruction.
This flag activates `native ClearType hinting', disabling backwards
compatibility mode as described in Greg Hitchcocks whitepaper.  In
other words, it enables unrestricted functionality of all TrueType
instructions in ClearType.

* src/truetype/ttgload.c (tt_get_metrics): Call `sph_set_tweaks'
unconditionally.
(tt_loader_init): Unset `ignore_x_mode' flag if bit 2 of
`GS.instruct_control' is active.

* src/truetype/ttinterp.c (Ins_INSTCTRL): Handle selector index 3.
(Ins_GETINFO): Updated.

* docs/CHANGES: Document it.
2015-05-22 22:02:15 +02:00
Werner Lemberg 790b8dfbff [truetype] Minor. 2015-05-20 12:33:40 +02:00
Werner Lemberg 0a6b6ff7c6 [truetype] Fix loading of composite glyphs.
* src/truetype/ttgload.c (TT_Load_Composite_Glyph): If the
ARGS_ARE_XY_VALUES flag is not set, handle argument values as
unsigned.  I trust `ttx' (which has exactly such code) that it does
the right thing here...

The reason that noone has ever noticed this bug is probably the fact
that point-aligned subglyphs are rare, as are subglyphs with a
number of points in the range [128;255], which is quite large (or
even in the range [32768;65535], which is extremely unlikely).
2015-05-17 22:54:48 +02:00
Chris Liddell a87fb8ccf3 [cff] Make the `*curveto' operators more tolerant.
* src/cff/cf2intrp.c (cf2_interpT2CharString): The opcodes
`vvcurveto', `hhcurveto', `vhcurveto', and `hvcurveto' all iterate,
pulling values off the stack until the stack is exhausted.
Implicitly the stack must be a multiple (or for subtly different
behaviour) a multiple plus a specific number of extra values deep.
If that's not the case, enforce it (as the old code did).
2015-05-12 07:27:35 +02:00
Chris Liddell d65bf72c3e [cff] fix incremental interface with new cff code.
* src/cff/cf2ft.c (cf2_getSeacComponent): When using the incremental
interface to retrieve glyph data for a SEAC, it be left to the
incremental interface callback to apply the encoding to raw
character index (as it was in the previous code).
2015-05-12 07:16:46 +02:00
Alexei Podtelezhnikov 4091495271 [autofit] Speed up IUP.
* src/autofit/afhints.c (af_iup_interp): Separate trivial snapping to
the same position from true interpolation, use `scale' to reduce divisions.
2015-04-29 21:57:30 -04:00
Werner Lemberg 9178a1228f Update `CHANGES' file. 2015-04-28 10:56:19 +02:00
Werner Lemberg 3cc076dae7 [cff] Use `name' table for PS name if we have a SFNT-CFF.
This follows the OpenType 1.7 specification.  See

  http://tug.org/pipermail/tex-live/2015-April/036634.html

for a discussion.

* src/cff/cffdrivr.c (cff_get_ps_name): Use the `sfnt' service if we
have an SFNT.
2015-04-28 09:16:27 +02:00
Alexei Podtelezhnikov 40623a1f3a [truetype] Speed up IUP.
* src/truetype/ttinterp.c (_iup_worker_interpolate): Separate trivial
snapping to the same position from true interpolation.
2015-04-27 22:27:00 -04:00
Alexei Podtelezhnikov b6c511d9d0 * src/base/ftoutln.c: Minor. 2015-04-24 00:10:40 -04:00
Werner Lemberg 14df6b1a63 [autofit] By default, enable warping code but switch off warping.
Suggested by Behdad.

* include/config/ftoption.h: Define AF_CONFIG_OPTION_USE_WARPER.

* src/autofit/afmodule.c (af_autofitter_init): Initialize `warping'
with `false'.
2015-04-22 11:14:35 +02:00
Werner Lemberg d164f70df8 * docs/CHANGES: Updated. 2015-04-21 07:51:41 +02:00
Werner Lemberg 12661a5ae0 [autofit] Introduce `warping' property.
This code replaces the debugging hook from the previous commit with
a better, more generic solution.

* include/ftautoh.h: Document it.

* src/autofit/afmodule.h (AF_ModuleRec)
[AF_CONFIG_OPTION_USE_WARPER]: Add `warping' field.

* src/autofit/afmodule.c (_af_debug_disable_warper): Remove.
(af_property_set, af_property_get, af_autofitter_init)
[AF_CONFIG_OPTION_USE_WARPER]: Handle `warping' option.

* src/autofit/afhints.h (AF_HINTS_DO_WARP): Remove use of the no
longer existing `_af_debug_disable_warper'.

* src/autofit/afcjk.c (af_cjk_hints_init), src/autofit/aflatin.c
(af_latin_hints_init), src/autofit/aflatin2.c (af_latin2_hints_init)
[AF_CONFIG_OPTION_USE_WARPER]: Add `AF_SCALER_FLAG_NO_WARPER' to the
scaler flags if warping is off.

* src/autofit/aftypes.h: Updated.
2015-04-21 07:13:59 +02:00
Werner Lemberg b51f01583f Minor. 2015-04-21 06:47:52 +02:00
Werner Lemberg 58f48f0ddc [autofit] Add debugging hook to disable warper.
* src/autofit/afmodule.c (_af_debug_disable_warper)
[FT_DEBUG_AUTOFIT]: New global variable.

* src/autofit/aftypes.h: Updated.
(AF_SCALER_FLAG_NO_WARPER): New macro (not actively used yet).

* src/autofit/afhints.h (AF_HINTS_DO_WARP): New macro.

* src/autofi/aflatin.c (af_latin_hints_apply)
[AF_CONFIG_OPTION_USE_WARPER]: Use `AF_HINTS_DO_WARP' to control use
of warper.

* src/autofit/afcjk.c (af_cjk_hints_init, af_cjk_hints_apply)
[AF_CONFIG_OPTION_USE_WARPER]: Synchronize with `aflatin.c'.

* src/autofit/aflatin2.c (af_latin2_hints_apply)
[AF_CONFIG_OPTION_USE_WARPER]: Synchronize with `aflatin.c'.
2015-04-16 20:11:49 +02:00
Alexei Podtelezhnikov 792db0b9a9 [cff,cid,pfr,sfnt,winfonts] NULL. 2015-04-15 23:20:23 -04:00
Alexei Podtelezhnikov eae1b3e371 [autofit,pshinter] NULL. 2015-04-13 22:40:17 -04:00
Alexei Podtelezhnikov eabc8d72e0 [psaux,psnames,type1,type42] NULL. 2015-04-12 23:16:48 -04:00
Alexei Podtelezhnikov adb08efcf1 [bdf,pcf,truetype] NULL. 2015-04-11 23:54:19 -04:00
Alexei Podtelezhnikov 9de55e0355 [base] NULL. 2015-04-10 23:45:11 -04:00
Werner Lemberg 5cd2155113 [cff] Update advance width handling to OpenType 1.7.
Problem reported by Behdad.

* src/cff/cffdrivr.c (cff_get_advances): Handle SFNT case
separately.

* src/cff/cffgload.c (cff_slot_load): Use advance width and side
bearing values from `hmtx' table if present.
2015-04-10 07:01:01 +02:00
Alexei Podtelezhnikov 67b912d2fa * src/autofit/afhints.c (af_glyph_hints_reload): Use do-while loop. 2015-04-03 22:38:11 -04:00
Alexei Podtelezhnikov 770b5d0647 * src/autofit/aflatin.c (af_latin_hint_edges): Reduce logic. 2015-04-02 23:15:36 -04:00
Alexei Podtelezhnikov 886f4d0493 [autofit] Finish the thought.
* src/autofit/afhints.c (af_direction_compute): make sure the long arm
is never negative so that its `FT_ABS' is not necessary.
2015-04-01 22:57:43 -04:00
Werner Lemberg a2fa657a03 [autofit] Call dumper functions for tracing.
* src/autofit/afcjk.c (af_cjk_hints_apply): Remove dead code.
* src/autofit/afhints.c (af_glyph_hints_dump_points): Minor
improvement.
* src/autofit/afmodule.c (af_autofitter_load_glyph): Implement it.
2015-04-01 15:55:41 +02:00
Werner Lemberg db8df797d0 [autofit] Make debugging stuff work again.
The interface to ftgrid was broken in the series of commits starting
with

  [autofit] Allocate AF_Loader on the stack instead of AF_Module.

from 2015-01-14.

* src/autofit/afmodule.c (_af_debug_hints_rec) [FT_DEBUG_AUTOFIT]:
Use a global AF_GlyphHintsRec object for debugging.
(af_autofitter_done, af_autofitter_load_glyph): Updated.

* src/autofit/afloader.c (af_loader_init, af_loader_done): Updated.
2015-04-01 13:30:55 +02:00
Werner Lemberg 16217e5f22 * src/autofit/afhints.c (af_glyph_hints_done): Fix minor thinko. 2015-04-01 13:13:56 +02:00
Werner Lemberg f353a38e87 [cff] Fix Savannah bug #44629.
* src/cff/cf2font.h (CF2_MAX_SUBR), src/cff/cffgload.h
(CFF_MAX_SUBRS_CALLS): Set to 16.
2015-03-29 14:47:49 +02:00
Werner Lemberg 10e2bb8b3d [type1, truetype] Make the MM API more flexible w.r.t. `num_coords'.
This commit allows `num_coords' to be larger or smaller than the
number of available axes while selecting a design instance, either
ignoring excess data or using defaults if data is missing.

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

* src/type1/t1load.c (T1_Set_MM_Blend, T1_Set_MM_Design,
T1_Set_Var_Design): Ditto.
2015-03-29 13:32:47 +02:00
Werner Lemberg dd5d6d7a80 [type1] Minor.
* src/type1/t1load.c (T1_Set_MM_Blend, T1_Set_MM_Design): Use
FT_THROW.
(T1_Set_Var_Design): Use T1_MAX_MM_AXIS and FT_THROW.
2015-03-29 10:04:22 +02:00
Werner Lemberg 8ce3026304 [cff] Trace charstring nesting levels.
* src/cff/cf2intrp.c (cf2_interpT2CharString) <cf2_cmdCALLGSUBR,
cf2_cmdCALLSUBR, cf2_cmdRETURN>: Implement it.

* src/cff/cffgload.c (cff_decoder_parse_charstrings)
<cff_op_callsubr, cff_op_callgsubr, cff_op_return>: Ditto.
2015-03-27 08:33:47 +01:00
Alexei Podtelezhnikov dac5644cea [base] Optimize `FT_Angle_Diff'.
Under normal circumstances we are usually close to the desired range
of angle values, so that the remainder is not really necessary.

* src/base/fttrigon.c (FT_Angle_Diff): Use loops instead of remainder.

* src/autofit/aftypes.h (AF_ANGLE_DIFF): Ditto in the unused macro.
2015-03-21 23:30:16 -04:00
Werner Lemberg 6cc425db91 [truetype] Improve `gvar' handling.
* src/truetype/ttgxvar.c (ft_var_readpackedpoints): Correctly handle
single-element runs.  Cf. glyph `Q' in Skia.ttf with weights larger
than the default.
2015-03-21 06:51:07 +01:00
Alexei Podtelezhnikov 2d7284e962 * src/base/fttrigon.c (FT_Vector_Rotate): Minor refactoring. 2015-03-20 21:34:19 -04:00
Werner Lemberg 772a5e5ddd Update links to Apple's TrueType specification. 2015-03-20 09:40:10 +01:00
Alexei Podtelezhnikov 6a17172687 Fix Savannah bug #44412 (part 2).
* src/base/fttrigon.c (FT_Sin, FT_Cos, FT_Tan): Call `FT_Vector_Unit'.
2015-03-17 22:43:08 -04:00
Werner Lemberg d3284462c3 [autofit] Add support for Arabic script.
Thanks to Titus Nemeth <tn@tntypography.eu> for guidance!

* src/autofit/afblue.dat: Add blue zone data for Arabic.

* src/autofit/afblue.c, src/autofit/afblue.h: Regenerated.

* src/autofit/afscript.h: Add Arabic standard characters.

* src/autofit/afranges.c: Add Arabic data.

* src/autofit/afstyles.h: Add Arabic data.

* docs/CHANGES: Document it.
2015-03-11 16:45:58 +01:00
Werner Lemberg a451638ec5 Rename `svxf86nm.h' to `svfntfmt.h'; update related symbols.
* include/internal/ftserv.h (FT_SERVICE_XFREE86_NAME_H): Renamed
to...
(FT_SERVICE_FONT_FORMAT_H): This.

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

src/base/ftfntfmt.c, src/bdf/bdfdrivr.c, src/cff/cffdrivr.c,
src/cid/cidriver.c, src/pcf/pcfdrivr.c, src/pfr/pfrdrivr.c,
src/truetype/ttdriver.c, src/type1/t1driver.c,
src/type42/t42drivr.c, src/winfonts/winfnt.c: Updated.
2015-03-11 08:55:12 +01:00
Werner Lemberg ba53879ea9 Minor. 2015-03-11 08:54:33 +01:00
Werner Lemberg dd7028c46e Rename `FT_XFREE86_H' to `FT_FONT_FORMATS_H'.
* include/config/ftheader.h: Implement it.
* src/base/ftfntfmt.c, docs/CHANGES: Updated.
2015-03-11 08:54:12 +01:00
Werner Lemberg f4d1c11faa Rename `FT_Get_X11_Font_Format' to `FT_Get_Font_Format'.
* include/ftfntfmt.h, src/base/ftfntfmt.c: Implement it.

* docs/CHANGES: Updated.
2015-03-11 08:54:08 +01:00
Werner Lemberg 3e58779675 Minor copyright and e-mail address issues. 2015-03-11 08:48:15 +01:00
Werner Lemberg cb0f7b65a8 Fix automatic copyright updating.
* src/tools/update-copyright: Make scanning of `no-copyright'
actually work.

* src/tools/no-copyright: Don't include README in general.
2015-03-11 08:47:48 +01:00
Werner Lemberg 0633995b55 Rename `ftxf86.[ch]' to `ftfntfmt.[ch]'.
CMakeLists.txt, builds/amiga/makefile, builds/amiga/makefile.os4,
builds/amiga/smakefile, builds/mac/FreeType.m68k_cfm.make.txt,
builds/mac/FreeType.m68k_far.make.txt,
builds/mac/FreeType.ppc_carbon.make.txt,
builds/mac/FreeType.ppc_classic.make.txt, builds/symbian/bld.inf,
builds/symbian/freetype.mmp, builds/wince/vc2005-ce/freetype.vcproj,
builds/wince/vc2008-ce/freetype.vcproj,
builds/windows/vc2005/freetype.vcproj,
builds/windows/vc2008/freetype.vcproj,
builds/windows/vc2010/freetype.vcxproj,
builds/windows/vc2010/freetype.vcxproj.filters,
builds/windows/visualc/freetype.dsp,
builds/windows/visualc/freetype.vcproj,
builds/windows/visualce/freetype.dsp,
builds/windows/visualce/freetype.vcproj, docs/INSTALL.ANY,
include/config/ftheader.h, include/ftfntfmt.h, modules.cfg,
src/base/ftfntfmt.c, vms_make.com: Updated.
2015-03-11 08:45:00 +01:00
Alexei Podtelezhnikov 6b832c872d Fix Savannah bug #44412 (part 1).
* src/base/ftstroke.c (ft_stroker_inside): Handle near U-turns.
2015-03-10 23:25:49 -04:00
Werner Lemberg eee7d8baa1 [base] Rename `FT_Bitmap_New' to `FT_Bitmap_Init'.
* include/ftbitmap.h, src/base/ftbitmap.c: Implement it.
Update all callers.

* docs/CHANGES: Updated.
2015-03-10 11:15:15 +01:00
Werner Lemberg 0aa36160d6 Formatting, whitespace, addition of some comments. 2015-03-08 22:50:37 +01:00
Werner Lemberg 6fce8427e4 Minor documentation improvement.
Based on a suggestion from Lawrence D'Oliveiro <ldo@geek-central.gen.nz>.
2015-03-06 23:53:28 +01:00
Werner Lemberg 493cc037c7 * src/sfnt/ttload.c (tt_face_load_font_dir): Fix compiler warning.
Found by Alexei.
2015-03-06 05:38:31 +01:00
Alexei Podtelezhnikov dd7498d283 * src/base/ftstroke.c: Simplify. 2015-03-05 22:51:36 -05:00
Werner Lemberg 328b792313 [truetype] Some fixes and code refactoring in `ttgxvar.c'.
* src/truetype/ttgxvar.c (ft_var_readpackedpoints): Fix return value
of `point_cnt' if two bytes are read.
Use a more vertical coding style.
(ft_var_readpackeddeltas): Use FT_UInt for `delta_cnt' parameter.
Use a more vertical coding style.
2015-03-04 08:40:23 +01:00
Werner Lemberg a374c9cfe7 [autofit] Fix Savannah bug #44241.
* src/autofit/aflatin.c (af_latin_metrics_init_blues): Reject glyphs
with less than 3 points.
2015-03-03 11:23:45 +01:00
Werner Lemberg 43d4901f32 Another minor documentation improvement. 2015-03-03 06:48:11 +01:00
Werner Lemberg 8bb4c8d454 Minor documentation improvement. 2015-03-03 06:39:01 +01:00
Werner Lemberg a07029ef5f Simplify `TYPEOF' macro.
No need for two arguments.

* include/config/ftconfig.h, builds/unix/ftconfig.in,
builds/vms/ftconfig.h (TYPEOF): Updated.

* include/internal/ftobjs.h (FT_PAD_FLOOR, FT_PIX_FLOOR),
src/autofit/afwarp.h (AF_WARPER_FLOOR): Updated.
2015-03-02 06:54:08 +01:00
Werner Lemberg 851e815127 Various compiler warning fixes for `make multi'.
* src/autofit/afcjk.c (af_cjk_hints_compute_blue_edges),
src/autofit/aflatin.c (af_latin_hint_compute_blue_edges,
af_latin_hint_edges), src/autofit/aflatin2.c
(af_latin2_hints_compute_blue_edges, af_latin2_hint_edges): Declare
as `static'.

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

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

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

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

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

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

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

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

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

* src/type42/t42parse.c (T1_Done_Table): Removed.  Unused.
2015-03-01 19:27:09 +01:00
Werner Lemberg bd133c352e Minor typo. 2015-03-01 07:45:36 +01:00
Werner Lemberg 6381541bd0 Update links. 2015-02-26 20:54:07 +01:00
Werner Lemberg f9837528d3 Typo. 2015-02-26 15:03:41 +01:00
Werner Lemberg 04c223703a [psaux] Signedness fixes.
* include/internal/psaux.h, src/psaux/afmparse.c,
src/psaux/afmparse.h, src/psaux/psconv.c, src/psaux/psobjs.c,
src/psaux/t1cmap.c, src/psaux/t1decode.c: Apply.
2015-02-25 11:20:20 +01:00
Werner Lemberg d25ec16672 [otvalid] Signedness fixes.
* src/otvalid/otvcommn.c, src/otvalid/otvgdef.c,
src/otvalid/otvgpos.c, src/otvalid/otvgsub.c, src/otvalid/otvmath.c:
Apply.
2015-02-25 09:19:59 +01:00
Werner Lemberg 5c9d9bf295 * src/bzip2/ftbzip2.c (ft_bzip2_alloc): Signedness fix. 2015-02-25 08:13:40 +01:00
Werner Lemberg 83d4181a36 [lzw] Signedness fixes.
* src/lzw/ftzopen.c, src/lzw/ftzopen.h: Apply.
2015-02-25 08:10:58 +01:00
Werner Lemberg 17b6291d26 [gxvalid] Signedness fixes.
* src/gxvalid/gxvbsln.c, src/gxvalid/gxvcommn.c,
src/gxvalid/gxvcommn.h, src/gxvalid/gxvjust.c,
src/gxvalid/gxvkern.c, src/gxvalid/gxvlcar.c, src/gxvalid/gxvmort.c,
src/gxvalid/gxvmort1.c, src/gxvalid/gxvmort2.c,
src/gxvalid/gxvmorx.c, src/gxvalid/gxvmorx1.c,
src/gxvalid/gxvmorx2.c, src/gxvalid/gxvopbd.c,
src/gxvalid/gxvprop.c, src/gxvalid/gxvtrak.c: Apply.
2015-02-25 07:56:11 +01:00
Werner Lemberg 24e4e96aff [cache] Signedness fixes.
* src/cache/ftcbasic.c, src/cache/ftccmap.c, src/cache/ftcimage.c,
src/cache/ftcmanag.c, src/cache/ftcsbits.c: Apply.
2015-02-25 07:55:51 +01:00
Werner Lemberg 559727d519 Change dimension fields in `FTC_ImageTypeRec' to unsigned type.
This doesn't break ABI.

* include/ftcache.h (FTC_ImageTypeRec): Use unsigned types for
`width' and `height'.

* docs/CHANGES: Document it.
2015-02-25 06:59:02 +01:00
Werner Lemberg 3d3523f721 Remove invalid note. 2015-02-25 06:46:13 +01:00
Werner Lemberg 4b9234b8a2 [cache] Don't use `labs'.
This is the only place in FreeType where this function was used.

* include/config/ftstdlib.h (ft_labs): Remove.

* src/cache/ftcimage.c (ftc_inode_weight): Replace `ft_labs' with
`FT_ABS'.
2015-02-25 06:31:43 +01:00
Werner Lemberg 3aaebe3a91 [cache] Replace `FT_PtrDist' with `FT_Offset'.
* src/cache/ftccache.h (FTC_NodeRec): `FT_Offset' (a.k.a. `size_t')
is a better choice for `hash' to hold a pointer than `FT_PtrDist'
(a.k.a. `ptrdiff_t'), especially since the latter is signed,
causing zillions of signedness warnings.  [Note that `hash' was of
type `FT_UInt32' before the change to `FT_PtrDist.]
Update all users.

* src/cache/ftcbasic.c, src/cache/ftccache.c, src/cache/ftccmap.c,
src/cache/ftcglyph.c, src/cache/ftcglyph.h: Updated.
2015-02-23 08:20:27 +01:00
Werner Lemberg 4d1f7af17b [smooth, raster] Re-enable standalone compilation.
* src/raster/ftraster.c (FT_RENDER_POOL_SIZE, FT_MAX)
[_STANDALONE_]: Define macros.

* src/smooth/ftgrays.c (FT_RENDER_POOL_SIZE, FT_MAX, FT_ABS,
FT_HYPOT) [_STANDALONE_]: Define macros.
2015-02-23 07:04:36 +01:00
Werner Lemberg cb13e7109c [smooth] Signedness fixes.
* src/smooth/ftgrays.c, src/smooth/ftsmooth.c: Apply.
2015-02-23 06:41:52 +01:00
Werner Lemberg a974e9acdf * src/raster/ftraster.c: Use the file's typedefs everywhere. 2015-02-22 21:02:13 +01:00
Werner Lemberg b0ebcdc8e4 * src/sfnt/ttpost.c (load_format_20): Fix error tracing message.
Bug introduced 6 commits earlier.
2015-02-22 20:42:49 +01:00
Werner Lemberg 22b1d5ca67 [pshinter] Fix thinko.
* src/pshinter/pshalgo.c (psh_glyph_find_strong_points): Correctly
check `count'.
Bug introduced two commits earlier.
2015-02-22 20:41:03 +01:00
Werner Lemberg ca96fe01fa [raster] Signedness fixes.
* src/raster/ftraster.c, src/raster/ftrend1.c: Apply.
2015-02-22 20:05:04 +01:00
Werner Lemberg 452066cdb9 [pshinter] Signedness fixes.
* src/pshinter/pshalgo.c, src/pshinter/pshglob.c,
src/pshinter/pshrec.c: Apply.
2015-02-22 15:59:02 +01:00
Werner Lemberg 41c2ed8143 [pshinter] Use macros for (unsigned) flags, not enumerations.
* src/pshinter/pshalgo.h (PSH_Hint_Flags): Replace with macros.
Updated.
* src/pshinter/pshrec.h (PS_Hint_Flags): Replace with macros.
2015-02-22 15:57:47 +01:00
Werner Lemberg 25c2f8820f * src/pshinter/pshrec.c: Simplify.
(ps_hints_open, ps_hints_stem): Remove switch statement.
2015-02-22 15:54:31 +01:00
Werner Lemberg 01f0842eb0 [sfnt] Signedness fixes.
* src/sfnt/pngshim.c, src/sfnt/sfobjs.c, src/sfnt/ttcmap.c,
src/sfnt/ttkern.c, src/sfnt/ttload.c, src/sfnt/ttpost.c,
src/sfnt/ttsbit.c: Apply.
* src/sfnt/sfdriver.c: Apply.
(sfnt_get_ps_name): Simplify.
2015-02-22 12:03:28 +01:00
Werner Lemberg 3c374c8cda [bdf] Signedness fixes.
* src/bdf/bdf.h, src/bdf/bdfdrivr.c, src/bdf/bdfdrivr.h,
src/bdf/bdflib.c: Apply.
2015-02-22 09:16:53 +01:00
Werner Lemberg b13945a93c * src/bdf/bdflib.c (_bdf_atous): New function.
(_bdf_parse_glyphs, _bdf_parse_start): Use it.
2015-02-22 09:15:47 +01:00
Werner Lemberg 03ccfd004f [pcf] Signedness fixes.
* src/pcf/pcf.h, src/pcf/pcfdrivr.c: Apply.
* src/pcf/pcfread.c: Apply.
(pcf_get_encodings): Ignore invalid negative encoding offsets.
2015-02-22 08:25:16 +01:00
Werner Lemberg 3d7e53f6a8 * src/winfonts/winfnt.c: Signedness fixes. 2015-02-21 11:30:54 +01:00
Werner Lemberg cc3986d5db Minor. 2015-02-21 11:29:46 +01:00
Werner Lemberg 7b6b417c97 [type42] Signedness fixes.
* src/type42/t42parse.c, src/type42/t42parse.h,
src/type42/t42types.h: Apply.
2015-02-21 10:39:34 +01:00
Werner Lemberg 8bfffb4c5c [pfr] Signedness fixes.
* src/pfr/pfrdrivr.c, src/pfr/pfrgload.c, src/pfr/pfrload.c,
src/pfr/pfrload.h, src/pfr/pfrobjs.c, src/pfr/pfrsbit.c,
src/pfr/pfrtypes.h: Apply.
2015-02-21 09:52:29 +01:00
Werner Lemberg 633a729d38 [cff] Minor signedness fixes related to last commit.
* src/cff/cf2ft.c, src/cff/cf2intrp.c, src/cff/cffgload.c: Apply.
2015-02-21 07:02:01 +01:00
Werner Lemberg c00b05f202 [cff] Thinkos in bias handling.
Only the final result is always positive.

Bug introduced three commits earlier.

* src/cff/cffgload.c, src/cff/cffgload.h: Apply.
2015-02-20 20:42:55 +01:00
Werner Lemberg 2bf03eb729 [cid] Fix signedness issues and emit some better error codes.
* src/cid/cidgload.c, src/cid/cidload.h, src/cid/cidobjs.c,
src/cid/cidparse.h: Apply.
* src/cid/cidload.c: Apply.
(parse_fd_array): Reject negative values for number of dictionaries.
* src/cid/cidparse.c: Apply.
(cid_parser_new): Reject negative values for hex data length.
2015-02-20 20:14:11 +01:00
Werner Lemberg eb05bfbe09 [cff] Signedness fixes for new engine.
* src/cff/cf2arrst.c, src/cff/cf2fixed.h, src/cff/cf2ft.c,
src/cff/cf2ft.h, src/cff/cf2hints.c, src/cff/cf2intrp.c: Apply.
2015-02-20 08:37:35 +01:00
Werner Lemberg 3a8d0537b5 [cff] Signedness fixes for basic infrastructure and old engine.
* include/internal/pshints.h, src/cff/cffdrivr.c,
src/cff/cffgload.c, src/cff/cffgload.h, src/cff/cffload.c,
src/cff/cffobjs.c, src/cff/cffparse.c, src/pshinter/pshrec.c: Apply.
2015-02-20 08:35:32 +01:00
Werner Lemberg d7db7fb54f Minor. 2015-02-19 23:09:32 +01:00
Werner Lemberg 3a1df3e188 * src/truetype/ttgxvar.c (TT_Get_MM_Var): Ignore `countSizePairs'.
This is hard-coded to value 2 in `fvar' version 1.0 (and no newer
version exists), but some fonts set it incorrectly.

Problem reported by Adam Twardoch <adam@fontlab.com>.
2015-02-19 15:42:48 +01:00
Werner Lemberg 93a884c6cd [cff] Emit better error code for invalid private dict size.
* src/cff/cffparse.c (cff_parse_private_dict): Reject negative
values for size and offset.
2015-02-19 14:11:16 +01:00
Werner Lemberg b57bb11ad0 [autofit] Fix signedness issues.
* src/autofit/afangles.c, src/autofit/afcjk.c,
src/autofit/afglobal.c, src/autofit/afhints.c,
src/autofit/aflatin.c, src/autofit/aflatin2.c, src/autofit/afwarp.c,
src/autofit/hbshim.c: Apply.
2015-02-19 10:44:18 +01:00
Werner Lemberg 81e5ff53a8 [autofit] Use macros for (unsigned) flags, not enumerations.
This harmonizes with other code in FreeType (and reduces the number
of necessary casts to avoid compiler warnings).

* src/autofit/afblue.hin: Make flag macros unsigned.
* src/autofit/afblue.h: Regenerated.

* src/autofit/afcjk.h: Replace flag enumeration with macros.
* src/autofit/afcjk.c: Updated.

* src/autofit/afhints.h (AF_Flags, AF_Edge_Flags): Replace with
macros.
* src/autofit/afhints.c: Updated.

* src/autofit/aflatin.h: Replace flag enumerations with macros.
* src/autofit/aflatin.c, src/autofit/aflatin2.c: Updated.

* src/autofit/aftypes.h (AF_ScalerFlags): Replace with macros.
2015-02-19 09:46:48 +01:00
Werner Lemberg d217950f82 Minor documentation improvement. 2015-02-19 06:45:49 +01:00
Werner Lemberg 3b5f332c5b [type1] Fix signedness issues.
* include/internal/psaux.h, include/internal/t1types.h,
src/psaux/psobjs.c, src/psaux/psobjs.h, src/psaux/t1decode.c,
src/type1/t1gload.c, src/type1/t1load.c, src/type1/t1parse.c: Apply.
2015-02-18 11:45:22 +01:00
Werner Lemberg 272e3cd077 [psaux, type1] Fix minor AFM issues.
* include/internal/t1types.h (AFM_KernPairRec): Make indices
unsigned.
Update users.
(AFM_FontInfoRec): Make element counters unsigned.
Update users.
* src/psaux/afmparse.h (AFM_ValueRec): Add union member for unsigned
int.

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

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

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

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

* src/cid/cidload.c (cid_parse_dict): Updated.
* src/pfr/pfrload.c (pfr_extra_item_load_font_id): Ditto.
* src/psaux/psobjs.c (ps_table_add), src/psaux/psobjs.h: Ditto.
* src/type1/t1load.c (parse_blend_axis_types, parse_encoding,
parse_chharstrings, parse_dict): Ditto.
* src/type42/t42parse.c (t42_parse_encoding, t42_parse_charstrings,
t42_parse_dict): Ditto.
2015-02-18 09:22:06 +01:00
Werner Lemberg 6a0ded7641 * src/type1/t1driver.c (t1_ps_get_font_value): Clean up.
This handles negative values better, avoiding many casts.
2015-02-18 08:51:22 +01:00
Werner Lemberg d3240c56e5 [base] Fix Savannah bug #44284.
* src/base/ftcalc.c (FT_MulFix): Typos.
2015-02-17 20:30:36 +01:00
Werner Lemberg 1f7a4e1f40 [truetype] Finish compiler warning fixes for signedness issues.
* src/truetype/ttgxvar.c, src/truetype/ttsubpix.c,
src/truetype/ttsubpix.h: Apply.
2015-02-17 10:17:56 +01:00
Werner Lemberg 9daea2c90c * src/truetype/ttsubpix.c: Adding missing `static' keywords. 2015-02-17 09:27:56 +01:00
Werner Lemberg d9c3f15117 [truetype] More signedness fixes.
* include/internal/tttypes.h, src/truetype/ttinterp.h,
src/truetype/ttobjs.h, src/truetype/ttinterp.c,
src/truetype/ttobjs.c: Apply.
2015-02-17 09:21:26 +01:00
Werner Lemberg 0a33a3984f [truetype] Various signedness fixes.
* include/internal/ftgloadr.h, src/truetype/ttpload.c: Apply.

* src/truetype/ttgload.c: Apply.
(TT_Get_VMetrics): Protect against invalid ascenders and descenders
while constructing advance height.
2015-02-17 08:03:05 +01:00
Werner Lemberg 76abc75c26 [base] Finish compiler warning fixes for signedness issues.
* src/base/ftglyph.c, src/base/ftlcdfil.c, src/base/ftstroke.c:
Apply.
2015-02-16 22:00:27 +01:00
Werner Lemberg 10aa858593 * include/tttables.h (TT_OS2): `fsType' must be FT_UShort. 2015-02-16 20:12:54 +01:00
Werner Lemberg 2e814fc045 More minor signedness warning fixes.
* src/base/ftbbox.c, src/base/ftbitmap.c, src/base/fttrigon.c,
src/base/ftutil.c: Apply.
2015-02-16 20:05:08 +01:00
Werner Lemberg 82235d0474 Next round of minor compiler warning fixes.
* include/internal/ftrfork.h (FT_RFork_Ref): Change `offset' member
type to `FT_Long'.
(CONST_FT_RFORK_RULE_ARRAY_BEGIN): Add `static' keyword.

* include/internal/ftstream.h (FT_Stream_Pos): Return `FT_ULong'.

* src/base/ftoutln.c, src/base/ftrfork.c, src/base/ftstream.c:
Signedess fixes.
2015-02-16 19:35:16 +01:00
Werner Lemberg 3cfa4d124c Various minor signedness fixes.
* include/ftadvanc.h, include/internal/ftobjs.h,
src/base/ftgloadr.c, src/base/ftobjs.c: Apply.
2015-02-16 17:59:06 +01:00
Werner Lemberg 6f325c26cf New `TYPEOF' macro.
This helps suppress signedness warnings, avoiding issues with
implicit conversion changes.

* include/config/ftconfig.h, builds/unix/ftconfig.in,
builds/vms/ftconfig.h (TYPEOF): Define.

* include/internal/ftobjs.h (FT_PAD_FLOOR, FT_PIX_FLOOR),
src/autofit/afwarp.h (AF_WARPER_FLOOR): Use it.
2015-02-16 11:31:32 +01:00
Werner Lemberg 1f377f0d50 * src/base/ftsystem.c: Use casts in standard C function wrappers.
(ft_alloc, ft_realloc, ft_ansi_stream_io, FT_Stream_Open): Do it.
2015-02-16 08:37:09 +01:00
Werner Lemberg 0814b80fde Fix Savannah bug #44261.
* builds/unix/detect.mk (setup) [unix]: Set `CONFIG_SHELL' in the
environment also while calling the configure script.
2015-02-16 07:29:53 +01:00
Werner Lemberg 587351b7e2 * include/internal/ftmemory.h: Add some `FT_Offset' casts.
(FT_MEM_SET, FT_MEM_COPY, FT_MEM_MOVE, FT_ARRAY_ZERO, FT_ARRAY_COPY,
FT_MEM_MOVE): Do it.
2015-02-16 07:03:22 +01:00
Werner Lemberg 48186b8168 [base] Clean up signedness issues in `ftdbgmem.c'.
Also fix other minor issues.

* src/base/ftdbgmem.c (FT_MemTableRec): Replace all FT_ULong types
with FT_Long for consistency.
(ft_mem_primes): Change type to `FT_Int'.
(ft_mem_closest_prime, ft_mem_table_set): Updated.

(ft_mem_debug_panic, ft_mem_debug_alloc, ft_mem_debug_free,
ft_mem_debug_realloc): Use `static' keyword and fix signedness
warnings where necessary.

(ft_mem_table_resize, ft_mem_table_new, ft_mem_table_destroy,
ft_mem_table_get_nodep, ft_mem_debug_init, FT_DumpMemory): Fix types
and add or remove casts to avoid signedness warnings.
2015-02-16 06:37:36 +01:00
Werner Lemberg 6d7d636b46 [base] Clean up signedness in arithmetic functions.
This makes the code more readable and reduces compiler warnings.

* src/base/ftcalc.c (FT_MulDiv, FT_MulDiv_No_Round, FT_MulFix,
FT_DivFix): Convert input parameters to unsigned, do the
computation, then convert the result back to signed.
(ft_corner_orientation): Fix casts.
2015-02-15 12:30:42 +01:00
Werner Lemberg 92359bd885 [sfnt] Fix Savannah bug #44184.
* src/sfnt/ttload.c (check_table_dir, tt_face_load_font_dir): No
longer reject `htmx' and `vmtx' tables with invalid length but
sanitize them.
2015-02-07 09:47:23 +01:00
Werner Lemberg 9ada669a2c Minor documentation improvement. 2015-02-07 08:22:00 +01:00
Jon Anderson 416d87963f [truetype] Fix regression in the incremental glyph loader.
* src/truetype/ttgload.c (load_truetype_glyph): For incremental
fonts, the glyph index may be greater than the number of glyphs
indicated, so guard the check with a preprocessor conditional.
2015-02-06 10:16:45 +01:00
Werner Lemberg b6cb4997e8 [autofit] Fix potential memory leak.
While this doesn't show up with FreeType, exactly the same code
leaks with ttfautohint's modified auto-hinter code (which gets used
in a slightly different way).

It certainly doesn't harm since it is similar to already existing
checks in the code for embedded arrays.

* src/autofit/afhints.c (af_glyph_hints_reload): Set `max_contours'
and `max_points' for all cases.
2015-02-06 08:46:06 +01:00
Werner Lemberg 19146a5302 [autofit] Add support for Thai script.
Thanks to Ben Mitchell <ben@rosettatype.com> for guidance with blue
zone characters!

* src/autofit/afblue.dat: Add blue zone data for Thai.

* src/autofit/afblue.c, src/autofit/afblue.h: Regenerated.

* src/autofit/afscript.h: Add Thai standard characters.

* src/autofit/afranges.c: Add Thai data.

* src/autofit/afstyles.h: Add Thai data.
2015-01-31 11:01:33 +01:00
Werner Lemberg d2c531ede8 Minor. 2015-01-23 22:37:42 +01:00
Behdad Esfahbod 264b5e46c0 [raster] Handle `FT_RASTER_FLAG_AA' correctly.
This fixes a breakage caused by the commit `[raster] Remove
5-level gray AA mode from monochrome rasterizer.'.

Problem reported by Markus Trippelsdorf <markus@trippelsdorf.de> and
octoploid <octoploid@yandex.com>.

* src/raster/ftraster.c (ft_black_render): Handle
`FT_RASTER_FLAG_AA'.

* src/raster/ftrend1.c (ft_raster1_render): Remove gray AA mode
remnants.
2015-01-23 21:23:55 +01:00
Werner Lemberg 0bd564a94d Add another link to cmap information. 2015-01-22 08:26:48 +01:00
Werner Lemberg 1a42f3253d Clarify meaning of FT_ENCODING_MS_SYMBOL. 2015-01-22 07:56:24 +01:00
Werner Lemberg 79a5ac603a * src/base/ftobjs.c (FT_New_Library): Fix compiler warning. 2015-01-18 07:30:04 +01:00
Chris Liddell 942aa5fff4 [raster] Fix Savannah bug #44022.
Add fallback for glyphs with degenerate bounding boxes.

If a glyph has only one very narrow feature, the bbox can end up
with either the width or height of the bbox being 0, in which case
no raster memory is allocated and no attempt is made to render the
glyph.  This is less than ideal when the drop-out compensation in
the rendering code would actually result in the glyph being
rendered.

This problem can be observed with the `I' glyph (gid 47) in the
Autodesk RomanS TrueType font.

* src/raster/ftrend1.c (ft_raster1_render): Add a fallback if either
dimension is zero to explicitly round up/down (instead of simply
round).
2015-01-18 07:29:48 +01:00
Werner Lemberg f57fc59e01 Run `src/tools/update-copyright'. 2015-01-17 20:41:43 +01:00
Werner Lemberg 50be00d3b3 Add some tools to handle yearly copyright notice updates.
We are now following the GNU guidelines: A new release automatically
means that the copyright year of all affected files gets updated; it
is no longer used to track years of modification changes.

* src/tools/update-copyright-year: New Perl script.
* src/tools/update-copyright: New shell script that calls
`update-copyright-year' on all files.
* src/tools/no-copyright: Exceptions that should not be handled by
`update-copyright'
2015-01-17 20:38:31 +01:00
Werner Lemberg f796cf6c6b Normalize copyright notice format. 2015-01-17 20:11:10 +01:00
Werner Lemberg 4eff854c27 * docs/CHANGES: Updated, using a description from Behdad. 2015-01-14 20:06:19 +01:00
Behdad Esfahbod 48c86628de * src/autofit/afmodule.c (af_autofitter_done): Fix compiler warning. 2015-01-14 19:38:36 +01:00
Behdad Esfahbod 56ddafa01c [autofit] Add embedded array of segments and edges.
Avoids multiple mallocs per typical glyphs.

With this and recent changes to avoid mallocs, the thread-safe
stack-based loader is now as fast as the previous model that had one
cached singleton.

* src/autofit/afhints.h (AF_SEGMENTS_EMBEDDED, AF_EDGES_EMBEDDED):
New macros.
(AF_AxisHintsRec): Add two arrays for segments and edges.

* src/autofit/afhints.c (af_axis_hints_new_segment): Only allocate
data if number of segments exceeds given threshold value.
(af_axis_hints_new_edge):  Only allocate data if number of edges
exceeds given threshold value.
(af_glyph_hints_done): Updated.
2015-01-14 19:36:02 +01:00
Behdad Esfahbod 6f16b10019 [autofit] Add embedded arrays for points and contours.
This avoids at least two malloc calls for typical glyphs.

* src/autofit/afhints.h (AF_POINTS_EMBEDDED, AF_CONTOURS_EMBEDDED):
New macros.
(AF_GlyphHintsRec): Add two arrays for contours and points.

* src/autofit/afhints.c (af_glyph_hints_init, af_glyph_hints_done):
Updated.
(af_glyph_hints_reload): Only allocate data if number of contours or
points exceeds given threshold values.
2015-01-14 19:26:49 +01:00
Behdad Esfahbod c27336567b [autofit] Allocate hints object on the stack.
This avoids one malloc per load.

* src/autofit/afloader.h (AF_LoaderRec): Change type of `hints' to
`AF_GlyphHints'.
Update prototype.

* src/autofit/afloader.c (af_loader_init): Use `AF_GlyphHints'
parameter instead of `FT_Memory'.
(af_loader_done): Directly reset `load_hints'.
(af_loader_load_g): Updated.

* src/autofit/afmodule.c (af_autofitter_load_glyph): Use local
`hints' object.
2015-01-14 19:16:12 +01:00
Behdad Esfahbod a4117fbda7 [autofit] Reuse slot glyph loader.
No need to create a new glyph loader; we can reuse the one from
`slot->internal->loader'.  It's hard to tell why it was written that
way originally, but new code looks sound and correct to me, and
avoids lots of allocations.

* src/autofit/afloader.c (af_loader_init): Change return type to
`void'.
Don't call `FT_GlyphLoader_New'.
(af_loader_reset): Don't call `FT_GlyphLoader_Rewind'.
(af_loader_load_g): Update code to use `internal->loader', which
doesn't need copying of data.

* src/autofit/afloader.h (AF_LoaderRec): Remove `gloader' member.
Update prototype.

* src/autofit/afmodule.c (af_autofitter_load_glyph): Updated.
2015-01-14 19:07:54 +01:00
Behdad Esfahbod ae6699f86c [autofit] Remove (unused) support for composite glyphs.
We never have to deal with composite glyphs in the autohinter, as
those will be loaded into FORMAT_OUTLINE by the recursed
`FT_Load_Glyph' function.

In the rare cases that FT_LOAD_NO_RECURSE is set, it will imply
FT_LOAD_NO_SCALE as per `FT_Load_Glyph', which then implies
FT_LOAD_NO_HINTING:

  /* resolve load flags dependencies */

  if ( load_flags & FT_LOAD_NO_RECURSE )
    load_flags |= FT_LOAD_NO_SCALE         |
                  FT_LOAD_IGNORE_TRANSFORM;

  if ( load_flags & FT_LOAD_NO_SCALE )
  {
    load_flags |= FT_LOAD_NO_HINTING |
                  FT_LOAD_NO_BITMAP;

    load_flags &= ~FT_LOAD_RENDER;
  }

and as such the auto-hinter is never called.  Thus, the recursion in
`af_loader_load_g' never actually happens.  So remove the depth
counter as well.

* src/autofit/afloader.c (af_loader_load_g): Remove `depth'
parameter.
<FT_GLYPH_FORMAT_COMPOSITE>: Remove associated code.
(af_loader_load_glyph): Updated.
2015-01-14 18:55:39 +01:00
Behdad Esfahbod c242fe41ec [raster] Fix uninitialized memory access.
Apparently `ras.cProfile' might be uninitialized.  This will be the
case if `ras.top == ras.cProfile->offset', as can be seen in
`End_Profile'.  The overshoot code introduced in a change `Fix B/W
rasterization of subglyphs with different drop-out modes.' (from
2009-06-18) violated this, accessing `ras.cProfile->flags'
unconditionally just before calling `End_Profile' (which then
detected that `cProfile' is uninitialized and didn't touch it).

This was harmless, and was not detected by valgrind before because
the objects were allocated on the `raster_pool', which was always
initialized.  With recent change to allocate raster buffers on the
stack, valgrind now reported this invalid access.

* src/raster/ftraster.c (Convert_Glyph): Don't access an
uninitialized `cProfile'.
2015-01-14 18:48:14 +01:00
Behdad Esfahbod b2ba68665f [smooth] Fix uninitialized memory access.
Looks like `ras.span_y' could always be used without initialization.
This was never detected by valgrind before because the library-wide
`raster_pool' was used for the worker object and `raster_pool' was
originally zero'ed.  But subsequent reuses of it were using `span_y'
uninitialized.  With the recent change to not use `render_pool' and
allocate worker and buffer on the stack, valgrind now detects this
uninitialized access.

* src/smooth/ftgrays.c (gray_raster_render): Initialize
`ras.span_y'.
2015-01-14 18:43:13 +01:00
Behdad Esfahbod 603292d7b0 [base] Don't initialize unused `driver->glyph_loader'.
* src/base/ftobjs.c (Destroy_Driver): Don't call
`FT_GlyphLoader_Done'.
(FT_Add_Module): Don't call `FT_GlyphLoader_New'.
2015-01-14 18:35:56 +01:00
Behdad Esfahbod 5163425344 [base] Don't allocate `library->raster_pool' anymore.
It's unused after the following commits:

  [raster] Allocate render pool for mono rasterizer on the stack.
  [raster] Remove 5-level gray AA mode from monochrome rasterizer.

The value of FT_RENDER_POOL_SIZE still serves the purpose it used to
serve, which is, to adjust the pool size.  But the pool is now
allocated on the stack on demand.

* src/base/ftobjs.c (FT_New_Library, FT_Done_Library): Implement.
2015-01-14 18:30:59 +01:00
Behdad Esfahbod 6dfdaf4d99 [base] Do not reorder library->renderers upon use.
Instead of keeping `library->renderers' in a MRU order, just leave
it as-is.  The MRU machinery wasn't thread-safe.

With this patch, rasterizing glyphs from different faces from
different threads doesn't fail choosing rasterizer
(FT_Err_Cannot_Render_Glyph).

Easiest to see that crash was to add a `printf' (or otherwise let
thread yield in FT_Throw with debugging enabled).

* src/base/ftobjs.c (FT_Render_Glyph_Internal), src/base/ftoutln.c
(FT_Outline_Render): Don't call `FT_Set_Renderer'.
2015-01-14 18:21:13 +01:00
Behdad Esfahbod a773c3041e [raster] Allocate render pool for mono rasterizer on the stack.
Instead of using the `render_pool' member of `FT_Library' that is
provided down to the rasterizer, completely ignore that and allocate
needed objects on the stack instead.

With this patch, rasterizing glyphs from different faces from
different threads doesn't crash in the monochrome rasterizer.

* src/raster/ftraster.c (black_TRaster): Remove `buffer',
`buffer_size', and `worker' members.

(ft_black_render): Create `buffer' locally.
(ft_black_reset): Updated.
2015-01-14 18:16:20 +01:00
Behdad Esfahbod 8dc8635874 [raster] Remove 5-level gray AA mode from monochrome rasterizer.
It was off by default and couldn't be turned on at runtime.  And the
smooth rasterizer superceded it over ten years ago.  No point in
keeping.  Comments suggested that it was there for compatibility
with FreeType 1.

550 lines down.

* src/raster/ftraster.c (FT_RASTER_OPTION_ANTI_ALIASING,
RASTER_GRAY_LINES): Remove macros and all associated code.

(black_TWorker): Remove `gray_min_x' and `gray_max_x'.
(black_TRaster): Remove `grays' and `gray_width'.

(Vertical_Sweep_Init, Vertical_Sweep_Span, Vertical_Sweep_Drop,
ft_black_render): Updated.

* src/raster/ftrend1.c (ft_raster1_render): Simplify code.
(ft_raster5_renderer_class): Removed.
2015-01-14 18:06:22 +01:00
Behdad Esfahbod 747ae2c8aa [smooth] Allocate render pool for smooth rasterizer on the stack.
Instead of using the `render_pool' member of `FT_Library' that is
provided down to the rasterizer, completely ignore that and allocate
needed objects on the stack instead.

With this patch, rasterizing glyphs from different faces from
different threads doesn't crash in the smooth rasterizer.

Bugs:

  https://bugzilla.redhat.com/show_bug.cgi?id=678397
  https://bugzilla.redhat.com/show_bug.cgi?id=1004315
  https://bugzilla.redhat.com/show_bug.cgi?id=1165471
  https://bugs.freedesktop.org/show_bug.cgi?id=69034

* src/smooth/ftgrays.c (gray_TRaster): Remove `buffer',
`buffer_size', `band_size', and `worker' members.

(gray_raster_render): Create `buffer', `buffer_size', and
`band_size' locally.
(gray_raster_reset): Updated.
2015-01-14 17:54:26 +01:00
Behdad Esfahbod 531d463aed [truetype] Allocate TT_ExecContext in TT_Size instead of TT_Driver.
Previously the code had stipulation for using a per-TT_Size exec
context if `size->debug' was true.  But there was no way that
`size->debug' could *ever* be true.  As such, the code was always
using the singleton `TT_ExecContext' that was stored in `TT_Driver'.
This was, clearly, not threadsafe.

With this patch, loading glyphs from different faces from different
threads doesn't crash in the bytecode loader code.

* src/truetype/ttobjs.h (TT_SizeRec): Remove `debug' member.
(TT_DriverRec): Remove `context' member.

* src/truetype/ttobjs.c (tt_size_run_fpgm, tt_size_run_prep): Remove
`TT_ExecContext' code related to a global `TT_Driver' object.

(tt_driver_done): Don't remove `TT_ExecContext' object here but ...
(tt_size_done_bytecode): ... here.

(tt_driver_init): Don't create `TT_ExecContext' object here but ...
(tt_size_init_bytecode): ... here, only on demand.

* src/truetype/ttinterp.c (TT_Run_Context): Remove defunct debug
code.
(TT_New_Context): Remove `TT_ExecContext' code related to a global
`TT_Driver' object.

* src/truetype/ttinterp.h: Updated.

* src/truetype/ttgload.c (TT_Hint_Glyph, tt_loader_init): Updated.
2015-01-14 17:46:55 +01:00
Behdad Esfahbod 89bc8d4de7 [autofit] Allocate AF_Loader on the stack instead of AF_Module.
Stop sharing a global `AF_Loader'.  Allocate one on the stack during
glyph load.

Right now this results in about 25% slowdown, to be fixed in a
following commit.

With this patch loading glyphs from different faces from different
threads doesn't immediately crash in the autohinting loader code.

Bugs:

  https://bugzilla.redhat.com/show_bug.cgi?id=1164941

* src/autofit/afloader.c (af_loader_init): Pass
`AF_Loader' and `FT_Memory' instead of `AF_Module' as arguments.
(af_loader_reset, af_loader_load_glyph): Also pass `loader' as
argument.
(af_loader_done): Use `AF_Loader' instead of `AF_Module' as
argument.

* src/autofit/afmodule.c (af_autofitter_init): Don't call
`af_loader_init'.
(af_autofitter_done): Don't call `af_loader_done'.
(af_autofitter_load_glyph): Use a local `AF_Loader' object.

* src/autofit/afloader.h: Include `afmodule.h'.
Update prototypes.
Move typedef for `AF_Module' to...

* src/autofit/afmodule.h: ... this place.
No longer include `afloader.h'.
2015-01-14 16:01:19 +01:00
Behdad Esfahbod 3f9b3d882d * src/type42/t42objs.h (T42_DriverRec): Remove unused member. 2015-01-14 15:48:12 +01:00
Werner Lemberg 36d03c9f58 Fix Savannah bug #43976.
Assure that FreeType's internal include directories are found before
`CPPFLAGS' (which might be set by the user in the environment), and
`CPPFLAGS' before `CFLAGS'.

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

* src/*/rules.mk (*_COMPILE): Fix order of include directories.
2015-01-12 11:26:30 +01:00
Werner Lemberg 2af74c9b87 [truetype] Better grouping of functions in `ttinterp.c'.
No code change.
2015-01-11 10:08:09 +01:00
Werner Lemberg 95b5705273 [truetype] Prettyfing.
* src/truetype/ttinterp.c (project, dualproj, fast_project,
fast_dualproj): Rename to...
(PROJECT, DUALPROJ, FAST_PROJECT, FAST_DUALPROJ): ... this.
2015-01-11 09:50:49 +01:00
Werner Lemberg ea173c0493 * src/truetype/ttinterp.c (Ins_JROT, Ins_JROF): Simplify.
Based on a patch from Behdad.
2015-01-11 08:58:54 +01:00
Werner Lemberg 628578c655 * src/truetype/ttinterp.c (Ins_SxVTL): Simplify function call. 2015-01-11 08:53:31 +01:00
Werner Lemberg 08e7909a58 * src/truetype/ttinterp.c (Normalize): Remove unused argument. 2015-01-11 08:45:50 +01:00
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 232bd948fd * Version 2.5.5 released.
=========================

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

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

* README, Jamfile (RefDoc), builds/windows/vc2005/freetype.vcproj,
builds/windows/vc2005/index.html,
builds/windows/vc2008/freetype.vcproj,
builds/windows/vc2008/index.html,
builds/windows/vc2010/freetype.vcxproj,
builds/windows/vc2010/index.html,
builds/windows/visualc/freetype.dsp,
builds/windows/visualc/freetype.vcproj,
builds/windows/visualc/index.html,
builds/windows/visualce/freetype.dsp,
builds/windows/visualce/freetype.vcproj,
builds/windows/visualce/index.html,
builds/wince/vc2005-ce/freetype.vcproj,
builds/wince/vc2005-ce/index.html,
builds/wince/vc2008-ce/freetype.vcproj,
builds/wince/vc2008-ce/index.html: s/2.5.4/2.5.5/, s/254/255/.

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

* builds/unix/configure.raw (version_info): Set to 17:4:11.
* CMakeLists.txt (VERSION_PATCH): Set to 5.
* docs/CHANGES: Updated.

* builds/toplevel.mk (dist): Fix typos.
2014-12-30 21:44:51 +01:00
Alexei Podtelezhnikov 7024155328 [base] Formatting and nanooptimizations.
* src/base/ftcalc.c,
* src/base/fttrigon.c: Revise sign restoration.
2014-12-24 12:11:46 -05:00
Werner Lemberg 36a4676136 Remove C-isms in Python code. 2014-12-22 03:31:32 +01:00
Werner Lemberg 06842c7b49 * src/pcf/pcfread.c (pcf_read_TOC): Improve fix from 2014-12-08. 2014-12-13 07:42:51 +01:00
Werner Lemberg bef8df0a3a Minor doc improvements. 2014-12-13 07:26:04 +01:00
Werner Lemberg 821195016e * builds/toplevel.mk (dist): Use older POSIX standard for `tar'.
Apparently, BSD tar isn't capable yet of handling POSIX-1.2001
(contrary to GNU tar), so force the POSIX-1.1988 format.

Problem reported by Stephen Fisher <sfisher@SDF.ORG>.
2014-12-11 22:27:06 +01:00
Werner Lemberg 812ed34189 * src/type42/t42parse.c (t42_parse_sfnts): Reject invalid TTF size. 2014-12-11 14:07:29 +01:00
Werner Lemberg c9ca6ffc94 * src/base/ftobjs.c (FT_Get_Glyph_Name): Fix off-by-one check.
Problem reported by Dennis Felsing <dennis@felsin9.de>.
2014-12-11 13:39:39 +01:00
Werner Lemberg b94381134e * src/type42/t42parse.c (t42_parse_sfnts): Check `string_size'.
Problem reported by Dennis Felsing <dennis@felsin9.de>.
2014-12-11 13:33:14 +01:00
suzuki toshiya 9bd1e55850 [gxvalid] Fix a naming convention conflicting with ftvalid.
See previous changeset for otvalid.

* src/gxvalid/{gxvcommn.h, gxvmort.h, gxvmorx.h}: Replace
`valid' by `gxvalid'.
* src/gxvalid/{gxvbsln.c, gxvcommn.c, gxvfeat.c, gxvjust.c,
gxvkern.c, gxvlcar.c, gxvmort.c, gxvmort0.c, gxvmort1.c,
gxvmort2.c, gxvmort4.c, gxvmort5.c, gxvmorx.c, gxvmorx0.c,
gxvmorx1.c, gxvmorx2.c, gxvmorx4.c, gxvmorx5.c, gxvopbd.c,
gxvprop.c, gxvtrak.c}: Replace `valid' by `gxvalid' if
it is typed as GXV_Validator.
2014-12-10 00:59:09 +09:00
suzuki toshiya 51abdf6ffa [otvalid] Fix a naming convention conflicting with ftvalid.
Some prototypes in ftvalid.h use `valid' for the variables
typed as FT_Validator.  Their implementations in src/base/
ftobjs.c and utilizations in src/sfnt/ttcmap.c do similar.

Some macros in otvcommn.h assume the exist of the variable
`valid' typed as OTV_Validator in the caller.

Mixing these two conventions cause invalid pointer conversion
and unexpected SEGV in longjmp.  To prevent it, all variables
typed as OTV_Validator are renamed to `otvalid'.

* src/otvalid/otvcommn.h: Replace `valid' by `otvalid'.
* src/otvalid/{otvcommn.c, otvbase.c, otvgdef.c, otvgpos.c,
otvgsub.c, otvjstf.c, otvmath.c}: Replace `valid' by `otvalid'
if it is typed as OTV_Validator.
2014-12-10 00:46:55 +09:00
suzuki toshiya 2b59282b2d [ftvalid] Introduce FT_THROW() in FT_INVALID_XXX macros.
Original patch is designed by Werner Lemberg.  Extra part
for otvalid and gxvalid are added by suzuki toshiya, see
discussion:
http://lists.nongnu.org/archive/html/freetype-devel/2014-12/msg00002.html
http://lists.nongnu.org/archive/html/freetype-devel/2014-12/msg00007.html

* include/internal/ftvalid.h: Introduce FT_THROW() in FT_INVALID_().
* src/gxvalid/gxvcommn.h: Ditto.
* src/otvalid/otvcommn.h: Ditto.
2014-12-10 00:27:41 +09:00
Werner Lemberg 74af85c4b6 [pcf] Fix Savannah bug #43774.
Work around `features' of X11's `pcfWriteFont' and `pcfReadFont'
functions.  Since the PCF format doesn't have an official
specification, we have to exactly follow these functions' behaviour.

The problem was unveiled with a patch from 2014-11-06, fixing issue #43547.

* src/pcf/pcfread.c (pcf_read_TOC): Don't check table size for last
element.  Instead, assign real size.
2014-12-08 16:01:50 +01:00
Werner Lemberg 553c9672b3 Work around a bug in Borland's C++ compiler.
See

  http://qc.embarcadero.com/wc/qcmain.aspx?d=118998

for Borland's bug tracker entry.

Reported by Yuliana Zigangirova <zigangirova@inbox.ru>,
http://lists.gnu.org/archive/html/freetype-devel/2014-04/msg00001.html.

* include/internal/ftvalid.h (FT_ValidatorRec), src/smooth/ftgrays.c
(gray_TWorker_): Move `ft_jmp_buf' field to be the first element.
2014-12-07 19:29:52 +01:00
Werner Lemberg 0098d5502d Uppercase all hex digits for orthogonality. 2014-12-07 11:03:57 +01:00
Werner Lemberg 9870d6dacf */*: Decorate hex constants with `U' and `L' where appropriate. 2014-12-07 09:40:47 +01:00
Werner Lemberg 66883b5808 [truetype] Prevent memory leak for buggy fonts.
* src/truetype/ttobjs.c (tt_size_done): Unconditionally call
`tt_size_done_bytecode'.
2014-12-07 09:17:06 +01:00
Werner Lemberg 5018477f4e Minor. 2014-12-07 08:17:12 +01:00
Werner Lemberg ed6a9df0f6 Whitespace. 2014-12-06 23:28:58 +01:00
Werner Lemberg 94926686b1 * Version 2.5.4 released.
=========================

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

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

* README, Jamfile (RefDoc), builds/windows/vc2005/freetype.vcproj,
builds/windows/vc2005/index.html,
builds/windows/vc2008/freetype.vcproj,
builds/windows/vc2008/index.html,
builds/windows/vc2010/freetype.vcxproj,
builds/windows/vc2010/index.html,
builds/windows/visualc/freetype.dsp,
builds/windows/visualc/freetype.vcproj,
builds/windows/visualc/index.html,
builds/windows/visualce/freetype.dsp,
builds/windows/visualce/freetype.vcproj,
builds/windows/visualce/index.html,
builds/wince/vc2005-ce/freetype.vcproj,
builds/wince/vc2005-ce/index.html,
builds/wince/vc2008-ce/freetype.vcproj,
builds/wince/vc2008-ce/index.html: s/2.5.3/2.5.4/, s/253/254/.

* include/freetype/freetype.h (FREETYPE_PATCH): Set to 4.

* builds/unix/configure.raw (version_info): Set to 17:3:11.
* CMakeLists.txt (VERSION_PATCH): Set to 4.
* docs/CHANGES: Updated.
2014-12-06 07:11:44 +01:00
Werner Lemberg 934ef382c8 docs/CHANGES: Updated, formatted. 2014-12-04 06:38:51 +01:00
Dave Arnold f89396cb62 [cff] Modify an FT_ASSERT.
* src/cff/cf2hints.c (cf2_hintmap_map): After the fix for Savannah
bug #43661, the test font `...aspartam.otf' still triggers an
FT_ASSERT.  Since hintmap still works with count==0, ...
(cf2_glyphpath_lineTo, cf2_glyphpath_curveTo): ... add that term to
suppress the assert.
2014-12-04 06:17:26 +01:00
Dave Arnold 2cdc4562f8 [cff] Fix Savannah bug #43661.
* src/cff/cf2intrp.c (cf2_interpT2CharString) <cf2_cmdHSTEM,
cf2_cmdVSTEM, cf2_cmdHINTMASK>: Don't append to stem arrays after
hintmask is constructed.

* src/cff/cf2hints.c (cf2_hintmap_build): Add defensive code to
avoid reading past end of hintmask.
2014-12-04 06:10:16 +01:00
Werner Lemberg 8fa69a88d7 docs/CHANGES: Updated. 2014-12-03 20:07:14 +01:00
Werner Lemberg a632b5f406 [autofit] Better fix for conversion specifiers in debug messages.
Using `%ld' for pointer differences causes warnings on 32bit
platforms.  The correct type would be (the relatively new) `%td',
however, this is missing on some important platforms.

This patch improves the change from 2014-11-28.

* src/autofit/afhints.c (AF_INDEX_NUM): Use `int' typecast.  Our
pointer differences are always sufficiently small.
(af_glyph_hints_dump_points, af_glyph_hints_dump_segments,
af_glyph_hints_dump_edge): Revert to `%d' and use `AF_INDEX_NUM'.
2014-12-03 19:30:44 +01:00
Werner Lemberg 16188ebfac FT_Sfnt_Tag: s/ft_sfnt_xxx/FT_SFNT_XXX/ for orthogonality.
All public FreeType enumeration and flag values are uppercase...

* include/tttables.h (FT_Sfnt_Tag): Implement it.  For backwards
compatilibity, retain the old values as macros.

* src/base/ftfstype.c (FT_Get_FSType_Flags), src/sfnt/sfdriver.c
(get_sfnt_table): Updated.
2014-12-03 10:18:34 +01:00
Werner Lemberg 16dc5d0b04 Minor. 2014-12-03 10:14:24 +01:00
Werner Lemberg de43ace7a3 * include/*: Improve structure of documentation.
. Add and update many `<Order>' tags.
. Apply various documentation fixes.
. Remove details to deprecated (or never implemented) data.
2014-12-02 23:06:04 +01:00
Werner Lemberg ca1f5cc7e6 [docmaker] Always handle `<Order>' section elements.
Previously, those elements were handled only for sections present in
a `<Sections>' chapter element.

* src/tools/docmaker/content.py (ContentProcessor::finish):
Implement it.
2014-12-02 22:49:25 +01:00
Werner Lemberg ef6a352344 [docmaker] Properly handle empty rows in Synopsis.
* src/tools/docmaker/tohtml.py (HtmlFormatter::section_enter): Emit
`&nbsp;' for empty fields.
2014-12-02 21:16:59 +01:00
Werner Lemberg 0e96f05009 [docmaker] Thinko.
* src/tools/docmaker/content.py (DocBlock::get_markup_words_all):
Emit `/empty/' string for first element also.
2014-12-02 11:08:31 +01:00
Werner Lemberg 102d4a76ed [docmaker] Honour empty lines in `<Order>' section element.
This greatly improves the readability of the `Synopsis' links.

* src/tools/docmaker/content.py (DocBlock::get_markup_words_all):
Insert string `/empty/' between items.

* src/tools/docmaker/formatter.py (Formatter::section_dump): Make it
robust against nonexistent keys.

* src/tools/docmaker/tohtml.py (HtmlFormatter::section_enter): Emit
empty <td> elements for `/empty/'.
2014-12-02 10:27:40 +01:00
Werner Lemberg 2af25ac0f9 [docmaker] Ensure Python 3 compatibility.
* src/tools/docmaker/content.py (ContentProcessor::set_section,
ContentProcessor::finish): Replace `has_key' function with `in'
keyword.

* src/tools/docmaker/formatter.py (Formatter::__init__): Replace
sorting function with a key generator.
(Formatter::add_identifier): Replace `has_key' function with `in'
keyword.

* src/tools/docmaker/tohtml.py (HtmlFormatter::html_source_quote):
Replace `has_key' function with `in' keyword.
(HtmlFormatter::index_exit, HtmlFormatter::section_enter): Use
integer division.
s/<>/>/.

* src/tools/docmaker/utils.py: Import `itertools'.
(index_sort): Replaced by...
(index_key): ... this new key generator (doing exactly the same).
2014-12-02 08:38:57 +01:00
Werner Lemberg 80bfeb1c3b [docmaker] Don't output a block multiple times.
This bug was hidden by not processing all lines of `<Order>' blocks.

* src/tools/docmaker/formatter.py (Formatter::section_dump): Filter
out field names.
2014-12-01 10:07:52 +01:00
Werner Lemberg 0dbad7632b [docmaker] Use field values as HTML link targets where possible.
* src/tools/docmaker/tohtml.py (HtmlFormatter::make_block_url):
Accept second, optional argument to specify a name.
(HtmlFormatter::html_source_quote): Link to field ID if possible.
(HtmlFormatter::print_html_field_list): Emit `id' attribute.
2014-12-01 08:44:48 +01:00
Werner Lemberg 785b1d0892 [docmaker] Allow empty lines in `<Order>' blocks.
Before this patch, the suggested order of entries stopped at the
first empty line.

Obviously, nobody noticed that this problem caused a much reduced
set of links in the `Synopsis' sections; in particular, the
`<Order>' blocks contain a lot of entries that wouldn't be listed
otherwise...

* src/tools/docmaker/content.py (DocBlock::get_markup_words_all):
New function to iterate over all items.
(DocSection::process): Use it.
2014-11-30 22:16:34 +01:00
Werner Lemberg 16b3e62013 * src/tools/docmaker/sources.py (column) [Format 2]: Fix regexp.
After the single asterisk there must be no other immediately following
asterisk.
2014-11-30 20:58:27 +01:00
Werner Lemberg 63cb256b5b Documentation typos. 2014-11-30 20:54:21 +01:00
Werner Lemberg aaffbf85df Minor. 2014-11-29 23:26:46 +01:00
Werner Lemberg 434bc69573 * src/tools/docmaker/tohtml.py: Improve CSS for vertical spacing. 2014-11-29 23:12:55 +01:00
Werner Lemberg 51987eaf39 [docmaker] Improve HTML code for table of contents..
* src/toold/docmaker/tohtml.py: Introduce a new table class `toc',
together with proper CSS.
2014-11-29 22:19:29 +01:00
Werner Lemberg aa834ce580 [docmaker] Provide higher-level markup and simplify HTML.
* src/tools/docmaker/tohtml.py: Instead of using extraneous `<div>'
elements, use CSS descendants (of class `section') to format the
data.

Also remove reduntant <p> and <br> elements, replacing them with
proper CSS.

Globally reduce page width to 75%.

(block_header): Rename <div> class to `section'.
2014-11-29 20:08:29 +01:00
Werner Lemberg 572e43cd80 Minor. 2014-11-29 20:07:56 +01:00
Werner Lemberg 3bb9702387 [docmaker] Add `top' links after blocks.
* src/tools/docmaker/tohtml.py (block_footer_middle): Implement it.
2014-11-29 16:12:37 +01:00
Werner Lemberg a31f971577 * src/tools/docmaker/tohtml.py: Improve CSS for fields.
Make fields align horizotnally relative to full line width.
2014-11-29 07:18:44 +01:00
Werner Lemberg 8f795118b8 * src/tools/docmaker/tohtml.py: Fix index and TOC templates.
This thinko was introduced 2014-11-27.
2014-11-29 06:49:15 +01:00
Werner Lemberg ba1ba0cade [docmaker] Format field lists with CSS.
This also simplifies the inserted HTML code.

* src/tools/docmaker/tohtml.py
(HtmlFormatter::print_html_field_list): Do it.
2014-11-28 22:04:14 +01:00
suzuki toshiya 348fffa850 Fix compiler warning to the comparison between signed and
unsigned variable.

* src/pfr/pfrsbit.c (pfr_slot_load_bitmap): Fix the comparison
between `ypos + ysize' and FT_INT_{MAX,MIN}.
2014-11-28 16:05:59 +09:00
Werner Lemberg 46d4dc86e1 [docmaker] Replace empty `<td>' with CSS..
* src/tools/docmaker/tohtml.py (HtmlFormatter::section_enter): Do
it.
2014-11-28 05:49:56 +01:00
Werner Lemberg 984e07176c [docmaker] Replace some `<table>' tags with `<h4>' and `<div>'.
* src/tools/docmaker/tohtml.py (marker_*): Use `<h4>'.
(source_*): Use `<div>'.
(HtmlFormatter::block_enter): s/<h4>/<h3>/.
2014-11-28 05:33:58 +01:00
suzuki toshiya 9ee6a0a085 Fix compiler warning to conversion specifiers in debug messages.
* src/autofit/afhints.c (af_glyph_hints_dump_points): Add length
modifier to dump long integers.  (af_glyph_hints_dump_segments,
af_glyph_hints_dump_edges): Ditto.
2014-11-28 11:14:18 +09:00
Werner Lemberg 7ea363402c * src/tools/docmaker/tohtml.py: Usee more CSS for index. 2014-11-27 19:38:31 +01:00
Werner Lemberg edcf817efa [docmaker] Replace `name' attribute of `<a>' with `id'.
* src/tools/docmaker/tohtml.py (HtmlFormatter::block_enter): Do it.
2014-11-27 19:28:48 +01:00
Werner Lemberg 26d699ed84 * src/tools/docmaker/tohtml.py: Remove remaining `width' attributes.
For `Index' and `TOC' links, we now simply use the `text-align' CSS
property of `<td>' to enforce flush-left and flush-right,
eliminating the hack with an empty, full-width `<td>' element
inbetween.

The change also enforces the same (smaller) size for all index and
TOC links.
2014-11-27 19:22:52 +01:00
suzuki toshiya 1b12f5d126 * src/cff/cf2font.c: Include `ftcalc.h' to use FT_MSB(),
cf2font.c could not find it under `make multi' build.
2014-11-28 01:22:26 +09:00
suzuki toshiya 2676e07aa4 * src/smooth/ftsmooth.c (ft_smooth_render_generic): Remove
unrequired negative value check for `width' and `height'.
2014-11-28 00:58:25 +09:00
Werner Lemberg dd3fee072c * src/tools/docmaker/tohtml.py: More HTML table refactoring.
Replace some `<table>' tags with `<div>' to simplify structure.

Move `bgcolor' attribute to CSS.

Replace most `width' attributes with CSS.  The remaining instances
(providing a similar effect as LaTeX's `\hfill' command) are removed
in a later patch.
2014-11-27 13:20:52 +01:00
Werner Lemberg a45b701a59 Minor documentation update. 2014-11-27 12:18:34 +01:00
Werner Lemberg 339d830efe [docmaker] Typos. 2014-11-27 12:03:17 +01:00
Werner Lemberg a5ad26afea * src/tools/docmaker/tohtml.py: Replace <font> with CSS. 2014-11-27 11:05:57 +01:00
Werner Lemberg ba67c61972 * src/tools/docmaker/tohtml.py: Center <table> with CSS. 2014-11-27 11:05:11 +01:00
Werner Lemberg 5594fa549d * src/tools/docmaker/tohtml.py: Replace `<center>' with `<div>'. 2014-11-27 11:04:18 +01:00
Werner Lemberg 433295ab6e Sort CSS entries. 2014-11-27 11:03:28 +01:00
Werner Lemberg 8585cf56c1 * src/tools/docmaker/tohtml.py: Remove redundant `<center>' tags.
This starts a series of commits into the direction of generating
valid HTML 5 code, especially using much more CSS.
2014-11-27 11:03:09 +01:00
suzuki toshiya 1b057040d8 Prevent too negative values (< FT_INT_MIN) in bitmap metrics,
suggested by Alexei.

* src/pfr/pfrsbit.c (pfr_slot_load_bitmap): Prevent too
negative values in `xpos' and `ypos + ysize'.
* src/smooth/ftsmooth.c (ft_smooth_render_generic): Prevent
too negative values in `x_left' and `y_top'.  Either negative
values in `width' and `height' are checked.
2014-11-27 17:53:20 +09:00
Werner Lemberg c52882ab72 [docmaker] Produce better HTML code.
* src/tools/docmaker/tohtml.py: Always use double quotes for
attribute values.
(source_footer): Close `td' and `tr' groups.
2014-11-27 08:01:25 +01:00
Werner Lemberg dbb93157d5 Use better way to disable creation of .pyc files for `make refdoc'.
Python 2.6 was released in 2008...

* builds/freetype.mk (refdoc): Use python's `-B' option.

* builds/detect.mk (std_setup, dos_setup): Mention required python
version for `refdoc' target.
2014-11-27 07:20:48 +01:00
Werner Lemberg 4e7f89e3d7 [docmaker] Cosmetics. 2014-11-27 07:00:10 +01:00
Werner Lemberg e8a5c33e9f * src/tools/docmaker/sources.py (re_bold, re_italic): Use
non-grouping parentheses.
* src/tools/docmaker/tohtml.py (HtmlFormatter::make_html_word):
Updated.
2014-11-27 06:48:37 +01:00
Werner Lemberg 3d167cbe7f * src/base/ftobjs.c (FT_Get_Glyph_Name): Fix compiler warning.
Introdruced in previous change.  Reported by Alexei.
2014-11-27 05:19:41 +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 2966889126 Typo. 2014-11-26 18:43:08 +01:00
Werner Lemberg a593a04277 * src/cache/ftcbasic.c: Use single calls to `FT_TRACE'. 2014-11-26 18:42:48 +01:00
suzuki toshiya cd4a5a26e5 * src/base/ftobj.c (Mac_Read_POST_Resource): Additional
overflow check in the summation of POST fragment lengths,
suggested by Mateusz Jurczyk <mjurczyk@google.com>.
2014-11-27 00:41:17 +09:00
suzuki toshiya 1720e81e3e * src/base/ftobjs.c (Mac_Read_POST_Resource): Insert comments
and fold too long tracing messages.
2014-11-26 17:56:49 +09:00
suzuki toshiya 18a8f0d994 Fix Savannah bug #43540.
* src/base/ftmac.c (parse_fond): Prevent a buffer overrun
caused by a font including too many (> 63) strings to store
names[] table.
2014-11-26 17:56:30 +09:00
suzuki toshiya 453316792f * src/base/ftobjs.c (Mac_Read_POST_Resource): Use unsigned long
variables to read the lengths in POST fragments.  Suggested by
Mateusz Jurczyk <mjurczyk@google.com>.
2014-11-26 17:56:09 +09:00
suzuki toshiya 35252ae9aa Fix Savannah bug #43539.
* src/base/ftobjs.c (Mac_Read_POST_Resource): Fix integer overflow
by a broken POST table in resource-fork.
2014-11-26 17:55:55 +09:00
suzuki toshiya 240c94a185 Fix Savannah bug #43538.
* src/base/ftobjs.c (Mac_Read_POST_Resource): Fix integer overflow
by a broken POST table in resource-fork.
2014-11-26 17:55:41 +09:00
suzuki toshiya 5aff85301b * src/base/ftobjs.c (Mac_Read_POST_Resource): Avoid memory leak
by a broken POST table in resource-fork.  Return after freeing
the buffered POST table when it is found to be broken.
2014-11-26 17:55:30 +09:00
Werner Lemberg 02b8e7e8d7 */*: s/Invalid_Argument/Invalid_Size_Handle/ where appropriate. 2014-11-25 11:31:51 +01:00
Werner Lemberg 0d4aa23e7c */*: s/Invalid_Argument/Invalid_Stream_Handle/ where appropriate. 2014-11-25 11:26:14 +01:00
Werner Lemberg f4f9e68800 */*: s/Invalid_Argument/Invalid_Library_Handle/ where appropriate. 2014-11-25 11:11:55 +01:00
Werner Lemberg 04c2aa18bf */*: s/Invalid_Argument/Invalid_Outline/ where appropriate. 2014-11-25 10:22:12 +01:00
Werner Lemberg 04edbbda3c */*: s/Invalid_Argument/Invalid_Face_Handle/ where appropriate. 2014-11-25 10:21:13 +01:00
Werner Lemberg 3e86711ebf [Savannah bug #43682] Adjust some renderer callbacks.
* src/raster/ftraster.c (ft_black_set_mode): Change return type to
`int' to stay in sync with `FT_Renderer_SetModeFunc' prototype.

* src/smooth/ftgrays.c (gray_raster_set_mode): New dummy function
for orthogonality.
(ft_grays_raster): Use it.
2014-11-25 09:01:07 +01:00
Werner Lemberg 6689a009ce [Savannah bug #43682] Properly handle missing return errors.
The functions in this patch *do* return non-trivial errors that must
be taken care of.

* src/autofit/afloader.c (af_loader_load_g), src/base/ftobjs.c
(FT_Render_Glyph_Internal), src/base/ftoutln.c (FT_Outline_Render),
src/cff/cffgload.c (cff_decoder_parse_charstrings) <cff_op_endchar>,
src/psaux/psobjs.c (ps_parser_load_field_table), src/psaux/t1decode
(t1_decoder_parse_charstrings) <op_endchar>, src/truetype/ttgload.c
(load_truetype_glyph <subglyph loop>, tt_loader_init,
TT_Load_Glyph), src/truetype/ttgxvar.c (TT_Set_MM_Blend),
src/truetype/ttobjs.c (tt_size_run_fpgm, tt_size_run_prep): Do it.
2014-11-25 08:53:09 +01:00
Werner Lemberg b24e8ba28a [Savannah bug #43682] Add/remove `void' casts to some functions.
We use a cast to indicate that we intentionally ignore a function's
return value.  However, this doesn't apply to API functions where
errors can only happen for trivially invalid input.

* src/base/ftstroke.c (FT_Glyph_Stroke, FT_Glyph_StrokeBorder),
src/base/ftsynth.c (FT_GlyphSlot_Embolden), src/cff/cffgload.c
(cff_slot_load), src/pfr/pfrdrivr.c (pfr_get_kerning),
src/type1/t1load.c (parse_encoding), src/type42/t42parse.c
(t42_parse_encoding): Do it.
2014-11-25 08:30:49 +01:00
Werner Lemberg 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 6889f7b72d Remove all code related to FT_MAX_CHARMAP_CACHEABLE.
This is no longer used.

* src/base/ftobjs.c, src/cache/ftccmap.c, src/cff/cffobjs.c,
src/sfnt/ttcmap.c: Do it.
2014-11-24 17:16:08 +01:00
Werner Lemberg f0292bb992 [sfnt] Fix Savannah bug #43680.
This adds an additional constraint to make the fix from 2013-01-25
really work.

* src/sfnt/ttsbit.c (tt_sbit_decoder_load_image) <index_format==4>:
Check `p' before `num_glyphs'.
2014-11-24 10:51:21 +01:00
Werner Lemberg eca0f06706 [truetype] Fix Savannah bug #43679.
* src/truetype/ttpload.c (tt_face_load_hdmx): Check minimum size of
`record_size'.
2014-11-24 10:22:08 +01:00
Jarkko Pöyry 96341dc378 [cff, pfr, psaux, winfonts] Fix Savannah bug #43676.
Don't cast cmap init function pointers to an incompatible type.

Without this patch, the number of parameters between declaration and
the real signature differs.  Calling such a function results in
undefined behavior.

  ISO/IEC 9899:TC3 (Committee Draft September 7, 2007)
    6.5.2.2 Function calls
      9 If the function is defined with a type that is not
        compatible with the type (of the expression) pointed to by
        the expression that denotes the called function, the
        behavior is undefined.

On certain platforms (c -> js with emscripten) this causes
termination of execution or invalid calls because in the emscripten
implementation, function pointers of different types are stored in
different pointer arrays.  Incorrect pointer type here results in
indexing of an incorrect array.

* src/cff/cffcmap.c (cff_cmap_encoding_init, cff_cmap_unicode_init),
src/pfr/pfrcmap.c (pfr_cmap_init), src/psaux/t1cmap.c
t1_cmap_standard_init, t1_cmap_expert_init, t1_cmap_custom_init,
t1_cmap_unicode_init), src/winfonts/winfnt.c (fnt_cmap_init): Fix
signature.
2014-11-24 09:53:07 +01:00
Werner Lemberg f70d9342e6 [sfnt] Fix Savannah bug #43672.
* src/sfnt/ttkern.c (tt_face_load_kern): Use correct value for
minimum table length test.
2014-11-24 09:31:32 +01:00
Werner Lemberg 73be9f9ab6 [type1, type42] Another fix for Savannah bug #43655.
* src/type1/t1load.c (parse_charstrings), src/type42/t42parse.c
(t42_parse_charstrings): Add another boundary testing.
2014-11-24 07:30:05 +01:00
Werner Lemberg a7a4207d10 [docmaker] Formatting, copyright, improved documentation.
* src/tools/docmaker/*: No code changes besides trivial
modifications.
2014-11-24 06:44:45 +01:00
Werner Lemberg f1094c0951 Minor documentation reordering. 2014-11-22 18:54:51 +01:00
Werner Lemberg d26cd5ed27 The FT_LOAD_BITMAP_CROP flag is obsolete.
It's not used by any driver.
2014-11-22 18:49:25 +01:00
Werner Lemberg af8346172a [bdf] Fix Savannah bug #43660.
* src/bdf/bdflib.c (_bdf_parse_glyphs) <"ENDFONT">: Check
`_BDF_GLYPH_BITS'.
2014-11-22 13:29:10 +01:00
Werner Lemberg 42fcd6693e [type42] Allow only embedded TrueType fonts.
This is a follow-up to Savannah bug #43659.

* src/type42/t42objs.c (T42_Face_Init): Exclusively use the
`truetype' font driver for loading the font contained in the `sfnts'
array.
2014-11-22 12:44:33 +01:00
Werner Lemberg 3788187e0c [type42] Fix Savannah bug #43659.
* src/type42/t42objs.c (T42_Open_Face): Initialize `face->ttf_size'.

* src/type42/t42parse.c (t42_parse_sfnts): Always set
`face->ttf_size' directly.  This ensures a correct stream size in
the call to `FT_Open_Face', which follows after parsing, even for
buggy input data.
Fix error messages.
2014-11-22 10:46:47 +01:00
Werner Lemberg 5f201ab5c2 [cff] Fix Savannah bug #43658.
* src/cff/cf2ft.c (cf2_builder_lineTo, cf2_builder_cubeTo): Handle
return values of point allocation routines.
2014-11-22 09:16:39 +01:00
Werner Lemberg 801b35fe81 Formatting. 2014-11-22 07:21:11 +01:00
Werner Lemberg 9bd20b7304 [sfnt] Fix Savannah bug #43656.
* src/sfnt/ttcmap.c (tt_cmap4_validate): Fix order of validity
tests.
2014-11-22 06:24:45 +01:00
Werner Lemberg dd89710f0f [type1, type42] Fix Savannah bug #43655.
* src/type1/t1load.c (parse_charstrings), src/type42/t42parse.c
(t42_parse_charstrings): Fix boundary testing.
2014-11-21 22:19:28 +01:00
Werner Lemberg b1fc00d5dc * src/pcf/pcfread.c (pcf_get_metrics): Sanitize invalid metrics. 2014-11-21 12:06:40 +01:00
Werner Lemberg 23c093fc38 Minor. 2014-11-21 08:41:39 +01:00
Werner Lemberg 9154dab815 [ftlcdfil] Obey flow direction.
* src/base/ftlcdfil.c (_ft_lcd_filter_fir, _ft_lcd_filter_legacy):
Handle `up' flow.
2014-11-21 08:03:51 +01:00
Werner Lemberg 644d6fab7e * src/base/ftbitmap.c (FT_Bitmap_Convert): Improve.
This commit completes argument checks and adds support for different
flow directions.
2014-11-21 07:28:50 +01:00
Werner Lemberg 6de761744c * src/base/ftbitmap.c (FT_Bitmap_Copy): Improve.
This commit adds argument checks and support for different flow
directions.
2014-11-21 06:38:46 +01:00
Werner Lemberg 1e6e1b8390 * src/base/ftbitmap.c (FT_Bitmap_New): Check argument. 2014-11-21 06:38:46 +01:00
Werner Lemberg b3500af717 Change some fields in `FT_Bitmap' to unsigned type.
This doesn't break ABI.

* include/ftimage.h (FT_Bitmap): Make `rows', `width', `num_grays',
`pixel_mode', and `palette_mode' unsigned types.

* src/base/ftbitmap.c: Updated.
(FT_Bitmap_Copy): Fix casts.

* src/cache/ftcsbits.c, src/raster/ftraster.c, src/sfnt/pngshim.c:
Updated.
2014-11-21 06:38:46 +01:00
Werner Lemberg df485774fb Make `FT_Bitmap_Convert' correctly handle negative `pitch' values.
* src/base/ftbitmap.c (FT_Bitmap_Convert): Always use positive value
for the pitch while copying data.
Correctly set pitch sign in target bitmap.
2014-11-21 06:38:46 +01:00
Werner Lemberg d6061212c3 Minor code improvement in `FT_Bitmap_Embolden'.
* src/base/ftbitmap.c (FT_Bitmap_Embolden) <FT_PIXEL_MODE_GRAY[24]>:
Fix thinko.
2014-11-21 06:38:01 +01:00
Werner Lemberg 8d05486eab Minor documentation improvements and whitespace. 2014-11-21 06:10:25 +01:00
Alexei Podtelezhnikov 237c0abfdc Trailing space. 2014-11-19 22:10:29 -05:00
Alexei Podtelezhnikov f841ad3ec2 * src/base/fttrigon.c: Use dedicated `FT_Angle' for arctan table. 2014-11-19 21:19:06 -05:00
Werner Lemberg a67c43e1c8 Avoid compiler warnings on x86-64 for `FT_MulFix'.
`FT_MulFix' takes `FT_Long' parameters as defined in `freetype.h',
but several inline implementations of it in `ftcalc.h' take
`FT_Int32' arguments.  This is causing compiler warnings on x86-64:
If parameters of type `FT_Fixed' (= `FT_Long') are passed to the
inline implementation of this function, integer values are truncated
from 64bit to 32bit.

* include/internal/ftcalc.h (FT_MulFix) [FT_MULFIX_ASSEMBLER]: Add
casts.
2014-11-19 06:46:23 +01:00
Werner Lemberg 54abd22891 [sfnt] Fix Savannah bug #43597.
* src/sfnt/pngshim.c (Load_SBit_Png): Protect against too large
bitmaps.
2014-11-15 09:05:22 +01:00
Werner Lemberg 257c270bd2 [sfnt] Fix Savannah bug #43591.
* src/sfnt/ttsbit.c (tt_sbit_decoder_init): Protect against addition
and multiplication overflow.
2014-11-12 21:42:13 +01:00
Werner Lemberg 677ddf4f1d [sfnt] Fix Savannah bug #43590.
* src/sfnt/ttload.c (check_table_dir, tt_face_load_font_dir):
Protect against addition overflow.
2014-11-12 21:26:44 +01:00
Werner Lemberg f46add1389 [sfnt] Fix Savannah bug #43589.
* src/sfnt/sfobjs.c (woff_open_font): Protect against addition
overflow.
2014-11-12 21:06:08 +01:00
Werner Lemberg 602040b111 [sfnt] Fix Savannah bug #43588.
* src/sfnt/ttcmap.c (tt_cmap8_validate, tt_cmap10_validate,
tt_cmap12_validate, tt_cmap13_validate, tt_cmap14_validate): Protect
against overflow in additions and multiplications.
2014-11-12 20:51:20 +01:00
Alexei Podtelezhnikov 2e73a1b4fd [base] CORDIC improvements.
The scaling between the hypotenuse and its CORDIC approximation is
based on regression analysis. The smaller padding for `theta' is
justifed by its maximum error of less than 6.

* src/base/fttrigon.c (ft_trig_downscale): Borrow code from
./ftcalc.c (ft_multo64), change linear intercept.
(ft_trig_pseudo_polarize): Decrease `theta' padding.
2014-11-09 23:22:43 -05:00
Werner Lemberg c3e9f02605 Minor documentation fixes. 2014-11-09 23:21:37 +01:00
Werner Lemberg 0e73d218bc * src/base/ftstroke.c (ft_stroker_inside): Fix border intersections.
One more place to check whether `radius' is zero.

Problem reported by Marco Wertz <marco.wertz@gmx.de>.
2014-11-09 01:27:38 +01:00
Werner Lemberg 2c4832d309 Fix Savannah bug #43535.
* src/bdf/bdflib.c (_bdf_strncmp): New macro that checks one
character more than `strncmp'.
s/ft_strncmp/_bdf_strncmp/ everywhere.
2014-11-07 07:42:33 +01:00
Werner Lemberg ef1eba7518 Fix Savannah bug #43548.
* src/pcf/pcfread (pcf_get_encodings): Add sanity checks for row and
column values.
2014-11-06 23:25:05 +01:00
Werner Lemberg 0e2f5d518c Fix Savannah bug #43547.
* src/pcf/pcfread.c (pcf_read_TOC): Check `size' and `offset'
values.
2014-11-06 22:32:46 +01:00
Werner Lemberg f49a100a6c * src/pcf/pcfread.c (pcf_read_TOC): Avoid memory leak. 2014-11-06 13:30:28 +01:00
Infinality facfc79a16 * src/truetype/ttsubpix.c (COMPATIBILITY_MODE_Rules): Updated.
The previous commit deteriorates rendering of DejaVu and similar
fonts; this gets compensated with this rule.
2014-11-03 07:24:59 +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 525d4876be [smooth] Improve code readability.
* src/smooth/ftsmooth.c (ft_smooth_render_generic): Rearrange code.
2014-10-31 22:12:37 -04:00
Alexei Podtelezhnikov e1efe0a2fc [smooth] Reduce outline translations during rendering.
* src/smooth/ftsmooth.c (ft_smooth_render_generic): Translate origin
virtually by modifying cbox, actually translate outline if cumulative
shift is not zero.
2014-10-31 00:07:14 -04:00
Alexei Podtelezhnikov c7fd93565c [smooth] Fix Savannah bug #35604 (cont'd).
* src/smooth/ftsmooth.c (ft_smooth_render_generic): Remove checks and
casts that became unnecessary after the variable type upgrades.
2014-10-30 22:43:01 -04:00
Alexei Podtelezhnikov 465ab99585 [smooth] Improve code readability.
* src/smooth/ftsmooth.c (ft_smooth_render_generic): Rearrange code.
2014-10-29 23:45:23 -04:00
Alexei Podtelezhnikov 74916997de Unify hypotenuse approximations.
* include/internal/ftcalc.h (FT_HYPOT): Move macro from here...
* include/internal/ftobjs.h: ... to here, next to required `FT_ABS'.
* src/smooth/ftgrays.c (gray_render_cubic): Use it here.
2014-10-29 22:24:24 -04:00
Werner Lemberg d8632a842e Improve comments, remove dead code. 2014-10-25 06:28:18 +02:00
Werner Lemberg fe15152ce7 [cff] Test valid darkening parameter macros in `ftoption.h'.
We no longer need an otherwise unused typedef that can cause a gcc
warning.
Problem reported by Alexei.

* src/cff/cffobjs.c (cff_driver_init): Use
`CFF_CONFIG_OPTION_DARKENING_PARAMETER_XXX' macros directly.
(SET_DARKENING_PARAMETERS): Removed.
Compile time tests are now ...

* devel/ftoption.h, include/config/ftoption.h: ... here.
2014-10-25 05:56:59 +02:00
Alexei Podtelezhnikov aba0f498c3 Improve flat corner definition.
* include/internal/ftcalc.h (FT_HYPOT): Macro to approximate Euclidean
distance with the alpha max plus beta min algorithm.
* src/base/ftcalc.c (ft_corner_is_flat): Use it instead of Taxicab metric.
2014-10-24 23:50:57 -04:00
Werner Lemberg d0422b23d3 Whitespace. 2014-10-25 05:20:08 +02:00
David Weiß dd8de1a008 [build] Improve property file for vc2010.
User-defined properties should be empty by default to prevent linker
failures.

* builds/windows/vc2010/freetype.user.props,
builds/windows/vc2010/freetype.vcxproj:
s/OptionsDirectory/UserOptionDirectory/.
Comment out all user options.
2014-10-23 20:01:48 +02:00
Werner Lemberg dd570e99ab [cff] Work around bug in preprocessor of MSVC 2010.
We have been hit by

  https://connect.microsoft.com/VisualStudio/feedback/details/718976/msvc-pr

* devel/ftoption.h, include/config/ftoption.h: Replace
`CFF_CONFIG_OPTION_DARKENING_PARAMETERS' with eight macros
`CFF_CONFIG_OPTION_DARKENING_PARAMETER_{X,Y}{1,2,3,4}'.

* src/cff/cffobjs.c (SET_DARKENING_PARAMETERS): Removed.  We no
longer need double expansion.
(SET_DARKENING_PARAMETERS_0): Renamed to ...
(SET_DARKENING_PARAMETERS): ... this.
Update call.
2014-10-23 19:57:37 +02:00
Werner Lemberg cc7bb80bde [sbit] Minor fixes.
* src/sfnt/ttsbit.c (tt_face_load_sbit) [TT_SBIT_TABLE_TYPE_SBIX]:
Accept overlay format also, but emit warning message in that case.
(tt_sbit_decoder_load_metrics): Add missing newline to error
message.
(tt_sbit_load_sbix_image): Add `rgbl' graphic type (as used on iOS
7.1) to the list of unsupported formats.
2014-10-20 08:35:50 +02: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
David Weiß fede19ec1c [build] Add property file to vc2010 project.
This simplifies custom build configurations, especially for
automated build environments.

* builds/windows/vc2010/freetype.user.props: New configuration file.

* builds/windows/vc2010/freetype.vcxproj: Include
`freetype.user.props' and use its data fields.

* builds/windows/vc2010/index.html: Updated.
2014-10-18 16:44:44 +02:00
Alexei Podtelezhnikov d4aabda388 [truetype] Unwrap engine compensation settings.
* src/truetype/ttobjs.c (tt_size_init_bytecode): Updated.
2014-10-18 10:10:04 -04:00
Werner Lemberg c9c33f202e [autofit] Add blue-zone support for Telugu.
This essentially moves the Telugu script from the `Indic' hinter to
the `Latin' hinter.

Note that this is a first shot and quite certainly needs
refinements.

* src/autofit/afblue.dat: Add blue zone data for Telugu.

* src/autofit/afblue.c, src/autofit/afblue.h: Regenerated.

* src/autofit/afscript.h: Add Telugu standard characters and move
data out of AF_CONFIG_OPTION_INDIC block.

* src/autofit/afranges.c: Move Telugu data out of
AF_CONFIG_OPTION_INDIC block.

* src/autofit/afstyles.h: Update Telugu data; in particular, use
AF_WRITING_SYSTEM_LATIN.
2014-10-18 11:01:14 +02:00
Werner Lemberg 1050aa9df0 Minor. 2014-10-18 10:45:09 +02:00
Werner Lemberg 54306f5a9f [cmake] Add iOS build support.
* builds/cmake/iOS.cmake: New file.  Universal binaries are built
with both 32 and 64 bit arm architectures.

* CMakeLists.txt (IOS_PLATFORM): New variable for running the iOS
toolchain.  Possible values are `OS' to build on iOS, or
`SIMULATOR' to build on APPLE.
2014-10-18 10:42:28 +02:00
Werner Lemberg 2e529bdb95 Improve documentation of FT_GlyphSlotRec.
Based on a suggestion by Phil Endecott <freetype@chezphil.org>.
2014-10-16 23:32:42 +02:00
Werner Lemberg 1a1750fb8a [cff] Add `CFF_CONFIG_OPTION_DARKENING_PARAMETERS' config macro.
* devel/ftoption.h, include/config/ftoption.h
(CFF_CONFIG_OPTION_DARKENING_PARAMETERS): New macro.

* src/cff/cffobjs.c (SET_DARKENING_PARAMETERS,
SET_DARKENING_PARAMETERS_0): New macros.
(cff_driver_init): Use new macros.
2014-10-16 22:54:01 +02:00
Werner Lemberg df3d67e0d7 Typos. 2014-10-16 07:24:44 +02:00
Werner Lemberg 03987bfdbf A better fix for Savannah bug #43392.
Suggested by Doug Felt <dougfelt@gmail.com>.

* src/sfnt/ttsbit.c (tt_sbit_decoder_load_metrics): Set
`vertAdvance' to zero...

* src/truetype/ttgload.c (TT_Load_Glyph): ... and set here a default
value for `vertAdvance' based on `linearVertAdvance' in case
`vertAdvance' is zero.  Note that the previous computed ad-hoc value
for `linearVertAdvance' was apparently not tested in a real-life
situation.
2014-10-16 07:22:55 +02: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
David Weiß 3889cb2faa [build] Better optimization settings for vc2010 solution file.
* builds/windows/vc2010/freetype.sln,
builds/windows/vc2010/freetype.vcxproj: Updated.
2014-10-14 11:35:16 +02:00
Werner Lemberg 8f17809b2d [autofit] Adjust Devenagari character range.
* src/autofit/afranges.c (af_deva_uniranges): Omit characters that
are common to all other Indic scripts.
2014-10-14 08:28:09 +02:00
Werner Lemberg 1ca5fa15b0 [sfnt] Fix Savannah bug #43392.
* src/sfnt/ttsbit.c (tt_sbit_decoder_load_metrics): Don't let
vertical metrics uninitialized.
2014-10-12 08:31:32 +02:00
Alexei Podtelezhnikov 673a28ef93 [base] Small bbox correction.
* src/base/ftbbox.c (FT_Outline_Get_BBox): Start from nonsense bbox
instead of initial point that could be `off' in conic outlines.
2014-10-11 14:40:51 -04:00
Alexei Podtelezhnikov 9cc0ad7bf5 Formatting. 2014-10-11 14:09:28 -04:00
Alexei Podtelezhnikov 40dac11360 [base] Fix Savannah bug #43356.
* src/base/ftbbox.c (BBox_Move_To, BBox_Conic_To): Update bbox in case
of implicit `to'.
(BBox_Line_To): New emitter that does not update bbox.
2014-10-09 00:58:14 -04:00
Alexei Podtelezhnikov 2ffcf17e15 [base] Introduce and use new macro `FT_UPDATE_BBOX'
* src/base/ftbbox.c (FT_UPDATE_BBOX): New macro.
(FT_Outline_Get_BBox): Use it here.
2014-10-08 22:01:08 -04:00
Alexei Podtelezhnikov 7abdb8ccea [base] Significant optimization of `ft_div64by32'
We shift as many bits as we can into the high register, perform
32-bit division with modulo there, then work through the remaining
bits with long division. This optimization is especially noticeable
for smaller dividends that barely use the high register.

* src/base/ftcalc.c (ft_div64by32): Updated.
2014-10-02 23:13:33 -04:00
Werner Lemberg c0ce72a6de Formatting. 2014-10-02 06:44:43 +02:00
Dave Arnold 537c55d39d [cff] Fix Savannah bug #43271.
* src/cff/cf2font.c (cf2_computeDarkening): Change overflow
detection to use logarithms and clamp `scaledStem'.
2014-10-02 06:32:32 +02:00
Alexei Podtelezhnikov 74d0aad22c * src/base/ftcalc.c: Remove miscellaneous type casts. 2014-10-01 23:27:15 -04:00
Alexei Podtelezhnikov 418e18f3df [base] Use more common `FT_MSB' implementation with masks.
* src/base/ftcalc.c (FT_MSB): Updated.
2014-10-01 22:36:40 -04:00
Alexei Podtelezhnikov 955aff12c0 [base] Clean up.
* src/base/ftcalc.c (FT_MOVE_SIGN): New macro for frequently used code.
2014-09-30 23:09:39 -04:00
Alexei Podtelezhnikov f78ca0dbb9 Remove commented out code. 2014-09-30 22:53:38 -04:00
Alexei Podtelezhnikov 7f49111f81 [base] Avoid unnecessary long division.
This applies to `FT_MulDiv' but not to `FT_DivFix', where overflows or
lack thereof are predicted accurately.

* src/base/ftcalc.c (ft_div64by32): Improve readability.
(FT_MulDiv, FT_MulDiv_No_Round) [!FT_LONG64]: Use straight division
when multiplication stayed within 32 bits.
2014-09-25 22:54:38 -04:00
Werner Lemberg 5b68e4fb60 [autofit] Minor clean-ups.
* src/autofit/afhints.c (AF_FLAGS): Remove obsolete values.

* src/autofit/afhints.c (af_glyph_hints_dump_points,
af_glyph_hints_align_strong_points): Updated.

* src/autofit/aflatin.c (af_latin_hints_link_segments,
af_latin_hints_compute_segments), src/autofit/afcjk.c
(af_cjk_hints_link_segments), src/autofit/aflatin2.c
(af_latin2_hints_link_segments, af_latin2_hints_compute_segments):
There are no longer fake segments since more than 10 years...
2014-09-24 19:06:13 +02:00
Alexei Podtelezhnikov 0753c0c35e Minor documentation fixes. 2014-09-22 22:06:38 -04:00
Werner Lemberg 7a615283cb [autofit] Minor. 2014-09-22 08:38:00 +02:00
Werner Lemberg 387a9fe73d [autofit] Minor code streamlining.
* src/autofit/afhints.c (af_axis_hints_new_edge): Remove redundant
initialization.
2014-09-22 06:42:24 +02:00
Werner Lemberg 378266dc1a Formatting. 2014-09-22 06:33:38 +02:00
Alexei Podtelezhnikov 5c894842d3 * src/base/ftcalc.c: Harmonize code. 2014-09-19 22:03:15 -04:00
Alexei Podtelezhnikov ef070d458b [base] Tighten the overflow check in `FT_MulDiv'.
* src/base/ftcalc.c (FT_MulDiv) [!FT_LONG64]: Updated.
2014-09-15 22:06:19 -04:00
Alexei Podtelezhnikov bc12d9e9ac Fix Savannah bug #43153.
* src/psaux/psconv.c (PS_Conv_ToFixed): Add protection against
overflow in `divider'.
2014-09-08 21:27:43 -04:00
Alexei Podtelezhnikov 336735d8de [base] Tighten the overflow check in `FT_DivFix'.
This fixes a 13-year old bug. The original overflow check should have
been updated when rounding was introduced into this function
(c2cd00443b).

* src/base/ftcalc.c (FT_DivFix) [!FT_LONG64]: Updated.
* include/freetype.h (FT_DivFix): Updated documentation.
2014-09-03 22:55:26 -04:00
Alexei Podtelezhnikov 3212852cce [base] Tighten the overflow check in `FT_MulFix'.
* src/base/ftcalc.c (FT_MulFix) [!FT_LONG64]: Updated.
2014-09-03 21:57:42 -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
Alexei Podtelezhnikov 5bb5750f98 Minor. 2014-08-21 23:44:44 -04:00
Alexei Podtelezhnikov 986885965a Fix Savannah bug #43033.
* include/config/ftconfig.h, builds/unix/ftconfig.in,
builds/vms/ftconfig.h [FT_LONG64]: Do not disable the macro when
64-bit type is `long'.
2014-08-21 23:28:52 -04:00
Werner Lemberg 70961e5772 Minor. 2014-08-20 16:19:32 +02:00
Alexei Podtelezhnikov 8fd87d4e69 [base] Small optimization of `FT_MulFix'.
* src/base/ftcalc.c (FT_MulFix): Loosen up the condition for direct
32-bit calculations.
2014-08-20 00:57:22 -04:00
Alexei Podtelezhnikov f09326a1a6 [base] Use unsigned calculation in `FT_MulDiv'.
* src/base/ftcalc.c (FT_MulDiv): Updated to expand 32-bit range.
2014-08-20 00:08:38 -04:00
Alexei Podtelezhnikov 382f3155f6 [base] Remove truncation in `FT_DivFix'.
* src/base/ftcalc.c (FT_DivFix): Updated.
2014-08-18 23:16:15 -04:00
Alexei Podtelezhnikov 5ef2023c45 Minor refactoring.
* src/base/ftcalc.c (FT_MulDiv, FT_MulDiv_No_Round): Updated.
2014-08-14 23:21:46 -04:00
Alexei Podtelezhnikov c7022467d2 Turn FT_MSB into a macro when using gcc builtins.
* src/base/ftcalc.c, include/internal/ftcalc.h: Updated.
2014-08-14 23:01:01 -04:00
Alexei Podtelezhnikov 87e56b043a Fix comment and whitespace. 2014-08-14 22:41:06 -04:00
Alexei Podtelezhnikov f8efbcfb8e [base] Avoid undefined FT_MSB in `BBox_Cubic_Check'.
* src/base/ftbbox.c (BBox_Cubic_Check): Update.
(update_cubic_max): Repalce with...
(cubic_peak): ... this, which now handles upscaling.
2014-08-12 23:22:17 -04:00
Alexei Podtelezhnikov d2935e2969 * src/base/fttrigon.c (ft_trig_prenorm): Comment on undefined behavior. 2014-08-12 00:41:04 -04:00
Alexei Podtelezhnikov 28018d42a8 [base] Handle collapsed outlines to avoid undefined FT_MSB.
* src/base/ftoutln.c (FT_Outline_Get_Orientation): Update.
2014-08-12 00:26:16 -04:00
Alexei Podtelezhnikov 4728993fa8 [base] Restore FT_MulFix inlining.
* include/freetype.h (FT_MulFix): Unconditionally defined.

* src/base/ftcalc.c [FT_MULFIX_ASSEMBLER]: Move code from here...

* include/internal/ftcalc.h [FT_MULFIX_ASSEMBLER]: ... to here,
which conditionally replaces the function with an inline version
through the macro.
2014-08-11 23:39:34 -04:00
Alexei Podtelezhnikov 90be4b6377 * src/base/ftbitmap.c (ft_gray_for_premultiplied_srgb_bgra): Refactor. 2014-08-08 22:27:10 -04:00
Werner Lemberg e1394d5675 Minor documentation improvement. 2014-08-04 07:35:13 +02:00
Werner Lemberg d17cabf57d [cff] Fix typo.
* src/cff/cf2hints.c (cf2_glyphpath_computeOffset): Use correct
offsets in third quadrant.

Reported by maks <maksqwe1@ukr.net>.
2014-07-26 09:53:50 +09:00
Werner Lemberg 4e75413334 Fix Savannah bug #42788.
* src/pfr/pfrobjs.c: Include `ftcalc.h'.
2014-07-17 17:34:49 +09:00
Werner Lemberg cbbf26b705 Whitespace. 2014-07-17 17:27:12 +09:00
Werner Lemberg 3939c200f3 Minor. 2014-07-17 17:24:22 +09:00
Alexei Podtelezhnikov c0a6f20a4b Replace `ft_highpow2' function.
* src/pfr/pfrobjs.c (pfr_face_get_kerning): Use `FT_MSB' instead of
`ft_highpow2'.

* src/base/ftutil.c, include/internal/ftobjs.h (ft_highpow2): Remove
it.
2014-07-16 22:05:56 -04:00
Alexei Podtelezhnikov 177982e933 * src/base/ftcalc.c (FT_MSB): Utilize gcc builtins. 2014-07-15 23:54:34 -04:00
Alexei Podtelezhnikov 71330ceb50 [base] Move assembler code back in the source file.
FT_MulFix assembler used to reside in ftcalc.c before f47d263f1b.

* include/config/ftconfig.h, builds/unix/ftconfig.in,
builds/vms/ftconfig.h [FT_MULFIX_ASSEMBLER]: Move code from here...

* src/base/ftcalc.c [FT_MULFIX_ASSEMBLER]: ... to here.
2014-07-15 23:30:45 -04:00
Alexei Podtelezhnikov 1183cd4e17 [base] Further clean up color bitmap conversion.
* src/base/ftbitmap.c (ft_gray_for_premultiplied_srgb_bgra): Stop
using FT_MulFix and FT_DivFix since all calculations fit into 32 bits.
2014-07-14 22:30:55 -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 e98e2bc1aa * builds/vms/ftconfig.h: Synchronize.
Problem reported by Alexei.
2014-07-12 16:37:39 +09:00
Alexei Podtelezhnikov 35576bf067 [base] Clean up bitmap conversion.
* src/base/ftbitmap.c (ft_gray_for_premultiplied_srgb_bgra): Use
appropriate FT_DivFix and remove superfluous upscaling.
2014-07-11 22:40:34 -04:00
Alexei Podtelezhnikov 2f52df4a0d [base] Improve comment. 2014-07-05 22:29:26 -04:00
Alexei Podtelezhnikov ceab95a649 [base] Small optimization of the ancient code.
* src/base/ftcalc.c (FT_MulDiv, FT_MulDiv_No_Round): Loosen up the
condition for direct 32-bit calculations.
2014-07-04 23:01:32 -04:00
Werner Lemberg 3897556a13 Fix Apple standard glyph names.
* src/sfnt/ttpost.c (tt_post_default_names): Synchronize with
`tools/glnames.py'

Problem reported by Adam Twardoch <adam@fontlab.com>.
2014-06-27 06:55:56 +02:00
Werner Lemberg ccf60ad445 Formatting. 2014-06-25 08:58:14 +02:00
Werner Lemberg 231171fc3a Partially revert commit from 2014-06-13.
* src/autofit/aflatin.c (af_latin_metrics_init_blues): Move
declaration of `p_first' and `p_last' out of the loop.
2014-06-17 09:14:32 +02:00
Werner Lemberg cf2347c962 * builds/unix/freetype2.m4: s/AC_PATH_PROG/AC_PATH_TOOL/.
This simplifies cross-compiling.
2014-06-17 09:01:04 +02:00
Werner Lemberg d708658c4a And another warning from Wojciech. 2014-06-13 15:56:11 +02:00
Werner Lemberg e5c0fff5af Fix more compiler warnings.
Reported by Wojciech Mamrak <wmamrak@gmail.com>.

* src/autofit/afglobal.c (af_face_globals_compute_style_coverage):
Make integer constant unsigned.

* src/sfnt/ttsbit.c (tt_face_load_strike_metrics)
<TT_SBIT_TABLE_TYPE_SBIX>: Fix types.
(tt_sbit_decoder_load_compound, tt_face_load_sbix_image): Add proper
casts.
2014-06-13 14:01:20 +02: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
Werner Lemberg 099489feff Update CHANGES file. 2014-06-10 06:51:52 +02:00
Alexey Petruchik 02f2170432 [cmake] Add option to build OS X framework.
* CMakeLists.txt: Update accordingly.

* builds/mac/freetype-Info.plist: New file.
2014-05-16 08:09:43 +02:00
Werner Lemberg d7f4594317 [autofit] Fix comment. 2014-05-13 15:33:11 +02:00
Pavel Koshevoy 15da66a630 * CMakeLists.txt (BASE_SRCS): Add missing `ftbdf.c'. 2014-05-13 07:33:48 +02:00
Werner Lemberg faa21472b7 [autofit] Fix variable initializations.
* src/autofit/afhints.c (af_glyph_hints_reload): Assign default
values to `in_dir' and `out_dir' for all points.
2014-05-11 12:44:00 +02:00
Werner Lemberg 07e7b8affe [autofit] Fix crash with font `CabinSketch-Bold.ttf'.
Problem reported by Ralf S. Engelschall <rse@engelschall.com>.

* src/autofit/afhints.c (af_glyph_hints_reload): Fix threshold for
finding first non-near point.
Properly initialize non-near point deltas.
2014-05-11 08:00:25 +02:00
Werner Lemberg 5f18a0c35d Formatting. 2014-05-01 17:26:52 +02:00
Werner Lemberg c576bb0d21 [autofit] Add blue-zone support for Devanagari.
This essentially moves the Devanagari script from the `Indic' hinter
to the `Latin' hinter.  Thanks to Girish Dalvi
<girish.dalvi@gmail.com> for guidance with blue zone characters!

* src/autofit/afblue.dat: Add blue zone data for Devanagari.

* src/autofit/afblue.c, src/autofit/afblue.h: Regenerated.

* src/autofit/afscript.h: Add Devanagari standard characters and
move data out of AF_CONFIG_OPTION_INDIC block.

* src/autofit/afranges.c: Move Devanagari data out of
AF_CONFIG_OPTION_INDIC block.
Move U+20B9, (new) Rupee sign, from Latin to Devanagari.

* src/autofit/afstyles.h: Update Devanagari data; in particular, use
AF_WRITING_SYSTEM_LATIN.
2014-05-01 17:24:19 +02:00
Werner Lemberg 63bef9a588 [autofit] Fix handling of neutral blue zones in stems.
* src/autofit/afhints.h (AF_Edge_Flags): New value
`AF_EDGE_NEUTRAL'.

* src/autofit/aflatin.c (af_latin_hints_compute_blue_edges): Trace
neutral blue zones with AF_EDGE_NEUTRAL.
(af_latin_hint_edges): Skip neutral blue zones if necessary.
2014-05-01 07:16:05 +02:00
Werner Lemberg ccfc4b4c4e [autofit] Introduce neutral blue zones to the latin module.
Such blue zones match either the top or the bottom of a contour.  We
need them for scripts where accent-like elements directly touch the
base character (for example, some vowel signs in Devanagari, cf.
U+0913 or U+0914).

* src/autofit/afblue.hin (AF_BLUE_PROPERTY_LATIN_NEUTRAL): New
property.

* src/autofit/afblue.h: Regenerated.

* src/autofit/aflatin.h (AF_LATIN_IS_NEUTRAL_BLUE): New macro.
(AF_LATIN_BLUE_NEUTRAL): New enumeration value.

* src/autofit/aflatin.c (af_latin_metrics_init_blues,
af_latin_hints_compute_blue_edges): Handle neutral blue zones.
2014-04-28 21:13:14 +02:00
Werner Lemberg abb3fcac85 * src/autofit/hbshim.c: Partially revert commit from 2014-04-17.
Using input glyph coverage data is simply wrong.

Problem reported by Nikolaus Waxweiler <madigens@gmail.com> and
Mantas Mikulėnas <grawity@gmail.com>.
2014-04-25 22:13:32 +02:00
Werner Lemberg 426f0e0453 Minor. 2014-04-24 07:13:31 +02:00
Werner Lemberg f193637f63 * src/raster/ftraster.c (Vertical_Sweep_Span): Use drop-out mode.
This spot has been missed while introducing support for various
drop-out modes years ago (including no drop-out mode, which this
commit fixes).

Problem reported by Patrick Thomas <pthomas505@gmail.com>.
2014-04-23 08:22:33 +02:00
Werner Lemberg d9b4470e39 * src/sfnt/pngshim.c (error_callback): s/longjmp/ft_longjmp/. 2014-04-22 07:33:07 +02:00
Werner Lemberg 98e510ee94 [autofit] Fix Savannah bug #42148.
The adaptation of the cjk auto-hinter module to blue stringsets in
2013-08-25 had three severe bugs.  Mea culpa.

1. Contrary to the latin auto-hinter, characters for reference and
   overshoot values of a blue zone are specified separately.  Due to
   the screwed-up change it didn't work at all.

2. A boolean comparison was erroneously replaced with a cast,
   causing invalid results with the `^' operator later on.  The
   visual artifact caused by this problem is the topic of the bug
   report.

3. Two flag values were inverted, causing incorrect assignment of
   reference and overshoot values.

* src/autofit/afblue.dat: Fix CJK bluestrings, introducing a new
syntax to have both reference and overshoot characters in a single
string.  This is error #1.
Add extensive comments.

* src/autofit/afblue.hin (AF_BLUE_PROPERTY_CJK_FILL): Removed, no
longer used.
(AF_BLUE_PROPERTY_CJK_TOP, AF_BLUE_PROPERTY_CJK_HORIZ): Fix values.
This is error #3.

* src/autofit/afblue.c, src/autofit/afblue.h: Regenerated.

* src/autofit/afcjk.c (af_cjk_metrics_init_blues): Correct error #1.
Use character `|' to separate characters for reference and overshoot
values.
Improve tracing messages, synchronizing them with the latin
auto-hinter.
(af_cjk_hints_compute_blue_edges): Fix value of `is_top_right_blue'.
This is error #2.
(af_cjk_align_linked_edge): Add tracing message.

* src/autofit/afcjk.h (AF_CJK_IS_FILLED_BLUE): Removed, no longer
used.
2014-04-20 22:11:27 +02:00
Werner Lemberg 8a2b690c0a Minor documentation fix. 2014-04-18 10:17:49 +02:00
Werner Lemberg 8c7fb78b16 [autofit] More coverage fixes for complex scripts.
* src/autofit/hbshim.c (af_get_coverage): Merge input glyph coverage
of GSUB lookups into output coverage.  Otherwise, ligatures are not
handled properly.
Don't check blue zone characters for default coverage.
2014-04-17 15:53:25 +02:00
Werner Lemberg bbd8313b5d Make `FT_Get_SubGlyph_Info' actually work.
* src/base/ftobjs.c (FT_Get_SubGlyph_Info): Return FT_Err_Ok
if there is no error.
2014-04-17 01:24:36 +02:00
Werner Lemberg c44a4ba4a2 Documentation fix. 2014-04-16 23:22:56 +02:00
Werner Lemberg 181fd071ee [afblue.pl]: Minor improvements.
* src/tools/afblue.pl: Allow whitespace before comments.
Ignore whitespace in strings.
2014-04-15 16:47:05 +02:00
Werner Lemberg 8b1f2a6cda [autofit] Improve coverage handling.
* src/autofit/hbshim.c (af_get_coverage): Don't exclude glyphs
appearing in the GPOS table if we are processing the default
coverage.
2014-04-14 07:58:19 +02:00
David Weber 7630787a6a [smooth] Fix stand-alone compilation.
* src/smooth/ftgrays.c (FT_BEGIN_STMNT, FT_END_STMNT): Define.
2014-04-13 15:41:13 +02:00
Werner Lemberg 8a94b1efd6 [autofit] Redesign the recognition algorithm of strong points.
In particular, local extrema without horizontal or vertical segments
are better recognized:

  + A                + D
   \                /
    \              /
     \            /
      \          /
       \        + C
        \    /
       B +/

If the distances AB and CD are large, point B wasn't previously
detected as an extremum since the `ft_corner_is_flat' function
`swallowed' BC regardless of its direction, tagging point B as weak.
The next iteration started at B and made `ft_corner_is_flat' swallow
point C, tagging it as weak also, et voilà.

To improve that, another pass gets now performed before calling
`ft_corner_is_flat' to improve the `topology' of an outline: A
sequence of non-horizontal or non-vertical vectors that point into
the same quadrant are handled as a single, large vector.

Additionally, distances of near points are now accumulated, which
makes the auto-hinter handle them as if they were prepended to the
next non-near vector.

This generally improves the auto-hinter's rendering results.

* src/autofit/afhints.c (af_glyph_hints_reload): Implement it.

* src/autofit/afhints.h (AF_FLAGS): Remove no longer used flag
`AF_FLAG_NEAR'.
2014-04-12 20:44:33 +02:00
Werner Lemberg 71f53e122b [autofit] Improve scoring algorithm for identifying stems.
Problem reported by Karsten Lücke <karsten.luecke@kltf.de>.

The new algorithm takes care of the width of stems: If the distance
between two segments is larger than the largest stem width, the
demerits quickly increase for larger distances.  This improves
hinting of slanted fonts (especially if the inner parts of serifs
have non-horizontal `shoulders'), avoiding false stem links.

* src/autofit/aflatin.c (af_latin_hints_link_segments): Use largest
stem width (if available) to compute better demerits for distances
between stems.
(af_latin_hints_detect_features): Pass stem width array and array
size.
(af_latin_metrics_init_widths): Updated to use original algorithm.
(af_latin_hints_apply): Updated to use new algorithm.

* src/autofit/aflatin.h: Updated.
* src/autofit/afcjk.c: Updated.
2014-04-05 16:27:19 +02:00
Werner Lemberg 87360a78f3 [aflatin] Improve comment. 2014-04-05 00:08:52 +02:00
Werner Lemberg f8555b5d8c Don't require `gzip' module for `sfnt'.
Reported by Preet <prismatic.project@gmail.com>.

* src/sfnt/sfobjs.c (woff_open_font): Guard use of
FT_Gzip_Uncompress with FT_CONFIG_OPTION_USE_ZLIB.
2014-04-03 05:45:38 +02:00
Werner Lemberg f41070fef0 Fix Savannah bug #38235.
Work around a bug in pkg-config version 0.28 and earlier: If a
variable value gets surrounded by doublequotes (in particular values
for the `prefix' variable), the prefix override mechanism fails.

* builds/unix/freetype2.in: Don't use doublequotes.
* builds/unix/unix-def.in (freetype.pc): Escape spaces in directory
names with backslashes.
2014-03-27 17:38:23 +01:00
Werner Lemberg ab76d970e7 Fix Savannah bug #41946.
Based on a patch from Marek Kašík <mkasik@redhat.com>.

* builds/unix/configure.raw (LIBS_CONFIG): Remove.
* builds/unix/freetype-config.in (libs): Hard-code value.
* builds/unix/unix-def.in: Updated.
2014-03-24 19:45:03 +01:00
Werner Lemberg d515992587 Another revert for the change from 2014-03-18.
Problem reported by Nikolaus Waxweiler <madigens@gmail.com>.

* src/base/ftcalc.c (FT_MulFix): Ensure that an `FT_MulFix' symbol
gets always exported.
2014-03-22 06:20:54 +01:00
Werner Lemberg f0c471a495 CMakeLists.txt: Another fix for include directories.
Problem reported by Taylor Holberton <taylorcholberton@gmail.com>.
2014-03-20 07:13:12 +01:00
Werner Lemberg 606c74f6d6 CMakeLists.txt: Fix include directories.
Problem reported by Taylor Holberton <taylorcholberton@gmail.com>.
2014-03-19 23:46:42 +01:00
Werner Lemberg cc7cf2c3d0 Partially revert last commit.
Found by Alexei.

* src/autofit/aflatin.c (af_latin_metrics_init_blues): Initializing
those variables is plain wrong, since we are in a loop.
2014-03-19 07:35:35 +01:00
Sean McBride 87628724a9 Fix clang warnings.
* src/autofit/aflatin.c (af_latin_metrics_init_blues): Initialize
some variables.

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

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

* src/type1/t1driver.c (t1_ps_get_font_value): Remove redundant
code.
2014-03-18 08:39:35 +01:00
Werner Lemberg 23367ff97f Fix Savannah bug #41869.
This works around a problem with HarfBuzz (<= 0.9.26), which doesn't
validate glyph indices returned by
`hb_ot_layout_lookup_collect_glyphs'.

* src/autofit/hbshim.c (af_get_coverage): Guard `idx'.

* docs/CHANGES: Updated.
2014-03-17 07:33:14 +01:00
Werner Lemberg 0318168ea8 * builds/unix/configure.raw: Don't show error messages of `which'. 2014-03-14 08:06:06 +01:00
Alan Coopersmith ed372b712f Fix cppcheck 1.64 warning.
* src/autofit/afglobal.c (af_face_globals_new): Catch NULL pointer
dereference in case of error.
2014-03-09 06:14:12 +01:00
Werner Lemberg 1a69dc7c16 * src/sfnt/ttcmap.c (tt_face_build_cmaps): Remove clang warning. 2014-03-09 06:06:58 +01:00
Werner Lemberg ec8853cd18 * Version 2.5.3 released.
=========================

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

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

* README, Jamfile (RefDoc), builds/windows/vc2005/freetype.vcproj,
builds/windows/vc2005/index.html,
builds/windows/vc2008/freetype.vcproj,
builds/windows/vc2008/index.html,
builds/windows/vc2010/freetype.vcxproj,
builds/windows/vc2010/index.html,
builds/windows/visualc/freetype.dsp,
builds/windows/visualc/freetype.vcproj,
builds/windows/visualc/index.html,
builds/windows/visualce/freetype.dsp,
builds/windows/visualce/freetype.vcproj,
builds/windows/visualce/index.html,
builds/wince/vc2005-ce/freetype.vcproj,
builds/wince/vc2005-ce/index.html,
builds/wince/vc2008-ce/freetype.vcproj,
builds/wince/vc2008-ce/index.html: s/2.5.2/2.5.3/, s/252/253/.

* include/freetype/freetype.h (FREETYPE_PATCH): Set to 3.

* builds/unix/configure.raw (version_info): Set to 17:2:11.
* CMakeLists.txt (VERSION_PATCH): Set to 3.
* docs/CHANGES: Updated.
2014-03-06 19:13:45 +01:00
Werner Lemberg 055653668f Fixes for compilation with C++.
* src/autofit/hbshim.c (scripts): Change type to `hb_script_t'.
(af_get_coverage): Updated.
(COVERAGE): Add cast.
2014-03-06 18:56:58 +01:00
Sean McBride b24e8d3356 Remove more clang analyzer warnings.
* src/bdf/bdflib.c (_bdf_readstream), src/truetype/ttgload.c
(TT_Load_Glyph): Remove dead stores.
2014-03-06 14:54:22 +01:00
Werner Lemberg a32758f27c * builds/unix/configure.raw: Simplify. 2014-03-05 08:02:46 +01:00
suzuki toshiya 382f3ef103 Fix a bug in configure in library dependency setting
* builds/unix/configure.raw: Use `x"${xxx}" != xno' style.
2014-03-05 10:20:16 +09:00
Werner Lemberg f48f7dc84b Minor fix for `make devel'.
* builds/freetype.mk (INCLUDE_FLAGS) [DEVEL_DIR]: Don't use
pkg-config for bzip2 since not all GNU/Linux distributions have
`bzip2.pc' (and the header file `bzlib.h' is located in /usr/include
normally).
2014-03-04 04:40:07 +01:00
Werner Lemberg 7ac76b50da Fix several clang static analyzer dead store warnings.
* src/autofit/afhints.c (af_glyph_hints_reload,
af_glyph_hints_align_weak_points): Remove unnecessary assignments.

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

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

* src/type1/t1load.c (T1_Set_MM_Blend): Ditto.
2014-03-04 04:29:17 +01:00
Werner Lemberg 93ebcbd0ac Rewrite library option handling in `configure'; improve `freetype-config'.
o Introduce `auto' value for `--with-XXX' library options; this is
  now the default.

o First use `pkg-config' for library detection, then fall back to
  other tests.

* builds/unix/configure.raw (--with-zlib, --with-bzip2, --with-png,
--with-harfbuzz): Rewrite.
Use new `xxx_reqpriv', `xxx_libpriv', and `xxx_libstaticconf'
variables to collect data for `freetype2.pc' and `freetype-config'.
(FT2_EXTRA_LIBS): Renamed to ...
(ft2_extra_libs): This since it gets no longer substituted.
(REQUIRES_PRIVATE, LIBS_PRIVATE, LIBS_CONFIG, LIBSSTATIC_CONFIG):
New output variables, replacing `XXX_PKG' and `LIBXXX'.
Add notice at the end of `configure' showing the library
configuration.

* builds/unix/freetype-config.in (--static): New command line
option.
(libs): Updated.
(staticlibs): New variable, to be used if `--static' is given.
* builds/doc/freetype-config.1: Document `--static'.

* builds/unix/freetype2.in, builds/unix/unix-def.in: Updated.
2014-03-03 07:13:45 +01:00
Werner Lemberg e962a914fd Avoid `long long' warnings with older gcc compilers.
Problem reported by Hin-Tak Leung <htl10@users.sourceforge.net>.

* builds/unix/configure.raw: Don't use gcc's `-pedantic' flag for
versions < 4.6.  This is especially needed for Max OS X since this
OS runs a gcc variant (or emulation) based on version 4.2.1.
2014-03-01 21:00:02 +01:00
Werner Lemberg 476a76650b Minor documentation improvements. 2014-03-01 16:26:05 +01:00
Werner Lemberg 6030a9f755 * docs/INSTALL.CROSS: Revised and updated. 2014-03-01 14:01:12 +01:00
Werner Lemberg 646db05dfd Make `make clean' remove `freetype2.pc'.
This is a generated file at build time, not configure time.

* builds/unix/unix-def.in (DISTCLEAN): Move `freetype2.pc' to ...
(CLEAN): This variable.
2014-03-01 12:48:07 +01:00
Werner Lemberg 00c79ed968 Use pkg-config for detecting libpng and libbz2 also.
* builds/unix/configure.raw (HAVE_PKG): New variable.
Search for libbz2 using `pkg-config'; s/BZ2/BZIP2/.
Search for libpng using `pkg-config'.
Fix definition of `LIBHARFBUZZ' variable.
* builds/unix/freetype-config.in ($libs): Updated.
* builds/unix/freetype2.in: Add `URL' field.
Update `Requires.private' and `Libs.private'.
* builds/unix/unix-def.in: Updated.
2014-03-01 12:32:20 +01:00
Werner Lemberg 86026a47b3 Add configure support for HarfBuzz.
* builds/unix/pkg.m4: New file.
* builds/unix/configure.raw: Search for libharfbuzz using
`pkg-config'.
Add `--without-harfbuzz' option.
* builds/unix/freetype-config.in, builds/unix/freetype2.in,
builds/unix/unix-def.in (freetype-config, freetype2.pc): Handle
HarfBuzz.

* docs/INSTALL.UNIX: Document interdependency of Freetype with
HarfBuzz.
2014-03-01 06:57:19 +01:00
Werner Lemberg 24a84f8b54 Typo. 2014-03-01 06:42:54 +01:00
Alexei Podtelezhnikov 6adda68a75 Math simplifications.
* src/cf2blues.c (cf2_blues_init): Use `FT_MulDiv'.
* src/cf2ft.c (cf2_getScaleAndHintFlag): Use simple division.
2014-02-28 09:25:57 +01:00
Dave Arnold 135c3faebb Fix Savannah bug #41697, part 2.
* src/cff/cf2ft.c (cf2_initLocalRegionBuffer,
cf2_initGlobalRegionBuffer): It is possible for a charstring to call
a subroutine if no subroutines exist.  This is an error but should
not trigger an assert.  Split the assert to account for this.
2014-02-28 07:45:07 +01:00
Dave Arnold 0eae6eb064 Fix Savannah bug #41697, part 1.
* src/cff/cf2hints.c (cf2_hintmap_build): Return when `hintMask' is
invalid.  In this case, it is not safe to use the length of
`hStemHintArray'; the exception has already been recorded in
`hintMask'.
2014-02-28 07:45:07 +01:00
Werner Lemberg a2b5f66bf5 [sfnt] Fix Savannah bug #41696.
* src/sfnt/ttcmap.c (tt_cmap0_validate, tt_cmap2_validate,
tt_cmap4_validate, tt_cmap14_validate): Fix limit tests.
2014-02-26 19:50:18 +01:00
Werner Lemberg eee4ff8d5a [winfnt] Fix Savannah bug #41694.
* src/winfonts/winfnt.c (FNT_Load_Glyph): Check glyph offset.
2014-02-26 18:12:36 +01:00
Werner Lemberg 08c628d128 [cff] Fix Savannah bug #41693.
* src/cff/cffload.c (CFF_Load_FD_Select): Reject empty array.
2014-02-26 14:18:03 +01:00
Werner Lemberg 9a56764037 [bdf] Fix Savannah bug #41692.
bdflib puts data from the input stream into a buffer in chunks of
1024 bytes.  The data itself gets then parsed line by line, simply
increasing the current pointer into the buffer; if the search for
the final newline character exceeds the buffer size, more data gets
read.

However, in case the current line's end is very near to the buffer
end, and the keyword to compare with is longer than the current
line's length, an out-of-bounds read might happen since `memcmp'
doesn't stop properly at the string end.

* src/bdf/bdflib.c: s/ft_memcmp/ft_strncmp/ to make comparisons
stop at string ends.
2014-02-26 13:08:07 +01:00
Werner Lemberg 6b290fd21c Fix Savannah bug #32902.
Patch taken from

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

with slight modifications.

* src/type1/t1parse.c (T1_Get_Private_Dict): Add heuristic test to
handle fonts that incorrectly use \r at the beginning of an eexec
block.
2014-02-19 09:31:24 +01:00
Simon Bünzli df14e6c0b9 Fix Savannah bug #41590.
* src/type1/t1load.c (parse_encoding): Protect against invalid
number.
2014-02-19 09:31:23 +01:00
suzuki toshiya cc9a0c26af fix commit comment. 2014-02-17 16:43:54 +09:00
suzuki toshiya 91c7a97b9b [autofit] Fix `make multi' compilation.
* src/hbshim.c: Include `afglobal.h' and `aftypes.h'.
2014-02-17 16:38:31 +09:00
Dave Arnold 89a94d4212 [cff] Optimize by using `FT_MulDiv'.
Suggested by Alexei.

* src/cff/cf2font.c (cf2_computeDarkening): Do it.
2014-02-12 23:45:47 +01:00
Werner Lemberg 85ee27ae93 Fix Savannah bug #41465.
* builds/unix/unix-def.in (CLEAN): Add `freetype-config'.
(DISTCLEAN): Remove `freetype-config'.
2014-02-12 23:27:41 +01:00
Sean McBride 7be2a94a50 Fix clang static analyzer and compiler warnings.
* src/autofit/afhints.c (af_glyph_hints_align_weak_points),
src/autofit/afloader (af_loader_load_g) <FT_GLYPH_FORMAT_COMPOSITE>,
src/base/ftcalc.c (FT_MSB), src/base/ftoutln.c
(FT_Outline_Decompose), src/bdf/bdfdrivr.c (bdf_interpret_style),
src/cff/cffparse.c (cff_parse_integer), src/cid/cidparse.c
(cid_parser_new), src/pfr/pfrload.c (pfr_phy_font_load),
src/raster/ftraster.c (Decompose_Curve), src/sfnt/sfdriver.c
(sfnt_get_ps_name), src/sfnt/ttcmap.c (tt_cmap12_next,
tt_cmap13_next), src/smooth/ftgrays.c (gray_hline): Remove dead
code.

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

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

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

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

* src/truetype/ttinterp.c (TT_New_Context): Reduce scope of
variable.
2014-02-08 13:55:38 +01:00
Werner Lemberg ab98c5e73b Fix Windows build directories.
The build target is now `windows' instead of `win32'.

Problem reported by Nickolas George <darknova.clan@gmail.com>.

* builds/modules.mk: Don't use `win32' and `win16' (!) but
`windows'.

* builds/windows/detect.mk, builds/windows/win32-def.mk:
s/win32/windows/.
2014-02-08 11:34:33 +01:00
Eugen Sawin a8ceae4008 Fix Savannah bug #41507.
* src/sfnt/ttsbit.c (tt_sbit_decoder_load_bitmap)
[!FT_CONFIG_OPTION_USE_PNG] <17, 17, 19>: Fix error handling.
2014-02-08 06:30:06 +01:00
Dave Arnold 355b359ebb [cff] Fix minor performance bug.
* src/cff/cf2font.c (cf2_font_setup): Darkening amount and blue zone
calculations are now cached and not recomputed on each glyph.
2014-02-08 06:23:04 +01:00
Werner Lemberg cc7d35a297 Minor. 2014-02-06 20:23:49 +01:00
Werner Lemberg 6dce136937 Fix problems with perl 5.8.8 as distributed with current MinGW.
* src/tools/afblue.pl: Work-around for Perl bug #63402.
(string_re): Avoid `possessive quantifiers', which have been
introduced in Perl version 5.10.
2014-02-05 15:40:47 +01:00
Werner Lemberg 741f736662 Work-around for Perl bug #63402. 2014-02-05 14:51:51 +01:00
Werner Lemberg d87f9a65a8 Fix compilation with MinGW.
Right now, compilation out of the box with latest MinGW is broken
due to bugs in header files of mingwrt 4.0.3 in strict ANSI mode,
cf.

  https://sourceforge.net/p/mingw/bugs/2024/
  https://sourceforge.net/p/mingw/bugs/2046/

* builds/unix/configure.raw: Don't set `-ansi' flag for MinGW.
2014-02-04 16:14:09 +01:00
Werner Lemberg a8772918a3 [autofit] Minor fix.
* src/autofit/afcjk.c (af_cjk_metrics_init_widths),
src/autofit/aflatin.c (af_latin_metrics_init_widths): Fix handling
of alternative standard characters.
This also fixes a compilation warning in non-debug mode.
2014-02-04 11:36:08 +01:00
Werner Lemberg ee3778d3d7 [cff] Fix Savannah bug #41363.
* src/cff/cf2ft.c (cf2_checkTransform): Convert assertion into
parameter check.
(cf2_decoder_parse_charstrings): Call `cf2_checkTransform' only if
we are scaling the outline.
(cf2_getPpemY): Remove problematic assertion.
2014-02-03 11:16:47 +01:00
Werner Lemberg f3abecb615 Minor documentation improvements. 2014-02-03 11:07:55 +01:00
Werner Lemberg 93305a4c73 Clarify possible values for BDF_PropertyRec. 2014-01-30 19:13:33 +01:00
Werner Lemberg a336400112 [autofit] Introduce two more slots for standard characters.
This is useful for OpenType features like `c2sc' (caps to small
caps) that don't have lowercase letters by definition, or other
features that mainly operate on numerals.

* src/autofit/afscript.h: Add more standard characters.

* src/autofit/aftypes.h: Update use of `SCRIPT' macro.
(AF_ScriptClassRec): Add members to hold two more standard
characters.
(AF_DEFINE_SCRIPT_CLASS): Updated.

* src/autofit/afglobal.c, src/autofit/afglobal.h,
* src/autofit/afpic.c, src/autofit/afranges.h, src/autofit/hbshim.c:
Update use of `SCRIPT' macro.

* src/autofit/afcjk.c (af_cjk_metrics_init_widths),
src/autofit/aflatin.c (af_latin_metrics_init_widths): Scan two more
standard characters.
2014-01-26 09:45:23 +01:00
Werner Lemberg eb7691cc3d Fix Savannah bug #41320.
* src/autofit/aflatin.c (af_latin_metrics_init_blues)
<AF_LATIN_IS_LONG_BLUE>: Avoid negative index of `last'.
2014-01-24 19:04:22 +01:00
Werner Lemberg 752f39127b Fix Savannah bug #41310.
* src/sfnt/ttsbit.c (tt_sbit_decoder_load_bitmap) <glyph_format==5>:
Don't check metrics, which this format doesn't have.
This is another correction to the commit from 2013-11-21.
2014-01-23 09:14:25 +01:00
Werner Lemberg 8b281f83e8 Fix Savannah bug #41309.
* src/type1/t1load.c (t1_parse_font_matrix): Properly handle result
of `T1_ToFixedArray'.

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

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

* src/psaux/psobjs.c (ps_parser_load_field) <T1_FIELD_TYPE_BBOX>,
<T1_FIELD_TYPE_MMOX>: Properly handle result of `ps_tofixedarray'.
2014-01-23 08:14:53 +01:00
Werner Lemberg 039f049656 Formatting. 2014-01-23 07:48:23 +01:00
Werner Lemberg ff8dc315d1 * src/autofit/hbshim.c (af_get_coverage): Fix memory leaks. 2014-01-22 09:19:57 +01:00
Werner Lemberg aae0f1aff4 Minor. 2014-01-19 18:27:18 +01:00
Werner Lemberg 6a700786ae [autofit] Improve tracing of style coverages.
* include/internal/fttrace.h: Add `afglobal' for tracing style
coverages.

* src/autofit/afglobal.c: Include FT_INTERNAL_DEBUG_H.
(FT_COMPONENT): Define.
(af_face_globals_compute_style_coverage): Trace `gstyles' array
data.
2014-01-16 08:55:40 +01:00
Werner Lemberg 2b623fe4f6 Minor doc issues. 2014-01-15 09:46:23 +01:00
Werner Lemberg 7cbfdffa49 Fix Savannah bug #41158.
* builds/unix/install.mk (install): Create man page directory.
2014-01-09 07:26:06 +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 c46fa86bd5 [autofit] Fix Savannah bug #41138, part 1.
* src/tools/afblue.pl <Handling #endif>: Produce correct auxiliary
enumeration names for generated `#else'.

* src/autofit/afblue.h: Regenerated.
2014-01-08 08:45:40 +01:00
Werner Lemberg 3e5a374848 Add manual page for `freetype-config'.
Contributed by Nis Martensen <nis.martensen@web.de>.

* docs/freetype-config.1: New file.

* builds/unix/unix-def.in (mandir): Define.
* builds/unix/install.mk (install, uninstall): Handle manpage.
2014-01-06 07:53:10 +01:00
Werner Lemberg 0c1d62d636 Fix Savannah bug #41105 (typo in file `README'). 2014-01-05 21:56:17 +01:00
Werner Lemberg 991cbcce97 [autofit] Minor fixes for `afblue.pl'.
* src/tools/afblue.pl (aux_name): Don't use `reverse'.
<Handling #endif>: Use proper indentation for generated `#else'.

* src/autofit/afblue.h: Regenerated.
2014-01-05 13:24:56 +01:00
Werner Lemberg 0d97744d81 [autofit] Fix Indic scripts.
Split the single, incorrect Indic entry into separate scripts so
that the covered ranges are the same: Bengali, Devanagari, Gujarati,
Gurmukhi, Kannada, Limbu, Malayalam, Oriya, Sinhala, Sundanese,
Syloti Nagri, Tamil, Telugu, and Tibetan.  At the same time, remove
entries for Meetai Mayak and Sharada – the Unicode ranges were
incorrect (and nobody has complained about that), fonts are scarce
for those scripts, and the Indic auto-hinter support is rudimentary
anyways.

* src/autofit/afscript.h: Updated, using AF_CONFIG_OPTION_INDIC and
AF_CONFIG_OPTION_CJK.

* src/autofit/afstyles.h (STYLE_DEFAULT_INDIC): New auxiliary macro.
Use it, together with AF_CONFIG_OPTION_INDIC and
AF_CONFIG_OPTION_CJK, to update.

* src/autofit/afranges.c [AF_CONFIG_OPTION_INDIC]: Updated.
[!AF_CONFIG_OPTION_INDIC, !AF_CONFIG_OPTION_CJK]: Removed.
Sort entries by tags.
2014-01-04 11:46:34 +01:00
Werner Lemberg ecdb0e35c3 [autofit] Thinko.
* src/autofit/hbshim.c (af_get_char_index): Similar to
`af_get_coverage', reject glyphs which are not substituted.
2014-01-03 20:49:31 +01:00
Werner Lemberg 1b5bc89754 [autofit] Fix handling of default coverages.
With this commit, the implementation of coverage handling is
completed.

* src/autofit/hbshim.c (af_get_coverage): Exit early if nothing to
do.
Reject coverages which don't contain appropriate glyphs for blue
zones.
2014-01-03 18:33:24 +01:00
Werner Lemberg a42f918434 [autofit] Fix handling of default coverages.
* src/autofit/afglobal.c (af_face_globals_compute_style_coverage):
First handle non-default coverages, then the default coverage of the
default script, and finally the other default coverages.
2014-01-03 18:29:41 +01:00
Werner Lemberg f45749b05b [autofit] Fix scaling of HarfBuzz shaping.
* src/autofit/hbshim.c (af_get_char_index): Scale to units per EM.
2014-01-03 18:09:36 +01:00
Werner Lemberg ea0367fbfe [autofit] Minor. 2014-01-03 18:06:45 +01:00
Werner Lemberg 5c7f5500e8 [autofit] Better ftgrid support.
* src/autofit/afhints.c (af_glyph_hints_get_segment_offset): Add
parameters `is_blue' and `blue_offset'.
2014-01-03 10:48:26 +01:00
Werner Lemberg 55cd7e0a05 [autofit] Remove some styles.
* src/autofit/afcover.h: Remove coverages for alternative fractions,
denominators, numerators, and fractions.

* src/autofit/afstyles.h (META_STYLE_LATIN): Updated.
2014-01-02 13:07:48 +01:00
Werner Lemberg c973e67b5a [autofit] Add more styles.
* src/autofit/afstyles.h (STYLE_LATIN, META_STYLE_LATIN): New
auxiliary macros; use them to define styles for Cyrillic, Greek, and
Latin.

* src/autofit/afcover.h: Remove coverage for oldstyle figures.
Since those digits are used in combination with ordinary letters, it
makes no sense to handle them separately.

* src/autofit/afglobal.c (af_face_globals_get_metrics): Don't limit
`options' parameter to 4 bits.
2014-01-01 16:34:42 +01:00
Werner Lemberg abb2f73054 [autofit] Fix style assignments to glyphs.
* src/autofit/hbshim.c (af_get_coverage)
[FT_CONFIG_OPTION_USE_HARFBUZZ]: Scan GPOS coverage of features also
so that we can skip glyphs that have both GSUB and GPOS data.
2014-01-01 08:00:16 +01:00
Werner Lemberg 0950f3a50e * src/autofit/hbshim.c: s/{lookups,glyphs}/gsub_{lookups,glyphs}/. 2014-01-01 07:48:20 +01:00
Werner Lemberg 73cc8330ed [autofit] Implement and use `af_get_char_index' with HarfBuzz.
* src/autofit/hbshim.c (COVERAGE) [FT_CONFIG_OPTION_USE_HARFBUZZ]:
Redefine to construct HarfBuzz features.
(af_get_char_index) [FT_CONFIG_OPTION_USE_HARFBUZZ]: Rewritten.

* src/autofit/aflatin.c (af_latin_metrics_init_blues): Use
`y_offset' to adjust `best_y'.
2014-01-01 07:10:36 +01:00
Werner Lemberg 785f38573b [autofit] s/AF_STYLE_...._DEFAULT/AF_STYLE_...._DFLT/i. 2013-12-31 09:45:10 +01:00
Werner Lemberg c9d9947c68 [autofit] Fix interface of `af_get_char_index'.
* src/autofit/hbshim.c (af_get_char_index): Return error value.
Add argument for y offset (to be used in a yet-to-come patch).

* src/autofit/hbshim.h, src/autofit/afcjk.c,
src/autofit/aflatin.c: Updated.
2013-12-31 08:16:57 +01:00
Werner Lemberg 44aa7e0af5 [autofit] Don't combine multiple features into one set.
Combining them, as originally envisioned, would lead to much more
complicated code, as investigations have shown meanwhile.  The major
drawback is that we run out of available style slots much earlier.
However, this is only a theoretical issue since we don't support a
large number of scripts currently.

* src/autofit/afcover.h: Replace `COVERAGE_{1,2,3}' macros with
a single-element `COVERAGE' macro, sort the elements by the feature
tags, and add entry for `ruby'.

* src/autofit/aftypes.h: Updated.
* src/autofit/hbshim.c: Updated.
2013-12-30 07:41:22 +01:00
Werner Lemberg 072dc45d27 [autofit] Code shuffling to reduce use of cpp macros.
* src/autofit/afglobal.c (af_face_globals_compute_style_coverage):
Call `af_get_coverage' unconditionally.

* src/autofit/autofit.c: Include `hbshim.c' unconditionally.

* src/autofit/hbshim.c (af_get_coverage)
[!FT_CONFIG_OPTION_USE_HARFBUZZ]: Provide dummy function.

* src/autofit/hbshim.h: Provide function declarations
unconditionally.
2013-12-28 12:26:21 +01:00
Werner Lemberg 17af586e05 [autofit] Add wrapper function for `FT_Get_Char_Index'.
Yet-to-come changes will provide HarfBuzz functionality for the new
function.

* src/autofit/hbshim.c (af_get_char_index): New function.
* src/autofit/hbshim.h: Updated.

* src/autofit/afcjk.c (af_cjk_metrics_init_widths,
af_cjk_metrics_init_blues, af_cjk_metrics_check_digits): Updated.

* src/autofit/aflatin.c (af_latin_metrics_init_widths,
af_latin_metrics_init_blues, af_latin_metrics_check_digits):
Updated.
2013-12-28 10:33:01 +01:00
Werner Lemberg 6af01a04b1 [autofit] Use `global' HarfBuzz font object.
We now use `hb_font' instead of `hb_face' since yet-to-come changes
need this.

* src/autofit/afglobal.h: Include `hbshim.h'.
(AF_FaceGlobalsRec) [FT_CONFIG_OPTION_USE_HARFBUZZ]: New member
`hb_font'.

* src/autofit/afglobal.c (af_face_globals_new)
[FT_CONFIG_OPTION_USE_HARFBUZZ]: Create `hb_font'.
(af_face_globals_free) [FT_CONFIG_OPTION_USE_HARFBUZZ]: Destroy
`hb_font'.

* src/autofit/hbshim.h: Include HarfBuzz headers.

* src/autofit/hbshim.c: Include `hbshim.h' instead of HarfBuzz
headers.
(af_get_coverage): Updated.
2013-12-28 08:55:24 +01:00
Werner Lemberg d32a7d32e4 [autofit] Handle `DFLT' OpenType script for coverages.
* include/ftautoh.h: Document new `default-script' property.

* src/autofit/hbshim.c (af_get_coverage): Use `AF_FaceGlobals' for
type of first parameter.
(script_tags): Add one more element.
(af_get_coverage): Adjust `script_tags' to handle `DFLT' script tag.

* src/autofit/hbshim.h: Updated.

* src/autofit/afglobal.c (af_face_globals_compute_style_coverage):
Updated.

* src/autofit/afglobal.h (AF_SCRIPT_DEFAULT): New macro.

* src/autofit/afmodule.h (AF_ModuleRec): New `default_script'
member.

* src/autofit/afmodule.c (af_property_set, af_property_get): Handle
`default-script' property.
(af_autofitter_init): Updated.
2013-12-27 19:26:04 +01:00
Werner Lemberg 00a7b51fab Minor. 2013-12-27 19:18:49 +01:00
suzuki toshiya e2d2b1544f [ftrfork] Fix the face order difference between POSIX and Carbon.
The fragmented resources in Suitcase and .dfont should be reordered
when post resource for Type1 is being restored, but reordering of
sfnt resources induces the different face order.  Now the ordering
is restricted to post resource only, to prevent the different order
issue  (e.g. the face index in the fontconfig cache generated with
Carbon framework is incompatible with that by FreeType2 without
Carbon framework.)  Found by Khaled Hosny and Hin-Tak Leung.

http://lists.gnu.org/archive/html/freetype-devel/2013-02/msg00035.html
http://lists.gnu.org/archive/html/freetype-devel/2013-12/msg00027.html

* src/base/ftrfork.c (FT_Raccess_Get_DataOffsets): Add a switch
`sort_by_res_id' to control the fragmented resource ordering.
* include/internal/ftrfork.h: Daclare new switch.
* src/base/ftobjs.c (IsMacResource): Enable the soring for post
resource, and disable the sorting for sfnt resource.
2013-12-27 16:45:18 +09:00
Werner Lemberg 5f577462bd Fix Savannah bug #40997.
* src/bdf/bdfdrivr.c (BDF_Face_Init): Only use OR operator to
adjust face flags since FT_FACE_FLAG_EXTERNAL_STREAM might already
be set.
* src/cff/cffobjs.c (cff_face_init): Ditto.
* src/cid/cidobjs.c (cid_face_init): Ditto.
* src/pcf/pcfread.c (pcf_load_font): Ditto.
* src/pfr/pfrobjs.c (pfr_face_init): Ditto.
* src/type1/t1objs.c (T1_Face_Init): Ditto.
* src/type42/t42objs.c (T42_Face_Init): Ditto.
* src/winfonts/winfnt.c (FNT_Face_Init): Ditto.
2013-12-25 08:50:50 +01:00
Werner Lemberg c7b55a3473 Split off ChangeLog.24. 2013-12-23 16:42:03 +01:00
Werner Lemberg 1924134710 Introduce `coverages'.
Coverages are the interface to the HarfBuzz library to access
OpenType features for handling glyphs not addressable by the cmap.

Right now, compilation of HarfBuzz is only added to the development
build.  A solution for standard build mode will be delayed until
HarfBuzz gets split into two libraries to avoid mutual dependencies
between FreeType and HarfBuzz.

Note that this is only a first step in handling coverages, basically
providing the framework only.  Code for handling selected OpenType
features (this is, actually using the data in `afcover.h') will
follow.

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

* src/autofit/hbshim.c, src/autofit/hbshim.h, src/autofit/afcover.h:
New files.

* src/autofit/afscript.h: Add HarfBuzz script name tags.

* src/autofit/afstyles.h: Add default coverage enumeration values.

* src/autofit/aftypes.h: Update use of `SCRIPT' and `STYLE' macros.
(AF_Coverage): New enumeration (generated by `afcover.h').
(AF_StyleClassRec): New member `coverage'.
(AF_DEFINE_STYLE_CLASS): Updated.

* include/internal/fttrace.h: Add `afharfbuzz' for tracing coverage
data.

* src/autofit/afglobal.h: Update use of `SCRIPT' and `STYLE' macros.
(AF_SCRIPT_FALLBACK): Renamed to ...
(AF_STYLE_FALLBACK): ... this.

* src/autofit/afglobal.c: Include `hbshim.c'.
Update use of `SCRIPT' and `STYLE' macros.
(af_face_globals_compute_style_coverage)
[FT_CONFIG_OPTION_USE_HARFBUZZ]: Call `af_get_coverage'.
Update.

* src/autofit/afmodule.h (AF_ModuleRec):
s/fallback_script/fallback_style/.

* src/autofit/afmodule.c (af_property_set): Adapt handling of
`fallback-script' property to set a fallback style.
(af_property_get, af_autofitter_init): Updated.

* src/autofit/afpic.c: Update use of `SCRIPT' and `STYLE' macros.

* src/autofit/afranges.h: Update use of `SCRIPT' macro.

* src/autofit/autofit.c [FT_CONFIG_OPTION_USE_HARFBUZZ]: Include
`hbshim.c'.

* src/autofit/rules.mk (AUTOF_DRV_SRC): Add `hbshim.c'.
(AUTOF_DRV_H): Add `afcover.h'.

* builds/freetype.mk (INCLUDE_FLAGS) [DEVEL_DIR]: Use pkg-config for
all libraries needed by FreeType.
2013-12-21 21:39:04 +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
Werner Lemberg 3bf60950f7 [autofit] Make PIC mode work actually.
* src/autofit/afpic.h (AFModulePIC): Fix array sizes to fit the
enumeration values automatically generated by including `afscript.h'
and friends.

* src/autofit/afpic.c (autofit_module_class_pic_init): Updated.
2013-12-21 08:49:11 +01:00
Werner Lemberg bd41386280 Fix PIC linking.
* include/internal/ftrfork.h (CONST_FT_RFORK_RULE_ARRAY_BEGIN): Fix
generated function name.

* src/base/basepic.c (FT_Init_Table_raccess_guess_table): Rename
to ...
(FT_Init_Table_ft_raccess_guess_table): ... this so that the
function name correctly corresponds to what the macro framework
expects.

* src/psnames/rules.mk (PSNAMES_DRV_SRC_S): Use correct file name so
that PIC functions are compiled also.
2013-12-21 08:14:25 +01:00
Werner Lemberg c4e968edcb [base] Add missing dependencies to Makefile.
* src/base/rules.mk (BASE_SRC): Add `basepic.c' and `ftpic.c'.
(BASE_H): Add `basepic.h'.
2013-12-21 07:23:08 +01:00
Werner Lemberg 8a8f3758f1 [autofit] Fix PIC compilation.
* src/autofit/afcjk.c (af_cjk_metrics_init_widths),
src/autofit/aflatin.c (af_latin_metrics_init_widths)
[FT_CONFIG_OPTION_PIC]: Declare `globals'.

* src/autofit/afglobal.c: Always call AF_DEFINE_SCRIPT_CLASS, and
AF_DEFINE_STYLE_CLASS.

* src/autofit/afpic.c: Include `afglobal.h'.
(autofit_module_class_pic_init): Typo.

* src/autofit/aftypes.h (AF_DEFINE_SCRIPT_CLASS,
AF_DEFINE_STYLE_CLASS): Don't use the same identifier for macro
parameter and structure member.
2013-12-20 18:35:35 +01:00
Werner Lemberg 974b193bcc [autofit] Introduce `styles'.
This is the new top-level structure for handling glyph input data;
scripts are now defined separately.

* src/autofit/aftypes.h (SCRIPT): Updated.
(AF_ScriptClassRec): Move `blue_stringset' and `writing_system'
members to ...
(AF_Style_ClassRec): ... this new structure.
(AF_Style): New enumeration.
(AF_StyleMetricsRec): Replace `script' enumeration with
`style_class' pointer.
(AF_DEFINE_SCRIPT_CLASS, AF_DECLARE_SCRIPT_CLASS): Updated.
(AF_DEFINE_STYLE_CLASS, AF_DECLARE_STYLE_CLASS): New macros.

* src/autofit/afstyles.h: New file, using data from `afscript.h'.
* src/autofit/afscript.h: Updated.

* src/autofit/afcjk.c (af_cjk_metrics_init_widths,
af_cjk_metrics_init_blues, af_cjk_hint_edges): Updated.

* src/autofit/afglobal.c (SCRIPT): Updated.
(STYLE): Redefine macro to load `afstyles.h'.
(af_script_names) [FT_DEBUG_LEVEL_TRACE]: Replace with...
(af_style_names): ... this array.
(af_face_globals_compute_script_coverage): Renamed to...
(af_face_globals_compute_style_coverage): ... this.
Updated.
(af_face_globals_new, af_face_globals_free,
af_face_globals_get_metrics): Updated.

* src/autofit/afglobal.h (SCRIPT): Updated.
(STYLE): Redefine macro to load `afstyles.h'.
(AF_SCRIPT_FALLBACK): Update definition.  This will get more
refinements with later on.
(AF_SCRIPT_UNASSIGNED): Replace with...
(AF_STYLE_UNASSIGNED): ... this macro.
(AF_FaceGlobalsRec): Updated.

* src/autofit/aflatin.c (af_latin_metrics_init_widths,
af_latin_metrics_init_blues, af_latin_metrics_scale_dim,
af_latin_hint_edges): Updated.

* src/autofit/aflatin2.c (af_latin2_metrics_init_widths): Updated.
(af_ltn2_uniranges): Removed.

* src/autofit/afloader.c (af_loader_load_g, af_loader_load_glyph):
Updated.

* src/autofit/afpic.c (autofit_module_class_pic_init): Updated.
* src/autofit/afpic.h (AF_STYLE_CLASSES_GET): New macro.
(AFModulePIC): Add `af_style_classes' and `af_style_classes_rec'
members.

* src/autofit/afranges.h: Updated.

* src/autofit/rules.mk (AUTOF_DRV_H): Add `afstyles.h'.
2013-12-20 17:26:26 +01:00
Werner Lemberg d8324571f1 [autofit] Factor scripts and uniranges out of writing system files.
* src/autofit/afranges.c, src/autofit/afranges.h: New files.

* src/autofit/afscript.h: Extend `SCRIPT' macro with more
parameters, taking data from the writing system files.

* src/autofit/aftypes.h: Updated.

* src/autofit/afglobal.c: Include `afranges.h'.
Load `afscript.h' to call AF_DEFINE_SCRIPT_CLASS.
* src/autofit/afglobal.c: Include `afranges.h'.
Load `afscript.h' to call AF_DECLARE_SCRIPT_CLASS.

* src/autofit/afcjk.c, src/autofit/afcjk.h: Updated.
* src/autofit/afdummy.c, src/autofit/afdummy.h: Updated.
* src/autofit/afindic.c, src/autofit/afindic.h: Updated.
* src/autofit/aflatin.c, src/autofit/aflatin.h: Updated.
* src/autofit/aflatn2.c, src/autofit/aflatn2.h: Updated.

* src/autofit/afpic.c: Updated.

* src/autofir/autofit.c: Include `afranges.c'.
* src/autofit/rules.mk (AUTOF_DRV_SRC): Add `afranges.c'.
2013-12-19 15:45:24 +01:00
Werner Lemberg 4593062207 [autofit] Minor. 2013-12-19 15:24:39 +01:00
Werner Lemberg 73f3198101 [autofit] More code orthogonality.
* src/autofit/aftypes.h (AF_StyleMetrics): Replace `script_class'
pointer to an `AF_ScriptClass' structure with `script' index of type
`AF_Script'.
Move some code around.

* src/autofit/afcjk.c: Include `afpic.h'.
(af_cjk_metrics_init_widths, af_cjk_metrics_init_blues,
af_cjk_hint_edges): Updated.

* src/autofit/aflatin.c: Include `afpic.h'.
(af_latin_metrics_init_widths, af_latin_metrics_init_blues,
af_latin_metrics_scale_dim, af_latin_hint_edges): Updated.

* src/autofit/afglobal.c (af_face_globals_get_metrics): Updated.

* src/autofit/afloader.c (af_loader_load_g, af_loader_load_glyph):
Updated.
2013-12-19 15:24:17 +01:00
Werner Lemberg 115de7131d [autofit] Minor. 2013-12-18 16:06:09 +01:00
Werner Lemberg 3f91cb338b [autofit] s/ScriptMetrics/StyleMetrics/. 2013-12-18 12:59:35 +01:00
Werner Lemberg 4fccc214f9 [autofit] s/script_{metrics,hints}/style_{metrics,hints}/ 2013-12-18 12:53:01 +01:00
Werner Lemberg f4df4079fb [autofit] s/gscripts/gstyles/. 2013-12-18 10:39:30 +01:00
Werner Lemberg 9a35455045 [autofit] s/glyph_scripts/glyph_styles/.
This is the first commit of a series to create a new top-level
structure (a `style') for handling scripts, writing_systems, and
soon-to-be-added coverages.
2013-12-18 10:36:06 +01:00
Werner Lemberg 7a5fc2f362 [autofit] s/AF_Script_/AF_WritingSystem_/ where appropriate. 2013-12-17 13:29:53 +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 e9d95aa06b [documentation] Add section how to include FreeType header files.
Problem reported by David Kastrup <dak@gnu.org>.

Surprisingly, a description how to do that was completely missing in
the API reference.

* include/freetype.h, include/ftchapters.h: New documentation
section `header_inclusion'.
2013-12-11 07:48:51 +01:00
Werner Lemberg 9193259cf2 [autofit] s/DFLT/NONE/, s/dflt/none/. 2013-12-10 13:24:07 +01:00
Werner Lemberg 45244f8043 [autofit] s/AF_SCRIPT_NONE/AF_SCRIPT_UNASSIGNED/. 2013-12-10 13:18:11 +01:00
Werner Lemberg 69d1a3609e [truetype] Fix scaling of vertical phantom points.
* src/truetype/ttgload.c (load_truetype_glyph): Scale pp3.x and
pp4.x also.
2013-12-10 10:12:27 +01:00
Werner Lemberg 7318b1aa2f Formatting. 2013-12-10 09:40:36 +01:00
Werner Lemberg 05c786d990 [truetype] Fix positioning of composite glyphs.
Problem reported by Nigel Tao <nigeltao@golang.org>.

* src/truetype/ttgload.c (TT_Hint_Glyph): Remove code that shifts
the glyph (component) by a fractional value computed from the LSB
phantom point.  This is wrong, since the horizontal phantom points
get rounded horizontally later on.
2013-12-10 08:38:57 +01:00
Werner Lemberg dd8050aa79 * Version 2.5.2 released.
=========================

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

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

* README, Jamfile (RefDoc), builds/windows/vc2005/freetype.vcproj,
builds/windows/vc2005/index.html,
builds/windows/vc2008/freetype.vcproj,
builds/windows/vc2008/index.html,
builds/windows/vc2010/freetype.vcxproj,
builds/windows/vc2010/index.html,
builds/windows/visualc/freetype.dsp,
builds/windows/visualc/freetype.vcproj,
builds/windows/visualc/index.html,
builds/windows/visualce/freetype.dsp,
builds/windows/visualce/freetype.vcproj,
builds/windows/visualce/index.html,
builds/wince/vc2005-ce/freetype.vcproj,
builds/wince/vc2005-ce/index.html,
builds/wince/vc2008-ce/freetype.vcproj,
builds/wince/vc2008-ce/index.html: s/2.5.1/2.5.2/, s/251/252/.

* include/freetype/freetype.h (FREETYPE_PATCH): Set to 1.

* builds/unix/configure.raw (version_info): Set to 17:1:11.
* docs/CHANGES: Updated.
2013-12-08 23:14:46 +01:00
Werner Lemberg d3526ab192 Add info on bytecode interpreter versions of Windows.
Provided by Greg Hitchcock.
2013-12-08 10:14:15 +01:00
Werner Lemberg 98d185c794 [truetype] Next round in phantom point handling.
Greg Hitchcock provided very interesting insights into the
complicated history of the horizontal positions of the TSB and BSB
phantom points.

* src/truetype/ttgload.c (TT_LOADER_SET_PP)
[TT_CONFIG_OPTION_SUBPIXEL_HINTING]: Use `subpixel_hinting' and
`grayscale_hinting' flags as conditionals for the x position of TSB
and BSB.
2013-12-07 09:26:55 +01:00
Werner Lemberg fcdb784082 * builds/freetype.mk (FT_CC): Removed. Unused. 2013-12-05 15:53:27 +01:00
Werner Lemberg 64b395cca6 [sfnt] Fix handling of embedded bitmap strikes.
This corrects the commit from 2013-11-21.  Problem reported by
Andrey Panov <panov@canopus.iacp.dvo.ru>.

* src/sfnt/ttsbit.c (tt_sbit_decoder_load_bitmap): Fix logic to
detect excessive bytes for bit-aligned bitmaps.
2013-12-04 06:18:56 +01:00
Werner Lemberg c2b4753970 [truetype] Remove dead code.
Reported by Nigel Tao <nigeltao@golang.org>.

* include/internal/tttypes.h (TT_LoaderRec): Remove unused
`preserve_pps' field.
* src/truetype/ttgload.c (TT_Hint_Glyph): Updated.
2013-12-03 07:01:57 +01:00
Werner Lemberg bdd5e75e4e [truetype] Fix phantom point handling.
This is a further improvement to the changes from 2013-11-06.

* src/truetype/ttgload.c (TT_Hint_Glyph): Horizontal phantom points
are rounded horizontally, vertical ones are rounded vertically.
(TT_LOADER_SET_PP): The horizontal position of vertical phantom
points in pre-ClearType mode is zero, as shown in the OpenType
specification.
2013-12-03 06:57:02 +01:00
Werner Lemberg a44b784bca Formatting. 2013-12-02 09:52:38 +01:00
Werner Lemberg 64872a5016 [truetype] Fix change from 2013-11-20.
Problem reported by Akira Kakuto <kakuto@fuk.kindai.ac.jp>.

* src/truetype/ttgload.c (TT_Load_Simple_Glyph): Protect call to
`Update_Max' with both a TT_USE_BYTECODE_INTERPRETER guard and a
`IS_HINTED' clause.
Also remove redundant check using `maxSizeOfInstructions' – in
simple glyphs, the bytecode data comes before the outline data, and
a validity test for this is already present.
2013-12-02 07:51:17 +01:00
Werner Lemberg 52166ab0a7 [autofit] Fix use of dumping functions in `ftgrid' demo program.
* src/autofit/afhints.c (AF_DUMP) [FT_DEBUG_AUTOFIT]: New macro.
(af_glyph_hints_dump_points, af_glyph_hints_dump_segments,
af_glyph_hints_dump_edges) [FT_DEBUG_AUTOFIT]: Add parameter to
handle output to stdout.
Use AF_DUMP.
(af_glyph_hints_dump_points, af_glyph_hints_dump_segments,
af_glyph_hints_dump_edges) [!FT_DEBUG_AUTOFIT]: Removed.
2013-11-27 10:10:16 +01:00
Werner Lemberg 3aee429ba6 * Version 2.5.1 released.
=========================

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

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

* README, Jamfile (RefDoc), builds/windows/vc2005/freetype.vcproj,
builds/windows/vc2005/index.html,
builds/windows/vc2008/freetype.vcproj,
builds/windows/vc2008/index.html,
builds/windows/vc2010/freetype.vcxproj,
builds/windows/vc2010/index.html,
builds/windows/visualc/freetype.dsp,
builds/windows/visualc/freetype.vcproj,
builds/windows/visualc/index.html,
builds/windows/visualce/freetype.dsp,
builds/windows/visualce/freetype.vcproj,
builds/windows/visualce/index.html,
builds/wince/vc2005-ce/freetype.vcproj,
builds/wince/vc2005-ce/index.html,
builds/wince/vc2008-ce/freetype.vcproj,
builds/wince/vc2008-ce/index.html: s/2.5.0/2.5.1/, s/250/251/.

* include/freetype/freetype.h (FREETYPE_PATCH): Set to 1.

* builds/unix/configure.raw (version_info): Set to 17:0:11.
* docs/CHANGES, docs/release: Updated.
2013-11-25 00:28:11 +01:00
Werner Lemberg 063ee6b1c0 [truetype]: Add tricky font names `hkscsiic.ttf' and `iicore.ttf'.
* src/truetype/ttobjs.c (TRICK_NAMES_MAX_CHARACTERS,
TRICK_NAMES_COUNT): Updated.
(trick_names): Add family name for the two fonts.
2013-11-24 00:19:17 +01:00
Werner Lemberg 9326cafa9b * src/sfnt/ttsbit.c (tt_sbit_decoder_load_bitmap): Typo. 2013-11-23 23:59:25 +01:00
Werner Lemberg 8af2a1cd95 [truetype] Typo.
Problem reported by Hin-Tak Leung <htl10@users.sourceforge.net>.

* src/sfnt/sfobjs.c (sfnt_load_face): Return correct `bsize->width'
value if the font lacks an `OS/2' table.
2013-11-21 13:13:12 +01:00
Werner Lemberg 427b176893 [truetype] Improve handling of buggy embedded bitmap strikes.
We are now able to successfully load `AppleMyoungJo.ttf'.
Problem reported by Hin-Tak Leung <htl10@users.sourceforge.net>.

* src/sfnt/ttsbit.c (tt_sbit_decoder_load_bitmap): Don't trust glyph
format.
2013-11-21 13:10:56 +01:00
Werner Lemberg 2862686996 [truetype] Don't trust `maxp's `maxSizeOfInstructions'.
Problem reported by Hin-Tak Leung <htl10@users.sourceforge.net>; see

  http://lists.nongnu.org/archive/html/freetype-devel/2013-08/msg00005.html

for details.

* src/base/ftobjs.c (FT_Load_Glyph): Check size of `fpgm' and `prep'
tables also for setting `autohint'.

* src/truetype/ttgload.c (TT_Load_Simple_Glyph): Use code from
`TT_Process_Composite_Glyph' for handling unreliable values of
`maxSizeOfInstructions'.
2013-11-20 21:06:18 +01:00
Werner Lemberg bc25de66c1 [sfnt] Fix `OS/2' table version 5 support.
We now follow the `official' announcement from Microsoft (on the
OpenType mailing list, which unfortunately hasn't a public archive).

* include/freetype/tttables.h (TT_OS2):
s/usLowerPointSize/usLowerOpticalPointSize/,
s/usUpperPointSize/usUpperOpticalPointSize/.

* src/sfnt/ttload.c (tt_face_load_os2): Update, and set correct
default values.
2013-11-16 07:52:20 +01:00
Werner Lemberg c52b129ccd * builds/unix/ft2unix.h: Remove. No longer necessary.
* builds/unix/install.mk (install): Updated.
2013-11-13 10:06:00 +01:00
Werner Lemberg fae3820764 Simplify header file hierarchy.
This large patch changes the header file directory layout from
`include/freetype/...' to `include/...', effectively removing one
level.  Since the file `ft2build.h' is also located in `include'
(and it stays there even after installation), all FreeType header
files are now in a single directory.

Applications that use (a) `freetype-config' or FreeType's
`pkg-config' file to get the include directory for the compiler, and
(b) the documented way for header inclusion like

  #include <ft2build.h>
  #include FT_FREETYPE_H
  ...

don't need any change to the source code.

* include/freetype/*: Move up to...
* include/*: ... this directory.

* builds/amiga/include/freetype/*: Move up to...
* builds/amiga/include/*: ... this directory.

*/*: Essentially do `s@/freetype/@/@' where appropriate.

* CMakeList.txt: Simplify.
* builds/unix/freetype-config.in, builds/unix/freetype2.in: For
`--cflags', return a single directory.
* builds/unix/install.mk (install): No longer try to remove `cache'
and `internal' subdirectories; instead, remove the `freetype'
subdirectory.
2013-11-13 08:55:46 +01:00
Werner Lemberg ea5c781afa [truetype] Fix last `truetype' commit.
* src/truetype/ttgload.c (tt_get_metrics): Preserve stream position.
Return error value.
(load_truetype_glyph): Updated.
2013-11-12 08:55:26 +01:00
Werner Lemberg 7833328b90 * docs/CMAKE: New dummy file. 2013-11-10 06:26:52 +01:00
Dave Arnold dd21301ef2 [cff] Fix for hints that touch.
* src/cff/cf2hints.c (cf2_hintmap_insertHint): Fix condition for
finding index value of insertion point.
2013-11-08 10:52:51 +01:00
Werner Lemberg 5e225b7c15 [truetype] Fix handling of phantom points in composite glyphs.
Problem reported by Nigel Tao <nigeltao@golang.org>.

This is a follow-up commit to the previous one.

* src/truetype/ttgload.c (load_truetype_glyph): Call
`tt_get_metrics' after loading the glyph header.
2013-11-06 08:41:59 +01:00
Werner Lemberg 7e4b0fbfdd [truetype] Improve emulation of vertical metrics.
This commit also improves the start values of vertical phantom
points.  Kudos to Greg Hitchcock for help.

* src/truetype/ttgload.c (TT_Get_VMetrics): Add parameter to pass
`yMax' value.  Replace code with fixed Microsoft definition.
(tt_get_metrics): Updated.
(TT_LOADER_SET_PP): Add explanation how to initialize phantom
points, taken from both the OpenType specification and private
communication with Greg (which will eventually be added to the
standard).
Fix horizontal position of `pp3' and `pp4'.

* src/truetype/ttgload.h: Updated.

* src/truetype/ttdriver.c (tt_get_advances): Updated.

* docs/CHANGES: Updated.
2013-11-06 07:14:49 +01:00
Werner Lemberg b1d97810c9 Improve comment. 2013-11-06 06:52:13 +01:00
Werner Lemberg 29bca65dda Improve documentation of `FT_Load_Sfnt_Table'. 2013-11-05 23:46:25 +01:00
Werner Lemberg 507405369b * builds/windows/vc2010/freetype.vcxproj: s/v110/v100/.
PlatformToolSet version 110 is for VC2012.

Problem reported (with solution) by Dave Arnold <darnold@adobe.com>.
2013-11-05 23:19:18 +01:00
Werner Lemberg c606428693 [truetype] Correctly reset point tags for glyph components.
Problem reported by Nigel Tao <nigeltao@golang.org>.

* src/truetype/ttgload.c (TT_Process_Composite_Glyph): Fix loop.
2013-11-05 13:29:15 +01:00
Werner Lemberg e4db812790 Typos. 2013-11-03 20:29:37 +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 35b0818986 Fix Savannah bug #40451.
Simply apply the patch from the bug report.

* builds/unix/ftconfig.in, builds/vms/ftconfig.h,
include/freetype/config/ftconfig.h: The used #pragma directives only
work with gcc versions 4.6 and higher.
2013-11-02 08:28:41 +01:00
Werner Lemberg afa0d59ee5 * docs/CHANGES: Updated. 2013-11-01 22:27:27 +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
Werner Lemberg e921bdebde Comment fix. 2013-11-01 12:41:27 +01:00
Werner Lemberg 0c61c096b8 Comment fixes. 2013-10-28 05:09:21 +01:00
Werner Lemberg ee5105107b [sfnt] Implement support for `OS/2' table version 5.
See

  http://typedrawers.com/discussion/470/new-microsoft-size-specific-design-selection-mechanism

for the announcement.

* include/freetype/tttables.h (TT_OS2): Add fields
`usLowerPointSize' and `usUpperPointSize'.  Since FreeType returns
this structure only as a pointer through `FT_Get_Sfnt_Table', there
shouldn't be any ABI problems.

* src/sfnt/ttload.c (tt_face_load_os2): Implement it.

* docs/CHANGES: Updated.
2013-10-27 07:25:35 +01:00
Werner Lemberg 994a859831 * README.git, docs/CHANGES, docs/INSTALL: Updated. 2013-10-24 08:50:34 +02:00
John Cary a0e4a73fd4 Provide cmake support.
* CMakeLists.txt: New file.
2013-10-24 08:49:08 +02:00
Dave Arnold 4cfa8fc5be Comment on no-stem-darkening & darkening-parameters 2013-10-23 21:31:00 +02:00
Kenneth Miller 4d87ac8a7f Provide support for x64 builds in Visual C++ project files.
* src/builds/win32: Renamed to...
* src/builds/windows: This.

* src/builds/windows/vc2010/*: Updated to handle x64 target.

* src/builds/windows/*.mk, docs/INSTALL.GNU: s/win32/windows/ where
appropriate.
2013-10-23 20:10:56 +02:00
Werner Lemberg 1eb06e67a0 Minor doc improvement. 2013-10-22 10:42:38 +02:00
Werner Lemberg db9159c471 Add md5 URL. 2013-10-22 10:27:50 +02:00
Werner Lemberg 604838d5ba * src/base/md5.c, src/base/md5.h: Updated to recent version.
* src/base/ftobjs.c: Updated; `md5.c' no longer uses `free'.
2013-10-22 01:10:10 +02:00
Werner Lemberg 75efc2d0bd [autofit] s/SMALL_TOP/X_HEIGHT/.
* src/autofit/afblue.dat: Updated.

* src/autofit/afblue.c, src/autofit/afblue.h: Regenerated.

* src/autofit/aflatin.c, src/autofit/aflatin.h,
src/autofit/atlatin2.c: Updated.
2013-10-19 21:46:03 +02:00
Werner Lemberg 34efe05ce0 * src/autofit/afblue.dat: s/MINOR/DESCENDER/.
* src/autofit/afblue.c, src/autofit/afblue.h: Regenerated.
2013-10-19 21:14:40 +02:00
Werner Lemberg a5f22a9ed2 [autofit] Add description strings to script entries.
Currently, this is unused.

* src/autofit/afscript.h: Do it.
* src/autofit/afglobal.c, src/autofit/afpic.c,
src/autofit/aftypes.h: Updated.
2013-10-17 11:08:25 +02:00
Werner Lemberg 955f6a86a3 [autofit] Improve tracing message for extra light flag.
* src/autofit/aflatin.c (af_latin_metrics_scale_dim): Do it.
2013-10-16 19:47:57 +02: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 b6695243b7 [autofit] Improve tracing of `latin' hinter.
* src/autofit/aflatin.c (af_latin_metrics_init_blues): Report blue
zone types.
(af_latin_metrics_scale_dim): Report scaling changes due to x height
alignment.
Report scaled stroke width and blue zone values.
2013-10-12 10:33:04 +02:00
Werner Lemberg 2c56f2ab90 Improve last ChangeLog entry. 2013-10-07 22:01:00 +02:00
Dave Arnold e845a85ea5 * src/cff/cf2font.c (cf2_computeDarkening): Avoid division by zero. 2013-10-03 23:04:29 +02:00
Werner Lemberg 1a39944fa0 Updated CHANGES file. 2013-10-03 06:16:50 +02:00
Darrell Bellert 01af71d42f * src/sfnt/ttload.c (tt_face_load_pclt): Fix `pclt_fields'. 2013-10-02 22:04:07 +02:00
Dave Arnold 0b33045285 * src/cff/cf2font.c (cf2_computeDarkening): Initialize darkenAmount.
This line was lost in commit 89ca1fd6 (from 2013-06-25).  The effect
is to use a previous darkening amount when producing an unhinted,
unscaled outline.  This can cause autohint samples in ftgrid and
ftview to be based on darkened CFF outlines instead of unhinted,
undarkened ones.
2013-10-02 11:04:06 +02:00
Dave Arnold 3a2cb0f881 Fix Savannah bug #39295.
The bug was caused by switching to the initial hintmap (the one in
effect when `moveto' executes) just before drawing the final element
in the charstring.  This ensured that the path was closed (in both
Character Space and Device Space).  But if the final element was a
curve and if the final hintmap was different enough from the initial
one, then the curve was visibly distorted.

The first part of the fix is to draw the final curve using the final
hintmap as specified by the charstring.  This corrects the
distortion but does not ensure closing in Device Space.  It may
require the rasterizer to automatically generate an extra closing
line.  Depending on the hintmap differences, this line could be from
zero to a couple pixels in length.

The second part of the fix covers the case where the charstring
subpath is closed with an explicit line.  We now modify that line's
end point to avoid the distortion.

Some glyphs in the bug report font (TexGyreHeros-Regular) that show
the change are:

  25ppem    S (98)
  24ppem    eight (52)
  25.5ppem  p (85)

Curves at the *end* of a subpath are no longer distorted.  However,
some of these glyphs have bad hint substitutions in the middle of a
subpath, and these are not affected.

The patch has been tested with a set of 106 fonts that shipped with
Adobe Creative Suite 4, together with 756 Open Source CFF fonts from
Google Fonts.  There are 1.5 million glyphs, of which some 20k are
changed with the fix.  A sampling of a few hundred of these changes
have been examined more closely, and the changes look good (or at
least acceptable).

* src/cff/cf2hints.h (CF2_GlyphPathRec): New element `pathIsClosing'
to indicate that we synthesize a closepath line.

* src/cff/cf2hints.c (cf2_glyphpath_init): Updated.
(cf2_glyphpath_pushPrevElem): If closing, use first hint map (for
`lineto' operator) and adjust hint zone.
For synthesized closing lines, use end point in first hint zone.
(cf2_glyphpath_lineTo): Take care of synthesized closing lines.  In
particular, shift the detection of zero-length lines from character
space to device space.
(cf2_glyphpath_closeOpenPath): Remove assertion.
Updated.
2013-09-29 16:17:02 +02:00
Werner Lemberg 4f9760e752 [autofit] Remove outdated comment. 2013-09-25 23:32:25 +02:00
Werner Lemberg b75a8b8817 * src/autofit/aflatin.c (af_{grek,cyrl}_uniranges): Fix arrays. 2013-09-25 09:46:36 +02:00
Werner Lemberg 964317e8db Minor. 2013-09-25 09:22:40 +02:00
suzuki toshiya ac0f4454f7 [bdf, pcf] Refuse non-zero face_index.
Suggested by Akira Tagoh, see

  http://lists.gnu.org/archive/html/freetype/2013-09/msg00030.html

* src/bdf/bdfdrivr.c (BDF_Face_Init): Return Invalid_Argument error
when the font could be opened but non-zero face_index is given.
* src/pcf/pcfdrivr.c (PCF_Face_Init): Ditto.

* src/type42/t42objs.c (T42_Face_Init): Remove unrequired FT_UNUSED
macro for face_index because it is validated in later.
2013-09-25 10:57:17 +09:00
Werner Lemberg 4de7787f22 Fix Savannah bug #40090.
* src/autofit/afcjk.c (af_cjk_metrics_scale): Revert commit
306f8c5d (from 2013-08-25) affecting this function.
2013-09-23 22:10:08 +02:00
Werner Lemberg 5a4c5a5b23 [autofit] Disunify Cyrillic and Greek handling from Latin.
* src/autofit/afscript.h: Add Cyrillic and Greek.

* src/autofit/afblue.dat (AF_BLUE_STRINGSET_GREK,
AF_BLUE_STRINGSET_CYRL): Add blue zones for Greek and Cyrillic.
(AF_BLUE_STRINGSET_LATN): Fix typo.
* src/autofit/afblue.c, src/autofit/afblue.h: Regenerated.

* src/autofit/aflatin.c (af_grek_uniranges, af_cyrl_uniranges): New
arrays.
(af_grek_script_class, af_cyrl_script_class): New scripts.
* src/autofit/aflatin.h: Updated.
2013-09-22 22:37:26 +02:00
Werner Lemberg 2cca96694f * docs/CHANGES: Updated. 2013-09-20 07:23:34 +02:00
Behdad Esfahbod 31e726d939 Fix vertical size of emboldened glyphs.
Cf. https://bugzilla.gnome.org/show_bug.cgi?id=686709

* src/base/ftsynth.c (FT_GlyphSlot_Embolden): Adjust `horiBearingY'
also.
2013-09-20 07:20:53 +02:00
Alexei Podtelezhnikov 52381c14e3 * include/freetype/ftoutln.h: Correct FT_Outline_Get_Orientation
algorithm description.
2013-09-11 23:25:56 -04:00
Werner Lemberg 3f542498b2 [autofit] Improve Hebrew rendering.
This change introduces a new blue zone property
`AF_BLUE_PROPERTY_LATIN_LONG' to make the auto-hinter ignore short
top segments.

* src/autofit/afblue.dat: Fix Hebrew blue strings.
Use AF_BLUE_PROPERTY_LATIN_LONG for AF_BLUE_STRING_HEBREW_TOP.

* src/autofit/afblue.hin (AF_BLUE_PROPERTY_LATIN_LONG): New macro.

* src/autofit/afblue.c, src/autofit/afblue.h: Updated.

* src/autofit/aflatin.c (af_latin_metrics_init_blues): Handle
`AF_LATIN_IS_LONG_BLUE'.

* src/autofit/aflatin.h (AF_LATIN_IS_LONG_BLUE): New macro.
2013-09-11 23:08:31 +02:00
Werner Lemberg 00ea2a133b [doc] s/which/that/ where appropriate.
Note that this is a try by a non-native English speaker whose mother
language (German) doesn't have this distinction at all...
2013-09-03 11:33:10 +02:00
Werner Lemberg 504f5b4a8d Fix Savannah bug #39905 (documentation only). 2013-09-02 22:08:12 +02:00
Werner Lemberg 85a7fdf3c6 [sfnt] Fix frame access while reading WOFF table directory.
* src/sfnt/sfobjs.c (woff_open_font): Using single memory frame
while reading the directory entries for the whole loop.
2013-08-29 21:03:05 +02:00
Werner Lemberg d689d1cf78 Implement support for WOFF containers.
We simply synthesize a SFNT from the WOFF, create a memory stream
for the new data, and load the SFNT as usual.

Does NOT add any API to access WOFF metadata or private blocks.

* include/freetype/internal/tttypes.h (WOFF_HeaderRec,
WOFF_TableRec): New structures.

* include/freetype/tttags.h (TTAG_wOFF): New macro.

* src/base/ftobjs.c (FT_Open_Face): Set `stream' after calling
`open_face'.

* src/sfnt/sfobjs.c [FT_CONFIG_OPTION_SYSTEM_ZLIB]: Include
`FT_GZIP_H'.
(WRITE_BYTE, WRITE_USHORT, WRITE_ULONG): New temporary macros for
writing to a stream.
(sfnt_stream_close, compare_offsets, woff_open_font): New functions.
(sfnt_open_font): Handle `TTAG_wOFF'.
(sfnt_init_face): Set `stream' after calling `sfnt_open_font'.

* src/truetype/ttobjs.c (tt_face_init): Set `stream' after calling
`sfnt->init_face'.

* src/base/ftobjs.c (open_face): Use a pointer to FT_Stream as an
argument so that a changed stream survives.
Update callers.
2013-08-29 17:53:40 +02:00
Werner Lemberg dc240524ff [gzip] New function `FT_Gzip_Uncompress'.
This is modeled after zlib's `uncompress' function.  We need this
for WOFF support.

* include/freetype/ftgzip.h, src/gzip/ftgzip.c (FT_Gzip_Uncompress):
New function.

* src/gzip/rules.mk: Rewrite to better reflect dependencies.
2013-08-29 17:53:24 +02:00
Werner Lemberg 5195ecd62f [autofit] Fix `make multi' compilation.
* src/autofit/afblue.cin, src/autofit/afblue.c: Don't include
`afblue.h' but `aftypes.h'.
* src/autofit/afcjk.c: Don't include `aftypes.h' but `afglobal.h'.
2013-08-28 17:41:21 +02:00
Werner Lemberg e0f39aefde [autofit] Fix C++ compilation.
* src/autofit/afglobal.c (af_face_globals_get_metrics),
src/autofit/afdummy.c (af_dflt_script_class), src/autofit/afindic.c
(af_deva_script_class): Use proper casts.
2013-08-28 17:34:01 +02:00
Behdad Esfahbod c799dd6725 * src/sfnt/ttload.c (tt_face_load_font_dir): Fix sign typos. 2013-08-27 21:46:03 +02:00
Behdad Esfahbod bd3849e7de FT_Open_Face: Improve external stream handling.
If the font's `clazz->init_face' function wants to swap to new
stream, handling of whether original stream was external could
result to either memory leak or double free.  Mark externality into
face flags before calling `init_face' such that the clazz can handle
external streams properly.

* src/base/ftobjs.c (FT_Open_Face): Move code to set
FT_FACE_FLAG_EXTERNAL_STREAM to...
(open_face): This function.
2013-08-27 21:43:38 +02:00
Werner Lemberg bcd8c0b0eb Remove `FT_SqrtFixed' function.
It's no longer used.

* include/freetype/internal/ftcalc.h, src/base/ftcalc.c: Do it.
2013-08-27 21:36:03 +02:00
Werner Lemberg 71c0ad6520 Whitespace. 2013-08-27 21:30:09 +02:00
Werner Lemberg 5e53db25ff [autofit] While tracing, report script names instead of ID values.
* src/autofit/afglobal.c (af_script_names) [FT_DEBUG_LEVEL_TRACE]:
New array.
* src/autofit/afglobal.h: Updated.

* src/autofit/afcjk.c (af_cjk_metrics_init_widths,
af_cjk_hint_edges): Use `af_script_names'.
* src/autofit/aflatin.c (af_latin_metrics_init_widths,
af_latin_hint_edges): Ditto.
2013-08-27 18:37:39 +02:00
Werner Lemberg 278f64b330 [autofit] Report used script while hinting a glyph.
* src/autofit/afcjk.c (af_cjk_hint_edges), src/autofit/aflatin.c
(af_latin_hint_edges): Implement it.
2013-08-26 20:20:03 +02:00
Werner Lemberg 371f5c3b9d [autofit] Add support for Hebrew script.
* src/autofit/afblue.dat: Add blue strings for Hebrew.
* src/autofit/afblue.c, src/autofit/afblue.h: Regenerated.

* src/autofit/aflatin.c (af_hebr_uniranges): New array.
(af_hebr_script_class): New script.
* src/autofit/aflatin.h, src/autofit/afscript.h: Updated.
2013-08-26 20:11:24 +02:00
Werner Lemberg 098121dbb9 [autofit] Improve tracing messages.
* src/autofit/afcjk.c (af_cjk_metrics_init_widths): Mention script
ID in tracing message.
(af_cjk_metrics_init_blues): Initialize `axis' outside of the inner
loop.
Improve tracing messages.
(af_cjk_hint_edges) [FT_DEBUG_LEVEL_TRACE]: New variable
`num_actions' to count hinting actions.
Improve tracing messages.

* src/autofit/aflatin.c (af_latin_metrics_init_widths): Mention
script ID in tracing message.
(af_latin_metrics_init_blues, af_latin_hint_edges): Improve tracing
messages.
2013-08-26 18:54:05 +02:00
Werner Lemberg ffee64afb8 Better tracing of loaded glyphs.
Previously, the loading of a glyph was traced at level 4, if at all.
With this change, all font loading routines emit a tracing message
at level 1, making it easier to select tracing output (for example
using F2_DEBUG="any:1 afhints:7 aflatin:7").

* src/bdf/bdfdrivr.c (BDF_Glyph_Load): Add tracing message.
* src/cff/cffdrivr.c (cff_glyph_load): Ditto.
* src/cff/cffgload.c (cff_decoder_prepare): Improve tracing
messages.
* src/cid/cidgload.c (cid_load_glyph): Use level 1 for tracing
message.
* src/pcf/pcfdrivr.c (PCF_Glyph_Load): Ditto.
* src/pfr/pfrobjs.c (pfr_slot_load): Add tracing message.
* src/truetype/ttgload.c (TT_Load_Glyph): Ditto.
* src/type1/t1gload.c (T1_Load_Glyph): Ditto.
* src/type42/t42objs.c (T42_GlyphSlot_Load): Ditto.
* src/winfonts/winfnt.c (FNT_Load_Glyph): Ditto.
2013-08-26 12:55:48 +02:00
Werner Lemberg 33655a9647 [autofit] Fix script selection.
* src/autofit/afglobal.c (af_face_globals_get_metrics): Use
`AF_SCRIPT_DFLT', not value 0.
Simplify code.

* src/autofit/afscript.h: Sort by script name.
2013-08-26 09:58:50 +02:00
Werner Lemberg 92f5a047c9 [autofit] Make `dummy' hinter work as expected.
* src/autofit/afdummy.c (af_dummy_hints_init): Properly set scaling
information.
(af_dummy_hints_apply): Scale the glyphs.
2013-08-26 09:22:27 +02:00
Werner Lemberg c1eb445965 [autofit] Make `cjk' module use blue stringsets.
* src/autofit/afcjk.c (AF_CJK_MAX_TEST_CHARACTERS): Removed.
(af_cjk_hani_blue_chars): Removed.
(AF_CJK_BLUE_TYPE_*): Removed.
(af_cjk_metrics_init_blues): Replace AF_CJK_MAX_TEST_CHARACTERS with
AF_BLUE_STRING_MAX_LEN.
Change loops to use offsets (in file `afblue.h') into the new arrays
`af_blue_stringsets' and `af_blue_strings' (in file `afblue.c').
Instead of three dimensions (as used in the old blue string array)
we now use properties to do the same, saving one loop nesting level.

* src/autofit/afcjk.h: Remove old enumeration values superseded by
the new data in `afblue.h'.
(AF_CJK_IS_TOP_BLUE, AF_CJK_IS_HORIZ_BLUE, AF_CJK_IS_FILLED_BLUE,
AF_CJK_IS_RIGHT_BLUE): New macros, to be used in
`af_cjk_metrics_init_blues'.
(AF_CJK_BLUE_IS_RIGHT): Remove this now redundant enum value.
(AF_CJK_BLUE_IS_TOP): Renamed to...
(AF_CJK_BLUE_TOP): This.
(AF_CJK_MAX_BLUES): Remove.
(AF_CJKAxisRec): Updated.
2013-08-25 19:47:26 +02:00
Werner Lemberg 5c4a23a4e9 [autofit] Typo.
* src/autofit/afblue.hin, src/autofit/afblue.c (GET_UTF8_CHAR): Use
cast.
2013-08-25 19:29:07 +02:00
Werner Lemberg 306f8c5d89 [autofit] Synchronize `cjk' with `latin' module (and vice versa).
* src/autofit/afcjk.c (af_cjk_metrics_init_widths): Add tracing
messages.
(af_cjk_metrics_init_blues): Don't pass blue string array as
argument but use the global array directly.
Use `outline' directly.
Update and add tracing messages.
(af_cjk_metrics_init): Simplify code.
(af_cjk_metrics_scale_dim): Improve tracing message.
(af_cjk_metrics_scale): Synchronize.

* src/autofit/aflatin.c (af_latin_metrics_init_widths,
af_latin_metrics_init_blues): Improve and add tracing messages.
2013-08-25 13:07:08 +02:00
Werner Lemberg 0975d685ed [autofit] Make `latin' module use blue stringsets.
* src/autofit/aflatin.c (AF_LATIN_MAX_TEST_CHARACTERS): Removed.
(af_latin_blue_chars): Removed.
(af_latin_metrics_init_blues): Replace AF_LATIN_MAX_TEST_CHARACTERS
with AF_BLUE_STRING_MAX_LEN.
Change loops to use offsets (in file `afblue.h') into the new arrays
`af_blue_stringsets' and `af_blue_strings' (in file `afblue.c').
Use `AF_LATIN_IS_SMALL_TOP_BLUE' macro.

* src/autofit/aflatin.h: Remove old enumeration values superseded by
the new data in `afblue.h'.
(AF_LATIN_IS_TOP_BLUE): Updated definition.
(AF_LATIN_IS_SMALL_TOP_BLUE): New macro.
(AF_LATIN_MAX_BLUES): Remove.
(AF_LatinAxisRec): Updated.
2013-08-25 08:37:47 +02:00
Werner Lemberg db3e5b9394 [autofit] Add blue stringsets.
* src/autofit/aftypes.h: Include `afblue.h'.
(AF_ScriptClassRec): Add `blue_stringset' field.
(AF_DEFINE_SCRIPT_CLASS): Updated.

* src/autofit/autofit.c: Include `afblue.c'.

* src/autofit/afcjk.c (af_hani_script_class), src/autofit/afdummy.c
(af_dflt_script_class), src/autofit/afindic.c
(af_deva_script_class), src/autofit/aflatin.c
(af_latn_script_class), src/autofit/aflatin2.c
(af_ltn2_script_class): Updated.

* src/autofit/rules.mk (AUTOF_DRV_SRC): Add `afblue.c'.
2013-08-25 08:23:22 +02:00
Werner Lemberg 8b8be78385 [autofit] Introduce data file for blue strings.
The idea is to have a central file which gets processed by a Perl
script to create proper `.c' and `.h' files using templates.  There
are two other reasons to do that:

  . The data file should be easily readable.  We use UTF-8 encoding
    which then gets converted to single bytes.

  . Since the number of supported scripts will increase soon, the
    current usage of blue string arrays is a waste of space.  Using
    the Perl script it is possible to imitate jagged arrays,
    defining enumeration constants as offsets into the arrays.

This commit only adds files without changing any functionality.

* src/autofit/afblue.dat: New data file.
* src/tools/afblue.pl: New Perl script for processing `afblue.dat'.

* src/autofit/afblue.cin, src/autofit/afblue.hin: New template files
for...
* src/autofit/afblue.c, src/autofit/afblue.c: New source files.
To avoid a dependency on Perl, we add them too.
2013-08-25 08:01:41 +02:00
Alexei Podtelezhnikov fc32e1c8cc [base] Enable new algorithm for BBox_Cubic_Check.
* src/base/ftbbox.c: Enable new BBox_Cubic_Check algorithm, remove the
old one. Improve comments.
2013-08-19 22:57:05 -04:00
Werner Lemberg 4af444400f * builds/unix/unix-def.in (freetype2.pc): Don't set executable bit. 2013-08-18 18:46:30 +02:00
Werner Lemberg 6bfa263a97 Fix Savannah bug #39804.
* builds/unix/configure.raw (LIBPNG): Define and export.
* builds/unix/freetype-config.in, builds/unix/freetype2.in: Handle
libpng.
2013-08-18 18:34:05 +02:00
Alexei Podtelezhnikov 32a7d87050 [base] Clean up BBox_Conic_Check.
* src/base/ftbbox.c (BBox_Conic_Check): Remove redundant checks for
extremum at the segment ends, which are already within the bbox.
Slightly modify calculations.
2013-08-17 22:19:21 -04:00
Alexei Podtelezhnikov 1a9c3d14fb [base] Finish experimental (disabled) BBox_Cubic_Check implementation.
* src/base/ftbbox.c (BBox_Cubic_Check): Scale arguments to improve
accuracy and avoid overflows.
2013-08-15 22:51:42 -04:00
Alexei Podtelezhnikov 61a65510dc [base] Refactor experimental (disabled) BBox_Cubic_Check.
* src/base/ftbbox.c (BBox_Cubic_Check): Implement the minimum search
as the mirror image of the maximum search.
2013-08-13 22:28:57 -04:00
John Tytgat 9bcfab8758 Fix Savannah bug #39702.
* src/cff/cffload.c (cff_index_get_pointers): Check for `cur_offset
!= 0'; this stronger test is mandated by the CFF specification.
Fix test for INDEX structures which have one or more empty entries
at the end.
2013-08-06 08:55:19 +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
Werner Lemberg 9e6de36aee Fix Savannah bug #39700.
* builds/unix/ftconfig.h: Synchronize with
`include/freetype/config/ftconfig.h'.

* builds/vms/ftconfig.h: Ditto.
Make the differences to the master `ftconfig.h' file as small as
possible for easier maintainance.
2013-08-05 16:37:21 +02:00
Werner Lemberg df41fe5791 Whitespace. 2013-08-05 16:34:32 +02:00
Werner Lemberg cc25e3ae12 [autofit] Improve handling of `near' points.
Points which are very near to each other are now marked as such.
The `weak' flag is then computed by using the `in' vector of the
first and the `out' vector of the last point of a group of near
points.

For example, this fixes the rendering of glyph `Oslash' in
`Roboto-Thin.ttf'.

* src/autofit/afhints.h (AF_Flags): New value `AF_FLAGS_NEAR'.

* src/autofit/afhints.c (af_glyph_hints_reload): Introduce
the heuristic value `near_limit' to decide whether the current point
is near to the previous one, then set `AF_FLAG_NEAR' accordingly.
Store good `in' vector (of last non-near point) in
`last_good_in_{x,y}' and use it as an argument to
`ft_corner_is_flat' if necessary.
2013-08-05 08:46:15 +02:00
Werner Lemberg ba9cf52d3b Comment typo. 2013-08-05 07:00:59 +02:00
Werner Lemberg fb09a51f0f Add comments to `ft_corner_is_flat'. 2013-08-04 18:24:02 +02:00
Werner Lemberg b8bf8b54e5 [autofit] Update comments. 2013-08-04 09:25:24 +02:00
Werner Lemberg 0d28a7d6a6 * include/freetype/ftcffdrv.h: Improve documentation.
This is based on blog entries from David Lemon and Dave Arnold (both
from Adobe) with kind permission.  Dave also helped in
proof-reading.
2013-08-02 22:59:43 +02:00
Werner Lemberg 6d3c10e055 Typo. 2013-08-02 20:47:15 +02:00
Werner Lemberg 456cc440ca [autofit] Move declaration of scripts into separate file.
This has the benefit that we don't need to duplicate the data at
different places.

* src/autofit/afscript.h: New file.

* src/autofit/aftypes.h (AF_Script): Include `afscript.h' to define
the enumeration values.

* src/autofit/afglobal.c: Include `afscript.h' to get the script
specific header files.
(af_script_classes): Include `afscript.h' to fill this array.

* src/autofit/afpic.c: Include `afscript.h' to get the script
specific header files.
(autofit_module_class_pic_init): Include `afscript.h' for
initialization.
* src/autofit/afpic.h (AF_SCRIPT_CLASSES_COUNT,
AF_SCRIPT_CLASSES_REC_COUNT): Removed.  Use `AF_SCRIPT_MAX' instead.

* src/autofit/rules.mk (AUTOF_DRV_H): Updated.
2013-08-02 20:25:21 +02:00
Werner Lemberg 773601da12 [autofit] Move declaration of writing systems into separate file.
This has the benefit that we don't need to duplicate the data at
different places.

* src/autofit/afwrtsys.h: New file.

* src/autofit/aftypes.h (AF_WritingSystem): Include `afwrtsys.h' to
define the enumeration values.

* src/autofit/afglobal.c: Include `afwrtsys.h' to get the writing
system specific header files.
Include `afpic.h'.
(af_writing_system_classes): Include `afwrtsys.h' to fill this
array.

* src/autofit/afpic.c: Include `afwrtsys.h' to get the writing
system specific header files.
(autofit_module_class_pic_init): Include `afwrtsys.h' for
initialization.
* src/autofit/afpic.h (AF_WRITING_SYSTEM_CLASSES_COUNT,
AF_WRITING_SYSTEM_CLASSES_REC_COUNT): Removed.  Use
`AF_WRITING_SYSTEM_MAX' instead.
2013-08-02 19:51:17 +02:00
Werner Lemberg 74a9b670e9 [sfnt] Fix compilation with g++.
* src/sfnt/pngshim.c (error_callback, read_data_from_FT_stream): Use
cast.
(Load_SBit_Png): Pacify compiler.
2013-08-02 14:53:32 +02:00
Werner Lemberg 89a529f317 [autofit] Fix `make multi'.
* include/freetype/config/ftconfig.h (FT_LOCAL_ARRAY,
FT_LOCAL_ARRAY_DEF): New macros.

* src/autofit/afglobal.c (af_writing_system_classes,
af_script_classes): Use FT_LOCAL_ARRAY_DEF.
* src/autofit/afglobal.h: Declare `af_writing_system_classes' and
`af_script_classes'.
* src/autofit/afloader.c: Include `afpic.h'.
2013-08-02 14:50:23 +02:00
Werner Lemberg e8ed2d621e Another round of cppcheck nitpicks.
The call was (from the top-level of the FreeType tree):

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

using cppcheck git commit f7e93f99.

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

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

* src/gxvalid/*: Comment out redundant code or guard it with
FT_DEBUG_LEVEL_TRACE.
2013-08-01 12:20:20 +02:00
Werner Lemberg 72f5ff5bbb [autofit] Introduce `writing systems'.
This patch adds a new top level to the auto-hinter's script class
hierarchy.  It defines `writing systems' which can contain multiple
scripts.

For example, the `latin' writing system (in file `aflatin.c') is
able to support scripts like Latin, Cyrillic, Armenian, etc., which
can be handled similarly.

Scripts are now named using four-letter OpenType tags.

* src/autofit/aftypes.h (AF_ScriptClassRec): Move relevant members
to...
(AF_WritingSystemClassRec): This new structure.  It holds pointers
to functions which can be shared among related scripts.
(AF_WritingSystem): New enumeration.
(AF_Script): Revised values using four-letter tags.
(AF_DEFINE_WRITING_SYSTEM_CLASS): New macro.
(AF_DEFINE_SCRIPT_CLASS): Updated.

* src/autofit/afglobal.c (af_writing_system_classes): New global,
constant array.
(af_script_classes): Updated.
(af_face_globals_free): Updated.
Remove assertion.
(af_face_globals_get_metrics): Updated.

* src/autofit/afglobal.h (AF_SCRIPT_FALLBACK)
[!AF_CONFIG_OPTION_CJK]: Handle this case.

* src/autofit/afloader.c (af_loader_load_g, af_loader_load_glyph):
Updated.

* src/autofit/afpic.c (autofit_module_class_pic_init): Updated;
initialize structures for both writing systems and scripts.
* src/autofit/afpic.h: Updated.
(AF_WRITING_SYSTEM_CLASSES_GET): New macro.

* src/autofit/afcjk.c (af_cjk_writing_system_class): New writing
system.
(af_cjk_uniranges): Renamed to...
(af_hani_uniranges): This.
(af_cjk_script_class): Reduced and renamed to...
(af_hani_script_class): This.
* src/autofit/afcjk.h: Updated.

* src/autofit/afdummy.c (af_dummy_writing_system_class): New writing
system.
(af_dummy_script_class): Reduced and renamed to...
(af_dflt_script_class): This.
* src/autofit/afdummy.h: Updated.

* src/autofit/afindic.c (af_indic_writing_system_class): New writing
system.
(af_indic_uniranges): Renamed to...
(af_deva_uniranges): This.
(af_indic_script_class): Reduced and renamed to...
(af_deva_script_class): This.
* src/autofit/afcjk.h: Updated.

* src/autofit/aflatin.c (af_latin_writing_system_class): New writing
system.
(af_latin_uniranges): Renamed to...
(af_latn_uniranges): This.
(af_latin_script_class): Reduced and renamed to...
(af_latn_script_class): This.
* src/autofit/aflatin.h: Updated.

* src/autofit/aflatin2.c (af_latin2_writing_system_class): New
writing system.
(af_latin2_uniranges): Renamed to...
(af_ltn2_uniranges): This.
Synchronize ranges with `latin'.
(af_latin2_script_class): Reduced and renamed to...
(af_ltn2_script_class): This.
* src/autofit/aflatin2.h: Updated.
2013-07-31 22:57:01 +02:00
Werner Lemberg 5d6a360542 [autofit] Variable renaming.
* src/autofit/aftypes.h (AF_ScriptMetricsRec):
s/clazz/script_class/.
Update all users.
2013-07-31 22:57:01 +02:00
Werner Lemberg cc34efca99 Minor. 2013-07-31 22:55:50 +02:00
suzuki toshiya 2b29ed660a Ignore libpng-config under cross-building configuration,
because it will return the flags for the hosting environment.

* builds/unix/configure.raw: Ignore libpng-config when
`cross_compiling' == yes.
2013-07-30 13:55:29 +09:00
suzuki toshiya f2e7f1e1dd 2013-07-30 Behdad Esfahbod <behdad@google.com>
Prevent division by zero by a transparent color.

	* src/base/ftbitmap.c (ft_gray_for_premultiplied_srgb_bgra):
	Return 0 immediately, when alpha channel is zero.
2013-07-30 13:32:57 +09:00
Behdad Esfahbod 21c32b08d5 Add FT_FACE_FLAG_COLOR and FT_HAS_COLOR.
Also disambiguate Google's color bitmap tables.

* include/freetype/freetype.h (FT_FACE_FLAG_COLOR, FT_HAS_COLOR):
New macros.

* include/freetype/internal/tttypes.h (TT_SbitTableType): Add
TT_SBIT_TABLE_TYPE_CBLC.

* src/sfnt/sfobjs.c (sfnt_load_face): Handle FT_FACE_FLAG_COLOR.

* src/sfnt/ttsbit.c (tt_face_load_sbit,
tt_face_load_strike_metrics, tt_face_load_sbit_image): Handle
TT_SBIT_TABLE_TYPE_CBLC.
2013-07-25 21:53:18 +02:00
suzuki toshiya b4725cb716 [sfnt] Fix for `make multi' target.
* src/sfnt/pngshim.c (Load_SBit_Png): Use FT_LOCAL_DEF().
2013-07-24 14:25:39 +09:00
Werner Lemberg 6a7df625df * docs/INSTALL.GNU: Updated. 2013-07-20 10:48:37 +02:00
Behdad Esfahbod ff269528ca [sfnt] Fix `sbix' table version handling.
* src/sfnt/ttsbit.c (tt_face_load_sbit) [TT_SBIT_TABLE_TYPE_SBIX]:
USHORT version numbers are to be considered as `minor'.
2013-07-20 08:02:39 +02:00
Werner Lemberg 05c1421f8d [autofit] Fix segment classification for blue zones.
The old code (essentially unchanged since the very beginning)
incorrectly handled this configuration

               x -o- x
                /   \
               /     \
              /       \
             o         o

as flat and this

                o               o
               /               /
             x|              x|
              |               |
              o---------------o

as round.  (`o' and `x' are on and off points, respectively).

This is a major change which should improve the rendering results
enormously for many TrueType fonts, especially in the range approx.
20-40ppem, fixing the appearance of many overshoots.

* src/autofit/aflatin.c (af_latin_metrics_init_blues): Look at the
first and last points of the segment, not the points right before
and after.
2013-07-19 23:11:23 +02:00
Behdad Esfahbod 778a7e6a36 [sfnt] `sbix' fix-ups.
* src/sfnt/sfobjs.c (sfnt_load_face): Apple's `sbix' color bitmaps
are rendered scaled and then the `glyf' outline rendered on top.  We
don't support that yet, so just ignore the `glyf' outline and
advertise it as a bitmap-only font.

* src/sfnt/ttsbit.c (tt_face_load_strike_metrics)
[TT_SBIT_TABLE_TYPE_SBIX]: Return metrics in 26.6 units.
(tt_face_load_sbix_image): Typo.
2013-07-19 14:28:28 +02:00
Werner Lemberg 01705395b0 [sfnt] Add support for Apple's `sbix' color bitmap table.
* include/freetype/internal/tttypes.h (TT_SBit_MetricsRec): Widen
fields to FT_Short and FT_UShort, respectively.
(TT_SBitTableType): New enumeration.
(TT_FaceRec): Add `sbit_table_type' field.

* include/freetype/tttags.h (TTAG_sbix): New macro.

* src/sfnt/pngshim.c (Load_SBit_Png): Pass a more generic
FT_GlyphSlot argument instead FT_Bitmap.
Add flag to control map and metrics handling.
Update all users.

* src/sfnt/ttsbit.c: Include `ttmtx.h'.
(tt_face_load_eblc): Renamed to...
(tt_face_load_sbit): This.
Handlic `sbix' bitmaps.
(tt_face_free_eblc): Renamed to...
(tt_face_load_sbit): This.
Updated.
(tt_face_load_strike_metrics): Handle `sbix' bitmaps.
(tt_face_load_sbix_image): New function.
(tt_sbit_decoder_alloc_bitmap, tt_sbit_decoder_load_image,
tt_sbit_decoder_load_byte_aligned, tt_sbit_decoder_load_bit_aligned,
tt_sbit_decoder_load_compound, tt_sbit_decoder_load_png,
tt_sbit_decoder_load_image, tt_sbit_decoder_load_bitmap): Don't pass
and handle load flags.
(tt_sbit_decoder_load_bitmap) [!FT_CONFIG_OPTION_USE_PNG]: Better
handle formats 17-19.
Move color to grayscale conversion to...
(tt_face_load_sbit_image): Here.
Handle `sbix' bitmaps.

* src/sfnt/pngshim.h: Updated.
* src/sfnt/ttsbit.h: Updated.
* src/sfnt/sfdriver.c: Updated.
2013-07-18 13:13:12 +02:00
Werner Lemberg 274207eb9a [sfnt] Ignore invalid magic number in `head' or `bhed'.
Other font engines seem to ignore it also.  Problem reported by
Hin-Tak Leung <htl10@users.sourceforge.net>.

* src/sfnt/ttload.c (check_table_dir): Don't abort but warn only if
we have an invalid magic number.
2013-07-18 12:38:57 +02:00
Werner Lemberg 9a7951d99b [smooth] Fix segfault caused by previous commit.
* src/smooth/ftgrays.c (gray_set_cell): Always compute
`ras.invalid'.
2013-07-16 15:25:24 +02:00
David Turner 89929ec6b9 [smooth] Improve performance.
Provide a work-around for an ARM-specific performance bug in GCC.
This speeds up the rasterizer by more than 5%.

Also slightly optimize `set_gray_cell' and `gray_record_cell' (which
also improves performance on other platforms by a tiny bit (<1%).

* src/smooth/ftgrays.c (FT_DIV_MOD): New macro.
Use it where appropriate.

(gray_record_cell, gray_set_cell, gray_move_to,
gray_convert_glyph_inner): Streamline condition handling.
2013-07-16 13:36:07 +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
David Turner b28908860d Optimize FT_MulFix for x86_64 GCC builds.
This patch provides an optimized `FT_MulFix' implementation for
x86_64 machines when FreeType is built with GCC, or compatible
compilers like Clang.

Example:
  bin/ftbench -p -t 5 -s 14 -f 0008 Arial.ttf

Before:

  Load                       4.863 us/op
  Load_Advances (Normal)     4.816 us/op
  Load_Advances (Fast)       0.028 us/op
  Render                     2.753 us/op
  Get_Glyph                  0.463 us/op
  Get_CBox                   0.077 us/op
  Get_Char_Index             0.023 us/op
  Iterate CMap              13.898 us/op
  New_Face                  12.368 us/op
  Embolden                   0.028 us/op
  Get_BBox                   0.302 us/op

After:

  Load                       4.617 us/op
  Load_Advances (Normal)     4.645 us/op
  Load_Advances (Fast)       0.027 us/op
  Render                     2.789 us/op
  Get_Glyph                  0.460 us/op
  Get_CBox                   0.077 us/op
  Get_Char_Index             0.024 us/op
  Iterate CMap              13.403 us/op
  New_Face                  12.278 us/op
  Embolden                   0.028 us/op
  Get_BBox                   0.301 us/op

* builds/unix/ftconfig.in, include/freetype/config/ftconfig.h
(FT_MulFix_x86_64): New function.
2013-07-16 13:19:32 +02:00
David Turner a5f33eeb8a Speed up ARMv7 support.
When building for ARMv7 with thumb2 instructions, the optimized
`FT_MulFix_arm' assembly routine was not being used.

The reason for this is in the `ftconfig.h' header, namely:

- The assembly routine uses the `smull' instruction which is not
  available when generating Thumb-1 machine code.  It is available
  in Thumb-2 mode, though.

- The header was written a long time ago before Thumb-2 became
  widely popular (e.g. with Android).  So it simply doesn't use the
  assembly routine if the `__thumb__' built-in macro is defined.

- When compiling in Thumb-2 mode, the compiler will define both
  `__thumb__' and `__thumb2__'.

By checking for `(__thumb2__ || !__thumb__)', we ensure that the
assembly routine is only avoided when generating Thumb-1 code.

Given that this is performance-sensitive function, this improves
`ftbench' as follows on a Galaxy Nexus:

                           Before (us/op)   After (us/op)

  - loading Arial.ttf glyphs at 14 ppem [1]

      Load                   34.285          33.098

  - same operation with the light auto-hinter [2]

      Load                   31.317          29.590

  - same operation without hinting [3]

      Load                    6.143           5.376

  - loading Arial.ttf advances at 14 ppem [4]

      Load_Advances (normal) 34.216          33.016
      Load_Advances (fast)    0.176           0.176

  [1] ftbench -t 5 -p -s 14 -b a -f 0008 Arial.ttf
  [2] ftbench -t 5 -p -s 14 -b a -r 1 -f 0028 Arial.ttf
  [3] ftbench -t 5 -p -s 14 -b a -f 000a Arial.ttf
  [4] ftbench -t 5 -p -s 14 -b b -f 0008 Arial.ttf

* builds/unix/ftconfig.in, include/freetype/config/ftconfig.h
(FT_MULFIX_ASSEMBLER): Fix handling for ARMv7.
2013-07-16 13:19:32 +02:00
Werner Lemberg aa0ac3239c [sfnt] Fix documentation of `tt_face_get_metrics'.
Problem reported in Savannah bug #39383.
2013-07-02 10:36:26 +02:00
Werner Lemberg a411de9157 One more update to `CHANGES' file. 2013-06-28 07:59:42 +02:00
Werner Lemberg e12fc77e46 * docs/CHANGES: Updated. 2013-06-28 07:57:32 +02:00
Werner Lemberg 680c1d408f * src/winfonts/winfnt.c (FNT_Load_Glyph): Fix bitmap width guard. 2013-06-27 17:21:59 +02:00
Werner Lemberg b8850fc1fd [cff] Add darkening limit to `darkening-parameters'.
* src/cff/cffdrivr.c (cff_property_set): Add check.
2013-06-26 12:22:10 +02:00
Werner Lemberg 89ca1fd6d7 [cff] Add `darkening-parameters' property.
* include/freetype/ftcffdrv.h: Document it.

* src/cff/cffdrivr.c (cff_property_set, cff_property_get): Handle
`darkening-parameters' property.

* src/cff/cf2font.h (CF2_FontRec): Add `darkenParams' array.

* src/cff/cf2font.c (cf2_computeDarkening): Add `darkenParams'
argument and use it.
Update all callers.

* src/cff/cf2ft.c (cf2_decoder_parse_charstrings): Copy
`darken_params' values.

* src/cff/cffobjs.h (CFF_DriverRec): Add `darken_params' array.

* src/cff/cffobjs.c (cff_driver_init): Set default values for
`darken_params'.
2013-06-25 23:28:02 +02:00
Werner Lemberg fad93267a2 [docmaker] Code shuffling.
* src/tools/docmaker/tohtml.py (re_url): Move regexp...
* src/tools/docmaker/sources.py: ... to this file.
2013-06-25 10:41:37 +02:00
Werner Lemberg 8bdc40716a [docmaker] Remove unused functions.
* src/tools/docmaker/content.py (DocMarkup.get_start,
DocBlock.get_markup_name): Removed.
* src/tools/docmaker/tohtml.py (html_quote0, dump_html_code,
HtmlFormatter.make_html_words): Removed.
2013-06-25 10:20:53 +02:00
Werner Lemberg ffb8b473ea * builds/freetype.mk (dll): Remove target.
Problem reported by Jörg Günnewig <joerg.guennewig@googlemail.com>.
2013-06-25 09:09:30 +02:00
Werner Lemberg 979c5c50fb [doc] Fix hyperlinks. 2013-06-25 07:48:38 +02:00
Werner Lemberg c7cc9ebe20 [docmaker] Recognise URLs.
* src/tools/docmaker/tohtml.py (re_url): New regular expression.
(make_html_para): Use it.
2013-06-25 07:24:02 +02:00
Werner Lemberg 3da5182804 Fix comment. 2013-06-23 09:48:20 +02:00
Werner Lemberg fe4f571f99 * Version 2.5.0.1 released.
===========================

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

* include/freetype/config/ftoption.h: Undefine
CFF_CONFIG_OPTION_OLD_ENGINE.
* devel/ftoption.h: Define CFF_CONFIG_OPTION_OLD_ENGINE.
2013-06-19 23:27:47 +02:00
Werner Lemberg 609f0ca04f * builds/unix/install.mk (install): Don't create `cache' directory.
Found by Peter Breitenlohner <peb@mppmu.mpg.de>.
2013-06-19 14:41:47 +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 841e49a7e1 Update CHANGES; tag some auto-hinter properties as still experimental. 2013-06-19 00:25:06 +02:00
Werner Lemberg f56691a852 Fix Savannah bug #39269.
* src/base/ftgloadr.c (FT_GlyphLoader_CheckPoints): Free memory in
case of reacollocation failures.
2013-06-18 10:17:48 +02:00
Andrew Church 67cf7a8841 Fix Savannah bug #39266.
If memory allocations fail at certain points while opening a font,
FreeType can either crash due to a NULL dereference or leak memory.

* include/freetype/internal/ftobjs.c (FT_Face_InternalRec,
FT_LibraryRec): Make `refcount' a signed integer.  If, for example,
FT_Open_Face() fails in a memory allocation before the face's
reference count is set to 1, a subsequent `FT_Done_Library' call
would otherwise loop over `FT_Done_Face' 2^32 times before freeing
the face.

* src/base/ftobjs.c (open_face): Initialize `stream' and friends
earlier.
(FT_Open_Face) <Fail>: Behave correctly if `node' is NULL.
(FT_Destroy_Module) <Fail>: Check that `renderer_clazz' is valid.
2013-06-18 09:35:34 +02:00
Werner Lemberg d7e3444b8a * src/smooth/ftgrays.c One final pragma to silence 64-bit MSVC. 2013-06-14 18:33:39 +02:00
Werner Lemberg 9d043dae27 Minor doc improvement.
Suggested by Ulrich Eckhardt <ulrich.eckhardt@dominolaser.com>.
2013-06-13 10:45:56 +02:00
Dave Arnold cb23a62880 [cff] Add code to Adobe's engine to handle ppem > 2000.
* src/cff/cffgload.c (cff_slot_load): If we get
FT_Err_Glyph_Too_Big, retry unhinted and scale up later on.
2013-06-13 07:46:32 +02:00
Werner Lemberg 294ce11b00 Another try on pragmas.
* include/freetype/internal/ftdebug.h: Move pragmas to...
* include/freetype/internal/internal.h: ... this file since it gets
included by all source files.
* include/freetype/internal/ftserv.h: Remove pragma which has no
effect.
2013-06-12 23:33:11 +02:00
Werner Lemberg 25b6e600c1 * include/freetype/internal/ftdebug.h: Disable MSVC warning C4127.
This partially undoes commit 3f6e0e0c.
2013-06-12 11:06:34 +02:00
Werner Lemberg c06889eb2c More compiler warning fixes.
*/*: Use cast to `FT_Bool' (or `Bool') where appropriate.
2013-06-12 10:58:06 +02:00
Werner Lemberg 2d9caa0606 Minor documentation issues. 2013-06-11 16:24:13 +02:00
Werner Lemberg 5e094c6fb2 [truetype] Improve handling of broken sbit advance widths.
* src/truetype/ttgload.c (TT_Load_Glyph): Use the glyph's (scaled)
`linearHoriAdvance' if the sbit's `horiAdvance' value is zero.

Cf. font `Fixedsys Excelsior' v3.01 (FSEX300.ttf), glyph A, 16ppem.
2013-06-10 14:59:21 +02:00
Werner Lemberg a25ecfddba [sfnt] Improve embedded bitmap tracing.
* src/base/ftobjs.c (FT_Request_Size): Move trace message regarding
bitmap strike match to...
(FT_Match_Size): This function.

* src/sfnt/ttsbit.c (tt_sbit_decoder_load_metrics,
tt_sbit_decoder_load_byte_aligned, tt_sbit_decoder_load_bit_aligned,
tt_sbit_decoder_load_compound, tt_sbit_decoder_load_png,
tt_sbit_decoder_load_image): Decorate with tracing messages.
2013-06-10 12:57:16 +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
Werner Lemberg e2d73df77d Documentation improvements. 2013-06-09 08:48:01 +02:00
Werner Lemberg 2ba871b289 * src/cache/ftcmanag.c (FTC_Manager_Reset): Add missing cache flush.
This code, present since eight(!) years in the unused `CACHE'
branch, has been forgotten to apply to the master branch.  It's
really amazing that noone has ever complained since
`FTC_Manager_Reset' is pretty useless without flushing the cache.
2013-06-09 08:20:54 +02:00
Werner Lemberg 3f6e0e0c6b Add and improve pragmas for MSVC compiler.
* include/freetype/internal/ftdebug.h: Remove pragmas.
* include/freetype/internal/ftserv.h: Use push and pop for pragmas.
* include/freetype/internal/ftvalid.h: Handle warning C4324.
* src/base/ftobjs.c: Use push and pop for pragmas.
* src/gzip/ftgzip.c: Handle warning C4244.
2013-06-07 18:10:40 +02:00
Werner Lemberg 85fd84b828 [cff] s/cf2_getGlyphWidth/cf2_getGlyphOutline/.
* src/cff/cf2font.c, src/cff/cf2font.h, src/cff/cf2ft.c: Do it.
2013-06-07 17:10:21 +02:00
Werner Lemberg 4447b2c84e [cff] Add early exit feature for width-only calls.
This is for `FT_Get_Advance'.

There are 7 places where the spec says the width can be defined:

  hstem/hstemhm
  vstem/vstemhm
  cntrmask/hintmask
  hmoveto
  vmoveto
  rmoveto
  endchar

* src/cff/cf2intrp.c (cf2_doStems): Exit early for width-only calls,
if possible.

(cf2_interpT2CharString) <cf2_cmdHSTEM>, <cf2_cmdVSTEM>,
<cf2_cmdVMOVETO>, <cf2_cmdENDCHAR>, <cf2_cmdHINTMASK>,
<cf2_cmdRMOVETO>, <cf2_cmdHMOVETO>: Exit early for width-only calls.
2013-06-06 21:28:36 +02:00
Werner Lemberg badf317840 Next round of compiler fixes.
* builds/win32/ftdebug.c, builds/wince/ftdebug.c (ft_debug_init):
Add proper cast.

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

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

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

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

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

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

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

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

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

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

* src/type1/t1driver.c (t1_ps_get_font_value): Add casts.
* src/type1/t1parse.c (T1_Get_Private_Dict): Add cast.
2013-06-06 09:16:38 +02:00
Dave Arnold c378249e58 Fix more MSVC Win32 compiler warnings.
* src/base/ftobjs.c: Fix typo in MS pragma.

* src/base/bdflib.c (_bdf_set_default_spacing, _bdf_add_property):
`lineno' is only used in debug mode.

* src/cff/cf2ft.c (cf2_builder_moveTo): `params' is only used in
debug mode.
2013-06-05 19:57:55 +02:00
Werner Lemberg 9ef0bc005c Minor formatting. 2013-06-05 14:53:27 +02:00
Werner Lemberg 45392b77a8 Fix compiler warnings.
* include/freetype/internal/ftmemory.h: Decorate memory allocation
macros with `FT_Long' where appropriate.
Remove duplicate of FT_MEM_QRENEW_ARRAY definition.

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

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

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

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

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

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

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

* src/type1/t1load.c (T1_Get_MM_Var): Ditto.
2013-06-05 13:43:20 +02:00
Werner Lemberg d963498faf * src/cff/cf2font.c (cf2_getGlyphWidth): Initialize `advWidth'.
Problem reported by Ingmar Sittl <ingmar.sittl@elektrobit.com>.
2013-06-04 20:18:57 +02:00
Werner Lemberg 8d8508e4d2 Missed some cppcheck items. 2013-06-04 13:09:01 +02:00
Werner Lemberg dc624ca4dc Apply fixes for cppcheck nitpicks.
http://cppcheck.sourceforge.net/

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

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

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

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

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

* src/tools/ftrandom.c (main): Fix memory leak.
2013-06-04 10:30:48 +02:00
Werner Lemberg eeb8320445 Documentation fix.
Based on suggestions by Gregor Mückl <GregorMueckl@gmx.de>.
2013-06-04 07:14:55 +02:00
Werner Lemberg 2429dc3d7c Add CFF_CONFIG_OPTION_OLD_ENGINE configuration option.
This controls whether the old FreeType CFF engine gets compiled into
FreeType.  It is now disabled by default.

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

* src/cff/cffdrivr.c (cff_property_set), src/cff/cffgload.c
(CFF_Operator, cff_argument_counts, cff_builder_add_point,
cff_operator_seac, cff_decoder_parse_charstrings, cff_slot_load),
src/cff/cffgload.h, src/cff/cffobjs.c (cff_driver_init): Use
CFF_CONFIG_OPTION_OLD_ENGINE to guard the affected code.

* docs/CHANGES: Updated.
2013-06-03 12:41:58 +02:00
Werner Lemberg f9cceeb4e3 Fix PNG library handling.
* builds/unix/configure.raw: Don't use LIBPNG_LIBS but
LIBPNG_LDFLAGS.
2013-06-02 23:38:13 +02:00
Behdad Esfahbod 760d342d37 Add support for color embedded bitmaps (eg. color emoji).
A new load flag, FT_LOAD_COLOR, makes FreeType load color
embedded-bitmaps, following this draft specification

  https://color-emoji.googlecode.com/git/specification/v1.html

which defines two new SFNT tables, `CBDT' and `CBLC' (named and
modeled after `EBDT' and `EBLC', respectively).  The color bitmaps
are stored in the new FT_PIXEL_MODE_BGRA format to represent BGRA
pre-multiplied sRGB images.  If PNG support is available, PNG color
images as defined in the same proposed specification are supported
also.

Note that color bitmaps are converted to grayscale if client didn't
ask for color.

* builds/unix/configure.raw: Search for libpng.
Add `--without-png' option.

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

* include/freetype/freetype.h (FT_LOAD_COLOR): New load flag.

* include/freetype/ftimage.h (FT_Pixel_Mode): Add
`FT_PIXEL_MODE_BGRA'.

* include/freetype/tttags.h (TTAG_CBDT, TTAG_CBLC): New tags.

* src/base/ftbitmap.c (FT_Bitmap_Embolden): Updated.
(ft_gray_for_premultiplied_srgb_bgra): New function.
(FT_Bitmap_Convert): Handle FT_PIXEL_MODE_BGRA.

* src/sfnt/pngshim.c, src/sfnt/pngshim.h: New files.

* src/sfnt/sfnt.c: Include `pngshim.c'.

* src/sfnt/ttsbit.c: Include FT_BITMAP_H and `pngshim.h'
(tt_face_load_eblc): Load `CBLC'.
(tt_sbit_decoder_init): Load `CBDT'.
(tt_sbit_decoder_alloc_bitmap): Pass load flags to select between
color and grayscale bitmaps.
Set `num_grays'.  This is used by `ftview' to choose the blending
algorithm.
(tt_sbit_decoder_load_byte_aligned,
tt_sbit_decoder_load_bit_aligned, tt_sbit_decoder_load_compound,
tt_sbit_decoder_load_image): Pass load flag.
s/write/pwrite/.
Don't call `tt_sbit_decoder_alloc_bitmap'.
Updated.
(tt_sbit_decoder_load_png) [FT_CONFIG_OPTION_USE_PNG]: New function.
(tt_sbit_decoder_load_bitmap): Pass load flag.
Handle new glyph formats 17, 18, and 19.
Call `tt_sbit_decoder_alloc_bitmap'.
Flatten color bitmaps if necessary.
(tt_face_load_sbit_image): Updated.

* src/sfnt/rules.mk (SFNT_DRV_SRC): Add `pngshim.c'.

* docs/CHANGES: Updated.
2013-05-29 11:36:18 +02:00
Werner Lemberg 713ea8e87c Minor doc improvements. 2013-05-28 22:37:10 +02:00
Guenter 41e4480e43 Apply Savannah patch #8055.
Make `apinames' create an import file for NetWare.

* src/tools/apinames.c (PROGRAM_VERSION): Set to 0.2.
(OutputFormat): Add `OUTPUT_NETWARE_IMP'.
(names_dump): Handle it.
(usage): Updated.
(main): Handle new command line flag `-wN'.
2013-05-24 11:38:09 +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 fd66469eba Update more FT_Err_XXX macros using FT_ERR and FT_THROW;
* builds/amiga/src/base/ftsystem.c, builds/mac/ftmac.c,
builds/unix/ftsystem.c, builds/vms/ftsystem.c: Do it.
2013-05-17 17:40:27 +02:00
Werner Lemberg 2799133a6e Fix ChangeLog entry. 2013-05-17 14:00:26 +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 6650be7c43 [truetype] Avoid empty source file.
* src/truetype/ttsubpix.c [!TT_CONFIG_OPTION_SUBPIXEL_HINTING]:
Provide dummy typedef.
2013-05-13 10:05:29 +02:00
Werner Lemberg 7441dd874d * src/cff/cf2font.c (cf2_getGlyphWidth): Fix uninitialized variable.
Fix suggested by Vaibhav Nagarnaik <vnagarnaik@gmail.com>.
2013-05-13 09:12:46 +02:00
Brian Nixon 8d6025c8da Fix Savannah bug #38970.
* src/base/ftdebug.c, builds/win32/ftdebug.c,
builds/wince/ftdebug.c, builds/amiga/src/base/ftdebug.c
(ft_debug_init): Don't read past the environment variable FT2_DEBUG.
2013-05-13 09:06:42 +02:00
Werner Lemberg cd888753c8 [truetype] Add framework for TrueType properties.
* src/truetype/ttdrivr.c: Include FT_SERVICE_PROPERTIES_H.
(tt_property_set, tt_property_get): New functions, still empty.
Define `tt_service_properties' service.
Update `tt_services'.

* src/truetype/ttpic.h: Include FT_SERVICE_PROPERTIES_H.
(TT_SERVICE_PROPERTIES_GET): New macro.
(TTModulePIC): Add `tt_service_properties'.
2013-05-12 15:08:57 +02:00
Werner Lemberg b112fa4190 Fix Savannah bug #38967.
* src/base/ftcalc.c (FT_DivFix) [FT_LONG64]: Fix cast.
2013-05-12 07:29:04 +02:00
Werner Lemberg cbcf33d1d9 Introduce unsigned 64bit type (if available).
* include/freetype/config/ftconfig.h: Define FT_UINT64 if available.
[FT_LONG64]: Provide FT_UInt64.

* builds/unix/ftconfig.in: Synchronized.
2013-05-12 07:27:48 +02:00
Werner Lemberg d51ac9c7c6 Fix Savannah bug #38968.
* include/freetype/ftmodapi.h: Add `FT_EXPORT' to
FT_Property_{Set,Get}.
* src/base/ftobjs.c: Add `FT_EXPORT_DEF' to
FT_Property_{Set,Get}.
2013-05-12 06:00:27 +02:00
Werner Lemberg ea2b4756e4 [sfnt] Clean up bitmap code.
* src/sfnt/ttsbit.c: Deleted.
* src/sfnt/ttsbit0.c: Renamed to `ttsbit.c'.
* rules.mk (SFNT_DRV_H): Updated.
2013-05-10 08:04:33 +02:00
Werner Lemberg f6aa089f12 */* [FT_CONFIG_OPTION_OLD_INTERNALS]: Remove macro and guarded code. 2013-05-10 07:58:47 +02:00
Werner Lemberg cecf93ef90 * Version 2.4.12 released.
==========================

Tag sources with `VER-2-4-12'.

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

* 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.11/2.4.12/, s/2411/2412/.

* include/freetype/freetype.h (FREETYPE_PATCH): Set to 12.

* builds/unix/configure.raw (version_info): Set to 16:1:10.
2013-05-08 11:39:16 +02:00
Werner Lemberg 2688a6c65e * docs/CHANGES: Updated. 2013-05-08 10:00:49 +02:00
Werner Lemberg ccbdc3c421 * src/autofit/aflatin.c (af_latin_metrics_scale_dim): Typo. 2013-05-08 09:17:56 +02:00
Werner Lemberg 2656861118 Synchronize `ftconfig.h'.
* builds/unix/ftconfig.in: Updated.
2013-05-05 17:50:22 +02:00
Werner Lemberg dd192ef0b4 Fix compilation with C++.
* src/base/md5.c (body): Use proper cast.
2013-05-05 16:13:01 +02:00
Werner Lemberg d135e27c23 Fix 64bit compilation issues.
* include/freetype/config/ftconfig.h [FT_LONG64]: Typedef
`FT_Int64' here.

* src/base/ftcalc.c: Remove typedef of `FT_Int64'.
(FT_DivFix): Fix cast.
* src/base/fttrigon.c: Remove typedef of `FT_Int64'.
2013-05-05 10:44:21 +02:00
Werner Lemberg 073a0e2901 [raster] Fix clang issues.
Fix suggested by <octoploid@yandex.com>.

* src/raster/ftraster.c (ULong): New typedef.
(SCALED): Add proper cast.
2013-05-05 10:41:20 +02:00
Werner Lemberg e6e8362728 Fix clang fixes.
* src/base/fttrigon.c (ft_trig_prenorm, FT_Vector_Rotate): Use
correct types.

* src/cff/cf2intrp.c (cf2_interpT2CharString) <default>: Force
unsigned for computations.
* src/cff/cffgload.c (cff_decoder_parse_charstrings): Ditto.
* src/cff/cffparse.c (cff_parse_integer): Ditto.

* src/psaux/t1decode.c (t1_decoder_parse_charstrings): Ditto.
2013-05-04 18:57:56 +02:00
Werner Lemberg 77c39b1deb [cff] Make Adobe CFF engine work correctly on 64bit hosts.
Reported by numerous people on the `freetype-devel' list.  Without
this fix, glyphs aren't properly aligned on a common baseline.

On 64bit systems, `FT_Pos' expands to `long int', having a width of
64bit.  `CF2_Fixed' expands to `int' which is normally 32bit wide on
64bit hosts also.  Wrong casts filled up the blues arrays with
incorrect values.  Note that all blues values are accessed with the
`cf2_blueToFixed' macro which handles the 64bit to 32bit conversion.

* src/cff/cf2ft.h (cf2_getBlueValues, cf2_getOtherBlues,
cf2_getFamilyBlues, cf2_getFamilyOtherBlues): Use `FT_Pos' for
`data', not `CF2_Fixed'.
* src/cff/cf2ft.c (cf2_getBlueValues, cf2_getOtherBlues,
cf2_getFamilyBlues, cf2_getFamilyOtherBlues): Updated.
* src/cff/cf2blues.c (cf2_blues_init): Updated.
2013-05-04 18:04: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 138068fd07 Formatting. 2013-05-04 15:26:24 +02:00
Werner Lemberg afaeeee9a0 Fix errors reported by clang's `sanitize' feature.
* include/freetype/internal/ftstream.h: Simplify and fix integer
extraction macros.
(FT_INT8_, FT_BYTE_I16, FT_BYTE_I32, FT_INT8_I16, FT_INT8_I32,
FT_INT8_I32, FT_INT8_U32): Removed.
(FT_PEEK_SHORT, FT_PEEK_LONG, FT_PEEK_OFF3, FT_PEEK_SHORT_LE,
FT_PEEK_LONG_LE, FT_PEEK_OFF3_LE): Use unsigned values for
computations and convert to signed as the last step.

* src/cff/cf2fixed.h (cf2_intToFixed, cf2_fixedToInt,
cf2_fracToFixed): Avoid shifts of negative values.
(cf2_intToFrac, cf2_fixedToFrac, cf2_fixedTo26Dot6): Removed,
unused.

* src/cff/cf2intrp.c (cf2_interpT2CharString) <cf2_cmdEXTENDEDNMBR,
default>: Use unsigned values for computations and convert to signed
as the last step.
Use proper types in tracing messages.

* src/cff/cffgload.c (cff_decoder_parse_charstrings): Use unsigned
values for computation of operands and convert to signed as the last
step.
Use proper type in tracing message.
2013-05-04 14:05:24 +02:00
Werner Lemberg 99033fefb6 * src/cff/cf2blues.c: Remove dead code. 2013-05-03 17:39:24 +02:00
Werner Lemberg b3c3f86e58 Minor. 2013-05-03 08:51:17 +02:00
Chris Liddell 9bf75e0819 * src/cff/cffgload.c: Include FT_CFF_DRIVER_H. 2013-05-02 11:09:15 +02:00
Werner Lemberg 2048f02e15 Minor. 2013-04-29 23:04:57 +02:00
Werner Lemberg 29f1a92710 README: Improved. 2013-04-27 09:46:10 +02:00
Werner Lemberg 689d68e5b3 docs/CHANGES: Add ftdemo changes. 2013-04-27 08:09:35 +02:00
Werner Lemberg 234b987ef6 * docs/CHANGES: Updated. 2013-04-26 14:10:12 +02:00
Werner Lemberg 06474c3e5b [cff] Add a new Type 2 interpreter and hinter.
This work, written by Dave Arnold <darnold@adobe.com> and fully
integrated into FreeType by me, is a donation by Adobe in
collaboration with Google.  It is vastly superior to the old CFF
engine, and it will replace it soon.  Right now, it is still off by
default, and you have to explicitly select it using the new
`hinting-engine' property of the cff driver.

For convenience, (most of) the new files are committed separately.

* include/freetype/config/ftheader.h (FT_CFF_DRIVER_H): New macro.
* include/freetype/ftcffdrv.h: New file to access CFF driver
properties.
* include/freetype/fterrdef.h (FT_Err_Glyph_Too_Big): New error
code.
* include/freetype/internal/fttrace.h: Add `cf2blues', `cf2hints',
and `cf2interp'.

* src/cff/cffgload.h (CFF_SubFont): New member `current_subfont'.
* src/cff/cffobjs.h (CFF_DriverRec): New members `hinting_engine'
and `no_stem_darkening'.
* src/cff/cfftypes.h (CFF_FontRec): New member `cf2_instance'.

* src/cff/cff.c: Include new files.
* src/cff/cffdrivr.c (cff_property_set, cff_property_get): Handle
`hinting-engine' and `no-stem-darkening' properties (only the Adobe
engine listens to them).
* src/cff/cffgload.c: Include `cf2ft.h'.
(cff_decoder_prepare): Initialize `current_subfont'.
(cff_build_add_point): Handle Adobe engine which uses 16.16
coordinates.
(cff_slot_load): Handle FT_LOAD_NO_SCALE and FT_LOAD_NO_HINTING
separately.
Choose rendering engine based on `hinting_engine' property.
* src/cff/cffload.c (cff_font_done): Call finalizer of the Adobe
engine.
* src/cff/cffobjs.c: Include FT_CFF_DRIVER_H.
(cff_driver_init): Set default property values.

* src/cff/rules.mk (CFF_DRV_SRC, CFF_DRV_H): Add new files.

* src/cff/cf2*.*: New files, containing the Adobe engine.
2013-04-13 18:53:28 +02:00
Werner Lemberg 283c8ed817 [cff] New files for Adobe's Type 2 interpreter and hinting engine. 2013-04-13 15:02:31 +02:00
Werner Lemberg 831dac8814 [cff] Minor code administration issues.
* src/cff/cffgload.c (check_points): Rename to...
(cff_check_points): ...this and make it FT_LOCAL.
(cff_builder_add_point, cff_builder_add_point1,
cff_builder_start_point, cff_builder_close_contour,
cff_lookup_glyph_by_stdcharcode, cff_get_glyph_data,
cff_free_glyph_data): Make them FT_LOCAL.

* src/cff/cffgload.h: Updated.
2013-04-12 21:13:49 +02:00
Werner Lemberg 2dc2662125 Add output bitmap checksums.
Use `FT2_DEBUG=bitmap:3' for tracing.

* src/base/md5.c, src/base/md5.h: New files, taken from

  http://openwall.info/wiki/people/solar/software/public-domain-source-code/md5

* include/freetype/internal/fttrace.h: Add `bitmap'.

* src/base/ftobjs.c [FT_DEBUG_LEVEL_TRACE]: Include `md5.c'

(FT_Render_Glyph_Internal) [FT_DEBUG_LEVEL_TRACE]: For tracing,
convert resulting bitmap to a uniform format and compute a checksum.
Use `bitmap' category for the tracing message.

* src/base/rules.mk (BASE_H): Updated.

* docs/LICENSE.TXT: Updated.
2013-04-12 20:11:38 +02:00
Werner Lemberg fc185ef41a Add framework for CFF properties.
* include/freetype/internal/ftserv.h (FT_DEFINE_SERVICEDESCREC7):
New macro.

* src/cff/cffdrivr.c: Include FT_SERVICE_PROPERTIES_H.
(cff_property_set, cff_property_get): New function, still empty.
Define `cff_service_properties' service.
Update `cff_services'.

* src/cff/cffpic.h: Include FT_SERVICE_PROPERTIES_H.
(CFF_SERVICE_PROPERTIES_GET): New macro.
CffModulePIC: Add `cff_service_properties'.
2013-04-12 19:48:06 +02:00
Werner Lemberg 04e547bd2c Fix Savannah bug #38589.
* src/bdf/bdflib.c (_bdf_readstream): Thinko.
2013-04-03 07:37:56 +02:00
Werner Lemberg 2f7ccb2399 * configure: Use egrep, not grep.
Problem reported Mojca Miklavec <mojca.miklavec.lists@gmail.com>.
2013-03-31 09:04:38 +02:00
Werner Lemberg 94720c2c56 Typo. 2013-03-29 19:37:49 +01:00
Werner Lemberg a705927c6f * include/freetype/ftlcdfil.h: Add description of color filtering.
Based on a contribution from Antti S. Lankila <alankila@bel.fi>.
2013-03-29 19:35:39 +01:00
Werner Lemberg 762bf19ab7 Typo. 2013-03-24 08:37:12 +01:00
Werner Lemberg eed830614f Whitespace. 2013-03-23 14:25:43 +01:00
Werner Lemberg fbb0773cb1 [autofit] Minor.
* src/autofit/afmodule.c (af_property_set): Typo.
(af_autofitter_init, af_autofitter_done): Use cast.
2013-03-23 14:06:54 +01:00
Werner Lemberg eb624d7c17 * configure: Automatically test for `gmake' also.
Suggested by Mojca Miklavec <mojca.miklavec.lists@gmail.com>.
2013-03-21 22:58:28 +01:00
Peter Breitenlohner 63463b93bc Respect CONFIG_SHELL from the environment.
Some large packages using FreeType have to use a broken (deficient)
/bin/sh.  The configure scripts (as generated by Autoconf) are
clever enough to find a better shell and put that one into the
environment variable CONFIG_SHELL.  If that environment variable is
already set the script skips the test and assumes to be already
running under a good shell.

* builds/unix/detect.mk: Honour CONFIG_SHELL.
* builds/unix/unix-def.in (SHELL): Define.
2013-03-21 19:58:40 +01:00
Werner Lemberg 835b9cd586 Minor. 2013-03-21 09:07:44 +01:00
Werner Lemberg 6f1e345d35 Fix Savannah patch #7971.
* configure: Handle MAKE environment variable also.
2013-03-21 09:00:27 +01:00
Werner Lemberg b114b7c01b Fix Savannah bug #38538.
* builds/amiga/src/base/ftdebug.c, builds/win32/ftdebug.c,
builds/wince/ftdebug.c (FT_Throw): Add function.
2013-03-17 22:42:07 +01:00
Werner Lemberg 5ea06ce017 Whitespace. 2013-03-17 08:14:46 +01:00
Werner Lemberg 706fc83370 Remove dead code.
* src/raster/rastpic.c (ft_raster1_renderer_class_pic_init)
src/smooth/ftspic.c (ft_smooth_renderer_class_pic_init): Do it.
2013-03-17 08:09:17 +01:00
Werner Lemberg 8b4459b858 * src/pshinter/pshpic.h (GET_PIC): Use correct container. 2013-03-17 07:44:35 +01:00
Werner Lemberg f619abf6b0 * include/freetype/ftmoderr.h: Fix commit from 2013-03-11.
The previous version was not backwards compatible.  Reported by
Behdad.
2013-03-15 08:16:25 +01: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 52339dc274 New error management macros.
* include/freetype/fterrors.h (FT_ERR_XCAT, FT_ERR_CAT): Move to...
* include/freetype/fttypes.h: ... this file.
(FT_ERR, FT_ERR_EQ, FT_ERR_NEQ, FT_MODERR_EQ, FT_MODERR_NEQ): New
macros.

* include/freetype/freetype.h: Updated.
2013-03-14 15:49: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 c58ce3beee Introduce `FT_THROW' macro.
The idea is to replace code like

  return FT_Err_Foo_Bar;

or

  return CFF_Err_Foo_Bar;

with

  return FT_THROW( Foo_Bar );

The FT_THROW macro has two functions:

  . It hides the module specific prefix.

  . In debug mode, it calls the empty function `FT_Throw' which can
    be thus used to set a breakpoint.

* include/freetype/internal/ftdebug.h (FT_THROW): New macro.
(FT_Throw): New prototype.
* src/base/ftdebug.c (FT_Throw): New function.
2013-03-13 11:06:39 +01:00
Werner Lemberg dbc6e3f192 Remove `FT_KEEP_ERR_PREFIX'.
The idea is to always have FT_ERR_PREFIX available internally.

* include/freetype/fterrors.h: Use FT2_BUILD_LIBRARY to guard
undefinition of FT_ERR_PREFIX

* src/gxvalid/gxverror.h, src/otvalid/otverror.h,
src/sfnt/sferrors.h: Updated.
2013-03-12 11:42:20 +01:00
Werner Lemberg c879f24562 [gxvalid] Fix module error.
* src/gxvalid/gxverror.h (FT_ERR_BASE): Define as
FT_Mod_Err_GXvalid.
* include/freetype/ftmoderr.h: Add module error for `GXvalid'.
2013-03-11 10:11:57 +01:00
Werner Lemberg d6bc524bdc Always use module related error codes.
* src/cff/cffobjs.c (cff_face_init), src/type1/t1objs.c
(T1_Face_Init), src/type42/t42objs.c (T42_Face_Init): Use
`FT_ERROR_BASE'.

* src/type1/t1load.c (parse_encoding): Use
T1_Err_Unknown_File_Format.
2013-03-11 09:50:53 +01:00
Werner Lemberg 737bbb0457 Minor. 2013-03-08 21:25:45 +01:00
Werner Lemberg 2d88254046 [cff] Set `linear{Hori,Vert}Advance' for embedded bitmaps also.
* src/cff/cffgload.c (cff_slot_load): Implement it.
2013-03-08 21:23:45 +01:00
Alexei Podtelezhnikov 2ba18ba1ce [base] Fix commit ab02d9e8.
* src/base/ftbbox.c (BBox_Cubic_Check): Change scaling to msb of 22.
2013-02-22 23:58:57 -05:00
Alexei Podtelezhnikov f9434dba81 [base] New bisecting BBox_Cubic_Check (disabled).
* src/base/ftbbox.c (BBox_Cubic_Check): New bisecting algorithm
for extremum search built around simple condition that defines
which half contains the extremum.
2013-02-19 21:27:18 -05:00
Alexei Podtelezhnikov 0e536676ba [tools] Update BBox testing tool.
* src/tools/test_bbox.c: Add another cubic outline with exact BBox.
(REPEAT): Increase the number of benchmarking cycles.
(profile_outline): Tweak output formatting.
2013-02-18 20:41:56 -05:00
Werner Lemberg bcca86af30 Fix Savannah bug #38235.
* builds/unix/configure.raw: Don't generate `freetype-config' and
`freetype.pc'.

* builds/unix/unix-def.in (FT2_EXTRA_LIBS, LIBBZ2, LIBZ,
build_libtool_libs, ft_version): New variables to be substituted.
(freetype-config, freetype.pc): New rules to generate those files.

* builds/unix/freetype-config.in: Remove code for handling `rpath'.
The use of $rpath has been accidentally removed in a patch from
2009-12-22, and apparently noone has missed it since.
Use `%' instead of `@' as a variable substitution marker.
Use quotes.

* builds/unix/freetype.in: Use `%' instead of `@' as a variable
substitution marker.
Use quotes.
2013-02-08 12:49:41 +01:00
Werner Lemberg a2c7eb1888 * src/truetype/ttobjs.c (tt_size_run_prep): Reset more GS variables.
BTW, Greg agrees that the OpenType specification is missing the list
of GS variables which will always be reset to the default values
after the `prep' table has been executed.
2013-02-07 19:49:12 +01:00
Werner Lemberg bfcc375b06 * src/truetype/ttobjs.c (tt_size_run_prep): Reset reference points.
Up to now, we simply took a snapshot of the Graphics State after the
`prep' table has been executed, and right before a glyph's bytecode
was run it got reloaded.  However, as Greg Hitchcock has told us in
private communication, reference points get reset to zero in the MS
rasterizer and we follow in due course.  While reasonable, this is
undocumented behaviour.

Most notably, this fixes the rendering of Arial's `x' glyph in
subpixel hinting mode.
2013-02-06 08:47:29 +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
Alexei Podtelezhnikov 0eb6316fde [pcf] Streamline parsing of PCF encoding table.
* src/pcf/pcfread.c (pcf_get_encodings): Use simpler double for-loop.
Reallocate array instead of using temporary storage.
2013-02-01 20:24:00 -05:00
Werner Lemberg 3b1f206b04 Fix Savannah bug #38227.
* builds/unix/freetype-config.in: Set LC_ALL.
2013-02-01 23:45:04 +01:00
Werner Lemberg 30f1e6ca45 Fix Savannah bug #38221.
This complements commit 83c0ebab.

* src/base/ftcalc.c (FT_MulDiv_No_Round): Don't enclose with
`TT_USE_BYTECODE_INTERPRETER'.
2013-02-01 14:50:08 +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
Alexei Podtelezhnikov fba917d0e7 Improve comments. 2013-01-30 20:14:18 -05:00
Alexei Podtelezhnikov d56e544d65 Add an important comment.
Thanks to Hin-Tak Leung for the analysis.
2013-01-28 22:29:51 -05:00
Werner Lemberg 6b9034f0fd Formatting, comment improvements. 2013-01-28 13:56:23 +01:00
Alexei Podtelezhnikov ab02d9e8e7 [base] Small optimization of BBox calculation.
* src/base/ftbbox.c (BBox_Cubic_Check): Use FT_MSB function in
scaling algorithm.
2013-01-28 06:35:19 -05:00
Infinality c574d72ca8 [truetype] Minor formatting fix. 2013-01-26 17:40:44 -06:00
Infinality 97ba5109bd [truetype] Fix rasterizer_version logic in sph. 2013-01-26 17:05:40 -06:00
Infinality a5fe359596 [truetype] Align more to ClearType whitepaper for sph. 2013-01-26 12:29:52 -06:00
Alexei Podtelezhnikov 610ee58e07 [base] Fix broken emboldening at small sizes.
* src/base/ftoutln.c (FT_Outline_EmboldenXY): Do not attempt to
normalize zero-length vectors.
2013-01-25 23:33:00 -05:00
Werner Lemberg f41ee05475 Fix Savannah bug #38167.
This fixes commit 83c0ebab from 2012-06-27.

* src/truetype/ttinterp.h:
s/TT_CONFIG_OPTION_BYTECODE_INTERPRETER/TT_USE_BYTECODE_INTERPRETER/.
2013-01-25 16:41:24 +01:00
Xi Wang ba931be2af [sfnt] Fix broken pointer overflow checks.
Many compilers such as gcc and clang optimize away pointer overflow
checks `p + n < p', because pointer overflow is undefined behavior.
Use a safe form `n > p_limit - p' instead.

Also avoid possible integer overflow issues, for example, using
`num_glyphs > ( p_limit - p ) / 2' rather than `num_glyphs * 2'
given a large `num_glyphs'.

* src/sfnt/ttsbit0.c (tt_sbit_decoder_load_image): Implement it.
2013-01-25 00:57:09 +01:00
Werner Lemberg 817caa9f4f Fix `make multi'
* src/base/ftoutln.c, src/base/fttrigon.c: Include
FT_INTERNAL_CALC_H.
2013-01-25 00:40:56 +01:00
David 'Digit' Turner 72447195ce [truetype] Fix C++ compilation.
* src/truetype/ttsubpix.h: Updated.
(SPH_X_SCALING_RULES_SIZE): Moved and renamed to...
* src/truetype/ttsubpix.c (X_SCALING_RULES_SIZE): This.
(sph_X_SCALING_Rules): Removed.
(scale_test_tweak): Make function static.
(sph_test_tweak_x_scaling): New function.

* src/truetype/ttgload.c (TT_Process_Simple_Glyph): Updated.
2013-01-25 00:36:35 +01:00
Werner Lemberg 4cd5fd463e Remove trailing whitespace. 2013-01-24 13:33:06 +01:00
Werner Lemberg e9f330adf6 [base] Make `FT_Hypot' really internal.
* include/freetype/fttrigon.h (FT_Hypot): Move to...
* include/freetype/internal/ftcalc.h: This file.

* src/base/fttrigon.c (FT_Hypot): Move to...
* src/base/ftcalc.c: This file.
Include FT_TRIGONOMETRY_H.

* src/truetype/ttgload.c: Don't include FT_TRIGONOMETRY_H.
2013-01-24 09:12:56 +01:00
Werner Lemberg a56f95b268 Minor. 2013-01-24 08:45:29 +01:00
Werner Lemberg 87dc86d68c [truetype] Revert change from 2013-01-22.
FreeType's `height' value is the baseline-to-baseline distance...

* src/truetype/ttobjs.c (tt_size_reset): Undo.
2013-01-24 08:39:43 +01: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 dcc0d070e0 Typo. 2013-01-23 23:09:59 -05:00
Alexei Podtelezhnikov da11e5e764 [base] Fix integer overflow.
* src/base/ftoutln.c (FT_Outline_EmboldenXY): Normalize incoming and
outgoing vectors and use fixed point arithmetic.
2013-01-23 20:11:40 -05:00
Alexei Podtelezhnikov e1a2ac1900 [base] Fix integer overflow.
* src/base/ftoutln.c (FT_Outline_Get_Orientation): Scale the
coordinates down to avoid overflow.
2013-01-23 19:51:28 -05:00
Alexei Podtelezhnikov 869fb8c49d [base] Split out MSB function.
* src/base/fttrigon.c (ft_trig_prenorm): Borrow from here.
* include/freetype/internal/ftcalc.h (FT_MSB): Declare here.
* src/base/ftcalc.c (FT_MSB): Define here.
2013-01-23 19:43:28 -05:00
Werner Lemberg e0469372be [truetype] Fix font height.
* src/truetype/ttobjs.c (tt_size_reset): The Windows rendering
engine uses rounded values of the ascender and descender to compute
the TrueType font height.
2013-01-22 11:07:07 +01:00
Werner Lemberg 7190098098 Minor. 2013-01-16 20:08:35 +01:00
Werner Lemberg cd3f871e8d [sfnt] Fix optimized sbit loader.
It was not taking bit_depth into consideration when blitting!

* src/sfnt/ttsbit0.c (tt_sbit_decoder_load_byte_aligned,
* tt_sbit_decoder_load_bit_aligned): Handle bit
depth.
2013-01-16 19:56:08 +01:00
David Turner 3a40612723 [truetype] Improve sub-pixel code.
This patches fixes many issues with the ttsubpix implementation.

1. Data tables are defined, instead of declared, in the header, and
   thus copied into each source file that includes it.

2. These tables were defined as global, mutable, visible variables,
   and thus costing private RAM to every process that loads the
   library (> 50 KB / process, this is huge!).

   Additionally, this also made the library export the symbols
   completely needlessly.

3. Missing `sph_' and `SPH_' prefixes to some of the definitions.

Note that this doesn't try to fix the incredibly inefficient storage
format for the data tables used by the code.  This one will require
another pass in the future.

* src/truetype/ttinterp.h (MAX_NAME_SIZE, MAX_CLASS_MEMBERS):
Renamed to...
(SPH_MAX_NAME_SIZE, SPH_MAX_CLASS_MEMBERS): This.
Update all users.

(SPH_TweakRule, SPH_ScaleRule): Decorate with `const' where
appropriate.

(Font_Class): Rename to...
(SPH_Font_Class): This.  Decorate with `const' where appropriate.

* src/truetype/ttsubpix.h (scale_test_tweak, sph_test_tweak):
Decorate arguments with `const' where appropriate.

Move font tweaking tables to...

* src/truetype/ttsubpic.c: This file and decorate them with `static'
and `const' where appropriate.

(X_SCALING_Rules, X_SCALING_RULES_SIZE): Renamed to...
(spu_X_SCALING_Rules, SPH_X_SCALING_RULES_SIZE): This.
Update all users.
2013-01-16 19:48:31 +01: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
Alexei Podtelezhnikov a692170a23 Call it fixed-point. 2013-01-12 19:17:05 -05:00
Werner Lemberg e4ecce3bfe Disable FT_CONFIG_OPTION_OLD_INTERNALS.
After the next release we are going to remove the code completely.

* devel/ftoption.h, include/freetype/config/ftoption.h
(FT_CONFIG_OPTION_OLD_INTERNALS): Comment out.
* docs/CHANGES: Document it.
2013-01-11 09:02:22 +01:00
Werner Lemberg 53c0cb59ed Typos, whitespace. 2013-01-11 08:29:22 +01:00
Alexei Podtelezhnikov ad9d5c9726 [base] Update the overflow protection bit.
The recent optimizations of CORDIC iterations drastically reduce
the expansion factor. The vector components with MSB of 29 are now
safe from overflow.

* src/base/fttrigon.c (FT_TRIG_SAFE_MSB): New macro.
(ft_trig_prenorm): Use it and remove dead code.
2013-01-10 22:29:07 -05:00
Werner Lemberg 4412e74de7 Minor comment improvements. 2013-01-10 20:16:20 +01:00
Alexei Podtelezhnikov 6b83a3674c [base, pshinter] Use FT_ABS, FT_MIN, and FT_MAX for readability.
* src/base/ftbbox.c: Updated.
* src/base/ftobjs.c: Updated.
* src/base/fttrigon.c: Updated.
* src/pshinter/pshalgo.c: Updated.
* src/pshinter/pshrec.c: Updated.
2013-01-09 00:25:32 -05:00
Alexei Podtelezhnikov 09dbb059e1 [base] Clean up trigonometric core.
* src/base/fttrigon.c: Document the algorithm in a large comment.
(FT_TRIG_COSCALE): Remove macro.
(FT_Tan: Use `FT_TRIG_SCALE' instead.
(FT_Cos, FT_Vector_Unit): Ditto and round the return values.
2013-01-08 23:29:44 -05:00
Alexei Podtelezhnikov 5dd9657fe8 [base] Use rounding in CORDIC iterations.
* src/base/fttrigon.c (ft_trig_pseudo_rotate,
ft_trig_pseudo_polarize): Improve accuracy by rounding.
2013-01-02 23:45:14 -05:00
Alexei Podtelezhnikov b4ac30b0ed [base] Reduce trigonometric algorithms.
After we get within 45 degrees by means of true 90-degree rotations,
we can remove initial 45-degree CORDIC iteration and start from
atan(1/2) pseudorotation, reducing expansion factor thereby.

* src/base/fttrigon.c (FT_TRIG_SCALE, FT_TRIG_COSCALE): Update macros.
(ft_trig_pseudo_rotate, ft_trig_pseudo_polarize): Update.

* src/tools/cordic.py: Bring up to date with trigonometric core.

* docs/CHANGES: Old typo.
2013-01-02 22:21:37 -05:00
Alexei Podtelezhnikov 50e634abe1 * src/pshinter/pshalgo.h: Remove unused code. 2013-01-02 20:31:56 -05:00
Werner Lemberg 7d6dc907d8 * src/truetype/ttgload.c (tt_loader_init): Add more tracing. 2012-12-27 01:08:24 +01:00
Werner Lemberg 2ef0a19842 [type1] Fix handling of /FontBBox in MM fonts.
Problem reported by Del Merritt <del@alum.mit.edu>

If we have

  /FontBBox { { 11 12 13 14 15 16 17 18 }
              { 21 22 23 24 25 26 27 28 }
              { 31 32 33 34 35 36 37 38 }
              { 41 42 43 44 45 46 47 48 } }

in the /Blend dictionary,  then the first BBox is { 11 21 31 41 },
the second { 12 22 32 42 }, etc.

* include/freetype/internal/psaux.h (T1_FieldType): Add
`T1_FIELD_TYPE_MM_BBOX' (for temporary use).

* src/psaux/psobjs.c (ps_parser_load_field) <T1_FIELD_TYPE_MM_BBOX>:
Implement it.
2012-12-23 21:14:37 +01:00
Werner Lemberg f44f3f0e43 Formatting, minor internal documentation improvement. 2012-12-23 18:30:34 +01:00
Alexei Podtelezhnikov cbf3fb39fd * src/tools/cordic.py: Bring up to date with trigonometric core. 2012-12-21 14:20:25 -05:00
Werner Lemberg 3ffb822e92 Check parameters of `FT_Outline_New'.
Problem reported by Robin Watts <robin.watts@artifex.com>.

* src/base/ftoutln.c (FT_Outline_New_Internal): Ensure that
`numContours' and `numPoints' fit into FT_Outline's `n_points' and
`n_contours', respectively.
2012-12-21 16:45:27 +01:00
Werner Lemberg c6a66b49e6 * Version 2.4.11 released.
==========================

Tag sources with `VER-2-4-11'.

* docs/CHANGES, docs/release: Updated.

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

* 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.10/2.4.11/, s/2410/2411/.

* include/freetype/freetype.h (FREETYPE_PATCH): Set to 10.

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

* builds/toplevel.mk (dist): Don't include `.mailmap'.
2012-12-20 08:31:56 +01:00
Alexei Podtelezhnikov d7383b7b86 [base] Improve trigonometric core.
FreeType used to rely on a 24-step iteration CORDIC algorithm to
calculate trigonometric functions and rotate vectors. It turns out
that once the vector is in the right half-plane, the initial rotation
by 63 degrees is not necessary. The algorithm is perfectly capable
to converge to any angle starting from the second 45 degree rotation.
This patch removes the first rotation and makes it a 23-step CORDIC
algorithm.

* src/base/fttrigon.c (FT_TRIG_SCALE, FT_TRIG_COSCALE): Update macro
values.
(ft_trig_pseudo_rotate, ft_trig_pseudo_polarize): Remove initial
rotation.
2012-12-20 01:03:22 -05:00
Werner Lemberg 768590a99d * src/base/ftobjs.c (ft_property_do): Fix compiler warning. 2012-12-20 06:08:23 +01:00
Werner Lemberg df018924d9 Formatting. 2012-12-20 06:07:33 +01:00
Alexei Podtelezhnikov 32fc416f57 * src/base/ftrfork.c (FT_Raccess_Guess): Switch to FT_Int counters. 2012-12-19 23:05:32 -05:00
Alexei Podtelezhnikov 06174dbb20 [base] Clean up trigonometric core.
* src/base/fttrrigon.c (ft_trig_pseudo_polarize): Align algorithm
with `ft_trig_pseudo_rotate'.
2012-12-19 22:46:27 -05:00
Infinality 1749ae20a7 [truetype] Minor performance enhancement. 2012-12-18 07:23:09 -06:00
Infinality 94b79e7453 [truetype] Remove unusued code and variables. 2012-12-17 19:17:30 -06:00
Werner Lemberg a9f6f85e77 Various compiler warning fixes.
* include/freetype/internal/ftserv.h (FT_SERVICE_UNAVAILABLE): Use
`logical not' operator instead of negation.  The idea is that `~'
returns exactly the data type enforced by the cast to a pointer (be
it 32bit or 64bit or whatever), while a negative integer has not
this flexibility.
* src/cache/ftccmap.c (FTC_CMAP_UNKNOWN): Ditto.
* src/truetype/ttgxvar.c (ALL_POINTS, TT_Get_MM_Var): Ditto.
* src/type/t1load.c (T1_Get_MM_Var): Ditto.
(parse_blend_axis_types): Use cast.
* src/bdf/bdflib.c (_bdf_readstream): Use cast.
2012-12-17 09:08:09 +01:00
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
Werner Lemberg 309b8b31e0 [sfnt] Fix Savannah bug #37936.
* src/sfnt/ttload.c (tt_face_load_gasp): Avoid memory leak.
2012-12-16 19:08:36 +01:00
Alexei Podtelezhnikov 8ac5c5c8a5 [base] Fix 11-year old bug.
Since the initial commit (ebe85f59) the value of FT_TRIG_SCALE has
always been slightly less than the correct value, which has been
given in the comment as a hexadecimal. As a result, vector lengths
were underestimated and rotated vectors were shortened.
2012-12-15 23:33:55 -05:00
Werner Lemberg 7f2e4f4f55 [bdf] Fix Savannah bug #37907.
* src/bdf/bdflib.c (_bdf_parse_glyphs) <ENCODING>: Normalize
negative second parameter of `ENCODING' field also.
2012-12-15 09:39:41 +01:00
Werner Lemberg 07bdb6e289 [bdf] Fix Savannah bug #37906.
* src/bdf/bdflib.c (_bdf_parse_glyphs): Use correct array size for
checking `glyph_enc'.
2012-12-15 02:02:23 +01:00
Werner Lemberg 9b6b5754b5 [bdf] Fix Savannah bug #37905.
* src/bdf/bdflib.c (_bdf_parse_start): Reset `props_size' to zero in
case of allocation error; this value gets used in a loop in
`bdf_free_font'.
2012-12-15 01:34:41 +01: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
Johnson Y. Yan 06d6916c96 [type1] Another fix for 2012-09-17 commit.
* src/type1/t1parse.c (T1_Get_Private_Dict) <found>: Correctly set
`limit' value.
2012-12-09 00:07:51 +01:00
Werner Lemberg f5e2e39828 Add .mailmap file. 2012-12-08 12:30:37 +01: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
John Tytgat 54d43a39c5 [pshinter] Clamp BlueScale value.
This is Savannah bug #37856.

* src/pshinter/pshglob.c (psh_calc_max_height): New function.
(psh_globals_new): Use it to limit BlueScale value to
`1 / max_of_blue_zone_heights'.
2012-12-05 11:14:41 +01:00
Werner Lemberg 4d3a1e6c96 Formatting. 2012-12-05 06:32:57 +01:00
Alexei Podtelezhnikov 4ae9cbb025 [truetype, type1] Revise the use of FT_MulDiv.
* src/truetype/ttgxvar.c: Updated.
* src/truetype/ttobjs.c: Updated.
* src/type1/t1load.c: Updated.
2012-12-01 23:36:02 -05:00
Del Merritt 74e6a1f26f [doc] Minor improvements. 2012-11-30 15:29:33 +01:00
Werner Lemberg b731c8274a Minor. 2012-11-30 15:22:03 +01:00
Werner Lemberg 7e8e1761df [configure] Preserve customized `ftoption.h'.
Problem reported by Del Merritt <del@alum.mit.edu>.

* builds/unix/configure.raw <cpp computation of bit length>: Don't
remove existing FreeType configuration files.
2012-11-30 13:45:47 +01:00
Werner Lemberg 337fcb6ad6 [type1] Fix Savannah bug #37831.
The bug report also contains a patch.

* src/type1/t1parse.c (T1_Get_Private_Dict) <found>: Really fix
change from 2012-09-17.
2012-11-29 21:10:10 +01:00
Alexei Podtelezhnikov 6a126e14c4 [truetype] Fix formatting and typo. 2012-11-28 23:32:02 -05:00
Alexei Podtelezhnikov 79180ad049 [cid, type1, type42] Clean up units_per_EM calculations.
* src/cid/cidload.c (cid_parse_font_matrix): Updated.
* src/type1/t1load.c (t1_parse_font_matrix): Updated.
* src/type42/t42parse.c (t42_parse_font_matrix): Updated.
2012-11-27 21:36:20 -05:00
Alexei Podtelezhnikov 72e976d415 [ftstroke] Minor improvement.
* src/base/ftstroke.c: Replace nested FT_DivFix and FT_MulFix with
FT_MulDiv.
2012-11-27 21:18:34 -05:00
Werner Lemberg fa22ec1cfb * src/base/fttrigon.c (ft_trig_downscale): Make 64bit version work. 2012-11-17 11:45:24 +01:00
Alexei Podtelezhnikov 0690d3d7b5 [base] Fix integer overflows in dd5718c7d6.
* src/base/ftoutln.c (FT_Outline_EmboldenXY): Use FT_MulDiv.
2012-11-15 20:50:59 -05:00
Werner Lemberg 3a55340029 [autofit] Trace stem widths.
* src/autofit/aflatin.c (af_latin_metrics_init_widths): Add some
FT_TRACE calls.
2012-11-15 16:37:05 +01:00
Werner Lemberg 55127272c4 [cff] Add support for OpenType Collections (OTC).
* src/cff/cffload.c (cff_font_load): Separate subfont and face
index handling to load both pure CFFs with multiple subfonts and
OTCs (with multiple faces where each face holds exactly one
subfont).
* src/cff/cffobjs.c (cff_face_init): Updated.
2012-11-13 09:22:11 +01:00
Werner Lemberg 1a37e4174b [autofit] Minor improvement.
* src/autofit/aflatin.c (af_latin_hints_compute_blue_edges): Fix
loop.
2012-11-12 11:01:07 +01:00
Werner Lemberg f966da825c [autofit] Improve tracing.
* src/autofit/aflatin.c (af_latin_hint_edges)
[FT_DEBUG_LEVEL_TRACE]: Count number of actions and emit something
if there weren't any.
2012-11-10 12:42:18 +01:00
Werner Lemberg 3af607b07d Improve documentation of Unicode IVS handling. 2012-11-04 17:25:29 +01:00
Werner Lemberg 21332fb625 Add example for FT_Get_Sfnt_Table. 2012-11-04 08:03:34 +01:00
Alexei Podtelezhnikov dd5718c7d6 [base] Fortify emboldening code against egregious distortions.
* src/base/ftoutln.c (FT_Outline_EmboldenXY): Threshold emboldening
strength when it leads to segment collapse.
2012-11-04 00:57:57 -04:00
Alexei Podtelezhnikov 48ce226ae3 [base] Clean up emboldening code and improve comments there.
* src/base/ftoutln.c (FT_Outline_EmboldenXY): Replace sequential
calls to FT_MulFix and FT_DivFix with FT_MulDiv.
Mention that bisectors are used to figure out the shift direction.
2012-11-03 22:27:27 -04:00
Werner Lemberg 553bb3c3ca [autofit] Add standard character to `AF_ScriptClassRec' structure.
* src/autofit/aftypes.h (AF_ScriptClassRec): Add `standard_char'
member.
(AF_DEFINE_SCRIPT_CLASS): Updated.

* src/autofit/aflatin.c (af_latin_metrics_init_widths): Use it.
(af_latin_metrics_init, af_latin_script_class): Updated.

* src/autofit/aflatin.c (af_latin2_metrics_init_widths): Use it.
(af_latin2_metrics_init, af_latin2_script_class): Updated.

* src/autofit/afcjk.c (af_cjk_metrics_init_widths): Use it.
(af_cjk_metrics_init, af_cjk_script_class): Updated.

* src/autofit/afindic.c(af_indic_metrics_init,
af_indic_script_class): Updated.

* src/autofit/afcjk.h, src/autofit/aflatin.h: Updated.

* src/autofit/afdummy.c: Updated.
2012-10-24 14:22:14 +02:00
Werner Lemberg 118c6025b7 [autofit] Only use Unicode CMap.
* src/autofit/aflatin.c (af_latin_metrics_init): Implement it, to be
in sync with `af_face_globals_compute_script_coverage)'.
2012-10-24 12:26:20 +02:00
Werner Lemberg 8e82a961e7 [psaux] Improve parsing of invalid numbers.
* src/psaux/psconv.c (PS_Conv_Strtol): Always parse complete number,
even in case of overflow.
(PS_Conv_ToInt): Only increase cursor if parsing was successful.
(PS_Conv_ToFixed): Ditto.
Trace underflow and data error.
2012-10-21 11:02:50 +02:00
Werner Lemberg fdcbaf19fe [smooth] Improve tracing.
* src/smooth/ftgrays.c (gray_sweep): Trace last sweep line of
current band also.
2012-10-21 10:40:12 +02: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 ad4eecca77 [cff] Improve parsing of invalid real numbers.
* src/cff/cffparse.c (cff_parse_real): Always parse complete number,
even in case of overflow or underflow.
Also trace one more underflow.
2012-10-20 21:27:17 +02:00
Andreas Pehnack 1e1688340e [sfnt] Load pure CFF fonts wrapped in SFNT container.
Such fonts only have a `cmap' and a `CFF' table.

* src/sfnt/ttload.c (tt_face_load_font_dir): Don't call
`check_table_dir' if font signature is `OTTO'.
2012-10-20 11:42:22 +02:00
Werner Lemberg eaf0afb4c7 [psaux] Fix some value overflows and improve tracing.
* src/psaux/psconv.c: Include FT_INTERNAL_DEBUG_H.
(FT_COMPONENT): Define.
(PS_Conv_Strtol): Return FT_Long.
Handle bad data and overflow.
Emit some tracing messages in case of error.
(PS_Conv_ToInt): Return FT_Long.
(PS_Conv_ToFixed): Updated.
* src/psaux/psconv.h: Updated.

* include/freetype/internal/fttrace.h: Add `psconv'.
2012-10-20 11:27:25 +02:00
Werner Lemberg dda1e93db8 [autofit] Fix `make multi CC=c++'.
* src/autofit/aflatin.c, src/autofit/aflatin2.c: Include
`afglobal.h'.
* src/autofit/afloader.c: Fix order of header files.
* src/autofit/afmodule.c: Include `afglobal.h' and `aferrors.h'.
2012-10-20 08:34:57 +02:00
Werner Lemberg 4404ec4ef5 [cff] Fix more value errors and improve tracing.
* src/cff/cffparse.c (cff_parse_integer): Emit tracing message in
case of error.
(cff_parse_real): Handle and trace overflow, underflow, and bad data
consistently.
(do_fixed): New helper function, handling and tracing overflow.
(cff_parse_fixed, cff_parse_fixed_scaled): Use `do_fixed'.
2012-10-19 09:06:53 +02:00
Werner Lemberg 0708b23e80 [psaux] Fix some value overflows.
* src/psaux/psconv.c (PS_Conv_ToFixed): Implement it.
2012-10-17 21:38:19 +02:00
Bram Tassyns 76accc184b [cff] Fix value overflow.
* src/cff/cffparse.c (cff_parse_fixed_scaled): Implement it.
2012-10-17 19:55:20 +02: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 4f18d457e2 Improve documentation regarding vertical layout. 2012-10-07 22:36:46 +02:00
Gilles Espinasse be81ec22cc Remove useless `rm' detection.
`rm -f' is directly used in the `configure' script created by
autoconf, thus no availability test is necessary.

* builds/unix/configure.raw (RMF): Remove test.
* builds/unix/unix-def.in (DELETE): Updated.
2012-09-30 08:42:30 +02:00
Werner Lemberg bf745003e9 [autofit] Minor optimization.
* src/autofit/afglobals.c (af_face_globals_compute_script_coverage):
Add loop condition.
2012-09-29 22:40:40 +02:00
Werner Lemberg 156ba42e4d [autofit] Fix thinko.
* src/autofit/aftypes.h (AF_SCRIPT):
s/AF_SCRIPT_NONE/AF_SCRIPT_DUMMY/.  We already use `AF_SCRIPT_NONE'
as a bit mask.

* src/autofit/afdummy.c: Updated.
2012-09-29 10:08:01 +02:00
Werner Lemberg 7da6bbc34a Typos. 2012-09-25 06:37:15 +02:00
Werner Lemberg 3683fb55c9 [autofit] Implement `increase-x-height' property.
* include/freetype/ftautoh.h (FT_Prop_IncreaseXHeight): New
structure.

* include/autofit/afmodule.c (af_property_get_face_globals): New
function, re-using code from `af_property_get'.
(af_property_set, af_property_get): Handle `increase-x-height'.
Updated.
2012-09-18 23:31:05 +02:00
Werner Lemberg d180ac70fc [autofit] Implement Infinality's `increase glyph heights'.
This is an improved version of a similar fix contained in the
so-called `Infinality patch', taken from

  http://www.infinality.net/fedora/linux/zips/freetype-infinality-2.4.10-20120616_01-x86_64.tar.bz2

which addresses various enhancements of the auto-hinter.  Without
properties to control a module's metadata it wasn't possible to
adapt the patches because everything was originally controlled by
environment variables which I consider not suitable in general.

A patch to control `increase_x_height' follows.

* src/autofit/afglobal.h (AF_PROP_INCREASE_X_HEIGHT_MIN,
AF_PROP_INCREASE_X_HEIGHT_MAX): New macros.
(AF_FaceGlobalsRec): Add `increase_x_height' member.
* src/autofit/afglobal.c (af_face_globals_new): Initialize it.

* src/autofit/aflatin.c (af_latin_metrics_scale_dim),
* src/autofit/aflatin2.c (af_latin2_metrics_scale_dim): Implement
handling of `increase_x_height'.
2012-09-18 23:26:37 +02:00
Werner Lemberg 842c4ea258 [autofit] Add hierarchical property access to some structures.
* src/autofit/afglobal.h: Include `afmodule.h'.
(AF_FaceGlobalsRec): Add `module' member.
(AF_FaceGlobals): Typedef moved to...
* src/autofit/aftypes.h: Here.
(AF_ScriptMetricsRec): Add `globals' member.

* src/autofit/afglobal.c (af_face_globals_new,
af_face_globals_compute_script_coverage,
af_face_globals_get_metrics): Updated.

* src/autofit/afloader.c (af_loader_reset), src/autofit/afmodule.c
(af_property_get): Updated.
2012-09-18 15:23:41 +02:00
Werner Lemberg 273e2b796f Cosmetics. 2012-09-18 13:27:27 +02:00
Werner Lemberg ebda8b3257 Fix Savannah bug #37350.
* src/type1/t1parse.c (T1_Get_Private_Dict) <found>: Check for ASCII
storage only if we actually have at least four bytes.
2012-09-17 20:59:31 +02:00
Werner Lemberg 302fd62590 [autofit] Cosmetics. 2012-09-16 07:51:20 +02:00
Werner Lemberg d4ec007541 [autofit] Implement `fallback-script' property.
* src/autofit/afglobal.c: s/default_script/fallback_script/.
* src/autofit/afglobal.h: s/AF_SCRIPT_DEFAULT/AF_SCRIPT_FALLBACK/.

* src/autofit/afmodule.c: s/default_script/fallback_script/.
(af_property_set, af_property_get): Implement `fallback-script'.
* src/autofit/afmodule.h: s/default_script/fallback_script/.

* include/freetype/ftautoh.h: Document it.
2012-09-15 18:26:28 +02:00
Werner Lemberg 44e1f0d3a0 [autofit] Correct previous Unicode 6.1.0 change.
The auto-hinter's latin module only handles latin ligatures in the
`Alphabetical Presentation Forms' block.

* src/autofit/aflatin.c (af_latin_uniranges): Fix it.
2012-09-15 11:11:18 +02:00
Werner Lemberg ce92c5fabe * src/autofit/afmodule.c: s/FT_Err_/AF_Err_/. 2012-09-15 10:56:15 +02:00
Werner Lemberg d0014f2ccb [autofit] Make default script a global property.
* src/autofit/afmodule.h (AF_ModuleRec): Add `default_script' field.

* src/autofit/afglobal.c (af_face_globals_compute_script_coverage,
af_face_globals_new), src/autofit/afloader.c (af_loader_reset),
src/autofit/afmodule.c (af_property_get) <glyph-to-script-map>,
af_autofitter_init:
Handle default script.

* src/autofit/afglobal.h: Updated.
2012-09-15 10:33:43 +02:00
Werner Lemberg 073a4cefbd Use `FT_Module' instead of `FT_Library' argument in property funcs.
This internal change simplifies access to global module data.

* include/freetype/internal/services/svprop.h
(FT_Properties_SetFunc, FT_Properties_GetFunc): Change accordingly.

* src/base/ftobjs.c (ft_property_do), src/autofit/afmodule.c
(af_property_set, af_property_get): Updated.
2012-09-15 09:10:06 +02:00
Werner Lemberg 8ae2a65e09 [autofit] Update to Unicode 6.1.0.
* src/autofit/afcjk.c (af_cjk_uniranges), src/autofit/aflatin.c
(af_latin_uniranges): Add and fix ranges.
2012-09-14 14:10:01 +02:00
Werner Lemberg 95dae1c47a [autofit] Pass `AF_Module' instead of `AF_Loader'.
We want to access the (not yet existing) module's global data later
on.

* src/autofit/afloader.c: Include `afmodule.h'.
(af_loader_init, af_loader_reset, af_loader_done,
af_loader_load_glyph): Change accordingly.
* src/autofit/afmodule.c (AF_ModuleRec): Move to `afmodule.h'.
Updated.

* src/autofit/afmodule.h: Include `afloader.h'.
(AF_ModuleRec): Define here.
* src/autofit/afloader.h (AF_Module): Define here.
Updated.
2012-09-14 12:26:57 +02:00
Werner Lemberg 6d29c5cbe3 [autofit] Fix `make multi'.
* include/freetype/internal/fttrace.h: Add `afmodule'.
* src/autofit/afmodule.c: Include FT_INTERNAL_DEBUG_H.
(FT_COMPONENT): Define.
2012-09-14 11:57:36 +02:00
Werner Lemberg 688da8eea7 * src/autofit/afmodule.c: s/FT_Autofitter/AF_Module/. 2012-09-14 07:55:15 +02:00
Werner Lemberg 7bbbcbfb1a [autofit] Minor reorganization.
* src/autofit/afglobal.c (AF_SCRIPT_LIST_DEFAULT,
AF_SCRIPT_LIST_NONE, AF_DIGIT): Move to...
* src/autofit/afglobal.h (AF_SCRIPT_DEFAULT, AF_SCRIPT_LIST_NONE,
AF_DIGIT): This and update code.
2012-09-12 17:45:39 +02:00
Werner Lemberg 44481daf43 [autofitter] Add some comments. 2012-09-11 19:45:36 +02:00
Werner Lemberg 2be60cfe7e [autofit] Implement `glyph-to-script-map' property.
* include/freetype/ftautoh.h: New public header file.
* include/freetype/config/ftheader.h (FT_AUTOHINTER_H): New macro.

* src/autofit/afglobal.c (AF_FaceGlobalsRec): Move structure to...
* src/autofit/afglobal.h: This header file.
* src/autofit/afmodule.c: Include FT_AUTOHINTER_H.
(af_property_get): Handle `glyph-to-script-map'.
2012-09-01 22:31:43 +02:00
Werner Lemberg 7f316f22d1 [autofit] Implement properties service framework.
No properties are added yet.

* src/autofit/afmodule.c: Include FT_SERVICE_PROPERTIES_H.
(af_property_set, af_property_get): New dummy functions.
(af_service_properties, af_services, af_get_interface): Provide
service setup.
(autofit_moduleclass): Add service interface.

* src/autofit/afpic.c: Add necessary forward declarations.
(autofit_module_class_pic_init): Add code for service addition.
(autofit_module_pic_free): Add code for service removal.
* src/autofit/afpic.h (AF_SERVICES_GET, AF_SERVICE_PROPERTIES_GET):
New macros which provide necessary syntactical sugar for PIC
support.
2012-08-31 00:20:29 +02:00
Werner Lemberg 0f8fd88e83 Implement properties to control FreeType modules.
* include/freetype/fterrdef.h (FT_Err_Missing_Property): New error
code.
* include/freetype/ftmodapi.h (FT_Property_Set, FT_Property_Get):
New API.

* include/freetype/internal/services/svprop.h: New file.
* include/freetype/internal/ftserv.h (FT_SERVICE_PROPERTIES_H): New
macro.

* src/base/ftobjs.c: Include FT_SERVICE_PROPERTIES_H.
(ft_property_do, FT_Property_Set, FT_Property_Get): New functions.
2012-08-30 23:31:55 +02:00
edA-qa mort-ora-y 403515edcf Improve documentation of FT_Request_Size and FT_Set_Pixel_Sizes. 2012-08-30 06:23:31 +02:00
Werner Lemberg 590344cde0 [docmaker] Allow `-' in tags and identifiers.
* src/tools/docmaker/content.py (re_identifier),
src/tools/docmaker/sources.py (re_markup_tag1, re_markup_tag2,
re_crossref): Add `-' in patterns.
2012-08-29 09:16:56 +02:00
Werner Lemberg 328aa3b203 [FT_CONFIG_OPTION_PIC] Fix g++ 4.6.2 compiler warnings.
* include/freetype/internal/ftdriver.h (FT_DEFINE_DRIVER),
include/freetype/internal/ftobjs.h (FT_DEFINE_RENDERER,
FT_DEFINE_MODULE), include/freetype/internal/ftserv.h
(FT_DEFINE_SERVICEDESCREC1, FT_DEFINE_SERVICEDESCREC2,
FT_DEFINE_SERVICEDESCREC3, FT_DEFINE_SERVICEDESCREC4,
FT_DEFINE_SERVICEDESCREC5, FT_DEFINE_SERVICEDESCREC6),
src/autofit/afpic.c (autofit_module_class_pic_init),
src/base/basepic.c (ft_base_pic_init), src/base/ftinit.c
(ft_create_default_module_classes), src/cff/cffparse.c
(FT_Create_Class_cff_field_handlers), src/cff/cffpic.c
(cff_driver_class_pic_init), src/pshinter/pshpic.c
(pshinter_module_class_pic_init), src/psnames/pspic.c
(psnames_module_class_pic_init), src/raster/rastpic.c
(ft_raster1_renderer_class_pic_init), src/sfnt/sfntpic.c
(sfnt_module_class_pic_init), src/sfnt/ttcmap.c
(FT_Create_Class_tt_cmap_classes), src/smooth/ftspic.c
(ft_smooth_renderer_class_pic_init), src/truetype/ttpic.c
(tt_driver_class_pic_init): Initialize allocation variable.
2012-08-27 11:23:41 +02:00
Werner Lemberg 06e31e9b5e [truetype] Fix compilation warning.
* src/truetype/ttgload.c (IS_HINTED): Move macro to...
* src/truetype/ttobjs.h: This header file.
2012-08-27 09:35:22 +02:00
Werner Lemberg d9bf44a430 [autofit, cff, pshinter, psnames] More renamings for orthogonality.
* src/autofit/afmodule.c, src/autofit/afpic.h:
s/AF_AUTOFITTER_/AF_/.

* src/cff/cffdrivr.c, src/cff/cffobjs.c, src/cff/cffparse.c,
src/cff/cffpic.h: s/FT_CFF_/CFF_/.

* src/pshinter/pshmod.c, src/pshinter/pshpic.h:
s/FT_PSHINTER_/PSHINTER_/.

* src/psnames/psmodule.c, src/psnames/pspic.h:
s/FT_PSCMAPS/PSCMAPS_/.
2012-08-27 08:41:43 +02:00
Werner Lemberg 0c633e3fcd [sfnt, truetype] More renamings for orthogonality.
* src/sfnt/sfdriver.c, src/sfnt/sfntpic.h, src/sfnt/ttcmap.c,
src/truetype/ttdriver.c, src/truetype/ttpic.h: s/FT_SFNT_/SFNT_/,
s/FT_TT_/TT_/, s/GET_CMAP_INFO_GET/CMAP_INFO_GET/.
2012-08-27 07:43:28 +02:00
Werner Lemberg d0841ea73b [autofit] Some macro and variable renamings for orthogonality.
* include/freetype/internal/autohint.h, src/base/ftobjs.c,
src/autofit/afmodule.c, src/autofit/afpic.c, src/autofit/afpic.h:
s/SERVICE/INTERFACE/, s/service/interface/, s/Service/Interface/.
2012-08-27 06:57:05 +02:00
Werner Lemberg 9a87937522 [pshinter] Formatting. 2012-08-27 06:01:46 +02:00
Werner Lemberg d77b1ea012 [sfnt] Formatting. 2012-08-27 05:48:23 +02:00
Werner Lemberg b355b5693a Fix Savannah bug #37178.
* src/base/ftobjs.c (FT_Open_Face): Initialize `error' with
`FT_Err_Missing_Module' before loop to indicate `no valid drivers'.
2012-08-26 14:00:11 +02:00
Werner Lemberg 68fe6a9afa Formatting. 2012-08-26 13:56:56 +02:00
Werner Lemberg 6edaef3b14 [sfnt] More formatting. 2012-08-24 13:41:24 +02:00
Werner Lemberg 665c65bf86 [sfnt] Formatting. 2012-08-24 13:10:08 +02:00
Werner Lemberg ee09c86163 [psnames] Formatting. 2012-08-23 14:50:00 +02:00
Werner Lemberg f76f491ff7 Fix typos, add comments. 2012-08-23 13:34:26 +02:00
Werner Lemberg 37ec8c3833 Minor formatting. 2012-08-23 13:21:53 +02:00
Werner Lemberg 04affa270b * src/base/ftsynth.c (FT_GlyphSlot_Oblique): Fix shear angle.
The old value was far too large (more than 20°).  The new one
corresponds to 12°, quite common in typography.
2012-08-17 09:28:28 +02:00
Werner Lemberg 3d3ff4b2f9 Formatting. 2012-08-16 08:39:11 +02:00
Werner Lemberg 2f6be4c854 Document module names. 2012-08-14 20:11:17 +02:00
Alexei Podtelezhnikov 9ea55c7c33 Fix Savannah bug #37017.
* src/smooth/ftgrays.c (gray_render_cubic): Use a different set of
checks when detecting super curvy splines to be split.
2012-08-12 11:14:46 -04:00
Werner Lemberg 5b995a8dd8 [autofit] Improve recognition of flat segments.
Problem reported by Brad Dunzer <BDunzer@extensis.com>.

* src/autofit/aflatin.c (af_latin_metrics_init_blues): We have
a flat segment if the horizontal distance of best on-points is
larger than a given threshold.
2012-08-05 11:11:44 +02:00
Werner Lemberg e194d7cd61 [autofit] Variable renamings.
* src/autofit/aflatin.c (af_latin_metrics_init_blues): Replace
`glyph' with `outline'.
s/best_first/best_contour_first/.
s/best_last/best_contour_last/.
2012-08-05 10:58:02 +02:00
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 6274bd370f Typo. 2012-07-25 13:10:52 +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 fff6dcf1fe Improve documentation of FT_LOAD_NO_SCALE. 2012-07-10 08:33:50 +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
Dave Thomas fec113d724 [ARM] Fix FT_MulFix_arm.
* include/freetype/config/ftconfig.h (FT_MulFix_arm) [__arm__]:
Avoid ADDS instruction to clobber condition codes.
2012-07-07 10:57:30 +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
Werner Lemberg ad866e2c9a Fix `checking if gcc static flag -static works' test.
On my linux build tree, I receive yes answer in in every package I
build except freetype for this test checking if gcc static flag
`-static' works

On freetype, no is received, unless bzip2 and zlib are disabled using

  ./configure --without-bzip2 --without-zlib

The reason is that bzip2 and zlib tests add `-lz' and `-lbz2' to
LDFLAGS and this broke static flag test.

* builds/unix/configure.raw: Update CFLAGS and LDFLAGS only after
LT_INIT has run.
2012-06-30 07:59:28 +02:00
Infinality d0a827b340 [truetype] Fix various artifacts. 2012-06-28 20:34:26 -05:00
Gilles Espinasse 34de9d2644 Fix CFLAGS and LDFLAGS share configure test.
* builds/unix/configure.raw: Fix typo.
2012-06-28 06:45:26 +02: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
Werner Lemberg 320613eeb8 * Version 2.4.10 released.
==========================

Tag sources with `VER-2-4-10'.

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

* 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.9/2.4.10/, s/249/2410/.

* include/freetype/freetype.h (FREETYPE_PATCH): Set to 10.

* builds/unix/configure.raw (version_info): Set to 15:0:9.
2012-06-15 06:45:12 +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 a03cb019aa * builds/exports.mk: Add CCexe_CFLAGS and CCexe_LDFLAGS.
to pass special compiler/linker flags under cross development.
Suggested by Savannah bug #36367.

ChangeLog on 2010-07-15 saying as they were removed was wrong
for the official trunk of FreeType2.  This commit is the first
introduction of them.
2012-06-14 17:56:01 +09:00
Werner Lemberg 2d67e9b555 * docs/CHANGES: Updated. 2012-06-14 08:46:04 +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 fc61b5f211 Fix Savannah bug #36634.
Minor documentation improvement of FT_Get_Char_Index.
2012-06-12 08:07:19 +02: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
Werner Lemberg 5715ff4606 configure.raw: Doc improvement. 2012-05-29 13:57:12 +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
Werner Lemberg aa6895c176 * docs/CHANGES: Updated. 2012-05-28 22:55:54 +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 8be5d3ac0d Improve documentation w.r.t. stroking and advance widths.
Based on suggestions from johnpf74 <jfalcone@ea.com>.
2012-05-24 07:05:03 +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 448d128ec5 Document that the auto-hinter needs a valid cmap. 2012-04-24 15:25:54 +02:00
Werner Lemberg 447f0773ee Minor documentation improvement. 2012-04-07 19:13:29 +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
suzuki toshiya f0b194141d [configure] fix Savannah bug #35644.
* builds/unix/configure.raw: Check `-ansi' flag works even if gcc
is used.  Bionic libc headers for Android lose the consistency
when they are parsed with __STDC_VERSION__ older than 199901L or
__STRICT_ANSI__.
2012-03-21 15:42:14 +09: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 9e0c667413 Improve misleading documentation note. 2012-03-18 16:00:38 +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
Vinnie Falco 9e287894cd Prepare source code for amalgamation.
* include\freetype\freetype.h: Swap order of preprocessor blocks.
2012-03-10 07:31:58 +01:00
Werner Lemberg 50ed33e537 * Version 2.4.9 released.
=========================

Tag sources with `VER-2-4-9'.

* docs/CHANGES: Updated.

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

* 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.8/2.4.9/, s/248/249/.

* include/freetype/freetype.h (FREETYPE_PATCH): Set to 9.

* builds/unix/configure.raw (version_info): Set to 14:1:8.
2012-03-08 21:02:06 +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
Werner Lemberg ba67957d5e Fix Savannah bug #35660.
For some divisions, we use casts to 32bit entities.  Always guard
against division by zero with these casts also.

* src/base/ftcalc.c (ft_div64by32): Remove redundant cast.
(FT_MulDiv, FT_MulDiv_No_Round): Add 32bit cast.
(FT_DivFix): Add 32bit cast (this omission triggered the bug).
2012-03-03 12:27:18 +01:00
Werner Lemberg 847502a217 Improve documentation of `FT_Get_Track_Kerning'. 2012-03-03 07:03:41 +01:00
Werner Lemberg ceed93e328 [psaux] Fix handling of track kerning.
* src/psaux/afmparse.c (afm_parse_track_kern): Don't inverse sign
for `min_kern'.  It is indeed quite common that track kerning
*increases* spacing for very small sizes.
2012-03-03 07:03:08 +01:00
Werner Lemberg 0fc8debeb6 [truetype] Fix Savannah bug #35689.
* src/truetype/ttgload.c (TT_Load_Simple_Glyph): Check first outline
point.
2012-03-02 16:09:51 +01:00
Werner Lemberg 6ac022dc75 [bdf] Fix Savannah bug #35656.
* src/bdf/bdflib.c (_bdf_parse_glyphs) <_BDF_BITMAP>: Check validity
of nibble characters instead of accessing `a2i' array.
2012-03-01 16:43:20 +01:00
Werner Lemberg 7d35a7dc7c [winfonts] Fix Savannah bug #35659.
* src/winfonts/winfnt.c (FNT_Face_Init): Check number of glyphs.
2012-03-01 16:11:33 +01:00
Werner Lemberg d9c1659610 [bdf] Fix Savannah bug #35658.
* src/bdf/bdflib.c (_bdf_list_split): Initialize `field' elements
properly.
2012-03-01 15:15:00 +01:00
Werner Lemberg 292144b44a [psaux] Fix Savannah bug #35657.
If in function `skip_spaces' the routine `skip_comment' comes to the
end of buffer, `cur' is still increased by one, so we need to check
for `p >= limit' and not `p == limit'.

* src/psaux/psconv.c (PS_Conv_Strtol, PS_Conv_ToFixed,
PS_Conv_ASCIIHexDecode, PS_Conv_EexecDecode): Fix boundary checking.
2012-03-01 14:54:47 +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 cee5d59358 [bdf] Fix Savannah bug #35643.
* src/bdf/bdflib.c (_bdf_list_ensure): Bring code in sync with
comment before `_bdf_list_split', this is, really allocate at least
five `field' elements.
2012-03-01 09:26:03 +01:00
Werner Lemberg 4086fb7caf [bdf] Fix Savannah bug #35641.
* src/bdf/bdflib.c (_bdf_parse_glyphs) <DWIDTH, BBX>: Abort if
_BDF_ENCODING isn't set.  We need this because access to the `glyph'
variable might be undefined otherwise.
2012-03-01 08:55:40 +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 9290fa9022 [truetype] Remove redundant check.
* src/truetype/ttgload.c (TT_Load_Simple_Glyph): Remove reduntant
second check for ordered contour start points.
2012-02-29 17:29:07 +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
Alexei Podtelezhnikov b25265c5e4 Avoid modulo operators against a power-of-two denominator.
* src/afcjk.c (af_hint_normal_stem), src/base/ftoutln.c
(ft_contour_has), src/cff/cffgload.c (cff_decoder_parse_charstrings)
<cff_op_vvcurveto, cff_op_hhcurveto, cff_op_hvcurveto>,
src/gxvalid/gxvcommn.c (GXV_32BIT_ALIGNMENT_VALIDATE),
src/gxvalid/gxvfeat.c (gxv_feat_setting_validate): Replace `%' with
`&' operator.
2012-02-29 13:45:24 +01:00
Werner Lemberg 5621fdd412 [autofit] Don't synchronize digit widths for light rendering mode.
We don't hint horizontally in this mode.

* src/autofit/afloader.c (af_loader_load_g) <Hint_Metrics>:
Implement it.
2012-02-29 13:33:33 +01:00
Alexei Podtelezhnikov c18c1882c2 [type42] Minor code optimization (again).
* src/type42/t42parse.c (t42_parse_sfnts): Simplify previous change.
2012-02-28 07:52:04 +01:00
Werner Lemberg fcbc82e69e [smooth] Fix Savannah bug #35604.
* src/smooth/ftsmooth.c (ft_smooth_render_generic): Use `FT_Pos'
instead of `FT_UInt' for some variables and update comparisons
accordingly.  A detailed analysis can be found in the bug report.
2012-02-26 20:54:19 +01:00
Werner Lemberg c42848e6d9 [type42] Minor code optimization.
* src/type42/t42parse.c (t42_parse_sfnts): Use bitmask instead of
modulo operator.
2012-02-26 19:44:04 +01:00
Werner Lemberg 22fff25385 Whitespace. 2012-02-26 08:47:20 +01:00
Werner Lemberg bd63334ee7 * docs/CHANGES: Updated. 2012-02-26 08:46:05 +01:00
Werner Lemberg d9577add64 [type1] Fix Savannah bug #35608.
* src/type1/t1parse.c (T1_Get_Private_Dict): Reject too short
dictionaries.
2012-02-26 08:03:57 +01:00
Werner Lemberg 03242f58c4 [bdf] Support `ENCODING -1 <n>' format.
* src/bdf/bdflib.c (_bdf_parse_glyphs) <ENCODING>: Implement it.
2012-02-26 06:52:56 +01:00
Werner Lemberg 28dd2c4595 [bdf] Fix Savannah bug #35607.
* src/bdf/bdflib.c (_bdf_parse_glyphs) <ENCODING>: Normalize
negative encoding values.
2012-02-26 06:18:58 +01:00
Werner Lemberg 58cbc465d2 [type1] Fix Savannah bug #35606.
* src/type1/t1load.c (parse_subrs): Add proper guards for `strncmp'.

* src/psaux/psobjs.c (ps_parser_skip_PS_token): Emit error message
only if cur < limit.
2012-02-26 05:26:56 +01:00
Werner Lemberg c776fc17bf [pcf] Fix Savannah bug #35603.
* src/pcf/pcfread.c (pcf_get_properties): Assure final zero byte in
`strings' array.
2012-02-25 14:21:01 +01:00
Werner Lemberg 82365c0dea [type42] Fix Savannah bug #35602.
* src/type42/t42parse.c (t42_parse_sfnts): Check `string_size' more
thoroughly.
2012-02-25 13:22:40 +01:00
Werner Lemberg 0b1c0c6b20 [bdf] Fix Savannah bugs #35599 and #35600.
* src/bdf/bdflib.c (ACMSG16): New warning message.
(_bdf_parse_glyphs) <_BDF_BITMAP>: Check line length.
2012-02-25 10:23:04 +01:00
Werner Lemberg 320d4976d1 [bdf] Fix Savannah bugs #35597 and #35598.
* src/bdf/bdflib.c (_bdf_is_atom): Fix handling of property value.
2012-02-24 18:06:46 +01:00
Werner Lemberg 6b5b6f39e7 Prepare source code for amalgamation (6/6).
* src/cff/cffdrivr.c: s/Load_Glyph/cff_glyph_load/.

* src/cid/cidload.c: s/parse_font_matrix/cid_parse_font_matrix/.
s/t1_init_loader/cid_init_loader/.
s/t1_done_loader/cid_done_loader/.

* src/pxaux/t1cmap.c: s/t1_get_glyph_name/psaux_get_glyph_name/.

* src/truetype/ttdriver.c: s/Load_Glyph/tt_glyph_load/.

* src/type1/t1load.c: s/parse_font_matrix/t1_parse_font_matrix/.
2012-02-24 12:26:25 +01:00
Werner Lemberg 1b99d0a01c Prepare source code for amalgamation (5/6).
* include/freetype/fterrors.h: Undefine FT_KEEP_ERR_PREFIX after
using it.
2012-02-24 10:54:07 +01:00
Vinnie Falco 9511143385 Prepare source code for amalgamation (4/6).
* src/smooth/ftgrays.c, src/raster/ftraster.c: Undefine RAS_ARG,
RAS_ARGS, RAS_VAR, and RAS_VARS before defining it.

* src/smooth/ftgrays.c: s/TRaster/black_TRaster/,
s/PRaster/black_PRaster/.
* src/raster/ftraster.c: s/TRaster/gray_TRaster/,
s/PRaster/gray_PRaster/.
2012-02-22 07:01:35 +01:00
Vinnie Falco d55f16df11 Prepare source code for amalgamation (3/6).
* src/smooth/ftgrays.c: s/TWorker/black_TWorker/,
s/PWorker/black_PWorker/.
* src/raster/ftraster.c: s/TWorker/gray_TWorker/,
s/PWorker/gray_PWorker/
2012-02-21 09:21:19 +01:00
Vinnie Falco 5ccebc4e1e Prepare source code for amalgamation (2/6).
* src/smooth/ftgrays.c, src/raster/ftraster.c: Undefine FLOOR,
CEILING, TRUNC, and SCALED before defining it.
2012-02-21 08:54:55 +01:00
Vinnie Falco 126405adde Prepare source code for amalgamation (1/6).
See discussion starting at

  http://lists.gnu.org/archive/html/freetype-devel/2012-01/msg00037.html

* src/smooth/ftgrays.c: s/TBand/gray_TBand/.
* src/raster/ftraster.c: s/TBand/black_TBand/.
2012-02-21 08:48:39 +01:00
Werner Lemberg 634867898b [autofit] Fix outline flags.
* src/autofit/afloader.c (af_loader_load_g): Don't reassign
`outline.flags' so that this information is preserved.  See
discussion starting at

  http://lists.gnu.org/archive/html/freetype-devel/2012-02/msg00046.html
2012-02-17 14:55:27 +01:00
Werner Lemberg 2536862d41 Improve description of FT_LOAD_PEDANTIC. 2012-02-11 21:42:19 +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
Werner Lemberg 185606a64d We don't use `extensions'.
* include/freetype/internal/ftobjs.h (FT_DriverRec): Remove
`extensions' field.
2012-02-11 14:34:05 +01:00
Werner Lemberg f24d0793f1 Clean up `generic' fields.
* include/freetype/internal/ftobjs.h (FT_ModuleRec, FT_LibraryRec):
Remove `generic' field since users can't access it.

* src/base/ftobjs.c (FT_Done_GlyphSlot): Call `generic.finalizer' as
advertised in the documentation of FT_Generic.
(Destroy_Module, FT_Done_Library): Updated to changes in `ftobjs.h'.
2012-02-11 09:37:46 +01:00
Werner Lemberg 02c0e526b2 Formatting. 2012-02-11 08:29:47 +01:00
Werner Lemberg e343e87d4f [autofit] Harmonize function arguments.
* src/autofit/afloader.c, src/autofit/afloader.h: Use `FT_Int32' for
`load_flags'.
2012-02-07 09:40:11 +01:00
Werner Lemberg 0b7daff031 * src/cff/cffobjs.c (cff_face_init): Remove unnecessary casts. 2012-02-07 08:52:41 +01:00
Werner Lemberg 3933334039 Formatting, whitespace. 2012-02-06 22:42:11 +01:00
Werner Lemberg 0ef4b83749 Formatting. 2012-02-06 22:14:51 +01:00
Werner Lemberg 25a3f56f58 Fix copyright year. 2012-02-06 22:11:21 +01:00
Werner Lemberg 12291284e4 Whitespace. 2012-02-06 17:59:05 +01:00
Werner Lemberg b178b6f8d7 Formatting. 2012-02-06 13:46:58 +01:00
Werner Lemberg 3e0be75b4b Cosmetics. 2012-02-04 21:42:49 +01:00
Werner Lemberg 8c1724d675 [configure] Fix minor grammar nits. 2012-01-30 14:14:43 +01:00
Werner Lemberg 5b7fbb44e0 Minor documentation improvements regarding threads and faces. 2012-01-27 20:51:27 +01:00
suzuki toshiya 7b02b70443 [gxvalid] Fix Savannah bug #35286.
Patch submitted by anonymous reporter.

* src/gxvalid/gxvcommn.c (gxv_XStateTable_subtable_setup):
gxv_set_length_by_ulong_offset() must be called with 3, not 4,
the number of the subtables in the state tables; classTable,
stateArray, entryTable.
2012-01-17 16:20:02 +09:00
suzuki toshiya c7c4d68bfb [raccess] Modify for PIC build.
Based on the patch provided by Erik Dahlstrom <ed@opera.com>,
http://lists.gnu.org/archive/html/freetype-devel/2012-01/msg00010.html

Also `raccess_guess_table[]' and `raccess_rule_by_darwin_vfs()'
are renamed with `ft_' suffixes.

* src/base/ftbase.h: `raccess_rule_by_darwin_vfs()' is renamed
to `ft_raccess_rule_by_darwin_vfs()'.
* src/base/ftobjs.c: Ditto.

* src/base/ftrfork.c: Declarations of FT_RFork_Rule,
raccess_guess_rec, are moved to...
* include/freetype/internal/ftrfork.h: Here.

* include/freetype/internal/ftrfork.h:
FT_RFORK_RULE_ARRAY_{BEGIN,ENTRY,END} macros are defined
to replace raccess_guess_table[] in both of PIC and non-PIC
modes.
* src/base/ftrfork.c: raccess_guess_table[] array is rewritten
by FT_RFORK_RULE_ARRAY_{BEGIN,ENTRY,END}.

* src/base/basepic.h (BasePIC): Add `ft_raccess_guess_table'
storage.  (FT_RACCESS_GUESS_TABLE_GET): New macro to retrieve
the function pointer from `ft_raccess_guess_table' storage in
`BasePIC' structure.
* src/base/ftrfork.c (FT_Raccess_Guess): Rewritten with
FT_RACCESS_GUESS_TABLE_GET.
(raccess_get_rule_type_from_rule_index): Add `library' as the
first argument to the function, to retrieve the storage of
`ft_raccess_guess_table' from it.  Also `raccess_guess_table'
is replaced by FT_RACCESS_GUESS_TABLE_GET.
(ft_raccess_rule_by_darwin_vfs): Ditto.
2012-01-17 15:13:50 +09:00
suzuki toshiya 1749d8bc6a Remove trailing spaces. 2012-01-17 02:00:24 +09:00
suzuki toshiya c24f77ac76 Formatting PIC related sources.
* src/autofit/afpic.c: Harmonize to FT2 coding conventions.
* src/base/basepic.c: Ditto.
* src/base/ftpic.c: Ditto.
* src/cff/cffpic.c: Ditto.
* src/pshinter/pshpic.c: Ditto.
* src/psnames/pspic.c: Ditto.
* src/raster/rastpic.c: Ditto.
* src/sfnt/sfntpic.c: Ditto.
* src/smooth/ftspic.c: Ditto.
* src/truetype/ttpic.c: Ditto.
2012-01-16 21:13:05 +09:00
suzuki toshiya 8a5cea2616 [autofit] Fix the inclusion of "aflatin2.h" in PIC file.
* src/autofit/afpic.c: Include "aflatin2.h" when
FT_OPTION_AUTOFIT2 is defined, as afglobal.c does so.
Unconditionally inclusion causes declared but unimplemented
warning by GCC 4.6.
2012-01-16 20:41:53 +09:00
suzuki toshiya 4880a0ed82 [cff] Remove redundant declarations of cff_cmap_XXX_class_rec.
* src/cff/cffpic.c: The declarations of
FT_Init_Class_cff_cmap_encoding_class_rec() and
FT_Init_Class_cff_cmap_unicode_class_rec() are removed.
They can be obtained by the inclusion of cffcmap.h.
cffcmap.h invokes FT_DECLARE_CMAP_CLASS() and it declares
FT_Init_Class_cff_cmap_encoding_class_rec() etc in PIC mode.
2012-01-16 18:51:15 +09:00
suzuki toshiya 3c96681856 Fix redundant declaration warning in PIC mode.
Originally FT_DEFINE_{DRIVER,MODULE,RENDERER}() macros were
designed to declare xxx_pic_{free,init} by themselves.
Because these macros are used at the end of the module
interface (e.g. ttdriver.c) and the wrapper source to build
a module as a single object (e.g. truetype.c) includes
the PIC file (e.g. ttpic.c) before the module interface,
these macros are expanded AFTER xxx_pic_{free,init} body
when the modules are built as single object.
The declaration after the implementation causes the redundant
declaration warnings, so the declarations are moved to module
PIC headers (e.g. ttpic.h).  Separating to other header files
are needed for multi build.

* include/freetype/internal/ftdriver.h (FT_DEFINE_DRIVER):
Remove class_##_pic_free and class_##_pic_init declarations.
* include/freetype/internal/ftobjs.h (FT_DEFINE_RENDERER,
FT_DEFINE_MODULE): Ditto.

* src/base/basepic.h: Insert a comment and fix coding style.
* src/autofit/afpic.h: Declare autofit_module_class_pic_{free,
init}.
* src/cff/cffpic.h: Declare cff_driver_class_pic_{free,init}.
* src/pshinter/pshpic.h: Declare pshinter_module_class_pic_{free,
init}.
* src/psnames/pspic.h: Declare psnames_module_class_pic_{free,
init}.
* src/raster/rastpic.h: Declare
ft_raster{1,5}_renderer_class_pic_{free,init}
* src/sfnt/sfntpic.h: Declare sfnt_module_class_pic_{free,init}.
* src/smooth/ftspic.h: Declare
ft_smooth_{,lcd_,lcdv_}renderer_class_pic_{free,init}.
* src/truetype/ttpic.h: Declare tt_driver_class_pic_{free,init}.
2012-01-15 23:35:31 +09:00
suzuki toshiya e38acb0d53 Make pspic.c to include module error header to fix multi build.
* src/psnames/pspic.c: Include `psnamerr.h'.
2012-01-15 20:05:22 +09:00
suzuki toshiya 09f3e41c25 [base] Fix a dereference of uninitialized variable in PIC mode.
* src/base/ftglyph.c (FT_Glyph_To_Bitmap): `glyph' must be
set before derefering to obtain `library'.  The initialization
of `clazz', `glyph', `library' and NULL pointer check are
reordered to minimize PIC conditonals.
2012-01-15 02:48:47 +09:00
suzuki toshiya 0614febcec [base] Insert explict cast for GCC 4.6 in PIC mode.
* src/base/ftinit.c (FT_Add_Default_Modules): Under PIC
configuration, FT_DEFAULT_MODULES_GET returns
FT_Module_Class** pointer, GCC 4.6 warns that
const FT_Module_Class* const* variable is warned as
inappropriate to store it.  To calm it, explicit cast is
inserted.  Also `library' is checked to prevent the NULL
pointer dereference in FT_DEFAULT_MODULES_GET.
2012-01-15 01:31:07 +09:00
suzuki toshiya 226f361975 Fix PIC build broken by d9145241fe.
Under PIC configuration, FT_{CFF,PSCMAPS,SFNT,TT}_SERVICES_GET
take no arguments but derefer the variable named `library'
internally.

* src/cff/cffdrivr.c (cff_get_interface): Declare `library' and
set it if non-NULL driver is passed.
* src/truetype/ttdriver.c (tt_get_interface): Ditto.

* src/sfnt/sfdriver.c (sfnt_get_interface): Declare `library'
under PIC configuration, and set it if non-NULL module is given.
* src/psnames/psmodule.c (psnames_get_interface): Ditto.
2012-01-14 06:40:03 +09:00
suzuki toshiya 4b733517d7 Make PIC files to include module error headers, to use the
error codes with per-module prefix.

* src/autofit/afpic.c: Include `aferrors.h'.
* src/cff/cffpic.c: Include `cfferrs.h'.
* src/pshinter/pshpic.c: Include `pshnterr.h'.
* src/raster/rastpic.c: Include `rasterrs.h'.
* src/sfnt/sfntpic.c: Include `sferrors.h'.
* src/smooth/ftspic.c: Include `ftsmerrs.h'.
* src/truetype/ttpic.c: Include `tterrors.h'.
2012-01-14 06:32:50 +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 c017f072e4 Fix tracing message for `loca' table.
* src/truetype/ttpload.c (tt_face_get_location): Don't emit a
warning message if the last `loca' entry references an empty glyph.
2012-01-02 22:33:42 +01:00
Werner Lemberg eef90d3d1e Whitespace. 2012-01-02 14:11:43 +01:00
Werner Lemberg 5cb356405e Add some variable initializations.
Reported by Richard COOK <rscook@unicode.org>.

* src/type1/t1driver.c (t1_ps_get_font_value): Initialize `val'.
* src/smooth/ftgrays.c (gray_render_conic): Initialize `levels'
earlier.
2011-12-10 23:16:04 +01:00
Werner Lemberg 2fb22d5649 Fix serious scaling bug in `FT_Get_Advances'.
* src/base/ftadvanc.c (FT_Get_Advances): Advance values returned by
`FT_Load_Glyph' must be simply multiplied by 1024.
2011-12-08 11:55:06 +01:00
Werner Lemberg 96fcf87b75 * src/bdf/bdflib.c (_bdf_parse_start): Drop redundant error tracing. 2011-12-08 11:22:07 +01:00
Werner Lemberg 24b77764e7 Whitespace. 2011-12-08 09:51:52 +01:00
Werner Lemberg 8a6808eb1f Whitespace. 2011-12-02 20:22:04 +01:00
suzuki toshiya 714ee56ab1 [mac] Unify DARWIN_NO_CARBON with FT_MACINTOSH.
Originally FT_MACINTOSH was a pure auto macro and DARWIN_NO_CARBON
was a configurable macro to disable Carbon-dependent code.  Because
now configure script sets DARWIN_NO_CARBON by default and disables
Darwin & Carbon-dependent codes, these macros can be unified.
FT_MACINTOSH (undefined by default) is kept and DARWIN_NO_CARBON
(defined by default) is removed, because DARWIN_NO_CARBON violates
FT_XXX naming convention of public macros, and a macro configured by
default is not portable for the building without configure (e.g.
make devel).

* builds/unix/configure.raw: Define FT_MACINTOSH if Carbon-based
old Mac font support is requested and Carbon is available.
* builds/unix/ftconfig.in: Undefine FT_MACINTOSH when the support
for Mac OS X without Carbon (e.g.  Mac OS X 10.4 for ppc64) is
requested.
* include/freetype/config/ftconfig.in: Ditto.
* builds/vms/ftconfig.h: Ditto.

* src/base/ftbase.h: Remove DARWIN_NO_CARBON.
* src/base/ftbase.c: Ditto.
* src/base/ftobjs.c: Ditto.
* src/base/ftrfork.c: Ditto.

* src/base/ftmac.c: Compile the body if FT_MACINTOSH is defined
(same with TT_USE_BYTECODE_INTERPRETER in ttinterp.c).
* builds/mac/ftmac.c: Ditto.

* builds/mac/FreeType.m68k_cfm.make.txt: Define FT_MACINTOSH.
* builds/mac/FreeType.m68k_far.make.txt: Ditto.
* builds/mac/FreeType.ppc_classic.make.txt: Ditto.
* builds/mac/FreeType.ppc_carbon.make.txt: Ditto.
2011-12-02 21:14:58 +09:00
suzuki toshiya 2968bd6098 Fix Savannah bug #34728 (`make devel' on Mac OS X).
* builds/toplevel.mk: Check `/dev/null' to identify the Unix-
like systems without `init' nor `hurd' (e.g. Mac OS X >= 10.4).
* builds/unix/detect.mk: Ditto.
2011-11-30 23:25:38 +09:00
suzuki toshiya eba2781ab9 [apinames] Fix the overflow of signed integer hash.
* src/tools/apinames.c (names_add): Change the type of `h' from
int to unsigned int, to prevent undefined behaviour in the
overflow of signed integers (overflow of unsigned int is defined
to be wrap around).  Found by clang test suggested by Sean
McBride.
2011-11-30 22:40:43 +09:00
Werner Lemberg 628bebe639 [winfonts] Remove casts.
* src/winfonts/winfnt.c (winfnt_driver_class): Remove all casts and
update affected functions.
(FNT_Size_Select): Fix number of arguments.
2011-11-30 13:55:56 +01:00
Werner Lemberg 5a7a593c37 [type42] Remove casts.
* src/type42/t42driver.c (t42_driver_class): Remove all casts and
update affected functions.

* src/type42/t42objs.c, src/type42/t42objs.h: Updated for t42driver
changes.
2011-11-30 13:38:51 +01:00
Werner Lemberg d5260597b2 Cosmetics. 2011-11-30 13:10:54 +01:00
Werner Lemberg 910b544aaf [type1] Remove casts.
* src/type1/t1driver.c (t1_driver_class): Remove all casts and
update affected functions.

* src/type1/t1gload.c, src/type1/t1gload.h, src/type1/t1objs.c:
Updated for t1driver changes.
src/type1/t1objs.h (T1_Driver): Remove unused typedef.
Updated for t1driver changes.
2011-11-30 13:08:28 +01:00
Werner Lemberg c52f44d4fd Whitespace. 2011-11-30 10:46:53 +01:00
Werner Lemberg cdd25cc8f0 Minor internal documentation fix. 2011-11-30 10:12:07 +01:00
Werner Lemberg 7810fad7d4 Set the executable bit of autogen.sh.
Savannah patch #7681.
2011-11-29 23:56:23 +01:00
Werner Lemberg ed54e43aed [bdf] Fix Savannah bug #34896.
ENCODING now covers the whole Unicode range.

Note, however, that this change is quite expensive since it
increases the size of three arrays by almost 400kByte in total.  The
right fix is to replace the logic with something smarter.
Additionally, there exist very old BDFs for three-byte CCCII
encoding which exceeds the range of Unicode (another reason to have
a smarter logic).

* src/bdf/bdf.h (bdf_font_t): Increase size of `nmod' and `umod'
arrays.
* src/bdf/bdflib.c (bdf_parse_t): Increase size of `have' array.
2011-11-27 16:39:53 +01:00
Werner Lemberg 6e0d4cdf0e [bdf] Improve tracing.
* src/bdf/bdflib.c (DBGMSG1, DBGMSG2): New macros.
(_bdf_parse_glyphs): Use them.
2011-11-27 09:21:03 +01:00
Werner Lemberg 70cf8c5e6d Improve tracing.
* src/bdf/bdfdrivr.c (BDF_Face_Done), src/pcf/pcfdrivr.c
(PCF_Face_Done): Remove tracing message.

* src/bdf/bdfdrivr.c (BDF_Face_Init), src/cff/cffobjs.c
(cff_face_init), src/cid/cidobjs.c (cid_face_init),
src/pfr/pfrobjs.c (pfr_face_init), src/sfnt/sfobjs.c
(sfnt_init_face), src/truetype/ttobjs.c (tt_face_init),
src/type1/t1objs.c (T1_Face_Init), src/type42/t42objs.c
(T42_Face_Init), src/winfonts/winfnt.c (FNT_Face_Init): Add
`greeting' message.

* src/sfnt/sfobjs.c (sfnt_open_font), src/type42/t42objs.c
(T42_Open_Face): Improve tracing.
2011-11-26 20:09:39 +01:00
Werner Lemberg 3630bf7eb5 [cid] Fix error code.
* src/cid/cidparse.c (cid_parser_new): Do it.
2011-11-26 18:20:24 +01:00
Werner Lemberg d05d56fff0 [cff] Fix error code.
* src/cff/cffload.c (cff_font_load): Do it.
2011-11-26 18:13:09 +01:00
Werner Lemberg f8f576d1d4 Addition to last commit. 2011-11-26 18:07:30 +01:00
Werner Lemberg 930e9bf8f4 Add new error code FT_Err_Missing_Module.
Previously, FreeType misleadingly returned
FT_Err_Unknown_File_Format if a module was missing (or a test was
missing completely).

* include/freetype/fterrdef.h (FT_Err_Missing_Module): Define.

* src/cff/cffobjs.c (cff_face_init), src/cid/cidobjs.c
(cid_face_init), src/sfnt/sfobjs.c (sfnt_init_face),
src/truetype/ttobjs.c (tt_face_init), src/type1/t1objs.c
(T1_Face_Init), src/type42/t42objs.c (T42_Face_Init,
T42_Driver_Init): Updated.

* src/type1/t1afm.c (T1_Read_Metrics), src/type/t1objs.c
(T1_Face_Init), src/type42/t42objs.c (T42_Face_Init): Remove now
redundant test for `psaux'.
2011-11-26 13:38:26 +01:00
Werner Lemberg e01406bb91 [bdf] Add more error messages.
* src/bdf/bdflib.c (_bdf_set_default_spacing, _bdf_add_property):
Add line number argument.
Update all callers.
(ERRMSG5, ERRMSG6, ERRMSG7, ERRMSG8, ERRMSG9): New macros.
(_bdf_readstream, _bdf_set_default_spacing, _bdf_add_property,
_bdf_parse_glyphs, _bdf_parse_start): Add error messages.
2011-11-25 09:44:28 +01:00
Werner Lemberg fd905c02dd * include/freetype/fterrors.h: Remove dead code. 2011-11-24 12:53:38 +01:00
Werner Lemberg bb18bf7d05 * docs/releases: Updated. 2011-11-15 08:34:54 +01:00
Werner Lemberg 29795570cc Typo. 2011-11-15 08:17:59 +01:00
Werner Lemberg 9d7f0957fb * Version 2.4.8 released.
=========================

Tag sources with `VER-2-4-8'.

* docs/CHANGES: Updated.

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

* 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.7/2.4.8/, s/247/248/.

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

* builds/unix/configure.raw (version_info): Set to 14:0:8.
2011-11-14 20:37:12 +01:00
Werner Lemberg dfb475ab7a Fix compiler warning. 2011-11-14 20:29:13 +01:00
Chris Liddell 8b90cf0b42 Add FT_Get_PS_Font_Value() API.
This allows a Type 1 font face to be interrogated to retrieve most
of the dictionary keys (keys not relevant to FreeType's Type 1
interpreter are not available).

* include/freetype/internal/services/svpsinfo.h
(PS_GetFontValueFunc): New typedef.
(PSInfo): Add `ps_get_font_value'.
(FT_DEFINE_SERVICE_PSINFOREC): Updated.

* include/freetype/internal/t1types.h (T1_EncodingType): Moved to...
* include/freetype/t1tables.h: Here.
(PS_Dict_Keys): New enumeration.
(FT_Get_PS_Font_Value): New declaration.

* src/base/fttype1.c (FT_Get_PS_Font_Value): New function.

* src/type1/t1driver.c (t1_ps_get_font_value): This new function
does the real job.
(t1_service_ps_info): Add it.

* src/cff/cffdrivr.c (cff_service_ps_info), src/cid/cidriver.c
(cid_service_ps_info), src/type42/t42drivr.c (t42_service_ps_info):
Updated.
2011-11-13 16:30:59 +01:00
Braden Thomas 14a16e3430 [cid] Various loading fixes.
* src/cid/cidload.c (cid_load_keyword) <default>,
(parse_font_matrix, parse_expansion_factor): Correctly check number
of dictionaries.
(cid_read_subrs): Protect against invalid values of `num_subrs'.
Assure that the elements of the `offsets' array are ascending.
2011-11-08 08:27:42 +01:00
Werner Lemberg b2874fd5be * README: We use copyright ranges also.
According to

  http://www.gnu.org/prep/maintain/html_node/Copyright-Notices.html

this should be mentioned explicitly.
2011-11-05 08:39:58 +01:00
suzuki toshiya 94ada3d81c [raccess] Supplement for previous fix.
* src/base/ftbase.h (raccess_rule_by_darwin_vfs): Do not declare
it on native Mac OS X.
* src/base/ftrfork.c (raccess_get_rule_type_from_rule_index):
Hide raccess_get_rule_type_from_rule_index() on native Mac OS X
too.
2011-10-30 14:03:13 +09:00
suzuki toshiya dbe330bca9 [raccess] Hide raccess_rule_by_darwin_vfs() on native Mac OS X.
* src/base/ftrfork.c (raccess_rule_by_darwin_vfs): Do not
compile on native Mac OS X because it is not used.
2011-10-30 12:31:03 +09: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 016eba976f * Version 2.4.7 released.
=========================

Tag sources with `VER-2-4-7'.

* docs/CHANGES: Updated.

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

* 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.6/2.4.7/, s/246/247/.

* include/freetype/freetype.h (FREETYPE_PATCH): Set to 6.

* builds/unix/configure.raw (version_info): Set to 13:2:7.
2011-10-18 13:34:32 +02:00
Kal Conley 72185cb5f4 Fix handling of transformations if no renderer is present.
* src/base/ftobjs.c (FT_Load_Glyph): Thinko.
2011-10-15 09:33:11 +02:00
Kal Conley 298608d1d2 Fix conditions for autohinting.
* src/base/ftobjs.c (FT_Load_Glyph): Handle
FT_LOAD_IGNORE_TRANSFORM.
2011-10-15 09:09:59 +02:00
suzuki toshiya faddba4474 [gxvalid] Fix a bug to detect too large offset in morx table.
* src/gxvalid/gxvmorx2.c
(gxv_morx_subtable_type2_ligActionIndex_validate): Fix a bug
that too large positive offset cannot be detected.
2011-10-08 01:30:49 +09:00
Werner Lemberg 9c98fbf634 Handle some border cases.
* include/freetype/config/ftstdlib.h (FT_USHORT_MAX): New macro.

* src/base/ftbitmap.c (FT_Bitmap_Convert): Protect against invalid
value of `target->rows'.

* src/psaux/t1decode.c (t1_decoder_parse_charstrings): Add check for
flex start.

* src/raster/ftrend1.c (ft_raster1_render): Check `width' and
`height'.

* src/truetype/ttgxvar.c (TT_Vary_Get_Glyph_Deltas): Protect against
invalid values in `localpoints' array.
2011-10-01 09:25:55 +02:00
Werner Lemberg 6ae8bde444 [psnames] Handle zapfdingbats.
Problem reported by Nicolas Rougier <Nicolas.Rougier@inria.fr>.

* src/tools/glnames.py (adobe_glyph_list): Add data from AGL's
`zapfdingbats.txt' file.

* src/psnames/pstables.h: Regenerated.
2011-10-01 08:55:20 +02:00
Werner Lemberg bfc20c76eb Fix Savannah bug #34189.
* src/type1/t1load.c (T1_Open_Face): Initialize
`face->len_buildchar'.
2011-09-27 17:35:09 +02:00
Werner Lemberg 34d2818a75 [cff] Dump SIDs while tracing.
* src/cff/cffobjs.c (cff_face_init): Do it.

* src/cff/cffparse.c (cff_parser_run) [FT_DEBUG_LEVEL_TRACE]
<cff_kind_string>: Identify as SID.
2011-09-26 08:59:21 +02:00
Werner Lemberg 34eca6ec63 Remove unused FT_ALIGNMENT macro.
* builds/unix/ftconfig.in, builds/vms/ftconfig.h,
include/freetype/config/ftconfig.h: Do it.
2011-09-17 09:46:46 +02:00
Werner Lemberg e9e93d1b19 [smooth] Slightly optimize conic and cubic flatterners.
* src/smooth/ftgrays.c (gray_render_conic, gray_render_cubic): Move
out some code from the main loop to speed it up.
2011-09-17 09:21:25 +02:00
Tomas Hoger 487913d9a6 Slightly improve LZW_CLEAR handling.
* src/lzw/ftzopen.c (ft_lzwstate_io) <FT_LZW_PHASE_CODE>:
Ensure that subsequent (modulo garbage byte(s)) LZW_CLEAR codes are
handled as clear codes.  This also re-sets old_code and old_char to
predictable values, which is a little better than using `random'
ones if the code following LZW_CLEAR is invalid.
2011-09-11 09:18:10 +02:00
Tomas Hoger 83cb6c0049 Add explicit LZW decompression stack size limit.
Stack larger than 1<<LZW_MAX_BITS is never needed if prefix table is
constructed correctly.  It's even less than that, see e.g.
libarchive code comment for a better size upper bound:

  http://code.google.com/p/libarchive/source/browse/trunk/libarchive/archive_read_support_filter_compress.c?r=3635#121

This patch adds explicit stack size limit, enforced when stack is
realloced.

An alternative is to ensure that code < state->prefix[code - 256]
when traversing prefix table.  Such check is less efficient and
should not be required if prefix table is constructed correctly in
the first place.

* src/lzw/ftzopen.c (ft_lzwstate_stack_grow): Implement it.
2011-09-11 09:13:45 +02:00
Tomas Hoger 86c3c69c15 Protect against loops in the prefix table.
LZW decompressor did not sufficiently check codes read from the
input LZW stream.  A specially-crafted or corrupted input could
create a loop in the prefix table, which leads to memory usage
spikes, as there's no decompression stack size limit.

* src/lzw/ftzopen.c (ft_lzwstate_io) <FT_LZW_PHASE_START>: First
code in valid LZW stream must be 0..255.
<FT_LZW_PHASE_CODE>: In the special KwKwK case, code == free_ent,
code > free_ent is invalid.
2011-09-11 09:08:40 +02:00
Werner Lemberg 57b6a6148d Better tracing of metrics.
* src/base/ftobjs.c (FT_Request_Size, FT_Select_Size): Decorate with
FT_TRACE.
2011-09-09 19:05:54 +02:00
Werner Lemberg bb211ce6ce Fix Savannah bug #33816.
* src/cff/cfftypes.h (CFF_FontRecDictRec): New member
`has_font_matrix'.
* src/cff/cffparse.c (cff_parse_font_matrix): Set it.
Update tracing output.
* src/cff/cffobjs.c (cff_face_init): Use it so that the heuristics
can be removed.
2011-09-07 15:01:20 +02:00
Werner Lemberg c9a69022dc Typo. 2011-08-30 08:09:38 +02:00
Werner Lemberg 51ca771ff6 Better tracing of metrics.
* src/base/ftobjs.c (FT_Select_Metrics, FT_Request_Metrics):
Decorate with FT_TRACE.
2011-08-30 07:42:19 +02:00
Werner Lemberg 35ab70c19c [cff] Better tracing of the parsing process.
* src/cff/cffload.c (cff_subfont_load, cff_font_load): Decorate with
FT_TRACE.

* src/cff/cffparse.c (cff_parse_font_matrix, cff_parse_font_bbox,
cff_parse_private_dict, cff_parse_cid_ros): Updated.
(CFF_FIELD_NUM, CFF_FIELD_FIXED, CFF_FIELD_FIXED_1000,
CFF_FIELD_STRING, CFF_FIELD_BOOL, CFF_FIELD_CALLBACK, CFF_FIELD,
CFF_FIELD_DELTA): Add argument for ID.
(cff_parser_run): Decorate with FT_TRACE.

* src/cff/cffparse.h (CFF_Field_Handler) [FT_DEBUG_LEVEL_TRACE]: Add
`id' member.

* src/cff/cfftoken.h: Add IDs to all fields.
2011-08-25 13:41:16 +02:00
Werner Lemberg aeaa1619de [cff] Formatting, minor code clean-ups. 2011-08-24 20:50:25 +02:00
Werner Lemberg c3fb981e2a Fix Savannah bug #34022.
* README, docs/INSTALL: Remove references to UPGRADE.UNIX.
2011-08-16 16:04:33 +02:00
Werner Lemberg fa5c2e914e Fix Savannah bug #34018.
* doc/UPGRADE.UNIX: Removed.  Obsolete.
2011-08-15 17:46:40 +02:00
David Bevan 864c426eff Fix Savannah bug #33992.
* src/base/ftstroke.c (FT_Stroker_ParseOutline): Fix border case.
2011-08-15 17:34:01 +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 b91e785308 Fix Savannah bug #33975.
* src/cff/cffparse.c (cff_parse_font_matrix): Fix typo.
2011-08-09 17:48:44 +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 29a7965fd1 * Version 2.4.6 released.
=========================

Tag sources with `VER-2-4-6'.

* docs/CHANGES: Updated.

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

* 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.5/2.4.6/, s/245/246/.

* include/freetype/freetype.h (FREETYPE_PATCH): Set to 6.

* builds/unix/configure.raw (version_info): Set to 13:1:7.
2011-07-29 06:23:27 +02:00
Werner Lemberg e7d42366f1 [cff] Add some more tracing infos.
* src/cff/cffparse.c (cff_parse_font_matrix, cff_parse_font_bbox,
cff_parse_cid_ros): Add tracing.
2011-07-29 06:15:20 +02:00
Dirk Müller b03c4a0a3f [psaux, type1] Fix null pointer dereferences.
Found with font fuzzying.

* src/psaux/t1decode.c (t1_decoder_parse_charstrings): Check
`decoder->buildchar'.

* src/type1/t1load.c (t1_load_keyword): Check `blend->num_designs'.
2011-07-22 05:24:11 +02:00
Chris Morgan 3abf617b5e Add FT_CONFIG_OPTION_DISABLE_STREAM_SUPPORT.
Useful for embedded systems which don't need file stream support.

* src/base/ftsystem.c, src/base/ftobjs.c (FT_Stream_New): Implement
it.
2011-07-20 06:48:08 +02:00
Elton Chung 77f04cebe8 * src/base/ftpatent.c (FT_Face_SetUnpatentedHinting): Fix typo. 2011-07-20 06:30:20 +02:00
Steven Chu b0962ac34e [truetype] Fix metrics on size request for scalable fonts.
* src/truetype/ttdriver.c (tt_size_request): Fix copying metrics
from TT_Size to FT_Size if scalable font.
2011-07-16 09:12:42 +02:00
Matthias Drochner 143799d4a9 [psaux] Fix potential sign extension problems.
When shifting right a signed value, it is not defined by the
C standard whether one gets a sign extension or not.  Use a macro to
do an explicit cast from a signed short (assuming that this is
16bit) to an int.

* src/psaux/t1decode.c (Fix2Int): New macro.
Use it where appropriate.
2011-07-14 07:35:51 +02:00
Werner Lemberg 60f8371353 * src/psaux/t1decode.c (t1_decoder_parse_charstrings)
<op_callothersubr>: Better handling of subroutine index 0.
From Matthias Drochner <M.Drochner@fz-juelich.de>.
2011-07-14 07:34:12 +02:00
Werner Lemberg 403559b84a Sort case in switch statement numerically. 2011-07-14 07:21:11 +02:00
Алексей Подтележников dc33b4a155 [psaux] Optimize previous commit.
* src/psaux/t1decode.c (t1_decoder_parse_charstrings)
<op_callothersubr>: Move error check down to avoid testing twice for
good cases.
2011-07-10 07:08:51 +02:00
Werner Lemberg c46b1e2476 [psaux] Add better argument check for `callothersubr'.
* src/psaux/t1decode.c (t1_decoder_parse_charstrings)
<op_callothersubr>: Reject negative arguments.
2011-07-08 13:46:42 +02:00
Werner Lemberg f095744d2d [sfnt] Try harder to find non-zero values for ascender and descender.
* src/sfnt/sfobjs.c (sfnt_load_face): Consult `OS/2' table in case
the `hhea' table's values are zero.
2011-07-07 14:10:39 +02:00
Werner Lemberg ecdcad029f Typos. 2011-07-03 15:29:55 +02:00
Werner Lemberg f4b63326f1 Fix previous commit.
We want to unset FT_FACE_FLAG_SCALABLE only if there are bitmap
strikes in the font.

* src/truetype/ttobjs.c (tt_face_init): Implement it.

* docs/CHANGES: Updated.
2011-07-03 11:24:46 +02:00
Werner Lemberg b511999601 Whitespace. 2011-07-03 09:46:32 +02:00
Just Fill Bugs 07598339f7 Fix Savannah bug #33246.
* src/truetype/ttobjs.c (tt_check_single_notdef): New function.
(tt_face_init): Use it to test FT_FACE_FLAG_SCALABLE.
2011-07-02 18:41:36 +02:00
Werner Lemberg 9ae6c7c54d * docs/CHANGES: Updated. 2011-07-02 12:15:10 +02:00
David Bevan aecbfe1ba7 [ftstroke] Major revision.
The main problems
-----------------

  o If FT_STROKER_LINEJOIN_BEVEL was specified, unlimited miter
    joins (not bevel joins) were generated.  Indeed, the meanings of
    `miter' and `bevel' were incorrectly reversed (consistently) in
    both the code and comments.

  o The way bevel joins were constructed (whether specified
    explicitly, or created as a result of exceeding the miter limit)
    did not match what is required for stroked text in PostScript or
    PDF.

The main fixes
--------------

  o The behaviour of FT_STROKER_LINEJOIN_BEVEL has been corrected.

  o A new line join style, FT_STROKER_LINEJOIN_MITER_FIXED, has been
    introduced to support PostScript and PDF miter joins.

  o FT_STROKER_LINEJOIN_MITER_VARIABLE has been introduced as an
    alias for FT_STROKER_LINEJOIN_MITER.

Additionally, a variety of stroking errors have been fixed.  These
would cause various artifacts (including points `at infinity'),
especially when stroking poor quality fonts.

See

  http://lists.gnu.org/archive/html/freetype-devel/2011-07/msg00001.html

for example documents.  The FreeType stroker now produces results
very similar to that produced by GhostScript and Distiller for these
fonts.

Other problems
--------------

The following problems have been resolved:

  o Inside corners could be generated incorrectly.  Intersecting the
    inside corner could cause a missing triangular area and other
    effects.

    The intersection point can only be used if the join is between
    two lines and both lines are long enough.  The `optimization'
    condition in `ft_stroker_inside' has been corrected; this
    requires the line length to be passed into various functions and
    stored in `FT_StrokerRec'.

  o Incorrect cubic curves could be generated.  The angle
    calculations in `FT_Stroker_CubicTo' have been corrected to
    handle the case of the curve crossing the +/-PI direction.

  o If the border radius was greater than the radius of curvature of
    a curve, then the negative sector would end up outside (not
    inside) the border.  This situation is now recognized and the
    negative sector is circumnavigated in the opposite direction.
    (If round line joins are being used, this code is disabled
    because the line join will always cover the negative sector.)

  o When a curve is split, the arcs may not join smoothly (especially
    if the curve turns sharply back on itself).  Changes in
    direction between adjacent arcs were not handled.  A round
    corner is now added if the deviation from one arc to the next is
    greater than a suitable threshold.

  o The current direction wasn't retained if a the outline contained
    a zero length lineto or a curve that was determined to be
    `basically a point'.  This could cause a spurious join to be
    added.

  o Cubics with close control points could be mishandled.  All eight
    cases are now distinguished correctly.

Other improvements
------------------

o Borders for cubic curves could be too `flat'.
  FT_SMALL_CUBIC_THRESHOLD has been reduced a little to prevent
  this.

o The handling and use of movable points has been simplified a
  little.

o Various values are now computed only if the results are actually
  needed.

o The directions of the outer and inner borders have been swapped,
  as recommended by Graham Asher.

* src/base/ftstroke.c: Revised.
* include/freetype/ftstroke.h: Updated.
2011-07-02 12:09:52 +02:00
Werner Lemberg ee5d3b5947 * builds/toplevel.mk: We use git, not CVS, thus skip `.gitignore'. 2011-06-30 15:08:15 +02:00
Werner Lemberg 073986ec4a Minor doc fixes. 2011-06-30 06:20:30 +02:00
Werner Lemberg 54f187ab1a Document last commit. 2011-06-29 10:01:42 +02:00
Werner Lemberg 4bf221964c Improve documentation of FT_Get_Glyph_Name. 2011-06-29 09:45:51 +02:00
Werner Lemberg 96ddc679be Fix Savannah bug #33663.
* src/bdf/bdflib.c (_bdf_parse_glyphs): Handle negative values for
ENCODING correctly.
2011-06-29 09:15:54 +02:00
Werner Lemberg da9dbf89c8 * Version 2.4.5 released.
=========================

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

* docs/CHANGES: Updated.

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

* 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.4/2.4.5/, s/244/245/.

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

* builds/unix/configure.raw (version_info): Set to 13:0:7.
2011-06-25 07:16:22 +02:00
Werner Lemberg 3ae2c70dc6 Minor documentation fixes. 2011-06-24 13:18:41 +02:00
Werner Lemberg 397461947c Merge branch 'master' of git.sv.gnu.org:/srv/git/freetype/freetype2
Conflicts:
	ChangeLog
2011-06-20 19:20:50 +02:00
Werner Lemberg 4696dde23d * src/autofit/aflatin.c (af_latin_metrics_scale_dim): Fix change
from 2011-05-04.
2011-06-20 19:09:02 +02:00
suzuki toshiya c7e8028f3f [gxvalid] make the `prop' validation tracing verbose.
* src/gxvalid/gxvprop.c: Add tracing messages for errors.
2011-06-19 23:00:11 +09:00
suzuki toshiya c63c6f7265 [autogen.sh] Reflect environment variable LIBTOOLIZE. 2011-06-19 22:54:40 +09:00
Werner Lemberg ea79b84621 Update license documentation.
* docs/GPL.TXT: Renamed to...
* docs/GPLv2.TXT: This.

* docs/LICENSE.TXT: Updated.
2011-06-18 08:06:57 +02:00
suzuki toshiya 41aa412591 Fix wrong indents in src/cache/ftcmru.c. 2011-06-15 20:02:49 +09:00
suzuki toshiya e62c876bb0 Fix g++4.6 compiler warnings in module drivers.
The background is same with previous commit.

* src/truetype/ttgxvar.c (ft_var_readpackedpoints):
Init `points'.  (TT_Vary_Get_Glyph_Deltas): Init
`delta_xy'.  (TT_Get_MM_Var): Init `mmvar'.
* src/type1/t1load.c (T1_Get_MM_Var): Ditto.
* src/cff/cffdrivr.c (cff_ps_get_font_info): Init
`font_info'.
* src/cff/cffload.c (cff_index_get_pointers): Init `t'.
(cff_font_load): Init `sub'.
* src/cff/cffobjs.c (cff_size_init): Init `internal'.
(cff_face_init): Init `cff'.
* src/pfr/pfrload.c (pfr_extra_item_load_stem_snaps):
Init `snaps'.
* src/pcf/pcfread.c (pcf_get_properties): Init `properties'.
(pcf_get_bitmaps): Init `offsets'.  (pcf_get_encodings):
Init `tmpEncoding'.
* src/sfnt/ttload.c (tt_face_load_gasp): Init `gaspranges'.
* src/sfnt/ttsbit.c (Load_SBit_Image): Init `components'.
* src/cache/ftcmru.c (FTC_MruList_New): Init `node'.
* src/gzip/ftgzip.c (FT_Stream_OpenGzip): Init `zip' and
`zip_buff'.
* src/lzw/ftlzw.c (FT_Stream_OpenLZW): Init `zip'.
* src/bzip2/ftbzip2.c (FT_Stream_OpenBzip2): Init `zip'.
2011-06-15 02:48:33 +09:00
suzuki toshiya dc185ee2c2 Fix misleading comment, s/buffer allocator/FT_NEW() families/g 2011-06-15 02:36:52 +09:00
suzuki toshiya 65a449887d [base] Fix g++4.6 compiler warnings in src/base/*.c.
Passing uninitialized pointer to the buffer allocator is
not problematic theoretically (as far as the returned
pointer is checked before writing), but g++4.6 dislikes
it and warns by -Wuninitialized.  Initialize them by NULL.

* src/base/ftobjs.c (FT_Stream_New): Init `stream'.
(new_memory_stream): Ditto.
(FT_New_GlyphSlot): Init `slot'.
(FT_CMap_New): Init `cmap'.
(open_face_PS_from_sfnt_stream): Init `sfnt_ps'.
(Mac_Read_POST_Resource): Init `pfb_data'.
(Mac_Read_sfnt_Resource): Init `sfnt_data'.
* src/base/ftrfork.c (FT_Raccess_Get_DataOffsets):
Init `offsets_internal' and `ref'.
(raccess_guess_darwin_hfsplus): Init `newpath'.
(raccess_guess_darwin_newvfs): Ditto.
* src/base/ftbitmap.c (ft_bitmap_assure_buffer):
Init `buffer'.
* src/base/ftstroke.c (FT_Stroker_New): Init `stroker'.
2011-06-15 01:44:24 +09:00
suzuki toshiya 75b91a49aa [gxvalid] Cleanup.
Some invalid, overrunning, unrecommended non-zero values
are cared in paranoid validation mode only.  There are
many lines looking like:

  if ( valid->root->level >= FT_VALIDATE_PARANOID )
    FT_INVALID_xxx;

To simplify them, GXV_SET_ERR_IF_PARANOID( err ) is
introduced for more paranoid validation in future.

* src/gxvalid/gxvcommn.h (IS_PARANOID_VALIDATION):
New macro to assure valid->root->level is more or
equal to FT_VALIDATE_PARANOID.  (GXV_SET_ERR_IF_PARANOID):
New macro to raise an error if in paranoid validation.
* src/gxvalid/gxvcommn.c: Use GXV_SET_ERR_IF_PARANOID().
* src/gxvalid/gxvfeat.c: Ditto.
* src/gxvalid/gxvjust.c: Ditto.
* src/gxvalid/gxvkern.c: Ditto.
* src/gxvalid/gxvmort.c: Ditto.
* src/gxvalid/gxvmort0.c: Ditto.
* src/gxvalid/gxvmort1.c: Ditto.
* src/gxvalid/gxvmort2.c: Ditto.
* src/gxvalid/gxvmorx1.c: Ditto.
* src/gxvalid/gxvmorx2.c: Ditto.
2011-06-15 01:12:04 +09:00
suzuki toshiya f6f9b66781 [gxvalid] Fix gcc4.6 compiler warnings in gxvtrak.c.
* src/gxvalid/gxvtrak.c (gxv_trak_trackTable_validate):
Check different entries pointing same traking value.
(gxv_trak_validate): Remove unused variable `table_size'.
2011-06-14 23:55:57 +09:00
suzuki toshiya 05fc72c5c7 [gxvalid] Fix gcc4.6 compiler warnings in gxvmorx*.c.
* src/gxvalid/gxvmorx.c (gxv_morx_subtables_validate):
Conditionalize unvalidated variable `subFeatureFlags'.
(gxv_morx_chain_validate): Conditionalize unvalidated
variable `defaultFlags'.

* src/gxvalid/gxmorx0.c
(gxv_morx_subtable_type0_entry_validate):
Conditionalize unvalidated variables; `markFirst',
`dontAdvance', `markLast', `verb'.

* src/gxvalid/gxmorx1.c
(gxv_morx_subtable_type1_entry_validate): Conditionalize
unvalidated variables; `setMark', `dontAdvance'.

* src/gxvalid/gxvmorx2.c
(gxv_morx_subtable_type2_ligActionOffset_validate):
Conditionalize unvalidated variables; `last', `store'.
Checking for overrunning offset is added.
(gxv_morx_subtable_type2_entry_validate):
Conditionalize unvalidated variables; `setComponent',
`dontAdvance', `performAction'.
(gxv_morx_subtable_type2_ligatureTable_validate):
Check if the GID for ligature does not exceed the
max GID in `maxp' table.

* src/gxvalid/gxvmort5.c
(gxv_morx_subtable_type5_InsertList_validate):
Conditionalize unvalidated loading of `insert_glyphID'
array.  (gxv_morx_subtable_type5_entry_validate):
Conditionalize unvalidated variables; `setMark',
`dontAdvance', `currentIsKashidaLike',
`markedIsKashidaLike', `currentInsertBefore',
`markedInsertBefore'.
2011-06-14 23:54:10 +09:00
suzuki toshiya 56be3ac9b1 [gxvalid] Fix gcc4.6 compiler warnings in gxvmort*.c.
* src/gxvalid/gxvmort.c (gxv_mort_subtables_validate):
Conditionalize unvalidated variable `subFeatureFlags'.
(gxv_mort_chain_validate): Conditionalize unvalidated
variable `defaultFlags'.

* src/gxvalid/gxmort0.c
(gxv_mort_subtable_type0_entry_validate): Check the
conflict of the marks for the glyphs.

* src/gxvalid/gxmort1.c
(gxv_mort_subtable_type1_offset_to_subst_validate):
Local variables `min_gid', `max_gid' are replaced by
variables in the validator.
(gxv_mort_subtable_type1_entry_validate): Conditionalize
unvalidated variables; `setMark', `dontAdvance'.
(gxv_mort_subtable_type1_substTable_validate):
Validate the GID by the min/max GIDs in the validator.

* src/gxvalid/gxvmort2.c
(gxv_mort_subtable_type2_ligActionOffset_validate):
Conditionalize unvalidated variables; `last', `store'.
Checking for overrunning offset is added.
(gxv_mort_subtable_type2_entry_validate):
Conditionalize unvalidated variables; `setComponent',
`dontAdvance'.
(gxv_mort_subtable_type2_ligatureTable_validate):
Check if the GID for ligature does not exceed the
max GID in `maxp' table.

* src/gxvalid/gxvmort5.c
(gxv_mort_subtable_type5_InsertList_validate):
Conditionalize unvalidated loading of `insert_glyphID'
array.  (gxv_mort_subtable_type5_entry_validate):
Conditionalize unvalidated variables; `setMark',
`dontAdvance', `currentIsKashidaLike',
`markedIsKashidaLike', `currentInsertBefore',
`markedInsertBefore'.
2011-06-14 23:53:12 +09:00
suzuki toshiya 20c126c1ac [gxvalid] Fix gcc4.6 compiler warnings in gxvkern.c.
* src/gxvalid/gxvkern.c
(gxv_kern_subtable_fmt0_pairs_validate): Conditionalize
unvalidated variable `kernValue'.
(gxv_kern_subtable_fmt1_entry_validate): Conditionalize
unvalidated variables; `push', `dontAdvance', `kernAction',
`kernValue'.
(gxv_kern_coverage_new_apple_validate): Conditionalize
trace-only variables; `kernVertical', `kernCrossStream',
`kernVariation'.
(gxv_kern_coverage_classic_apple_validate): Conditionalize
trace-only variables; `horizontal', `cross_stream'.
(gxv_kern_coverage_classic_microsoft_validate):
Conditionalize trace-only variables; `horizontal',
`minimum', `cross_stream', `override'.
(gxv_kern_subtable_validate): Conditionalize trace-only
variables; `version', `tupleIndex'.
2011-06-14 23:50:39 +09:00
suzuki toshiya ce015ec8da [gxvalid] Fix gcc4.6 compiler warnings in gxvjust.c.
* src/gxvalid/gxvjust.c (gxv_just_check_max_gid):
New function to unify the checks of too large GID.
(gxv_just_wdp_entry_validate): Conditionalize unvalidated
variables; `beforeGrowLimit', `beforeShrinkGrowLimit',
`afterGrowLimit', `afterShrinkGrowLimit', `growFlags',
`shrinkFlags'.  Additional check for non-zero values in
unused storage `justClass' is added.
(gxv_just_actSubrecord_type0_validate): Conditionalize
unvalidated variable `order'.  GID is checked by
gxv_just_check_max_gid().  Additional check for upside-down
relationship between `lowerLimit' and `upperLimit' is added.
(gxv_just_actSubrecord_type1_validate): GID is checked by
gxv_just_check_max_gid().
(gxv_just_actSubrecord_type2_validate): Conditionalize
unvalidated variable `substThreshhold'.  GID is checked by
gxv_just_check_max_gid().
(gxv_just_actSubrecord_type5_validate): GID is checked by
gxv_just_check_max_gid().
(gxv_just_classTable_entry_validate): Conditionalize
unvalidated variables; `setMark', `dontAdvance',
`markClass', `currentClass'.
2011-06-14 23:49:34 +09:00
suzuki toshiya 248aa63973 [gxvalid] Preparation to fix gcc4.6 compiler warnings.
* src/gxvalid/gxvcommn.h (GXV_LOAD_TRACE_VARS): New macro to
conditionalize the variable which is only used for trace messages.
Automatically set by FT_DEBUG_LEVEL_TRACE.
(GXV_LOAD_UNUSED_VARS): New macro to conditionalize the loading of
unvalidated variables.  Undefined by default to calm gcc4.6 warning.
(GXV_ValidatorRec.{min_gid,max_gid}): New variables to hold defined
GID ranges, for the comparison of GID ranges in different subtables.
2011-06-14 23:47:21 +09:00
Werner Lemberg f3e2a97d5b Fix URLs. 2011-06-14 08:32:13 +02:00
Werner Lemberg 58d1a5ee74 [autofit] Remove unused structure member.
* src/autofit/afhints.h (AF_SegmentRec): Remove `contour'.
* src/autofit/aflatin.c (af_latin_hints_compute_segments),
src/autofit/aflatin2.c (af_latin2_hints_compute_segments): Updated.
2011-06-08 09:32:56 +02:00
Werner Lemberg fe0f16d295 Fix comments. 2011-06-01 10:36:04 +02:00
Werner Lemberg 849bde1fa0 Merge branch 'master' of git.sv.gnu.org:/srv/git/freetype/freetype2
Conflicts:
	ChangeLog
2011-05-30 07:29:04 +02:00
Werner Lemberg 6b19fd5c14 Fix g++ 4.6 compilation.
* src/autofit/afhints.c (af_glyph_hints_dump_segments,
af_glyph_hints_dump_edges): Use cast.
2011-05-30 07:27:59 +02:00
Werner Lemberg 71cc1a83d8 Fix gcc 4.6 compiler warnings.
* src/autofit/afcjk.c (af_cjk_metrics_init_blues): Use casts and
remove unused variables.
* src/autofit/aflatin.c (af_latin_hints_compute_edges): Comment out
`up_dir'.
* src/smooth/ftsmooth.c (ft_smooth_render_generic): Use `height_org'
and `width_org' conditionalized.
2011-05-30 07:20:37 +02:00
suzuki toshiya c32d54c949 [mac] Conditionalize the inclusion of "AvailabilityMacros.h".
The native SDK on earliest Mac OS X (10.0-10.1) did not have
"AvailabilityMacros.h".  To prevent the inclusion of missing
header file, ECANCELED (introduced in 10.2) in POSIX header
file <errno.h> is checked to detect the system version.

* include/freetype/config/ftconfig.h: Conditionalize the
inclusion of "AvailabilityMacros.h".
* builds/unix/ftconfig.in: Ditto.
* builds/vms/ftconfig.h: Ditto.
2011-05-29 01:33:34 +09:00
Werner Lemberg 735e5abb7b [autofit] Improve tracing of hinting process.
* src/autofit/aflatin.c (af_latin_hint_edges): Add tracing message
`ADJUST'.
2011-05-27 10:22:42 +02:00
Daniel Zimmermann 3ad8f35537 Reduce warnings for MS Visual Studio 2010.
* src/autofit/afhints.c (af_glyph_hints_get_num_segments,
af_glyph_hints_get_segment_offset) [!FT_DEBUG_AUTOFIT]: Provide
return value.
* src/cff/cffgload.c (cff_slot_load): Add cast.
* src/truetype/ttobjs.c (tt_check_trickyness_sfnt_ids): Use proper
loop variable type.
2011-05-24 06:22:32 +02:00
Behdad Esfahbod 79405d75c0 Documentation fix. 2011-05-24 06:10:47 +02:00
suzuki toshiya ebd14a599d Automake component `builds/unix/install-sh' is removed.
* builds/unix/install-sh: Removed.  It is not needed to
include repository, because autogen.sh installs it.
* builds/unix/.gitignore: Register install-sh.
2011-05-16 12:47:25 +09:00
sssa 4e8f9de9a0 [autofit] Make trace message for CJK bluezone more verbose. 2011-05-12 14:30:15 +09:00
Werner Lemberg 27b20e9a1e Formatting, minor doc improvements. 2011-05-09 09:48:49 +02:00
suzuki toshiya 084abf0469 [autofit] Add bluezones for CJK Ideographs.
To remove extremas of vertical strokes of CJK Ideographs at
low resolution and make the top and bottom horizontal stems
aligned, bluezones for CJK Ideographs are calculated from
sample glyphs.  At present, vertical bluezones (bluezones
to align vertical stems) are disabled by default.  For detail, see
http://lists.gnu.org/archive/html/freetype-devel/2011-04/msg00070.html
http://lists.gnu.org/archive/html/freetype-devel/2011-04/msg00092.html
http://lists.gnu.org/archive/html/freetype-devel/2011-05/msg00001.html

* include/freetype/internal/fttrace.h: New trace component `afcjk'.
* src/autofit/afcjk.h (AF_CJK{Blue,Axis,Metric}Rec): Add CJK version
for AF_Latin{Blue,Axis,Metric}Rec.
(af_cjk_metrics_check_digits): Ditto, shared with Indic module.
(af_cjk_metrics_init_widths): Ditto.
(af_cjk_metrics_init): Take AF_CJKMetric instead of AF_LatinMetric.
(af_cjk_metrics_scale): Ditto (declaration).
(af_cjk_hints_init): Ditto (declaration).
(af_cjk_hints_apply): Ditto (declaration).
* src/autofit/afcjk.c (af_cjk_metrics_scale): Ditto (body).
(af_cjk_hints_init): Ditto (body).
(af_cjk_hints_apply): Ditto (body).
(af_cjk_metrics_init_widths): Duplicate af_latin_metrics_init_widths.
(af_cjk_metrics_check_digits): Duplicate af_latin_metrics_check_digits.
(af_cjk_metrics_init): Call CJK bluezone initializer.
(af_cjk_metrics_scale_dim): Add code to scale bluezones.
(af_cjk_hints_compute_blue_edges): New function, CJK version of
af_latin_hints_compute_blue_edges.
(af_cjk_metrics_init_blues): New function, CJK version of
af_latin_metrics_init_blues.
(af_cjk_hints_edges): Add code to align the edge stems to blue zones.

* src/autofit/afindic.c (af_indic_metrics_init): Take AF_CJKMetric
instead of AF_LatinMetric, and initialize as af_cjk_metrics_init.
However bluezones are not initialized.
(af_indic_metrics_scale): Take AF_CJKMetric instead of AF_LatinMetric.
(af_indic_hints_init): Ditto.
(af_indic_hints_apply): Ditto.

* docs/CHANGES: Note about CJK bluezone support.
2011-05-08 19:22:32 +09:00
Werner Lemberg d2e82aa07e [autofit] Remove unused struct member.
* src/autofit/aflatin.h (AF_LatinAxis): Remove `control_overshoot'.
2011-05-06 19:04:30 +02:00
Werner Lemberg a3a0f57a1d * src/autofit/aflatin.c (af_latin_metrics_scale_dim): Simplify. 2011-05-04 06:14:30 +02:00
Werner Lemberg c3135e43f5 [autofit] Fix and add comments. 2011-05-02 06:04:15 +02:00
Werner Lemberg 3a0844c8ef [autofit] Add more debugging functions.
* src/autofit/afhints.c (af_glyph_hints_get_num_segments,
af_glyph_hints_get_segment_offset): New functions.
2011-05-01 13:44:44 +02:00
Werner Lemberg 3cf3b9e32c Minor formatting. 2011-05-01 12:30:37 +02:00
suzuki toshiya 7c6da3d73a Add new option `--disable-mmap' to configure script.
* builds/unix/configure.raw: New option `--disable-mmap'
is added.  It is for the developers to simulate the systems
without mmap() (like 4.3BSD, minix etc) on POSIX systems.
2011-05-01 19:06:24 +09:00
suzuki toshiya 58cb359335 [truetype] Recalculate the sfnt table checksum always.
* src/truetype/ttobjs.c (tt_get_sfnt_checksum): Recalculate
the sfnt table checksum even if non-zero value is writte in
the TrueType font header.  Some bad PDF generators write
wrong values.  For detail, see examples and benchmark tests
of the latency by recalculation:
http://lists.gnu.org/archive/html/freetype-devel/2011-04/msg00091.html
http://lists.gnu.org/archive/html/freetype-devel/2011-04/msg00096.html
2011-05-01 00:47:43 +09:00
suzuki toshiya 1e89d15a27 [truetype] Register a set of tricky fonts, NEC FA family.
* src/truetype/ttobjs.c (tt_check_trickyness_sfnt_ids):
Add 8 checksum sets for NEC FA family.  For the tricky fonts
without some tables (e.g. NEC FA fonts lack cvt table),
extra check is added to assure that 0-length table in the
registry is not included in the font.
2011-04-30 17:55:57 +09:00
suzuki toshiya 10385e379e Remove unrequired `else' from ttobjs.c::tt_get_sfnt_checksum(). 2011-04-30 17:49:45 +09:00
suzuki toshiya 89208861ef [truetype] Fix a bug in the sfnt table checksum getter.
* src/truetype/ttobjs.c (tt_get_sfnt_checksum): Check the
return value of face->goto_table() correctly.
2011-04-30 00:11:07 +09:00
Werner Lemberg b9aa1f1339 [autofit] Improve tracing messages.
* src/autofit/aflatin.c (af_latin_metrics_init_blues,
af_latin_align_linked_edge, af_latin_hint_edges): Do it.
2011-04-28 09:09:45 +02:00
suzuki toshiya 86b7b2f614 [truetype] Revert the reordering of trickyness checking.
Trickyness check by the family name is faster than that by
the checksum.
2011-04-26 03:46:12 +09:00
suzuki toshiya abc47aa136 [truetype] Always check the checksum to identify tricky fonts.
Some PDF generators mangle the family name badly, prioritize
the check by the sfnt table checksums than the check by the
family name.  For sample PDF, see
http://lists.gnu.org/archive/html/freetype-devel/2011-04/msg00073.html

* src/truetype/ttobjs.c (tt_check_trickyness): Exchange the order
of tt_check_trickyness_family() and tt_check_trickyness_sfnt_ids().
2011-04-25 23:51:04 +09:00
suzuki toshiya 233f9d5dd2 [autofit] Add more Indic scripts with hanging baseline.
* src/autofit/afindic.c (af_indic_uniranges): Tibetan, Limbu,
Sundanese, Meetei Mayak, Syloti Nagri and Sharada scripts are
added.
2011-04-22 10:14:07 +09:00
Werner Lemberg a8dbf7dbbc Merge branch 'master' of git.sv.gnu.org:/srv/git/freetype/freetype2
Conflicts:
	ChangeLog
2011-04-21 08:25:14 +02:00
Behdad Esfahbod 8c82ec5b17 Always ignore global advance.
This makes FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH redundant,
deprecated, and ignored.  The new behavior is what every major user
of FreeType has been requesting.  Global advance is broken in many
CJK fonts.  Just ignoring it by default makes most sense.

* src/truetype/ttdriver.c (tt_get_advances),
src/truetype/ttgload.c (TT_Get_HMetrics, TT_Get_VMetrics,
tt_get_metrics, compute_glyph_metrics, TT_Load_Glyph),
src/truetype/ttgload.h: Implement it.

* docs/CHANGES: Updated.
2011-04-21 08:21:37 +02:00
suzuki toshiya 94eff482ca Fix mismatched indents in src/autofit/aflatin2.c. 2011-04-21 14:03:39 +09:00
suzuki toshiya a345c0e1d5 [autofit] Blur CJK stems if too many to preserve their gaps 2011-04-21 10:58:33 +09:00
Werner Lemberg d503b1bce2 Integrate autofitter debugging stuff.
* devel/ftoption.h, include/freetype/config/ftoption.h
(FT_DEBUG_AUTOFIT): New macro.

* include/freetype/internal/fttrace.h: Add trace components for
autofitter.

* src/autofit/aftypes.h (AF_LOG): Removed.
(_af_debug): Removed.

* src/autofit/*: s/AF_DEBUG/FT_DEBUG_AUTOFIT/.
s/AF_LOG/FT_TRACE5/.
Define FT_COMPONENT where necessary.
2011-04-18 19:05:28 +02:00
Werner Lemberg de2de6b1fb Remove dead debugging code. 2011-04-18 16:11:18 +02:00
Werner Lemberg 575078d2b4 Formatting nits. 2011-04-18 15:33:17 +02:00
Werner Lemberg 149f5438c4 Synchronize config files.
* builds/unix/ftconfig.in: Copy missing assembler routines from
include/freetype/config/ftconfig.h.
2011-04-18 15:09:38 +02:00
Werner Lemberg 9b00875093 Fix Savannah bug #33047.
Patch submitted by anonymous reporter.

* src/psaux/psobjs.c (ps_table_add): Use FT_PtrDist for pointer
difference.
2011-04-13 13:37:37 +02:00
Werner Lemberg b9baff23f4 Document BBox and CBox computation problems for tricky fonts. 2011-04-13 00:29:41 +02:00
Kan-Ru Chen 21b1a0de7c Fix reading of signed integers from files on 64bit platforms.
Previously, signed integers were converted to unsigned integers, but
this can fail because of sign extension.  For example, 0xa344a1eb
becomes 0xffffffffa344a1eb.

We now do the reverse which is always correct because the integer
size is the same during the cast from unsigned to signed.

* include/freetype/internal/ftstream.h, src/base/ftstream.c
(FT_Stream_Get*): Replace with...
(FT_Stream_GetU*): Functions which read unsigned integers.
Update all macros accordingly.

* src/gzip/ftgzip.c (ft_gzip_get_uncompressed_size): Updated.
2011-04-12 09:26:43 +02:00
Werner Lemberg 7f03a2465c Update Unicode ranges for CJK autofitter; in particular, add Hangul.
* src/autofit/afcjk.c (af_cjk_uniranges): Update to Unicode 6.0.
2011-04-07 07:20:38 +02:00
Werner Lemberg 948a8fb674 Fix formatting of autofit debug dumps.
* src/autofit/afhints.c (af_glyph_hints_dump_points,
af_glyph_hints_dump_segments, af_glyph_hints_dump_edges): Adjust
column widths.
2011-04-04 13:02:08 +02:00
Werner Lemberg 9f5ed8118c Cosmetics. 2011-04-02 07:23:00 +02:00
Werner Lemberg 544adf7313 Whitespace, typo. 2011-04-02 07:15:33 +02:00
Werner Lemberg ef11551868 * src/autofit/aftypes.h (AF_OutlineRec): Removed, unused. 2011-03-30 09:29:05 +02:00
Werner Lemberg 90f0487ff1 Cosmetics. 2011-03-28 15:41:49 +02:00
Werner Lemberg f3c57917f0 Copyright. 2011-03-26 09:03:32 +01:00
Werner Lemberg 360646c968 * src/cff/cfftypes.h (CFF_MAX_CID_FONTS): Increase to 256.
This limit is given on p. 37 of Adobe Tech Note #5014.
2011-03-24 09:29:23 +01:00
Werner Lemberg 01caf4a7a9 * src/truetype/ttpload.c(tt_face_load_loca): Fix mismatch warning. 2011-03-23 05:19:59 +01:00
Werner Lemberg 6e3fee0b54 Typo. 2011-03-21 09:28:52 +01:00
Werner Lemberg da08e6974c Ignore *.o and *.a files. 2011-03-20 18:28:31 +01:00
Werner Lemberg af7b8b1a9f * src/sfnt/sfobjs.c (sfnt_open_font): Check number of TTC subfonts. 2011-03-20 07:51:57 +01:00
Werner Lemberg 8bd77f9030 More C++ compilation fixes.
* src/autofit/afhints.c (af_glyph_hints_dump_points,
af_glyph_hints_dump_segments, af_glyph_hints_dump_edges)
[__cplusplus]: Protect with `extern "C"'.
2011-03-19 15:27:04 +01:00
Werner Lemberg c7f26a1982 C++ compilation fixes.
* src/autofit/aflatin.c (af_latin_hints_apply), src/autofit/afcjk.c
(af_cjk_hints_apply): Use cast for `dim'.
2011-03-19 02:28:21 +01:00
Alexei Podtelezhnikov 8fb8841430 A better fix for Savannah bug #32671.
* src/smooth/ftgrays.c (gray_render_conic): Clean up code and
replace WHILE loop with a more natural DO-WHILE construct.
2011-03-17 20:24:57 +01:00
Werner Lemberg 437fb8ebf8 * src/base/ftstroke.c (FT_StrokerRec): Remove unused `valid' field.
Suggested by Graham Asher.
2011-03-16 08:54:02 +01:00
Werner Lemberg cecd912747 Make FT_Sfnt_Table_Info return the number of SFNT tables.
* src/sfnt/sfdriver.c (sfnt_table_info): Implement it.
* include/freetype/tttables.h: Update documentation.
* docs/CHANGES: Updated.
2011-03-09 06:18:28 +01:00
Werner Lemberg d87389e9d3 Whitespace. 2011-03-08 05:01:21 +01:00
Bram Tassyns 3fd158d0ce Fix Savannah bug #27988.
* src/cff/cffobjs.c (remove_style): New function.
(cff_face_init): Use it to strip off the style part of the family
name.
2011-03-07 09:33:53 +01:00
Werner Lemberg 9c111b0179 * docs/CHANGES: Updated. 2011-03-07 06:07:53 +01:00
Werner Lemberg 6c045535ea Quick fix for Savannah bug #32671.
This isn't the optimal solution yet, but it restores the previous
rendering quality (more or less).

* src/smooth/ftgrays.c (gray_render_conic): Do more splitting.
2011-03-07 05:40:42 +01:00
Werner Lemberg c9bdfa7e65 Fix autohinting fallback.
* src/base/ftobjs.c (FT_Load_Glyph): Assure that we only check TTFs,
ignoring CFF-based OTFs.
2011-03-06 18:35:37 +01:00
Werner Lemberg 4d0586f0da Whitespace. 2011-03-06 18:22:08 +01:00
Werner Lemberg 576fc2c06e Add AF_CONFIG_OPTION_USE_WARPER to control the autofit warper.
* devel/ftoption.h, include/freetype/config/ftoption.h
(AF_CONFIG_OPTION_USE_WARPER): New macro.
* src/autofit/aftypes.h (AF_USE_WARPER): Remove.

* src/autofit/*: s/AF_USE_WARPER/AF_CONFIG_OPTION_USE_WARPER/.

* src/autofit/afwarp.c [!AF_CONFIG_OPTION_USE_WARPER]: Replace dummy
variable assignment with a typedef.
2011-03-02 03:52:36 +01:00
Werner Lemberg e547a656a5 [autofit] More comments, formatting, whitespace. 2011-02-26 18:39:10 +01:00
Werner Lemberg b7fc0c7461 [autofit] Slight simplifications.
* src/autofit/aflatin.c (af_latin_hints_link_segments): Remove
test which always returns false.
(af_latin_hints_compute_blue_edges): Remove redundant assignment.
2011-02-26 18:36:21 +01:00
Werner Lemberg 6cfbb23ca3 [autofit] Some comments. Whitespace. 2011-02-26 17:32:38 +01:00
Werner Lemberg e7d1fb3142 * docs/PROBLEMS: Mention rendering differences on different
platforms.
Suggested and worded by Jason Owen <jason.a.owen@gmail.com>.
2011-02-24 20:01:00 +01:00
Werner Lemberg 6c28689691 [autofit] Comment out unused code.
* src/autofit/aflatin.c, src/autofit/aflatin2.c
(af_latin_hints_compute_edges): Do it.
2011-02-24 05:52:14 +01:00
Werner Lemberg f42cc539e0 * src/autofit/afhints.h (AF_GlyphHints): Remove unused field. 2011-02-24 05:18:46 +01:00
Werner Lemberg 6af024231b [autofit] Add ASCII drawing for better explanation. 2011-02-22 10:29:30 +01:00
suzuki toshiya ae6d1d7b98 [cache] Fix an off-by-one bug in FTC_Manager_RemoveFaceID().
Found by <ychen1392001@yahoo.com.cn>, see detail in

  http://lists.gnu.org/archive/html/freetype/2011-01/msg00023.html

* src/cache/ftccache.c (FTC_Cache_RemoveFaceID): Check the node
buckets[cache->p + cache->mask] too.
2011-02-20 19:14:25 +09:00
Werner Lemberg 7ad15d5926 [autofit] Document warper. 2011-02-20 07:30:46 +01:00
Kevin Kofler ff8095077c Fall back to autohinting if a TTF/OTF doesn't contain any bytecode.
This is Savannah patch #7471.

* src/base/ftobjs.c (FT_Load_Glyph): Implement it.
2011-02-19 23:09:26 +01:00
John Tytgat 18fffa456e [cff] Fix subset prefix removal.
* src/cff/cffobjs.c (remove_subset_prefix): Update length after
subset prefix removal.
2011-02-19 07:11:17 +01:00
Werner Lemberg c5bda503b9 [autofit] Add a lot of comments and do some minor formatting. 2011-02-16 21:59:44 +01:00
Werner Lemberg dd6c38fac7 Convert to CRLF. 2011-02-14 08:37:30 +01:00
Bradley Grainger 70f7db113e Add inline assembly version of FT_MulFix for MSVC.
* include/freetype/config/ftconfig.h: Ported the FT_MulFix_i386
function from GNU inline assembly syntax (see #ifdef __GNUC__ block
above) to MASM syntax for Microsoft Visual C++.
2011-02-14 08:32:24 +01:00
Bradley Grainger d2731e104c Add project and solution files in Visual Studio 2010 format.
* builds/win32/.gitignore: Ignore user-specific cache files.
* builds/win32/vc2010/: Add VS2010 project & solution files, created
by upgrading builds/win32/vc2008/freetype.vcproj.
* objs/.gitignore: Ignore Visual Studio output files.
2011-02-14 08:32:24 +01:00
Werner Lemberg 713faece86 * src/autofit/afdummy.c: Include `aferrors.h'.
Problem reported by Chris Liddel <chris.liddell@artifex.com>.
2011-02-03 19:47:13 +01:00
Werner Lemberg 75df70600f [cff] Ignore unknown operators in charstrings.
Patch suggested by Miles.Lau <sunliang_liu@foxitsoftware.com>.

* src/cff/cffgload.c (cff_decoder_parse_charstrings): Emit tracing
message for unknown operators and continue instead of exiting with a
syntax error.
2011-02-01 07:36:27 +01:00
Werner Lemberg 18931a5a5d [truetype] FT_LOAD_PEDANTIC now affects `prep' and `fpgm' also.
* src/truetype/ttgload.c (tt_loader_init): Handle
`FT_LOAD_PEDANTIC'.
* src/truetype/ttobjs.c (tt_size_run_fpgm, tt_size_run_prep,
tt_size_init_bytecode, tt_size_ready_bytecode): New argument to
handle pedantic mode.
* src/truetype/ttobjs.h: Updated.
2011-02-01 07:08:43 +01: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 91a97164ca Whitespace. 2011-01-30 20:12:54 +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 332da87d99 [autofit] Some formatting and clean-ups. 2011-01-23 12:42:23 +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
suzuki toshiya 17f54bc66c Fix ARM assembly code in include/freetype/config/ftconfig.h.
* include/freetype/config/ftconfig.h (FT_MulFix_arm):
Copy the maintained code from builds/unix/ftconfig.in.
Old GNU binutils could not accept the reduced syntax
`orr %0, %2, lsl #16'.  Un-omitted syntax like RVCT,
`orr %0, %0, %2, lsl #16' is better.  Reported by
Johnson Y. Yan.  The bug report by Qt developers is
considered too.

http://bugreports.qt.nokia.com/browse/QTBUG-6521
2011-01-15 21:53:32 +09:00
Werner Lemberg 21bdca7907 [raster] Make bbox handling the same as with Microsoft's rasterizer.
Right before B/W rasterizing, the bbox gets simply rounded to
integers.  This fixes, for example, glyph `three' in font `Helvetica
Neue LT Com 65 Medium' at 11ppem.

Thanks to Greg Hitchcock who explained this behaviour.

* src/raster/ftrend1.c (ft_raster1_render): Implement it.
2011-01-15 09:46:13 +01:00
suzuki toshiya a2ef6647ae Copy -mcpu=* & -march=* options from CFLAGS to LDFLAGS.
* builds/unix/configure.raw: Consider recent gcc-standard
flags to specify architecture in CFLAGS & LDFLAGS
harmonization.  Requested by Savannah bug #32114, to
support multilib feature of BuildRoot SDK correctly.
2011-01-15 13:33:28 +09:00
suzuki toshiya c68a82d8fc Fix off-by-one bug in CFLAGS & LDFLAGS harmonizer.
* builds/unix/configure.raw: Some important options that
included in CFLAGS but not in LDFLAGS are copied to
LDFLAGS, but the last option in CFLAGS was not checked.
2011-01-15 13:21:32 +09:00
Werner Lemberg 0039d0120e [raster] Add undocumented drop-out rule to the other bbox side also.
* src/raster/ftraster.c (Vertical_Sweep_Drop,
Horizontal_Sweep_Drop): Implement it.
2011-01-14 19:44:29 +01:00
Werner Lemberg c02485cb72 [raster] Reduce jitter value.
This catches a rendering problem with glyph `x' from Tahoma at
10ppem.  It seems that the increase of the precision in the change
from 2009-06-11 makes a larger jitter value unnecessary.

* src/raster/ftraster.c (Set_High_Precision): Implement it.
2011-01-13 21:55:08 +01:00
Werner Lemberg 29bc310563 [raster] Handle drop-outs at glyph borders according to Microsoft.
If a drop-out rule would switch on a pixel outside of the glyph's
bounding box, use the right (or top) pixel instead.  This is an
undocumented feature, but some fonts like `Helvetica Neue LT Com 65
Medium' heavily rely on it.

Thanks to Greg Hitchcock who explained this behaviour.

* src/raster/ftraster.c (Vertical_Sweep_Drop,
Horizontal_Sweep_Drop): Implement it.
2011-01-13 12:22:55 +01:00
Werner Lemberg 3757b1e1c1 Cleanup/formatting. 2011-01-13 10:33:04 +01:00
suzuki toshiya 6b3bef2b20 Correct wrong years about recent commits in ChangeLog. 2011-01-09 23:11:18 +09:00
suzuki toshiya 5e7ad208e3 [cache] Fix Savannah bug #31923, patch drafted by Harsha.
When a node comparator changes the cached nodes during the
search of a node matching with queried properties, the
pointers obtained before the functon should be updated to
prevent the dereference to freed or reallocated nodes.
To minimize the rescan of the linked list, the update is
executed when the comparator notifies the change of cached
nodes. This change depends previous change:
38b272ffbb

* src/cache/ftccache.h (FTC_CACHE_LOOKUP_CMP): Rescan the
top node if the cached nodes are changed.
* src/cache/ftccache.c (FTC_Cache_Lookup): Ditto.
2011-01-09 23:09:36 +09:00
suzuki toshiya 38b272ffbb [cache] Notice if a cache query induced the node list change.
Some node comparators (comparing the cache node content and
the properties specified by the query) can flush the cache
node to prevent the cache inflation.  The change may
invalidate the pointers to the node obtained before the node
comparison, so the change should be noticed to the caller.
The problem caused by the cache node changing is reported by
Harsha, see Savannah bug #31923.

* src/cache/ftccache.h (FTC_Node_CompareFunc): Add new
argument `FT_Bool* list_changed' to indicate the change of
the cached nodes to the caller.
(FTC_CACHE_LOOKUP_CMP): Watch the change of the cached nodes
by `_list_changed'.
(FTC_CACHE_TRYLOOP_END): Take new macro argument `_list_changed'
and update it when FTC_Manager_FlushN() flushes any nodes.

* src/cache/ftccback.h (ftc_snode_compare): Updated to fit
with new FTC_Node_CompareFunc type.  (ftc_gnode_compare): Ditto.

* src/cache/ftcbasic.c: Include FT_INTERNAL_OBJECTS_H to
use TRUE/FALSE macros.  (ftc_basic_gnode_compare_faceid):
New argument `FT_Bool* list_changed' to indicate the change
of the cache nodes, anyway, it is always FALSE.

* src/cache/ftccmap.c: Include FT_INTERNAL_OBJECTS_H to
use TRUE/FALSE macros.  (ftc_cmap_node_compare):
New argument `FT_Bool* list_changed' to indicate the change
of the cache nodes, anyway, it is always FALSE.
(ftc_cmap_node_remove_faceid): Ditto.

* src/cache/ftccache.c (FTC_Cache_NewNode): Pass a NULL
pointer to FTC_CACHE_TRYLOOP_END(), because the result is
not needed.  (FTC_Cache_Lookup): Watch the change of the cache
nodes by `list_changed'.  (FTC_Cache_RemoveFaceID): Ditto.

* src/cache/ftcglyph.c: Include FT_INTERNAL_OBJECTS_H to
use TRUE/FALSE macros.  (ftc_gnode_compare): New argument
`FT_Bool* list_changed' to indicate the change of the cache
nodes, anyway, it is always FALSE.  (FTC_GNode_Compare):
New argument `FT_Bool* list_changed' to be passed to
ftc_gnode_compare().
* src/cache/ftcglyph.h (FTC_GNode_Compare): Ditto.

* src/cache/ftcsbits.c (ftc_snode_compare): New argument
`FT_Bool* list_changed' to indicate the change of the cache
nodes, anyway. It is updated by FTC_CACHE_TRYLOOP().
(FTC_SNode_Compare): New argument `FT_Bool* list_changed'
to be passed to ftc_snode_compare().
* src/cache/ftcsbits.h (FTC_SNode_Compare): Ditto.
2011-01-09 22:52:24 +09:00
suzuki toshiya 62d116f8d6 [cache] Fit FTC_GNode_Compare() to FTC_Node_CompareFunc.
* src/cache/ftcglyph.h (FTC_GNode_Compare): Add the 3rd
argument `FTC_Cache  cache' to fit FTC_Node_CompareFunc
prototype.
* src/cache/ftcglyph.c (FTC_GNode_Compare): Ditto. Anyway,
`cache' is not used by its child ftc_gnode_compare().
2011-01-09 22:38:10 +09:00
suzuki toshiya 9a2e255b23 [cache] Deduplicate the code to get the top node by a hash.
There are several duplicated codes getting the top node
from a cache by a given hash, like:

    idx = hash & cache->mask;
    if ( idx < cache->p )
      idx = hash & ( cache->mask * 2 + 1 );
    pnode = cache->buckets + idx;

To deduplicate them, a cpp-macro to do same work
FTC_NODE__TOP_FOR_HASH( cache, hash ) is introduced.
For non-inlined config, non-ftc_get_top_node_for_hash() is
also introduced.

* src/cache/ftccache.h (FTC_NODE__TOP_FOR_HASH): Declare
and implement inlined version.
(FTC_CACHE_LOOKUP_CMP): Use FTC_NODE__TOP_FOR_HASH().
* src/cache/ftccache.c (ftc_get_top_node_for_hash): Non-
inlined version.
(ftc_node_hash_unlink): Use FTC_NODE__TOP_FOR_HASH().
(ftc_node_hash_link): Ditto.
(FTC_Cache_Lookup): Ditto.
2011-01-09 21:09:58 +09:00
suzuki toshiya 52a1e47a5c [cache] inline-specific functions are conditionalized.
* src/cache/ftcglyph.c (FTC_GNode_Compare): Conditionalized
for inlined config.  This function is a thin wrapper of
ftc_gnode_compare() for inlined FTC_CACHE_LOOKUP_CMP()
(see `nodecmp' argument).  Under non-inlined config,
ftc_gnode_compare() is invoked by FTC_Cache_Lookup(),
via FTC_Cache->clazz.node_compare().

* src/cache/ftcglyph.h (FTC_GNode_Compare): Ditto.
* src/cache/ftcsbits.c (FTC_SNode_Compare): Ditto,
for ftc_snode_compare().
* src/cache/ftcsbits.h (FTC_SNode_Compare): Ditto.
2011-01-09 20:49:21 +09:00
suzuki toshiya 0de5b376d7 [cache] Correct a type mismatch under non-inlined config.
* src/cache/ftcglyph.h (FTC_GCACHE_LOOKUP_CMP):
FTC_GCache_Lookup() takes the node via a pointer `FTC_Node*',
differently from cpp-macro FTC_CACHE_LOOKUP_CMP().
2011-01-09 20:31:22 +09:00
suzuki toshiya 34f4b20a15 Update Jamfile to include Bzip2 support.
* Jamfile: Include src/bzip2 to project.
Comments for lzw, gzip, bzip2 are changed to clarify that
they are for compressed PCF fonts, not others.
(e.g. compressed BDF fonts are not supported yet)
2011-01-06 11:19:50 +09:00
Werner Lemberg a399588ae2 Improve `gasp' table documentation. 2011-01-05 22:21:33 +01:00
suzuki toshiya 55e6a6fadf Update Symbian project files to include Bzip2 support.
Currently, it provides FT_Stream_OpenBzip2() that returns
unimplemented error always, to prevent unresolved symbol
error for the applications designed for Unix systems.

* builds/symbian/bld.inf: Include ftbzip2.h.
* builds/symbian/freetype.mmp: Include ftbzip2.c.
2011-01-06 02:56:33 +09:00
suzuki toshiya 29cb6a6c31 Fix ChangeLog. 2011-01-06 02:53:21 +09:00
suzuki toshiya 017b4d5e7f Update classic MacOS makefiles to include Bzip2 support.
Currently, it provides FT_Stream_OpenBzip2() that returns
unimplemented error always, to prevent unresolved symbol
error for the applications designed for Unix systems.

* builds/mac/FreeType.m68k_cfm.make.txt: Include ftbzip2.c.o.
* builds/mac/FreeType.m68k_far.make.txt: Ditto.
* builds/mac/FreeType.ppc_carbon.make.txt: Include ftbzip2.c.x.
* builds/mac/FreeType.ppc_classic.make.txt: Ditto.
2011-01-06 02:49:52 +09:00
suzuki toshiya be683e7597 Update Amiga makefiles to include Bzip2 support.
Currently, it provides FT_Stream_OpenBzip2() that returns
unimplemented error always, to prevent unresolved symbol
error for the applications designed for Unix systems.

* builds/amiga/makefile: Include bzip2.ppc.o built from ftbzip2.c.
* builds/amiga/makefile.os4: Include bzip2.o built from ftbzip2.c.
* builds/amiga/smakefile: Ditto.
2011-01-06 02:44:53 +09:00
suzuki toshiya 41d7e4a6ed Update pkg-config tools to reflect Bzip2 support.
* builds/unix/freetype-config.in: Include `-lbz2' to
--libs output, if built with Bzip2 support.
* builds/unix/freetype2.in: Ditto.
2011-01-06 02:36:50 +09:00
suzuki toshiya 1909959973 * builds/unix/configure.raw: Remove `SYSTEM_BZ2LIB' macro.
SYSTEM_ZLIB is used to switch the builtin zlib source
or system zlib source out of FreeType2.  But ftbzip2
module has no builtin bzip2 library and always requires
system bzip2 library.  Thus SYSTEM_BZ2LIB is always yes,
it is not used.
2011-01-06 02:09:23 +09:00
Werner Lemberg f3ce237027 */rules.mk: Handle `*pic.c' files. 2011-01-03 07:11:54 +01:00
Werner Lemberg fa1e6b35b4 Formatting. 2011-01-03 06:50:36 +01:00
Werner Lemberg 91843dfc4a * src/cff/cfftypes.h (CFF_MAX_CID_FONTS): Increase to 64.
Problem reported by Tom Bishop <wenlin@wenlin.com>.
2010-12-31 19:30:53 +01:00
Werner Lemberg 13a91639a5 Enable bzip2 support for `make devel'. 2010-12-31 19:18:15 +01:00
Werner Lemberg fe42a65317 Improve bzip2 support.
* include/freetype/ftmoderr.h: Add bzip2.

* docs/INSTALL.ANY, docs/CHANGES: Updated.

* src/pcf/README: Updated.
* include/freetype/internal/pcftypes.h: Obsolete, removed.
2010-12-31 17:47:09 +01:00
Joel Klinghed ed913c2151 Add bzip2 compression support to handle *.pcf.bz2 files.
* builds/unix/configure.raw: Test for libbz2 library.

* devel/ftoption.h, include/freetype/config/ftoption.h
(FT_CONFIG_OPTION_USE_BZIP2): Define.
* include/freetype/config/ftheader.h (FT_BZIP2_H): Define.

* include/freetype/ftbzip2.h: New file.

* src/bzip2/*: New files.

* src/pcf/pcf.h: s/gzip_/comp_/.
* src/pcf/pcfdrvr.c: Include FT_BZIP2_H.
s/gzip_/comp_/.
(PCF_Face_Init): Handle bzip2 compressed files.

* docs/formats.txt, modules.cfg: Updated.
2010-12-31 16:59:33 +01:00
Harsha 7774ac67ec Apply Savannah patch #7422.
If we encouter a space in a string then the sbit buffer is NULL,
height and width are 0s.  So the check in ftc_snode_compare will
always pass for spaces (comparision with 255).  Here the comments
above the condition are proper but the implementation is not.  When
we create an snode I think it is the proper way to initialize the
width to 255 and then put a check for being equal to 255 in snode
compare function.

* src/cache/ftcsbits.c (FTC_SNode_New): Initialize sbit widths with
value 255.
(ftc_snode_compare): Fix condition.
2010-12-25 16:34:56 +01:00
Werner Lemberg 312d26a491 Fix parameter handling of `FT_Set_Renderer'.
Reported by Kirill Tishin <siege@bk.ru>.

* src/base/ftobjs.c (FT_Set_Renderer): Increment `parameters'.
2010-12-13 20:17:26 +01:00
Werner Lemberg 396b11b840 [cff] Allow `hlineto' and `vlineto' without arguments.
We simply ignore such instructions.  This is invalid, but it doesn't
harm; and indeed, there exist such subsetted fonts in PDFs.

Reported by Albert Astals Cid <aacid@kde.org>.

* src/cff/cffgload.c (cff_decoder_parse_charstrings)
[cff_op_hlineto]: Ignore instruction if there aren't any arguments
on the stack.
2010-12-09 23:16:18 +01:00
Werner Lemberg 9ec31cea16 * Version 2.4.4 released.
=========================

Tag sources with `VER-2-4-4'.

* docs/CHANGES: Updated.

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

* 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/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.3/2.4.4/, s/243/244/.

* include/freetype/freetype.h (FREETYPE_PATCH): Set to 4.

* builds/unix/configure.raw (version_info): Set to 12:2:6.
2010-11-28 16:07:49 +01:00
Werner Lemberg cd3224411e Update CHANGES. 2010-11-28 15:31:23 +01:00
Алексей Подтележников 7c4ac3cb0c [ftsmooth]: Minor code simplification.
* src/smooth/ftgrays (gray_render_cubic): Do only one comparison
instead of two.
2010-11-28 08:23:40 +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
John Tytgat ed7d1a59ff * src/psaux/t1decode.c (t1_decoder_parse_charstring): Expand
start_point, check_points, add_point, add_point1, close_contour
macros.
Remove add_contour macro.
Return error code from t1_builder_start_point and
t1_builder_check_points when there was one (instead of returning 0).
2010-11-23 19:30:38 +01:00
John Tytgat 391c79360b Fix outdated CVS reference.
* docs/INSTALL.UNIX: Fix outdated CVS references.
2010-11-23 19:07:51 +01:00
suzuki toshiya 51d488104f New entry in CHANGES 2010-11-23 04:28:11 +09:00
Werner Lemberg 9871b849dd Some formatting and improvements of comments. 2010-11-22 19:30:41 +01:00
suzuki toshiya 9f5dd61bf3 [truetype] Identify the tricky fonts by cvt/fpgm/prep checksums.
Some Latin TrueType fonts are still expected to be unhinted.
Fix Savannah bug #31645.

* src/truetype/ttobjs.c (tt_check_trickyness): Divided to...
(tt_check_trickyness_family): this checking family name, and
(tt_check_trickyness_sfnt_ids): this checking cvt/fpgm/prep.
(tt_get_sfnt_checksum): Function to retrieve the sfnt checksum
for specified subtable even if cleared by lazy PDF generators.
(tt_synth_sfnt_checksum): Function to calculate the checksum.
2010-11-23 02:47:10 +09:00
Werner Lemberg ec4372f565 [truetype] Fix `loca' handling for inconsistent number of glyphs.
Reported by Johnson Y. Yan <yinsen_yan@foxitsoftware.com>.

* src/truetype/ttpload.c (tt_face_load_loca): While sanitizing,
handle case where `loca' is the last table in the font.
2010-11-18 20:34:22 +01:00
Werner Lemberg fa764cf868 [sfnt] Ignore all errors while loading `OS/2' table.
Suggested by Johnson Y. Yan <yinsen_yan@foxitsoftware.com>.

* src/sfnt/sfobjs.c (sfnt_load_face): Do it.
2010-11-18 13:08:52 +01:00
Johnson Y. Yan b70d8a0ef6 [type1] Fix matrix normalization.
* src/type1/t1load.c (parse_font_matrix): Handle sign of scaling
factor.
2010-11-18 10:36:59 +01:00
Werner Lemberg f689bf7d9f [type1]: Improve guard against malformed data.
Based on a patch submitted by Johnson Y. Yan
<yinsen_yan@foxitsoftware.com>

* src/type1/t1load.c (read_binary_data): Check `size'.
2010-11-18 10:28:16 +01:00
Werner Lemberg 05012ad9c9 [sfnt] While tracing, output table checksums also.
* src/sfnt/ttload.c (tt_face_load_font_dir): Do it.
2010-11-17 11:47:53 +01:00
suzuki toshiya ac09390afc [UVS] Fix find_variant_selector_charmap(), Savannah bug #31545.
Since 2010-07-04, find_variant_selector_charmap() returns
the first cmap subtable always under rogue-compatible
configuration, it causes NULL pointer dereference and
make UVS-related functions crashed.

* src/base/ftobjs.c (Fix find_variant_selector_charmap):
Returns UVS cmap correctly.
2010-11-04 23:26:11 +09:00
suzuki toshiya b72e046098 [UVS] Remove non-essential pointer checking in previous commit. 2010-11-04 23:09:05 +09:00
suzuki toshiya e891e4d6f1 [UVS] Stabilizes UVS supporting functions against non-UVS fonts.
UVS supporting functions assume the variation handler functions
are valid.  When a font without cmap format 14 is given, these
function pointers are left as NULL, so calling these functions
causes NULL pointer dereference.

* src/base/ftobjs.c (FT_Face_GetCharVariantIndex): Check the pointer
FT_CMap_Class->char_var_index before calling it.
(FT_Face_GetCharVariantIsDefault): Check the pointer
FT_CMap_Class->char_var_default before calling it.
(FT_Face_GetVariantSelectors): Check the pointer
FT_CMap_Class->variant_list before calling it.
(FT_Face_GetVariantsOfChar): Check the pointer
FT_CMap_Class->charvariant_list before calling it.
(FT_Face_GetCharsOfVariant): Check the pointer
FT_CMap_Class->variantchar_list before calling it.
2010-11-04 21:53:11 +09:00
Alexei Podtelezhnikov 6aee69096f [ftsmooth] Improve rendering.
* src/smooth/ftsmooth.c (gray_render_conic): Since version 2.4.3,
cubic deviations have been estimated _after_ UPSCALE, whereas
conic ones have been evaluated _before_ UPSCALE, which produces
inferior rendering results.  Fix this.
Partially undo change from 2010-10-15 by using ONE_PIXEL/4; this has
been tested with demo images sent to the mailing list.  See

  http://lists.gnu.org/archive/html/freetype-devel/2010-10/msg00055.html

and later mails in this thread.
2010-11-02 16:01:03 +01:00
Werner Lemberg 6a96bbe275 [ftraster] Minor fixes.
Reported by Tom Bishop <wenlin@wenlin.com>.

* src/raster/ftraster.c (ULong): Remove unused typedef.
(TWorker): Remove unused variable `precision_mask'.
2010-10-28 08:51:15 +02:00
Werner Lemberg f0987abdc2 [ftraster] Fix rendering.
Problem reported by Tom Bishop <wenlin@wenlin.com>; see
thread starting with

  http://lists.gnu.org/archive/html/freetype/2010-10/msg00049.html

* src/raster/ftraster.c (Line_Up): Replace FMulDiv with SMulDiv
since the involved multiplication exceeds 32 bits.
2010-10-28 08:33:28 +02:00
suzuki toshiya 875439cfce Revert a change of `_idx' type in FTC_CACHE_LOOKUP_CMP().
* src/cache/ftccache.h (FTC_CACHE_LOOKUP_CMP): Revert
the type of `_idx' from FT_PtrDist (by previous change)
to original FT_UFast, to match with FT_CacheRec.
2010-10-25 15:43:01 +09:00
suzuki toshiya 3512a71269 [cache] Change the hash types to FT_PtrDist.
On LLP64 platforms (e.g. Win64), FT_ULong (32-bit)
variables are inappropriate to calculate hash values
from the memory address (64-bit).  The hash variables
are extended from FT_ULong to FT_PtrDist and new
hashing macro functions are introduced.  The hash
values on 16-bit memory platforms are changed, but
ILP32 and LP64 are not changed.  The hash value in
the cache subsystem is not reverted to the memory
address, so using signed type FT_PtrDist is safe.

* src/cache/ftccache.h (_FTC_FACE_ID_HASH): New hash
function to replace FTC_FACE_ID_HASH() for portability.
* src/cache/ftcmanag.h (FTC_SCALER_HASH): Replace
FTC_FACE_ID_HASH() by _FTC_FACE_ID_HASH().
* src/cache/ftccmap.c (FTC_CMAP_HASH): Ditto.

* src/cache/ftccache.h (FTC_NodeRec): The type of the
member `hash' is changed from FT_UInt32 to FT_PtrDist.

* src/cache/ftccache.h (FTC_Cache_Lookup): The type of the
argument `hash' is changed from FT_UInt32 to FT_PtrDist.
(FTC_Cache_NewNode): Ditto.
* src/cache/ftccache.c (ftc_cache_add): Ditto.
(FTC_Cache_Lookup): Ditto.  (FTC_Cache_NewNode): Ditto.
* src/cache/ftcglyph.h (FTC_GCache_Lookup): Ditto.
* src/cache/ftcglyph.c (FTC_GCache_Lookup): Ditto.

* src/cache/ftcbasic.c (FTC_ImageCache_Lookup): The type
of the internal variable `hash' is changed to FT_PtrDist
from FT_UInt32.  (FTC_ImageCache_LookupScaler): Ditto.
(FTC_SBitCache_Lookup): Ditto.
(FTC_SBitCache_LookupScaler): Ditto.
* src/cache/ftccmap.c (FTC_CMapCache_Lookup): Ditto.
* src/cache/ftccache.h (FTC_CACHE_LOOKUP_CMP): Ditto.
Also the type of the internal variable `_idx' is changed to
FT_PtrDist from FT_UInt32 for better pointer calculation.
2010-10-25 02:08:56 +09:00
suzuki toshiya 61590b73d1 [cache] Hide internal macros incompatible with LLP64.
FT_POINTER_TO_ULONG(), FTC_FACE_ID_HASH() and
FTC_IMAGE_TYPE_HASH() are enclosed by
FT_CONFIG_OPTION_OLD_INTERNALS and hidden from
normal clients.

For the history of these macros, see the investigation:
http://lists.gnu.org/archive/html/freetype/2010-10/msg00022.html
2010-10-25 01:12:09 +09:00
suzuki toshiya b8b498f2e2 Change the type of FT_MEM_VAL() from FT_ULong to FT_PtrDist.
On LLP64 platforms (e.g. Win64), unsigned long (32-bit)
cannot cover the memory address (64-bit).  FT_MEM_VAL() is
used for hashing only and not dereferred, so using signed
type FT_PtrDist is safe.

* src/base/ftdbgmem.c (FT_MEM_VAL): Change the type of the
return value from FT_ULong to FT_PtrDist.
(ft_mem_table_resize): The type of hash is changed to
FT_PtrDist.  (ft_mem_table_get_nodep): Ditto.
2010-10-25 00:35:59 +09: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 d1bf3e33f7 Copyright years. 2010-10-15 20:47:40 +02:00
Werner Lemberg 34d61e8637 Fix thinko in spline flattening.
FT_MAX_CURVE_DEVIATION is dependent on the value of ONE_PIXEL.

* src/smooth/ftgrays.c (FT_MAX_CURVE_DEVIATION): Remove it and
replace it everywhere with ONE_PIXEL/8.
2010-10-15 20:44:15 +02:00
suzuki toshiya 463dddadfb [raccess] Skip unrequired resource access rules by Darwin VFS.
When a resource fork access rule by Darwin VFS could open the
resource fork but no font is found in it, the rest of rules
by Darwin VFS are skipped.  It reduces the warnings of the
deprecated resource fork access method by recent Darwin kernel.
Fix MacPorts ticket #18859:
	http://trac.macports.org/ticket/18859

* src/base/ftobjs.c (load_face_in_embedded_rfork):
When FT_Stream_New() returns FT_Err_Cannot_Open_Stream, it
means that the file is possible to be fopen()-ed but zero-sized.
Also there is a case that the resource fork is not zero-sized,
but no supported font exists in it.  If a rule by Darwin VFS
falls into such cases, there is no need to try other Darwin VFS
rules anymore.  Such cases are marked by vfs_rfork_has_no_font.
If it is TRUE, the Darwin VFS rules are skipped.
2010-10-13 17:20:27 +09:00
suzuki toshiya c081a4a932 [raccess] Grouping resource access rules based on Darwin VFS.
MacOS X/Darwin kernel supports a few tricky methods to access
a resource fork via ANSI C or POSIX interface.  Current resource
fork accessor tries all possible methods to support all kernels.
But if a method could open a resource fork but no font is found,
there is no need to try other methods older than tested method.
To determine whether the rule index is for Darwin VFS, a local
function ftrfork.c::raccess_rule_by_darwin_vfs() is introduced.
To use this function in ftobjs.c etc but it should be inlined,
it is exposed by ftbase.h.

* src/base/ftrfork.c (FT_RFork_Rule): New enum type to identify
the rules to access the resource fork.
(raccess_guess_rec): New structure to bind the rule function and
rule enum type.
(FT_Raccess_Guess): The list of the rule functions is replaced by
(raccess_guess_table): This.  This is exposed to be used by other
intra module functions.
(raccess_rule_by_darwin_vfs): A function to return a boolean
if the rule specified by the rule index is based on Darwin VFS.
2010-10-13 17:05:42 +09:00
suzuki toshiya 4b71871418 Prevent to open a FT_Stream for zero-sized file on non-Unix.
builds/unix/ftsystem.c prevents to open an useless stream from
zero-sized file and returns FT_Err_Cannot_Open_Stream, but the
stream drivers for ANSI C, Amiga and VMS return useless streams.
For cross-platform consistency, all stream drivers should act
same.

* src/base/ftsystem.c (FT_Stream_Open): If the size of the opened
file is zero, FT_Err_Cannot_Open_Stream is returned.
* builds/amiga/src/base/ftsystem.c (FT_Stream_Open): Ditto.
* src/vms/ftsystem.c (FT_Stream_Open): Ditto.
2010-10-13 16:21:59 +09:00
Werner Lemberg 59eb9f8cfe Fix Savannah bug #31310.
* src/truetype/ttgxvar.c (ft_var_readpackedpoints): Protect against
invalid `runcnt' values.
2010-10-12 07:49:17 +02:00
Chris Liddell bc4ed48e41 Fix Savannah bug #31275.
* src/sfnt/ttpost.c: Include FT_INTERNAL_DEBUG_H.
2010-10-08 18:40:18 +02:00
Ed 4afa9d7443 Typo. 2010-10-08 12:05:40 +02: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
Werner Lemberg 94d540ef77 Fix Savannah bug #31253.
Patch submitted by an anonymous reporter.

* configure: Use `awk' instead of `sed' to manipulate output of `ls
-id'.
2010-10-05 12:28:15 +02:00
Werner Lemberg a5a32c15c5 * Version 2.4.3 released.
=========================

Tag sources with `VER-2-4-3'.

* docs/CHANGES: Updated.

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

* 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/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.2/2.4.3/, s/242/243/.

* include/freetype/freetype.h (FREETYPE_PATCH): Set to 3.

* builds/unix/configure.raw (version_info): Set to 12:1:6.
2010-10-03 20:36:03 +02:00
Werner Lemberg 1a414646a0 More whitespace. 2010-10-03 20:23:04 +02:00
Werner Lemberg 297ff852c0 Whitespace. 2010-10-03 20:22:23 +02:00
Werner Lemberg 75eeb32a2e Avoid `configure' issues with symbolic links.
Based on a patch from Alexander Stohr <Alexander.Stohr@gmx.de>.

* configure: Compare directories using `ls -id'.
Check existence of `reference' subdirectory before creating it.
2010-10-03 20:17:27 +02:00
Werner Lemberg 3987b15ef7 Fix Savannah bug #31088 (sort of).
* src/sfnt/ttload.c (tt_face_load_maxp): Always allocate at least 64
function entries.
2010-10-02 11:46:19 +02:00
Werner Lemberg 0e6fc09134 [smooth] Fix splitting of cubics for negative values.
Reported by Róbert Márki <gsmiko@gmail.com>; see
http://lists.gnu.org/archive/html/freetype/2010-09/msg00019.html.

* src/smooth/ftgrays.c (gray_render_cubic): Fix thinko.
2010-10-02 09:05:46 +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
Werner Lemberg 3343ecd82e Improve cache description.
Suggested by Gernot.Reisinger@omnino.at.
2010-10-01 07:48:01 +02:00
suzuki toshiya d2b8b8db8a [sfnt] Make error message filling NULL names less verbose.
* src/sfnt/ttpost.c (load_format_20): Showing 1 summary message
when we fill `post' names by NULL, instead of per-entry message.
2010-09-20 19:06:23 +09:00
Graham Asher e0a9a93330 [smooth] Fix and improve spline flattening.
This fixes the flattening of cubic, S-shaped curves and speeds up
the handling of both the conic and cubic arcs.

See the discussions on the freetype-devel mailing list in late
August and September 2010 for details.

* src/smooth/ftgrays.c (FT_MAX_CURVE_DEVIATION): New macro.
(TWorker): Remove `conic_level' and `cubic_level' elements.
(gray_render_conic): Simplify algorithm.
(gray_render_cubic): New algorithm; details are given in the code
comments.
(gray_convert_glyph): Remove heuristics.
2010-09-20 09:29:23 +02:00
Werner Lemberg d38ba0c92d Minor fixes.
* src/cff/cffload.c (cff_charset_compute_cids): `charset->sids[i]'
is `FT_UShort'.
(cff_index_access_element): Don't use additions in comparison.
* src/sfnt/ttpost.c (load_format_20): Make `post_limit' of type
`FT_Long'.
Don't use additions in comparison.
Improve tracing messages.
(load_format_25, load_post_names): Make `post_limit' of type
`FT_Long'.
2010-09-19 20:51:19 +02:00
suzuki toshiya 73aa20ca1d [cff] Truncate the element length at the end of the stream.
See Savannah bug #30975.

* src/cff/cffload.c (cff_index_access_element): `off2', the
offset to the next element is truncated at the end of the
stream to prevent invalid I/O.  As `off1', the offset to the
requested element has been checked by FT_STREAM_SEEK(),
`off2' should be checked similarly.
2010-09-20 01:31:42 +09:00
suzuki toshiya d2d843a01c [cff] Ignore CID > 0xFFFFU.
See Savannah bug #30975.

* src/cff/cffload.c (cff_charset_compute_cids): Ignore CID if
greater than 0xFFFFU.  CFF font spec does not mention about
maximum CID in the font, but PostScript and PDF spec define
that maximum CID is 0xFFFFU.
2010-09-20 01:28:17 +09:00
suzuki toshiya a0f43f207b [cff] Make trace message in cff_charset_load() verbose.
See Savannah bug #30975.

* src/cff/cffload.c (cff_charset_load): Report the original
`nleft' and truncated `nleft'.
2010-09-20 01:26:56 +09:00
suzuki toshiya b3e1954d16 [cff] Correct `max_cid' from CID array length to max CID.
See Savannah bug #30975.

* src/cff/cffload.c (cff_charset_compute_cids): Don't increment
max_cid after detecting max CID.  The array CFF_Charset->cids
is allocated by max_cid + 1.
(cff_charset_cid_to_gindex): Permit CID is less than or equal
to CFF_Charset->max_cid.
* src/cff/cffobjs.c (cff_face_init): FT_Face->num_glyphs is
calculated as CFF_Charset->max_cid + 1.
2010-09-20 01:24:44 +09:00
suzuki toshiya 643d49df09 [truetype] Sanitize the broken offsets in `loca'.
* src/truetype/ttpload.c (tt_face_get_location): If `pos1', the
offset to the requested entry in `glyf' exceeds the end of the
table, return offset=0, length=0.  If `pos2', the offset to the
next entry in `glyf' exceeds the end of the table, truncate
the entry length at the end of `glyf' table.
See Savannah bug #31040.
2010-09-20 01:16:39 +09:00
suzuki toshiya 900e7e0cde [sfnt] Prevent overrunning in `post' table parser.
* src/sfnt/ttpost.c (load_post_names): Get the length of
`post' table and pass the limit of `post' table to
load_format_20() and load_format_25().
(load_format_20): Stop the parsing when we reached at the
limit of `post' table.  If more glyph names are required,
they are filled by NULL names.  See Savannah bug #31040.
2010-09-20 01:05:26 +09: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 fd0cdb7b9e Ignore the environmental setting of LIBTOOL.
Patch is suggested by Adrian Bunk, to prevent unexpected
reflection of environmental LIBTOOL.  See:
http://savannah.nongnu.org/patch/?7290

* builds/unix/unix-cc.in: LIBTOOL is unconditionally set to
$(FT_LIBTOOL_DIR)/libtool.  FT_LIBTOOL_DIR is set to $(BUILD_DIR)
by default.
* configure: When configured for the building out of source tee,
FT_LIBTOOL_DIR is set to $(OBJ_DIR).
2010-08-31 18:32:03 +09: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 12cf031644 [ftraster] Pacify compiler.
* src/raster/ftraster.c (ft_black_new) [_STANDALONE_]: `memory' is
not used.
2010-08-29 17:24:30 +02:00
Werner Lemberg 0e95b3d15c [cff] Allow SIDs >= 65000.
* src/cff/cffload.c (cff_charset_load): Fix change from 2009-03-20:
The threshold for SIDs is not applicable here.  I misinterpreted the
`SID values 65000 and above are available for implementation use'
sentence in the CFF specification.

Problem reported by Ivan Ninčić <inincic@pdftron.com>.
2010-08-29 17:24:30 +02:00
suzuki toshiya 1ab1e9ae30 Fix ChangeLogs. 2010-08-29 06:04:51 +09:00
suzuki toshiya 0eb9b1f571 Force hinting when the font lacks its familyname.
In Type42 or Type11 font embedded in PostScript & PDF, TrueType
sfnt stream may lack `name' table because they are not required.
Hinting for nameless fonts is safer for PDFs including embedded
Chinese fonts. Written by David Bevan, see:

http://lists.gnu.org/archive/html/freetype-devel/2010-08/msg00021.html
http://lists.freedesktop.org/archives/poppler/2010-August/006310.html

* src/truetype/ttobjs.c (tt_check_trickyness): If a NULL pointer
by nameless font is given, TRUE is returned to enable hinting.
2010-08-28 21:42:28 +09:00
suzuki toshiya 8b05b5d801 Register yet another tricky TrueType font.
* src/truetype/ttobjs.c (tt_check_trickyness): Add `HuaTianKaiTi?',
a Kaishu typeface paired with `HuaTianSongTi?' by Huatian
Information Industry.
2010-08-28 21:16:26 +09:00
Werner Lemberg f434e29906 In the documentation, explain what `padding' means. 2010-08-21 09:01:51 +02:00
Teijo Kinnunen ebaeb6425e Fix Savannah bug #30788.
* src/cache/ftccache.c (FTC_Cache_Clear): Check `cache->buckets' for
NULL too.
2010-08-17 07:40:55 +02:00
Werner Lemberg a205b3ca85 Try to fix Savannah bug #30717 (and probably #30719 too).
* src/smooth/ftsmooth.c (ft_smooth_render_generic): Add another
overflow test for `width' and `height'.
2010-08-10 02:59:12 +02:00
Werner Lemberg e563216ddd Typo. 2010-08-07 09:15:34 +02:00
Werner Lemberg 6a8691eb6a * Version 2.4.2 released.
=========================

Tag sources with `VER-2-4-2'.

* docs/CHANGES: Updated.

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

* 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/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.1/2.4.2/, s/241/242/.

* include/freetype/freetype.h (FREETYPE_PATCH): Set to 2.

* builds/unix/configure.raw (version_info): Set to 12:0:6.
2010-08-06 22:00:38 +02:00
Werner Lemberg 7e370676f9 Synchronize devel/ftoption.h. 2010-08-06 21:59:22 +02:00
Werner Lemberg ba95440cd1 Minor doc fixes, formatting. 2010-08-06 20:07:36 +02:00
suzuki toshiya 445241589d Fix Savannah bug #30648.
* src/base/ftobjs.c (FT_Done_Library): Specify the order of font
drivers in face closing process. Type42 faces should be closed
before TrueType faces, because a Type42 face refers another
internal TrueType face which is created from sfnt[] array on the
memory.
2010-08-07 01:46:56 +09:00
Yuriy Kaminskiy c9de9cbd56 [raster] Fix valgrind warning.
* src/raster/ftraster.c (Decompose_Curve) <default>: Access point[0]
only if we don't hit `limit'.
2010-08-06 08:20:28 +02:00
suzuki toshiya 018f5c2781 Update docs/CHANGES to note that CFF stack overflow bug is fixed. 2010-08-06 14:12:54 +09:00
suzuki toshiya 81f3472c0b Fix Savannah bug #30658.
* src/base/ftobjs.c (Mac_Read_POST_Resource): Check the total
length of collected POST segments does not overrun the allocated
buffer.
2010-08-06 14:11:54 +09:00
Werner Lemberg 223cb1b57c [cff] Add comment to clarify current implementation of `pop' operator. 2010-08-06 06:55:09 +02:00
Werner Lemberg 948076cd85 Fix conditional usage of FT_MulFix_i386.
With -ansi flag, gcc does not define `i386', only `__i386__'.

* include/freetype/config/ftconfig.h, builds/unix/ftconfig.in:
s/i386/__i386__/.
2010-08-06 01:39:26 +02: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 c06da1ad34 Fix Savannah bug #30656.
* src/type42/t42parse.c (t42_parse_sfnts): Protect against negative
string_size.
Fix comparison.
2010-08-05 23:15:26 +02:00
suzuki toshiya d9b3e39484 [cff] Don't use any values in decoder after parsing error.
* src/cff/cffgload.c (cff_slot_load): Skip the evaluations
of the values in decoder, if cff_decoder_parse_charstrings()
returns any error.
2010-08-05 17:10:32 +09:00
Werner Lemberg 45a3c76b54 Fix Savannah bug #30644.
* src/base/ftstream.c (FT_Stream_EnterFrame): Fix comparison.
2010-08-04 15:54:55 +02:00
Werner Lemberg 32dc43a5cc `make devel' fails if FT_CONFIG_OPTION_OLD_INTERNALS is set.
* devel/ftoption.h: Synchronize with
include/freetype/config/ftoption.h.
2010-08-04 15:21:20 +02:00
Suzuki, Toshiya (鈴木俊哉) 11d65e8a1f [cff] Improve stack overflow test.
* src/cff/cffgload.c (cff_decoder_parse_charstrings): Check stack
after execution of operations too.
2010-08-04 14:43:29 +02:00
Werner Lemberg fe3433c736 Add reference counters and to FT_Library and FT_Face objects.
* include/freetype/freetype.h (FT_Reference_Face): New function.
* include/freetype/ftmodapi.h (FT_Rererence_Library): New function.

* include/freetype/internal/ftobjs.h (FT_Face_InternalRec,
FT_LibraryRec): New field `refcount'.

* src/base/ftobjs.c (FT_Open_Face, FT_New_Library): Handle
`refcount'.
(FT_Reference_Face, FT_Reference_Library): Implement new functions.
(FT_Done_Face, FT_Done_Library): Handle `refcount'.

* docs/CHANGES: Updated.
2010-07-18 18:41:47 +02:00
Werner Lemberg b69c6ac011 * Version 2.4.1 released.
=========================

Tag sources with `VER-2-4-1'.

* docs/CHANGES: Updated.

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

* 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/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.0/2.4.1/, s/240/241/.

* include/freetype/freetype.h (FREETYPE_PATCH): Set to 1.

* builds/unix/configure.raw (version_info): Set to 11:1:5.
2010-07-18 06:20:09 +02:00
Werner Lemberg 2de6b8a3db [cff] Final try to fix `hintmask' and `cntrmask' limit check.
Problem reported by Tobias Wolf <towolf@gmail.com>.

* src/cff/cffgload.c (cff_decoder_parse_charstrings)
<cff_op_hintmask>: Sigh.  I'm apparently too silly to fix this
correctly in less than three tries.
2010-07-17 13:39:50 +02:00
Werner Lemberg 072afbdbac Fix ChangeLog entry. 2010-07-13 06:26:46 +02:00
Werner Lemberg 15ffc3546d * Version 2.4.0 released.
=========================

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

* docs/CHANGES: Updated.

* docs/VERSION.DLL: Update documentation and bump version number to
2.4.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/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.3.12/2.4.0/, s/2312/240/.

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

* builds/unix/configure.raw (version_info): Set to 11:0:5.
2010-07-12 22:07:16 +02:00
Werner Lemberg 511b799926 Split ChangeLog. 2010-07-12 21:53:20 +02:00
Werner Lemberg 8c4b462a56 Typo. 2010-07-12 21:25:01 +02:00
Werner Lemberg c8f5b98be2 Remove C++ warnings.
*/*: Initialize pointers where necessary to make g++ happy.
2010-07-12 21:13:22 +02:00
malc f4e6c155f0 Fix type-punning issues with C++.
* include/freetype/internal/ftmemory.h (FT_ASSIGNP) [__cplusplus]:
Emulate a `typeof' operator with an inline template which uses
`static_cast'.
2010-07-12 20:57:54 +02:00
Werner Lemberg 7fa49cee58 Typo. 2010-07-12 00:33:36 +02:00
Werner Lemberg ebfd454a60 Fix C++ compilation issue.
* src/tools/apinames.c (names_dump) <OUTPUT_WATCOM_LBC>: Fix
typo of `dot' variable.
2010-07-11 09:28:21 +02:00
suzuki toshiya d594202ebb Fix another case reported in Savannah bug #30373.
Permit a face for Type1, Type42 and CFF without charmap,
patch by Tor Andersson.

* src/type1/t1objs.c (T1_Face_Init): Reset the error if it
is FT_Err_No_Unicode_Glyph_Name.
* src/type42/t42objs.c (T42_Face_Init): Ditto.
* src/cff/cffobjs.c (cff_face_init): Ditto.
2010-07-11 00:31:17 +09:00
suzuki toshiya 84fa62e0d7 Fix a mistake in t42objs.c in previous commit. 2010-07-09 23:43:14 +09:00
suzuki toshiya 840f208df4 Use defined macros to set {platform,encoding}_id.
* src/bdf/bdfdrivr.c: Include ttnameid.h and use macros to
set charmap.{platfom,encoding}_id.
* src/pcf/pcfdrivr.c: Ditto.
* src/winfonts/winfnt.c: Ditto.
* src/type1/t1objs.c: Ditto.
* src/type42/t42objs.c: Ditto.
* src/cff/cffobjs.c: Ditto.
* src/pfr/pfrobjs.c: Ditto.
2010-07-09 22:51:49 +09:00
suzuki toshiya 1e2a446d55 Capitalize ISO. 2010-07-09 22:14:35 +09:00
suzuki toshiya dfba8cfe56 Apple Unicode is not deprecated now. 2010-07-09 22:14:35 +09:00
suzuki toshiya bd62daf302 Unicode != ISO in the earliest TTF terminology. 2010-07-09 22:14:35 +09:00
suzuki toshiya b8ca6de365 Fix Savannah bug #30373.
Too serious check of errors by `FT_CMap_New' since 2010-07-04
is fixed. Reported by Tor Andersson.

* include/freetype/fterrdef.h
(PSnames_Err_No_Unicode_Glyph_Name): New error code to
indicate the Unicode charmap synthesis failed because
no Unicode glyph name is found.

* src/psnames/psmodule.c (ps_unicodes_init): Return
PSnames_Err_No_Unicode_Glyph_Name when no Unicode glyph name
is found in the font.
* src/cff/cffcmap.c (cff_cmap_unicode_init): Return
CFF_Err_No_Unicode_Glyph_Name when no SID is available.

* src/type1/t1objs.c (T1_Face_Init): Proceed if `FT_CMap_New'
is failed by the lack of Unicode glyph name.
* src/type42/t42objs.c (T42_Face_Init): Ditto.
* src/cff/cffobjs.c (cff_face_init): Ditto.
2010-07-09 20:50:34 +09:00
Ken Sharp 603d121872 Make ftraster.c compile in stand-alone mode with MSVC compiler.
* src/raster/ftmisc.h (FT_Int64) [_WIN32, _WIN64]: Fix typedef
since there is no `inttypes.h' for MSVC.
2010-07-09 09:55:29 +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 c73e160517 Pacify compiler.
* src/cff/cffload.c (cff_index_get_pointers): Initialize
`new_bytes'.
2010-07-06 10:44:56 +02:00
Eugene A. Shatokhin b33b856a27 Fix Savannah bug #27648.
* src/base/ftobjs.c (ft_remove_renderer, FT_Add_Module): Call
`raster_done' only if we have an outline glyph format.

Fix comment typo.
2010-07-05 22:36:30 +02:00
Werner Lemberg e8770c679b Fix Savannah bug #30030.
* builds/win32/*/freetype.vcproj: Add ftxf86.c.
2010-07-05 07:45:02 +02:00
Werner Lemberg 2dc76a4650 [cff] Next try to fix `hintmask' and `cntrmask' limit check.
Problem reported by malc <av1474@comtv.ru>.

* src/cff/cffgload.c (cff_decoder_parse_charstrings)
<cff_op_hintmask>: It is possible that there is just a single byte
after the `hintmask' or `cntrmask', e.g., a `return' instruction.
2010-07-05 06:40:02 +02:00
suzuki toshiya 0ae3271814 Restrict the number of the charmaps in a rogue-compatible mode.
Fix for Savannah bug #30059.

* src/cache/ftccmap.c (FTC_CMapCache_Lookup): Replace `16' the
minimum character code passed by a legacy rogue client by...
* include/freetype/config/ftoption.h (FT_MAX_CHARMAP_CACHEABLE):
This.  It is undefined when FT_CONFIG_OPTION_OLD_INTERNALS is
undefined (thus the rogue client compatibility is not required).

* src/cff/cffobjs.c (cff_face_init): Abort the automatic
selection or synthesis of Unicode cmap subtable when the charmap
index exceeds FT_MAX_CHARMAP_CACHEABLE.
* src/sfnt/ttcmap.c (tt_face_build_cmaps): Issue error message
when the charmap index exceeds FT_MAX_CHARMAP_CACHEABLE.

* src/base/ftobjs.c (find_unicode_charmap): When Unicode charmap
is found after FT_MAX_CHARMAP_CACHEABLE, ignore it and search
earlier one.
(find_variant_selector_charmap): When UVS charmap is found after
FT_MAX_CHARMAP_CACHEABLE, ignore it and search earlier one.
(FT_Select_Charmap): When a charmap matching with requested
encoding but after FT_MAX_CHARMAP_CACHEABLE, ignore and search
earlier one.
(FT_Set_Charmap): When a charmap matching with requested
charmap but after FT_MAX_CHARMAP_CACHEABLE, ignore and search
earlier one.
(FT_Get_Charmap_Index): When a requested charmap is found
after FT_MAX_CHARMAP_CACHEABLE, return the inverted charmap
index.
2010-07-05 09:59:03 +09:00
Werner Lemberg 8a6f3280f5 Version number update. 2010-07-04 07:49:03 +02:00
Werner Lemberg 6bbbbc1523 TrueType hinting is no longer patented.
* include/freetype/config/ftoption.h, devel/ftoption.h
(TT_CONFIG_OPTION_BYTECODE_INTERPRETER): Define.
(TT_CONFIG_OPTION_UNPATENTED_HINTING): Undefine.

* docs/CHANGES, docs/INSTALL, include/freetype/freetype.h: Updated.
* docs/TRUETYPE, docs/PATENTS: Removed.
2010-07-04 07:37:56 +02:00
Werner Lemberg ce27fd56fa Cosmetic changes. 2010-07-04 07:09:10 +02:00
suzuki toshiya a874c7ecca Check error value by `FT_CMap_New'.
* src/cff/cffobjs.c (cff_face_init): Check error value by
`FT_CMap_New'.
* src/pfr/pfrobjs.c (pfr_face_init): Ditto.
* src/type1/t1jobjs.c (T1_Face_Init): Ditto.
* src/type42/t42jobjs.c (T42_Face_Init): Ditto.
2010-07-04 12:08:41 +09:00
Werner Lemberg e017639710 Make ftgrays.c compile stand-alone again.
* src/smooth/ftgrays.c [_STANDALONE_]: Include `stddef.h'.
(FT_INT_MAX, FT_PtrDist)[_STANDALONE_]: Define.
2010-07-03 15:31:38 +02:00
suzuki toshiya b2ea64bcc6 Additional fix for Savannah bug #30306.
* src/base/ftobjs.c (Mac_Read_POST_Resource): If the type
of the POST fragment is 0, the segment is completely ignored.
The declared length of the segment is not cared at all.
According to Adobe Technical Note 5040, type 0 segment is
comment only and should not be loaded for the interpreter.
Reported by Robert Swiecki.
2010-07-02 18:19:39 +09:00
Werner Lemberg c2dabdeed0 Merge branch 'master' of git.sv.gnu.org:/srv/git/freetype/freetype2
Conflicts:
	ChangeLog
2010-07-02 01:27:49 +02:00
suzuki toshiya 5ef20c8c1d Initial fix for Savannah bug #30306.
* src/base/ftobjs.c (Mac_Read_POST_Resource): Check `rlen'
the length of fragment declared in the POST fragment header
and prevent an underflow in length calculation. Some fonts
set the length to zero in spite of the exist of following
16bit `type'. Reported by Robert Swiecki.
2010-07-01 18:39:04 +09: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
suzuki toshiya f29f741efb Additional fix for Savannah bug #30248 and #30249.
* src/base/ftobjs.c (Mac_Read_POST_Resource): Check the buffer
size during gathering PFB fragments embedded in LaserWriter PS
font for Macintosh. Reported by Robert Swiecki.
2010-07-01 17:32:40 +09:00
Werner Lemberg 6305b869d8 Fix Savannah bug #30263.
* src/smooth/ftgrays.c (gray_render_span): Use cast to `unsigned
int' to avoid integer overflow.

* src/smooth/ftsmooth.c (ft_smooth_render_generic): Use smaller
threshold values for `width' and `height'.  This is not directly
related to the bug fix but makes sense anyway.
2010-06-30 18:24:33 +02:00
Werner Lemberg 0ae6cf214f Minor optimizations by avoiding divisions.
* src/sfnt/ttkern.c (tt_face_load_kern, tt_face_get_kerning):
Replace divisions with multiplication in comparisons.
2010-06-30 10:26:48 +02:00
Werner Lemberg ae425e5189 Fix minor tracing issues.
* src/cff/cffgload.c, src/truetype/ttgload.c: Adjust tracing levels.
2010-06-29 12:31:08 +02:00
Werner Lemberg 18b552f6ae [cff] Really fix `hintmask' and `cntrmask' limit check.
* src/cff/cffgload.c (cff_decoder_parse_charstrings)
<cff_op_hintmask>: Fix thinko and handle tracing also.
2010-06-27 15:41:02 +02:00
Werner Lemberg 8bebaa74cc Fix valgrind warning.
* src/base/ftoutln.c (FT_Outline_Get_Orientation): Initialize
`result' array.
2010-06-27 15:10:15 +02:00
Werner Lemberg 4f7851e3d2 [cff] Fix memory leak.
* src/cff/cffgload.c (cff_operator_seac): Free charstrings even in
case of errors.
2010-06-27 13:03:54 +02:00
Werner Lemberg e9f0cdb6c0 [cff] Protect against invalid `hintmask' and `cntrmask' operators.
* src/cff/cffgload.c (cff_decoder_parse_charstrings)
<cff_op_hintmask>: Ensure that we don't exceed `limit' while parsing
the bit masks of the `hintmask' and `cntrmask' operators.
2010-06-27 12:34:19 +02:00
Werner Lemberg 1c70fcbc0a Fix PFR change 2010-06-24.
* src/pfr/pfrgload.c (pfr_glyph_load_simple): Really protect against
invalid indices.
2010-06-27 00:43:23 +02:00
Werner Lemberg 91ea0bf80d Improve PFR tracing messages.
* src/pfr/pfrgload.c (pfr_glyph_load_rec): Emit tracing messages for
simple and compound glyph offsets.
2010-06-26 22:46:38 +02:00
Werner Lemberg 82ad8ab242 Fix last PFR change.
* src/pfr/pfrobjs.c (pfr_face_init): Fix rejection logic.
2010-06-26 09:45:41 +02:00
Werner Lemberg 7d91173643 Fix Savannah bug #30262.
* src/sfnt/ttload.c (tt_face_load_maxp): Limit `maxComponentDepth'
arbitrarily to 100 to avoid stack exhaustion.
2010-06-26 09:29:51 +02:00
Werner Lemberg 75787c19ea Add some memory checks (mainly for debugging).
* src/base/ftstream.c (FT_Stream_EnterFrame): Exit with error
if the frame size is larger than the stream size.

* src/base/ftsystem.c (ft_ansi_stream_io): Exit with error if
seeking a position larger than the stream size.
2010-06-26 09:24:08 +02:00
Werner Lemberg ea5babaa67 Fix Savannah bug #30261.
* src/pfr/pfrobjs.c (pfr_face_init): Reject fonts which contain
neither outline nor bitmap glyphs.
2010-06-25 22:44:37 +02:00
Werner Lemberg e23ba91af7 Fix Savannah bug #30254.
* src/cff/cffload.c (cff_index_get_pointers): Do sanity check for
first offset also.
2010-06-25 21:55:14 +02:00
suzuki toshiya c69891a134 Initial fix for Savannah bug #30248 and #30249.
* src/base/ftobjs.c (Mac_Read_POST_Resource): Check the error during
reading a PFB fragment embedded in LaserWriter PS font for Macintosh.
Reported by Robert Swiecki.
2010-06-25 10:48:12 +09:00
Werner Lemberg 6fc12943e9 Fix Savannah bug #30247.
* src/pcf/pcfread.c (pcf_get_metrics): Disallow (invalid) fonts with
zero metrics.
2010-06-24 20:20:26 +02:00
Graham Asher e419f48b40 * src/smooth/ftgrays.c (gray_render_cubic): Fix algorithm.
The previous version was too aggressive, as demonstrated in
http://lists.gnu.org/archive/html/freetype-devel/2010-06/msg00020.html.
2010-06-24 12:50:46 +02:00
Werner Lemberg f765e4403c */*: Use module specific error names where appropriate. 2010-06-24 10:34:29 +02:00
Werner Lemberg 8b1c34da4c Fix Savannah bug #30236.
* src/sfnt/ttcmap.c (tt_face_build_cmaps): Improve check for pointer
to `cmap_table'.
2010-06-24 08:48:10 +02:00
Werner Lemberg 3cf87f4d27 Fix Savannah bug #30235.
* src/pfr/pfrgload.c (pfr_glyph_load_simple): Protect against
invalid indices if there aren't any coordinates for indexing.
2010-06-24 08:20:56 +02:00
Werner Lemberg b21d7bc567 [bdf]: Font properties are optional.
* src/bdf/bdflib.c (_bdf_readstream): Use special error code to
indicate a redo operation.
(_bdf_parse_start): Handle `CHARS' keyword here too and pass current
input line to `_bdf_parse_glyph'.
2010-06-24 07:40:49 +02:00
Werner Lemberg 8c2c2556af Whitespace. 2010-06-24 07:36:21 +02:00
Werner Lemberg fb69029a7a Fix Savannah bug #30220.
* include/freetype/fterrdef.h
(BDF_Err_Missing_Fontboundingbox_Field): New error code.

* src/bdf/bdflib.c (_bdf_parse_start): Check for missing
`FONTBOUNDINGBOX' field.
Avoid memory leak if there are multiple `FONT' lines (which is
invalid but doesn't hurt).
2010-06-23 10:00:52 +02:00
Werner Lemberg ddc4b136d6 Fix Savannah bug #30168.
* src/pfr/pfrgload.c (pfr_glyph_load_compound): Limit the number of
subglyphs to avoid endless recursion.
2010-06-21 09:28:32 +02:00
Werner Lemberg 90b07bd541 Fix Savannah bug #30145.
* src/psaux/psobjs.c (t1_builder_add_contour): Protect against
`outline == NULL' which might happen in invalid fonts.
2010-06-20 16:27:36 +02:00
Werner Lemberg f4c94d4b5f Fix Savannah bug #30135.
* src/bdf/bdflib.c (_bdf_list_join): Don't modify value in static
string `empty'.
(_bdf_parse_glyph): Avoid memory leak in case of error.
2010-06-19 16:08:31 +02:00
Werner Lemberg 5d86cdce7e Fix Savannah bug #30108.
* src/autofit/afglobal.c (af_face_globals_compute_script_coverage):
Properly mask AF_DIGIT bit in comparison.
2010-06-15 08:29:30 +02:00
Werner Lemberg 8d22746c9e Fix Savannah bug #30106.
Point numbers for FreeType's implementation of hinting masks are
collected before the final number of points of a glyph has been
determined; in particular, the code for handling the `endchar'
opcode can reduce the number of points.

* src/pshinter/pshalgo.c (psh_glyph_find_strong_points): Assure that
`end_point' is not larger than `glyph->num_points'.
2010-06-12 01:32:20 +02:00
Werner Lemberg 3624110cc2 [cff]: Improve debugging output.
* src/cff/cffgload.c (cff_decoder_parse_charstrings)
<cff_op_hintmask>: Implement it.
2010-06-11 23:00:22 +02:00
Graham Asher 7fb3ef64a2 ftgrays: Speed up rendering of small cubic splines.
* src/smooth/ftgrays.c (gray_render_cubic): Implement new,
simplified algorithm to find out whether the spline can be replaced
with two straight lines.  See this thread for more:

  http://lists.gnu.org/archive/html/freetype-devel/2010-06/msg00000.html
2010-06-10 08:10:57 +02:00
Werner Lemberg ad61f178e2 Oops, revert unwanted previous commit for ftgrays.c. 2010-06-09 15:18:57 +02:00
Werner Lemberg 7d3d2cc4fe Fix Savannah bug #30082.
* src/cff/cffgload.c (cff_decoder_parse_charstrings)
<cff_op_callothersubr>: Protect against stack underflow.
2010-06-09 09:14:09 +02:00
Werner Lemberg a4124bf088 Fix Savannah bug #30053.
* src/cff/cffparse (cff_parse_real): Handle border case where
`fraction_length' has value 10.
2010-06-08 09:21:39 +02:00
Werner Lemberg 370aea802c Formatting. 2010-06-08 08:37:11 +02:00
Werner Lemberg d087199f2c Fix Savannah bug #30052.
This bug has been introduced with commit 2415cbf3.

* src/base/ftobjs.c (FT_Get_First_Char, FT_Get_Next_Char): Protect
against endless loop in case of corrupted font header data.
2010-06-07 08:46:01 +02:00
Werner Lemberg c217bf19f0 Remove unused variable.
Found by Graham.

* src/autofit/afhints.c (af_glyph_hints_reload): Remove unused
variable `first' in first block.
2010-05-26 16:16:34 +02:00
Werner Lemberg e30de299f2 Fix various memory problems found by linuxtesting.org.
* src/base/ftgxval.c (FT_TrueTypeGX_Free, FT_ClassicKern_Free),
src/base/ftotval.c (FT_OpenType_Free), src/base/ftpfr.c
(ft_pfr_check): Check `face'.

* src/base/ftobjs.c (FT_Get_Charmap_Index): Check `charmap' and
`charmap->face'.
(FT_Render_Glyph): Check `slot->face'.
(FT_Get_SubGlyph_Info): Check `glyph->subglyphs'.

Improve API documentation.
2010-05-22 20:03:41 +02:00
Werner Lemberg 09344385ee autofit: Remove dead code.
Suggested by Graham.

* src/autofit/afhints.c (af_glyph_hints_compute_inflections):
Removed.
(af_glyph_hints_reload): Remove third argument.
Update all callers.
2010-05-22 07:43:22 +02:00
Bram Tassyns d7cc8f499a Fix Savannah bug #27987.
* src/cff/cffobjs.c (remove_subset_prefix): New function.
(cff_face_init): Use it to adjust `cffface->family_name'.
2010-05-21 10:14:58 +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
Hongbo Ni 236fc8e15a Apply patch #7196.
* src/cff/cffgload.c (cff_slot_load): Prevent crash if CFF subfont
index is out of range.
2010-05-18 11:00:39 +02:00
Werner Lemberg 4c66924440 * docs/formats.txt: Give pointer to PCF documentation.
Information provided by Alan Coopersmith
<alan.coopersmith@oracle.com>.
2010-05-11 07:24:28 +02:00
Werner Lemberg 30b8480bbb Whitespace. 2010-05-11 00:06:02 +02:00
Ken Sharp 88169b107a Fix Savannah bug #29846.
Previously we discovered fonts which used `setcurrentpoint' to set
the initial point of a contour to 0,0.  This caused FreeType to
raise an error, because the `setcurrentpoint' operator is only
supposed to be used with the results from an OtherSubr subroutine.

This was fixed by simply ignoring the error and carrying on.

Now we have found a font which uses setcurrentpoint to actually
establish a non-zero point for a contour during the course of a
glyph program.  FWIW, these files may be produced by an application
called `Intaglio' on the Mac, when converting TrueType fonts to
Type 1.

The fix allows the new invalid behaviour, the old invalid behaviour
and real proper usage of the operator to work the same way as Adobe
interpreters apparently do.

(t1_decoder_parse_charstrings): Make `setcurrentpoint' use the top
two elements of the stack to establish unconditionally the current x
and y coordinates.

Make the `flex' subroutine handling (OtherSubr 0) put the current
x,y coordinates onto the stack, instead of two dummy uninitialised
values.
2010-05-11 00:03:33 +02:00
Ken Sharp 54e63755f3 Fix Savannah bug #29444.
* src/psaux/psobjs.c (t1_builder_start_point): Accept (invalid)
`lineto' immediately after `hsbw', in accordance with Acrobat, GS,
and others.
2010-04-14 23:38:35 +02:00
Michał Cichoń 08e254e0a6 Fix Savannah bug #27999.
* src/cache/ftcmanag.c (FTC_Manager_RemoveFaceID): Only remove
selected entry, not all.
2010-04-14 21:25:30 +02:00
Werner Lemberg 4b407fff2e Typo. 2010-04-14 15:47:04 +02:00
Jonathan Kew 25e742c573 Add overflow check to `fvar' table.
* src/truetype/ttgxvar.c (TT_Get_MM_Var): Check axis and instance
count.
2010-04-06 16:42:56 +02:00
Ken Sharp 7baeeafcec Fix Savannah bug #29335.
* src/raster/ftraster.c (Line_Up): Use slow multiplication to
prevent overflow.  This shouldn't have any serious impact on speed,
however.
2010-04-05 11:19:38 +02:00
Werner Lemberg 460d23f168 Add new function `FT_Library_SetLcdFilterWeights'.
This is based on code written by Lifter
<http://unixforum.org/index.php?showuser=11691>.  It fixes
FreeDesktop bug #27386.

* src/base/ftlcdfil.c (FT_Library_SetLcdFilterWeights): New
function.

* include/freetype/ftlcdfil.h: Updated.

* docs/CHANGES: Updated.
2010-04-05 08:46:26 +02:00
John Tytgat 8c4cce5259 Fix Savannah bug #29404.
* src/truetype/ttgload.c: Revert change 2752bd1a (check on bit 1
of `head' table of TrueType fonts).
2010-04-05 08:22:22 +02:00
suzuki toshiya f00957c1c1 Fix a typo in include/freetype/ftsystem.h. 2010-03-16 11:00:02 +09:00
suzuki toshiya cef43bde8e Fix `multi build' for Tytgat's CFF driver improvement.
* src/base/cffload.h (cff_index_get_name): Added.
2010-03-14 23:12:13 +09:00
suzuki toshiya 199f04f33d Remove duplicated inclusion of `FT_OUTLINE_H' in ftobjs.c. 2010-03-12 14:48:57 +09:00
Chris Liddell 6c0d881418 Fix Savannah bug #27442.
* src/raster/ftraster.c (ft_black_reset): Fix `buffer_size'.
2010-03-11 18:27:31 +01:00
Werner Lemberg 763300a97c Remove unused variable.
Reported by Graham.

* src/cff/cffparse.c (cff_parse_real): Remove `rest'.
2010-03-09 17:01:21 +01:00
Werner Lemberg daae9025c7 Formatting. 2010-03-04 10:43:31 +01:00
Werner Lemberg 03b3da8bb6 Improve CFF string (especially glyphname) lookup performance.
We do this by avoiding memory allocation and file I/O.  This is
Savannah patch #7104.

* src/cff/cfftypes.h: Include PS cmaps service and
FT_INTERNAL_POSTSCRIPT_HINTS_H.
(CFF_SubFontRec): Remove `num_local_subrs'.
(CFF_FontRec): Add `num_strings', `strings', and `string_pool'
fields.
Remove `string_index' and `num_global_subrs' fields.
Use real types instead of `void' for `pshinter' and `psnames' fields.

* src/cff/cffload.c: Don't include PS cmaps service.
(cff_index_get_pointers): Add `pool' parameter which allows to
insert an extra NUL character for each String INDEX entry.
(cff_index_get_name): Make it a local function.
(cff_index_get_string): New function.
(cff_subfont_load): Updated.
(cff_font_load): Initialize `num_strings', `strings', and
`string_pool' fields in the `CFF_FontRec' structure.
(cff_index_get_sid_string): Use `cff_index_get_string' instead of
`cff_index_get_name'.
(cff_font_done): Updated.

* src/cff/cffload.h: Don't include PS cmaps service.
(cff_index_get_string): Added.
(cff_index_get_sid_string): Updated.

* src/cff/cffobjs.c: Don't include PS cmaps service and
FT_INTERNAL_POSTSCRIPT_HINTS_H.
(cff_size_get_globals_funcs, cff_slot_init): Updated.
(cff_face_init): Follow `cff_index_get_name',
`cff_index_get_string', and `cff_index_get_sid_string' changes.

* src/cff/cffcmap.c (cff_sid_free_glyph_name): Removed.
(cff_sid_to_glyph_name): Use `cff_index_get_cid_string'.
(cff_cmap_unicode_init): Updated.

* src/cff/cffdrivr.c: Don't include PS cmap service.
(cff_get_glyph_name): Avoid unnecessary lookup for POSTSCRIPT_CMAPS
service.
(cff_get_glyph_name, cff_ps_get_font_info, cff_get_ros): Follow API
`cff_index_get_sid_string' change.
(cff_get_name_index): Use `cff_index_get_string' instead of
`cff_index_get_name'.

* src/cff/cffgload.c: Don't include FT_INTERNAL_POSTSCRIPT_HINTS_H.
(cff_decoder_init, cff_decoder_prepare): Updated.
2010-03-02 13:00:55 +01:00
Werner Lemberg e0717d4f48 Simplify code.
Suggested by Behdad.

* src/base/ftobjs.c (FT_Get_First_Char): Don't use a loop since we
call FT_Get_Next_Char anyway if necessary.
2010-02-27 08:10:11 +01:00
Behdad Esfahbod 2415cbf365 Improve handling of invalid glyph indices in char->index functions.
* src/base/ftobjs.c (FT_Get_First_Char, FT_Get_Next_Char): Use a
loop.
2010-02-26 23:48:53 +01:00
Chris Liddell 10cf388795 Fix Savannah bug #28905.
Initialize phantom points before calling the incremental interface
to update glyph metrics.

* src/truetype/ttgload.c (tt_get_metrics_incr_overrides)
[FT_CONFIG_OPTION_INCREMENTAL]: New function, split off from...
(tt_get_metrics): This.
Updated.
(load_truetype_glyph): Use tt_get_metrics_incr_overrides.
2010-02-18 17:09:30 +01:00
Werner Lemberg a546af7684 Improve documentation. 2010-02-14 10:04:11 +01:00
Werner Lemberg b36d4192a3 * Version 2.3.12 released.
==========================

Tag sources with `VER-2-3-12'.

* docs/CHANGES: Updated.

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

* 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/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.3.11/2.3.12/, s/2311/2312/.

* include/freetype/freetype.h (FREETYPE_PATCH): Set to 12.

* builds/unix/configure.raw (version_info): Set to 10:0:4.
2010-02-13 07:57:56 +01:00
Werner Lemberg 129799c652 Add some files to Windows project files. 2010-02-13 07:53:37 +01:00
Werner Lemberg 3e5c88856d Doc fix. 2010-02-13 07:53:37 +01:00
Werner Lemberg 233642aa8b Minor doc fixes. 2010-02-13 07:53:37 +01:00
suzuki toshiya ad6954a0cb Improve autotool version checking to work with beta releases. 2010-02-13 02:25:04 +09:00
suzuki toshiya 93eaf50aae Fix overallocating bug in FT_Outline_New_Internal(). 2010-02-13 01:08:33 +09:00
Ken Sharp 63e7aac34f Really fix Savannah bug #28678 (part 2).
Since we consider `sbw' for the horizontal direction only, we still have
to synthesize vertical metrics if the user wants to use the vertical
writing direction.

* src/cff/cffgload.c (cff_slot_load), src/cid/cidgload.c
(cid_slot_load_glyph), src/type1/t1gload.c (T1_Load_Glyph):
Synthesize vertical metrics (only) if FT_LOAD_VERTICAL_LAYOUT is
set.
2010-02-10 07:13:27 +01:00
Ken Sharp 980b76ea5e Really fix Savannah bug #28678 (part 1).
After long discussion, we now consider the character width vector
(wx,wy) returned by the `sbw' Type 1 operator as being part of *one*
direction only.  For example, if you are using the horizontal
writing direction, you get the horizontal and vertical components of
the advance width for this direction.  Note that OpenType and CFF fonts
don't have such a vertical component; instead, the GPOS table can be
used to generate two-dimensional advance widths (but this isn't
handled by FreeType).

* include/freetype/ftincrem.h (FT_Incremental_MetricsRec): Add
`advance_v' field to hold the vertical component of the advance
value.

* src/truetype/ttgload.c (tt_get_metrics), src/cff/cffgload.c
(cff_slot_load), src/type1/t1gload.c
(T1_Parse_Glyph_And_Get_Char_String), src/cid/cidgload.c
(cid_load_glyph): Use it.
2010-02-10 07:02:43 +01:00
Werner Lemberg db9a41e81b * devel/ftoption.h [FT_CONFIG_OPTION_PIC]: Define.
Other minor documentation fixes.
2010-02-09 15:43:24 +01:00
Werner Lemberg 2d43503901 Minor documentation improvement. 2010-02-09 07:40:56 +01:00
suzuki toshiya d9145241fe Prevent NULL pointer dereference passed to FT_Module_Requester. 2010-02-05 02:58:24 +09:00
suzuki toshiya c9669a8a63 [sfnt] Fix memory leaks in previous patch. 2010-01-30 02:24:25 +09:00
suzuki toshiya 75852eda51 New parameters for FT_Open_Face() to ignore preferred family names. 2010-01-29 23:18:34 +09:00
Ken Sharp f19e46f3ba Fix Savannah bug #28678.
* src/cff/cffgload.c (cff_slot_load), src/cid/cidgload.c
(cid_load_glyph): Handle vertical metrics correctly.

* src/type1/t1gload.c (T1_Parse_Glyph_And_Get_Char_String): Handle
vertical metrics correctly.
(T1_Load_Glyph): Don't synthesize vertical metrics.
2010-01-27 10:04:50 +01:00
Werner Lemberg f0760ca6e8 We no longer use CVS. 2010-01-23 16:19:33 +01:00
Werner Lemberg 85a477b2ee Improve FT_BBox documentation.
From David Bevan.
2010-01-23 13:17:27 +01:00
Werner Lemberg b8f245bd77 Improve documentation of FT_BBox. 2010-01-21 08:41:41 +01:00
Werner Lemberg 13fa21bd5e Make FT_Set_Transform work if no renderer is available.
* src/base/ftobjs.c (FT_Load_Glyph): Apply `standard' transformation
if no renderer is compiled into the library.
2010-01-14 21:34:08 +01:00
Werner Lemberg d40cd0b4a4 Fix compilation warning. 2010-01-14 20:32:21 +01:00
Werner Lemberg 5ebda893c3 Fix compilation instructions without our build system. 2010-01-14 20:13:23 +01:00
Werner Lemberg df870f3e15 Provide inline assembly code for RVCT compiler.
This is Savannah patch #7059.

* include/freetype/config/ftconfig.h (FT_MULFIX_ASSEMBLER,
FT_MulFix_arm) [__CC_ARM || __ARM_CC]: Define.
2010-01-11 06:28:56 +01:00
Werner Lemberg 2ad9158008 Whitespace. 2010-01-09 08:22:38 +01:00
Werner Lemberg 644f88fa72 Typo. 2010-01-09 08:21:36 +01:00
Werner Lemberg 1ac5e0ec76 Documentation typo. 2010-01-09 08:14:26 +01:00
Ken Sharp 8ea31415f4 Fix Savannah bug #28521.
Issue #28226 involved a work-around for a font which used the
`setcurrentpoint' operator in an invalid way; this operator is only
supposed to be used with the result of OtherSubrs, and the font used
it directly.  The supplied patch removed the block of code which
checked this usage entirely.

This turns out to be a Bad Thing.  If `setcurrentpoint' is being
used correctly it should reset the flex flag in the decoder.  If we
don't do this then the flag never gets reset and we omit any further
contours from the glyph (at least until we close the path or
similar).

* src/psaux/t1decode.c (t1_decoder_parse_charstrings)
<op_setcurrentpoint>: Handle `flex_state' correctly.
2010-01-08 18:13:02 +01:00
Werner Lemberg 297dc2235a Another clang fix. 2010-01-05 20:48:57 +01:00
Werner Lemberg fc58155afc Apply reports from clang static analyzer.
* src/lzw/ftlzw.c (ft_lzw_file_init), src/base/ftstroke.c
(FT_Stroker_ParseOutline), src/base/ftsynth.c
(FT_GlyphSlot_Embolden): Remove dead code.

* src/base/ftpatent.c (_tt_check_patents_in_table): Initialize
`offset_i'.
2010-01-05 20:00:35 +01:00
Ralph Giles bc0082d512 Improve the comment describing the FT_CONFIG_OPTION_INCREMENTAL option. 2010-01-05 19:41:22 +01:00
Ralph Giles e383729536 Enable the incremental font interface by default.
Ghostscript requires the incremental font interface for handling
some Postscript documents.  It is moving to using FreeType as its
primary renderer; supporting this in the default build makes it
Ghostscript to be linked against the system FreeType when one is
available.

* include/freetype/config/ftoption.h (FT_CONFIG_OPTION_INCREMENTAL):
Uncomment.
2010-01-05 19:36:58 +01:00
Werner Lemberg 1fc440b222 Typo. 2010-01-05 13:39:37 +01:00
Werner Lemberg 2a33275e3a Fix Savannah bug #28395.
* src/truetype/ttdriver.c (Load_Glyph), src/type1/t1gload.c
(T1_Loada_Glyph): Don't check `num_glyphs' if incremental interface
is used.
2010-01-05 10:27:15 +01:00
Werner Lemberg 942d92c9c0 Minor fixes. 2010-01-05 10:24:25 +01:00
Werner Lemberg fe6da50d04 Thinkos. 2010-01-05 10:10:15 +01:00
Ken Sharp dbe5622335 Make Type 1 `seac' operator work with incremental interface.
* src/psaux/t1decode.c (t1operator_seac): Don't check `glyph_names'
if incremental interface is used.
2010-01-05 09:43:01 +01:00
Werner Lemberg 3445e4f942 Make incremental interface work with TrueType fonts.
* src/truetype/ttgload.c (load_truetype_glyph): Don't check
`glyf_offset' if incremental interface is used.
2010-01-04 15:53:27 +01:00
Werner Lemberg c32b178934 Minor documentation fix. 2010-01-03 14:09:03 +01:00
Lars Abrahamsson 8cf9b74cf0 Make compilation with FT_CONFIG_OPTION_PIC work again.
* src/base/ftglyph.c (FT_Glyph_To_Bitmap) [FT_CONFIG_OPTION_PIC]:
Declare `library' for FT_BITMAP_GLYPH_CLASS_GET.

* src/base/ftinit.c (ft_destroy_default_module_classes,
ft_create_default_module_classes): Use proper casts (needed for C++
compilation).

* src/sfnt/ttcmap.c (tt_cmap13_class_rec): Use FT_DEFINE_TT_CMAP.
2009-12-31 18:26:14 +01:00
Werner Lemberg 173bdc681a Minor addition. 2009-12-22 00:27:29 +01:00
Marc Kleine-Budde 978b11dc59 Make freetype-config aware of $SYSROOT.
* builds/unix/freetype-config.in: Decorate with ${SYSROOT} where
appropriate.
2009-12-22 00:25:38 +01:00
Werner Lemberg 64ed303897 Whitespace. 2009-12-20 18:12:57 +01:00
Werner Lemberg f4fe5a4a7f Fix compiler warning.
Reported by Sean.

* src/base/ftdbgmem.c [!FT_DEBUG_MEMORY]: ANSI C doesn't like empty
source files; however, some compilers warn about an unused variable
declaration.  This is now replaced with a typedef.
2009-12-20 17:56:22 +01:00
Werner Lemberg 7bdc1d598d Fix Savannah bug #28320.
There exist corrupt, subsetted fonts (embedded in PDF files) which
contain a private dict that ends with an unterminated floating point
number (no operator following).  We now ignore this error (as
acrobat does).

* src/cff/cffparse.c (cff_parser_run): Don't emit a syntax error for
unterminated floating point numbers.
2009-12-18 07:13:22 +01:00
Werner Lemberg 94cdb3f045 Comment fixes. 2009-12-16 20:47:21 +01:00
Werner Lemberg 7da7ad9457 Really fix compiler warnings.
Reported by Sean.

* src/truetype/ttgxvar.c (GX_PT_POINTS_ARE_WORDS,
GX_PT_POINT_RUN_COUNT_MASK): Convert enum values to macros.
2009-12-16 18:13:55 +01:00
Werner Lemberg 0770de9aac Typos. 2009-12-16 08:36:24 +01:00
suzuki toshiya d818ba5979 Improve configure.raw to copy some options from CFLAGS to LDFLAGS. 2009-12-16 13:23:14 +09:00
Werner Lemberg 481324cd36 Fix compiler warnings.
Reported by Sean.

* src/truetype/ttgxvar.c (ft_var_readpackeddeltas): Fix counter data
type.
2009-12-15 08:58:37 +01:00
Ken Sharp ce41259372 Ignore invalid `setcurrentpoint' operations in Type 1 fonts.
This fixes Savannah bug #28226.

At least two wild PostScript files of unknown provenance contain
Type 1 fonts, apparently converted from TrueType fonts in earlier
PDF versions of the files, which use the `setcurrentpoint' operator
inappropriately.

FreeType currently throws an error in this case, but Ghostscript and
Adobe Distiller both accept the fonts and ignore the problem.  This
commit #ifdefs out the check so PostScript interpreters using
FreeType can render these files.

The specification says `setcurrentpoint' should only be used to set
the point after a `Subr' call, but these fonts use it to set the
initial point to (0,0).  Unnecessarily so, as they correctly use an
`hsbw' operation which implicitly sets the initial point.
2009-12-14 22:32:32 +01:00
Werner Lemberg 2db9783869 Fix parsing of /CIDFontVersion.
This fixes Savannah bug #28287.

* src/cid/cidtoken.h: `cid_version' in CID_FaceInfoRec (in
t1tables.h) is of type FT_Fixed.
2009-12-14 22:17:26 +01:00
Werner Lemberg 8d14b6f4fd Trace glyph index in CID module.
Suggested in Savannah patch #7023.

* src/cid/cidgload.c (cid_load_glyph): Add tracing message.
2009-12-14 07:55:39 +01:00
Werner Lemberg 9045f5bdf2 Fix compiler warnings.
* src/truetype/ttgload.c (tt_get_metrics): Put `Exit' label into the
proper preprocessor conditional.
* src/pfr/pfrobjs.c (pfr_slot_load): Pacify gcc.
2009-12-03 05:57:30 +01:00
John Tytgat 087b7ea667 Better handling of start of `eexec' section.
This fixes Savannah bug #28090.

* src/type1/t1parse.c (T1_Get_Private_Dict): Skip all whitespace
characters before start of `eexec' section.
2009-11-25 23:51:06 +01:00
Werner Lemberg a5e9dbd528 Fix Savannah bug #27742.
* src/base/ftstroke.c (ft_stroker_outside): Avoid silent division by
zero, using a threshold for `theta'.
2009-11-20 09:33:57 +01:00
Werner Lemberg 934d054f45 Fix Savannah bug #28036.
* src/type1/t1afm.c (t1_get_index): Fix comparison.
2009-11-20 06:26:22 +01:00
Werner Lemberg 0197508440 Fix compiler warnings.
Reported by Kevin Blenkinsopp <arqon@promode.org>.

* src/sfnt/ttload.c (check_table_dir): Use proper data type.
2009-11-16 23:10:53 +01:00
Werner Lemberg 0aa1de621c s/casted/cast/ 2009-11-15 10:53:50 +01:00
Werner Lemberg 7635ba64b7 Really fix FreeDesktop bug #21197.
This also fixes Savannah bug #28021.

* src/autofit/aflatin.c (af_latin_metrics_check_digits),
src/autofit/aflatin2.c (af_latin2_metrics_check_digits): Fix loop.
2009-11-15 10:17:44 +01:00
Werner Lemberg c4b22144d3 Add tracing messages for advance values.
* src/base/ftobjs.c (FT_Load_Glyph), src/truetype/ttgload.c
(TT_Get_HMetrics, TT_Get_VMetrics): Do it.
2009-11-15 10:10:00 +01:00
Werner Lemberg c0aeef4571 Fix compiler warning.
Reported by Jeremy Manson <jeremy.manson@gmail.com>.

* src/truetype/ttgload.c (load_truetype_glyph): Initialize `error'.
2009-11-08 07:58:05 +01:00
Werner Lemberg c6e4180c05 Remove compiler warning.
Reported by Sean McBride <sean@rogue-research.com>.

* src/tools/apinames.c (read_header_file)<STATE_TYPE>: Use a cast to
`int', as specified in the printf(3) man page.
2009-11-04 12:18:48 +01:00
Werner Lemberg 012552f143 Fix Savannah bug #27921.
* src/cff/cffobjs.c (cff_face_init), src/cid/cidobjs.c
(cid_face_init), src/type1/t1afm.c (T1_Read_Metrics),
src/type1/t1objs.c (T1_Face_Init): Don't use unsigned constant
values for rounding if the argument can be negative.
2009-11-04 10:06:04 +01:00
Bram Tassyns 8821cc5df1 Add basic support for Type1 charstrings in CFF.
* src/cff/cffgload.c (CFF_Operator, cff_argument_counts): Handle
`seac', `sbw', and `setcurrentpoint' opcodes.
(cff_compute_bias): Add parameter to indicate the charstring type.
Update all callers.
(cff_operator_seac): Add parameter for side bearing.
(cff_decoder_parse_charstrings): Updated for more Type1 support.
2009-11-04 07:21:15 +01:00
Werner Lemberg f186ba682d Return correct `linearHoriAdvance' value for embedded TT bitmaps too.
Reported by Jeremy Manson <jeremy.manson@gmail.com>.

src/truetype/ttgload.c (load_truetype_glyph): Add parameter to
quickly load the glyph header only.
Update all callers.
(tt_loader_init): Add parameter to quickly load the `glyf' table
only.
Update all callers.
(TT_Load_Glyph): Compute linear advance values for embedded bitmap
glyphs too.
2009-11-03 15:46:35 +01:00
Werner Lemberg 422210be64 Improve code readability.
* src/ttgload.c (load_truetype_glyph): Move metrics calculation
to...
(tt_get_metrics): This new function.
2009-11-03 08:11:02 +01:00
Werner Lemberg ac0d52d851 Whitespace. 2009-11-02 08:35:24 +01:00
Werner Lemberg 350444d480 Improve documentation of the various advance values. 2009-11-02 08:12:45 +01:00
Werner Lemberg c4bdb73571 Minor doc fix.
Found by Ian Britten.
2009-11-02 07:25:01 +01:00
Werner Lemberg 939bc785f2 Mention all used licenses. 2009-10-29 09:28:27 +01:00
bram tassyns 06ba45978d Fix Savannah bug #27811.
* src/truetype/ttxgvar.c (ft_var_readpackeddeltas): Fix
signed/unsigned mismatch.
2009-10-26 22:26:31 +01:00
Werner Lemberg 38449dceaf Whitespace. 2009-10-26 07:26:25 +01:00
Werner Lemberg 2d15120cb5 Fix handling of `get' and `put' CFF instructions.
* src/cff/cffgload.c (cff_decoder_parse_charstrings) <cff_op_get,
cff_op_put>: Appendix B of Adobe Technote #5177 limits the number of
elements for the `get' and `put' operators to 32.
* src/cff/cffgload.h (CFF_MAX_TRANS_ELEMENTS): Define.
(CFF_Decoder): Use it for `buildchar' and remove `len_buildchar'.
2009-10-19 21:09:13 +02:00
Werner Lemberg d90567b1e6 Fix handling of `dup' CFF instruction.
Problem and solution reported by Ning Dong <flintning@163.com>.

* src/cff/cffgload.c (cff_decoder_parse_charstrings) <cff_op_dup>:
Increase `args' by 2, not 1.
2009-10-18 10:47:11 +02:00
Werner Lemberg e1e723012d Documentation typo. 2009-10-18 09:47:52 +02:00
Werner Lemberg dd9d7ca7ae Typos. 2009-10-10 21:19:35 +02:00
Werner Lemberg d699c2994e * Version 2.3.11 released.
==========================

Tag sources with `VER-2-3-11'.

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

* README, Jamfile (RefDoc), builds/win32/visualc/index.html,
builds/win32/visualc/freetype.dsp,
builds/win32/visualc/freetype.vcproj,
builds/win32/visualce/index.html,
builds/win32/visualce/freetype.dsp,
builds/win32/visualce/freetype.vcproj: s/2.3.10/2.3.11/, s/2310/2311/.

* include/freetype/freetype.h (FREETYPE_PATCH): Set to 11.

* builds/unix/configure.raw (version_info): Set to 9:22:3.
2009-10-10 20:25:48 +02:00
Werner Lemberg 3c4e6baadb * docs/CHANGES, docs/release: Updated. 2009-10-10 20:15:49 +02:00
suzuki toshiya 008686a123 [pcf] Fix a bug in the nprops truncation, Gentoo bug #288357. 2009-10-11 02:07:16 +09:00
Werner Lemberg 19dfcbd2a4 * Version 2.3.10 released.
==========================

Tag sources with `VER-2-3-10'.

* builds/toplevel.mk (major, minor, patch): Fix regexp to allow more
than a single digit.
(dist): We now use git.

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

* README, Jamfile (RefDoc), builds/win32/visualc/index.html,
builds/win32/visualc/freetype.dsp,
builds/win32/visualc/freetype.vcproj,
builds/win32/visualce/index.html,
builds/win32/visualce/freetype.dsp,
builds/win32/visualce/freetype.vcproj: s/2.3.9/2.3.10/, s/239/2310/.

* include/freetype/freetype.h (FREETYPE_PATCH): Set to 10.

* builds/unix/configure.raw (version_info): Set to 9:21:3.
2009-10-06 12:00:43 +02:00
Werner Lemberg bcdde60e5d Whitespace. 2009-10-06 11:14:19 +02:00
Werner Lemberg 5c3160ec14 Formatting. 2009-10-06 11:12:28 +02:00
Werner Lemberg ca87cd0bda Fix `make multi'.
* src/cache/ftccache.c, src/cache/ftcsbits.c (FT_COMPONENT): Define.

* src/sfnt/sfdriver.c: Include FT_INTERNAL_DEBUG_H.
2009-10-06 11:09:29 +02:00
suzuki toshiya 6167357e8f [cache] Fold too long lines. 2009-09-29 03:19:47 +09:00
suzuki toshiya 82633a2440 [cache] Fix Savannah bug #27441, cleanup Redhat bugzilla #513582. 2009-09-27 16:55:44 +09:00
suzuki toshiya f2647ddabb [cache, psaux, type1] Fix for multi build. 2009-09-26 00:48:37 +09:00
suzuki toshiya 76f1b9d9cf [autofit] Fix for multi build. 2009-09-25 23:57:30 +09:00
suzuki toshiya 4e0c9ee155 [cache] Check the face filled by FTC_Manager_LookupFace(). 2009-09-24 14:30:40 +09:00
Werner Lemberg e2184505b1 * docs/CHANGES: Updated. 2009-09-23 09:28:48 +02:00
Werner Lemberg 766b822f4c [raster] Fix 5-levels grayscale output.
This was broken since version 2.3.0.

* src/raster/ftraster.c (count_table): Use pre-2.3.0 values (which
were then computed dynamically).
(Vertical_Gray_Sweep_Step): Updated.

(ft_black_render): Initialize `worker->gray_lines' (problem found by
valgrind).

(FT_RASTER_OPTION_ANTI_ALIASING, DEBUG_RASTER): Dont' #undef, just
comment out.
2009-09-12 23:15:17 +02:00
suzuki toshiya 812d1bc90d Improve configure.raw for cross build. 2009-09-13 02:12:44 +09:00
suzuki toshiya 704f4d75cd [BDF] Modify hash API to take size_t value instead of void *. 2009-09-13 00:50:14 +09:00
suzuki toshiya 519a5eafd7 Whitespace. 2009-09-13 00:00:28 +09:00
suzuki toshiya 0729bc9f52 [Win64] Improve the computation of random seed from stack address. 2009-09-10 16:09:55 +09:00
Werner Lemberg fecb7a60fa Replace CR line endings with CRLF in Visual C/CE project files. 2009-09-10 07:36:11 +02:00
Werner Lemberg d30062d25c Whitespace. 2009-09-08 07:06:54 +02:00
Werner Lemberg 4539b3eec8 Whitespace. 2009-09-08 07:05:26 +02:00
Werner Lemberg 5e240c1270 [raster] Improvements for stand-alone mode.
* src/raster/rules.mk: Don't handle ftmisc.h.  It is needed for
stand-alone mode only.

* src/raster/ftmisc.h (FT_MemoryRec , FT_Alloc_Func, FT_Free_Func,
FT_Realloc_Func): Copy declarations from ftsystem.h.
2009-09-03 13:14:24 +02:00
Bram Tassyns 4694ea2b95 Improve vertical metrics calculation (Savannah bug #27364).
The calculation of `vertBearingX' is not defined in the OTF font
spec so FreeType does a `best effort' attempt.  However, this value
is defined in the PDF and PostScript specs, and that algorithm is
better than the one FreeType currently uses:

  FreeType: Use the middle of the bounding box as the X coordinate
            of the vertical origin.

  Adobe PDF spec: Use the middle of the horizontal advance vector as
                  the X coordinate of the vertical origin.

FreeType's algorithm goes wrong if you have a really small glyph
(like the full-width, circle-like dot at the end of the sentence, as
used in CJK scripts) with large bearings.  With the FreeType
algorithm this dot gets centered on the baseline; with the PDF
algorithm it gets the correct location (in the top right).  Note
that this is a serious issue, it's like printing the dot at the end
of a Roman sentence at the center of the textline instead of on the
baseline like it should. So i believe the PDF spec's algorithm
should be used in FreeType as well.

The `vertBearingY' value for such small glyphs is also very strange
if no `vmtx' information is present, since the height of the bbox is
not representable for the height of the glyph visually (the
whitespace up to the baseline is part of the glyph).  The fix also
includes some code for a better estimate of `vertBearingY'.

* src/base/ftobjs.c (ft_synthesize_vertical_metrics): `vertBearingX'
is now calculated as described by the Adobe PDF Spec.  Estimate for
`vertBearingY' now works better for small glyphs completely above or
below the baseline into account.

* src/cff/cffgload.c (cff_slot_load): `vertBearingX' is now
calculated as described by the Adobe PDF Spec.  Vertical metrics
information was always ignored when FT_CONFIG_OPTION_OLD_INTERNALS
was not defined.

* src/truetype/ttgload.c (compute_glyph_metrics): `vertBearingX' is
now calculated as described by the Adobe PDF Spec.
2009-09-02 13:06:33 +02:00
John Tytgat 03e8b2f763 Fix custom cmap for empty Type 1 font (Savannah bug #27294).
* include/freetype/internal/t1types.h (T1_EncodingRecRec_): Update
comment to reflect revised code_last meaning.
* src/type1/t1load.c (T1_Open_Face), src/type42/t42objs.c
(T42_Open_Face): Assign max_char as highest character code + 1 and
use this for T1_EncodingRecRec_::code_last.
* src/psaux/t1cmap.c (t1_cmap_custom_init): Follow revised
T1_EncodingRecRec_::code_last meaning.
2009-09-01 08:10:24 +02:00
Ralph Giles 17904a107a Document that FT_Get_X11_Font_Format() is a general call.
This function was originally added to return the underlying font
format in a way which was compatible with the needs of the XFree86
font server.  However, a function of this sort is also necessary when
freetype is used by PDF interpreters which apply different rules
based on the font format.

The X11 namespace is confusing for such users.  This commit ameliorates
that confusion by documenting that this function is in fact entirely
internal to freetype and doesn't depend on X11 in any way.
2009-08-28 09:08:00 +02:00
Werner Lemberg d77cd8ce7e Fix rendering of horizontally compressed CFFs.
Bug reported by Ivan Nincic <inincic@pdftron.com>.

* src/cff/cffgload.c (cff_slot_load): Thinko: Check `xx' element of
`font_matrix' also.

* docs/CHANGES: Updated.
2009-08-27 00:10:56 +02:00
Su Yu efaf5abcf8 Don't call `ft_fseek' every time when executing `ft_fread'.
* src/base/ftstream.c (FT_Stream_Seek), src/base/ftsystem.c
(ft_ansi_stream_io): Implement it.
2009-08-03 19:55:58 +02:00
suzuki toshiya 2b6a3f0be9 sfnt: Cast a charcode to 32-bit in cmap format 14 parser. 2009-08-01 00:37:59 +09:00
suzuki toshiya 9b1aab8d1e sfnt: Cast a charcode to 32-bit in cmap format 12 parser. 2009-08-01 00:37:58 +09:00
suzuki toshiya e6d0c1fb9c psaux: Fix a few casts to FT_Int32 value. 2009-08-01 00:37:58 +09:00
suzuki toshiya b76c3f718d sfnt: Fix a data type mismatching with its source. 2009-08-01 00:37:57 +09:00
suzuki toshiya 2a2beb47c4 sfnt: Extend a few local variables to load 32-bit values. 2009-08-01 00:37:57 +09:00
suzuki toshiya 3783dac000 pfr: Extend `num_aux' to take 32-bit value. 2009-08-01 00:37:56 +09:00
suzuki toshiya 3bda1f9949 pcf: Truncate FT_ULong `nprops' to fit to int PCF_Face->nprops. 2009-08-01 00:37:56 +09:00
suzuki toshiya 8eb551f1b3 gxvalid: Extend a few local variables to reduce the casts. 2009-08-01 00:37:55 +09:00
suzuki toshiya d365997759 gxvalid: Extend `settingTable' to take 32-bit offset. 2009-08-01 00:37:55 +09:00
suzuki toshiya 6e2375f72c autofit: Cast FT_Long glyph_count to compare with FT_UInt GID. 2009-08-01 00:37:54 +09:00
suzuki toshiya 057bc4c071 smooth: Exclude 16-bit system in invalid pitch/height check. 2009-08-01 00:35:40 +09:00
suzuki toshiya b16a942671 cff: Type large constants > 0x7FFF as long for 16-bit systems. 2009-08-01 00:32:25 +09:00
suzuki toshiya 5133c56f2f base: Remove an unused variable. 2009-08-01 00:32:25 +09:00
suzuki toshiya 5d3ff05615 cache: Check higher bits in flags for non ILP32 systems. 2009-08-01 00:32:24 +09:00
suzuki toshiya 61adbe980a sfnt: Ignore invalid GIDs in glyph name lookup. 2009-08-01 00:32:24 +09:00
suzuki toshiya eec405540d pcf: Fix a comparison between FT_Long and FT_ULong. 2009-08-01 00:32:24 +09:00
suzuki toshiya eceaffef3e gxvalid: Guarantee `nFeatureFlags' size up to 32-bit. 2009-08-01 00:32:23 +09:00
suzuki toshiya cad4f91555 sfnt: Insert explicit cast for LP64 system. 2009-08-01 00:32:23 +09:00
suzuki toshiya 2f07c57f5a gxvalid: Guarantee `just' table size upto 32-bit. 2009-08-01 00:32:22 +09:00
suzuki toshiya 205a2a0cce gxvalid: Guarantee `trak' table size upto 32-bit. 2009-08-01 00:32:22 +09:00
suzuki toshiya 49740490e1 type1: Fix a data type mismatching with its source. 2009-08-01 00:32:22 +09:00
suzuki toshiya 737634e5e4 pfr: Fix a data type mismatching with its source. 2009-08-01 00:32:21 +09:00
suzuki toshiya b12b8c3ce4 pfr: Fix a data type mismatching with its source. 2009-08-01 00:32:21 +09:00
suzuki toshiya c4420d97f4 pfr: Fix a data type mismatching with its source. 2009-08-01 00:32:21 +09:00
suzuki toshiya 471980d9dc smooth: Improve the format in debug message. 2009-08-01 00:32:20 +09:00
suzuki toshiya 0105905052 sfnt: Fix a data type mismatching with its source. 2009-08-01 00:32:20 +09:00
suzuki toshiya cf31edf5ee psaux: Fix a data type mismatching with its source. 2009-08-01 00:32:19 +09:00
suzuki toshiya ec7bc863fb truetype: Extend TrueType GX packed deltas to FT_Offset. 2009-08-01 00:32:19 +09:00
suzuki toshiya 5668181bda truetype: Extend mmvar_len to hold size_t values. 2009-08-01 00:32:18 +09: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 9206eba291 truetype: Truncate the deltas of composite glyph at 16-bit values. 2009-08-01 00:32:17 +09:00
suzuki toshiya 1b6f1d20b5 truetype: Truncate the instructions upto 16-bit per a glyph. 2009-08-01 00:32:16 +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
suzuki toshiya 9fc4094375 truetype: Cast the scaling params to 32-bit for LP64 system. 2009-08-01 00:32:14 +09:00
suzuki toshiya c9c6438840 sfnt: Cast a character code to FT_UInt32 for LP64 system. 2009-08-01 00:32:14 +09:00
suzuki toshiya 3f0182afb2 sfnt: Cast a character code to FT_UInt32 for LP64 system. 2009-08-01 00:32:13 +09:00
suzuki toshiya 9c1aac0011 sfnt: Extend TT_BDF->strings_size to FT_ULong for huge BDF. 2009-08-01 00:32:13 +09:00
suzuki toshiya 259568cf68 psaux: Handle the string length by FT_Offset variables. 2009-08-01 00:32:13 +09:00
suzuki toshiya 75d56e5d79 pcf: Fix some data types mismatching with their sources. 2009-08-01 00:32:12 +09:00
suzuki toshiya c595c06c61 pcf: Handle the string length by size_t variables. 2009-08-01 00:32:12 +09:00
suzuki toshiya 78ba8a610c pcf: Fix some data types mismatching with their sources. 2009-08-01 00:32:11 +09:00
suzuki toshiya 52170ac0ce otvalid: Truncate the glyph index to 16-bit. 2009-08-01 00:32:11 +09:00
suzuki toshiya f7c6b11691 cache: Insert explict casts for LP64 systems. 2009-08-01 00:32:10 +09:00
suzuki toshiya ed1d359025 cache: Fix some data types mismatching with their sources. 2009-08-01 00:32:10 +09:00
suzuki toshiya 3f0f2e462b XXX_cmap_encoding_char_next() return FT_UInt32 values. 2009-08-01 00:32:09 +09:00
suzuki toshiya 25dba9cfa8 truetype: Extend TT_Face->num_locations for broken TTFs. 2009-08-01 00:32:09 +09:00
suzuki toshiya e45e052279 smooth: Fix some data types mismatching with their sources. 2009-08-01 00:32:08 +09:00
suzuki toshiya c579dc4391 cff: Fix some data types mismatching with their sources. 2009-08-01 00:32:08 +09:00
suzuki toshiya 87054758fb autofit: Fix some data types mismatching with their sources. 2009-08-01 00:32:08 +09:00
suzuki toshiya b56680240a autofit: Count the size of the memory object by ptrdiff_t. 2009-08-01 00:32:07 +09:00
suzuki toshiya 15dc278c5a autofit: Fix for unused variable `first'. 2009-08-01 00:32:07 +09:00
suzuki toshiya e866cf3f55 Improve bitmap size or pixel variables for 16-bit systems. 2009-08-01 00:32:06 +09:00
suzuki toshiya d3ed6d1bba psaux: Prevent invalid arguments to afm_parser_read_vals(). 2009-08-01 00:30:43 +09:00
suzuki toshiya 0d226c31c5 base: Prevent some overflows on LP64 systems. 2009-08-01 00:30:24 +09:00
suzuki toshiya 072e55233e cff: Cast the long variables to 32-bit for LP64 systems. 2009-08-01 00:30:23 +09:00
suzuki toshiya b61d92898e pcf: Improve PCF_PropertyRec.value names on LP64 platforms. 2009-08-01 00:30:23 +09:00
suzuki toshiya eae89a7f07 pcf: Fix some data types mismatching with their sources. 2009-08-01 00:30:22 +09:00
suzuki toshiya be41d3e718 bdf: Improve bdf_property_t.value names for LP64 platforms. 2009-08-01 00:30:22 +09:00
suzuki toshiya 660d651317 bdf: Fix some data types mismatching with their sources. 2009-08-01 00:30:21 +09:00
suzuki toshiya 38e480b4c6 autofit: Improve Unicode range definitions. 2009-08-01 00:30:21 +09:00
suzuki toshiya 93bb15940b smooth: Fix a data type mismatching with its source. 2009-08-01 00:30:21 +09:00
suzuki toshiya ea5268d2d2 smooth: Fix a data type mismatching with its source. 2009-08-01 00:30:20 +09:00
suzuki toshiya f4e1c8bdda cache: Disable the legacy compatibility if 16-bit system. 2009-08-01 00:30:20 +09:00
suzuki toshiya 2a5831ec07 cache: Check 32-bit glyph index on 16-bit systems. 2009-08-01 00:30:19 +09:00
suzuki toshiya b566d42aa0 cache: Fix some data types mismatching with their sources. 2009-08-01 00:30:19 +09:00
suzuki toshiya ebf8e294fc cache: Fix some data types mismatching with their sources. 2009-08-01 00:30:19 +09:00
suzuki toshiya 9f50873a81 cache: Cast NULL to a required function type explicitly. 2009-08-01 00:30:18 +09:00
suzuki toshiya 41f9d0d6ee fttypes.h: Cast FT_MAKE_TAG output to FT_Tag exlicitly. 2009-08-01 00:30:18 +09:00
suzuki toshiya 82ebaa7b05 psnames: Handle Unicode codepoints by FT_UInt32 variables. 2009-08-01 00:30:17 +09:00
suzuki toshiya d200982d8b psaux: Use size_t variable to pass the buffer size. 2009-08-01 00:30:17 +09:00
suzuki toshiya d1ee378566 type1: Use size_t variable to pass the string length. 2009-08-01 00:30:16 +09:00
suzuki toshiya 7fd7c6f2e9 cid: Fix some data types mismatching with their sources. 2009-08-01 00:30:16 +09:00
suzuki toshiya 34c203cdde cff: Fix for unused variable `rest'. 2009-08-01 00:30:16 +09:00
suzuki toshiya a813cf4801 cff: Fix some data types mismatching with their sources. 2009-08-01 00:30:15 +09:00
suzuki toshiya 2bbcb7edd8 bdf: Fix some data types mismatching with their sources. 2009-08-01 00:30:15 +09:00
suzuki toshiya 763b39496e sfnt: Count the size of the memory object by ptrdiff_t. 2009-08-01 00:30:14 +09:00
suzuki toshiya f420757c73 lzw: Count the size of the memory object by ptrdiff_t. 2009-08-01 00:30:14 +09:00
suzuki toshiya 88c95bab74 otvalid: Count the table size on memory by ptrdiff_t. 2009-08-01 00:30:13 +09:00
suzuki toshiya 90c7efc8f2 otvalid: Prevent an overflow by GPOS/GSUB 32b-bit offset. 2009-08-01 00:30:13 +09:00
suzuki toshiya 95aeebf438 ftobjs.c: Prevent an overflow in glyph index handling. 2009-08-01 00:30:13 +09:00
suzuki toshiya 2ed9d7fc75 Improve the variable types in raccess_make_file_name(). 2009-08-01 00:30:12 +09:00
suzuki toshiya 61fa1b53c2 ftpatent.c: Fix for unused variable `error'. 2009-08-01 00:30:12 +09:00
suzuki toshiya f7ecdbc70a type1: Check invalid string longer than PostScript limit. 2009-08-01 00:30:12 +09:00
suzuki toshiya a8c515d25c gzip: Use FT2 zcalloc() & zfree() in ftgzip.c by default. 2009-08-01 00:30:11 +09:00
suzuki toshiya 5f43bab8bf gzip: Distinguish PureC from TurboC on MSDOS. 2009-08-01 00:30:11 +09:00
suzuki toshiya 3f36047eff gxvalid: Insert PureC pragma to allow unevaluated variables. 2009-08-01 00:30:11 +09:00
suzuki toshiya 62aa9ec647 gxvalid: Pass the union by the pointer instead of the value. 2009-08-01 00:29:29 +09:00
Werner Lemberg 7009a6eb03 Fix Redhat bugzilla #513582 and Savannah bug #26849.
* src/cache/ftccache.h (FTC_CACHE_LOOKUP_CMP) <FTC_INLINE>: Fix
aliasing bug.
2009-07-29 11:53:13 +02:00
Werner Lemberg 1a49548bc3 Fix Savannah bug #27106.
Typo in Mac README instructions.
2009-07-25 16:19:23 +02:00
Werner Lemberg 2cd790d7e2 Document recent library changes.
* docs/CHANGES: Do it.
2009-07-19 11:18:00 +02:00
Werner Lemberg 46e05c443b Fix Savannah bug #23786.
* src/truetype/ttobjs.c (tt_size_init_bytecode): Don't reset x_ppem
and y_ppem.  Otherwise the `*_CVT_Stretched' functions in ttinterp.c
get never called.
An anonymous guy suggested this change on Savannah, and it seems to
be the right solution.
2009-07-17 22:49:34 +02:00
Werner Lemberg dc20faaf4c Typo. 2009-07-17 10:50:04 +02:00
Werner Lemberg 9f27998ebf Merge branch 'master' of wl@git.sv.gnu.org:/srv/git/freetype/freetype2
Conflicts:
	ChangeLog

Merge.
2009-07-15 12:33:01 +02:00
Werner Lemberg deee58f225 * docs/release: Updated. 2009-07-15 07:58:00 +02:00
Werner Lemberg 0fbdf11a48 README.CVS -> README.git
* README.CVS: Renamed to...
* README.git: This.
Updated.
2009-07-15 07:50:06 +02:00
suzuki toshiya 3009417a7d Borland C++ compiler patch proposed by Mirco Babin. 2009-07-15 12:57:26 +09:00
Werner Lemberg b2967734a6 Fix Savannah bug #27026.
* builds/win32/vc2005/freetype.sln: Use correct version number.
2009-07-14 16:44:06 +02:00
suzuki toshiya 313d4f4ca6 Add a script to check the undefined and unused trace macros. 2009-07-13 00:01:57 +09:00
suzuki toshiya 3bf7baaac3 Formatting. 2009-07-12 23:54:40 +09:00
Werner Lemberg a2ef3769bc Merge branch 'master' of wl@git.sv.gnu.org:/srv/git/freetype/freetype2 2009-07-09 18:59:25 +02:00
suzuki toshiya da59462780 smooth: Check glyph size by width/height, instead of pitch/height. 2009-07-09 17:21:32 +09:00
Werner Lemberg 0d02317fb2 [ftraster] Make it compile again with -D_STANDALONE_.
* src/raster/ftraster.c [_STANDALONE_]: Define
FT_CONFIG_STANDARD_LIBRARY_H.
Include `string.h'.
Don't include `rastpic.h'.
Define FT_DEFINE_RASTER_FUNCS.
2009-07-09 09:21:46 +02:00
suzuki toshiya 8ad243bdcd Shorten URLs referring ft-devel archive. 2009-07-09 16:12:30 +09:00
suzuki toshiya e05861b9da Register 2 missing trace components, t1afm and ttbdf. 2009-07-09 14:43:57 +09:00
suzuki toshiya a6990d0612 Register a trace component for ftgloadr.c. 2009-07-09 12:48:23 +09:00
suzuki toshiya 4c531460ed Prevent the overflows by a glyph with too many points or contours. 2009-07-08 14:52:11 +09:00
suzuki toshiya f4a0f93a14 Fix a typo in ChangeLog, found by mouse@Rodents-Montreal.ORG 2009-07-06 17:16:15 +09:00
Bram Tassyns 3d3ba0563e Improve compatibility to Acroread.
This fixes Savannah bug #26944.

* src/cff/cffload.c (cff_charset_compute_cids): For multiple GID to
single CID mappings, make the lowest value win.
2009-07-05 14:54:59 +02:00
suzuki toshiya ad289d139f ftpatent: Fix a bug by wrong usage of service->table_info(). 2009-06-29 03:09:17 +09:00
Werner Lemberg 24370d67f5 Uff, another thinko. 2009-06-28 02:11:51 +02:00
Werner Lemberg e7389a4405 [psaux, cff] Protect against nested `seac' calls.
* include/freetype/internal/psaux.h (T1_Decoder), src/cff/cffgload.h
(CFF_Decoder): Add `seac' boolean variable.

* src/cff/cffgload.c (cff_operator_seac,
cff_decoder_parse_charstrings), src/psaux/t1decode.c
(t1operator_seac, t1_decoder_parse_charstrings): Use it.
2009-06-28 01:25:55 +02:00
Werner Lemberg 6bb34880e8 Thinko.
* src/psaux/t1decode.c (t1operator_seac)
[FT_CONFIG_OPTION_INCREMENTAL]: Test for existence of incremental
interface.
2009-06-28 00:43:37 +02:00
Werner Lemberg a7e5a335f2 * devel/ftoption.h [FT_CONFIG_OPTION_INCREMENTAL]: Define. 2009-06-28 00:40:05 +02:00
Werner Lemberg b8f97f17cd Formatting. 2009-06-28 00:37:53 +02:00
suzuki toshiya fee19a786d Add tools to preprocess the source files for AtariST PureC. 2009-06-27 17:07:14 +09:00
suzuki toshiya 3609141de4 Fix wrong date in ChangeLog 2009-06-27 15:02:36 +09:00
suzuki toshiya 912f039743 Keep existing modules.cfg in the building tree. 2009-06-27 14:38:32 +09:00
suzuki toshiya 66d308edfd Filter --srcdir= option before invoking builds/unix/configure. 2009-06-27 14:33:06 +09:00
suzuki toshiya 20fb146351 Improve configure.raw for cross-building on exe-suffixed systems. 2009-06-27 14:27:55 +09:00
Werner Lemberg 610cddcac4 [truetype] Remove TT_SubGlyphRec.
* src/truetype/ttobjs.h (TT_SubGlyphRec): Removed, unused.
2009-06-26 07:39:08 +02:00
Werner Lemberg 858abbedc0 For warning messages, replace FT_ERROR with FT_TRACE0.
FT_ERROR is now used only if a function produces a non-zero `error'
value.

Formatting, improving and harmonizing debug strings.
2009-06-26 06:15:41 +02:00
Werner Lemberg e15d9c52bc Formatting etc. 2009-06-25 21:31:53 +02:00
Werner Lemberg eeec2b8fc6 Documentation improvements. 2009-06-25 16:47:10 +02:00
Werner Lemberg 777d6d59ed Provide version information better.
* src/base/ftinit.c (FT_Init_FreeType): Don't set version here
but...
* src/base/ftobjs.c (FT_New_Library): Here.
2009-06-25 16:46:39 +02:00
Werner Lemberg 1e8bf5831a Thinko. 2009-06-23 15:48:52 +02:00
Werner Lemberg 11cb8c36ed Use 16.16 format while parsing Type 1 charstrings.
This fixes Savannah bug #26867.

Previously, only integers have been used which can lead to serious
rounding errors.

However, fractional values are only used internally; after the
charstrings (of either Type 1 or 2) have been processed, the
resulting coordinates get rounded to integers currently -- before
applying scaling.  This should be fixed; at the same time a new load
flag should be introduced, to be used in combination with
FT_LOAD_NO_SCALE, which indicates that font units are returned in
16.16 format.  Similarly, the incremental interface should be
extended to allow fractional values for metrics.

* include/freetype/internal/psaux.h (T1_BuilderRec): Remove `shift'
field.
* include/freetype/internal/pshints.h (T1_Hints_SetStemFunc,
T1_Hints_SetStem3Func): Use FT_Fixed for coordinates.

* src/psaux/psobjs.c: Include FT_INTERNAL_CALC_H.
(t1_build_add_point): Always convert fixed to integer.
* src/psaux/t1decode.c (t1_decoder_parse_charstrings):
Use 16.16 format everywhere (except for large integers followed by a
`div').
[CAN_HANDLE_NON_INTEGRAL_T1_OPERANDS]: Remove #ifdef and activate
code uncoditionally.
Add support for random numbers and update remaining code
accordingly; this should work now.
(t1_operator_seac): Updated.
* src/psaux/pshrec.c: Include FT_INTERNAL_CALC_H.
(ps_hints_t1stem3, t1_hints_stem): Updated.

* src/cid/cidgload.c: Include FT_INTERNAL_CALC_H.
(cid_load_glyph) [FT_CONFIG_OPTION_INCREMENTAL],
(cid_face_compute_max_advance, cid_slot_load_glyph): Updated.

* src/type1/t1gload.c (T1_Parse_Glyph_And_Get_Char_String)
[FT_CONFIG_OPTION_INCREMENTAL], (T1_Get_Advances, T1_Load_Glyph):
Updated.
* src/type1/t1load.c: Include FT_INTERNAL_CALC_H.
* src/type1/t1objs.c (T1_Face_Init): Updated.
2009-06-22 16:56:47 +02:00
Werner Lemberg df9cd975d3 src/pshinter/pshrec.c: Use PSH_Err_Ok. 2009-06-21 23:25:36 +02:00
Werner Lemberg f79df78a53 Code beautification.
* src/type1/t1load.c (FT_INT_TO_FIXED): Removed.
Replace everywhere with INT_TO_FIXED.
(FT_FIXED_TO_INT): Move to ...
* include/freetype/internal/ftcalc.h (FIXED_TO_INT): Here.
Update all users.
2009-06-21 20:17:01 +02:00
Werner Lemberg 96d389835a Remove useless code. 2009-06-21 12:43:27 +02:00
Werner Lemberg 1f540eff0b Remove unused variables.
* include/freetype/internal/psaux.h (T1_BuilderRec),
src/cff/cffgload.h (CFF_Builder): Remove `last'.
Update all users.
2009-06-20 13:24:08 +02:00
Werner Lemberg 41821f8a8a [psaux] Check large integers while parsing charstrings.
* src/psaux/t1decode.c (t1_decoder_parse_charstrings): Large
integers must be followed by a `div' operator.
2009-06-20 09:31:19 +02:00
Werner Lemberg 541ab5adda [cff] Revert last change.
* src/cff/cffgload.c (cff_decoder_parse_charstrings): Do it.
Next time, don't confuse Type 2 charstring opcodes with TOP DICT
values...
2009-06-20 07:31:44 +02:00
Werner Lemberg b34c9b49cc aflatin.c: Fix compiler warning. 2009-06-20 06:32:23 +02:00
Werner Lemberg ae342dab60 builds/compiler/gcc.mk (CFLAGS): Use -O3, not -O6. 2009-06-20 06:01:57 +02:00
Werner Lemberg f1631f2db0 [cff] Fix handling of reserved byte 0xFF.
* src/cff/cffgload.c (cff_decoder_parse_charstrings): Abort if byte
0xFF is encountered.
2009-06-19 23:50:37 +02:00
Werner Lemberg 86fa2ebc1f Improve debug messages for Type1 charstrings.
* src/psaux/t1decode.c (t1_decoder_parse_charstrings): Emit newlines
after instructions.
Prettify output.
2009-06-19 14:56:26 +02:00
Werner Lemberg d1862d227c More ftgray fixes for FT_STATIC_RASTER.
Problems reported by suyu@cooee.cn.

* src/smooth/ftgrays.c (gray_move_to, gray_raster_render): Use
RAS_VAR.
2009-06-19 09:09:34 +02:00
Werner Lemberg 140a694373 docs/CHANGES: Updated. 2009-06-18 16:07:11 +02:00
Werner Lemberg 8262213192 Whitespace & documentation improvements. 2009-06-18 15:48:21 +02:00
Werner Lemberg 7227114043 Fix B/W rasterization of subglyphs with different drop-out modes.
Normally, the SCANMODE instruction (if present) to set the drop-out
mode in a TrueType font is located in the `prep' table only and thus
valid for all glyphs.  However, there are fonts like `pala.ttf'
which additionally contain this instruction in the hinting code of
some glyphs (but not all).  As a result it can happen that a
composite glyph needs multiple drop-out modes for its subglyphs
since the rendering state gets reset for each subglyph.

FreeType collects the hinted outlines from all subglyphs, then it
sends the data to the rasterizer.  It also sends the drop-out mode
-- after hinting has been applied -- and here is the error: It sends
the drop-out mode of the last subglyph only; drop-out modes of all
other subglyphs are lost.

This patch fixes the problem; it adds a second, alternative
mechanism to pass the drop-out mode: For each contour, the
rasterizer now checks the first `tags' array element.  If bit 2 is
set, bits 5-7 contain the contour's drop-out mode, overriding the
global drop-out mode.

* include/freetype/ftimage.h (FT_CURVE_TAG_HAS_SCANMODE): New macro.

* src/truetype/ttgload.c (TT_Hint_Glyph): Store drop-out mode in
`tags[0]'.

* src/raster/ftraster.c (Flow_Up, Overshoot_Top, Overshoot_Bottom):
Use bits 3-5 instead of 0-2.
(New_Profile): Set the drop-out mode in the profile's `flags' field.
(Decompose_Curve): Check `tags[0]' and set `dropOutControl' if
necessary.
(Vertical_Sweep_Drop, Horizontal_Sweep_Drop,
Horizontal_Gray_Sweep_Drop, Draw_Sweep): Use the profile's drop-out
mode.
2009-06-18 15:42:52 +02:00
Werner Lemberg 780d7e05e7 Minor simplification. 2009-06-17 06:45:20 +02:00
Werner Lemberg 38e4076775 Typo. 2009-06-16 22:41:46 +02:00
Werner Lemberg 42206ad86a Improve scan conversion rules 4 and 6.
Two new constraints are introduced to better identify a `stub' -- a
concept which is only vaguely described in the OpenType
specification.  The old code was too rigorous and suppressed more
pixel than it should.

  . The intersection of the two profiles with the scanline is less
    than a half pixel.  Code related to this was already present in
    the sources but has been commented out.

  . The endpoint of the original contour forming a profile has a
    distance (`overshoot') less than half a pixel to the scanline.

Note that the two additional conditions fix almost all differences
to the Windows rasterizer, but some problematic cases remain.

* src/raster/ftraster.c (Overshoot_Top, Overshoot_Bottom): New
macros for the `flags' field in the `TProfile' structure.
(IS_BOTTOM_OVERSHOOT, IS_TOP_OVERSHOOT): New macros.
(New_Profile, End_Profile): Pass overshoot flag as an argument and
set it accordingly.
Update callers.
(Vertical_Sweep_Drop, Horizontal_Sweep_Drop): Implement the two new
constraints.
2009-06-16 15:14:21 +02:00
Werner Lemberg 0409ef3268 Increase precision for B/W rasterizer.
* src/raster/ftraster.c (Set_High_Precision): Add two more bits to
the precision.  This corrects rendering of some small glyphs, for
example, glyph `xi' in verdana.ttf at 13 ppem.  Testing with ftbench
on my GNU/Linux box I don't see a performance degradation.
2009-06-11 17:32:31 +02:00
Michael Zucchi f33b237c96 Handle FT_STROKER_LINECAP_BUTT.
This fixes Savannah bug #26757.

* src/base/ftstroke.c (ft_stroker_cap): Implement it.
2009-06-08 17:12:40 +02: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 2f2b780e00 Simplify math.
Suggested by Alexei Podtelezhnikov <apodtele@gmail.com>.

* src/raster/ftraster.c (Vertical_Sweep_Drop, Horizontal_Sweep_Drop,
Horizontal_Gray_Sweep_Drop): Do it.
2009-06-07 08:29:30 +02:00
Werner Lemberg 90c699af0c Preparation for fixing scan conversion rules 4 and 6.
* src/raster/ftraster.c (TFlow): Replace enumeration with...
(Flow_Up): This macro.
(TProfile): Replace `flow' member with `flags' bit field.
Update all affected code.
2009-06-05 10:37:15 +02:00
Werner Lemberg cbdba61511 Typo, formatting. 2009-06-03 08:53:47 +02:00
James Cloos 15e8e237e6 Enable autohinting for glyphs rotated by multiples of 90°.
* src/base/ftobjs.c (FT_Load_Glyph): Alter check for permitted
matrices to allow rotations by multiples of 90°, not only unrotated,
possibly slanted matrices.
2009-05-29 12:59:42 +02:00
Werner Lemberg b4df875196 Remove compiler warning.
Reported by Krzysztof Kowalczyk <kkowalczyk@gmail.com>.

* src/autofit/aflatin2.c (af_latin2_hint_edges): Move declaration of
`n_edges' into `#if' block.
2009-05-28 07:07:48 +02:00
Werner Lemberg c32019b64a Make compilation work with FT_CONFIG_OPTION_USE_ZLIB not defined.
Reported by Krzysztof Kowalczyk <kkowalczyk@gmail.com>.

* src/pcf/pcfdrivr.c (PCF_Face_Init) [!FT_CONFIG_OPTION_USE_ZLIB]:
Make it work.
Simplify #ifdef logic.
2009-05-28 06:56:26 +02:00
Werner Lemberg 19fbc576af Improve b/w rasterizer.
Problem reported by Krzysztof Kotlenga <pocek@users.sf.net>.

* src/raster/raster.c (Vertical_Sweep_Drop, Horizontal_Sweep_Drop,
Horizontal_Gray_Sweep_Drop): For smart drop-out mode, if
intersections are equally distant relative to next pixel center,
select the left pixel, not the right one.
2009-05-22 09:20:25 +02:00
Werner Lemberg b72af52b9c Fix Savannah bug #26600.
* src/type42/t42parse.c (t42_load_keyword): Handle
T1_FIELD_LOCATION_FONT_EXTRA.
2009-05-19 07:33:15 +02:00
Ralph Giles 04a7858c61 Make `seac' operator work correctly with incremental interface.
SEAC (Single Encoding Accented Characters) are composed of (basically) two
indices specifying two other glyphs, and a movement to position the accent
properly with respect to the main glyph.

To make it work with the incremental interface we now demand that the caller
handles the encoding by itself.
2009-04-30 20:32:31 +02:00
Werner Lemberg 7daf801f8f Document recent changes to ftview.
* docs/CHANGES: Do it.
2009-04-30 20:00:22 +02:00
Werner Lemberg 8b84c9d19f autohinter: Don't change digit widths if all widths are the same.
This fixes FreeDesktop bug #21197.

* src/autofit/afglobal.c (AF_DIGIT): New macro.
(af_face_globals_compute_script_coverage): Mark ASCII digits in
`glyph_scripts' array.
(af_face_globals_get_metrics): Updated.
(af_face_globals_is_digit): New function.
* src/autofit/afglobal.h: Updated.
(AF_ScriptMetricsRec): Add `digits_have_same_width' flag.

* src/autofit/aflatin.c: Include FT_ADVANCES_H.
(af_latin_metrics_check_digits): New function.
(af_latin_metrics_init): Use it.
* src/autofit/aflatin.h: Updated.
* src/autofit/afcjk.c (af_cjk_metrics_init): Updated.

* src/autofit/aflatin2.c: Similar changes as with aflatin.c.

* src/autofit/afloader.c (af_loader_load_g): Test digit width.

* docs/CHANGES: Document it.
2009-04-27 19:40:35 +02:00
Werner Lemberg b5a460597a Make ftgrays compile with _STANDALONE_ and FT_STATIC_RASTER again.
Problems reported by suyu@cooee.cn.

* src/smooth/ftgrays.c (FT_DEFINE_OUTLINE_FUNCS,
FT_DEFINE_RASTER_FUNCS) [_STANDALONE_]: Define.
[!_STANDALONE_]: Include ftspic.h only here.
(ras): Define/declare after definition of `TWorker'.
Use `RAS_VAR_' where necessary.
2009-04-26 16:32:10 +02:00
Werner Lemberg 6757390d1a Add missing ChangeLog entry. 2009-04-26 16:21:15 +02:00
Karl Berry b3511ebb60 Fix AC_CHECK_FT2.
Only check PATH for freetype-config if we did not already find it from a
prefix option.
2009-04-21 22:51:07 +02:00
Oran Agra 1dcd0f2399 Add #error to modules and files that do not support PIC yet.
When FT_CONFIG_OPTION_PIC is defined the following files will
create #error:
* src/bdf/bdfdrivr.h
* src/cache/ftcmanag.c
* src/cid/cidriver.h
* src/gxvalid/gxvmod.h
* src/gzip/ftgzip.c
* src/lzw/ftlzw.c
* src/otvalid/otvmod.h
* src/pcf/pcfdrivr.h
* src/pfr/pfrdrivr.h
* src/psaux/psauxmod.h
* src/type1/t1driver.h
* src/type42/t42drivr.h
* src/winfonts/winfnt.h
2009-04-05 18:25:14 +03:00
Oran Agra 59b4af8d59 Position Independent Code (PIC) support in autofit module.
* include/freetype/internal/autohint.h add macros to init
instances of FT_AutoHinter_ServiceRec.

* src/autofit/afmodule.h declare autofit_module_class
using macros from ftmodapi.h,
when FT_CONFIG_OPTION_PIC is defined create and destroy
functions will be declared.
* src/autofit/afmodule.c when FT_CONFIG_OPTION_PIC is defined
af_autofitter_service and autofit_module_class structs
will have functions to init or create and destroy them
instead of being allocated in the global scope.
And macros will be used from afpic.h in order to access them.

* src/autofit/aftypes.h add macros to init and declare
instances of AF_ScriptClassRec.

* src/autofit/afcjk.h declare af_cjk_script_class
using macros from aftypes.h,
when FT_CONFIG_OPTION_PIC is defined init function will be declared.
* src/autofit/afcjk.c when FT_CONFIG_OPTION_PIC is defined
af_cjk_script_class struct will have function to init it instead of
being allocated in the global scope.

* src/autofit/afdummy.h declare af_dummy_script_class
using macros from aftypes.h,
when FT_CONFIG_OPTION_PIC is defined init function will be declared.
* src/autofit/afdummy.c when FT_CONFIG_OPTION_PIC is defined
af_dummy_script_class struct will have function to init it instead of
being allocated in the global scope.

* src/autofit/afindic.h declare af_indic_script_class
using macros from aftypes.h,
when FT_CONFIG_OPTION_PIC is defined init function will be declared.
* src/autofit/afindic.c when FT_CONFIG_OPTION_PIC is defined
af_indic_script_class struct will have function to init it instead of
being allocated in the global scope.

* src/autofit/aflatin.h declare af_latin_script_class
using macros from aftypes.h,
when FT_CONFIG_OPTION_PIC is defined init function will be declared.
* src/autofit/aflatin.c when FT_CONFIG_OPTION_PIC is defined
af_latin_script_class struct will have function to init it instead of
being allocated in the global scope.
Change af_latin_blue_chars to be PIC-compatible by being a two
dimentional array rather than array of pointers.


* src/autofit/aflatin2.h declare af_latin2_script_class
using macros from aftypes.h,
when FT_CONFIG_OPTION_PIC is defined init function will be declared.
* src/autofit/aflatin2.c when FT_CONFIG_OPTION_PIC is defined
af_latin2_script_class struct will have function to init it instead of
being allocated in the global scope.
Change af_latin2_blue_chars to be PIC-compatible by being a two
dimentional array rather than array of pointers.

* src/autofit/afglobal.c when FT_CONFIG_OPTION_PIC is defined
af_script_classes array initialization was moved to afpic.c and
is later refered using macros defeined in afpic.h.

New Files:
* src/autofit/afpic.h declare struct to hold PIC globals for autofit
module and macros to access them.
* src/autofit/afpic.c implement functions to allocate, destroy and
initialize PIC globals for autofit module.

* src/autofit/autofit.c add new file to build: afpic.c.
* src/autofit/jamfile add new files to FT2_MULTI build: afpic.c.
2009-04-05 18:23:38 +03:00
Oran Agra 4e711be9f5 Position Independent Code (PIC) support in pshinter module.
* include/freetype/internal/pshints.h add macros to init
instances of PSHinter_Interface.

* src/pshinter/pshmod.h declare pshinter_module_class
using macros from ftmodapi.h,
when FT_CONFIG_OPTION_PIC is defined create and destroy
functions will be declared.
* src/pshinter/pshmod.c when FT_CONFIG_OPTION_PIC is defined
pshinter_interface and pshinter_module_class structs
will have functions to init or create and destroy them
instead of being allocated in the global scope.
And macros will be used from pshpic.h in order to access them.

New Files:
* src/pshinter/pshpic.h declare struct to hold PIC globals for pshinter
module and macros to access them.
* src/pshinter/pshpic.c implement functions to allocate, destroy and
initialize PIC globals for pshinter module.

* src/pshinter/pshinter.c add new file to build: pshpic.c.
* src/pshinter/jamfile add new files to FT2_MULTI build: pshpic.c.
2009-04-05 18:20:16 +03:00
Oran Agra 24b110c6c6 Position Independent Code (PIC) support in psnames module.
* include/freetype/internal/services/svpscmap.h add macros to init
instances of FT_Service_PsCMapsRec.

* src/psnames/psmodule.h declare psnames_module_class
using macros from ftmodapi.h,
when FT_CONFIG_OPTION_PIC is defined create and destroy
functions will be declared.
* src/psnames/psmodule.c when FT_CONFIG_OPTION_PIC is defined
pscmaps_interface and pscmaps_services structs
and psnames_module_class array
will have functions to init or create and destroy them
instead of being allocated in the global scope.
And macros will be used from pspic.h in order to access them.

New Files:
* src/psnames/pspic.h declare struct to hold PIC globals for psnames
module and macros to access them.
* src/psnames/pspic.c implement functions to allocate, destroy and
initialize PIC globals for psnames module.

* src/psnames/psnames.c add new file to build: pspic.c.
* src/psnames/jamfile add new files to FT2_MULTI build: pspic.c.
2009-04-05 18:18:03 +03:00
Oran Agra 056095096f Position Independent Code (PIC) support in raster renderer.
* src/raster/ftrend1.h declare ft_raster1_renderer_class
and ft_raster5_renderer_class
using macros from ftrender.h,
when FT_CONFIG_OPTION_PIC is defined create and destroy
functions will be declared.
* src/smooth/ftrend1.c when FT_CONFIG_OPTION_PIC is defined
ft_raster1_renderer_class and ft_raster5_renderer_class structs
will have functions to init or create and destroy them
instead of being allocated in the global scope.
Macros will be used from rastpic.h in order to access
ft_standard_raster from the pic_container (allocated in ftraster.c).
In ft_raster1_render when PIC is enabled, the last letter of
module_name is used to verfy the renderer class rather than the
class pointer.

* src/raster/ftraster.c when FT_CONFIG_OPTION_PIC is defined
ft_standard_raster struct will have function to init it
instead of being allocated in the global scope.

New Files:
* src/raster/rastpic.h declare struct to hold PIC globals for raster
renderer and macros to access them.
* src/raster/rastpic.c implement functions to allocate, destroy and
initialize PIC globals for raster renderer.

* src/raster/raster.c add new file to build: rastpic.c.
* src/raster/jamfile add new files to FT2_MULTI build: rastpic.c.
2009-04-05 18:16:13 +03:00
Oran Agra c1e22f3986 Position Independent Code (PIC) support in smooth renderer.
* src/smooth/ftsmooth.h declare ft_smooth_renderer_class,
ft_smooth_lcd_renderer_class and ft_smooth_lcd_v_renderer_class
using macros from ftrender.h,
when FT_CONFIG_OPTION_PIC is defined create and destroy
functions will be declared.
* src/smooth/ftsmooth.c when FT_CONFIG_OPTION_PIC is defined
the following structs:
ft_smooth_renderer_class, ft_smooth_lcd_renderer_class
and ft_smooth_lcd_v_renderer_class
will have functions to init or create and destroy them
instead of being allocated in the global scope.
And macros will be used from ftspic.h in order to access
ft_grays_raster from the pic_container (allocated in ftgrays.c).

* src/smooth/ftgrays.h include FT_CONFIG_CONFIG_H
* src/smooth/ftgrays.c when FT_CONFIG_OPTION_PIC is NOT defined
func_interface was moved from gray_convert_glyph_inner function
to the global scope.
When FT_CONFIG_OPTION_PIC is defined
func_interface and ft_grays_raster structs
will have functions to init them
instead of being allocated in the global scope.
And func_interface will be allocated on the stack of
gray_convert_glyph_inner.

New Files:
* src/smooth/ftspic.h declare struct to hold PIC globals for smooth
renderer and macros to access them.
* src/smooth/ftspic.c implement functions to allocate, destroy and
initialize PIC globals for smooth renderer.

* src/smooth/smooth.c add new file to build: ftspic.c.
* src/smooth/jamfile add new files to FT2_MULTI build: ftspic.c.
2009-04-05 18:14:04 +03:00
Oran Agra cb3b61416b Position Independent Code (PIC) support in cff driver.
* include/freetype/internal/services/svcid.h add macros to init
instances of FT_Service_CIDRec.
* include/freetype/internal/services/svpsinfo.h add macros to init
instances of FT_Service_PsInfoRec.

* src/cff/cffcmap.h declare cff_cmap_encoding_class_rec
and cff_cmap_unicode_class_rec using macros from
ftobjs.h, when FT_CONFIG_OPTION_PIC is defined create and destroy
functions will be declared.
* src/cff/cffcmap.c when FT_CONFIG_OPTION_PIC is defined
the following structs:
cff_cmap_encoding_class_rec and cff_cmap_unicode_class_rec
will have functions to init or create and destroy them
instead of being allocated in the global scope.

* src/cff/cffdrivr.h declare cff_driver_class using macros from
ftdriver.h, when FT_CONFIG_OPTION_PIC is defined create and destroy
functions will be declared.
* src/cff/cffdrivr.c when FT_CONFIG_OPTION_PIC is defined
the following structs:
cff_service_glyph_dict, cff_service_ps_info, cff_service_ps_name
cff_service_get_cmap_info, cff_service_cid_info, cff_driver_class,
and cff_services array
will have functions to init or create and destroy them
instead of being allocated in the global scope.
And macros will be used from cffpic.h in order to access them
from the pic_container.
Use macros from cffpic.h in order to access the
structs allocated in cffcmap.c

* src/cff/cffobjs.c Use macros from cffpic.h in order to access the
structs allocated in cffcmap.c

* src/cff/parser.c when FT_CONFIG_OPTION_PIC is defined
implement functions to create and destroy cff_field_handlers array
instead of being allocated in the global scope.
And macros will be used from cffpic.h in order to access it
from the pic_container.

New Files:
* src/cff/cffpic.h declare struct to hold PIC globals for cff
driver and macros to access them.
* src/cff/cffpic.c implement functions to allocate, destroy and
initialize PIC globals for cff driver.

* src/cff/cff.c add new file to build: cffpic.c.
* src/cff/jamfile add new files to FT2_MULTI build: cffpic.c.
2009-04-05 18:12:03 +03:00
Oran Agra fb429ec409 Position Independent Code (PIC) support in sfnt driver.
* include/freetype/internal/services/svbdf.h add macros to init
instances of FT_Service_BDFRec.
* include/freetype/internal/services/svgldict.h add macros to init
instances of FT_Service_GlyphDictRec.
* include/freetype/internal/services/svpostnm.h add macros to init
instances of FT_Service_PsFontNameRec.
* include/freetype/internal/services/svsfnt.h add macros to init
instances of FT_Service_SFNT_TableRec.
* include/freetype/internal/services/svttcmap.h add macros to init
instances of FT_Service_TTCMapsRec.
* include/freetype/internal/sfnt.h add macros to init
instances of SFNT_Interface.

* src/sfnt/sfdriver.h declare sfnt_module_class using macros from
ftmodapi.h, when FT_CONFIG_OPTION_PIC is defined create and destroy
functions will be declared.
* src/sfnt/sfdriver.c when FT_CONFIG_OPTION_PIC is defined
the following structs:
sfnt_service_sfnt_table, sfnt_service_glyph_dict, sfnt_service_ps_name
tt_service_get_cmap_info, sfnt_service_bdf, sfnt_interface,
sfnt_module_class, and sfnt_services array
will have functions to init or create and destroy them
instead of being allocated in the global scope.
And macros will be used from sfntpic.h in order to access them
from the pic_container.

* src/sfnt/ttcmap.h add macros to init
instances of TT_CMap_ClassRec.
* src/sfnt/ttcmap.c when FT_CONFIG_OPTION_PIC is defined
the following structs:
tt_cmap0_class_rec, tt_cmap2_class_rec, tt_cmap4_class_rec
tt_cmap6_class_rec, tt_cmap8_class_rec, tt_cmap10_class_rec,
tt_cmap12_class_rec, tt_cmap14_class_rec and tt_cmap_classes array
will have functions to init or create and destroy them
instead of being allocated in the global scope.
And macros will be used from sfntpic.h in order to access them
from the pic_container.
The content of tt_cmap_classes is now described in the
new file 'ttcmapc.h'.

New Files:
* src/sfnt/sfntpic.h declare struct to hold PIC globals for sfnt
driver and macros to access them.
* src/sfnt/sfntpic.c implement functions to allocate, destroy and
initialize PIC globals for sfnt driver.
* src/sfnt/ttcmapc.h describing the content of
tt_cmap_classes allocated in ttcmap.c

* src/sfnt/sfnt.c add new file to build: sfntpic.c.
* src/sfnt/jamfile add new files to FT2_MULTI build: sfntpic.c.
2009-04-05 18:08:32 +03:00
Oran Agra 2e7a4e9b7f Position Independent Code (PIC) support in truetype driver.
* include/freetype/internal/services/svmm.h add macros to init
instances of FT_Service_MultiMastersRec.
* include/freetype/internal/services/svttglyf.h add macros to init
instances of FT_Service_TTGlyfRec.

* src/truetype/ttdriver.h declare tt_driver_class using macros from
ftdriver.h, when FT_CONFIG_OPTION_PIC is defined create and destroy
functions will be declared.
* src/truetype/ttdriver.c when FT_CONFIG_OPTION_PIC is defined
the following structs:
tt_service_gx_multi_masters, tt_service_truetype_glyf, tt_driver_class
and tt_services array,
will have functions to init or create and destroy them
instead of being allocated in the global scope.
And macros will be used from ttpic.h in order to access them
from the pic_container.
* src/truetype/ttobjs.c change trick_names array to be
PIC-compatible by being a two dimentional array rather than array
of pointers.

New Files:
* src/truetype/ttpic.h declare struct to hold PIC globals for truetype
driver and macros to access them.
* src/truetype/ttpic.c implement functions to allocate, destroy and
initialize PIC globals for truetype driver.

* src/truetype/truetype.c add new file to build: ttpic.c.
* src/truetype/jamfile add new files to FT2_MULTI build: ttpic.c.
2009-04-05 18:03:02 +03:00
Oran Agra 636c294bef Position Independent Code (PIC) support and infrastructure in base.
* include/freetype/config/ftoption.h add FT_CONFIG_OPTION_PIC
* include/freetype/internal/ftobjs.h Add pic_container member to
FT_LibraryRec.
Add macros to declare and init instances of FT_CMap_ClassRec.
Add macros to init instances of FT_Outline_Funcs and FT_Raster_Funcs.
Add macros to declare, allocate and initialize modules
(FT_Module_Class).
Add macros to declare, allocate and initialize renderers
(FT_Renderer_Class).
Add macro to init instances of FT_Glyph_Class.
Add macros to declare, allocate and initialize drivers
(FT_Driver_ClassRec).
* include/freetype/internal/ftpic.h new file to declare the
FT_PIC_Container struct and the functions to allocate and detroy it.
* include/freetype/internal/ftserv.h add macros to allocate and
destory arrays of FT_ServiceDescRec.
* include/freetype/internal/internal.h define macro to include
ftpic.h.

New Files:
* src/base/ftpic.c implement functions to allocate and destory the
global pic_container.
* src/base/basepic.h declare struct to hold PIC globals for base and
macros to access them.
* src/base/basepic.c implement functions to allocate, destroy and
initialize PIC globals for base.

* src/base/ftinit.c when FT_CONFIG_OPTION_PIC is defined implement
functions that allocate and destroy ft_default_modules according to
FT_CONFIG_MODULES_H in the pic_container instead of the global scope
and use macro from basepic.h to access it.
* src/base/ftobjs.c add calls to the functions that allocate and
destroy the global pic_container when the library is created and
destroyed.

* src/base/jamfile add new files to FT2_MULTI build:
ftpic.c and basepic.c.
* src/base/ftbase.c add new files to build:
ftpic.c and basepic.c.

* src/base/ftglyph.c when FT_CONFIG_OPTION_PIC is defined
ft_bitmap_glyph_class and ft_outline_glyph_class will be allocated
in the pic_container instead of the global scope and use macros from
basepic.h to access them.
* src/base/ftbbox.c allocate bbox_interface stract on the stack
instead of the global scope when FT_CONFIG_OPTION_PIC is defined.
* src/base/ftstroke.c access ft_outline_glyph_class allocated in
ftglyph.c via macros from basepic.h
2009-04-05 17:59:26 +03:00
Oran Agra 2589e5fd94 Preparing changes in cff parser later needed for PIC version.
* src/cff/cffload.c, src/cff/cffload.h, src/cff/cffobjs.c,
src/cff/cffparse.c, src/cff/cffparse.h: Add library pointer to
'CFF_ParserRec' set by `cff_parser_init'.
Route library pointer from 'cff_face_init' to 'cff_subfont_load'
for `cff_parser_init'.

* src/cff/cffparse.c (CFF_Field_Handler): Move it to...
* src/cff/cffparse.h: This file, to be used by other C files.
2009-04-05 17:34:40 +03:00
Oran Agra 3da7e68f75 Minor change in ftstroke.c.
* src/base/ftstroke.c (FT_StrokerRec): Replace `memory' member with
`library' needed for PIC version.
Update all callers.
2009-04-05 17:30:14 +03:00
Oran Agra d8f4b57fbe Typo. 2009-04-05 17:28:48 +03:00
Werner Lemberg cbab53c260 Improve documentation. 2009-04-04 09:26:18 +02:00
Werner Lemberg 314f35ad2e ftnames.c -> ftsnames.c
* src/base/ftnames.c: Rename to...
* src/base/ftsnames.c: This.
* src/base/Jamfile, src/base/rules.mk, src/base/ftbase.c: Updated.
2009-04-04 09:20:14 +02:00
Werner Lemberg d9ba68d6b8 Whitespace. 2009-04-04 09:11:58 +02:00
Werner Lemberg b47b97db84 Fix comment.
OpenType 1.6 now mentions that data in the `loca' table must be ordered.
2009-04-04 07:51:45 +02:00
Werner Lemberg ca98f8cc2b Add support for cmap type 13.
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_CMAP_FORMAT_13): New macro.

* src/sfnt/ttcmap.c (TT_CMap13Rec, tt_cmap13_init,
tt_cmap13_validate, tt_cmap13_char_index, tt_cmap13_char_next,
tt_cmap13_get_info, tt_cmap13_char_map_def_binary,
tt_cmap14_class_rec): New functions and structures for cmap 13
support.
(tt_cmap_classes): Register tt_cmap13_class_rec.

* docs/CHANGES: Mention cmap 13 support.
2009-04-04 07:42:38 +02:00
Werner Lemberg 8566d4a096 Synchronize ftoption.h versions (minor changes only). 2009-04-04 07:31:33 +02:00
Werner Lemberg fbdf127904 Ignore empty contours in CFF glyphs.
Problem reported by Albert Astals Cid <aacid@kde.org>.

* src/cff/cffgload.c (cff_builder_close_contour): Synchronize with
t1_builder_close_contour.
2009-04-01 08:03:37 +02:00
Werner Lemberg 0315bb20ce Typo. 2009-03-31 18:11:55 +02:00
Werner Lemberg 0ddc2fe2ae Slightly improve documentation of FT_Encoding. 2009-03-31 18:06:19 +02:00
Werner Lemberg 3ba8301b21 Callbacks for b/w rasterizer are not implemented currently. 2009-03-30 12:58:41 +02:00
Werner Lemberg b3e6df69e6 Really fix Ghostscript Coverity issue #3904. 2009-03-21 10:45:18 +01:00
Werner Lemberg 4d1a34ce0b Another redundant header inclusion.
* src/truetype/ttgxvar.c: Fix Ghostscript Coverity issue #4041.
2009-03-21 10:42:56 +01:00
Werner Lemberg 86e041b5a8 Remove redundant header inclusions.
This covers many Ghostscript Coverity issues.

* src/*: Do it.
2009-03-21 08:51:44 +01:00
Werner Lemberg 16bd51c819 Fix Ghostscript Coverity issue #3904.
* src/truetype/ttgxvar.c (ft_var_readpackedpoints): Protect against
zero value of `runcnt'.
2009-03-21 07:48:34 +01:00
Werner Lemberg 7171ff5782 Fix `make multi' run.
* src/smooth/ftsmooth.h: Include FT_INTERNAL_DEBUG_H.
2009-03-20 21:08:29 +01:00
Werner Lemberg f4a82bee1e Whitespace. 2009-03-20 16:10:26 +01:00
Werner Lemberg 9dbfac22bc Fix Savannah bug #25923.
* src/cache/ftccmap.c (FTC_CMAP_HASH): Fix typo.
2009-03-20 09:13:59 +01:00
Werner Lemberg 79972af4f0 Protect against too large glyphs.
Problem reported by Tavis Ormandy <taviso@google.com>.

* src/smooth/ftsmooth.c (ft_smooth_render_generic): Don't allow
`width' or `pitch' to be larger than 0xFFFF.
2009-03-20 08:21:37 +01:00
Werner Lemberg a18788b14d Fix validation for various cmap table formats.
* src/sfnt/ttcmap.c (tt_cmap8_validate, tt_cmap10_validate,
tt_cmap12_validate): Check `length' correctly.
(tt_cmap_14_validate): Check `length' and `numMappings' correctly.
2009-03-20 08:03:58 +01:00
Werner Lemberg a49db4f866 Copyright. 2009-03-20 07:30:43 +01:00
Werner Lemberg 0a05ba257b Protect against malformed compressed data.
Problem reported by Tavis Ormandy <taviso@google.com>.

* src/lsw/ftzopen.c (ft_lzwstate_io): Test whether `state->prefix' is
zero.
2009-03-20 07:19:45 +01:00
Werner Lemberg 0545ec1ca3 Protect against invalid SID values in CFFs.
Problem reported by Tavis Ormandy <taviso@google.com>.

* src/cff/cffload.c (cff_charset_load): Reject SID values larger
than 64999.
2009-03-20 06:49:10 +01:00
Vincent Richomme 8b819254b9 Update WinCE Visual C project files.
* builds/wince/vc2005-ce/freetype.vcproj,
builds/wince/vc2008-ce/freetype.vcproj: Add missing base extension
files.
2009-03-19 08:30:49 +01:00
Werner Lemberg a9ba23c856 Remove unused Win32 code.
* builds/wince/ftdebug.c: Remove code guarded with `!_WIN32_WCE'.
Since Win32 is handled separately this is no longer needed.
2009-03-19 08:27:59 +01:00
Vincent Richomme 91b127f70e Make `gzip' module compile on WinCE.
* src/gzip/zconf.h [_WIN32_WCE]: Define NO_ERRNO_H.
2009-03-19 08:17:50 +01:00
Werner Lemberg 80c253f9e8 Remove unused WinCE code.
* builds/win32/ftdebug.c: Remove code guarded with `_WIN32_WCE'.
Since WinCE is handled separately this is no longer needed.
2009-03-19 08:05:06 +01:00
Werner Lemberg 7bb1005de8 docmaker: Don't ignore single-line code blocks.
* src/tools/docmaker/content.py (DocBlock::_init__): Fix change from
2009-01-31.
2009-03-16 20:42:38 +01:00
Werner Lemberg 5a80a94b18 Whitespace. 2009-03-15 20:58:38 +01:00
Steve Langasek 2cd5dce831 Use __asm__ for declaring assembly instead of asm.
* builds/unix/ftconfig.in (FT_MulFix_arm): Use __asm__ instead of
asm on arm, fixing a build failure on armel with -pedantic.
2009-03-15 13:11:25 +01:00
Werner Lemberg e4661646de Fix valgrind warning.
* src/sfnt/ttsbit0.c (tt_sbit_decoder_load_bit_aligned): Don't read
past the end of the frame.
2009-03-14 23:32:24 +01:00
Werner Lemberg f4f5ba2d87 * Version 2.3.9 released.
=========================


Tag sources with `VER-2-3-9'.
2009-03-12 09:56:04 +00:00
Werner Lemberg a284ab6254 * builds/unix/freetype2.in: Move @FT2_EXTRA_LIBS@ to `Libs.private'. 2009-03-12 08:11:12 +00:00
Werner Lemberg b66efefdcd Fix some FreeType Coverity issues as reported for Ghostscript.
* src/base/ftobjs.c (FT_New_Face, FT_New_Memory_Face): Initialize
`args.stream' (#3874, #3875).
(open_face_PS_from_sfnt_stream): Improve error management (#3786).
* src/base/ftmm.c (ft_face_get_mm_service): Fix check of `aservice'
(#3870).
* src/base/ftstroke.c (ft_stroke_border_get_counts): Remove dead
code (#3790).
* src/base/ftrfork.c (raccess_guess_apple_generic): Check error
value of `FT_Stream_Skip' (#3784).

* src/type1/t1gload.c (T1_Load_Glyph): Check `size' before accessing
it (#3872)

* src/pcf/pcfdrivr.c (PCF_Glyph_Load): Check `face' before accessing
it (#3871).
* src/pcf/pcfread.c (pcf_get_metrics): Handle return value of
`pcf_get_metric' (#3789, #3782).
(pcf_get_properties): Use FT_STREAM_SKIP (#3783).

* src/cache/ftcmanag.c (FTC_Manager_RegisterCache): Fix check of
`acache' (#3797)

* src/cff/cffdrivr.c (cff_ps_get_font_info): Fix check of `cff'
(#3796).
* src/cff/cffgload.c (cff_decoder_prepare): Check `size' (#3795).
* src/cff/cffload.c (cff_index_get_pointers): Add comment (#3794).

* src/bdf/bdflib.c (_bdf_add_property): Check `fp->value.atom'
(#3793).
(_bdf_parse_start): Add comment (#3792).

* src/raster/ftraster.c (Finalize_Profile_Table): Check
`ras.fProfile' (#3791).

* src/sfnt/ttsbit.c (Load_SBit_Image): Use FT_STREAM_SKIP (#3785).

* src/gzip/ftgzip.c (ft_gzip_get_uncompressed_size): Properly ignore
seek error (#3781).
2009-03-12 08:07:49 +00:00
Werner Lemberg 0711d389d6 Typo. 2009-03-11 21:39:10 +00:00
Werner Lemberg 07e818170f Extend CID service functions to handle CID-keyed CFFs as CID fonts.
* include/freetype/ftcid.h (FT_Get_CID_Is_Internally_CID_keyed,
FT_Get_CID_From_Glyph_Index): New functions.

* include/freetype/internal/services/svcid.h
(FT_CID_GetIsInternallyCIDKeyedFunc,
FT_CID_GetCIDFromGlyphIndexFunc): New function typedefs.
(CID Service): Use them.

* src/base/ftcid.c: Include FT_CID_H.
(FT_Get_CID_Is_Internally_CID_keyed, FT_Get_CID_From_Glyph_Index):
New functions.

* src/cff/cffdrivr.c (cff_get_is_cid, cff_get_cid_from_glyph_index):
New functions.
(cff_service_cid_info): Add them.
* src/cff/cffload.c (cff_font_load): Don't free `font->charset.sids'
-- it is needed for access as a CID-keyed font.  It gets deleted
later on.

* src/cid/cidriver.c (cid_get_is_cid, cid_get_cid_from_glyph_index):
New functions.
(cid_service_cid_info): Add them.

* docs/CHANGES: Updated.
2009-03-11 21:29:54 +00:00
Werner Lemberg 9318df0cad Fix Savannah bug #25597.
* src/cff/cffparse.c (cff_parse_real): Don't allow fraction_length
to become larger than 9.
2009-03-11 10:20:51 +00:00
Werner Lemberg 1e54a65fa8 Minor update. 2009-03-11 07:10:26 +00:00
Werner Lemberg 911f431966 Fix Savannah bug #25814.
* builds/unix/freetype2.in: As suggested in the bug report, move
@LIBZ@ to `Libs.private'.
2009-03-11 07:07:37 +00:00
Werner Lemberg 801e7bae3a Fix Savannah bug #25781.
We now simply check for a valid `offset', no longer handling `delta
= 1' specially.

* src/sfnt/ttcmap.c (tt_cmap4_validate): Don't check `delta' for
last segment.
(tt_cmap4_set_range, tt_cmap4_char_map_linear,
tt_cmap4_char_map_binary): Check offset.
2009-03-11 06:47:49 +00:00
Werner Lemberg 34ca21edc6 * src/base/Jamfile: Fix handling of ftadvanc.c.
Reported by Oran Agra <oran@monfort.co.il>.
2009-03-11 05:35:01 +00:00
Werner Lemberg 31f5bbba44 Restructure Win32 and Wince compiler support.
* src/builds/win32: Remove files for WinCE.
Move VC 2005 support to a separate directory.
Add directory for VC 2008 support.

* src/builds/wince: New directory hierarchy for WinCE compilers
(VC 2005 and VC 2008).
2009-03-10 11:54:51 +00:00
Werner Lemberg 21dab9112b More preparations for 2.3.9 release.
* docs/CHANGES: Updated.

* Jamfile, README: s/2.3.8/2.3.9/, s/238/239/.
2009-03-09 18:06:28 +00:00
Werner Lemberg 8312ab7563 * src/sfnt/rules.mk (SFNT_DRV_H): Add ttsbit0.c. 2009-03-09 13:18:47 +00:00
Werner Lemberg ee3cc2e4fc Fix handling of EBDT formats 8 and 9 (part 2).
This patch fixes the following problems in ttsbit0.c:

. Bitmaps for compound glyphs were never allocated.

. `SBitDecoder' refused to load metrics if some other metrics have
  already been loaded.  This condition certainly makes no sense for
  recursive calls, so I've just disabled it.  Another possibility
  would be resetting `decoder->metrics_loaded' to false before
  loading each composite component.  However, we must restore the
  original metrics after finishing the recursion; otherwise we can
  get a misaligned glyph.

. `tt_sbit_decoder_load_bit_aligned' incorrectly handled `x_pos',
  causing some glyph components to be shifted too far to the right
  (especially noticeable for small sizes).

Note that support for grayscale bitmaps (not necessarily compound) is
completely broken in ttsbit0.c.

* src/sfnt/tt_sbit_decoder_load_metrics: Always load metrics.
(tt_sbit_decoder_load_bit_aligned): Handle `x_pos' correctly in case
of `h == height'.
(tt_sbit_decoder_load_compound): Reset metrics after loading
components.
Allocate bitmap.
2009-03-09 13:13:44 +00:00
Werner Lemberg 1a5edf7a4f * builds/unix/configure.raw (version_info): Set to 9:20:3. 2009-03-09 08:36:18 +00:00
Werner Lemberg 42f5c714c0 Formatting. 2009-03-03 23:34:49 +00:00
David Turner ab7e52b1c7 Fix SFNT kerning table parser against malformed tables.
Closes Savannah BUG #25750

	* src/sfnt/ttkern.c (tt_face_get_kerning): fix a bug
	where a malformed table would be succesfully loaded but
	later crash the engine during parsing.
2009-03-03 22:37:13 +00:00
Werner Lemberg 15b60bb513 Formatting, copyright years. 2009-03-03 21:35:32 +00:00
David Turner cda6f49332 Update documentation and bump version number to 2.3.9
* include/freetype/freetype.h: bump patch version to 9
	* docs/CHANGES: document the ABI break in 2.3.8
	* docs/VERSION.DLL: update version numbers table for 2.3.9
	* builds/unix/configure.ac: update AC_INIT and version_info
	numbers.
2009-03-03 20:49:32 +00:00
Werner Lemberg 45f8c5e589 Minor typos. 2009-03-03 14:26:47 +00:00
David Turner 01ca4da203 Remove ABI-breaking field in public PS_InfoFontRec definition.
Instead, we define a new internal PS_FontExtraRec structure to
    hold the additionnal field, then place it in various internal
    positions of the corresponding FT_Face derived objects.
2009-03-03 13:28:59 +00:00
Werner Lemberg 7585683c4a Remove dead code.
Minor formatting.
2009-03-02 09:09:45 +00:00
Werner Lemberg e5a7cc239c Fix handling of EBDT formats 8 and 9.
The main cycle in `blit_sbit' makes too many iterations: it actually
needs the count of lines in the source bitmap rather than in the
target image.

* src/sfnt/ttsbit.c (blit_sbit) [FT_CONFIG_OPTION_OLD_INTERNALS]:
Add parameter `source_height' and use it for main loop.
(Load_SBit_Single) [FT_CONFIG_OPTION_OLD_INTERNALS]: Updated.
2009-03-02 09:09:12 +00:00
Werner Lemberg 14de111f72 Fix Savannah bug #25669.
* src/base/ftadvanc.h (FT_Get_Advances): Fix serious typo.

* src/base/ftobjs.c (FT_Select_Metrics, FT_Request_Metrics): Fix
scaling factor for non-scalable fonts.

* src/cff/cffdrivr.c (cff_get_advances): Use correct advance width
value to prevent incorrect scaling.

* docs/CHANGES: Document it.
2009-02-24 21:34:51 +00:00
Werner Lemberg 1e8599240f Fix Savannah bug #25588.
* builds/unix/ftconfig.in (FT_MulFix_arm): Use correct syntax for
`orr' instruction.
2009-02-15 07:54:35 +00:00
Werner Lemberg f40170a74e Minor documentation fixes.
Formatting.
2009-02-12 22:42:27 +00:00
Werner Lemberg 0552a496c4 * src/truetype/ttobjs.c (tt_check_trickyness): Add `DFKaiShu'.
Reported by David Bevan <dbevan@emtex.com>.
2009-02-11 22:59:40 +00:00
Werner Lemberg c2cabd4291 Fix Savannah bug #25495.
* src/sfnt/sfobjs.c (sfnt_load_face): Test for bitmap strikes before
setting metrics and bbox values.  This ensures that the check for a
font with neither a `glyf' table nor bitmap strikes can be performed
early enough to set metrics and bbox values too.
2009-02-09 22:20:27 +00:00
Werner Lemberg 67bbcbd72d Fix Savannah bug #25480.
* builds/unix/freetype-config.in: For --ftversion, don't use $prefix
but $includedir.
2009-02-04 07:59:16 +00:00
Werner Lemberg 763ae208e5 Minor docmaker improvements.
* src/tools/docmaker/content.py (DocBlock::__init__): Ignore empty
code blocks.
2009-01-30 23:45:53 +00: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 5184ed6d53 Move FT_Get_FSType_Flags to a separate file.
Problem reported by Mickey Gabel <mickey@monfort.co.il>.

* src/base/ftobjs.c (FT_Get_FSType_Flags): Move to...
* src/base/ftfstype.c: This new file.

* modules.cfg (BASE_EXTENSION): Add ftfstype.c.

* docs/INSTALL.ANY: Updated.

* builds/mac/*.txt, builds/amiga/*makefile*,
builds/win32/{visualc,visualce}/freetype.*, builds/symbian/*:
Updated.
2009-01-22 10:13:59 +00:00
Werner Lemberg 5e83ce4d29 Formatting. 2009-01-22 05:53:35 +00:00
Suzuki, Toshiya (鈴木俊哉) a7c5de592c * builds/unix/ftsystem.c: Fix 2 error messages ending without LINEFEED 2009-01-22 04:00:32 +00:00
Suzuki, Toshiya (鈴木俊哉) 5a00909a77 * Fix a bug in POSIX resource-fork accessor since 2008-10-04 2009-01-22 03:50:37 +00:00
Werner Lemberg 0dabaa6ce9 Fix documentation buglets.
Reported by Le Tan Phu <phult@necsv.com>, in report V0021 sent to ft-devel.
2009-01-19 14:31:53 +00:00
Werner Lemberg c591c17b3f Fix Savannah bug #25355.
* include/freetype/config/ftconfig.h (FT_MulFix_i386): Make
assembler code work with gcc 2.95.3 (as used by the Haiku project).
Add `cc' register to the clobber list.
2009-01-19 08:55:15 +00:00
Werner Lemberg 4e263a9559 Documentation fixes.
Reported by Chi Nguyen <chint@necsv.com>, in document V0026 sent to
ft-devel.
2009-01-19 08:47:43 +00:00
Werner Lemberg 0b6b46ffd9 Documentation fixes.
Suggested by Chi Nguyen <chint@necsv.com> in document V0024 sent to the
ft-devel list.
2009-01-19 08:35:45 +00:00
Werner Lemberg 3739f8b987 Protect FT_Get_Next_Char.
* src/sfnt/ttcmap.c (tt_cmap4_set_range): Apply fix similar to
change from 2008-07-22.

Patch from Ronen Ghoshal <rghoshal@emtex.com>.
2009-01-18 13:13:17 +00:00
Werner Lemberg 4f7ef401ea Implement FT_Get_Name_Index for SFNT driver.
* src/sfnt/sfdriver.c (sfnt_get_name_index): New function.
(sfnt_service_glyph_dict): Use it.

Problem reported by Truc Truong <tructv@necsv.com>.
2009-01-18 10:53:29 +00:00
Werner Lemberg 59e2c8dd25 Fix documentation of FT_Outline_GetInsideBorder.
* include/freetype/ftstroke.h (FT_Outline_GetInsideBorder): Fix
documentation.  Problem reported by Truc Truong <tructv@necsv.com>.

* docs/CHANGES: Updated.
2009-01-18 06:42:59 +00:00
Werner Lemberg e22dd0b80f * Version 2.3.8 released.
=========================


Tag sources with `VER-2-3-8'.

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

* README, Jamfile (RefDoc), builds/win32/visualc/index.html,
builds/win32/visualc/freetype.dsp,
builds/win32/visualc/freetype.vcproj,
builds/win32/visualce/index.html,
builds/win32/visualce/freetype.dsp,
builds/win32/visualce/freetype.vcproj: s/2.3.7/2.3.8/, s/237/238/.

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

* builds/unix/configure.raw (version_info): Set to 9:19:3.

* docs/release: Updated.
2009-01-14 06:52:18 +00:00
Werner Lemberg fb4ddb2791 builds/toplevel.mk (dist): Compress better. 2009-01-14 05:30:56 +00:00
Werner Lemberg 9bf73ec407 Fix C++ compilation.
* src/base/ftobjs.c (FT_Get_FSType_Flags): Cast for compilation
with C++.
2009-01-13 17:42:00 +00:00
Werner Lemberg 24d72a1b0b Don't use stdlib.h and friends directly.
Reported by Mickey Gabel <mickey@monfort.co.il>.

* src/base/ftdbgmem.c: s/<stdlib.h>/FT_CONFIG_STANDARD_LIBRARY_H/.

* src/gzip/ftgzip.c, src/lzw/ftlzw.c, src/raster/ftmisc.h:
s/<string.h>/FT_CONFIG_STANDARD_LIBRARY_H/.

* src/autofit/aftypes.h, src/autofit/afhints.c,
src/pshinter/pshalgo.c: s/<stdio.h>/FT_CONFIG_STANDARD_LIBRARY_H/

* src/lzw/ftlzw.c, src/base/ftdbgmem.c: Don't include stdio.h.
2009-01-13 17:34:48 +00:00
Werner Lemberg f47acf2b5f Avoid compiler warnings.
* */*: s/do ; while ( 0 )/do { } while ( 0 )/.
Reported by Sean McBride <sean@rogue-research.com>.
2009-01-12 20:11:14 +00:00
Werner Lemberg e85baf4f8e Fix stdlib dependencies.
Problem reported by Mickey Gabel <mickey@monfort.co.il>.

* include/freetype/config/ftstdlib.h (ft_exit): Removed.  Unused.

* src/autofit/afhints.c, src/base/ftlcdfil.c, src/smooth/ftsmooth.c:
s/memcpy/ft_memcpy/.
* src/psaux/t1decode.c: s/memset/ft_memset/, s/memcpy/ft_memcpy/.
2009-01-12 20:01:10 +00:00
Werner Lemberg 214ca056f5 * include/freetype/ftbdf.h (FT_Get_BDF_Property): Improve documentation. 2009-01-11 11:45:54 +00:00
Werner Lemberg fc6d12a1f7 * docs/formats.txt: Add link to PCF specification. 2009-01-11 10:55:45 +00:00
Suzuki, Toshiya (鈴木俊哉) 759c07d149 load_flags of FT_Get_Advance(), FT_Get_Advances() and backends are declared as FT_Int32 to match the flags of FT_Load_Glyph() 2009-01-09 11:11:53 +00:00
Suzuki, Toshiya (鈴木俊哉) 68e16e0105 * src/gxvalid/gxvmort.c (gxv_mort_feature_validate): Fix wrong length check, Savannah patch #6682. 2009-01-09 08:01:15 +00:00
Werner Lemberg 9d83d29028 Fix problem with T1_FIELD_{NUM,FIXED}_TABLE2.
* src/psaux/psobjs.c (ps_parser_load_field_table): Don't handle
`count_offset' if it is zero (i.e., unused).  Otherwise, the first
element of the structure which holds the data is erroneously
modified.  Problem reported by Chi Nguyen <chint@necsv.com>.
2009-01-09 07:58:08 +00:00
Suzuki, Toshiya (鈴木俊哉) a7c00b79e0 load_flags of FT_Get_Advance(), FT_Get_Advances() and backends are declared as FT_UInt32 for 16-bit platforms 2009-01-09 07:21:16 +00:00
Werner Lemberg 9b1da084c2 tab -> space 2009-01-09 06:21:04 +00:00
Suzuki, Toshiya (鈴木俊哉) 2dc1079494 * src/base/ftobjs.c (FT_Done_Library): Issue an error when FT_Done_Face() is failed and retried 2009-01-09 05:07:15 +00:00
Werner Lemberg a79de11b22 * docs/CHANGES: Document new key `a' in ftdiff. 2009-01-07 08:27:37 +00:00
Werner Lemberg c32637222f Don't rely on GNU sed.
* autogen.sh: Don't use GNUisms while calling sed.  Problem reported
by Sean McBride.
2009-01-06 21:00:47 +00:00
Werner Lemberg 5758688e87 Typo. 2009-01-06 09:40:22 +00:00
Werner Lemberg a86f1b96b5 FT_Bitmap_Convert: Support missing pixel modes.
* src/base/ftbitmap.c (FT_Bitmap_Convert): Handle FT_PIXEL_MODE_LCD
and FT_PIXEL_MODE_LCD_V.  Problem reported by Chi Nguyen
<chint@necsv.com>.
2009-01-06 09:07:22 +00:00
Werner Lemberg c679115f0d Fix AC_CANONICAL_XXX issue.
* builds/unix/configure.raw: Don't call AC_CANONICAL_BUILD and
AC_CANONICAL_TARGET and use $host_os only.  A nice explanation for
this change can be found at
http://blog.flameeyes.eu/s/canonical-target.

From Savannah patch #6712.
2009-01-06 07:07:39 +00:00
Werner Lemberg f2e33c1111 Minor fixes.
* src/base/ftdbgmem.c (_debug_mem_dummy): Make it static.

* src/base/ftmac.c: Remove some #undefs.
2009-01-06 06:59:36 +00:00
Werner Lemberg 1ad384d881 Set `face_index' field in FT_Face for all font formats.
* cff/cffobjs.c (cff_face_init), winfonts/winfnt.c (FNT_Face_Init),
sfnt/sfobjs.c (sfnt_init_face): Do it.

* docs/CHANGES: Document it.
2008-12-25 23:52:00 +00:00
Werner Lemberg 66043b1c4f * builds/unix/ftsystem.c (FT_Stream_Open): Reject zero-length files.
Patch from Savannah bug #25151.
2008-12-22 18:09:48 +00:00
Werner Lemberg 3c5ad95166 * src/pfr/pfrdrivr.c, src/winfonts/winfnt.c, src/cache/ftcmanag.c,
src/smooth/ftgrays.c, src/base/ftobjc.s, src/sfobjs.c:
s/_Err_Bad_Argument/_Err_Invalid_Argument/.  The former is for
errors in the bytecode interpreter only.
2008-12-21 17:51:12 +00:00
Werner Lemberg 478cca14a5 * src/base/ftpfr.c (FT_Get_PFR_Metrics): Protect against NULL
arguments.
Fix return value for non-PFR fonts.  Both problems reported by Chi
Nguyen <chint@necsv.com>.
2008-12-21 17:38:23 +00:00
Werner Lemberg ce33a312da FT_USE_MODULE declares things as:
extern const FT_Module_Class

(or similar for C++).  However, the actual types of the variables
being declared are often different, e.g., FT_Driver_ClassRec or
FT_Renderer_Class.  (Some are, indeed, FT_Module_Class.)

This works with most C compilers (since those structs begin with an
FT_Module_Class struct), but technically it's undefined behavior.

To quote the ISO/IEC 9899:TC2 final committee draft, section 6.2.7
paragraph 2:

  All declarations that refer to the same object or function shall
  have compatible type; otherwise, the behavior is undefined.

(And they are not compatible types.)

Most C compilers don't reject (or even detect!) code which has this
issue, but the GCC LTO development branch compiler does.  (It
outputs the types of the objects while generating .o files, along
with a bunch of other information, then compares them when doing the
final link-time code generation pass.)

Patch from Savannah bug #25133.

* src/base/ftinit.c (FT_USE_MODULE): Include variable type.

* builds/amiga/include/freetype/config/ftmodule.h,
include/freetype/config/ftmodule.h, */module.mk: Updated to declare
pass correct types to FT_USE_MODULE.
2008-12-21 10:29:30 +00:00
Werner Lemberg b6fa845146 * src/autofit/aflatin.c (af_latin_hint_edges),
src/autofit/aflatin2.c (af_latin2_hint_edges), src/autofit/afcjk.c
(af_cjk_hint_edges): Protect against division by zero.
2008-12-21 09:46:31 +00:00
Werner Lemberg 05bf6877a4 * docs/CHANGES: Updated.
Provide API for accessing embedding and subsetting restriction
information.

* include/freetype.h (FT_FSTYPE_INSTALLABLE_EMBEDDING,
FT_FSTYPE_RESTRICTED_LICENSE_EMBEDDING,
FT_FSTYPE_PREVIEW_AND_PRINT_EMBEDDING, FT_FSTYPE_EDITABLE_EMBEDDING,
FT_FSTYPE_NO_SUBSETTING, FT_FSTYPE_BITMAP_EMBEDDING_ONLY): New
macros.
(FT_Get_FSType_Flags): New function declaration.

* src/base/ftobjs.c (FT_Get_FSType_Flags): New function.

* src/cid/cidtoken.h, src/type1/t1tokens.h, src/type42/t42parse.c
(t42_keywords): Handle `FSType'.

* include/freetype/t1tables.h (PS_FontInfoRec): Add `fs_type' field.
2008-12-18 06:32:10 +00:00
Werner Lemberg cfc514ea7e * src/base/ftsynth.c (FT_GlyphSlot_Embolden): Don't use internal
macros so that copying the source code into an application works
out of the box.
2008-12-17 11:03:26 +00:00
Werner Lemberg c8c4cc837c * include/freetype/ftsynth.h, src/basae/ftsynth.c: Move
FT_GlyphSlot_Own_Bitmap to...
* include/freetype/ftbitmap.h, src/base/ftbitmap.c: These files.

* docs/CHANGES: Document it.
2008-12-17 10:50:31 +00:00
Werner Lemberg 00bcd34ae6 Improve documentation of FT_Outline_Embolden. 2008-12-17 10:15:43 +00:00
Werner Lemberg 5914cb621a Minor doc fixes. 2008-12-16 13:12:18 +00:00
Werner Lemberg b972a2a294 Generalize the concept of `tricky' fonts by introducing
FT_FACE_FLAG_TRICKY to indicate that the font format's hinting
engine is necessary for correct rendering.

At the same time, slightly modify the behaviour of tricky fonts:
FT_LOAD_NO_HINTING is now ignored.  To really force raw loading
of tricky fonts (without hinting), both FT_LOAD_NO_HINTING and
FT_LOAD_NO_AUTOHINT must be used.

Finally, tricky TrueType fonts always use the bytecode interpreter
even if the patented code is used.

* include/freetype/freetype.h (FT_FACE_FLAG_TRICKY, FT_IS_TRICKY):
New macros.

* src/truetype/ttdriver.c (Load_Glyph): Handle new load flags
semantics as described above.

* src/truetype/ttobjs.c (tt_check_trickyness): New function, using
code of ...
(tt_face_init): This function, now simplified and updated to new
semantics.

* src/base/ftobjs.c (FT_Load_Glyph): Don't use autohinter for tricky
fonts.

* docs/CHANGES: Document it.
2008-12-11 08:55:48 +00:00
Werner Lemberg 1474f439b5 Really fix Savannah bug #25010: An SFNT font with neither outlines
nor bitmaps can be considered as containing space `glyphs' only.

* src/truetype/ttpload.c (tt_face_load_loca): Handle the case where
a `glyf' table is missing.

* src/truetype/ttgload.c (load_truetype_glyph): Abort if we have no
`glyf' table but a non-zero `loca' entry.
(tt_loader_init): Handle missing `glyf' table.

* src/base/ftobjs.c (FT_Load_Glyph): Undo change 2008-12-05.

* src/sfnt/sfobjs.c (sfnt_load_face): A font with neither outlines
nor bitmaps is scalable.
2008-12-09 06:51:56 +00:00
Werner Lemberg e3b083c65b * src/autofit/aflatin.c (af_latin_uniranges): Add more ranges. This
fixes Savannah bug #21190 which also provides a basic patch.
2008-12-05 22:50:40 +00:00
Werner Lemberg 76fffcd898 * include/freetype/freetype.h (FT_LOAD_ADVANCE_ONLY): Use value
0x100 instead of 0x10000; the latter value is already occupied by
FT_LOAD_TARGET_LIGHT.  Bug reported by James Cloos.


Handle SFNT with neither outlines nor bitmaps.  This fixes Savannah
bug #25010.

* src/base/ftobjs.c (FT_Load_Glyph): Reject fonts with neither
outlines nor bitmaps.

* src/sfnt/sfobjs.c (sfnt_load_face): Don't return an error if there
is no table with glyphs.


* src/sfnt/ttload.c (tt_face_lookup_table): Improve debugging
message.


Other minor cosmetics.
2008-12-05 18:37:44 +00:00
Werner Lemberg afe6016030 GDEF tables need `glyph_count' too for validation. Problem reported
by Chi Nguyen <chint@necsv.com>.

* src/otvalid/otvgdef.c (otv_GDEF_validate), src/otvalid/otvalid.h
(otv_GDEF_validate), src/otvalid/otvmod.c (otv_validate): Pass
`glyph_count'.
2008-12-01 12:53:00 +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 8f9b7f50a5 * src/type/t1load.c (mm_axis_unmap): Revert previous patch and fix
it correctly by using FT_INT_TO_FIXED (FreeType expects 16.16 values
in the /BlendDesignMap space).
2008-11-29 17:35:58 +00:00
Werner Lemberg b2cb6ce6c4 * src/type1/t1load.c (mm_axis_unmap): `blend_points' is FT_Fixed*,
whereas `design_points' is FT_Long*.  Therefore, return blend rather
than design points.
2008-11-29 09:32:12 +00:00
Werner Lemberg 02197280b4 Formatting. 2008-11-29 09:31:44 +00:00
Werner Lemberg c7597edb6a * src/cff/cffparse.c (cff_parse_real): Handle more than nine
significant digits correctly.  This fixes Savannah bug #24953.
2008-11-27 21:55:20 +00:00
Werner Lemberg 0a263a8b31 * src/base/ftstream.c (FT_Stream_ReadFields): Don't access stream
before the NULL check.  From Savannah patch #6681.
2008-11-25 05:44:41 +00:00
Werner Lemberg 52cd0fc8b9 Fixes from the gnuwin32 port.
* src/base/ftlcdfil.c: s/EXPORT/EXPORT_DEF/.

* src/base/ftotval.c: Include FT_OPENTYPE_VALIDATE_H.

* src/psaux/psobjs.c (ps_table_add): Check `length'.
2008-11-24 08:15:05 +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 312043f41b * src/cff/cffdrivr.c (cff_get_cmap_info): Initialize `format' field.
This fixes Savannah bug #24819.

Document `format' field of TT_CMapInfo.
2008-11-12 06:29:41 +00:00
Werner Lemberg e7aad0254c * src/sfnt/sfobjs.c (sfnt_load_face): Remove #if 0/#endif guards
since OpenType version 1.5 has been released.

* include/ttnameid.h (TT_NAME_ID_WWS_FAMILY,
TT_NAME_ID_WWS_SUBFAMILY): New macros for OpenType 1.5.
(TT_URC_COPTIC, TT_URC_VAI, TT_URC_NKO, TT_URC_BALINESE,
TT_URC_PHAGSPA, TT_URC_NON_PLANE_0, TT_URC_PHOENICIAN,
TT_URC_TAI_LE, TT_URC_NEW_TAI_LUE, TT_URC_BUGINESE,
TT_URC_GLAGOLITIC, TT_URC_YIJING, TT_URC_SYLOTI_NAGRI,
TT_URC_LINEAR_B, TT_URC_ANCIENT_GREEK_NUMBERS, TT_URC_UGARITIC,
TT_URC_OLD_PERSIAN, TT_URC_SHAVIAN, TT_URC_OSMANYA,
TT_URC_CYPRIOT_SYLLABARY, TT_URC_KHAROSHTHI, TT_URC_TAI_XUAN_JING,
TT_URC_CUNEIFORM, TT_URC_COUNTING_ROD_NUMERALS, TT_URC_SUNDANESE,
TT_URC_LEPCHA, TT_URC_OL_CHIKI, TT_URC_SAURASHTRA, TT_URC_KAYAH_LI,
TT_URC_REJANG, TT_URC_CHAM, TT_URC_ANCIENT_SYMBOLS,
TT_URC_PHAISTOS_DISC, TT_URC_OLD_ANATOLIAN, TT_URC_GAME_TILES): New
macros for OpenType 1.5.
2008-11-08 22:00:55 +00:00
Werner Lemberg b6192827a3 * src/base/ftobjs.c (ft_glyphslot_free_bitmap): Protect against
slot->internal == NULL.  Reported by Graham Asher.
2008-11-08 07:28:39 +00:00
Werner Lemberg 9512092859 * src/sfnt/sfobjs.c (tt_face_get_name): Modified to return an error
code so that memory allocation problems can be distinguished from
missing table entries.  Reported by Graham Asher.
(GET_NAME): New macro.
(sfnt_load_face): Use it.
2008-11-08 07:20:25 +00:00
Werner Lemberg c321b9b063 * devel/ftoption.h, include/freetype/config/ftoption.h
[TT_CONFIG_OPTION_BYTECODE_INTERPRETER]: Undefine
TT_CONFIG_OPTION_UNPATENTED_HINTING.  This fixes the return value of
`FT_Get_TrueType_Engine_Type' (and makes it work as documented).
Reported in bug #441638 of bugzilla.novell.com.

* docs/CHANGES: Document it.

Other minor documentation improvements.
2008-11-05 14:34:29 +00:00
Werner Lemberg e0ed07d767 * src/type1/t1load.c (parse_subrs): Use an endless loop. There are
fonts (like HELVI.PFB version 003.001, used on OS/2) which define
some `subrs' elements more than once.  Problem reported by Peter
Weilbacher <mozilla@weilbacher.org>.
2008-11-04 10:37:30 +00:00
Werner Lemberg f31072c867 * src/sfnt/ttpost.c (tt_post_default_names): Add `const'. 2008-10-15 20:03:37 +00:00
Suzuki, Toshiya (鈴木俊哉) 6922266b2c * src/truetype/ttgxvar.c (TT_Set_MM_Blend): Disambiguate 2008-10-15 15:22:39 +00:00
Werner Lemberg 5d64257340 add comment 2008-10-15 13:20:17 +00:00
Werner Lemberg 822604c831 * src/cff/cffobjs.c (cff_face_init): Remove compiler warning.
Suggested by Bram Tassyns in Savannah patch #6651.
2008-10-14 07:28:03 +00:00
Werner Lemberg 174b8de328 * src/sfnt/sfobjs.c (sfnt_load_face): Fix computation of
`underline_position'.


* docs/CHANGES: Updated.


Formatting, minor editing.
2008-10-12 11:47:29 +00:00
Werner Lemberg 0192230ea2 (important) formatting 2008-10-11 06:00:15 +00:00
Werner Lemberg cec1d5f86a typo 2008-10-09 07:14:08 +00:00
Suzuki, Toshiya (鈴木俊哉) 1464bc5ad3 * Fix Savannah bug #24468, unexpected conversion between FT_UInt32* and FT_UInt* 2008-10-09 05:44:23 +00:00
Werner Lemberg fa9d39940e Fix Savannah bug #24485.
* src/type1/t1load.c (parse_charstrings): Assure that we always have
a .notdef glyph.
2008-10-08 16:04:46 +00:00
Werner Lemberg 54dd7cf43b Make braces balanced throught the whole file. 2008-10-07 18:15:46 +00:00
Werner Lemberg cd91bf0acc Make braces balanced throughout the whole file. 2008-10-07 18:13:23 +00:00
Werner Lemberg 570b1fdb84 formatting 2008-10-05 06:08:40 +00:00
Werner Lemberg b016c53f42 s/with other words/in other words/ 2008-10-05 05:46:14 +00:00
Suzuki, Toshiya (鈴木俊哉) 96d87bed0e {src/base,builds/mac}/ftobjs.c: Include FT_TRUETYPE_TAGS_H for multi build 2008-10-05 03:08:10 +00:00
Suzuki, Toshiya (鈴木俊哉) af48cb0b98 src/base/ftobjs.c: Include FT_TRUETYPE_TAGS_H 2008-10-05 02:53:06 +00:00
Suzuki, Toshiya (鈴木俊哉) 2d3e0af942 * `FT_Open_Face' tries `open_face_PS_from_sfnt_stream' when a sfnt container is found but not OpenType. 2008-10-05 02:38:57 +00:00
Suzuki, Toshiya (鈴木俊哉) 21bd516592 Introduce macros for some MacOS-specific resource tags 2008-10-04 18:10:28 +00:00
Suzuki, Toshiya (鈴木俊哉) 72eb270ac7 * Remove wrong initialization in `ft_lookup_PS_in_sfnt_stream' 2008-10-04 17:49:58 +00:00
Werner Lemberg 45489589ad * src/base/ftobjs.c (open_face_PS_from_sfnt_stream): Remove compiler
warnings.

Formatting.
2008-10-04 11:39:03 +00:00
Suzuki, Toshiya (鈴木俊哉) 1137d04f85 * New function `open_face_PS_from_sfnt_stream' to check and open a Type1 PS or CID-keyed font in an sfnt stream. 2008-10-04 07:11:58 +00:00
Suzuki, Toshiya (鈴木俊哉) bc2c498419 * src/base/ftobjs.c (ft_lookup_PS_in_sfnt): Set *is_sfnt_cid to FALSE when no PS resource is found 2008-10-03 12:28:52 +00:00
Suzuki, Toshiya (鈴木俊哉) 9e2b9900dc * Remove duplicated functions from builds/mac/ftmac.c. Now MPW builds builds/mac/ftmac.c as a part of ftbase.c 2008-10-03 11:52:22 +00:00
Werner Lemberg 35ae574a51 Add casts for stupid compilers. Reported by Graham. 2008-10-02 10:40:52 +00:00
Werner Lemberg b17fb11f93 * src/cff/cffgload.c (cff_slot_load): Map CID 0 to GID 0. This
fixes Savannah bug #24430.
2008-10-02 10:17:32 +00:00
Werner Lemberg 89a1a51834 * builds/freetype.mk (BASE_H): Rename to...
(INTERNAL_H): This.
(FREETYPE_H): Updated.
* src/base/rules.mk: (BASE_OBJ_S, OBJ_DIR/%.$O): Add BASE_H.
* src/bdf/rules.mk (BDF_DRV_H): Add bdferror.h.
* src/cache/rules.mk (CACHE_DRV_H): Add ftccache.h and ftcsbits.h.
* src/pcf/rules.mk (PCF_DRV_H): Add pcfread.h.
* src/raster/rules.mk (RASTER_DRV_H): Add ftmisc.h.
* src/type42/rules.mk (T42_DRV_H): Add t42types.h.
2008-10-02 06:48:10 +00:00
Werner Lemberg cff15b07f3 Formatting. 2008-10-02 05:38:29 +00:00
Suzuki, Toshiya (鈴木俊哉) ba3e230429 * Fix wrong comment in ftbase.h 2008-10-02 01:48:14 +00:00
Suzuki, Toshiya (鈴木俊哉) f414702e04 * Merge the duplicated functions in ftmac.c with ftobjs.c 2008-10-02 01:43:18 +00:00
Werner Lemberg ce1bad0381 * src/sfnt/sfobjs.c (sfnt_load_face): `psnames_error' is only needed
if TT_CONFIG_OPTION_POSTSCRIPT_NAMES is defined.
2008-10-01 22:46:26 +00:00
Werner Lemberg d03d856d95 * src/truetype/ttobjs.c (tt_face_done), src/cff/cffobjs.c
(cff_face_done), src/pfr/pfrobjs.c (pfr_face_done),
src/pcf/pcfdrivr.c (PCF_Face_Done), src/cid/cidobjs.c
(cid_face_done), src/bdf/bdfdrivr. (BDF_Face_Done),
src/sfnt/sfobjs.c (sfnt_face_done): Protect against face == 0.
Reported by Graham Asher.
2008-10-01 22:39:05 +00:00
Werner Lemberg 6bc16e92e4 s/synthetize/synthesize/ 2008-10-01 21:16:44 +00:00
Werner Lemberg fce4e23998 Formatting. 2008-10-01 04:41:46 +00:00
Suzuki, Toshiya (鈴木俊哉) ef4a915e28 * Fix make rules for multi build on Mac OS X 2008-09-30 16:21:07 +00:00
Suzuki, Toshiya (鈴木俊哉) c6bdee5f27 * Fix the conditions for multi build on MacOS 2008-09-30 00:59:55 +00:00
Werner Lemberg b4c810e2b4 * src/cff/cffgload.c (CFF_Operator, cff_argument_counts,
cff_decoder_parse_charstrings): Handle (invalid)
`callothersubr' and `pop' instructions.
2008-09-22 11:28:46 +00:00
Werner Lemberg bd0f71aa96 Fix Savannah bug #24307.
* include/freetype/internal/t1types.h (CID_FaceRec),
src/type42/t42types.h (T42_FaceRec): Comment out `afm_data'.


* src/smooth/ftgrays.c (gray_raster_render): Don't dereference
`target_map' if FT_RASTER_FLAG_DIRECT is set.  Problem reported by
Stephan T. Lavavej <stl@nuwen.net>.
2008-09-22 08:55:44 +00:00
Suzuki, Toshiya (鈴木俊哉) 815e186f1a * src/{otvalid,sfnt}/Jamfile: Add missing targets for multi build by jam 2008-09-21 18:33:57 +00:00
Werner Lemberg 70f4cff19d * src/smooth/ftgrays.c (gray_find_cell): Fix threshold. The values
passed to this function are already `normalized'.  Problem reported
by Stephan T. Lavavej  <stl@nuwen.net>.

* docs/CHANGES: Document it.
2008-09-20 16:12:05 +00:00
Werner Lemberg 22e970a23e Formatting, minor code fixes. 2008-09-20 12:20:21 +00:00
Werner Lemberg 6874d85ba0 * src/base/ftoutln.c: Include FT_INTERNAL_DEBUG_H.
(FT_Outline_Decompose): Decorate with tracing messages.

* src/smooth/ftgrays.c [DEBUG_GRAYS]: Replace with
FT_DEBUG_LEVEL_TRACE.
[_STANDALONE_ && FT_DEBUG_LEVEL_TRACE]: Include stdio.h and
stdarg.h.

(FT_TRACE) [_STANDALONE_]: Remove.
(FT_Message) [_STANDALONE_ && FT_DEBUG_LEVEL_TRACE]: New function.
(FT_TRACE5, FT_TRACE7) [_STANDALONE_]: New macros.
(FT_ERROR) [_STANDALONE_]: Updated.

(gray_hline) [FT_DEBUG_LEVEL_TRACE]: Fix condition.
Use FT_TRACE7.
(gray_dump_cells): Make it `static void'.
(graay_convert_glyph): Use FT_TRACE7.

(FT_Outline_Decompose) [_STANDALONE_]: Synchronize with version in
ftoutln.c.

* src/base/ftadvanc.c (FT_Get_Advance, FT_Get_Advances): Use
FT_ERROR_BASE.

Other minor modifications.
2008-09-20 11:50:47 +00:00
Suzuki, Toshiya (鈴木俊哉) 3afbee82fe * ftmac.c: Import sfnt-wrapped Type1/CID font support 2008-09-19 17:46:01 +00:00
Suzuki, Toshiya (鈴木俊哉) dec8e7b97d * src/base/ftobjs.c: Fix double free bug in sfnt-wrapped Type1/CID font support 2008-09-19 16:47:01 +00:00
Suzuki, Toshiya (鈴木俊哉) 9ae5eaf862 * src/base/ftobjs.c: Add initial support for sfnt-wrapped CID-keyed fonts 2008-09-19 06:48:35 +00:00
Werner Lemberg 55c40631f4 * src/base/ftsystem.c (FT_Done_Memory): Use ft_sfree directly for
orthogonality (ft_free and ft_sfree could belong to different memory
pools).  This fixes Savannah bug #24297.
2008-09-18 11:20:12 +00:00
Suzuki, Toshiya (鈴木俊哉) 0c0db3eb48 * src/cff/cffobjs.c: replace 0x4F54544FL by TTAG_OTTO 2008-09-18 04:36:56 +00:00
Werner Lemberg 4afcfd3056 beautifying, doc fixes. 2008-09-16 17:32:02 +00:00
Werner Lemberg 634df6e3ba * src/cff/cffgload.h, src/cff/cffgload.c
(cff_decoder_set_width_only): Eliminate function call.
2008-09-16 07:25:31 +00:00
Werner Lemberg ed6c0e063c Fix Savannah bug #24179, reported by Bram Tassyns.
* src/type1/t1load.c (mm_axis_unmap, T1_Get_MM_Var): Fix computation
of default values.


* src/tools/glnames.py (main): Surround `ft_get_adobe_glyph_index'
and `ft_adobe_glyph_list' with FT_CONFIG_OPTION_ADOBE_GLYPH_LIST to
prevent unconditional definition.  This fixes Savannah bug #24241.

* src/psnames/pstables.h: Regenerated.
2008-09-15 07:49:40 +00:00
Werner Lemberg b211651ac9 * autogen.sh, builds/unix/configure.raw,
include/freetype/config/ftconfig.h, builds/unix/ftconfig.in: Minor
beautifying.

* include/freetype/ftadvanc.h, include/freetype/ftgasp.h,
include/freetype/ftlcdfil.h: Protect against FreeType 1.
Some other minor fixes.

* devel/ftoption.h: Synchronize with
include/freetype/config/ftoption.h.

Formatting, documentation improvements.
2008-09-12 16:27:48 +00:00
Werner Lemberg 8d3e6ecc3c * src/base/ftbase.c: Include ftadvanc.c. 2008-09-11 08:29:14 +00:00
Suzuki, Toshiya (鈴木俊哉) 59188661e6 * Fix Savannah bug #21250: builds/unix/configure installs bi-arch ftconfig.h if it works correctly 2008-09-11 08:02:23 +00:00
Suzuki, Toshiya (鈴木俊哉) 8e29645e20 * builds/unix/configure.raw: Clear FT2_EXTRA_LIBS when Mac OS X frameworks are missing 2008-09-05 03:21:21 +00:00
David Turner 17cd687266 * include/freetype/ftcache.h, src/cache/ftccmap.c:
modify FTC_CMapCache_Lookup to accept a negative cmap index
    to mean "use default cached FT_Face's charmap". This fixes
    Savannah issue #22625
2008-09-02 02:34:29 +00:00
David Turner f47d263f1b * include/freetype/ftoption.h, include/freetype/ftconfig.h,
builds/unix/ftconfig.in, include/freetype/freetype.h,
    src/base/ftcalc.c:
    Make FT_MulFix an inlined function. Also provide an assembler
    implementation for ARM architectures. this is done to speedup
    FreeType a little (on x86 3% when loading+hinting, 10% when
    rendering, ARM savings are more important though).
    Disable this by undefining FT_CONFIG_OPTION_INLINE_MULFIX in
    ftconfig.h
2008-09-02 02:21:58 +00:00
David Turner 238bb38513 ooops. Add missing files 2008-09-01 21:35:53 +00:00
David Turner 28534d616b * include/freetype/ftadvanc.h, src/base/ftadvanc.c,
include/freetype/config/ftheader.h, include/freetype/freetype.h,
    src/base/Jamfile, src/base/rules.mk, src/cff/cffdrivr.c,
    src/cff/cffgload.c, src/cff/cffgload.h, src/truetype/ttdriver.c,
    src/truetype/ttgload.h, src/truetype/ttgload.c, src/type1/t1driver.c,
    src/type1/t1gload.h, src/type1/t1gload.c:
    Add a new header named FT_ADVANCES_H declaring some new APIs
    to extract the advances of one or more glyphs without necessarily
    loading their outlines. Also provide 'fast loaders' for the
    TrueType, Type1 and CFF font drivers (more to come later)

    * autogen.sh: add checks for minimum version of the 'autotools'
    stuff.
2008-09-01 21:35:21 +00:00
Suzuki, Toshiya (鈴木俊哉) 7981fe2a0f * src/sfnt/sfobjs.c (sfnt_open_font): Use TTAG_OTTO 2008-08-29 06:09:03 +00:00
Werner Lemberg 4dbf00aa23 * src/type1/t1load.c (parse_encoding): Protect against infinite
loop.  This fixes Savannah bug #24150 (where a patch has been posted
too).
2008-08-28 16:12:48 +00:00
Werner Lemberg a4cb0d95d9 * src/type/t1afm.c (compare_kern_pairs), src/pxaux/afmparse.c
(afm_compare_kern_pairs): Fix comparison.  This fixes Savannah bug
#24119.
2008-08-23 19:54:06 +00:00
Suzuki, Toshiya (鈴木俊哉) 4c60bd916c * Fix FT_Stream_New() to initialize stream always 2008-08-19 15:35:44 +00:00
Werner Lemberg 77f7358533 Formatting. 2008-08-19 04:53:02 +00:00
Suzuki, Toshiya (鈴木俊哉) fdc2d7618a * src/base/ftmac.c: Add a fallback for the case that HAVE_TYPE_RESOURCE_INDEX is not set by configure 2008-08-18 06:02:07 +00:00
Suzuki, Toshiya (鈴木俊哉) a8700d428b * builds/unix/configure.raw: Replace all-in-one Carbon.h by minimum CoreServices.h 2008-08-18 05:08:01 +00:00
Suzuki, Toshiya (鈴木俊哉) a2637823db * src/sfnt/ttcmap.c: Fix for empty sub-headers in Dynalab fonts 2008-08-18 04:44:56 +00:00
Werner Lemberg da32d7054d Add one more example to the documentation of FT_Glyph_To_Bitmap. 2008-08-06 09:09:41 +00:00
Werner Lemberg 293a877a99 Minor documentation improvements. 2008-08-05 18:36:15 +00:00
Werner Lemberg c86f86112f Minor documentation improvement. 2008-08-05 11:18:45 +00:00
Werner Lemberg 7fd201829a * src/type1/t1tokens.h: Handle `ForceBold' keyword. This fixes
Savannah bug #23995.

* src/cid/cidload.c (parse_expansion_factor): New callback function.
(cid_field_records): Use it for `ExpansionFactor'.
* src/cod/cidtoken.h: Handle `ForceBold' keyword.
Don't handle `ExpansionFactor'.
2008-08-04 18:46:37 +00:00
Werner Lemberg eba3eeecd9 * src/cff/cffparse.c (cff_parse_fixed_scaled): Fix thinko which
resulted in incorrect scaling.  This fixes Savannah bug #23973.
2008-08-04 15:54:24 +00:00
Werner Lemberg 17e6901112 Be more tolerant w.r.t. invalid entries in SFNT table directory.
* src/sfnt/ttload.c (check_table_dir): Ignore invalid entries and
adjust table count.
Add more trace messages.
(tt_face_load_font_dir): Updated.
2008-08-04 05:45:41 +00:00
Werner Lemberg 806f59341d * src/cff/cffgload.c (cff_decoder_parse_charstrings): No longer
assume that the first argument on the stack is the bottom-most
element.  Two reasons:

  o According to people from Adobe it is missing in the Type 2
    specification that pushing of additional, superfluous arguments
    on the stack is prohibited.

  o Acroread in general handles fonts differently, namely by popping
    the number of arguments needed for a particular operand (as a PS
    interpreter would do).  In case of buggy fonts this causes a
    different interpretation which of the elements on the stack are
    superfluous and which not.

Since there are CFF subfonts (embedded in PDFs) which rely on
Acroread's behaviour, FreeType now does the same.
2008-07-30 05:28:37 +00:00
Werner Lemberg 830846e645 Formatting, copyright years. 2008-07-27 06:27:21 +00:00
Werner Lemberg 7f30c0c64c Add extra mappings for `Tcommaaccent' and `tcommaaccent'. This
fixes Savanna bug #23940.

* src/psnames/psmodule.c (WGL_EXTRA_LIST_SIZE): Rename to...
(EXTRA_GLYPH_LIST_SIZE): This.
Increase by 2.
(ft_wgl_extra_unicodes): Rename to...
(ft_extra_glyph_unicodes): This.
Add two code values.
(ft_wgl_extra_glyph_names): Rename to...
(ft_extra_glyph_names): This.
Add two glyphs.
(ft_wgl_extra_glyph_name_offsets): Rename to...
(ft_extra_glyph_name_offsets): This.
Add two offsets.

(ps_check_wgl_name, ps_check_wgl_unicode): Rename to...
(ps_check_extra_glyph_name, ps_check_extra_glyph_unicode): This.
Updated.
(ps_unicodes_init): Updated.
2008-07-27 05:43:59 +00:00
Werner Lemberg bdcfddcd43 * src/cff/cffgload.c (cff_decoder_prepare,
cff_decoder_parse_charstrings): Improve debug output.
2008-07-26 21:22:20 +00:00
Werner Lemberg e75da4576e * src/sfnt/ttcmap.c (tt_cmap4_validate, tt_cmap4_char_map_linear,
tt_cmap4_char_map_binary): Handle fonts which treat the last segment
specially.  According to the specification, such fonts would be
invalid but acroread accepts them.
2008-07-22 20:59:59 +00:00
Werner Lemberg 50997cd742 * src/pfr/pfrdrivr.c (pfr_get_advance): Fix off-by-one error.
* src/base/ftcalc.c (FT_MulFix): Fix portability issue.

* src/sfnt/ttpost.c (MAC_NAME) [!FT_CONFIG_OPTION_POSTSCRIPT_NAMES]:
Fix compiler warning.
2008-07-16 21:03:40 +00:00
Werner Lemberg bd48d35bf8 Set FT_FACE_FLAG_CID_KEYED only if pure_cff is set. 2008-07-16 07:05:11 +00:00
Werner Lemberg 3d2f06f399 Handle CID-keyed fonts wrapped in a SFNT (with cmaps) correctly.
* src/cff/cffload.c (cff_font_load): Pass `pure_cff'.
Invert sids table only if `pure_cff' is set.
* src/cff/cffload.h: Udpated.

* src/cff/cffobjs.c (cff_face_init): Updated.
2008-07-16 06:13:34 +00:00
Werner Lemberg 6b19e095be * src/truetype/ttpload.c (tt_face_load_loca): Handle buggy fonts
where num_locations < num_glyphs.  Problem reported by Ding Li.
2008-07-09 06:20:12 +00:00
Werner Lemberg ca6fc732b7 Fix ChangeLog. 2008-07-05 06:36:39 +00:00
Werner Lemberg 4e33f9e53c Since FreeType uses `$(value ...)', we now need GNU make 3.80 or
newer.

* configure: zsh doesn't like ${1+"$@"}.
Update needed GNU make version.
* builds/toplevel.mk: Check for `$(eval ...)'.
* docs/INSTALL.GNU, docs/INSTALL.CROSS, docs/INSTALL.UNIX: Document
it.
2008-07-05 06:35:28 +00:00
Werner Lemberg 71b8f3f2ed * src/raster/ftraster.c (Draw_Sweep): If span is smaller than one
pixel, only check for dropouts if neither start nor end point lies
on a pixel center.  This fixes Savannah bug #23762.
2008-07-04 07:22:06 +00:00
Werner Lemberg be54a68c9d * Version 2.3.7 released.
=========================


Tag sources with `VER-2-3-7'.

* docs/CHANGES, docs/VERSION.DLL: Update documentation and bump
version number to 2.3.7.

* README, Jamfile (RefDoc), builds/win32/visualc/index.html,
builds/win32/visualc/freetype.dsp,
builds/win32/visualc/freetype.vcproj,
builds/win32/visualce/index.html,
builds/win32/visualce/freetype.dsp,
builds/win32/visualce/freetype.vcproj: s/2.3.6/2.3.7/, s/236/237/.

* include/freetype/freetype.h (FREETYPE_PATCH): Set to 7.

* builds/unix/configure.raw (version_info): Set to 9:18:3.

* docs/release: Updated.
2008-06-29 07:43:41 +00:00
Werner Lemberg 4e7d984d94 * src/ftlyph.c (FT_Matrix_Multiply, FT_Matrix_Invert): Move to...
* src/ftcalc.c: Here.  This fixes Savannah bug #23729.
2008-06-27 22:26:11 +00:00
Werner Lemberg a741c6f2aa * src/raster/ftraster.c (Vertical_Sweep_Drop, Horizontal_Sweep_Drop,
Horizontal_Gray_Sweep_Drop): Test for intersections which
degenerate to a single point can be ignored; this has been confirmed
by Greg Hitchcock from Microsoft.  (This was commented out code.)
2008-06-27 06:58:48 +00:00
Werner Lemberg 8a9b63913f Improve navigation in API reference.
* src/tools/docmaker/tohtml.py (html_header_3): Renamed to...
(html_header_6): This.
(html_header_3, html_header_3i, html_header_4, html_header_5,
html_header_5t): New strings.
(toc_footer_start, toc_footer_end): New strings.
(HtmlFormatter::html_header): Updated.
(HtmlFormatter::html_index_header, HtmlFormatter::html_toc_header):
New strings.
(HtmlFormatter::index_enter): Use `html_index_header'.
(HtmlFormatter::index_exit): Print `html_footer'.
(HtmlFormatter::toc_enter): Use `html_toc_header'.
(HtmlFormatter::toc_exit): Print proper footer.

Convert ~ to non-breakable space.

* src/tools/docmaker/tohtml.py (make_html_para): Implement it.
Update header files accordingly.

Many other minor documentation fixes.
2008-06-26 19:56:51 +00:00
Werner Lemberg e172c332bc minor formatting 2008-06-25 22:21:42 +00:00
Werner Lemberg 2be28a448f Fix documentation of `num_glyphs'. 2008-06-25 21:12:14 +00:00
Werner Lemberg 959cb8eb19 minor improvements 2008-06-25 20:58:33 +00:00
Suzuki, Toshiya (鈴木俊哉) f3a924dd53 Fix for 10.4u SDK bundled to Mac OS X 10.5 2008-06-24 17:13:58 +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 5563bea093 * src/psaux/psobjs.c (t1_builder_close_contour): Don't add contour
if it consists of one point only.  Based on a patch from Savannah
bug #23683 (from John Tytgat).
2008-06-24 05:44:28 +00:00
Werner Lemberg 745a4f42a5 * src/truetype/ttgload.c (TT_Load_Glyph): Protect bytecode stuff
with IS_HINTED.

* docs/CHANGES: Updated.
2008-06-22 22:41:24 +00:00
Suzuki, Toshiya (鈴木俊哉) b1c36cfbd9 * builds/unix/configure.raw: Copy -isysroot option from CFLAGS to LDFLAGS, if required 2008-06-22 15:32:56 +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 c91dfa39e8 Improve documentation of gray-level rastering and what to do if you need
less than 256 gray levels.
2008-06-21 06:27:53 +00:00
Werner Lemberg 5b631d894c * src/cff/cffobjs.c (cff_face_init): Compute final
`dict->units_per_em' value before assigning it to
`cffface->units_per_EM'.  Otherwise, CFFs without subfonts are be
scaled incorrectly if the font matrix is non-standard.  This fixes
Savannah bug #23630.

* docs/CHANGES: Updated.
2008-06-19 16:23:43 +00:00
Werner Lemberg cd6dcca658 * src/type/t1objs.c (T1_Face_Init): Slightly improve algorithm. 2008-06-19 06:20:21 +00:00
Werner Lemberg d57a5e9fff * src/type/t1objs.c (T1_Face_Init): Fix change from 2008-03-21.
Reported by Peter Weilbacher <mozilla@weilbacher.org>.

* docs/CHANGES: Updated.
2008-06-18 06:16:39 +00:00
Werner Lemberg ca947c2551 * src/otvalid/otvgpos.c (otv_MarkBasePos_validate): Set
`valid->extra2' to 1.  This is undocumented in the OpenType 1.5
specification.
2008-06-16 05:33:51 +00:00
Werner Lemberg ad83e05b37 * src/base/ftcalc.c (FT_MulFix) <asm>: Protect registers correctly
from clobbering.  Patch from Savannah bug report #23556.

* docs/CHANGES: Document it.
2008-06-15 11:06:12 +00:00
Werner Lemberg b796adb451 * autogen.sh: Add option `--install' to libtoolize. 2008-06-10 17:15:35 +00:00
Werner Lemberg 6174e17cf7 * Version 2.3.6 released.
=========================


Tag sources with `VER-2-3-6'.

* docs/CHANGES, docs/VERSION.DLL: Update documentation and bump
version number to 2.3.6.

* README, Jamfile (RefDoc), builds/win32/visualc/index.html,
builds/win32/visualc/freetype.dsp,
builds/win32/visualc/freetype.vcproj,
builds/win32/visualce/index.html,
builds/win32/visualce/freetype.dsp,
builds/win32/visualce/freetype.vcproj: s/2.3.5/2.3.6/, s/235/236/.

* include/freetype/freetype.h (FREETYPE_PATCH): Set to 6.

* builds/unix/configure.raw (version_info): Set to 9:17:3.


* include/freetype/internal/psaux.h (T1_BuilderRec): Remove `scale_x'
and `scale_y'.
* src/cff/cffgload.h (CFF_Builder): Remove `scale_x' and `scale_y'.


* src/cff/cffparse.c: Include FT_INTERNAL_DEBUG_H.
* src/cff/cffobjs.h: Include FT_INTERNAL_POSTSCRIPT_HINTS_H.
2008-06-10 05:58:25 +00:00
Werner Lemberg f3200faaf3 Typo. 2008-06-10 04:57:57 +00:00
Werner Lemberg 102bb83afd * src/base/ftobjs.c (open_face): Check `clazz->init_face' and
`clazz->done_face'.

Update documentation of FT_Driver_ClassRec.
2008-06-10 04:57:19 +00:00
Werner Lemberg 26bd7a2c5d s/enable_shared/build_libtool_libs/ 2008-06-09 21:27:17 +00:00
Werner Lemberg 630e24d965 Support debugging on WinCE. From Savannah patch #6536; this fixes
bug #23497.

* builds/win32/ftdebug.c (OutputDebugStringEx): New function/macro
as a replacement for OutputDebugStringA (which WinCE doesn't have).
Update all callers.
(ft_debug_init) [_WIN32_CE]: WinCE apparently doesn't have
environment variables.
2008-06-09 21:20:18 +00:00
Werner Lemberg a984fda881 * README.CVS: Updated.
* builds/unix/configure.raw: Updated for newer versions of autoconf
and friends.
2008-06-09 21:02:13 +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 4c3cc76ba0 * include/freetype/ftcache.h (FTC_FaceID): Change type back to
FT_Pointer.  Reported by Ian Britten <britten@caris.com>.
2008-06-03 20:53:49 +00:00
Werner Lemberg 90053f3f66 typo 2008-06-02 13:55:14 +00:00
Werner Lemberg 8e3539bf7c Emit header info for defined FreeType objects in reference.
* src/tools/docmaker/content.py (re_header_macro): New regexp.
(ContentProcessor::__init__): Initialize new dictionary `headers'.
(DocBlock::__init__): Collect macro header definitions.

* src/tools/docmaker/tohtml.py (header_location_header,
header_location_footer): New strings.
(HtmlFormatter::__init__): Pass `headers' dictionary.
(HtmlFormatter::print_html_field): Don't emit paragraph tags.
(HtmlFormatter::print_html_field_list): Emit empty paragraph.
(HtmlFormatter::block_enter): Emit header info.
2008-06-02 13:53:54 +00:00
Werner Lemberg 7493ea12de * include/freetype/config/ftheader.h (FT_UNPATENTED_HINTING_H,
FT_INCREMENTAL_H): Added.
2008-06-02 07:24:36 +00:00
Werner Lemberg e899991b5e More doc fixes to improve HTML version. 2008-05-31 07:03:30 +00:00
Werner Lemberg 2b0b4221ab Cosmetic code changes. 2008-05-28 22:17:28 +00:00
Werner Lemberg 0e9b0ec460 Improve documentation so that it can be better parsed by docmaker.
Formatting.
2008-05-28 21:51:57 +00:00
Werner Lemberg de0d00556e * src/tools/docmaker/sources.py (SourceBlock::__init__): While
looking for markup tags, return immediately as soon a single one is
found.
2008-05-28 21:51:15 +00:00
Werner Lemberg 8f7d17bfe3 formatting 2008-05-28 06:39:33 +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 35a90b7901 * src/tools/docmaker/tohtml.py (block_footer_start,
block_footer_middle): Beautify output.
2008-05-27 18:16:03 +00:00
Werner Lemberg 0c52faa9db add missing casting 2008-05-25 20:04:56 +00:00
Werner Lemberg 57a94c4863 whitespace 2008-05-25 16:49:29 +00:00
Werner Lemberg ffa496574a * src/truetype/ttgload.c (load_truetype_glyph): Move initialization
of the graphics state for subglyphs to...
(TT_Hint_Glyph): This function.
Hinting instructions for a composite glyph apparently refer to the
just hinted subglyphs, not the unhinted, unscaled outline.  This
seems to fix Savannah bugs #20973 and (at least partially) #23310.
2008-05-25 12:43:57 +00:00
Werner Lemberg c938131856 * src/raster/ftraster.c (fc_black_render): Return 0 when we are
trying to render into a zero-width/height bitmap, not an error code.
2008-05-25 12:19:34 +00:00
Werner Lemberg 355f1b13d1 Fix ChangeLog. 2008-05-22 06:12:23 +00:00
Suzuki, Toshiya (鈴木俊哉) 062f88a4f3 * src/base/ftmac.c (FT_New_Face_From_Suitcase): Check if valid aface is returned by FT_New_Face_From_FOND() 2008-05-20 07:57:53 +00:00
Werner Lemberg 5e8a368673 * src/pshinter/pshalgo.c (ps_hints_apply): Reset scale values after
correction for pixel boundary.  Without this patch, the effect can
be cumulative under certain circumstances, making glyphs taller and
taller after each call.  This fixes Savannah bug #19976.
2008-05-18 21:49:02 +00:00
Werner Lemberg 16dc51feae * src/base/ftdebug.c (FT_Message, FT_Panic): Send output to stderr.
This fixes Savannah bug #23280.

* docs/CHANGES: Updated.

Some formatting.
2008-05-18 17:36:15 +00:00
David Turner c567ff279b add missing comment 2008-05-18 14:32:51 +00:00
David Turner a92cec567c * src/psnames/psmodule.c: using 'static' to make declarations
non-global for ft_wgl_extra_unicodes, ft_wgl_extra_glyph_names,
	ft_wgl_extra_glyph_name_offsets, ps_check_wgl_name and
	ps_check_wgl_unicode
2008-05-18 14:08:57 +00:00
Werner Lemberg 89d64fa6e3 * src/truetype/ttgload.c (TT_Load_Simple_Glyph): Handle zero-contour
glyphs correctly.  Patch from Savannah bug #23277.
2008-05-17 20:06:13 +00:00
Werner Lemberg a2f17cc150 * docs/CHANGES: Updated.
Improve support for WGL4 encoded fonts.

* src/psnames/psmodule.c (WGL_EXTRA_LIST_SIZE): New macro.
(ft_wgl_extra_unicodes, ft_wgl_extra_glyph_names,
ft_wgl_extra_glyph_name_offsets): New arrays.
(ps_check_wgl_name, ps_check_wgl_unicode): New functions.
(ps_unicodes_init): Use them to add additional Unicode mappings.
2008-05-17 10:01:45 +00:00
Werner Lemberg bcc750e511 * src/psaux/t1decode.c (t1_decoder_parse_charstrings)
<op_closepath>: `closepath' without a path is a no-op, not an error
(cf. the PS reference manual).

Reported by Martin McBride.
2008-05-16 04:50:00 +00:00
Werner Lemberg bcfcc71d29 * builds/toplevel.mk (CONFIG_GUESS, CONFIG_SUB): Updated. 2008-05-15 09:14:39 +00:00
Werner Lemberg 2d73899925 Fix ChangeLog. 2008-05-14 23:33:53 +00:00
Werner Lemberg 504645ed5b * src/type1/t1load.c (parse_subrs): Accept fonts with a subrs array
which contain a single but empty entry.  This is technically
invalid (since it must end with `return', but...)

Reported by Martin McBride.
2008-05-14 23:26:20 +00:00
Werner Lemberg e6e6eade04 Finish fix of scaling bug of CID-keyed CFF subfonts.
* include/freetype/internal/ftcalc.h, src/base/ftcalc.c
(FT_Matrix_Multiply_Scaled, FT_Vector_Transform_Scaled): New
functions.

* src/cff/cffobjs.h (CFF_Internal): New struct.  It is used to
provide global hinting data for both the top-font and all subfonts
(with proper scaling).

* src/cff/cffobjs.c (cff_make_private_dict): New function, using
code from `cff_size_init'.
(cff_size_init, cff_size_done, cff_size_select, cff_size_request):
Use CFF_Internal and handle subfonts.
(cff_face_init): Handle top-dict and subfont matrices correctly;
apply some heuristic in case of unlikely matrix concatenation
results.  This has been discussed with people from Adobe (thanks
goes mainly to David Lemon) who confirm that the CFF specs are fuzzy
and not correct.

* src/cff/cffgload.h (cff_decoder_prepare): Add `size' argument.

* src/cff/cffgload.c (cff_builder_init): Updated.
(cff_decoder_prepare): Handle hints globals for subfonts.
Update all callers.
(cff_slot_load): Handling scaling of subfonts properly.

* src/cff/cffparse.c (cff_parse_fixed_dynamic): New function.
(cff_parse_font_matrix): Use it.

* src/cff/cfftypes.h (CFF_FontDictRec): Make `units_per_em'
FT_ULong.

* docs/CHANGES: Document it.
2008-05-14 23:05:38 +00:00
Werner Lemberg fb57228b94 * src/winfonts/winfnt.c (fnt_face_get_dll_font, FNT_Face_Init):
Handle case `face_index < 0'.
* docs/CHANGES: Document it.
2008-05-13 12:10:04 +00:00
Werner Lemberg b7c063d523 Add some (commented out) code for orthogonality. 2008-05-11 21:36:37 +00:00
Werner Lemberg 84662841e8 Clean up. 2008-05-04 16:54:23 +00:00
Werner Lemberg 32e05a6a94 Cleaning up. 2008-05-04 16:53:22 +00:00
Werner Lemberg 551dd3c0a6 First steps to fix the scaling bug of CID-keyed CFF subfonts,
reported by Ding Li on 2008/03/28 on freetype-devel.

* src/base/cff/cffparse.c (power_tens): New array.
(cff_parse_real): Rewritten to introduce a fourth parameter which
returns the `scaling' of the real number so that we have no
precision loss.  This is not used yet.
Update all callers.
(cff_parse_fixed_thousand): Replace with...
(cff_parse_fixed_scaled): This function.  Update all callers.
2008-05-04 13:37:38 +00:00
Werner Lemberg 6d29f0f1e8 * src/base/ftobjs.c (FT_Load_Glyph): Call the auto-hinter without
transformation since it recursively calls FT_Load_Glyph.  This fixes
Savannah bug #23143.
2008-05-03 15:54:15 +00:00
Werner Lemberg de9479a00d * include/freetype/internal/psaux.h (T1_BuilderRec): Mark `scale_x'
and `scale_y' as obsolete since they aren't used.
* src/psaux/psobjs.c (t1_builder_init): Updated.

* src/cff/cffgload.h (CFF_Builder): Mark `scale_x' and `scale_y' as
obsolete since they aren't used.
* src/cff/cffgload.c (cff_builder_init): Updated.
2008-04-26 12:52:57 +00:00
Werner Lemberg 4ebc890e06 * src/pcf/pcfdrivr.c (PCF_Face_Init): Protect call to
`FT_Stream_OpenLZW' with `FT_CONFIG_OPTION_USE_LZ'.  From Savannah
bug #22909.
2008-04-13 22:06:12 +00:00
Werner Lemberg 8271e5e443 whitespace 2008-04-13 21:59:29 +00:00
Werner Lemberg 048b756389 * src/psaux/psconv.c (PS_Conv_ToFixed): Increase precision if
integer part is zero.
2008-04-13 05:55:36 +00:00
Werner Lemberg c32e83f23f Fix compilation with g++ 4.1 (with both `single' and `multi'
targets).

* src/base/ftobjs.c (FT_Open_Face): Don't define a variable in block
which is crossed by a `goto'.

* src/otvalid/otvalid.h (otv_MATH_validate): Add prototype.
2008-04-01 06:07:37 +00:00
Werner Lemberg 210d61894b Fix support for subsetted CID-keyed CFFs.
* include/freetype/freetype.h (FT_FACE_FLAG_CID_KEYED,
FT_IS_CID_KEYED): New macros.

* src/cff/cffobjs.c (cff_face_init): Set number of glyphs to the
maximum CID value in CID-keyed CFFs.
Handle FT_FACE_FLAG_CID_KEYED flag.

* docs/CHANGES: Document it.


Fix CFF font matrix calculation and improve precision.

* src/cff/cffparse.c (cff_parse_real): Increase precision if integer
part is zero.
(cff_parse_font_matrix): Simplify computation of `units_per_em';
this prevents overflow also.


Support FT_Get_CID_Registry_Ordering_Supplement for PS CID fonts.

* src/cid/cidriver.c: Include FT_SERVICE_CID_H.
(cid_get_ros): New function.
(cid_service_cid_info): New service structure.
(cid_services): Register it.
2008-04-01 05:55:48 +00:00
Werner Lemberg a56e526671 Adjustments for Visual C++ 8.0, as reported by Rainer Deyke.
* builds/compiler/visualc.mk (CFLAGS): Remove /W5.
(ANSIFLAGS): Add _CRT_SECURE_NO_DEPRECATE.
2008-03-23 14:53:44 +00:00
Werner Lemberg 8575117c50 * src/type1/t1objs.c (T1_Face_Init): Use `/Weight'. Patch from
Savannah bug #22675.
2008-03-21 07:16:00 +00:00
Werner Lemberg 3863c95146 * src/truetype/ttgxvar.c (TT_Get_MM_Var): Fix named style loop.
Patch from Savannah bug #22541.
2008-03-13 06:38:37 +00:00
Werner Lemberg cd874831dc add copyright notices 2008-03-06 22:11:30 +00:00
Werner Lemberg fc29393998 * src/sfnt/ttcmap.c (tt_cmap14_char_map_nondef_binary,
tt_cmap14_find_variant): Return correct value.
(tt_cmap14_variant_chars): Fix check for `di'.
2008-03-03 08:08:12 +00:00
Werner Lemberg 5057e36c15 * docs/CHANGES: Updated. 2008-02-29 07:23:02 +00:00
Werner Lemberg 7faa1554c2 Add build support for symbian platform. From Savannah bug #22440.
* builds/symbian/*: New files.
2008-02-29 07:14:38 +00:00
Werner Lemberg 9b9d3349b2 minor improvements, copyright years 2008-02-21 23:22:06 +00:00
Suzuki, Toshiya (鈴木俊哉) 6cb2faa845 * src/base/ftmac.c: Fix a bug of PostScript font name synthesis in parse_fond(). 2008-02-21 18:46:07 +00:00
Werner Lemberg 31093ccecd minor fixes 2008-02-21 17:10:04 +00:00
Suzuki, Toshiya (鈴木俊哉) 5d3ac4ae12 * builds/unix/confiure.raw: Split the compiler option to link Carbon frameworks for each framework 2008-02-21 10:15:41 +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
Werner Lemberg c903f2f22d minor editing 2008-02-17 08:23:04 +00:00
Werner Lemberg 44c655b01c * src/autofit/afloader.c (af_loader_load_g, af_loader_load_glyph):
Check for valid callback pointers.
2008-02-17 08:22:08 +00:00
Werner Lemberg edc7d81a7b Explain `CJK'. 2008-02-16 05:53:46 +00:00
Suzuki, Toshiya (鈴木俊哉) d2c55ab0e4 fix for inexistent sfnt ID in broken FOND 2008-02-15 09:12:59 +00:00
Werner Lemberg aa722df478 Minor editing. 2008-02-14 10:46:40 +00:00
Suzuki, Toshiya (鈴木俊哉) 60e83a1d57 * src/base/ftbase.c: <ftmac.c> is replaced by "ftmac.c" 2008-02-14 02:55:16 +00:00
Werner Lemberg 744dd456bc * builds/modules.mk (CLOSE_MODULE, REMOVE_MODULE), builds/detect.mk
(dos_setup), builds/freetype.mk (clean_project_dos,
distclean_project_dos): Don't use \ but $(SEP).  Reported by Duncan
Murdoch.
2008-02-11 08:22:40 +00:00
Werner Lemberg 4c93399155 * src/base/ftlcdfil.c (_ft_lcd_filter_legacy): Updated comment to
mention intra-pixel algorithm.

* include/freetype/freetype.h (FT_Render_Mode): Mention that
FT_Library_SetLcdFilter can be used to reduce fringes.
2008-01-18 05:32:55 +00:00
Werner Lemberg 61d83d0938 Oops! 2008-01-18 05:19:20 +00:00
Werner Lemberg 250c01d40a whitespace 2008-01-18 05:16:09 +00:00
Werner Lemberg 53286c0970 more formatting and whitespace 2008-01-18 05:14:13 +00:00
Werner Lemberg 4af139d2e4 formatting, whitespace 2008-01-18 04:53:28 +00:00
Werner Lemberg 1ddd1b768d * src/raster/ftraster.c (ft_black_render): Check `outline' before
using it.  Reported by Allan Yang.
2008-01-16 06:58:54 +00:00
Werner Lemberg ee0f2ab970 Whitespace. 2008-01-12 20:24:01 +00:00
Werner Lemberg eca1f27905 * src/raster/ftraster.c (FT_CONFIG_OPTION_5_GRAY_LEVELS): Remove.
* src/raster/ftraster.c (ft_black_init)
[FT_RASTER_OPTION_ANTI_ALIASING]: Fix compilation.
2008-01-12 07:46:09 +00:00
Werner Lemberg 0b2b5ca764 Small doc improvement. 2008-01-10 10:33:47 +00:00
Werner Lemberg bf391cb858 * src/truetype/ttgload.c (load_truetype_glyph): Handle the case
where the number of contours in a simple glyph is zero (and which
does contain an entry in the `glyf' table).  This fixes Savannah bug
#21990.
2008-01-10 08:47:08 +00:00
Suzuki, Toshiya (鈴木俊哉) 75696860ea Formatting. 2008-01-04 01:43:23 +00:00
Werner Lemberg d2e1573706 * src/smooth/ftgrays.c (gray_raster_render): Check `outline'
correctly.

Whitespace.
2007-12-30 23:49:14 +00:00
Suzuki, Toshiya (鈴木俊哉) 540b954574 Improvement of POSIX resource-fork accessor to load Mac OS X HelveLTMM 2007-12-21 06:03:59 +00:00
Werner Lemberg d156cabcae * src/cff/cffparse.c (cff_parse_real): Don't apply `power_ten'
division too early; otherwise the most significant digit(s) of the
final result are lost as the value is truncated to an integer.  This
fixes Savannah bug #21794 (where the patch has been posted too).
2007-12-14 07:48:32 +00:00
Werner Lemberg bd7e1c3ce0 Pass options from one configure script to another as-is (not
expanded).  This is needed for options like
--includedir='${prefix}/include'.

* builds/unix/detect.mk, configure: Prevent argument expansion in
call to the (real) `configure' script.



* src/truetype/ttgload.c (load_truetype_glyph): Fix compilation if
TT_USE_BYTECODE_INTERPRETER isn't defined.



There exist CFFs which contain opcodes for the Type 1 operators
`hsbw' and `closepath' which are both invalid in Type 2 charstrings.
However, it doesn't harm to support them.

* src/cff/cffgload.c (CFF_Operator): Add `cff_op_hsbw' and
`cff_op_closepath.'
(cff_argument_counts): Ditto.

(cff_decoder_parse_charstrings): Handle Type 1 opcodes 9 (closepath)
and 13 (hsbw) which are invalid in Type 2 charstrings.
2007-12-06 17:17:30 +00:00
Suzuki, Toshiya (鈴木俊哉) a6d36573bd * src/base/ftrfork.c: add support for new pathname syntax "..namedfork/rsrc" to access resource fork on Mac OS X. 2007-12-06 10:27:15 +00:00
Suzuki, Toshiya (鈴木俊哉) 44b5e57781 Mac OS X Carbon tests in configure.raw are improved and builds/mac/ftmac.c is updated to sync to src/base/ftmac.c 2007-12-06 07:47:25 +00:00
Suzuki, Toshiya (鈴木俊哉) 05f5c58d13 Improvements of the document and comments in Mac OS sources by Sean McBride 2007-12-06 05:43:36 +00:00
Werner Lemberg a10d2b7cf5 * src/cff/cffload.c (cff_subfont_load): Don't use logical OR to
concatenate error codes.
* src/sfnt/ttsbit.c (Load_SBit_Range): Ditto.
2007-12-04 22:05:54 +00:00
Werner Lemberg d496b92659 * src/truetype/ttobjs.c (tt_face_init): Don't use logical OR to
concatenate error codes.
2007-12-04 21:49:59 +00:00
Werner Lemberg c0da523270 * src/pfr/pfrgload.c (pfr_glyph_load_compound): Remove compiler
warning.
2007-12-04 21:44:32 +00:00
Werner Lemberg 24fe618bde Improve. 2007-11-23 09:18:07 +00:00
Suzuki, Toshiya (鈴木俊哉) 86c0f90498 * src/base/{ftobjs.c, ftrfork.c}: recovery of Carbon-free legacy MacOS font support in freetype-2.3.4 2007-11-20 14:00:17 +00:00
Suzuki, Toshiya (鈴木俊哉) a547068835 * Add acknowledge of previous Mac OS X 10.5 patch author 2007-11-16 16:29:36 +00:00
Suzuki, Toshiya (鈴木俊哉) 00518cacad * src/base/ftmac.c: Revise Carbon dependent functions for Mac OS X 10.5 2007-11-16 15:48:58 +00:00
Werner Lemberg d503fc57f2 * src/sfnt/sfobjs.c (sfnt_done_face): Check `sfnt' everywhere. This
fixes Savannah bug #21485.
2007-11-01 09:19:44 +00:00
Werner Lemberg 27649fb62b * src/winfonts/winfnt.c (FNT_Face_Init): Check first that the driver
can handle the font at all, then check `face_index'.  Otherwise, the
driver might return the wrong error code.  This fixes Savannah bug
#21468.
2007-10-29 22:00:58 +00:00
Werner Lemberg e77b6c4955 Typo. 2007-10-21 08:18:40 +00:00
Werner Lemberg 7d9c189ac2 * src/sfnt/sfobjs.c (sfnt_load_face): Support bit 9 and prepare
support for bit 8 in the `OS/2' table.  MS is already using this;
hopefully, this becomes part of OpenType 1.5.
Prepare also support for `name' IDs 21 (WWS_FAMILY) and 22
(WWS_SUBFAMILY).
2007-10-21 08:12:30 +00:00
Werner Lemberg 6684257742 * src/tools/docmaker/tohtml.py (html_header_2): Fix typo.
Add `td.left' element to CSS.
(toc_section_enter): Use it.
2007-10-20 16:17:28 +00:00
Werner Lemberg 7f2425fb4f Formatting, improving documentation. 2007-10-20 16:15:07 +00:00
David Turner cf432dbf22 * include/freetype/freetype.h, src/base/ftobjs.c: renamed
cmap14-related new APIs to the FT_Object_ActionName scheme.
        update the documentation for these APIs

        * src/sfnt/ttcmap.c: stronger cmap 14 validation, make the
        code a little more consistent with FreeType coding conventions
        and modify the cmap14 functions that returned a newly allocated
        array to use a persistent vector from the TT_CMap14 object
        instead.
2007-10-19 12:36:40 +00:00
Werner Lemberg 9a966b7d1b Add support for cmap type 14.
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_CMAP_FORMAT_14): New macro.

* include/freetype/internal/ftobjs.h (FT_CMap_CharVarIndexFunc,
FT_CMap_CharVarIsDefaultFunc, FT_CMap_VariantListFunc,
FT_CMap_CharVariantListFunc, FT_CMap_VariantCharListFunc): New
support function prototypes.
(FT_CMap_ClassRec): Add them.
Update all users.

* include/freetype/ttnameid.h (TT_APPLE_ID_VARIANT_SELECTOR): New
macro.

* include/freetype/freetype.h (FT_Get_Char_Variant_Index,
FT_Get_Char_Variant_IsDefault, FT_Get_Variant_Selectors,
FT_Get_Variants_Of_Char, FT_Get_Chars_Of_Variant): New API
functions.

* src/base/ftobjs.c (find_variant_selector_charmap): New auxiliary
function.
(FT_Set_Charmap): Disallow cmaps of type 14.
(FT_Get_Char_Variant_Index, FT_Get_Char_Variant_IsDefault,
FT_Get_Variant_Selectors, FT_Get_Variants_Of_Char,
FT_Get_Chars_Of_Variant): New API functions.

* src/sfnt/ttcmap.c (TT_PEEK_UINT24, TT_NEXT_UINT24): New macros.

(TT_CMap14Rec, tt_cmap14_init, tt_cmap14_validate,
tt_cmap14_char_index, tt_cmap14_char_next, tt_cmap14_get_info,
tt_cmap14_char_map_def_binary, tt_cmap14_char_map_nondef_binary,
tt_cmap14_find_variant, tt_cmap14_char_var_index,
tt_cmap14_char_var_isdefault, tt_cmap14_variants,
tt_cmap14_char_variants, tt_cmap14_def_char_count,
tt_cmap14_get_def_chars, tt_cmap14_get_nondef_chars,
tt_cmap14_variant_chars, tt_cmap14_class_rec): New functions and
structures for cmap 14 support.
(tt_cmap_classes): Register tt_cmap14_class_rec.
(tt_face_build_cmaps): One more error message.

* docs/CHANGES: Mention cmap 14 support.
2007-10-15 17:21:32 +00:00
Werner Lemberg cc272c5166 Clarify `best' in documentation of FT_Select_Charmap. 2007-10-01 07:33:38 +00:00
Werner Lemberg 74597ccd8f * src/base/ftobjs.c (find_unicode_charmap): If search for a UCS-4
charmap fails, do the loop again while searching a UCS-2 charmap.
This favours MS charmaps over Apple ones.
2007-10-01 07:08:56 +00:00
Suzuki, Toshiya (鈴木俊哉) 2be3f472dd * src/base/ftmac.c: Use more abstract data type instead of `short\' 2007-08-29 06:08:59 +00:00
Werner Lemberg abc44f5ecf * src/otvalid/otvcmmn.c (otv_x_y_ux_sy): Skip context glyphs. Found
by Imran Yousaf.  Fixes Savannah bug #20773.

(otv_Lookup_validate): Correct handling of LookupType.  Found by
Imran Yousaf.  Fixes Savannah bug #20782.
2007-08-18 06:38:07 +00:00
Werner Lemberg 23a424f521 * src/otvalid/otvgsub.c (otv_SingleSubst_validate): Fix handling of
SingleSubstFormat1.
2007-08-17 20:16:44 +00:00
Suzuki, Toshiya (鈴木俊哉) 4fc0ccea68 * Fix a bug in configure.raw overlooking native C compiler if named "platform-gcc" 2007-08-11 16:35:06 +00:00
Werner Lemberg 3f1905b191 * src/otvalid/otvcommn.c, src/otvalid/otvcommn.h
(otv_Coverage_validate): Add fourth argument to pass an expected
count value.  Update all users.
Check glyph IDs.
(otv_ClassDef_validate): Check `StartGlyph'.

* src/otvalid/otvgsub.c (otv_SingleSubst_validate): More glyph ID
checks.

* src/otvalid/otvmath.c (otv_MathConstants_validate): There are only
56 constants.
(otv_GlyphAssembly_validate, otv_MathGlyphConstruction_validate):
Check glyph IDs.
2007-08-11 15:45:32 +00:00
Werner Lemberg d76fe5a1af * src/otvalid/otvbase.c, src/otvalid/otvcommn.c,
src/otvalid/otvgdef.c, src/otvalid/otvgpos.c, src/otvalid/otvgsub.c,
src/otvalid/otvjstf.c: s/FT_INVALID_DATA/FT_INVALID_FORMAT/ where
appropriate.  Reported by George.

* include/freetype/internal/fttrace.h: Define `trace_otvmath'.

* src/otvalid/rules.mk (OTV_DRV_SRC): Add otvmath.c.

* docs/CHANGES: Updated.


Add `MATH' validating support to otvalid module.

* include/freetype/tttags.h (TTAG_MATH): New macro.
* include/freetype/ftotval.h (FT_VALIDATE_MATH): New macro.
(FT_VALIDATE_OT): Updated.

* src/otvalid/otmath.c: New file.

* src/otvalid/otvalid.c: Include otvmath.c.
* src/otvalid/otvmod.c (otv_validate): Handle `MATH' table.
2007-08-08 06:38:06 +00:00
Werner Lemberg b66178851a * builds/unix/configure.raw: Add call to AC_LIBTOOL_WIN32_DLL.
Fixes Savannah bug #20686.
2007-08-04 22:17:48 +00:00
Werner Lemberg d6752a6bfb * src/psnames/psmodule.c: Fix usage of
FT_CONFIG_OPTION_POSTSCRIPT_NAMES macro.  Reported by Graham Asher.
2007-08-02 22:03:30 +00:00
Suzuki, Toshiya (鈴木俊哉) cf093cd7d2 * Fix src/base/ftmac.c (open_face_from_buffer): fix the type of driver_type as const. 2007-07-31 03:58:09 +00:00
Werner Lemberg 39c91ad444 * src/raster/ftraster.c (count_table): Make it conditional.
* src/base/ftobjs.c (FT_New_Library): Check FT_RENDER_POOL_SIZE with
a preprocessor statement.
2007-07-28 05:40:40 +00:00
Werner Lemberg 71dd687310 * src/base/ftoutln.c (FT_Outline_Translate): Check `outline' before
first usage.  From Savannah patch #6115.
2007-07-27 04:44:36 +00:00
Werner Lemberg 5bfe0d0465 Really add new files. 2007-07-17 04:57:01 +00:00
Werner Lemberg ef915c36f4 * docs/CHANGES: Updated.
Add new service for getting the ROS from a CID font.

* include/freetype/config/ftheader.h (FT_CID_H): New macro.
* include/freetype/ftcid.h: New file.

* include/freetype/internal/ftserv.h (FT_SERVIVE_CID_H): New macro.
* include/freetype/internal/services/svcid.h: New file.

* src/base/ftcid.c: New file.

* src/cff/cffdrivr.c: Include FT_SERVICE_CID_H.
(cff_get_ros): New function.
(cff_service_cid_info): New service structure.
(cff_services): Register it.

* src/cff/cffload.c (cff_font_done): Free registry and ordering.

* src/cff/cfftypes.h (CFF_FontRec): Add `registry' and `ordering'.

* modules.cfg (BASE_EXTENSIONS): Add ftcid.c.
2007-07-16 20:46:05 +00:00
Werner Lemberg 2f10956744 Add support for postscript name service to CFF driver.
* src/cff/cffdrivr.c: Include FT_SERVICE_POSTSCRIPT_NAME_H.
(cff_get_ps_name): New function.
(cff_service_ps_name): New service structure.
(cff_services): Register it.
2007-07-11 05:32:00 +00:00
Werner Lemberg d21fe6e5d6 Really restore changes introduced in revision 1.178. 2007-07-10 23:10:39 +00:00
Werner Lemberg b003b3e7b5 * src/base/ftglyph.c (FT_Glyph_Copy): Fix initialization of
`target'.  Reported by Sean McBride.
2007-07-08 07:13:12 +00:00
Werner Lemberg 1e1b6dff54 * src/pfr/pfrcmap.c: Include pfrerror.h.
* src/autofit/afindic.c: Add some external declarations to pacify
`make multi' compilation.

* src/cid/cidgload.c (cid_load_glyph): Pacify compiler.

* src/cff/cffdrivr.c (cff_ps_get_font_info), src/cff/cffobjs.c
(cff_strcpy), include/freetype/internal/ftmemory.h (FT_MEM_STRDUP),
src/autofit/aflatin.c (af_latin_hints_compute_edges),
src/autofit/afcjk.c (af_cjk_hints_compute_edges), src/sfnt/ttmtx.c
(tt_face_get_metrics), src/base/ftobjs.c (open_face)
[FT_CONFIG_OPTION_INCREMENTAL]: Fix compilation with C++ compiler.

* docs/release: Mention test compilation targets.
2007-07-07 07:30:40 +00:00
Werner Lemberg 0f6f367ec1 Better maxComponentDepth test. 2007-07-04 19:57:45 +00:00
Werner Lemberg 3033f4366b * src/truetype/ttgload.c (load_truetype_glyph): Always allow a
recursion depth of 1.  This was the maximum value in TrueType 1.0,
and some older fonts don't set this field correctly.

* src/gxvalid/gxvmort1.c
(gxv_mort_subtable_type1_substTable_validate): Fix tracing message.
2007-07-04 14:12:19 +00:00
Werner Lemberg 986ea4b2cb * docs/PROBLEMS: Mention that some PS based fonts can't be
handled correctly by FreeType.
2007-07-04 04:53:15 +00:00
Werner Lemberg 3b0e500601 * src/autofit/aflatin.c (af_latin_metrics_init_blues): Initialize
`round' to pacify compiler.

Really commit changes which have been used to build release 2.3.5.
2007-07-03 04:48:19 +00:00
Werner Lemberg aa52eab74a Updated. 2007-07-02 15:14:50 +00:00
Werner Lemberg e3be90bf28 formatting 2007-07-02 14:58:58 +00:00
David Turner 481b25f009 * include/freetype/freetype.h, src/base/ftpatent.c: adding
FT_Face_SetUnpatentedHinting to dynamically change the setting
	after a face is created.
2007-07-01 09:51:15 +00:00
David Turner 0ba8991292 fix a small bug in the TrueType loader that created distortion in the result
of bytecode-hinted text. Werner, feel free to package 2.3.5 now :-)
2007-07-01 09:34:04 +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 7723dc34d3 Add autofit module for Indic scripts. This currently just reuses
the CJK-specific functions.

* include/freetype/config/ftoption.h (AF_CONFIG_OPTION_INDIC): New
macro.
* devel/ftoption.h: Synchronize with
include/freetype/config/ftoption.h.

* src/autofit/afindic.c, src/autofit/afindic.h: New files.

* src/autofit/afglobal.c, src/autofit/aftypes.h,
src/autofit/autofit.c: Updated.

* src/autofit/Jamfile (_sources), * src/autofit/rules.mk
(AUTOF_DRV_SRC): Updated.
2007-06-26 04:44:35 +00:00
Werner Lemberg 7854c4a521 Fix ChangeLog. 2007-06-23 07:16:20 +00:00
David Turner 8f626b04f3 fix stupid typo that prevented the truetype loader from working correctly 2007-06-22 22:22:38 +00:00
Werner Lemberg 5b4d435a96 * src/cff/cffgload.c (cff_slot_load): Fix logic of 2007-05-28
change.
2007-06-20 07:07:55 +00:00
Werner Lemberg c67fb6f1a3 Fix ChangeLog. 2007-06-20 06:08:13 +00:00
Werner Lemberg 9fe5815c97 * src/type1/t1load.c (parse_encoding): Handle one more error. 2007-06-19 07:57:30 +00:00
Werner Lemberg 5a829394f6 * src/winfonts/winfnt.c (fnt_face_get_dll_font): Return error
FNT_Err_Invalid_File_Format if file format was recognized but
the file doesn't contain any FNT(NE) or RT_FONT(PE) resources.
Add verbose debug logs to make it easier to debug failing load
attempts.
(FNT_Face_Init): A single FNT font can't contain more than 1 face,
so return an error if requested face index is > 0.
Do not do further attempt to load fonts if a previous attempt has
failed but returned error FNT_Err_Invalid_File_Format, i.e., the
file format has been recognized but no fonts found in the file.
2007-06-19 04:53:30 +00:00
Suzuki, Toshiya (鈴木俊哉) 7893501c3e * fix compiler warnings of src/base/ftmac.c, drop unnecessary part for Mac OS X. 2007-06-19 03:27:05 +00:00
Werner Lemberg bb2510daec * src/type42/t42parse.c (t42_parse_encoding): Handle one more error. 2007-06-18 17:07:49 +00:00
Werner Lemberg f9fa1c8b77 * src/psaux/psobjs.c (ps_parser_skip_PS_token): Remove incorrect
assertion.
(ps_parser_to_bytes): Fix error message.

* src/type42/t42objs.c (T42_Open_Face): Handle one more error
return.
* src/type42/t42parse.c (t42_parse_sfnts): s/alloc/allocated/.
Don't allow mixed binary and hex strings.
Handle zero string_size == 0 and string_buf == 0.
2007-06-18 17:00:05 +00:00
Werner Lemberg 95104a4d57 * src/cff/cffgload.c (cff_decoder_prepare): Fix change from
2007-06-06.
2007-06-18 07:33:10 +00:00
Werner Lemberg f48aec7b1e * src/psaux/psobjs.c (ps_tofixedarray, ps_tocoordarray): Fix exit
logic.
(ps_parser_load_field) <T1_FIELD_TYPE_BBOX>: Skip delimiters
correctly.
(ps_parser_load_field_table): Use `fields->array_max' instead of
T1_MAX_TABLE_ELEMENTS to limit the number of arguments.
2007-06-18 07:07:55 +00:00
Werner Lemberg be183ebb5d * src/winfonts/winfnt.c (fnt_face_get_dll_font): Exit in case of
invalid font.
(FNT_Load_Glyph): Protect against invalid bitmap width.
2007-06-17 11:27:17 +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
David Turner 6c2ab0977c prevent a 16-bit integer overflow that would create problems when rendering
*very* large anti-aliased outlines
2007-06-16 16:40:37 +00:00
Werner Lemberg e9f4799940 Document ftpatchk. 2007-06-16 09:32:31 +00:00
Werner Lemberg ab1604bd6b * src/winfonts/winfnt.h: Add necessary structures for PE resource
parsing.
(WinPE32_HeaderRec): New structure.
(WinPE32_SectionRec): New structure.
(WinPE_RsrcDirRec): New structure.
(WinPE_RsrcDirEntryRec): New structure.
(WinPE_RsrcDataEntryRec): New structure.
(FNT_FontRec): Remove unused `size_shift' field.

* src/winfonts/winfnt.c (fnt_face_get_dll_font): Add support for
loading bitmap .fon files in PE format.
2007-06-16 07:59:39 +00:00
Werner Lemberg 08a645d833 * builds/win32/ftdebug.c: Unify debug level handling with other
platforms.
2007-06-15 14:05:20 +00:00
Werner Lemberg 367f301b44 * builds/win32/ftdebug.c (FT_Message): Send debug output to the
console as well as to the debugger.
2007-06-14 06:56:52 +00:00
Werner Lemberg 46dde4953a * src/autofit/aflatin.c (af_latin_uniranges): Expand structure to
cover all ranges which could possibly be handled by the aflatin
module (since the default fallback for unknown ranges is now the
afcjk module).  It might be necessary to fine-tune this further by
splitting off modules for Greek, Cyrillic, or other blocks.
2007-06-14 03:59:02 +00:00
Werner Lemberg 49e18b8d5f formatting 2007-06-11 21:15:09 +00:00
David Turner a48162759e experimental auto-hinter updates 2007-06-11 20:35:54 +00:00
David Turner b38c15da09 fix bug #19565, which was caused by an incorrect segment link computation 2007-06-11 19:36:48 +00:00
David Turner b792017faf experimental changes for the Latin auto-hinter.
note that the new code is disabled by default.
2007-06-11 05:37:35 +00:00
Werner Lemberg cf7b764285 Fix ChangeLog. 2007-06-11 04:58:01 +00:00
Werner Lemberg f6c120f826 * docs/CHANGES: Document FT_Face_CheckTrueTypePatents).
Formatting, reformulations.
2007-06-11 04:55:58 +00:00
David Turner 7fa30ee879 remove compiler warning 2007-06-11 00:55:23 +00:00
David Turner 75e7acd840 add missing file, doh ! 2007-06-11 00:26:25 +00:00
David Turner 5f5e544611 slight speed-up of the TrueType glyph loader 2007-06-11 00:18:00 +00:00
David Turner 84c6f88117 * include/freetype/config/ftoption.h: clarify documentation regarding
unpatented hinting

	* include/freetype/freetype.h, src/base/ftpatent.c, src/truetype/ttdriver.c,
	include/freetype/internal/services/svttglyf.h, modules.cfg,:
	include/freetype/internal/ftserv.h,:
	Fonts without a cmap must be handled correctly by FreeType (anything
	Adding the FT_Face_CheckTrueTypePatents API to FT_FREETYPE_H, it is
	implemented by the optional src/base/ftpatent.c
2007-06-10 20:51:04 +00:00
Werner Lemberg 33db39e292 * src/sfnt/sfobjs.c (sfnt_load_face): Undo change from 2007-04-28.
Fonts without a cmap must be handled correctly by FreeType (anything
else would be a bug).


* src/psaux/t1decode.c (t1_decoder_parse_charstrings)
[FT_DEBUG_LEVEL_TRACE]: Improve tracing message.
2007-06-08 06:30:29 +00:00
Werner Lemberg 88ab638e0f * src/sfnt/ttsbit0.c (tt_sbit_decoder_init,
tt_sbit_decoder_load_image): Protect against integer overflows.


* src/pfr/pfrgload.c (pfr_glyph_load_simple): More bounding checks
for `x_control' and `y_control'.
2007-06-07 05:01:56 +00:00
Werner Lemberg 470210b73c * src/winfonts/winfnt.c (fnt_face_get_dll_font): Do a rough check of
`font_count'.


* src/type1/t1load.c (parse_font_matrix): Check `temp_scale'.


* src/cff/cffgload.c (cff_decoder_prepare): Change return type to
`FT_Error'.
Check `fd_index'.
(cff_slot_load): Updated.
* src/cff/cffgload.h: Updated.
2007-06-06 10:05:49 +00:00
Werner Lemberg a8d65494cb * src/pfr/pfrcmap.c (pfr_cmap_init): Convert assertion into normal
FreeType error.
2007-06-06 04:47:49 +00:00
Werner Lemberg 2a2dca6b40 * src/base/ftoutln.c (FT_Outline_Decompose): Check `last'. 2007-06-06 04:39:37 +00:00
Werner Lemberg e5c14d93b8 * src/psaux/psobjs.c (ps_tocoordarray, ps_tofixedarray): Return -1
in case of parsing error.
(ps_parser_load_field): Updated.

* src/type1/t1load.c (parse_font_matrix): Updated.
2007-06-05 20:50:37 +00:00
Werner Lemberg f4bc3f40b3 * src/winfnt/winfnt.c (FNT_Face_Init): Check `family_size'. 2007-06-05 07:32:15 +00:00
Werner Lemberg 6e2f9d5db7 Improve tracing messages. 2007-06-05 06:58:48 +00:00
Werner Lemberg 1053656d24 whitespace 2007-06-05 06:49:50 +00:00
Werner Lemberg 9a0332cd3f * src/pfr/pfrgload.c (pfr_glyph_curve_to, pfr_glyph_line_to): Convert
assertion into normal FreeType error.
2007-06-05 05:50:01 +00:00
Werner Lemberg 6c05475d50 * src/pfr/pfrgload.c (pfr_glyph_done): Comment out unused code.
(pfr_glyph_load_simple): Convert assertion into normal FreeType
error.
Check `idx'.
(pfr_glyph_load_compound): Convert assertion into normal FreeType
error.

* src/pfr/pfrtypes.h (PFR_GlyphRec): Comment out unused code.
2007-06-05 05:27:54 +00:00
Werner Lemberg ad18b367e9 * src/cid/cidgload.c (cid_load_glyph): Check `fd_select'.
* src/tools/ftrandom/Makefile: Depend on `libfreetype.a'.
2007-06-04 07:04:05 +00:00
Werner Lemberg 25b14229f1 More OBJ_DIR. 2007-06-03 19:53:02 +00:00
Werner Lemberg f2ff7329c7 Some explanations, taken from an email sent by George. 2007-06-03 19:50:57 +00:00
Werner Lemberg 2fdb70e9d5 Fold fttest.c into ftrandom.c (as it was orginally). 2007-06-03 19:38:59 +00:00
Werner Lemberg 99a320b431 * src/tools/ftrandom/*: Add the `ftrandom' test program written by
George Williams (with some modifications).
2007-06-03 19:21:26 +00:00
Werner Lemberg 3d507fefe8 * src/base/ftobjs.c (destroy_charmaps), src/type1/t1objs.c
(T1_Face_Done), src/winfonts/winfnt.c (FNT_Face_Done): Check for
face == NULL.  Suggested by Graham Asher.
2007-06-03 16:54:55 +00:00
Werner Lemberg ce280a22e2 * src/base/ftobjs.c (FT_Request_Metrics): Fix compiler warning. 2007-06-03 05:58:30 +00:00
Werner Lemberg 5b591e49cf * include/freetype/fterrdef.h (FT_Err_Corrupted_Font_Header,
FT_Err_Corrupted_Font_Glyphs): New error codes for BDF files.

* src/bdf/bdflib.c (bdf_load_font): Use them.

* src/bdf/bdflib.c (_bdf_parse_start): Check `FONT' better.
2007-06-01 22:16:43 +00:00
Werner Lemberg b9933f4b02 * src/base/ftobjs.c (FT_Request_Metrics), src/cache/ftccmap.c
(FTC_CMapCache_Lookup): Remove unused code.
2007-06-01 21:27:12 +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 4d2815db50 (cid_parser_new): Exit properly if no `StartData' has been seen at all. 2007-06-01 07:49:31 +00:00
Werner Lemberg 936346413f Remove tabs from source files. 2007-06-01 06:56:17 +00:00
Werner Lemberg cb37b3b36a * builds/unix/ftsystem.c (FT_Stream_Open): Don't use ULONG_MAX but
LONG_MAX to avoid compiler warning.  Suggested by Sean McBride.
2007-06-01 06:49:03 +00:00
Werner Lemberg bebc7b11c5 * src/cid/cidparse.c (cid_parser_new): Don't continue second search
pass for `StartData' if an error has occurred.
2007-06-01 06:32:30 +00:00
Werner Lemberg ba03af6f91 * src/type1/t1load.c (parse_subrs, parse_charstrings): Protect
against too small binary data strings.

* src/bdf/bdflib.c (_bdf_parse_glyphs): Check `STARTCHAR' better.
2007-05-30 13:57:02 +00:00
Werner Lemberg 99e0c18ea1 Formatting, reformulations. 2007-05-29 07:00:23 +00:00
David Turner c510d5d837 remove compiler warning (unused variable) 2007-05-28 21:34:04 +00:00
David Turner 0291a5c696 updating CHANGES 2007-05-28 15:49:08 +00:00
David Turner 552a956247 optimize CFF glyph loader (avoid apply identity font transform) 2007-05-28 15:45:35 +00:00
David Turner f0cd69c1b4 2007-05-28 David Turner <david@freetype.org>
* src/autofit/afglobal.c: change default hinting script to
	CJK, since it works well with a larger array of scripts. thanks to
	"Rahul Bhalerao" <b.rahul.pm@gmail.com> for pointing this out !
2007-05-28 15:42:09 +00:00
Werner Lemberg 1c8980ef4a * docs/CHANGES: Updated.
Formatting.
2007-05-25 07:11:12 +00:00
Werner Lemberg 6ff2ff574b * src/truetype/ttobjs.h (tt_size_ready_bytecode): Move declaration
into TT_USE_BYTECODE_INTERPRETER preprocessor block.

* src/truetype/ttobjs.c (tt_size_ready_bytecode)
[!TT_USE_BYTECODE_INTERPRETER]: Removed.  Unused.
2007-05-24 19:39:14 +00:00
David Turner 7890686d80 fix crash when not using the bytecode interpreter with TrueType fonts 2007-05-22 14:08:09 +00:00
David Turner 3e2f953a10 real fix for bug #19910. the .Z format is really badly designed :-( 2007-05-22 13:10:59 +00:00
David Turner 0d0365ec59 avoid heap explosion in the case of malformed .Z font files
related to bug #19910, but not a bugfix yet
2007-05-22 09:53:44 +00:00
Werner Lemberg 9df3c223f7 * src/pshinter/pshrec.c (ps_mask_table_set_bits): Add `const'.
(ps_dimension_set_mask_bits): Remove `const'.
2007-05-20 18:07:52 +00:00
Werner Lemberg 0f2b7bda6e * src/sfnt/ttmtx.c (tt_face_get_metrics)
[!FT_CONFIG_OPTION_OLD_INTERNALS]: Another type-punning fix.
2007-05-19 15:15:47 +00:00
Werner Lemberg 799441101a typo 2007-05-19 14:10:06 +00:00
Werner Lemberg c1d2257e46 Updated. 2007-05-19 07:24:55 +00:00
Werner Lemberg b826fa7589 Savannah patch #5929.
* include/freetype/tttables.h, src/base/ftobjcs.c
(FT_Get_CMap_Format): New function.

* include/freetype/internal/services/svttcmap.c (TT_CMapInfo): Add
`format' member.
* src/sfnt/ttcmap.c (tt_cmap{0,2,4,6,8,10,12}_get_info): Set
cmap_info->format.
2007-05-19 07:18:48 +00:00
Werner Lemberg 6f99c88801 * src/truetype/ttgload.c (load_truetype_glyph): Save graphics state
before handling subglyphs so that it can be reinitialized each time.
This fixes Savannah bug #19859.
2007-05-19 07:01:49 +00:00
Werner Lemberg d069246805 Oops! Incorrect application of a patch... 2007-05-16 15:48:02 +00:00
Werner Lemberg 95bc9d3a07 * src/cache/ftccache.c (ftc_node_mru_link, ftc_node_mru_unlink),
src/cache/ftccache.h (FTC_CACHE_LOOKUP_CMP), src/cache/ftcglyph.h
(FTC_GCACHE_LOOKUP_CMP), src/pshinter/pshmod.c (ps_hinter_init),
src/sfnt/ttmtx.c (tt_face_load_hmtx, tt_face_load_hhea,
tt_face_get_metrics): Fix type-punning issues.
2007-05-16 15:19:42 +00:00
Werner Lemberg 6ae7ff0607 Formatting, typos. 2007-05-15 11:55:37 +00:00
David Turner 0a24bd259a do not use functions from <ctypes.h>, they are locale-dependent (and slower) 2007-05-15 10:54:10 +00:00
Werner Lemberg 607dec79bb * src/autofit/afcjk.c (af_cjk_hints_compute_edges): Remove unused
variable.
* src/autofit/afloader.c (af_loader_load_g): Ditto.

* src/base/ftobjs.c (ft_validator_error): Use `ft_jmp_buf'.
(open_face_from_buffer): Initialize `stream'.
(FT_Request_Metrics): Remove unused variable.
Remove redundant `break' statements.
(FT_Get_Track_Kerning): Remove unused variable.

* src/psaux/afmparse.c (afm_parse_track_kern, afm_parse_kern_pairs,
afm_parse_kern_data): Remove redundant
`break' statements.
(afm_parser_parse): Ditto.
Don't use uninitialized variables.

* src/psnames/psmodule.c (VARIANT_BIT): Define as unsigned long.
Use `|' operator instead of `^' to set it.
Update all users.

* src/sfnt/ttcmap.c (tt_face_build_cmaps): Use `ft_jmp_buf'.
* src/sfnt/ttkern.c (tt_face_load_kern): Remove unused variable.

* src/truetype/ttgload.c (TT_Load_Simple_Glyph): Remove redundant
comparison.
(TT_Process_Simple_Glyph): Use FT_UInt for `n_points' and `i'.
(TT_Load_Glyph): Remove unused variable.
2007-05-15 06:49:37 +00:00
Werner Lemberg 56ceaa4853 Formatting. 2007-05-14 18:53:58 +00:00
Werner Lemberg 8d463a53d1 * src/base/ftobjs.c (FT_New_Library): Only allocate rendering pool
if FT_RENDER_POOL_SIZE is > 0.  From Savannah patch #5928.
2007-05-13 16:01:55 +00:00
David Turner 711cf84749 implement FTC_ImageCache_LookupScaler and FTC_SBitCache_LookupScaler,
which allow us to specify the font size with a FTC_Scaler structure,
hence enabling fractional point sizes, etc...
2007-05-11 14:36:24 +00:00
David Turner a8b45e6183 fix a typo that force CVT scaling to be re-run on each glyph load 2007-05-11 14:10:30 +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
Werner Lemberg 4127103f8d * builds/win32/visualce/freetype.sln: Removed, as requested by
Vincent.
2007-05-06 04:51:48 +00:00
Werner Lemberg 405e25949c whitespace 2007-05-05 06:26:09 +00:00
Werner Lemberg df49e697c1 * builds/win32/visualce/*: Add Visual C++ project files for Pocket
PC targets.

* docs/CHANGES: Document them.
2007-05-04 06:30:05 +00:00
Werner Lemberg 5077e83e11 * builds/unix/ftsystem.c (FT_Stream_Open): Handle return value 0 of
mmap (which might happen on some RTOS).  From Savannah patch #5909.
2007-05-04 06:13:46 +00:00
Werner Lemberg 106eaf1dbb * src/base/ftobjs.c (FT_Set_Char_Size): Simplify code.
* include/freetype/freetype.h (FT_Set_Char_Size): Update
documentation.
2007-05-03 07:07:47 +00:00
Werner Lemberg 1b5267dad1 * src/sfnt/sfobjs.c (sfnt_load_face): Check error code after loading
`cmap'.
2007-04-28 21:06:15 +00:00
Werner Lemberg cc712a248c * src/truetype/ttgload.c (TT_Load_Simple_Glyph): Check for negative
number of points in contours.  Problem reported by Victor Stinner
<victor.stinner@haypocalc.com>.
(TT_Process_Simple_Glyph): Synchronize variable types.
2007-04-27 17:16:50 +00:00
Werner Lemberg 45bb18fc7b * src/base/ftglyph.c (FT_Glyph_Copy): Always set second argument to
zero in case of error.  This fixes Savannah bug #19689.
2007-04-26 06:26:35 +00:00
Werner Lemberg fcc1f472c3 * src/sfnt/sfobjs.c (sfnt_load_face) [FT_CONFIG_OPTION_INCREMENTAL]:
Ignore `hhea' table.  This fixes Savannah bug #19261.
2007-04-10 11:51:50 +00:00
Werner Lemberg 7b512f50d3 Documentation: s/ttengine/truetype_engine/ for orthogonality. 2007-04-10 05:13:03 +00:00
Werner Lemberg 14bf82e129 * Version 2.3.4 released.
=========================


Tag sources with `VER-2-3-4'.

* docs/CHANGES, docs/VERSION.DLL: Update documentation and bump
version number to 2.3.4.

* README, Jamfile (RefDoc), builds/win32/visualc/index.html,
builds/win32/visualc/freetype.dsp,
builds/win32/visualc/freetype.vcproj: s/2.3.3/2.3.4/, s/233/234/.

* include/freetype/freetype.h (FREETYPE_PATCH): Set to 4.

* builds/unix/configure.raw (version_info): Set to 9:15:3.
2007-04-10 04:09:49 +00:00
Werner Lemberg f4a52a6c42 * src/truetype/ttgload.c (load_truetype_glyph): Save and restore
memory stream to avoid a crash with the incremental memory
interface (Savannah bug #19260).
2007-04-09 08:40:11 +00:00
Werner Lemberg c81cf61fcf Fix ChangeLog. 2007-04-06 09:28:23 +00:00
David Turner 1dcb4448c1 fixed a memory buffer overwrite bug. Damn !! 2007-04-06 08:19:04 +00:00
Werner Lemberg 9f83e05502 * Version 2.3.3 released.
=========================


Tag sources with `VER-2-3-3'.

* docs/CHANGES: Mention CVE-2007-1351.
2007-04-05 02:28:23 +00:00
Werner Lemberg 7478197e00 formatting 2007-04-03 19:39:28 +00:00
David Turner 7338ec2b53 make FT_Set_Char_Size deal with 0-valued resolution parameter like the other one 2007-04-03 14:30:34 +00:00
Werner Lemberg 94f1227f32 formatting; improved ChangeLog entries 2007-04-03 07:19:53 +00:00
David Turner e6472c1251 detect "extra-light" fonts in the auto-hinter in order to avoid producing weird results with them 2007-04-02 13:13:54 +00:00
Werner Lemberg 24fd93d6ec formatting 2007-03-29 11:56:21 +00:00
Werner Lemberg 644b1ad49e * builds/win32/visualc/index.html,
builds/win32/visualc/freetype.dsp,
builds/win32/visualc/freetype.vcproc, README: s/2.3.2/2.3.3/,
s/232/233/.

* docs/CHANGES: Mention ftdiff.
2007-03-28 21:17:11 +00:00
David Turner 3f539694f1 fixing bug in the padding zero-ing of the bitmap emboldener 2007-03-28 14:53:40 +00:00
Werner Lemberg a08b2176c1 * src/bdf/bdflib.c (setsbit, sbitset): Handle values >= 128
gracefully.
(_bdf_set_default_spacing): Increase `name' buffer size to 256 and
issue an error for longer names.
(_bdf_parse_glyphs): Limit allowed number of glyphs in font to the
number of code points in Unicode.
2007-03-28 07:17:17 +00:00
David Turner 23553d6d2b * docs/CHANGES, docs/VERSION, include/freetype/freetype.h,
builds/unix/configure.raw, README, Jamfile: update documentation and bump version
	number to 2.3.3
2007-03-26 13:37:17 +00:00
David Turner f58caa09bc fix autofit's blue zone computations: it now ignores 1-point contours that
correspond to mark attach coordinates, and not to the real glyph outline
2007-03-26 12:39:25 +00:00
David Turner 3b242d3619 last (tiny) fix to the bytecode interpreter and code cleanup 2007-03-26 12:03:04 +00:00
Suzuki, Toshiya (鈴木俊哉) 86a3ee7613 Disable Carbon framework dependency on 64bit ABI of Mac OS X 10.4.x 2007-03-26 05:40:55 +00:00
Werner Lemberg 14ffe0911f formatting 2007-03-22 06:12:43 +00:00
Suzuki, Toshiya (鈴木俊哉) dabf0535a8 Temporal fix for 32bit unsigned long overflow on LP64 platform 2007-03-22 05:23:53 +00:00
Suzuki, Toshiya (鈴木俊哉) 4bcf957406 Suppress SGI compiler warning against setjmp 2007-03-22 04:53:45 +00:00
Werner Lemberg c9f6c66f95 formatting 2007-03-21 13:30:14 +00:00
Suzuki, Toshiya (鈴木俊哉) 6fb74f676b Dequote OS_INLINE in configure.raw to avoid unexpected shell evaluation 2007-03-19 06:30:26 +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 34cd7ea03d comment fix 2007-03-11 01:21:00 +00:00
Werner Lemberg 25d592a71c * Version 2.3.2 released.
=========================


Tag sources with `VER-2-3-2'.

* builds/win32/visualc/index.html,
builds/win32/visualc/freetype.dsp,
builds/win32/visualc/freetype.vcproc, README: s/2.3.1/2.3.2/,
s/231/232/.
2007-03-09 07:59:35 +00:00
David Turner 121cad54ae updating version numbers and documentation 2007-03-08 16:43:50 +00:00
Werner Lemberg 1e259deda2 Fix ChangeLog; fix source code comment. 2007-03-08 15:39:21 +00:00
David Turner 3a51afac36 fixing implementation bug in ft_mem_strcpyn 2007-03-08 10:50:38 +00:00
Werner Lemberg d112cf099b formatting, copyright years 2007-03-06 12:06:56 +00:00
Werner Lemberg 3d92f08bc5 * include/freetype/config/ftstdlib.h (ft_strstr): New wrapper
macro for `strstr'.

* src/truetype/ttobjs.c (tt_face_init): Use ft_strstr for scanning
`trick_names', as suggested by Ivan Nincic.
2007-03-06 11:59:24 +00:00
David Turner dddd068e5d fix a small memory leak when FT_Init_FreeType fails for some reason 2007-03-05 18:23:25 +00:00
David Turner 91aaf3267b bugfix: do not erase root x_ppem and y_ppem values in tt_size_init_bytecode 2007-03-05 18:18:52 +00:00
David Turner 085bc6e2b2 fix bug in the PFM parser: kerning values must be read as 16-bit *signed* values 2007-03-05 17:40:03 +00:00
Werner Lemberg de5e686661 formatting 2007-02-25 21:06:43 +00:00
David Turner 601aefe4ec fix postscript hinter's handling of small and ghost stems 2007-02-21 16:47:49 +00:00
Suzuki, Toshiya (鈴木俊哉) b68e025c1b * Fix memory leak in ftmac.c, patch by Jjgod Jiang 2007-02-20 02:37:36 +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 eb3d1fdcb5 Fix ChangeLog. 2007-02-13 08:19:49 +00:00
David Turner a6bdb667d9 better handling of serif segments in the Latin auto-fitter, gets rid of
broken "9" in Arial 9pt/96dpi
2007-02-12 22:33:48 +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
Werner Lemberg 5c74d3592f Fix ChangeLog. 2007-02-12 21:46:18 +00:00
Werner Lemberg 173d0fe4d5 Fix ChangeLog. 2007-02-12 21:44:57 +00:00
Werner Lemberg 442bfb8913 Formatting, copyright years, s/memcpy/ft_memcpy/. 2007-02-12 21:44:10 +00:00
David Turner 2ef3e0f1cd fix inter-letter spacing of auto-hinted glyphs (non-light modes)w 2007-02-12 21:28:21 +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
David Turner c0f9c4aadd introduce ft_mem_dup, ft_mem_strdup and ft_mem_strcpyn, and the corresponding
macros to use them (e.g. FT_STRDUP, FT_DUP and FT_STRCPYN)

modify the code to use them instead of raw mallocs/strcpy
2007-02-12 14:55:03 +00:00
Werner Lemberg fe33408f9a typo 2007-02-12 14:35:15 +00:00
Werner Lemberg 582067dc92 * src/autofit/afloader.c (af_loader_load_g): Don't change width for
non-spacing glyphs.
2007-02-11 15:03:05 +00:00
Werner Lemberg be6fe77405 Some more info on Unicode cmaps. 2007-02-11 13:15:25 +00:00
Werner Lemberg dcbb708e7a formatting, copyright years 2007-02-08 08:54:09 +00:00
Werner Lemberg 8f47453b6a * src/cff/cffdrivr.c (cff_get_name_index): Protect against NULL
pointer.
2007-02-07 08:31:01 +00:00
Suzuki, Toshiya (鈴木俊哉) f223df6e79 * Add __attribute__((deprecated)) to functions whose interface using non ANSI data types 2007-02-05 04:07:46 +00:00
Suzuki, Toshiya (鈴木俊哉) beebb33202 * Fix to use builds/mac/ftmac.c if configured with --with-fsspec etc 2007-02-05 03:44:27 +00:00
Suzuki, Toshiya (鈴木俊哉) 4827e9bd2c * Add FT_GetFilePath_From_Mac_ATS_Name as replacement for FT_GetFile_From_Mac_ATS_Name 2007-02-05 03:28:29 +00:00
Suzuki, Toshiya (鈴木俊哉) 027357f1c8 * Check ANSI compatibility of Mac OS X system header 2007-02-05 02:50:45 +00:00
Suzuki, Toshiya (鈴木俊哉) da5ada5def * Fixed wrong comment in ftmac.h 2007-02-05 02:46:27 +00:00
Suzuki, Toshiya (鈴木俊哉) b8128d93a1 * Check ANSI compatibility of Mac OS X system header 2007-02-05 02:31:34 +00:00
Werner Lemberg 313d77761c * include/freetype/ttnameid.h (TT_MS_LANGID_DZONGHKA_BHUTAN):
Explain why applications shouldn't use it.  Found by Alexei.
2007-02-01 08:10:45 +00:00
Werner Lemberg 4b2e83d5b5 A new set of spelling fixes from Alexei.
Add some copyright messages.
2007-02-01 07:58:02 +00:00
Werner Lemberg 53935939df * Version 2.3.1 released.
=========================


Tag sources with `VER-2-3-1-FINAL'.

* builds/win32/visualc/freetype.dsp,
builds/win32/visualc/freetype.vcproj: s/230/231/.
* builds/win32/visualc/index.html: s/221/231/.

* vms_make.com: Add `ftgasp'.
2007-01-31 08:53:02 +00:00
Werner Lemberg 689dd66b56 More typo fixes from Alexei. 2007-01-30 23:08:50 +00:00
David Turner 3eaef6c170 updating version numbers to 2.3.1 2007-01-30 10:40:23 +00:00
David Turner a7ee608c1d disable light auto-hinting optimization for the next release 2007-01-30 10:33:53 +00:00
Werner Lemberg a4875bdcca Spelling fixes from Alexei. 2007-01-29 14:49:59 +00:00
Werner Lemberg 6e87ed9f04 Spelling fixes from Alexei. 2007-01-26 22:18:56 +00:00
Werner Lemberg bf24176be5 formatting 2007-01-26 16:08:49 +00:00
David Turner d91eebda1c improvement to glyph spacing, especially when light auto-hinting 2007-01-26 15:05:41 +00:00
Werner Lemberg 3b3f2baae4 * docs/release: Updated -- Savannah uses a new uploading scheme.
formatting
2007-01-25 22:14:40 +00:00
Werner Lemberg d785566330 formatting, rearranging 2007-01-25 13:53:56 +00:00
David Turner a42567bf66 - same CFF loader fix (stricter checking though than Werner's version)
- document light auto-hinter improvements
2007-01-25 12:23:37 +00:00
Werner Lemberg b1be9e8b57 * src/cff/cffload.c (cff_index_get_pointers): Handle last entry
correctly.  This fixes Savannah bug #18867.

* docs/CHANGES: Document it.

Other formatting.
2007-01-25 11:50:00 +00:00
David Turner 741a17e82b * src/truetype/ttobjs.c: fixed typo that prevented compilation when
disabling both the unpatented and the bytecode interpreter in the
        TrueType font driver
2007-01-23 16:14:38 +00:00
David Turner b6de8d1d3f * src/autofit/aflatin.c, src/autofit/aftypes.h, src/autofit/afwarp.h,
src/autofit/afwarp.c: fix and enable the warper to improve "light"
        hinting mode. This is not necessarily a final version, but it seems
        to work well
2007-01-23 15:51:50 +00:00
Werner Lemberg 93a5c73cf8 Typo. From Han-Wen. 2007-01-23 06:29:23 +00:00
Werner Lemberg 42b63b2bba * ChangeLog: Split off older entries into...
* ChangeLog.22: This new file.
2007-01-21 21:01:33 +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 011d111218 * src/sfnt/ttmtx.c (tt_face_get_metrics)
[!FT_CONFIG_OPTION_OLD_INTERNALS]: Fix limit check.
2007-01-21 09:36:00 +00:00
Werner Lemberg b800329782 Version 2.3.0 released. 2007-01-17 12:56:25 +00:00
Werner Lemberg b4142d5126 Whitespace and spelling fixes from Alexei.
Formatting, copyright years.
2007-01-17 12:45:26 +00:00
Werner Lemberg 87a5a43e67 * docs/release: Updated. 2007-01-17 12:44:39 +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 9b774e2822 Remove trailing whitespace. From Alexei. 2007-01-16 06:11:27 +00:00
Werner Lemberg 267e1d719a * builds/amiga/makefile, builds/amiga/makefile.os4,
builds/amiga/smakefile: Add `ftgasp.c' and `ftlcdfil.c'.

* builds/amiga/include/freetype/config/ftconfig.h: Synchronize.
2007-01-15 07:48:09 +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 6164a9d13b * docs/CHANGES, docs/INSTALL.MAC: Improvements. 2007-01-13 23:01:36 +00:00
Werner Lemberg 281c148621 * src/type1/t1afm.c (T1_Read_Metrics): MS Windows allows PFM
versions up to 0x3FF without complaining.
2007-01-13 22:50:51 +00:00
Werner Lemberg ac250b228a Add FT_Get_PS_Font_Info interface to CFF driver.
* src/cff/cfftypes.h: Include FT_TYPE1_TABLES_H.
(CFF_FontRec): Add `font_info' field.

* src/cff/cffload.c: Include FT_TYPE1_TABLES_H.
(cff_font_done): Free font->font_info if necessary.

* src/cff/cffdrvr.c (cff_ps_get_font_info): New function.
(cff_service_ps_info): Register cff_ps_get_font_info.
2007-01-13 14:01:36 +00:00
Werner Lemberg b0398be6b8 clarifications 2007-01-13 08:52:27 +00:00
Werner Lemberg 23df31adcc * src/base/ftoutln.c (FT_Outline_Get_Orientation): Fix compilation
with C++ compiler.

* src/autofit/afhints.c (af_glyph_hints_dump_segments,
af_glyph_hints_dump_edges): Ditto.

* src/base/rules.mk (BASE_SRC): Remove ftgasp.c (it's already in
`modules.cfg').

* src/sfnt/ttsbit0.h: Remove.

* src/sfnt/rules.mk (SFNT_DRV_SRC): Don't include ttsbit0.c.
2007-01-13 08:45:00 +00:00
Werner Lemberg 27cf9de104 formatting, copyright years 2007-01-13 07:34:23 +00:00
Yamato, Masatake (大和正武) 9f9bc2bc46 Fix a typo. 2007-01-13 06:38:56 +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 6d96d31d98 * builds/unix/install-sh, builds/unix/mkinstalldirs: Updated from
`automake' CVS module from sources.redhat.com.
2007-01-12 10:30:19 +00:00
Werner Lemberg 17432b5e37 * src/type1/t1load.c (is_space): Removed.
(parse_encoding, parse_charstrings): Use IS_PS_DELIM.
(parse_charstrings): Use IS_PS_TOKEN.


* autogen.sh: Avoid bash specific syntax.
2007-01-12 09:28:44 +00:00
David Turner 490503acf5 small doc update 2007-01-11 15:29:41 +00:00
David Turner 2c7a7fbafd updating libtool version number to 9.11.3 2007-01-11 15:14:16 +00:00
David Turner 7a3c564e2e * src/base/ftobjs.c (IsMacResource): fixed a small bug that caused a
crash with some Mac OS X .dfont files. Submitted by Masatake Yamoto.
2007-01-11 15:09:01 +00:00
David Turner 038ace28ad small MacOS X fix for autogen.sh 2007-01-11 15:00:59 +00:00
David Turner 7201108da0 pre-tag doc update 2007-01-10 14:33:18 +00:00
David Turner d5ca74723c * Jamfile, README, builds/win32/visualc/freetype.dsp,
builds/win32/visualc/freetype.vcproj, docs/VERSION.DLL,
	include/freetype/freetype.h, include/freetype/t1tables.h,
	include/freetype/internal/tttypes.h: updating version
	number to 2.3.0 !!

	* include/freetype/ftchapters.h, include/freetype/ftgasp.h,
	include/freetype/ftlcdfil.h: updating reference documentation
	with GASP support and LCD filtering sections
2007-01-10 14:18:15 +00:00
David Turner 2628ea9c12 * src/pshinter/pshalgo.c (psh_glyph_compute_inflections):
fixed a typo which created an endless loop with some malformed
        font files
2007-01-10 13:15:56 +00:00
Werner Lemberg bf02d396ca * src/type1/t1load.c (T1_Get_MM_Var): Always return fixed point
values.
2007-01-10 07:07:37 +00:00
Werner Lemberg cc7f12a429 formatting, copyright years and messages, doc polishing 2007-01-09 10:37:36 +00:00
David Turner 4f7496eea2 updating docs/CHANGES 2007-01-09 09:21:16 +00:00
David Turner f48b60ed59 * include/freetype/ftgasp.h, src/base/ftgasp.c: adding a
new API FT_Get_Gasp to return entries of the GASP table
        corresponding to a given character pixel size.

        * src/sfnt/ttload.c: add version check for the GASP table,
        in order to be better future-proof

        * include/freetype/config/ftheader.h: add definition of
        FT_GASP_H, corresponding to <freetype/ftgasp.h>

        * src/base/rules.mk, src/base/Jamfile, modules.cfg,
        builds/win32/visualc/freetype.dsp,
        builds/win32/visualc/freetype.vcproj: Adding src/base/ftgasp.c
        to the default build
2007-01-08 15:15:32 +00:00
Werner Lemberg b8004d2e88 * src/cid/cidparse.c (cid_parser_new): Improve error message for
Type 11 fonts.
Scan for `/sfnts' token.
2007-01-07 09:13:38 +00:00
Werner Lemberg e6b6f3733e * src/cid/cidparse.c (cid_parser_new): Reject Type 42 CID-keyed
fonts.
2007-01-07 00:06:47 +00:00
Werner Lemberg be5f797f5b * src/cff/cffload.c (cff_index_init): Remove unused variable.
(cff_index_read_offset): s/perror/errorp/ to avoid global shadowing.
2007-01-06 07:51:48 +00:00
Werner Lemberg f629439905 formatting, copyright years 2007-01-06 07:47:45 +00:00
David Turner d88a0c9e64 fixing typo 2007-01-05 17:59:18 +00:00
David Turner 34fcd0b409 * src/pfr/pfrobjs.c (pfr_face_init): detect non-scalable fonts
correctly. fixes bug #17876
2007-01-05 15:55:59 +00:00
David Turner 384be23418 * src/truetype/ttobjs.h, src/truetype/ttobjs.c,
src/truetype/ttgload.c: do not allocate interpreter-specific
	tables in memory if we're not going to load glyphs with it
	anyway.
2007-01-05 15:32:01 +00:00
David Turner 4a89bb9a13 - reset FT_CONFIG_OPTION_OLD_INTERNALS which *disables* the previous optimization
(duhhh)
2007-01-05 14:48:27 +00:00
David Turner 91a3402d78 - don't load metrics table in memory, reduces heap usage
- forgot to commit the changes in cffload.c that are already documented
2007-01-05 14:47:08 +00:00
David Turner 9d7d50f789 fixing typo 2007-01-05 13:17:15 +00:00
David Turner a3a3c5d711 small optimization in the CMAP 4 validator 2007-01-05 13:15:29 +00:00
David Turner 5dbdb6c3c4 * src/cff/cffload.c, src/cff/cffload.h, src/cff/cffgload.c,
src/cff/cfftypes.h: formatting + do not load the CFF index
	offsets into memory, since this wastes a *lot* of heap memory
	with large Asian CFF fonts. There is no significant performance
	loss
2007-01-05 13:14:08 +00:00
Werner Lemberg 82dba7620e copyright year 2007-01-05 12:41:49 +00:00
David Turner 3a2131a30b formatting 2007-01-05 10:51:56 +00:00
Werner Lemberg 4ea0a7f0b6 formatting, minor doc fixes, copyright years 2007-01-05 09:03:31 +00:00
David Turner f1c7e388ef add missing comments 2007-01-04 23:16:37 +00:00
David Turner 9750fcb067 * docs/INSTALL.UNIX: simplified some parts, add reference to
autogen.sh and pointer to README.CVS

        * README.CVS: add common problem description and solution
        when running autogen.sh

        * docs/INSTALL: add reference to MacOS X

        * docs/MAKEPP, docs/INSTALL.MAC: add new documentation files

        * docs/TODO: remove obsolete items
2007-01-04 23:14:48 +00:00
David Turner d10dff2bed formatting 2007-01-04 22:00:51 +00:00
David Turner 38d1002b8a * src/raster/ftraster.c: removing dynamically generated "count_table",
and replace it with a constant array of bytes
2007-01-04 18:50:12 +00:00
David Turner 8a2c7f8fb8 * src/raster/ftraster.c, src/smooth/ftgrays.c: small optimization, the
rasterizers now	uses the render pool to store their state during scanline
	convertion. this saves about 6 KB of heap space for each FT_Library instance
2007-01-04 18:33:12 +00:00
David Turner 91bd5ddf17 * src/smooth/ftgrays.c: small optimization, the rasterizer now
uses the render pool to store its state during its operation,
        this saves about 4 KB of heap for each FT_Library instance
2007-01-04 18:00:14 +00:00
David Turner 8a6c44e673 Getting rid of the FT_OPTIMIZE_MEMORY macro, since the optimization
is no longer experimental
2007-01-04 17:03:11 +00:00
David Turner a8cf42bb7a * src/pshinter/pshalgo.c: remove a stupid typo that results in no
hinting and a memory leak with some large Asian CFF fonts

        * src/base/ftobjs.c (FT_Done_Library): remove a subtle memory leak
        which happens when FT_Done_Library is called with opened CFF_Faces in
        it. We need to close all faces before destroying the modules, or else
        some bad things (memory leaks) may happen.
2007-01-04 16:46:46 +00:00
Werner Lemberg 6b87e6f0ff * src/gxvalid/gxvkern.c (gxv_kern_subtable_fmt0_pairs_validate):
Remove compiler warning.

Formatting.
2007-01-02 19:20:08 +00:00
David Turner 9207e00198 adding documentation comment 2007-01-02 16:58:13 +00:00
Yamato, Masatake (大和正武) 55d5a1cbe9 (gxv_kern_subtable_fmt0_pairs_validate): Show the trace message after validating gids. 2006-12-30 20:24:30 +00:00
Yamato, Masatake (大和正武) d5d3e41dac (gxv_kern_subtable_fmt0_pairs_validate): New function. Checks uniqueness of the gid pairs.
(gxv_kern_subtable_fmt0_validate): Move some code to `gxv_kern_subtable_fmt0_pairs_validate'.
2006-12-30 20:17:30 +00:00
David Turner 115b442b23 * src/autofit/aflatin.c, src/truetype/ttgload.c: removing compiler
warnings

	* builds/win32/visualc/freetype.vcproj: adding _CRT_SECURE_NO_DEPRECATE
	to avoid deprecation warnings with Visual C++ 8
2006-12-22 11:37:05 +00:00
Werner Lemberg eeaa6497c3 add comment 2006-12-19 14:34:07 +00:00
Werner Lemberg 4755bf7a82 * src/base/ftlcdfil.c (FT_Library_SetLcdFilter)
[FT_FORCE_LIGHT_LCD_FILTER]: Fix typo.
2006-12-16 08:58:44 +00:00
Werner Lemberg 0fd08bdc6a formatting 2006-12-16 02:57:46 +00:00
Suzuki, Toshiya (鈴木俊哉) 1d5b6a6054 * Notes for simplification of src/base/ftmac.c 2006-12-15 15:44:56 +00:00
Suzuki, Toshiya (鈴木俊哉) 431282fc9e * Add volatile to sync svotval.h with otvmod.c 2006-12-15 15:39:04 +00:00
Suzuki, Toshiya (鈴木俊哉) 7e3d601355 * Simplify src/base/ftmac.c for Mac OS X 2006-12-15 15:23:21 +00:00
Suzuki, Toshiya (鈴木俊哉) 21fd256d20 * Backup src/base/ftmac.c to builds/mac/ftmac.c for legacy MacOS 2006-12-15 15:09:44 +00:00
Suzuki, Toshiya (鈴木俊哉) 7a7d403d7a * Improve resource fork handler for POSIX 2006-12-15 14:47:42 +00:00
Werner Lemberg ec5b4508cc * builds/toplevel.mk (version): Protect against `distclean' target. 2006-12-10 07:51:38 +00:00
Werner Lemberg b26b314a93 * builds/*/*def.mk, builds/*/detect.mk (CAT): Define to either `cat'
or `type'.

* builds/freetype.mk (version): Extracted from freetype.h, using
GNU make's built-in string functions.
(refdoc): Use $(version) instead of static version number.
2006-12-09 20:01:43 +00:00
Werner Lemberg 4e1d6c0c51 * builds/toplevel.mk (dist): Extract version number from freetype.h. 2006-12-09 08:20:37 +00:00
Werner Lemberg 15c29503fb * src/tools/apinames (State): Remove final comma in structure -- xlc
v5 under AIX 4.3 doesn't like this.
2006-12-09 07:29:54 +00:00
Werner Lemberg 601cb88918 typo 2006-12-08 15:55:39 +00:00
Werner Lemberg 66c7ece8e7 Improve documentation of FT_New_Memory_Face. 2006-12-08 15:51:51 +00:00
Werner Lemberg 256a351264 Fix ChangeLog. 2006-12-08 06:49:33 +00:00
David Turner dbf3b43aea * src/autofit/afloader.c (af_loader_load_g): small adjustment
to the spacing of auto-fitter glyphs. This only impacts rare
        cases (e.g. Arial Bold at rather small character sizes)
2006-12-07 21:18:09 +00:00
Werner Lemberg e2e18e035c comment fixes 2006-12-03 09:46:32 +00:00
Werner Lemberg 1117131c03 * src/sfnt/rules.mk (SFNT_DRV_SRC): Add ttsbit0.c. 2006-12-03 09:43:40 +00:00
Werner Lemberg 3bcd7d7fa5 Formatting. 2006-12-03 09:38:16 +00:00
Werner Lemberg 52c6eceaef typo 2006-12-03 09:30:28 +00:00
Werner Lemberg 960ba59ad9 * src/sfnt/sfobjs.c (tt_face_get_name): All Unicode strings are
encoded in UTF-16BE.  Patch from Rajeev Pahuja <rpahuja@esri.com>.
(tt_name_entry_ascii_from_ucs4): Removed.


* include/freetype/ftxf86.h: Fix and extend comment so that it
appears in the documentation.

* include/freetype/ftchapters.h: Add `font_format' section.


* src/tools/docmaker/tohtml.py (HtmlFormatter::index_exit): Add link
to TOC in index page.


Formatting.
2006-12-01 08:20:47 +00:00
David Turner 3a18c5e29e * src/smooth/ftgrays.c (gray_raster_render): return 0 when we're
trying to rendering into a zero-width/height bitmap, instead of an
    error code.
2006-11-28 08:38:31 +00:00
David Turner 80658e5075 * src/truetype/ttobjs.c (tt_face_init): Fix typo in previous patch
* src/smooth/ftgrays.c: remove hard-coded error values, use FreeType
    ones instead

    * src/autofit/afhints.c (af_glyph_hints_dump_segments): remove unused
    variable
2006-11-28 08:09:20 +00:00
Werner Lemberg 8636c29ae8 * src/truetype/ttobjs.c (tt_face_init): Protect against NULL pointer. 2006-11-26 22:28:13 +00:00
David Turner 1bd6c47260 * src/autofit/afhints.c: add stubs to link the "ftgrid" test program
when debugging is disabled in the auto-hinter
2006-11-25 01:30:40 +00:00
David Turner 81e725f513 * src/autofit/afhints.c, src/autofit/afhints.h, src/autofit/aflatin.c,
src/autofit/aftypes.h: Misc. auto-hinter improvements
2006-11-23 14:49:48 +00:00
Werner Lemberg 91959bf24c Fix Savannah bug #15553.
* src/truetype/ttgload.c (tt_loader_init): Re-execute the CVT
program after a change from mono to grayscaling (and vice versa).
Use correct constant for comparison to get `exec->grayscale'.
2006-11-22 10:36:55 +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
Werner Lemberg 913a365090 Because FT_Load_Glyph expects CID values for CID-keyed fonts, the
test for a valid glyph index must be deferred to the font drivers.
This patch fixes Savannah bug #18301.

* src/base/ftobjs.c (FT_Load_Glyph): Don't check `glyph_index'.
* src/bdf/bdfdrivr.c (BDF_Glyph_Load), src/cff/cffgload.c
(cff_slot_load), src/cid/cidgload.c (cid_slot_load_glyph),
src/pcf/pcfdrivr.c (PCF_Glyph_Load), src/pfr/pfrobjs.c
(pfr_slot_load), src/truetype/ttdriver.c (Load_Glyph),
src/type1/t1gload.c (T1_Load_Glyph), src/winfonts/winfnt.c
(FNT_Load_Glyph): Check validity of `glyph_index'.
2006-11-19 09:19:17 +00:00
Werner Lemberg 0d0d78dadc formatting 2006-11-14 10:37:10 +00:00
David Turner a95e5c62de updating documentation 2006-11-13 13:24:30 +00:00
David Turner 29c191cd53 * src/base/ftlcdfil.c: added support for FT_FORCE_LIGHT_LCD_FILTER
and FT_FORCE_LEGACY_LCD_FILTER at compile time. Define these macros
      when building the library to change the default LCD filter to be
      used. This is only useful for experimentation
2006-11-13 13:03:48 +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 8765c71b41 * include/freetype/ftlcdfil.h, include/internal/ftobjs.h,
src/base/ftlcdfilt.c, src/smooth/ftsmooth.c: API change for
       the LCD filter, the FT_LcdFilter value is a enum describing
       which filter to apply, new values FT_LCD_FILTER_LIGHT and
       FT_LCD_FILTER_LEGACY (the latter implements the LibXft original
       algorithm which produces incredible color fringes for everything
       except very-well hinted text)

       * src/autofit/aflatin.c: various tiny improvements that drastically
       improve the handling of serif fonts and of LCD/LCD_V hinting modes.
2006-11-10 16:49:42 +00:00
Werner Lemberg 49c77a87c3 Fix ChangeLog. 2006-11-09 21:51:57 +00:00
David Turner 4e9cc3c4ee * src/pshinter/pshalgo.c (psh_glyph_compute_inflections): fixed
a stupid typo which created a variable-used-before-initialized bug
2006-11-09 16:31:52 +00:00
Werner Lemberg d60ae949db Formatting. 2006-11-07 09:47:04 +00:00
Werner Lemberg 5e43089b4f * src/base/ftsynth.c (FT_GlyphSlot_Embolden): Handle vertical layout
also.
2006-11-07 09:35:03 +00:00
Werner Lemberg 111b5aefca * src/base/ftcalc.c: Don't use `long long' but `FT_Int64'.
Formatting
2006-11-03 09:40:12 +00:00
David Turner 91b44e65c2 - improve autofitter's handling of serif fonts (results are much better)
- make GCC 4 happy when compiling our zlib sources
2006-11-02 23:28:09 +00:00
David Turner effd15de89 - merging af_corner_XXX and psh_corner_XXX functions into ft_corner_XXX versions in ftcalc.c
- more auto-fitter debugging support
2006-11-02 17:21:02 +00:00
David Turner 4060474815 - fixed a bug in af_compute_direction which generated ugly glyphs
- added more debug/log messages to help improve the auto-fitter
2006-11-02 16:37:35 +00:00
Werner Lemberg 950c5d2f07 Fix copyright notice (to be the same as the original file in x.org). 2006-11-01 21:18:15 +00:00
Werner Lemberg e88c5261c3 * src/cff/cffload.c (cff_encoding_load): Remove unused variable.
* src/base/ftobjs.c (FT_Select_Charmap): Disallow FT_ENCODING_NONE
as argument.
2006-10-24 05:46:26 +00:00
Werner Lemberg 715e96ecf4 formatting, improving ChangeLog entries 2006-10-24 05:28:45 +00:00
David Turner a186139cad improve FT_Outline_Get_Orientation for broken asian fonts 2006-10-23 16:00:59 +00:00
David Turner 29873a0ccd * src/sfnt/ttmtx.c, src/cff/cffload.c: speeding up the CFF font
loader, with some large CFF fonts, FT_Open_Face is now 350% faster !
2006-10-23 10:23:17 +00:00
David Turner e140f14232 * src/pshinter/pshalgo.c: major speed improvements to the Postscript
hinter, more than 100% speed increase on my machine
2006-10-23 08:56:57 +00:00
Werner Lemberg b9e6d69a96 formatting 2006-10-15 08:58:40 +00:00
Suzuki, Toshiya (鈴木俊哉) 0708826049 * src/base/ftmac.c (FT_New_Face_From_FOND): Initialize the variable error 2006-10-15 07:15:28 +00:00
Suzuki, Toshiya (鈴木俊哉) bfe872dad1 * preliminary autoconf-based cross-building support 2006-10-14 13:08:05 +00:00
Werner Lemberg 82a07e9378 * docs/INSTALL.UNX, docs/UPGRADE.UNX: Renamed to...
* docs/INSTALL.UNIX, docs/UPGRADE.UNIX: This.  Update all documents
which reference those files.
2006-10-12 06:20:44 +00:00
Suzuki, Toshiya (鈴木俊哉) 9d49961fcc * embed explicit Carbon dependency into freetype2.pc and freetype-config, if configured to use Carbon 2006-10-12 01:35:54 +00:00
Werner Lemberg 28e17d9707 * devel/ftoption.h (FT_CONFIG_OPTION_SUBPIXEL_RENDERING): Define for
development.
2006-10-11 17:27:47 +00:00
Jens Claudius 336d229f02 2006-10-03 Jens Claudius <jens.claudius@yahoo.com>
* include/freetype/config/ftstdlib.h: Cast away volatileness from
   argument to ft_setjmp.

 * include/freetype/internal/ftvalid.h: Add comment that
   ft_validator_run must not be used.
2006-10-03 08:53:37 +00:00
Werner Lemberg 046bf8b0cc formatting 2006-10-03 08:43:42 +00:00
Werner Lemberg 2863cfa7c9 * src/base/ftbase.c: Undo change from 2006-09-30.
* src/base/rules.mk (BASE_SRC): Remove `ftlcdfil.c'.
2006-10-01 17:04:00 +00:00
David Turner df430e1a20 * include/freetype/internal/ftobjs.h, src/base/ftobjs.c,
src/truetype/ttobjs.c: fixes related to the unpatented hinter
2006-10-01 00:09:35 +00:00
Werner Lemberg 9884faed9d Typo in comment. 2006-09-29 22:13:21 +00:00
Werner Lemberg 1e4402e3dc * src/base/rules.mk (BASE_SRC): Remove `ftapi.c' (which is no longer
in use).

* src/base/ftbase.c: Include `ftlcdfil.c'.
2006-09-29 22:10:36 +00:00
Werner Lemberg 2c002e13a7 formatting, improving documentation 2006-09-29 21:31:53 +00:00
Werner Lemberg 9b15ea341c * src/sfnt/ttcmap.c (tt_cmap4_char_map_binary): Fix algorithm for
overlapping segments.  Bug reported by Stefan Koch.
2006-09-29 18:22:11 +00:00
David Turner ad83071620 * include/freetype/internal/ftobjs.h, src/truetype/ttobjs.c,
src/base/ftobjs.c: fixed a bug in the automatic unpatented
        hinting support which prevented normal bytecode hinting to
        work properly

        * src/autofit/aftypes.h: undefining AF_DEBUG to get rid of
        traces
2006-09-27 16:20:59 +00:00
David Turner 826935a381 another missing file 2006-09-27 09:12:43 +00:00
David Turner 3cc7d630bd adding missing file 2006-09-27 08:48:38 +00:00
David Turner 87e4b339a3 * modules.cfg: adding ftlcdfil.c to the list of default base
extensions
2006-09-27 08:45:49 +00:00
David Turner 26bb2e27d1 * src/base/Jamfile, src/base/rules.mk, vms_make.com: adding
'ftlcdfil.c' to the list of compiled source files
2006-09-27 07:58:43 +00:00
David Turner 8a317cf7ab * include/freetype/freetype.h: bumping FT_FREETYPE_PATCH to 2
for an upcoming 2.2.2 release

        * include/freetype/ftlcdfil.h, src/freetype/ftlcdfil.c:
        added a new API to support color filtering of subpixel glyph
        bitmaps. In default build, the function FT_Library_SetLcdFilter
        returns FT_Err_Unimplemented_Feature; you need to #define
        FT_CONFIG_OPTION_SUBPIXEL_RENDERING in ftoption.h to compile
        the real implementation

        * src/smooth/ftsmooth.c: adding support for sub-pixel color
        filtering; simplifying a few function calls

        * include/freetype/config/ftheader.h: adding FT_LCD_FILTER_H
        macro that points to <freetype/ftlcdfil.h>
2006-09-27 07:52:48 +00:00
Werner Lemberg e20df4a167 * src/pfr/pfrobjs.c (pfr_face_get_kerning): Skip adjustment bytes
correctly.  Reported as Savannah bug #17843.
2006-09-27 06:29:21 +00:00
Werner Lemberg 110246c641 formatting 2006-09-26 21:55:44 +00:00
David Turner e3d6e94853 CHANGES BETWEEN 2.2.1 and 2.2.2
I. IMPORTANT BUG FIXES

    - Various integer overflows have been fixed.

    - PFB fonts with MacOS resource fork weren't  handled correctly on
      non-MacOS platforms.

    - The PCF font loarder has been seriously hardened against malformed
      font files.

  II. IMPORTANT CHANGES

    - the unpatented hinter is now part of the default build of the
      library, and we added code to automatically support "tricky"
      fonts that need it.

      what this means is that FreeType should "just work" with certain
      Asian fonts, like MingLiu, which cannot properly load without a
      bytecode interpreter, but fortunately do not use any of the
      patented bytecode opcodes.

      Note that the API didn't change, so you can still force
      unpatented hinting with a special parameter to FT_Open_Face
      as well.

      if you're an embedded systems developer, you might want to
      *disable* the feature to save code space by undefining
      TT_CONFIG_OPTION_UNPATENTED_HINTING in ftoption.h.

    - LCD-optimized rendering is now disabled in all default builds
      of the library, mainly due to patent reasons. For more information
      see:

      http://lists.gnu.org/archive/html/freetype/2006-09/msg00064.html

      a new configuration macro FT_CONFIG_OPTION_SUBPIXEL_RENDERING has
      been introduced in ftoption.h; manually define it in this file
      if you want to re-enable the feature.

      the change only affects the implementation, not the FreeType API.
      This means that clients don't need to be modified, because the
      library still generates LCD decimated bitmaps, but with the added
      constraint that R=G=B on each triplet.

   - Some computation bugs in the TrueType bytecode interpreter were found,
     which allow us to get rid of very subtle and rare differences we had
     with the Windows renderer.

  III. MISCELLANEOUS

    - TrueType glyph loading is now about 25% faster.

    - the anti-aliased rasterizer has been optimized and is now 15% to 25%
      percent faster than the previous one, depending on content

    - the Type 1 loader has been improved; as an example, it now skips
      over top-level dictionaries properly

======================================================================
2006-09-26 16:58:21 +00:00
David Turner 6f8c622996 * src/autofit/aftypes.h, src/autofit/afhints.h,
src/autofit/afmodule.c: adding support for disabling
        horizontal and vertical hinting for the purpose of debugging
        the auto-fitter
2006-09-26 15:42:44 +00:00
Werner Lemberg 745ff2c29f * src/base/ftmac.c (FT_New_Face_From_FOND): Fall back to SFNT if
LWFN fails and both are available.
2006-09-19 05:48:02 +00:00
Werner Lemberg f9644559a8 formatting 2006-09-12 13:48:10 +00:00
David Turner f3050059dd * src/sfnt/sfobjs.c (tt_face_get_name): support some function
which report their English names through an Apple Roman
        (platform,encoding) pair, with language_id != English

        if the font uses another name entry with language_id == English,
        it will be selected correctly though.

        * src/truetype/ttobjs.c: add unpatent-hinting selection for
        "mingli.ttf"
2006-09-11 12:00:32 +00:00
Werner Lemberg 36d2eab054 * src/truetype/ttpload.c (tt_face_load_hdmx): Handle `record_size'
values which have the upper two bytes set to 0xFF instead of 0xFF
(as it happens in at least two CJKV fonts, `HAN NOM A.ttf' and
`HAN NOM B.ttf').

* src/smooth/ftgrays.c [GRAYS_USE_GAMMA]: Really remove all code.

Formatting.
2006-09-05 19:24:34 +00:00
David Turner 2066e0acd6 fix stupid bug 2006-09-05 14:58:22 +00:00
David Turner c7bc9b7907 * src/smooth/ftgrays.c: minor source cleanups and optimization 2006-09-05 12:17:38 +00:00
David Turner 772e55d38e * src/smooth/ftgrays.c (gray_sweep): Avoid buffer overwrites
when to the end of a bitmap scanline. The fun never ends ;-)
2006-09-05 09:45:15 +00:00
Werner Lemberg d1fc7d427b Fix ChangeLog. 2006-09-05 07:55:42 +00:00
David Turner aa557a908a fix for the latest rasterizer optimization 2006-09-04 16:42:44 +00:00
Werner Lemberg 2d8629b393 * devel/ftoption.h: Synchronize with
include/freetype/config/ftoption.h.

* src/smooth/ftgrays.c (gray_record_cell): Remove shadowing
variable declaration.
(gray_convert_glyph): Fix compiler warnings.

Formatting, copyright years.
2006-09-03 06:18:45 +00:00
David Turner bd50295ca4 * src/smooth/ftgrays.c: optmized the performance of the anti-aliased
rasterizer. The speed gains is between 15% and 25%, depending on
    content
2006-09-01 19:05:24 +00:00
David Turner 6d79f214e1 * src/truetype/ttobjs.c: updated the TrueType loader to recognize
a few fonts that require the automatic unpatented loader
2006-09-01 14:09:35 +00:00
Werner Lemberg d898aeddbe * configure: Make it possible to handle configure options which
have strings containing spaces.
2006-08-29 09:50:34 +00:00
Jens Claudius a787f45580 2006-08-27 Jens Claudius <jens.claudius@yahoo.com>
Fix miscellaneous compiler warnings.

	* freetype2/include/freetype/internal/ftobjs.h: close
	comment with `*/' to avoid `/* in comment' compiler warning.

	* freetype2/src/base/ftdbgmem.c (ft_mem_table_get_source): Turn
	cast `(FT_UInt32)(void*)' into `(FT_UInt32)(FT_PtrDist)(void*)'
	since on 64-bit platforms void* is larger than FT_UInt32.

	* freetype2/src/base/ftobjs.c (t_validator_error): cast
	away volatileness of argument to ft_longjmp. Spotted by
	Werner `Putzfrau' Lemberg.

	* freetype2/src/bdf/bdflib.c (bdf_load_font): initialize
	local variable `lineno'.

	* freetype2/src/gxvalid/gxvmod.c (classic_kern_validate):
	mark local variable `error' volatile.
2006-08-27 11:26:18 +00:00
Werner Lemberg c4c35b773d * builds/unix/ftconfig.in: Synchronize with main ftconfig.h.
Reported by Jens.

Formatting.
2006-08-27 08:03:46 +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
Jens Claudius 088e44e877 2006-08-22 Jens Claudius <jens.claudius@yahoo.com>
Fix for previous commit, which caused many compiler warnings/errors
	about addresses of volatile objects passed as function arguments
	as non-volatile pointers.


	* freetype2/include/freetype/internal/ftvalid.h: Make
	FT_Validator typedef a pointer to a volatile object.

	* freetype2/src/gxvalid/gxvmod.c (gxv_load_table): Make function
	argument `table' a pointer to a volatile object.

	* freetype2/src/otvalid/otvmod.c (otv_load_table): Make function
	argument `table' a pointer to a volatile object.
2006-08-22 14:24:30 +00:00
Werner Lemberg 1234299620 formatting 2006-08-19 11:18:09 +00:00
Jens Claudius 2652bd5412 2006-08-18 Jens Claudius <jens.claudius@yahoo.com>
* freetype2/src/gxvalid/gxvmod.c (GXV_TABLE_DECL): Mark local
	variable `_sfnt' as volatile since it must keep its value across
	a call to ft_setjmp.
	(gxv_validate): Same for local variables `memory' and `valid'.
	(classic_kern_validate): Same for local variables `memory',
	`ckern', and `valid'.

	* freetype2/src/otvalid/otvmod.c (otv_validate): Same for function
	parameter `face' and local variables `base', `gdef', `gpos', `gsub',
	`jstf', and 'valid'.

	* freetype2/src/sfnt/ttcmap.c (tt_face_build_cmaps): Same for
	local variable `cmap'.
2006-08-18 17:20:37 +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
David Turner 2b21a932f1 * src/base/ftobjs.c (ft_validator_run): disabling function, it is
buggy by design, so it will always return -1
2006-08-16 09:24:32 +00:00
David Turner 9fbfc6af07 * src/cid/cidgload.c (cid_slot_load_glyph),
src/truetype/ttgload.c (tt_prepare_zone): removing compiler warnings
2006-08-16 09:11:31 +00:00
Suzuki, Toshiya (鈴木俊哉) f1e96066a6 * modules.cfg: compile ftgxval.c by default 2006-08-15 17:02:47 +00:00
Suzuki, Toshiya (鈴木俊哉) e261f426d6 * src/otvalid/otvmod.c, src/gxvalid/gxvmod.c: replace ft_validator_run by ft_setjmp 2006-08-15 17:00:43 +00:00
Jens Claudius 9950adcc11 * freetype2/include/freetype/internal/psaux.h: (enum T1_TokenType_):
add T1_TOKEN_TYPE_KEY. (struct T1_FieldRec_) add `dict'. Add macros
T1_FIELD_DICT_FONTDICT and  T1_FIELD_DICT_PRIVATE. Change T1_NEW_XXX and
T1_FIELD_XXX macros to take the dictionary where the PS keywords is
expected as an additional argument.

* freetype2/src/cid/cidload.c: (T1_FieldRec): Adjust invocations
of T1_FIELD_XXX.

* freetype2/src/cid/cidtoken.h: Adjust invocations of T1_FIELD_XXX.

* freetype2/src/psaux/psobjs.c: Add macro FT_COMPONENT for tracing.
(ps_parser_to_token): Report a PostScript key as T1_TOKEN_TYPE_KEY
instead as T1_TOKEN_TYPE_ANY. (ps_parser_load_field): Make sure a token
that should be a string or name is a string or name indeed. Avoid
memory leak if a keyword has been already encountered and its value
is overwritten.

* freetype2/src/type1/t1load.c: (T1_FieldRec): Adjust invocations of
T1_FIELD_XXX. (parse_dict): Ignore keywords that occur in the wrong
dictionary (e.g., in Private instead of FontDict).

* freetype2/src/type1/t1tokens.h: Adjust invocations of T1_FIELD_XXX.
2006-08-13 12:14:36 +00:00
Werner Lemberg 814839a6d8 Fix ChangeLog. 2006-07-28 11:55:48 +00:00
Werner Lemberg a4d6a1c8d1 Move creation of field `buildchar' of T1_DecoderRec out of
`t1_decoder_init' and let the caller of `t1_decoder_init' take care
of it.

Call the finisher for T1_Decoder in `cid_face_compute_max_advance'
and `T1_Compute_Max_Advance'.

* freetype2/include/freetype/internal/psaux.h (T1_DecoderRec):
Remove field `face', add `len_buildchar'.

* freetype2/include/freetype/internal/t1types.h (T1_FaceRec): Add
field `buildchar'.

* freetype2/src/cid/cidgload.c (cid_face_compute_max_advance): Call
finisher for T1_Decoder.
(cid_slot_load_glyph): Do not ignore failure when initializing the
T1_Decoder.

* freetype2/src/psaux/t1decode.c (t1_decoder_parse_charstrings):
Updated.
(t1_decoder_init): Remove initialization of fields `buildchar' and
`len_buildchar'.
(t1_decoder_done): Remove deallocation of field `buildchar'.

* freetype/src/type1/t1gload.c (T1_Compute_Max_Advance): Initialize
T1_Decoder's `buildchar' and `len_buildchar'; call finisher for
T1_Decoder.
(T1_Load_Glyph): Initialize T1_Decoder's `buildchar' and
`len_buildchar'; make sure to call finisher for T1_Decoder even in
case of error.

* freetype2/src/type1/t1load.c (T1_Open_Face): Allocate new field
`buildchar' of T1_FaceRec.

* freetype2/src/type1/t1objs.c (T1_Face_Done): Free new field
`buildchar' of T1_FaceRec.
2006-07-19 09:54:56 +00:00
Werner Lemberg 1a380e02d1 * freetype2/include/freetype/internal/psaux.h: New macros
IS_PS_NEWLINE, IS_PS_SPACE, IS_PS_SPECIAL, IS_PS_DELIM, IS_PS_DIGIT,
IS_PS_XDIGIT, and IS_PS_BASE85 (from freetype2/src/psaux/psconv.h).
(T1_FieldLocation): Add T1_FIELD_LOCATION_LOADER,
T1_FIELD_LOCATION_FACE, and T1_FIELD_LOCATION_BLEND.
(T1_DecoderRec): New fields `buildchar' and `face'.
(IS_PS_TOKEN): New macro.

* freetype2/include/freetype/internal/t1types.h (T1_FaceRec): New
fields `ndv_idx', `cdv_idx', and `len_buildchar'.

* freetype2/include/freetype/t1tables.h (PS_BlendRec): New fields
`default_design_vector' and `num_default_design_vector'.

* freetype2/src/psaux/psconv.h: Move macros IS_PS_NEWLINE,
IS_PS_SPACE, IS_PS_SPECIAL, IS_PS_DELIM, IS_PS_DIGIT, IS_PS_XDIGIT,
and IS_PS_BASE85 to freetype2/include/freetype/internal/psaux.h.

* freetype2/src/psaux/psobjs.c (ps_parser_to_token_array): Allow
`token' argument to be NULL if we want only to count the number of
tokens.
(ps_tocoordarray): Allow `coords' argument to be NULL if we just
want to skip the array.
(ps_tofixedarray): Allow `values' argument to be NULL if we just
want to skip the array.

* freetype2/src/psaux/t1decode.c (t1_decoder_parse_charstrings): Add
support for (partially commented out) othersubrs 19-25, 27, and 28.
(t1_decoder_init): Initialize new fields `face' and `buildchar'.
(t1_decoder_done): Release new field `buildchar'.

* freetype2/src/type1/t1load.c (parse_buildchar, parse_private): New
functions.
(t1_keywords): Register them.
(t1_allocate_blend): Updated.
(t1_load_keyword): Handle field types T1_FIELD_LOCATION_LOADER,
T1_FIELD_LOCATION_FACE and T1_FIELD_LOCATION_BLEND.
(parse_dict): Remove `keyword_flags' argument.
Use new macro IS_PS_TOKEN.
Changed function so that later PostScript definitions override
earlier ones.
(t1_init_loader): Initialize new field `keywords_encountered'.
(T1_Open_Face): Initialize new fields `ndv_idx', `cdv_idx', and
`len_buildchar'.
Remove `keywords_flags'.

* freetype2/src/type1/t1load.h (T1_LoaderRect): New field
`keywords_encountered'.
(T1_PRIVATE, T1_FONTDIR_AFTER_PRIVATE): New macros.

* freetype2/src/type1/t1tokens.h [!T1_CONFIG_OPTION_NO_MM_SUPPORT]:
New entries for parsing /NDV, /CDV, and /DesignVector.
2006-07-14 18:28:08 +00:00
Werner Lemberg 4af3c4d7ee Add many checks to protect against malformed PCF files.
* src/pcf/pcfdrivr.c (PCF_Face_Done): Protect against NULL pointers.
(PCF_Face_Init): Add calls to PCF_Face_Done in case of errors.

* src/pcf/pcfread.c (pcf_read_TOC): Protect against malformed table
data and check that tables don't overlap (using a simple
bubblesort).
(PCF_METRIC_SIZE, PCF_COMPRESSED_METRIC_SIZE, PCF_PROPERTY_SIZE):
New macros which give the size of data structures in the data
stream.
(pcf_get_properties): Use rough estimates to get array size limits.
Assign `face->nprops' and `face->properties' earlier so that a call
to PCF_Face_Done can do the clean-up in case of error.
Protect against invalid string offsets.
(pcf_get_metrics): Clean up code.
Adjust tracing message levels.
Use rough estimate to get array size limit.
(pcf_get_bitmaps): Clean up code.
Adjust tracing message levels.
Use rough estimates to get offset limits.
(pcf_get_encodings): Adjust tracing message level.
(pcf_get_accel): Clean up code.
2006-07-08 21:31:24 +00:00
Werner Lemberg b97daa2861 more doc fixes 2006-07-03 12:36:46 +00:00
Werner Lemberg 973542bbea doc improvement 2006-07-03 09:40:15 +00:00
Werner Lemberg 3d2f2c6004 minor doc improvement 2006-07-02 05:50:48 +00:00
Werner Lemberg 8eb05255fb * src/bdf/bdfdrivr.c (BDF_Face_Init): Handle fonts correctly which
don't have a POINT_SIZE property.  This fixes Savannah bug #16914.
2006-06-27 06:20:01 +00:00
Werner Lemberg 24703f8b39 * src/psaux/t1decode.c (T1_Operator, t1_args_count): Add opcode 15.
(t1_decoder_parse_charstrings): Operator with
opcode 15 pops its two arguments.
Handle the case where the pops of an othersubr may be part of a
subroutine.
Handle unknown othersubrs gracefully: count their operands and let
the following pop operators push the operands as the results onto
the Type1 stack.
Improve handling of setcurrentpoint opcode.
2006-06-26 19:12:51 +00:00
Werner Lemberg e9a746674a Fix handling of self-delimiting tokens. 2006-06-26 17:37:44 +00:00
Werner Lemberg c011f4cba1 The Type 1 parser now skips over top-level procedures as required
for a `Simplified Parser'.  This makes the parser more robust as it
doesn't poke around in PostScript code.  Additionally, it makes the
FontDirectory hackery in src/type1/t1load.c unnecessary.

* src/psaux/psobjs.c (IS_OCTAL_DIGIT): New macro.
(skip_literal_string): Add FT_Error as return value.
Handle escapes better.
(skip_string): Add FT_Error as return value.
Don't set `parser->error' but return error code directly.
(skip_procedure): New function.
(ps_parser_skip_PS_token): Handle procedures.
Update code.
(ps_parser_to_token): Update code.
(ps_parser_load_field_table): Handle bbox entries also.

* src/type1/t1load.c (parse_dict): Remove FontDirectory hackery.
Add commented-out code for synthetic fonts.
2006-06-26 09:40:00 +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 ef3d2c2347 formatting, copyright years 2006-06-25 06:07:14 +00:00
Suzuki, Toshiya (鈴木俊哉) 523119761a * src/base/ftmac.c: Add byteorder workaround for Intel Mac 2006-06-22 02:34:27 +00:00
Werner Lemberg be556d5b81 typo; spotted by George 2006-06-16 06:51:37 +00:00
Werner Lemberg 67d2f3a740 Fix ChangeLog. 2006-06-16 06:50:36 +00:00
Suzuki, Toshiya (鈴木俊哉) 817831f435 src/base/ftgxval.c, src/base/ftotval.c: return FT_Err_Unimplemented_Feature when validation service is unavailable 2006-06-15 09:05:41 +00:00
Werner Lemberg b10e45a7fb * src/bdf/bdflib.c (bdf_load_font): Fix memory leaks in case of
errors.
2006-06-08 07:32:56 +00:00
Werner Lemberg 7d48cb06b4 formatting 2006-06-08 06:00:08 +00:00
David Turner 5f1f75076c Fix memory leak described in Savannah bug #16768
* src/type1/t1afm.c (T1_Read_Metrics): fix memory leak
  which happened when the metrics file doesn't have kerning
  pairs.
2006-06-07 05:11:50 +00:00
David Turner f1a23cbf0f oops, stupid error fixed 2006-06-06 13:53:26 +00:00
Werner Lemberg 4836f955f3 formatting 2006-06-06 12:54:08 +00:00
David Turner 457b4a81a1 * include/freetype/internal/services/svpscmap.h, src/cff/cffcmap.c,
src/psaux/t1cmap.c, src/psnames/psmodule.c: Fix for the memory
        leak described in bug #16759.

        We change 'ps_unicodes_init' so that it also takes a 'free_glyph_name'
        callback to release the glyph names returned by 'get_glyph_name'
2006-06-06 08:14:14 +00:00
Werner Lemberg d724f20e05 formatting 2006-06-04 15:17:41 +00:00
David Turner ea4547ca03 * src/base/ftutil.c (ft_mem_qrealloc): fix the function
to accept 'item_size == 0' as well, though this sounds
  weird, it can theorically happen.

  see bug #16669
2006-06-04 14:50:57 +00:00
David Turner 0971735dce * src/pfr/pfrobjs.c (pfr_face_init): fix the computation
of 'face->num_glyphs' which missed the last glyph, due to
  the offset-by-1 computation, since the PFR format doesn't
  guarantee that glyph index 0 corresponds to the "missing
  glyph"

  should fix bug #16668
2006-06-04 14:33:08 +00:00
Werner Lemberg 33779660ba * builds/unix/unix-cc.in (LINK_LIBRARY): Don't comment out
`-no-undefined'.  Reported by Christian Biesinger.
2006-05-26 06:30:05 +00:00
Werner Lemberg 24773d6dc6 * builds/win32/visualc/freetype.dsp: Release libraries no longer
have debug information, and debug libraries use `C7 compatible'
debug info.
2006-05-20 08:53:13 +00:00
Werner Lemberg a6523a6719 Fix ChangeLog. 2006-05-20 08:47:01 +00:00
Suzuki, Toshiya (鈴木俊哉) de0a96c5dd * fix 2 memory leaks in MacOS resource fork handler, Savannah bug #16631 2006-05-19 23:16:12 +00:00
Suzuki, Toshiya (鈴木俊哉) 8cfa8bd51a * remove Carbon dependency of Darwin, if configured with no option 2006-05-19 22:11:50 +00:00
Suzuki, Toshiya (鈴木俊哉) 4720060553 fix the 2nd part of Savannah bug #16590 2006-05-19 10:48:42 +00:00
Werner Lemberg 545c4e566e * src/truetype/ttgload.c (TT_Load_Composite_Glyph)
[FT_CONFIG_OPTION_BYTECODE_INTERPRETER]: Make it compilable again.


Formatting, documentation fixes.
2006-05-17 22:55:04 +00:00
David Turner 281679de85 * include/freetype/internal/tttypes.h, src/autofit/afangles.c,
src/autofit/afcjk.c, src/autofit/afhints.c, src/autofit/aflatin.c,
        src/autofit/aftypes.h, src/base/ftcalc.c, src/base/ftoutln.c,
        src/gzip/ftgzip.c, src/psaux/psconv.c, src/truetype/ttgload.c,
        src/type1/t1gload.c:

          this is a major patch used to drastically improve the performance
          of loading glyphs. This both speeds up loading the glypn vector
          themselves and the auto-fitter.

          note that we've started using inline assembler with GCC to
          implement FT_MulFix, given that this function is so damn
          important for the engine's performance.

          the resulting speed-up is about 25%.
2006-05-17 13:34:21 +00:00
David Turner dc3ff31c3f * src/ftccmap.c (FTC_CMapCache_Lookup): changed the threshold
used to detect rogue clients from 4 to 16. This is to prevent
        some segmentation faults with fonts like KozMinProVI-Regular.otf
        which comes from the Japanese Adobe Reader Asian Font pack.
2006-05-17 12:59:35 +00:00
Werner Lemberg de2d90af6e * src/cff/cffload.c (cff_font_done): Deallocate subfont array. This
fixes the first part of Savannah bug #16590.


* docs/PROBLEMS: Updated icl issues.
2006-05-17 08:54:30 +00:00
Werner Lemberg 8ab412d48d Version 2.2.1 released. 2006-05-12 15:09:02 +00:00
Werner Lemberg 6e467a654d * src/tools/docmaker/tohtml.py (block_footer): Split into...
(block_footer_start, block_footer_middle, block_footer_end): This to
add navigation buttons.
(HtmlFormatter::block_exit): Updated.
2006-05-12 15:05:45 +00:00
Werner Lemberg 22d34421ab Add final newline. 2006-05-12 14:24:33 +00:00
Werner Lemberg e12a471f6a * src/tools/docmaker/tohtml.py (html_header_1): Use `utf-8' charset.
Convert some files to UTF-8.
2006-05-12 14:20:43 +00:00
Werner Lemberg 2ee71f1f01 More minor fixes. Move `version' section to the end of freetype.h so that
the library compiles actually.
2006-05-12 13:55:04 +00:00
Werner Lemberg 6756dc15ba * src/tools/docmaker/sources.py (re_source_keywords): Add word
boundary markers.
* src/tools/docmaker/content.py (re_field): Allow `.' in field names
(but not at the beginning or end).

* include/freetype/*: Many minor documentation improvements (adding
links, spelling errors, etc.).
2006-05-12 08:00:13 +00:00
Werner Lemberg fd74ec68b4 * README: Minor updates.
* include/freetype/*: s/scale/scaling value/ where appropriate.
Many other minor documentation improvements.

* src/tools/docmaker/sources.py (re_italic, re_bold): Handle
trailing punctuation.
* src/tools/docmaker/tohtml.py (HtmlFormatter::make_html_word): Add
warning message for undefined cross references.
Update handling of re_italic and re_bold.
2006-05-12 04:00:44 +00:00
Werner Lemberg 94168f0b41 Improve layout of `CHANGES' file. 2006-05-11 07:07:09 +00:00
Yamato, Masatake (大和正武) 28b55a9bb6 (FT_Stream_Open): Check errno only if read system call returns -1.
Remove a redundant parenthesis.
2006-05-11 03:01:42 +00:00
Werner Lemberg 37827608c2 convert to Unix line endings 2006-05-10 13:58:14 +00:00
Werner Lemberg 910d4f41d1 convert to Unix line endings. 2006-05-10 13:57:20 +00:00
Werner Lemberg 53478a10b4 Convert to Unix line endings. 2006-05-10 13:56:47 +00:00
Werner Lemberg 3d69a198b8 typo 2006-05-10 13:47:22 +00:00
Werner Lemberg e0d1559591 * builds/freetype.mk (refdoc): Write-protect the `docmaker'
directory to suppress generation of .pyc files.  According to the
Python docs there isn't a more elegant solution (currently).

* builds/toplevel.mk (dist): New target which builds .tar.gz,
.tar.bz2, and .zip files.  Note that the version number is still
hard-coded.
(do-dist): Sub-target of `dist'.
(CONFIG_GUESS, CONFIG_SUB): New variables.
(.PHONY): Updated.
2006-05-10 13:44:47 +00:00
Werner Lemberg b80d85fe9e * builds/unix/ftsystem.c (FT_Stream_Open): Avoid infinite loop if
given an empty, un-mmap()able file.  Reported and suggested fix in
Savannah bug #16555.
2006-05-10 04:47:35 +00:00
Werner Lemberg a127ca42ca * builds/win32/visualc/freetype.sln,
builds/win32/visualc/freetype.vcproj: Upgraded to VS.NET 2005 from
VS.NET 2003
Added files ftbbox.c, fttype1.c, ftwinfnt.c, ftsynth.c.

* builds/win32/visualc/index.html: Updated.
2006-05-09 13:41:50 +00:00
Werner Lemberg 5bfa0621c4 Minor change for testing purposes. 2006-05-09 08:31:39 +00:00
Werner Lemberg 4df5b26fdf Put version information into the configure script. Reported by Paul
Watson <pwatson@redlinepy.com>.

* builds/unix/configure.ac: Renamed to...
* builds/unix/configure.raw: This which now serves (with appropriate
modifications) as a template for configure.ac.

* version.sed: New script.

* autogen.sh: Generate configure.ac from configure.raw, using
FREETYPE_MAJOR, FREETYPE_MINOR, and FREETYPE_PATCH from freetype.h.
2006-05-08 07:10:29 +00:00
Werner Lemberg 1639c79482 * include/freetype/freetype.h (FREETYPE_PATCH): Set to 1.
* builds/unix/configure.ac (version_info): Set to 9:10:3.

* builds/win32/visualc/index.html,
builds/win32/visualc/freetype.dsp,
builds/win32/visualc/freetype.vcproj, builds/freetype.mk (refdoc),
Jamfile (RefDoc), README: s/220/221/, s/2.2.0/2.2.1/.
Minor updates.

* docs/CHANGES, docs/VERSION.DLL, docs/PROBLEMS, README.CVS:
Updated.

* builds/unix/install-sh: Updated from `texinfo' CVS module at
savannah.gnu.org.

* devel/ftoption.h: Synchronize with
include/freetype/config/ftoption.h.
2006-05-06 16:44:58 +00:00
Werner Lemberg 4f3b5bbd95 * src/lzw/ftlzw2.c: Renamed to...
* src/lzw/ftlzw.c: This.

* src/lzw/Jamfile, src/lzw/rules.mk: Updated.

* builds/mac/FreeType.m68k_cfm.make.txt,
builds/mac/FreeType.m68k_far.make.txt,
builds/mac/FreeType.ppc_carbon.make.txt,
builds/mac/FreeType.ppc_classic.make.txt: Updated.
2006-05-04 07:13:05 +00:00
Werner Lemberg a94746caee Formatting. 2006-05-03 20:39:55 +00:00
David Turner 679a252c24 * include/freetype/internal/ftmemory.h: allow compilation with
C++ compilers
2006-05-03 09:40:33 +00:00
Werner Lemberg 58eed04d5a * include/freetype/config/ftoption.h (FT_STRICT_ALIASING): Removed. 2006-05-02 22:26:09 +00:00
Werner Lemberg 94204895db Fix ChangeLog. 2006-05-02 22:24:06 +00:00
Werner Lemberg c6afa1221a * include/freetype/internal/ftmemory.h: s/new/newsz/ (for C++).
(FT_ALLOC): Remove redundant redefinition.

* builds/compiler/gcc-dev.mk (CFLAGS) [g++]: Don't use
`-Wstrict-prototypes'.

* src/base/ftstream.c (FT_Stream_EnterFrame): Add cast.

Formatting, copyright years.
2006-05-02 22:22:16 +00:00
David Turner 9482ba50b7 * include/freetype/ftstream.h, src/base/ftstream.c: modifying
various frame-related functions to report the place where the
    frames were entered/extracted/exited/released in the memory debugger.
2006-05-02 10:21:28 +00:00
David Turner 9ca782569c * include/freetype/internal/ftmemory.h, src/base/ftbitmap.c,
src/base/ftmac.c, src/base/ftrfork.c, src/lzw/ftzopen.c,
    src/raster/ftrend1.c, src/sfnt/ttpost.c, src/truetype/ttgxvar.c,
    src/type42/t42parse.c, src/winfonts/winfnt.c: hardening the code
    against out-of-bounds conditions when allocating arrays. This is
    for the cases where FT_NEW_ARRAY and FT_RENEW_ARRAY are not used
    already. Introducing the new FT_ALLOC_MULT and FT_REALLOC_MULT
    macros.
2006-05-02 09:00:29 +00:00
David Turner 264f307e66 * include/freetype/fterrdef.h, include/freetype/config/ftconfig.h,
include/freetype/internal/ftmemory.h, src/base/ftdbgmem.c,
    src/base/ftutil.c: udpating the memory management functions and
    macros to safely deal with array size buffer overflows, this
    corresponds to attemps to allocate arrays that are too large. For
    an example, consider the following code:

         count = read_uint32_from_file();
         array = malloc( sizeof(Item) * count );
         for ( nn = 0; nn < count; nn++ )
           array[nn] = read_item_from_file();

    if 'count' is larger than FT_UINT_MAX/sizeof(Item), the multiplication
    will overflow and the array allocated will be smaller than the data
    read from the file. In this case, the heap will be trashed, and this
    can be used as a denial-of-service, or make the engine crash later.

    the FT_ARRAY_NEW and FT_ARRAY_RENEW macro now check that the new
    count is no more than FT_INT_MAX/item_size, otherwise, a new error,
    named 'FT_Err_Array_Too_Large' will be returned.

    note that the memory debugger now works again when FT_DEBUG_MEMORY
    is defined, and FT_STRICT_ALIASING has disappeared, the corresponding
    code being now the default.
2006-05-02 06:34:27 +00:00
Suzuki, Toshiya (鈴木俊哉) a229540280 fix bug in Mac_Read_POST_Resource() 2006-04-30 04:46:17 +00:00
Werner Lemberg 06fceb3f39 * builds/unix/unix-def.in (datarootdir): Define, for autoconf 2.59c
and forthcoming versions.
2006-04-29 07:53:40 +00:00
Werner Lemberg 8fe6539026 Further C library abstraction. Based on a patch from
msn2@bidyut.com.

* include/freetype/config/ftstdlib.h (FT_CHAR_BIT, FT_FILE,
ft_fopen, ft_fclose, ft_fseek, ft_ftell, ft_fread, ft_smalloc,
ft_scalloc, ft_srealloc, ft_sfree, ft_labs): New wrapper macros for
C library functions.  Update all users accordingly (and catch some
other places where the C library function was used instead of the
wrapper functions).

* src/base/ftsystem.c: Don't include stdio.h and stdlib.h.
* src/gzip/zutil.h [MSDOS && !(__TURBOC__ || __BORLANDC__)]: Don't
include malloc.h.
2006-04-29 07:31:16 +00:00
Werner Lemberg 50ef72b6e3 * src/lzw/ftlzw.c, src/lzw/zopen.c, src/lzw/zopen.h: Removed,
obsolete.
2006-04-29 07:02:36 +00:00
Werner Lemberg a1c990a632 convert to utf-8 2006-04-29 06:24:30 +00:00
Werner Lemberg 4e03fe76cc convert to UTF-8 2006-04-29 06:20:09 +00:00
Werner Lemberg 99854e7c5a Fix accents in ChangeLog. 2006-04-28 19:36:37 +00:00
Werner Lemberg 12cceaaca8 * builds/win32/visualc/freetype.vcproj: Updated. 2006-04-27 05:02:35 +00:00
David Turner 3b47dd6518 Releasing FreeType 2.2 2006-04-26 19:34:24 +00:00
Werner Lemberg 564b4432ca * src/psaux/psobjs.c (shift_elements): Don't use FT_Long but
FT_PtrDiff for `delta'.  Reported by Cline PILLET
<Celine.Pillet@Tagginfo.com>.
2006-04-26 15:02:52 +00:00
Werner Lemberg 8a8c6022bf Formatting, copyright years, documentation. 2006-04-22 12:24:52 +00:00
David Turner 7aa2010216 * src/sfnt/ttcmap.c: removed compiler warnings (gcc-4.0.2) 2006-04-21 08:38:35 +00:00
David Turner 8e438ead71 * include/freetype/ftincrem.h, include/freetype/ftmodapi.h,
include/freetype/freetype.h: Documentation update
2006-04-21 08:35:11 +00:00
David Turner 7dc7f21533 doc updates
- fixing FT_Stroker_New to use a FT_Library instead of a FT_Memory

i know, i know, the ChangeLog will be updated later
2006-04-13 16:31:02 +00:00
David Turner 65c7c773aa * src/autofit/afloader.c: removing superfluous code in the auto-fitter's
loader
2006-04-13 07:51:58 +00:00
Detlef Würkner 7d04322e40 no message 2006-04-05 07:17:12 +00:00
Werner Lemberg 7f18de64b6 * builds/compiler/intelc.mk (TE): New variable.
(ANSIFLAGS): Updated.
2006-04-03 16:47:34 +00:00
Werner Lemberg 764b25145a * docs/PROBLEMS: New file. 2006-04-03 16:42:39 +00:00
Werner Lemberg fd7456c796 * builds/exports.mk (clean_symbols_list, clean_apinames): Removed.
(CLEAN): Add $(EXPORTS_LIST) and $(APINAMES_EXE).
(.PHONY): Updated.

* configure.ac: Minor fixes to improve --help output.
2006-04-03 15:46:48 +00:00
Werner Lemberg 4091786c81 Formatting. 2006-04-01 18:49:07 +00:00
David Turner cf60371a1b updating documentation 2006-04-01 16:22:06 +00:00
David Turner 0f15e1c181 * include/freetype/ftcache.h, include/freetype/config/ftheader.h:
updating documentation comments
2006-04-01 16:11:53 +00:00
David Turner 9da74d844b updating cache documentation 2006-04-01 09:14:12 +00:00
Werner Lemberg 6e9df6855d * builds/unix/install.mk (uninstall): Don't handle `cache'
directory which no longer exists.
2006-04-01 05:22:07 +00:00
Werner Lemberg b56ff68076 Updated. 2006-04-01 04:57:06 +00:00
Werner Lemberg 21d929be71 Updated. 2006-04-01 04:43:11 +00:00
Detlef Würkner d51b41e085 no message 2006-03-29 06:35:26 +00:00
Werner Lemberg fa3651e7d8 formatting, copyright year 2006-03-28 05:06:50 +00:00
David Turner 42137bc614 * src/sfnt/ttkern.c (tt_face_get_kerning): fixed a serious bug
that caused some programs to go into an infinite loop when dealing
        with fonts that don't have a properly sorted kerning sub-table
2006-03-27 20:10:26 +00:00
Werner Lemberg 26170df08b * src/bdf/bdflib.c (ERRMSG4): New macro.
(_bdf_parse_glyphs): Handle invalid BBX values.

* include/freetype/fterrdef.h (FT_Err_Bbx_Too_Big): New error
macro.
2006-03-26 07:19:07 +00:00
Werner Lemberg b6f6d2479a _not filtered_ -> _not_ _filtered_ 2006-03-25 03:08:26 +00:00
Werner Lemberg d6e2498f74 * src/tools/docmaker/tohtml.py (make_html_para): Convert `...' quotations
into real left and right single quotes.
Use `para_header' and `para_footer'.

* src/tools/docmaker/sources.py (re_bold, re_italic): Accept "'" also.
2006-03-24 18:31:47 +00:00
Werner Lemberg af16820a12 Normalize quotation to `...'. 2006-03-24 12:46:49 +00:00
Werner Lemberg e0dd18fc79 * src/tools/docmaker/tohtml.py (html_header_1): The `DOCTYPE' comment must
be in uppercase.
2006-03-24 12:14:48 +00:00
Werner Lemberg 4db32ecbc5 * docs/CHANGES: Updated.
* src/tools/docmaker/tohtml.py (html_header_2): Add horizontal
padding between table elements.


Formatting, copyright years.
2006-03-24 11:54:53 +00:00
David Turner 2ce9203735 - added FT_Get_SubGlyph_Info API to freetype.h
- small fix to lsb/rsb delta computations
- cleaning up Jamfile
2006-03-23 20:58:20 +00:00
Werner Lemberg d8776b3439 Improve documentation of `FT_LOAD_MONOCHROME'. 2006-03-22 20:33:48 +00:00
Werner Lemberg 6c5b617c59 * src/cache/ftccache.c, (ftc_node_mru_up, FTC_Cache_Lookup)
[!FTC_INLINE]: Compile conditionally.
* src/cache/ftccache.h: Updated.

* src/cache/ftcglyph.c (FTC_GNode_Init, FTC_GNode_UnselectFamily,
FTC_GNode_Done, FTC_GNode_Compare, FTC_Family_Init, FTC_GCache_New):
s/FT_EXPORT/FT_LOCAL/.
(FTC_GCache_Init, FTC_GCache_Done): Commented out.
(FTC_GCache_Lookup) [!FTC_INLINE]: Compile conditionally.
s/FT_EXPORT/FT_LOCAL/.
* src/cache/ftcglyph.h: Updated.

* src/cache/ftcimage.c (FTC_INode_Free, FTC_INode_New):
s/FT_EXPORT/FT_LOCAL/.
(FTC_INode_Weight): Commented out.
* src/cache/ftcimage.h: Updated.

* src/cache/ftmanag.c (FTC_Manager_Compress,
FTC_Manager_RegisterCache, FTC_Manager_FlushN):
s/FT_EXPORT/FT_LOCAL/.
* src/cache/ftmanag.h: Updated.

* src/cache/ftcsbits.c (FTC_SNode_Free, FTC_SNode_New,
FTC_SNode_Compare): s/FT_EXPORT/FT_LOCAL/.
(FTC_SNode_Weight): Commented out.
* src/cache/ftcsbits.h: Updated.
2006-03-22 15:30:41 +00:00
Werner Lemberg 3867d2f2fb * src/cache/ftccache.c, src/cache/ftccache.h (FTC_Node_Destroy):
Remove, unused.

* src/cache/ftccmap.h: Remove, unused.

* src/cache/rules.mk (CACHE_DRV_H): Remove ftccmap.h.
2006-03-22 08:03:06 +00:00
Werner Lemberg 5556dd2130 * src/base/ftoutln.c (FT_Outline_Get_Orientation): Improve
algorithm.
2006-03-21 21:36:33 +00:00
Werner Lemberg 8439fe8575 * builds/freetype.mk (refdoc), docs/CHANGES, Jamfile (RefDoc),
README: s/2.1.10/2.2/.
2006-03-21 21:04:33 +00:00
Werner Lemberg 95f206b1ea * src/sfnt/ttcmap.c (tt_face_build_cmaps): Handle invalid offset
correctly.
2006-03-21 20:47:28 +00:00
Werner Lemberg 26377008e7 * src/cff/cfftypes.h (CFF_CharsetRec): Add `max_cid' member.
* src/cff/cffload.c (cff_charset_load): Set `charset->max_cid'.

* src/cff/cffgload.c (cff_slot_load): Change type of third parameter
to `FT_UInt'.
Check range of `glyph_index'.
* src/cff/cffgload.h: Updated.
2006-03-21 18:41:40 +00:00
Werner Lemberg a62007fb17 Fix ChangeLog. 2006-03-21 17:41:40 +00:00
David Turner 24b9e87bca * src/autofit/aflatin.c (af_latin_metrics_scale): fixed small bug that
crash the auto-hinter (introduce by previous patch). aaah
2006-03-21 16:30:04 +00:00
Werner Lemberg 5a73d8d20f * builds/freetype.mk (CACHE_DIR, CACHE_H): Remove.
(FREETYPE_H): Updated.

* src/cache/rules.mk (CACHE_H_DIR): Remove.
(CACHE_DRV_H): Updated.

Formatting, copyright years.
2006-03-20 16:55:32 +00:00
David Turner e091ce35ff * src/autofit/aflatin.c (af_latin_hints_init):
disable horizontal hinting for italic/oblique fonts
2006-03-20 16:01:28 +00:00
David Turner da95af6cf6 * builds/win32/visualc/freetype.dsp: updating the project file, adding
missing base source files (e.g. ftstroke.c, ftxf86.c, etc...)

    * src/autofit/afcjk.c, src/autofit/aflatin.c, src/base/ftobjs.c,
    src/cff/cffobjs.c, src/cid/cidobjs.c, src/pfr/pfrobjs.c,
    src/sfnt/sfobjs.c, src/sfnt/ttmtx.c, src/truetype/ttpload.c,
    src/truetype/ttpload.h, src/type1/t1afm.c, src/type1/t1objs.c:
      removing compiler warnings when building with Visual C++ 6 and /W4
2006-03-20 13:32:33 +00:00
David Turner 505667c6ee * builds/unix/install.mk:
changing the installation procedure to remove the 'freetype/cache'
      from the target directory.
2006-03-20 12:13:14 +00:00
David Turner 256de4b18f * include/freetype/cache/ftccache.h,
include/freetype/cache/ftccmap.h,
    include/freetype/cache/ftcglyph.h
    include/freetype/cache/ftcimage.h
    include/freetype/cache/ftcmanag.h
    include/freetype/cache/ftcmru.h
    include/freetype/cache/ftcsbits.h:
      removing these header files from the public include directory.

    * include/freetype/config/ftheader.h:
      changing the definition of FT_CACHE_INTERNAL_XXX_H macros to
      redirect to FT_CACHE_H instead

    * src/cache/ftcbasic.c, src/cache/ftccache.c, src/cache/ftccache.h,
    src/cache/ftccback.h, src/cache/ftccmap.c, src/cache/ftcglyph.c,
    src/cache/ftcglyph.h, src/cache/ftcimage.c, src/cache/ftcimage.h,
    src/cache/ftcmanag.c, src/cache/ftcmanag.h, src/cache/ftcmru.c,
    src/cache/ftcmru.h, src/cache/ftcsbits.c, src/cache/ftcsbits.h:
      modifications to prevent using the FT_CACHE_INTERNAL_XXX_H macros,
      and grab the headers in 'src/cache' instead (see below).
2006-03-20 12:10:24 +00:00
David Turner dad2a2de01 * src/cache/ftccache.h, src/cache/ftcglyph.h, src/cache/ftcimage.h,
src/cache/ftcsbits.h, src/cache/ftcmanag.h, src/cache/ftccmap.h,
    src/cache/ftcmru.h: copying the cache's internal header files which
    were located in 'include/freetype/cache' to the 'src/cache' directory
    instead.

    Note that these files are not used by FreeType clients, all cache
    public APIs have been already moved to include/freetype/ftcache.h,
    and the FT_CACHE_INTERNAL_XXXX_H macros all resolve to it.

    the move is to allow us to modify the internals without intereference
    from rogue clients. Note that there are no known client that accesses
    the cache internals at the moment.
2006-03-20 11:48:13 +00:00
Werner Lemberg e6a8fcac2f Fix ChangeLog. 2006-03-07 23:53:55 +00:00
David Turner 65b96aad1e * src/cache/ftcmanag.c (FTC_Manager_Lookup_Size): prevent crashes
in Mozilla/FireFox print preview in Ubuntu Hoary
2006-03-07 00:38:24 +00:00
Werner Lemberg 91a3faaac9 Convert to Unix line endings. 2006-03-01 11:31:08 +00:00
Werner Lemberg e88d24c133 formatting 2006-02-28 21:49:54 +00:00
Wu, Chia-I (吳佳一) 9f5d3de3f0 * src/base/ftutil.c (ft_mem_qalloc) [FT_STRICT_ALIASING]: Do not
return error if size == 0.
2006-02-28 13:21:50 +00:00
Wu, Chia-I (吳佳一) a87b08a7af * src/base/ftobjs.c (FT_Done_Library): Modules are removed in the
reversed order so that type42 module is removed before truetype
module.  This avoids double free in some occasions.
2006-02-28 09:53:23 +00:00
David Turner e9a47198e6 * tagging VER-2-2-0-RC4
* docs/CHANGES: documentation updates
2006-02-28 09:26:58 +00:00
Suzuki, Toshiya (鈴木俊哉) 576c353179 enable ftgxval.c by default 2006-02-28 01:11:57 +00:00
Werner Lemberg 98d6a3acaa * src/cache/ftccache.c (ftc_node_destroy)
[!FT_CONFIG_OPTION_OLD_INTERNALS]: Mark as FT_LOCAL_DEF.  This
should now fix all possible compilation options.
2006-02-27 19:49:34 +00:00
Werner Lemberg 422d2a052a formatting, copyright years 2006-02-27 18:25:22 +00:00
Werner Lemberg c07ee52005 * include/freetype/cache/ftccache.h
[FT_CONFIG_OPTION_OLD_INTERNALS]: Remove declaration of
ftc_node_done.
2006-02-27 18:13:12 +00:00
David Turner c13e75fb1b * src/base/ftutil.c: ft_mem_alloc and related functions now return an
error if a negative size is passed in parameters.

    * src/cache/ftccache.c: make ftc_node_destroy FT_BASE_DEF, it needs to
    be exported for rogue clients

    * src/pshinter/pshglob.c: prevent problems with malformed fonts which
    have an odd number of blue values (these are broken according to the
    specs).

    * src/cff/cffload.c, src/type1/t1load.c: modify the loaders to force
    even-ness of 'num_blue_values'. Also change the CFF loader so that
    invalid entries in index files are ignored.
2006-02-27 13:14:42 +00:00
Wu, Chia-I (吳佳一) cffa8b65be * src/base/ftobjs.c (FT_Set_Char_Size): Ahh.. forgot to check the case
width or height is 0.
2006-02-27 11:11:40 +00:00
Suzuki, Toshiya (鈴木俊哉) 2f239b8e88 Update MPW makefiles to new header inclusion introduced on 2006-02-16 2006-02-27 10:34:33 +00:00
Wu, Chia-I (吳佳一) 2e48a1a138 * src/base/ftobjs.c (ft_glyphslot_grid_fit_metrics, FT_Load_Glyph):
Re-enable glyph metrics grid-fitting.  It is now done in the base
layer.
(FT_Set_Char_Size, FT_Set_Pixel_Sizes): Make sure the width and height
are not too small or too large, just like we were doing in 2.1.10.

* src/autofit/afloader.c (af_loader_load_g): The vertical metrics are
not scaled.
2006-02-27 09:18:07 +00:00
Werner Lemberg f99d846c8a * docs/release: Minor additions and clarifications.
* docs/CHANGES: Updated to reflect many fixes for backwards
compatibility.  Still incomplete.
2006-02-26 17:50:59 +00:00
Werner Lemberg 0aaf429a23 Fix ChangeLog. 2006-02-26 17:30:15 +00:00
David Turner b463665feb * src/base/ftobjs.c (ft_recompute_scaled_metrics): re-enable conservative
rounding of metrics to avoid breaking clients like Pango
    (see http://bugzilla.gnome.org/show_bug.cgi?id=327852)
2006-02-26 07:57:45 +00:00
Werner Lemberg ae1e4b1577 * src/cache/ftccache.c (ftc_node_destroy): Use FT_LOCAL_DEF (again). 2006-02-25 17:11:04 +00:00
Werner Lemberg 20a8d0cf38 * devel/ftoption.h: Synchronize with
include/freetype/config/ftoption.h.
2006-02-25 16:56:04 +00:00
Werner Lemberg 7f049f4221 Formatting, copyright years. 2006-02-25 16:52:16 +00:00
David Turner de271ab8f0 * builds/unix/ftsystem.c, include/freetype/config/ftheader.h,
include/freetype/internal/services/svotval.h,
    include/freetype/internal/services/svpfr.h,
    src/base/ftsystem.c, src/bdf/bdfdrivr.c, src/cache/ftcbasic.c,
    src/cff/cffcmap.c, src/gzip/ftgzip.c, src/lzw/ftlzw.c,
    src/lzw/ftlzw2.c, src/psaux/t1cmap.c, src/sfnt/ttbdf.c,
    src/smooth/ftgrays.c:

       solved -Wmissing-prototypes warnings with GCC
2006-02-25 14:53:02 +00:00
David Turner 6c71c6b968 * include/freetype/config/ftoption.h, src/autofit/afcjk.c,
src/base/ftobjs.c, src/base/ftutil.c, src/cff/cffobjs.c,
    src/psaux/afmparse.c, src/sfnt/ttbdf.c, src/tools/apinames.c,
    src/truetype/ttdriver.c:

       solved compiler warnings as well as C++ compilation problems
2006-02-25 12:49:40 +00:00
Werner Lemberg d7e6b76739 Formatting, copyright years, minor cleanups. 2006-02-25 06:24:28 +00:00
Wu, Chia-I (吳佳一) 88242072b8 * src/base/ftoutln.c (FT_OUTLINE_GET_CONTOUR, ft_contour_has,
ft_contour_enclosed, ft_outline_get_orientation): Commented out.  We
have to wait until `FT_GlyphSlot_Own_Bitmap' is stabilized.
(FT_Outline_Embolden): Use `FT_Outline_Get_Orientation'.
2006-02-24 11:53:21 +00:00
Wu, Chia-I (吳佳一) 032646139d * include/freetype/ftbitmap.h (FT_Bitmap_Embolden): Update
documentation.

* include/freetype/ftsynth.h (FT_GlyphSlot_Own_Bitmap),
src/base/ftsynth.c (FT_GlyphSlot_Own_Bitmap): New function to make
sure a glyph slot owns its bitmap.  It is also marked experimental and
due to change.
(FT_GlyphSlot_Embolden): Undo the last change.  It turns out rendering
the outline confuses some applications.
2006-02-24 11:18:40 +00:00
David Turner 478c591364 * tagging Third release candidate with VER-2-2-0-RC3 2006-02-24 09:56:23 +00:00
David Turner ca7d76f789 * src/cache/ftcbasic.c: correcting compatibility hack bug 2006-02-24 09:09:10 +00:00
Wu, Chia-I (吳佳一) a8e7a01965 * include/freetype/freetype.h (FT_Size_RequestRec): Change the type of
`width' and `height' to `FT_Long'.
(enum FT_Size_Request_Type), src/base/ftobjs.c (FT_Request_Metrics):
New request type `FT_SIZE_REQUEST_TYPE_SCALES' to specify the scales
directly.
2006-02-24 06:11:30 +00:00
David Turner a3873d2702 another try 2006-02-23 23:18:13 +00:00
David Turner b0e0db116d another hack 2006-02-23 23:03:39 +00:00
David Turner 782f13831e fix small bug 2006-02-23 22:59:52 +00:00
David Turner 3b6c71ee24 additionnal backwards-compatibility hacks 2006-02-23 22:57:31 +00:00
David Turner 88d8985a99 * src/cache/ftccmap.c: trying to hack binary compatibility for
gnustep-back (GNUstep backend module) which still crashes under
    Sarge.
2006-02-23 22:35:26 +00:00
Werner Lemberg d4303da035 formatting, copyright years. 2006-02-23 21:01:34 +00:00
David Turner b698eedaa9 fixed typo that prevented compilation 2006-02-23 14:50:13 +00:00
David Turner 481838e234 * src/bdf/bdflib.c: fixed a problem with large encodings.
Again, this patch comes from Debian libfreetype6 for 2.1.10 !
2006-02-23 12:40:14 +00:00
David Turner 6cda6c064f * src/bdf/bdflib.c: fixed a bug with zero-width glyphs
this patch comes from the Debian package for libfreetype6 !!
    How come nobody mentions this on the devel list ??
2006-02-23 12:37:18 +00:00
Wu, Chia-I (吳佳一) 890f807a7b * include/freetype/ftoutln.h (enum FT_Orientation): New value
`FT_ORIENTATION_NONE'.

* src/base/ftoutln.c (FT_OUTLINE_GET_CONTOUR, ft_contour_has,
ft_contour_enclosed, ft_outline_get_orientation): Another version of
`FT_Outline_Get_Orientation'.  This version differs from the public
one in that each part (contour not enclosed in another contour) of the
outline is checked for orientation.
(FT_Outline_Embolden): Use `ft_outline_get_orientation'.

* src/base/ftsynth.c (FT_GlyphSlot_Embolden): Render the outline and
use bitmap's embolden routine when the outline one failed.
2006-02-22 20:47:39 +00:00
Werner Lemberg 0d9be1c31e Fix comment so that it is included into the HTML documentation. 2006-02-22 14:28:06 +00:00
David Turner cdb610f624 adding missing file 2006-02-22 12:55:04 +00:00
Werner Lemberg 5edafed12a Clean-ups, copyright years, formatting. 2006-02-22 08:23:35 +00:00
Wu, Chia-I (吳佳一) facd9af542 * modules.cfg: Compile in ftotval.c and ftxf86.c by default for ABI
compatibility.

* src/sfnt/sfobjs.c (sfnt_done_face): Fix a memory leak.

* src/sfnt/ttsbit0.c (tt_sbit_decoder_load_bit_aligned,
tt_sbit_decoder_load_byte_aligned) [FT_OPTIMIZE_MEMORY]: Fix sbit
loading. (only tested with bit aligned sbit with x_pos == 0)

* src/truetype/ttpload.c (tt_face_load_hdmx,
tt_face_get_device_metrics) [FT_OPTIMIZE_MEMORY]: hdmx is not actually
used.
2006-02-22 07:59:35 +00:00
David Turner 0b5dc4df88 * include/freetype/ftmodapi.h, include/internal/ftserv.h,
include/internal/services/svtteng.h, src/base/ftobjs.c,
    src/truetype/ttdriver.c:

    adding a new API named FT_Get_TrueType_Engine_Type to determine
    wether we have a patented, unpatented or unimplemented TrueType
    bytecode interpreter.

    the FT_Get_Module_Flags API was removed consequently.
2006-02-21 22:36:23 +00:00
David Turner 44c865dfe1 fixed compiler warning 2006-02-21 17:10:27 +00:00
David Turner c093db9d06 * src/sfnt/sfmtx.c: disabling memory optimization when
FT_CONFIG_OPTION_OLD_INTERNALS is used. This is because libXfont
    is directly accessing the HMTX data. Grrrrr....
2006-02-21 17:06:35 +00:00
David Turner 1ae134a233 * src/sfnt/sfobjs.c (sfnt_face_load): fixed silly bug that
prevented embedded bitmaps from being correctly listed and used

    * src/pfr/pfrsbit.c: fixed handling of character advances
2006-02-21 16:50:17 +00:00
Werner Lemberg d41aecdbc0 formatting, doc improvements 2006-02-21 08:08:14 +00:00
David Turner dd0f3609d7 * include/freetype/internal/sfnt.h, src/sfnt/sfdriver.c,
src/sfnt/ttsbit.h, src/sfnt/ttsbit.c: moving the definition
        of 'set_sbit_strike' and 'load_sbit_metrics' to their 2.1.8
        location. This is used to support binary compatibility with
        the X.Org server's libXfont library.

        note that this disables memory optimizations for the embedded
        bitmap loader.Sigh....
2006-02-20 23:50:21 +00:00
Werner Lemberg f145e312df Formatting, copyright years, minor doc fixes. 2006-02-19 16:12:18 +00:00
David Turner 0880ac333a * builds/unix/unix-cc.in: don't filter-out exported functions
anymore, this is used to ensure that all FT_BASE internal
    functions are available for dynamic linking

    * include/freetype/ftcache.h, src/cache/ftcbasic.c,
    src/cache/ftccmap.c: try to revive old functions of the
    cache sub-system. We also try to support FTC_ImageCache_Lookup
    and FTC_ImageCache_SBit with legacy signatures through a gross
    hack (hope it works)
2006-02-17 17:23:13 +00:00
Werner Lemberg 1fae66950b * devel/ftoption.h: Synchronize with
include/freetype/config/ftoption.h.
2006-02-17 16:16:40 +00:00
Werner Lemberg 8e6f8c4d79 Formatting, copyright years, documentation improvements. 2006-02-17 08:07:09 +00:00
David Turner cda2d957dc * builds/amiga/src/base/ftsystem.c, devel/ftoption.h
include/freetype/ftcache.h, include/freetype/ftoutln.h,
      include/freetype/cache/ftccache.h, include/freetype/cache/ftccmap.h,
      include/freetype/config/ftoption.h, include/freetype/internal/ftcalc.h,
      include/freetype/internal/ftdriver.h,
      include/freetype/internal/ftmemory.h,
      include/freetype/internal/ftobjs.h, include/freetype/internal/ftrfork.h,
      include/freetype/internal/psaux.h, include/freetype/internal/sfnt.h,
      include/freetype/internal/t1types.h, include/freetype/internal/tttypes.h,
      src/base/ftcalc.c, src/base/ftdbgmem.c, src/base/ftobjs.c,
      src/base/ftsystem.c, src/base/ftutil.c, src/bdf/bdfdrivr.c,
      src/cache/ftccache.c, src/cache/ftccback.h, src/cache/ftccmap.c,
      src/cache/ftcmanag.c, src/cff/cffdrivr.c, src/cid/cidriver.c,
      src/pcf/pcfdrivr.c, src/pfr/pfrdrivr.c, src/psaux/psauxmod.c,
      src/sfnt/sfdriver.c, src/truetype/ttdriver.c, src/type1/t1driver.c,
      src/type1/t1objs.c, src/type42/t42drivr.c, src/winfonts/winfnt.c:

    massive changes to the internals to respect the internal object layouts
    and exported functions of FreeType 2.1.7. Note that the cache sub-system
    cannot be fully retrofitted, unfortunately.
2006-02-16 22:45:31 +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
Werner Lemberg 5225402a52 * include/freetype/ftoutln.h (FT_Outline_Embolden): Mention in
documentation that negative strength values are possible.
Give an example call.

* include/freetype/freetype.h (FT_GlyphSlotRec): Improve
documentation of `outline' field.

* src/sfnt/sfobjc.s: Inckude FT_INTERNAL_DEBUG_H.
* src/sfnt/sfdriver.c: Include ttmtx.h.

* src/autofit/afcjk.c: Include aftypes.h and aflatin.h.
2006-02-15 06:05:52 +00:00
Wu, Chia-I (吳佳一) 3dc0018174 * src/sfnt/ttmtx.c (tt_face_get_metrics): Typo. 2006-02-14 13:36:28 +00:00
Wu, Chia-I (吳佳一) 9a2b3b6d55 * src/sfnt/ttmtx.c (tt_face_load_hhea, tt_face_load_hmtx): Simply
return error if table is missing.
Check table length in non-FT_OPTIMIZE_MEMORY'ed `tt_face_load_hmtx'.

* src/sfnt/sfobjs.c (sfnt_load_face): Take care of missing metrics
tables.  The last change makes Mac bitmap-only font not load and this
fixes it.

* src/truetype/ttgload.c (load_truetype_glyph): Fix compilation error
when FT_CONFIG_OPTION_INCREMENTAL is defined.
2006-02-14 08:37:03 +00:00
Wu, Chia-I (吳佳一) 35222ff7bb Clean up the SFNT_Interface. In this final pass, `load_hmtx' is
splitted from `load_hhea'.

* include/freetype/internal/sfnt.h, src/sfnt/sfdriver.c,
src/sfnt/ttmtx.c, src/sfnt/ttmtx.h: Split `hmtx' from `hhea'.

* src/sfnt/sfobjs.c (sfnt_load_face): Update.
2006-02-14 07:25:57 +00:00
Wu, Chia-I (吳佳一) e0decd1e27 * src/sfnt/ttmtx.h, src/sfnt/ttmtx.c: Why are there two copies of
code...
2006-02-14 07:20:06 +00:00
Wu, Chia-I (吳佳一) 65863a5712 Clean up the SFNT_Interface. In this pass, we want to treat the font
directory (offset table and table directory) as a normal table like
the others.  This also means that TTC is no longer recognized there,
but in `init_face'.

* include/freetype/internal/sfnt.h (SFNT_Interface),
src/sfnt/sfdriver.c: `load_sfnt_header' and `load_directory' are
combined and renamed to `load_font_dir'.

* src/sfnt/ttload.h, src/sfnt/ttload.c:
s/sfnt_dir_check/check_table_dir/.
`sfnt_init' is moved to sfobjs.c and renamed to `sfnt_open_font'.
`tt_face_load_sfnt_header' and `tt_face_load_directory' are combined
and renamed to `tt_face_load_font_dir'.

* src/sfnt/sfobjs.c (sfnt_init_face): Recognize TTC here.
2006-02-14 07:01:29 +00:00
Wu, Chia-I (吳佳一) f5aa47beb0 Clean up the SFNT_Interface. Table loading functions are now named
after the tables' tags;  `hdmx' is TrueType-specific and thus the code
is moved to the truetype module; `get_metrics' is moved here from the
truetype module so that the code can be shared with the cff module.

This pass involves no real changes.  That is, the code is moved
verbatim mostly.  The only exception is the return value of
`tt_face_get_metrics'.

* include/freetype/internal/sfnt.h, src/sfnt/rules.mk,
src/sfnt/sfdriver.c, src/sfnt/sfnt.c, src/sfnt/sfobjs.c,
src/sfnt/ttload.c, src/sfnt/ttload.h, src/sfnt/ttsbit.c,
src/sfnt/ttsbit.h, src/sfnt/ttsbit0.c: Clean up the SFNT_Interface.

* src/sfnt/ttmtx.c, src/sfnt/ttmtx.h: Metrics-related tables' loading
and parsing code is moved here.
Move `tt_face_get_metrics' here from the truetype module.  The return
value is changed from `void' to `FT_Error'.

* include/freetype/internal/fttrace.h: New trace: ttmtx.

* src/truetype/ttpload.c, src/truetype/ttpload.h: `hdmx' loading and
parsing code is moved here.
New function `tt_face_load_prep' splitted from `tt_face_load_fpgm'.
`tt_face_load_fpgm' returns `FT_Err_Ok' if `fpgm' doesn't exist.

* src/cff/cffgload.c, src/cff/cffobjs.c: Update.

* src/truetype/ttgload.c, src/truetype/ttobjs.c: Update.
2006-02-14 06:40:10 +00:00
Werner Lemberg d39fda2b55 Formatting, copyright years. 2006-02-12 21:49:21 +00:00
Wu, Chia-I (吳佳一) 4c507ffa80 * src/autofit/afcjk.c (af_cjk_metrics_init): Fix a stupid bug...
* src/autofit/aflatin.c (af_latin_metrics_init_widths): Use
AF_LatinMetricsRec as the dummy metrics because we cast the metrics to
it later in `af_latin_hints_link_segments'.
2006-02-11 13:22:37 +00:00
Wu, Chia-I (吳佳一) f9a69132a7 * include/freetype/config/ftoption.h (AF_CONFIG_OPTION_CJK): #define
to enable autofit CJK script support. (#define'd by default)

* src/autofit/aflatin.h (AF_LATIN_CONSTANT): New macro.

* src/autofit/aflatin.c (af_latin_metrics_init_widths): Make sure that
`edge_distance_threshold' is always set.
(af_latin_hints_link_segments): Potential divide by 0 bug.
Use latin constant in the scoring formula.

* src/autofit/afcjk.c: Minor updates due to the above three changes.

* docs/TODO, docs/CHANGES: Updated.
2006-02-11 12:12:02 +00:00
Werner Lemberg d1d4bffe2f formatting 2006-02-10 22:15:22 +00:00
Wu, Chia-I (吳佳一) 4cdb45c01e Introduce experimental autofit CJK module based on akito's autohint
patch.  You need to #define AF_MOD_CJK in afcjk.c to enable it.

* src/autofit/afglobal.c, src/autofit/afcjk.h, src/autofit/afcjk.c,
src/autofit/rules.mk, src/autofit/autofit.c, src/autofit/aftypes.h:
Add CJK module based on akito's autohint patch.

* src/autofit/afhints.h (AF_SegmentRec): New field `len' for the
overlap length of the segments.  (AF_SEGMENT_LEN, AF_SEGMENT_DIST):
New macros.

* src/autofit/aflatin.h (af_latin_metrics_init_widths),
src/autofit/aflatin.c (af_latin_metrics_init_widths): Made `FT_LOCAL'.
Use the character given by the caller.
(af_latin_metrics_init_widths, af_latin_hints_link_segments): Scale
the thresholds.

* src/autofit/afloader.c (af_loader_load_g): Respect
AF_SCALER_FLAG_NO_ADVANCE.
2006-02-09 14:17:04 +00:00
Werner Lemberg 6be99f9104 * src/cid/cidparse.c (cid_parse_new): Remove shadowing variable.
Formatting.
2006-02-09 07:38:57 +00:00
Suzuki, Toshiya (鈴木俊哉) 4f41d63b02 fix src/cid/cidparse.c for too-short CIDFont 2006-02-09 01:43:00 +00:00
Suzuki, Toshiya (鈴木俊哉) 458c34233d fix --with-old-mac-fonts option 2006-02-08 12:58:24 +00:00
Werner Lemberg 54a79c8854 Use `?='. 2006-02-01 07:54:07 +00:00
Werner Lemberg 8a4de0d669 * Makefile, *.mk: Use `?=' where appropriate.
* builds/detect.mk (TOP_DIR), builds/os2/os2-dev.mk (TOP_DIR),
builds/win32/w32-dev.mk (TOP_DIR): Removed.  Defined elsewhere.
2006-02-01 07:52:11 +00:00
Werner Lemberg 9a8006b18e * builds/unix/install.mk (install): Fix path for ftmodule.h. 2006-02-01 06:07:05 +00:00
Werner Lemberg 03379b6533 * builds/unix/unixddef.mk: Actually do define PLATFORM (fixing
change from 2006-01-31).
(TOP_DIR, OBJ_DIR): Update.
2006-02-01 05:40:06 +00:00
Werner Lemberg 82a0e3cd53 s/index/size_index/ to avoid compiler warnings. 2006-02-01 05:22:25 +00:00
Werner Lemberg 38beff0083 * src/otvalid/module.mk: s/otvalid_module_class/otv_module_class/.
* src/gxvalid/module.mk: s/gxvalid_module_class/gxv_module_class/.
2006-02-01 05:14:25 +00:00
Werner Lemberg 59939244ad Implement new, simplified module selection. With GNU make it is now
sufficient to modify a single file, `modules.cfg', to control the
inclusion of modules and base extension files.

This change also fixes the creation of ftmodule.h; it now depends on
`modules.cfg' and thus is rebuilt only if necessary.

Finally, a version of `ftoption.h' in OBJ_DIR is preferred over the
default location.

* modules.cfg: New file.

* builds/freetype.mk: Don't include `modules.mk'.
Include all `rules.mk' files as specified in `modules.cfg'.
(FTOPTION_FLAG, FTOPTION_H): New variables.
(FT_CFLAGS): Add macro definition for FT_CONFIG_MODULES_H.
Add FTOPTION_FLAG.
($(FT_INIT_OBJ)): Don't use FT_MODULE_LIST.
(CONFIG_H): Add FTMODULE_H and FTOPTION_H.
(INCLUDES): Add DEVEL_DIR.
(INCLUDE_FLAGS, FTSYS_SRC, FTSYS_OBJ, FTDEBUG_SRC, FTDEBUG_OBJ,
OBJ_M, OBJ_S): Use `:=', not `='.
(remove_ftmodule_h): New phony target to delete `ftmodule.h'.
(distclean): Add remove_ftmodule_h.

* builds/modules.mk: (MODULE_LIST): Removed.
(make_module_list, clean_module_list): Replace targets
with...
(FTMODULE_H_INIT, FTMODULE_H_CREATE, FTMODULE_H_DONE): New
variables.  Reason for the change is that it is not possible to have
a phony prerequisite which is run only if the target file must be
rebuilt (phony prerequisites act like subroutines and are *always*
executed).  We only want to rebuild `ftmodule.h' if `module.cfg' is
changed.
Update all callers.
($FTMODULE_H)): Rule to create `ftmodule.h', depending on
`modules.cfg'.

* builds/toplevel.mk: Rewrite and simplify module handling.
(MODULES_CFG, FTMODULE_H): New variables.
Include MODULES_CFG.
(MODULES): New variable to include all `module.mk' and `rules.mk'
files.  We no longer use make's `wildcard' function for this.

* Makefile (USE_MODULES): Remove.  Update all users.
(OBJ_DIR): Define it here.

* src/*/module.mk: Change

    make_module_list: foo
    foo: ...

to

    FTMODULE_H_COMMANDS += FOO
    define FOO
    ...
    endef

in all files.  `FTMODULE_H_COMMANDS' is used in `FTMODULE_H_CREATE'.

* src/base/rules.mk (BASE_EXT_SRC): Use BASE_EXTENSIONS.

* builds/unix/detect.mk (setup): Always execute `configure' script.
(have_mk): Rename to...
(have_Makefile): This.
Don't use `strip' function.

* builds/unix/unix.mk: Include `install.mk' only if BUILD_PROJECT is
defined.
(have_mk): Don't use `strip' function.
Test for unix-def.mk in OBJ_DIR, not BUILD_DIR (and invert the test
accordingly).

* builds/unix/install.mk (install, uninstall): Handle `ftmodule.h'.

* builds/os2/os2-dev.mk, builds/unix/unix-dev.mk,
builds/win32/w32-bccd.mk, builds/win32/w32-dev.mk: Don't define
BUILD_DIR but DEVEL_DIR for development header files.

* builds/ansi/ansi-def.mk (TOP_DIR, OBJ_DIR),
builds/beos/beos-def.mk (TOP_DIR, OBJ_DIR), builds/unix/unix-def.in
(TOP_DIR, OBJ_DIR): Removed.  Defined elsewhere.

* builds/dos/dos-def.mk (OBJ_DIR), builds/os2/os2-def.mk (OBJ_DIR),
builds/win32/win32-def.mk (OBJ_DIR): Removed.  Defined elsewhere.

* builds/unix/unixddef.mk: Don't define BUILD_DIR but DEVEL_DIR for
development header files.
Don't define PLATFORM.

* configure: Copy `modules.cfg' to builddir if builddir != srcdir.
Update snippet taken from autoconf's m4sh.m4 to current CVS version.
Be more verbose.

* include/freetype/config/ftmodule.h: Add comments -- this file is
no longer used if FreeType is built with GNU make.

* docs/CHANGES, docs/CUSTOMIZE, docs/INSTALL, docs/INSTALL.ANY,
docs/INSTALL.GNU, docs/INSTALL.UNX: Document new build mechanism.
Other minor updates.

* modules.txt: Removed.  Contents included in `modules.cfg'.


* include/freetype/internal/ftmemory.h (FT_QAlloc_Debug,
FT_Free_Debug) [FT_STRICT_ALIASING]: Fix typos.

* src/base/ftdbgmem.c (FT_Alloc_Debug, FT_Realloc_Debug,
FT_QAlloc_Debug, FT_QRealloc_Debug, FT_Free_Debug)
[FT_STRICT_ALIASING]: Implement.
2006-01-31 20:17:42 +00:00
Wu, Chia-I (吳佳一) 5d146851df * src/cff/cffobjs.c (cff_face_init), src/cid/cidobjs.c
(cid_face_init), src/pfr/pfrobjs.c (pfr_face_init), src/type1/t1objs.c
(T1_Face_Init): Set face->height to
MAX(1.2 * units_per_EM, ascender - descender).
2006-01-31 10:29:44 +00:00
Wu, Chia-I (吳佳一) 98d802b83a * include/freetype/internal/t1types.h (AFM_FontInfo),
src/psaux/afmparse.c, src/tools/test_afm.c: Read `FontBBox',
`Ascender', and `Descender' from an AFM.

* src/type1/t1afm.c (T1_Read_Metrics): Use the metrics from the AFM.

* include/freetype/freetype.h (FT_FaceRec): Mention that fields may be
changed after file attachment.
2006-01-31 07:01:24 +00:00
Werner Lemberg 7596fd3a46 * src/*/module.mk (.PHONY): Add. 2006-01-28 16:29:29 +00:00
Werner Lemberg f6a25503c5 * devel/ftoption.h: Synchronize with
include/freetype/config/ftoption.h.

* src/autofit/module.mk (add_autofit_module), src/bdf/module.mk
(add_bdf_module), src/type42/module.mk (add_type42_driver): Fix
whitespace.

* src/smooth/module.mk (add_smooth_renderer): Add lcd and lcdv
renderer classes.
2006-01-28 10:38:15 +00:00
Werner Lemberg 68a15ebbe4 * README, docs/FTL.TXT: Fix email address for bug reports.
Other minor formatting.
2006-01-28 07:30:58 +00:00
David Turner 7213b4febd * builds/unix/configure.ac: fixed build problem on Cygwin
* builds/unix/install.mk: the installation now avoids installing
    the internal headers, and removes existing ones if finds in the
    target install directory
2006-01-27 16:42:32 +00:00
Werner Lemberg be3c9814a4 Formatting, copyright years. 2006-01-27 14:16:16 +00:00
David Turner 6a681fa84a * src/autofit/afwarp.c: simple #ifdef to prevent compilation when
the warp hinter isn't active (it shouldn't, still experimental)

    * Jamfile, include/freetype/config/ftmodule.h: removed "gxvalid"
    and "otvalid" from the list of modules that are linked statically
    to a given FreeType library. Functionality has been moved to the
    "ftvalid" CVS module.

    note also that current Make-based build system still compiles the
    modules though...

    * include/freetype/config/ftoption.h: added FT_STRICT_ALIASING,
    which controls the definitions of the memory management functions
    to avoid warnings with recent versions of GCC. this macro is
    only here to be disabled, in case we detect problems with the
    new scheme.

    NOTE: disable macro to use the memory debugger. this will be fixed
          later !!
2006-01-27 12:11:22 +00:00
David Turner 97c6418560 * builds/win32/visualc/freetype.dsp: updating project file to
define FT2_BUILD_LIBRARY, and remove gxvalid+otvalid from
    compilation
2006-01-27 12:06:37 +00:00
David Turner ff0e9e6c0d * builds/freetype.mk, Jamfile: define the macro FT2_BUILD_LIBRARY
when compiling the library.

    * include/freetype/config/ftheader.h: remove inclusions of
    internal headers, except if the macro FT2_BUILD_LIBRARY is defined.
2006-01-27 09:15:53 +00:00
Werner Lemberg 9cc4aed879 Formatting. 2006-01-26 21:03:58 +00:00
Wu, Chia-I (吳佳一) bcc438b15e * include/freetype/freetype.h (FT_Select_Size): Rename the second
argument from `idx' to `strike_index'.
(FT_Size_Request_Type): Add FT_SIZE_REQUEST_TYPE_MAX to the end of
this enum.

* include/freetype/internal/ftobjs.h (FT_REQUEST_WIDTH,
FT_REQUEST_HEIGHT): New macros to get the width and height of a
request, in fractional pixels.

* include/freetype/internal/ftobjs.h (FT_Select_Metrics,
FT_Request_Metrics), src/base/ftobjs.c (FT_Select_Metrics,
FT_Request_Metrics): New base functions to set the font metrics.  They
were part of FT_Select_Size/FT_Request_Size and are made independent
functions so that metrics are not set again and again.

* src/base/ftobjs.c (FT_Select_Size, FT_Request_Size): Metrics are set
only when driver's size_select/size_request is NULL.  That is, drivers
should set the metrics themselves.
(FT_Match_Size): Round before matching.  This was what we did and it
does cause some problems without rounding.

* src/cff/cffobjs.c (cff_size_select), src/truetype/ttdriver.c
(tt_size_select): Set the font metrics.
s/index/strike_index/.
The scaled metrics are always preferred over strikes' metrics, even
when some strike is selected.  This is done because the strikes'
metrics are not reliable, e.g., the sign of the descender is wrong for
some fonts.

* src/cff/cffobjs.c (cff_size_request), src/truetype/ttdriver.c
(tt_size_request): Set the font metrics.
Call cff_size_select/tt_size_select when some strike is matched.

* src/bdf/bdfdrivr.c, src/cff/cffobjs.c, src/cid/cidobjs.c,
src/pcf/pcfdrivr.c, src/truetype/ttdriver.c, src/type1/t1objs.c,
src/type1/t1objs.h, src/type42/t42objs.c, src/winfonts/winfnt.c:
Set the font metrics.
s/index/strike_index/.

* src/tools/test_afm.c, src/psaux/psconv.c: Older versions of these
files were committed.  Just a catch-up.
(PS_Conv_ToFixed): Remove the `goto'.
(PS_Conv_ASCIIHexDecode, PS_Conv_EexecDecode): Speed up a little.

* src/sfnt/ttsbit.c (tt_face_load_sbit_strikes,
tt_face_load_strike_metrics), src/sfnt/ttsbit0.c
(tt_face_load_sbit_strikes, tt_face_load_strike_metrics): The
advertised metrics in `available_sizes' are different from those
actually used.
2006-01-23 14:12:40 +00:00
Wu, Chia-I (吳佳一) 4c6234d963 * src/psaux/psaux.c src/psaux/psauxmod.c src/type1/t1driver.c: Make
AFM parser optional, controlled by `T1_CONFIG_OPTION_NO_AFM'.
2006-01-23 10:46:38 +00:00
Werner Lemberg ed70ca5a0f * builds/unix/install-sh, builds/unix/mkinstalldirs: Updated from
`texinfo' CVS module at savannah.gnu.org.
2006-01-23 07:28:03 +00:00
Werner Lemberg b36bf52795 * src/autofit/afloader.c (af_loader_load_g): Move AF_USE_WARPER up
to avoid compiler warnings.

* src/autofit/afwarp.c (af_warper_compute_line_best): Remove
shadowing variable declarations.
Fix warning parameters and replace printf with AF_LOG.
(af_warper_compute): Remove unused variable.
2006-01-22 07:09:54 +00:00
Werner Lemberg 1be9ebf5f9 * src/autofit/rules.mk (AUTOF_DRV_SRC): Add afwarp.c.
Formatting, copyright notices, copyright years.
2006-01-22 06:58:16 +00:00
Werner Lemberg e7be64e988 Fix ChangeLog. 2006-01-21 17:27:32 +00:00
David Turner bb4edc9235 * src/autofit/aflatin.c, src/autofit/afwarp.h, src/autofit/afwarp.c,
src/autofit/aftypes.h, src/autofit/afloader.c, src/autofit/autofit.c:

    adding experimental implementation of "warp hinting" (new hinting
    algorithm for gray-level and LCD rendering). It is disabled by default,
    you need to #define AF_USE_WARPER in aftypes.h to enable it.
2006-01-21 14:31:45 +00:00
David Turner 8c16ed361c * src/sfnt/ttsbit0.c (tt_face_load_strike_metrics): fixed small
bug that prevented compilation when FT_OPTIMIZE_MEMORY is defined
2006-01-19 13:10:49 +00:00
Werner Lemberg 8b560632d7 * builds/win32/visualc/freetype.dsp: Updated.
Typos.
2006-01-19 08:30:58 +00:00
Werner Lemberg 47bf95dd70 Use pscmap service in CFF module.
* src/cff/cffcmap.c (cff_cmap_uni_pair_compare): Removed.
(cff_sid_to_glyph_name): New function.
(cff_cmap_unicode_init, cff_cmap_unicode_done,
cff_cmap_unicode_char_index, cff_cmap_unicode_char next): Use pscmap
service.
(cff_cmap_unicode_class_rec): Updated.
* src/cff/cffcmap.h (CFF_CMapUnicode, CFF_CMap_UniPair): Removed.


* src/psnames/psmodule.c (ps_unicodes_char_next): Fix `unicode'
return value.


* src/psaux/afmparse.c (afm_parser_read_vals): Use double casting
to avoid type-punning compiler warnings.
2006-01-17 16:55:32 +00:00
Werner Lemberg ce94c7a9aa Formatting, copyright years. 2006-01-16 22:35:33 +00:00
Wu, Chia-I (吳佳一) 108fdbbbd3 * src/psaux/afmparse.c, src/psaux/afmparse.h: New files which
implement an AFM parser.  It is used to parse an AFM file.

* src/psaux/psconv.c, src/psaux/psconv.h: New files to provide
conversion functions (e.g, PS real number => FT_Fixed) for the
PS_Parser and AFM_Parser.  Some of the functions are taken, with some
modifications, from the psobjs.c

* src/psaux/psobjs.c: Use functions from psconv.c.

* include/freetype/internal/psaux.h, src/psaux/psauxmod.c:: Add
`AFM_Parser' to the `psaux' service.

* src/psaux/psaux.c, src/psaux/rules.mk: Include those new files.

* src/tools/test_afm.c: A test program for AFM parser.

* include/freetype/internal/services/svkern.h,
include/freetype/internal/ftserv.h: New service `Kerning'.  It is
currently only used to get the track kerning information.

* src/type1/t1driver.c, src/type1/t1objs.c, src/type1/t1afm.c,
src/type1/t1afm.h: Update to use the AFM parser.
Provide the `Kerning' service.

* include/freetype/freetype.h, src/base/ftobjs.c: New API
`FT_Get_Track_Kerning'.
2006-01-16 15:35:56 +00:00
Wu, Chia-I (吳佳一) ea1e8d3a53 * include/freetype/internal/ftobjs.h, src/base/ftobjs.c,
src/bdf/bdfdrivr.c, src/cff/cffgload.c, src/cid/cidgload.c,
src/pcf/pcfdrivr.c, src/type1/t1gload.c, src/winfonts/winfnt.c:
s/ft_fake_vertical_metrics/ft_synthesize_vertical_metrics/.

* docs/CHANGES: Mention that vertical metrics are synthesized for
fonts not having this info.
2006-01-15 15:01:45 +00:00
Werner Lemberg 1723dcc261 Formatting, minor clean-ups. 2006-01-15 07:30:32 +00:00
Wu, Chia-I (吳佳一) ce5ee00d02 copyright year updates. 2006-01-15 06:32:57 +00:00
Wu, Chia-I (吳佳一) 212aee0d6e * include/freetype/internal/ftobjs.h (ft_fake_vertical_metrics),
src/base/ftobjs.c (ft_fake_vertical_metrics): New function to fake the
vertical metrics.

* src/cff/cffgload.c, src/cid/cidgload.c, src/pcf/pcfdrivr.c,
src/type1/t1gload.c, src/winfonts/winfnt.c: Fake the vertical metrics.
The fake metrics is monotone.

* src/truetype/ttgload.c (compute_glyph_metrics): Some fixes and
formattings in vertical metrics faking.  There are still rooms for
improvements (and so do the CFF module).
2006-01-15 06:24:53 +00:00
Wu, Chia-I (吳佳一) e5ff059f7f * src/bdf/bdfdrivr.c (BDF_Glyph_Load), src/pcf/pcfdrivr.c
(PCF_Glyph_Load), src/winfonts/winfnt.c (FNT_Load_Glyph): Don't set
the linear advance fields as they are only for the outline glyphs.

* include/freetype/freetype.h: Documentation updates/clarificatoins.
The meaning of FT_LOAD_FORCE_AUTOHINT is changed so that no real
change need be made to the code.

* src/base/ftobjs.c (FT_Load_Glyph): Resolve flag dependencies and
decide whether to use the auto-hinter according to documentation.
There should to be no real difference.
Some checks (e.g., is text height positve?) after the glyph is loaded.
(FT_Select_Size, FT_Request_Size): Scales are set to wrong values.
Be careful that scales won't be negative.
2006-01-15 06:00:49 +00:00
Werner Lemberg 01fa8238ef Many doc fixes. From Chia-Yi. 2006-01-14 08:17:52 +00:00
Werner Lemberg 3d8eeb8e97 Formatting, comment fixes. 2006-01-14 07:10:45 +00:00
Wu, Chia-I (吳佳一) e33dc2ebee * docs/CHANGES: Mention the size selection change.
* src/bdf/bdfdrivr.c (BDF_Size_Request, BDF_Size_Select),
src/pcf/pcfdrivr.c (PCF_Size_Request, PCF_Size_Select),
src/winfonts/winfnt.c (FNT_Size_Request, FNT_Size_Select): Do size
matching for request of type NOMINAL and REAL_DIM.

* src/winfonts/winfnt.c (FNT_Face_Init): Print trace message when
`pixel_height' is used for nominal height.

* src/base/ftobjs.c (FT_Request_Size): Call `FT_Match_Size' if the
face is bitmap only and driver doesn't provide `request_size'.  This
is added merely for completion as no driver satisfies the conditions.
2006-01-14 05:09:30 +00:00
Werner Lemberg f1c2b91e14 Formatting, copyright year updates.
Decorate long constants with `L' and `UL' where appropriate.
2006-01-13 14:53:28 +00:00
Wu, Chia-I (吳佳一) fa7d6ab217 * include/freetype/internal/sfnt.h (SFNT_Interface): New method
`load_strike_metrics' used to load the strike's metrics.

* src/sfnt/sfdriver.c, src/sfnt/ttsbit.c, src/sfnt/ttsbit.h,
src/sfnt/ttsbit0.c: New function `tt_face_load_strike_metrics'.

* src/pfr/pfrobjs.c (pfr_face_init): Set FT_Bitmap_Size correctly.

* src/winfonts/winfnt.c (FNT_Face_Init): Use `nominal_point_size' for
nominal size unless it is obviously incorrect.

* include/freetype/freetype.h (FT_Bitmap_Size): Update the comments on
FNT driver.


Introduce new size selection interface.

* include/freetype/internal/ftdriver.h (struct FT_Driver_ClassRec_):
Replace `set_char_sizes' and `set_pixel_sizes' by `request_size' and
`select_size'.

* include/freetype/freetype.h (FT_Select_Size, FT_Size_Request_Type,
FT_Size_Request, FT_Request_Size, FT_Select_Size), src/base/ftobjs.c
(FT_Select_Size, FT_Request_Size): API additions to export the new
size selection interface.

* src/base/ftobjs.c (FT_Set_Char_Size, FT_Set_Pixel_Sizes): Use
`FT_Request_Size'.

* include/freetype/internal/ftobjs.h (FT_Match_Size),
src/base/ftobjs.c (FT_Match_Size): New function to match a size
request against `available_sizes'.  Drivers supporting bitmap strikes
can use this function to implement `request_size'.

* src/bdf/bdfdrivr.c, src/cid/cidobjs.c, src/cid/cidobjs.h,
src/cid/cidriver.c, src/pcf/pcfdrivr.c, src/type1/t1driver.c,
src/type1/t1objs.c, src/type1/t1objs.h, src/type42/t42drivr.c,
src/type42/t42objs.c, src/type42/t42objs.h, src/winfonts/winfnt.c:
Update to new size selection interface.

* src/cff/cffdrivr.c, src/cff/cffgload.c, src/cff/cffobjs.c,
src/cff/cffobjs.h, src/truetype/ttdriver.c, src/truetype/ttgload.c,
src/truetype/ttobjs.c, src/truetype/ttobjs.h: Update to new size
selection interface.
Make `strike_index' FT_ULong and always defined.
Use `load_strike_metrics' provided by SFNT interface.
2006-01-13 12:21:31 +00:00
Werner Lemberg 64714a28fb Copyright year, minor formatting. 2006-01-12 08:49:24 +00:00
Werner Lemberg 8ab0979d6e Prepare use of pscmap service within CFF module.
* include/freetype/internal/services/svpscmap.h: Include
FT_INTERNAL_OBJECTS_H.
(PS_Unicode_Index_Func): Removed.  Unused.
(PS_Macintosh_Name_Func): Renamed to...
(PS_Macintosh_NameFunc): This.
Update all callers.
(PS_Adobe_Std_Strings_Func): Renamed to...
(PS_Adobe_Std_StringsFunc): This.
Update all callers.
(PS_UnicodesRec): This is the former `PS_Unicodes' structure.
Add `cmap' member.
Update all callers.
(PS_Unicodes): This is now a typedef'd pointer to PS_UnicodesRec.
Update all callers.
(PS_Glyph_NameFunc): New typedef.
(PS_Unicodes_InitFunc): Change arguments to expect a function
and generic data pointer which returns a glyph name from a given
index.

* src/psnames/psmodule.c (ps_unicodes_init, ps_unicodes_char_index,
ps_unicodes_char_next, pscmaps_interface): Updated.

* include/freetype/internal/t1types.h (T1_FaceRec): Updated.

* src/psaux/t1cmap.h (T1_CmapStdRec): Updated.
(T1_CmapUnicode, T1_CmapUnicodeRec): Removed.

* src/psaux/t1cmap.c (t1_get_glyph_name): New callback function.
(t1_cmap_unicode_init, t1_cmap_unicode_done,
t1_cmap_unicode_char_index, t1_cmap_unicode_char_next,
t1_cmap_unicode_class_rec): Updated.

* src/type42/t42types.h (T42_FaceRec): Updated.
2006-01-12 08:12:27 +00:00
Suzuki, Toshiya (鈴木俊哉) 356a4d894c * Add declarations of new MacOS-specific APIs 2006-01-12 03:33:16 +00:00
Werner Lemberg 435046b54b Formatting, improving comments. 2006-01-11 10:57:42 +00:00
Werner Lemberg adf828ff95 Fix Savannah bug #15056 and use pscmap service in psaux module.
* include/freetype/internal/services/svpscmap.h (PS_UniMap): Use
FT_UInt32 for `glyph_index'.
(PS_Unicodes_InitFunc): Use FT_String for `glyph_names'.
(PS_Unicodes_CharIndexFunc): Use FT_UInt32 for `unicode'.
(PS_Unicodes_CharNextFunc): Make second argument a pointer to
FT_UInt32.

* src/psnames/psmodule.c (VARIANT_BIT, BASE_GLYPH): New macros.
(ps_unicode_value): Set VARIANT_BIT in return value if glyph is a
variant glyph (this is, it has non-leading `.' in its name).
(compare_uni_maps): Sort base glyphs before variant glyphs.
(ps_unicodes_init): Use FT_String for `glyph_names' argument.
Reallocate only if number of used entries is much smaller.
Updated to handle variant glyphs.
(ps_unicodes_char_index, ps_unicodes_char_next): Prefer base glyphs
over variant glyphs.
Simplify code.

* src/psaux/t1cmap.c (t1_cmap_uni_pair_compare): Removed.
(t1_cmap_unicode_init, t1_cmap_unicode_char_index,
t1_cmap_unicode_char_next): Use pscmap service.
(t1_cmap_unicode_done): Updated.

* src/psaux/t1cmap.h (T1_CMapUniPair): Removed.
(T1_CMapUnicode): Use PS_Unicodes structure.
2006-01-11 10:08:49 +00:00
Suzuki, Toshiya (鈴木俊哉) f8d16cc540 * Fix 'deprecated' warnings in building for MacOS 2006-01-11 09:28:38 +00:00
Werner Lemberg 6cdab92b59 * docs/CHANGES: Updated.
* include/freetype/ftmodapi.h (FT_Module_Get_Flags): New
declaration.

* src/base/ftobjs.c (FT_Module_Get_Flags): New function.
2006-01-08 22:34:01 +00:00
Werner Lemberg 30bd284447 * src/base/ftutil.c (ft_highpow2): s/FT_BASE/FT_BASE_DEF/.
Reported by Niels Boldt <nielsboldt@gmail.com>.
2006-01-08 19:38:42 +00:00
Werner Lemberg e8f92af3f0 * src/pcf/pcfread.c (pcf_get_bitmaps): Remove unused variable
`bitmaps'.  From Yu Lei <yulei0@gmail.com>.
2006-01-08 13:43:30 +00:00
Werner Lemberg 05cda08bcb Fix ChangeLog. 2006-01-08 13:37:15 +00:00
Suzuki, Toshiya (鈴木俊哉) 3dfcef690d add '\n' to the end of src/sfnt/ttbdf.c 2005-12-28 06:47:12 +00:00
Werner Lemberg 748b171dd7 Doc typos. From Huw Davies. 2005-12-25 09:15:09 +00:00
Werner Lemberg 083ba0b7bc Formatting, documentation improvements. 2005-12-23 15:10:54 +00:00
David Turner e6bb95336a * Jamfile, docs/reference/README: fix it so that "jam refdoc" works
correctly to generate the API reference in 'docs/reference'

	* src/tools/docmaker/tohtml.py: update to output nicer fields lists
	in the API reference

	* src/base/ftobjs.c (FT_Load_Glyph): FT_LOAD_TARGET_LIGHT now
	forces auto-hinting

	* freetype/freetype.h: updating the documentation for
	FT_LOAD_TARGET_XXX and FT_Render_Mode values
2005-12-23 13:32:06 +00:00
Suzuki, Toshiya (鈴木俊哉) 53be6e9b1b ftmac.c counts supported faces only 2005-12-23 12:22:46 +00:00
Werner Lemberg b79b513380 Formatting, improving comments. 2005-12-20 12:01:58 +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
Wu, Chia-I (吳佳一) dcb8b7103f * include/freetype/internal/ftobjs.h (ft_glyphslot_grid_fit_metrics),
src/base/ftobjs.c (ft_glyphslot_grid_fit_metrics): Removed.

* src/base/ftobjs.c (ft_recompute_scaled_metrics): Do not round.

* src/cff/cffgload.c (cff_slot_load), src/cid/cidgload.c
(cid_slot_load_glyph), src/truetype/ttgload.c (compute_glyph_metrics),
src/type1/t1gload.c (T1_Load_Glyph): Do not round glyph metrics.

* doc/CHANGES: Mention the changes.
2005-12-16 14:27:14 +00:00
David Turner db0182f056 small update 2005-12-14 21:16:33 +00:00
David Turner 89a2a4b531 * include/freetype/config/ftoption.h,
include/freetype/config/ftstdlib.h,
        include/freetype/internal/tttypes.h,
        src/sfnt/Jamfile, src/sfnt/rules.mk, src/sfnt/sfdriver.c,
        src/sfnt/ttbdf.h, src/sfnt/ttbdf.c, src/sfnt/sfobjs.c:

        Added support for an embedded 'BDF ' table within SFNT-based
        bitmap font files. This is used to store atoms & properties from
        the original BDF fonts that were used to generate the font file.

        the feature is controled by TT_CONFIG_OPTION_BDF within 'ftoption.h'
        and is used to implement FT_Get_BDF_Property for these font files.

        At the moment, this is still experimental, the BDF table format isn't
        cast into stone yet.
2005-12-14 20:38:15 +00:00
David Turner 8def3c897f * Jamfile: small fix to ensure that ftexport.sym is placed in the
same location than other generated objects (i.e. within the 'objs'
        directory of the current dir)
2005-12-14 16:38:31 +00:00
David Turner 5b5f382b7d * src/autofit/aflatin.c, src/autofit/afhints.c: changed the
implementation of the LIGHT hinting mode to completely disable
        horizontal hinting. This is an experimental effort to integrate
        David Chester's latest patch without fucking the other hinting
        modes as well.

        Note that this doesn't force auto-hinting for all fonts however.
2005-12-14 16:37:15 +00:00
Werner Lemberg 0779163ef9 Add missing files. 2005-12-12 07:40:58 +00:00
Werner Lemberg 364db0826b * src/sfnt/sfobjc.c (sfnt_init_face): Move tag check to...
* src/sfnt/ttload.c (sfnt_init): Here, before handling TTCs.
2005-12-07 20:34:11 +00:00
Werner Lemberg 3b8db66941 Fix ChangeLog and source code comment. 2005-12-06 10:47:44 +00:00
Wu, Chia-I (吳佳一) a3690cdadd * src/truetype/ttobjs.c (tt_size_init): size->ttmetrics.valid is
initialized twice.
size->strike_index is not initialized.
2005-12-06 08:24:01 +00:00
Werner Lemberg a10a9f91f7 Fix source code comment. 2005-12-04 12:48:57 +00:00
Werner Lemberg 2a0903a54b * src/type42/t42objs.x (T42_Face_Init): Replace call to
FT_New_Memory_Face with call to FT_Open_Face to pass `params'.
2005-12-03 08:13:43 +00:00
Werner Lemberg 21a7d84448 Minor doc update. 2005-11-30 21:05:32 +00:00
Werner Lemberg 44e47d5fd6 * src/sfnt/ttcmap.c, src/sfnt/ttcmap.h:
s/TT_CMAP_FLAG_OVERLAPPED/TT_CMAP_FLAG_OVERLAPPING/.
2005-11-30 18:47:49 +00:00
Werner Lemberg b5d88e8e0c * docs/CHANGES: Document latest charmap code changes. 2005-11-30 08:55:51 +00:00
Werner Lemberg b797fdb513 * docs/CHANGES: Document ftdump's `-v' option. 2005-11-30 08:48:32 +00:00
Wu, Chia-I (吳佳一) a28bc4c71d * src/sfnt/ttcmap.c (tt_cmap4_char_map_binary,
tt_cmap12_char_map_binary): Fix compiler warnings.
2005-11-30 02:39:10 +00:00
Wu, Chia-I (吳佳一) a0911343ee Major update to distinguish between unsorted and overlapped segments
for cmap format 4.  For overlapped but sorted segments, which is
previously considered unsorted, we still use binary search.

* src/sfnt/ttcmap.h (struct  TT_CMapRec_): Replace `unsorted' by
`flags'.
(TT_CMAP_FLAG_UNSORTED, TT_CMAP_FLAG_OVERLAPPED): New macros.

* src/sfnt/ttcmap.c (OPT_CMAP4): Removed as it is always defined.
(struct TT_CMap4Rec_): Remove `old_charcode' and `table_length'.
(tt_cmap4_reset): Removed.
(tt_cmap4_init): Updated accordingly.
(tt_cmap4_next): Updated accordingly.
Take care of overlapped segments.
(tt_cmap4_validate): Make sure the subtable is large enough.
Do not check glyph_ids because some fonts set the length wrongly.
Also, when all segments have offset 0, glyph_ids is always invalid. It
does not cause any problem so far only because the check misses
equality.
Distinguish between unsorted and overlapped segments.
(tt_cmap4_char_map_linear, tt_cmap4_char_map_binary): New functions to
do "charcode => glyph index" by linear/binary search.
(tt_cmap4_char_index, tt_cmap4_char_next): Use
tt_cmap4_char_map_linear and tt_cmap4_char_map_binary.
(tt_face_build_cmaps): Treat the return value of validator as flags
for cmap.
2005-11-29 11:32:53 +00:00
Wu, Chia-I (吳佳一) 569ec4ee2a * src/sfnt/ttcmap.c (struct TT_CMap12Rec_, tt_cmap12_init,
tt_cmap12_next): New struct/function for fast "next char".
(tt_cmap12_char_map_binary): New function to do "charcode => glyph
index" by binary search.
(tt_cmap12_char_index, tt_cmap12_char_next): Use
tt_cmap12_char_map_binary.
(tt_face_build_cmaps): Check table and offset correctly (equality is
missing).
2005-11-29 11:27:51 +00:00
Detlef Würkner df1598e316 2005-11-15 Detlef Wrkner <TetiSoft@apg.lahn.de>
* builds/amiga/smakefile: Adjusted the compiler options
	to the current sources, now really builds the gxvalid, gzip
	and psnames modules.

	* builds/amiga/src/base/ftsystem.c: The assumed Seek() position
	in the file cache was off by one byte which could cause false
	errors in font files.
2005-11-25 08:04:09 +00:00
Detlef Würkner 6e0d20bbbd Adjusted the compiler options to the current sources. 2005-11-25 08:02:57 +00:00
Detlef Würkner ba0893c915 The assumed Seek() position in the file cache was off by one byte. 2005-11-25 08:01:54 +00:00
Suzuki, Toshiya (鈴木俊哉) 6b1c597cba MPW makefiles are updated to build all available modules 2005-11-24 05:16:57 +00:00
Werner Lemberg c815f33b85 Add some references. 2005-11-22 09:37:04 +00:00
Werner Lemberg 67ba21189a * src/bdf/bdfdrivr.c (bdf_interpret_style, BDF_Face_Done): Fix small
memory leak.
2005-11-21 17:32:03 +00:00
Werner Lemberg 840232ad2c * src/sfnt/ttload.c (sfnt_init): Add tracing message. 2005-11-21 12:36:42 +00:00
Wu, Chia-I (吳佳一) 275be9ba6d * src/sfnt/ttsbit0.c (tt_sbit_decoder_load_image): image_offset is
added to image_start twice when image_format is 2 or 5.
2005-11-21 03:05:34 +00:00
Wu, Chia-I (吳佳一) d81947e429 * src/sfnt/sfobjs.c (sfnt_init_face): Check that format_tag is known
before loading the table directory.

* src/sfnt/ttload.c (tt_face_load_sfnt_header,
tt_face_load_directory): Delay sfnt_dir_check from
tt_face_load_sfnt_header to tt_face_load_directory.
2005-11-21 03:04:03 +00:00
Wu, Chia-I (吳佳一) 6f1eca0460 * src/sfnt/ttload.c (sfnt_dir_check): Clean up and return correct
error code.
(sfnt_init): New function to fill in face->ttc_header.  A non-TTC font
is synthesized into a TTC font with one offset table.
(tt_face_load_sfnt_header): Use sfnt_init.
Fix an invalid access when the font is TTC and face_index is -1.
2005-11-20 08:24:24 +00:00
Werner Lemberg 6c99045972 * src/sfnt/ttload.c (tt_face_load_metrics): Ignore excess number
of metrics instead of aborting.  Patch suggested by Derek Noonburg.

* src/cff/cffgload.c (cff_slot_load), src/cid/cidgload.c
(cid_slot_load_glyph), src/type1/t1gload.c (T1_Load_Glyph): Scale
the glyph properly if no hinter is available.

* docs/CHANGES: Mention scaling bug.
2005-11-18 21:10:59 +00:00
Werner Lemberg 1a293d6c73 * src/sfnt/ttload.c (tt_face_load_metrics): Ignore excess number
of metrics instead of aborting.  Patch suggested by Derek Noonburg.
2005-11-18 08:23:06 +00:00
Suzuki, Toshiya (鈴木俊哉) 8d81d41ae3 add FT_TrueTypeGX_Free() etc to free the buffers allocated by gxvalid, otvalid 2005-11-18 07:47:06 +00:00
Wu, Chia-I (吳佳一) cb18238109 * builds/unix/ftsystem.c (FT_Stream_Open, FT_New_Memory,
FT_Done_Memory), builds/vms/ftsystem.c (FT_Stream_Open, FT_New_Memory,
FT_Done_Memory), builds/win32/ftdebug.c (FT_Message, FT_Panic):
s/FT_EXPORT/FT_BASE/.
2005-11-18 04:29:31 +00:00
Werner Lemberg 2400ff2be6 typo 2005-11-17 21:32:41 +00:00
Detlef Würkner 0acfc1f833 2005-11-17 Detlef Wrkner <TetiSoft@apg.lahn.de>
* builds/amiga/src/base/ftdebug.c (FT_Trace_Get_Count,
	FT_Trace_Get_Name, FT_Message, FT_Panic),
	builds/amiga/src/base/ftsystem.c (FT_New_Memory, FT_Done_Memory,
	FT_Stream_Open): s/FT_EXPORT/FT_BASE/.
2005-11-17 16:54:54 +00:00
Detlef Würkner 5d021d6996 s/FT_EXPORT/FT_BASE/. 2005-11-17 16:28:41 +00:00
Detlef Würkner 4859ac4add Add ChangeLog entry. 2005-11-17 14:21:07 +00:00
Detlef Würkner c280d868de Added support for gxvalid module. 2005-11-17 14:19:30 +00:00
Werner Lemberg cfc0cf2e78 Add vertical metrics support to OpenType CFF outlines. Based on a
patch from Mike Moening <MikeM@RetekSolutions.com>

* src/cff/cffgload.c (cff_face_get_vertical_metrics): New function.
(cff_slot_load): Use cff_face_get_vertical_metrics.

* docs/CHANGES: Updated.
2005-11-17 08:12:00 +00:00
Wu, Chia-I (吳佳一) 35bfc0f1b9 * src/base/ftcalc.c (FT_MulTo64): Commented out.
* include/freetype/internal/ftcalc.h (FT_SqrtFixed), src/base/ftcalc.c
(FT_SqrtFixed), include/freetype/internal/ftdebug.h
(FT_Trace_Get_Count, FT_Trace_Get_Name, FT_Message, FT_Panic),
src/base/ftdebug.c (FT_Trace_Get_Count, FT_Trace_Get_Name, FT_Message,
FT_Panic), include/freetype/internal/ftobjs.h (FT_New_Memory,
FT_Done_Memory), include/freetype/internal/ftstream.h
(FT_Stream_Open), src/base/ftsystem.c (FT_New_Memory, FT_Done_Memory,
FT_Stream_Open): s/FT_EXPORT/FT_BASE/.

* builds/exports.mk: Manually add TT_New_Context to EXPORTS_LIST too.
2005-11-17 01:53:07 +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
Werner Lemberg d829ff768b * src/cache/ftccache.c (FTC_Cache_Clear), src/cache/ftcmanag.c
(FTC_Manager_Check): Remove FT_EXPORT_DEF tag.

* src/base/ftcalc.c (FT_Add64): Remove FT_EXPORT_DEF tag.
(FT_Div64by32, FT_Sqrt32): Commented out.  Unused.

* include/freetype/internal/ftcalc.h (SQRT_32): Removed.  Unused.
(FT_Sqrt32): Commented out.  Unused.

* include/freetype/cache/ftccache.h:
s/ftc_node_destroy/FTC_Node_Destroy/.

* src/cache/ftccback.h (ftc_node_destroy): New declaration.

* src/cache/ftccache.c (ftc_node_destroy): Use FT_LOCAL_DEF tag.
(FTC_Node_Destroy): New exported wrapper function for
ftc_node_destroy.

* src/cache/ftcmanag.c: Include ftccback.c.
2005-11-12 17:07:11 +00:00
Werner Lemberg cee37a3b0a Clean-up. 2005-11-12 07:34:40 +00:00
Werner Lemberg f2c5330a86 * builds/exports.mk ($(EXPORTS_LIST)): Add TT_RunIns. 2005-11-11 16:20:59 +00:00
Werner Lemberg 21ed634e8e Add copyright.
Clean-up.
2005-11-11 15:59:33 +00:00
Werner Lemberg 4309edccfd * src/autofit/afangles.c, src/autofit/aftypes.h (af_angle_diff):
Comment out.  Unused.


* builds/beos/beos.mk: Call beos-def.mk before anything else to
define the separator.

* builds/unix/unix-cc.in (LINK_LIBRARY): Add `-no-undefined' flag.
2005-11-11 15:49:14 +00:00
Werner Lemberg ea4c3dc485 * src/type1/t1afm.c (T1_Read_PFM): Zero offset means `no kerning
table available'.  From Sergey Tolstov <stolstov@esri.com>.
2005-11-08 09:10:16 +00:00
David Turner 96508b74b4 updating ChangeLog 2005-11-04 16:10:28 +00:00
Werner Lemberg 319c8b339b Improve documentation. From Ville Syrjl <syrjala@sci.fi>. 2005-11-04 11:33:32 +00:00
Werner Lemberg b2d025306e * src/base/ftobjs.c (FT_Open_Face): Avoid possible memory leak.
Make compiling instructions in docs/CUSTOMIZE work again.

* builds/unix/unix-cc.in (CPPFLAGS): New variable.
(CFLAGS): Don't include @CPPFLAGS@.
* builds/freetype.mk (FT_CFLAGS): Add CPPFLAGS.
2005-11-04 06:58:49 +00:00
David Turner dab2454635 updating ChangeLog with commits from 2005-10-28 2005-11-02 09:24:00 +00:00
David Turner c1aef3fccb adding missing file - oops 2005-10-28 19:24:11 +00:00
David Turner 9fbd2ab884 - various performance enhancements
- fixing apinames.c, adding support for Watcom and Borland compilers
- adding generation of exported symbols list to the build system, including the Unix one !!

sorry Werner, I have no time to document this in ChangeLog at the moment
2005-10-28 16:14:14 +00:00
Suzuki, Toshiya (鈴木俊哉) 69d45172b6 update files for classic MacOS support 2005-10-28 16:03:06 +00:00
Suzuki, Toshiya (鈴木俊哉) 4511576ba7 fix invalid cast from NULL to integer typed variables 2005-10-28 15:39:58 +00:00
Werner Lemberg 4b5661c386 * include/freetype/ftsysmem.h, include/freetype/ftsysio.h: Removed.
Obsolete.

Cleaning up comments to avoid a mix-up of old and new style.
2005-10-27 21:28:35 +00:00
Werner Lemberg 9d3de385a6 Fix comment style. 2005-10-26 20:08:45 +00:00
Werner Lemberg 43b057b637 * src/sfnt/sfdriver.c (sfnt_interface): Move out
`tt_face_get_kerning' from a #ifdef clause.  Reported by Tony J.
Ibbs <tibs@sj.co.uk>.
2005-10-26 18:37:40 +00:00
Werner Lemberg c57023a4c8 typo 2005-10-24 20:51:13 +00:00
Werner Lemberg 6c0e734f26 * src/base/ftdbgmem.c (ft_mem_debug_realloc): Make it compile with
C++.
2005-10-23 19:31:01 +00:00
Werner Lemberg 84cacd2391 formatting, comment clean-up 2005-10-23 19:25:41 +00:00
Werner Lemberg f50c73dd65 whitespace 2005-10-22 10:43:12 +00:00
Werner Lemberg 90968f7531 Fix ChangeLog. 2005-10-22 10:34:45 +00:00
David Turner 398d64c0cc * src/base/ftdbgmem.c: another realloc memory counting bug fix
* src/tools/Jamfile: adding missing file

  * src/lzw/Jamfile: fixing incorrect source file reference
2005-10-21 10:01:25 +00:00
Werner Lemberg 560d5fed38 Minor cleanups.
Copyright issues.
2005-10-21 09:08:28 +00:00
David Turner c1b6d08291 * src/base/ftdbgmem.c: fixes to better account for memory reallocations
* src/lzw/ftlzw2.c, src/lzw/ftzopen.h, src/lzw/ftzopen.c, src/lzw/rules.mk:
    first version of LZW loader re-implementation. Apparently, saves about
    260 KB of heap memory when loading tir24.pcf.Z
2005-10-20 15:33:34 +00:00
Wu, Chia-I (吳佳一) 7e30776ee8 * include/freetype/ftbitmap.h (FT_Bitmap_Copy, FT_Bitmap_Embolden),
src/base/ftbdf.c (FT_Get_BDF_Property), src/cache/ftcmru.c
(FTC_MruList_Reset, FTC_MruList_Done, FTC_MruList_Lookup): Misuse of
FT_EXPORT/FT_EXPORT_DEF.
2005-10-20 02:13:46 +00:00
Wu, Chia-I (吳佳一) 2293bb15c2 * src/truetype/ttgload.c (TT_Load_Glyph): Allow size->ttmetrics to be
invalid when FT_LOAD_NO_SCALE is set.
2005-10-19 08:07:38 +00:00
Werner Lemberg 8e6c56f99e Formatting, CR/LF issues. 2005-10-18 06:09:13 +00:00
Werner Lemberg 6d24acb9a5 whitespace 2005-10-18 05:59:30 +00:00
David Turner 92f30c812c * src/base/ftobjs.c (FT_Open_Face): don't call FT_New_GlyphSlot and
FT_New_Size if we're opening a face with face_index < 0 (which is only
  used for testing the format).

  * src/gxvalid/gxvmort0.c: removed compiler warning
2005-10-17 21:17:20 +00:00
David Turner 6c5299e44f * src/tools/apinames.c: adding new tool to extract public API
function names from header files
2005-10-16 08:29:12 +00:00
Werner Lemberg d7e08f7745 Fix ChangeLog. 2005-10-15 22:40:25 +00:00
Werner Lemberg 2b428d5787 minor cleanup 2005-10-15 05:49:31 +00:00
David Turner d23b7b5141 file ftcint.h was initially added on branch CACHE. 2005-10-13 14:30:56 +00:00
Werner Lemberg 4d7447b466 Mention multi-threading. 2005-10-12 05:56:01 +00:00
Werner Lemberg 7734a1f720 Add FT_FACE_FLAG_HINTER to indicate that a specific font driver has
a hinting engine of its own.

* include/freetype/freetype.h (FT_FACE_FLAG_HINTER): New macro.

* src/cff/cffobjs.c (cff_face_init), src/cid/cidobjs.c
(cid_face_init), src/truetype/ttobjs.c (tt_face_init)
[TT_CONFIG_OPTION_BYTECODE_INTERPRETER], src/type1/t1objs.c
(T1_Face_Init), src/type42/t42objs.c (T42_Face_Init)
[TT_CONFIG_OPTION_BYTECODE_INTERPRETER]: Update face flags.

* docs/CHANGES: Document it.
2005-10-05 15:18:29 +00:00
Werner Lemberg 613ea86674 Grammatical fixes (this is, removing future tense in most cases).
Other minor documentation improvements.
2005-10-05 10:21:58 +00:00
Werner Lemberg 7c25946f08 Formatting. 2005-09-28 07:34:45 +00:00
Werner Lemberg d6e8b3315c * builds/unix/freetype2.m4: Add license exception so that the file
can be used in any other autoconf script.
2005-09-28 06:49:13 +00:00
David Turner 2441513494 file ftrgb.h was initially added on branch RGB. 2005-09-27 16:34:29 +00:00
David Turner 61ce6979cf file rules.mk was initially added on branch RGB. 2005-09-27 16:25:29 +00:00
David Turner 743731afdc file ftrgb.c was initially added on branch RGB. 2005-09-27 16:25:29 +00:00
David Turner fae358aea8 file ftrgbgen.h was initially added on branch RGB. 2005-09-27 16:25:29 +00:00
David Turner 75a39a9044 file ftrgbgn2.h was initially added on branch RGB. 2005-09-27 16:25:29 +00:00
David Turner 98c3c78426 file Jamfile was initially added on branch RGB. 2005-09-27 16:25:29 +00:00
David Turner f582cf3f95 * src/autofit/aflatin.c (af_latin_compute_stem_width): fixed bad
computation of the "vertical" flag, causing ugly things in LCD mode
        and others.
2005-09-26 09:27:09 +00:00
David Turner 03ee7c82a3 * src/autofit/afangles.c (af_angle_atan): replaced CORDIC-based
implementation with one using lookup tables. This simple thing
        speeds glyph loading by 18% according to ftbench !
2005-09-23 14:14:15 +00:00
David Turner 18e44430ae * src/base/Jamfile: adding src/base/ftgxval.c
* src/gxvalid/gxvbsln.c, src/gxvalid/gxvcommn.c, src/gxvalid/gxvfeat.c,
        src/gxvalid/gxvjust.c, src/gxvalid/gxvkern.c, src/gxvalid/gxvlcar.c,
        src/gxvalid/gxvmort.c, src/gxvalid/gxvmort0.c, src/gxvalid/gxvmort1.c,
        src/gxvalid/gxvmort2.c, src/gxvalid/gxvmort4.c, src/gxvalid/gxvmort5.c,
        src/gxvalid/gxvmorx.c, src/gxvalid/gxvmorx0.c, src/gxvalid/gxvmorx1.c,
        src/gxvalid/gxvmorx2.c, src/gxvalid/gxvmorx5.c, src/gxvalid/gxvopbd.c,
        src/gxvalid/gxvprop.c, src/sfnt/sfdriver.c, src/truetype/ttgload.c:
          removing _many_ compiler warnings when compiling with Visual C++
          at maximum level (/W4)
2005-09-23 13:22:10 +00:00
David Turner 99ded0bed7 * src/autofit/aflatin.c (af_latin_hints_init): fixed a bug that
prevented internal hint mode bitflags from being computed correctly
2005-09-23 08:00:51 +00:00
Werner Lemberg b3feb80e02 * docs/CHANGES: Mention SING Glyphlet support.
Other minor doc fixes and CRLF issues.
2005-09-23 07:40:28 +00:00
David Turner ad20e6ba57 * src/base/Jamfile: fixing broken Jamfile 2005-09-22 20:37:51 +00:00
Werner Lemberg 8eacad6daa * freetype2/src/sfnt/ttload.c (sfnt_dir_check): Modified to allow a
font to have no `head' table if tables `SING' and `META' are
present; this is to support `SING Glyphlet'.

`SING Glyphlet' is an extension to OpenType developed by Adobe
primarily to facilitate adding supplemental glyphs to an OpenType
font (with emphasis on, but not necessariy limited to, gaiji to a
CJK font).  A SING Glyphlet Font is an OpenType font that contains
the outline(s), either in a `glyf' or `CFF' table, for a glyph;
`cmap', `BASE', and `GSUB' tables are present with the same format
and functionaliy as a regular OpenType font; there are no `name',
`head', `OS/2', and `post' tables; there are two new tables, `SING'
which contains details about the glyphlet, and `META' which contains
metadata.

Further information on the SING Glyphlet format can be found at:

  http://www.adobe.com/products/indesign/sing_gaiji.html

* freetype2/include/freetype/ttags.h (TTAG_SING, TTAG_META): New
macros for the OpenType tables `SING' and `META'.  These two tables
are used in SING Glyphlet Format fonts.
2005-09-19 07:07:11 +00:00
Werner Lemberg 7e25c688de * src/sfnt/sfobjs.c (sfnt_load_face): Reactivate code to set
FT_FACE_FLAG_KERNING which has been commented out erroneously.

* docs/CHANGES: Document it.
2005-09-09 18:00:06 +00:00
Werner Lemberg 99aa14c226 Fixes for `make multi' and using C++ compiler.
* gxvalid/gxvcommn.c (gxv_set_length_by_ushort_offset,
gxv_set_length_by_ulong_offset, gxv_array_getlimits_byte,
gxv_array_getlimits_ushort): Declare with FT_LOCAL_DEF.
(gxv_compare_ranges): Make it static.
(gxv_LookupTable_fmt0_validate, gxv_LookupTable_fmt2_validate,
gxv_LookupTable_fmt4_validate, gxv_LookupTable_fmt6_validate,
gxv_LookupTable_fmt8_validate, gxv_LookupTable_validate): Improve
trace messages.
(gxv_StateArray_validate, gxv_XStateArray_validate): s/class/clazz/.
(GXV_STATETABLE_HEADER_SIZE, GXV_STATEHEADER_SIZE,
GXV_XSTATETABLE_HEADER_SIZE, GXV_XSTATEHEADER_SIZE): Move to
gxvcommn.h.

* gxvalid/gxvcommn.h: Add prototypes for
gxv_StateTable_subtable_setup, gxv_XStateTable_subtable_setup,
gxv_XStateTable_validate, gxv_array_getlimits_byte,
gxv_array_getlimits_ushort, gxv_set_length_by_ushort_offset,
gxv_set_length_by_ulong_offset, gxv_odtect_add_range,
gxv_odtect_validate.
(GXV_STATETABLE_HEADER_SIZE, GXV_STATEHEADER_SIZE,
GXV_XSTATETABLE_HEADER_SIZE, GXV_XSTATEHEADER_SIZE): Moved from
gxvcommn.c.

* src/gxvalid/gxvbsln.c (gxv_bsln_LookupValue_validate,
gxv_bsln_parts_fmt1_validate): Improve trace messages.

* gxvalid/gxvfeat.c: Split off predefined registry stuff to...
* gxvalid/gxvfeat.h: New file.

* gxvalid/gxvjust.c (gxv_just_wdc_entry_validate): Improve trace
message.

* gxvalid/gxvkern.c (GXV_kern_Dialect): Add KERN_DIALECT_UNKNOWN.
(gxv_kern_subtable_fmt1_valueTable_load,
gxv_kern_subtable_fmt1_subtable_setup,
gxv_kern_subtable_fmt1_entry_validate): Fix C++ compiler errors.
(gxv_kern_coverage_validate): Use KERN_DIALECT_UNKWOWN.
Improve trace message.
(gxv_kern_validate_generic): Fix C++ compiler error.
Improve trace message.
(gxv_kern_validate_classic): Fix C++ compiler error.

* gxvalid/gxvmort0.c (gxv_mort_subtable_type0_validate): Declare
with FT_LOCAL_DEF.

* gxvalid/gxvmort1.c
(gxv_mort_subtable_type1_substitutionTable_load,
gxv_mort_subtable_type1_subtable_setup): Fix C++ compiler errors.
(gxv_mort_subtable_type1_substTable_validate): Improve trace
message.
(gxv_mort_subtable_type1_validate): Declare with FT_LOCAL_DEF.

* gxvalid/gxvmort2.c (gxv_mort_subtable_type2_opttable_load,
gxv_mort_subtable_type2_subtable_setup,
gxv_mort_subtable_type2_ligActionOffset_validate,
gxv_mort_subtable_type2_ligatureTable_validate): Fix C++ compiler
errors.
(gxv_mort_subtable_type2_validate): Declare with FT_LOCAL_DEF.

* gxvalid/gxvmort4.c (gxv_mort_subtable_type4_validate): Declare
with FT_LOCAL_DEF.

* gxvalid/gxvmort5.c (gxv_mort_subtable_type5_subtable_setup,
gxv_mort_subtable_type5_InsertList_validate): Fix C++ compiler
errors.
(gxv_mort_subtable_type5_validate): Declare with FT_LOCAL_DEF.

* gxvalid/gxvmort.c: Include gxvfeat.h.
(gxv_mort_featurearray_validate, gxv_mort_coverage_validate):
Declare with FT_LOCAL_DEF.
(gxv_mort_subtables_validate, gxv_mort_validate): Improve trace
messages.

* gxvalid/gxvmort.h (gxv_mort_feature_validate): Remove.

* gxvalid/gxvmorx0.c (gxv_morx_subtable_type0_validate): Declare
with FT_LOCAL_DEF.

* gxvalid/gxvmorx1.c
(gxv_morx_subtable_type1_substitutionTable_load,
gxv_morx_subtable_type1_subtable_setup,
gxv_morx_subtable_type1_entry_validate,
gxv_morx_subtable_type1_substitutionTable_validate): Fix C++
compiler errors.
(gxv_morx_subtable_type1_validate): Declare with FT_LOCAL_DEF.

* gxvalid/gxvmorx2.c (gxv_morx_subtable_type2_opttable_load,
gxv_morx_subtable_type2_subtable_setup,
gxv_morx_subtable_type2_ligActionIndex_validate,
gxv_morx_subtable_type2_ligatureTable_validate): Fix C++ compiler
errors.
(gxv_morx_subtable_type2_validate): Declare with FT_LOCAL_DEF.
Fix typo.

* gxvalid/gxvmorx4.c (gxv_morx_subtable_type4_validate): Declare
with FT_LOCAL_DEF.

* gxvalid/gxvmorx5.c (gxv_morx_subtable_type5_insertionGlyph_load,
gxv_morx_subtable_type5_subtable_setup): Fix C++ compiler error.
(gxv_morx_subtable_type5_validate): Declare with FT_LOCAL_DEF.

* gxvalid/gxvmorx.c (gxv_morx_subtables_validate,
gxv_morx_validate): Improve trace message.

* gxvalid/gxvopbd.c (gxv_opbd_LookupFmt4_transit): Fix compiler
warnings.
(gxv_opbd_validate): Improve trace message.

* gxvalid/gxvprop.c: Decorate constants with `U' and `L' where
appropriate.
(gxv_prop_zero_advance_validate, gxv_prop_validate): Improve trace
message.

* gxvalid/gxvtrak.c (gxv_trak_trackTable_validate): Remove unused
parameter.  Update all callers.
(gxv_trak_validate): Improve trace message.

* rules.mk (GXV_DRV_H): Add gxvfeat.h.
2005-09-05 19:31:27 +00:00
Werner Lemberg 4a7f0b1c7a * src/gxvalid/gxvbsln.c (GXV_BSLN_VALUE_EMPTY): Add `U'.
* src/gxvalid/gxmort1.c (GXV_MORT_SUBTABLE_TYPE1_HEADER_SIZE),
src/gxvalid/gxmort2.c (GXV_MORT_SUBTABLE_TYPE2_HEADER_SIZE): Fix
typo.

* src/gxvalid/gxvmorx0.c, src/gxvalid/gxvmorx1.c,
src/gxvalid/gxvmorx2.c, src/gxvalid/gxvmorx4.c,
src/gxvalid/gxvmorx5.c, src/gxvalid/gxvmort.c: Improve tracing
messages.
Decorate constants with `U' and `L' where appropriate.
Fix compiler warnings.

Formatting.
2005-09-01 07:33:03 +00:00
Werner Lemberg a4aa1c5bee * src/gxvalid/gxvbsln.c (gxv_bsln_validate): Fix tracing message.
* src/gxvalid/gxvcommn.c (gxv_odtect_add_range): Use `const'.

* src/gxvalid/gxvfeat.c, src/gxvalid/gxvjust.c,
src/gxvalid/gxvkern.c, src/gxvalid/gxvlcar.c, src/gxvalid/gxvmod.c,
src/gxvalid/gxvmort0.c, src/gxvalid/gxvmort1.c,
src/gxvalid/gxvmort2.c, src/gxvalid/gxvmort4.c,
src/gxvalid/gxvmort5.c, src/gxvalid/gxvmort.c: Improve tracing
messages.
Decorate constants with `U' and `L' where appropriate.
Fix compiler warnings.
2005-08-31 22:39:23 +00:00
Werner Lemberg eff1ee3bd3 * src/truetype/ttgload.c (load_truetype_glyph): Fix typo. 2005-08-31 20:40:00 +00:00
Werner Lemberg 9b71edb0de * src/gxvalid/gxvbsln.c: Fix compiler warnings.
* src/gxvalid/gxvcommn.c: Fix compiler warnings.
(gxv_XEntryTable_validate, gxv_compare_ranges): Remove unused
parameter.  Update all callers.
Improve tracing messages.

Some formatting.
2005-08-31 16:29:51 +00:00
Werner Lemberg 4814030bf6 * src/gxvalid/README: Revised. 2005-08-31 07:13:27 +00:00
Werner Lemberg a723526ae7 * include/freetype/freetype.h, include/freetype/ftchapters.h: Add
a preliminary section with some explanations about user allocation.

* src/tools/docmaker/tohtml.py (HtmlFormatter.section_enter):
Don't abort if there are no data types, functions, etc., in a
section.
Print synopsis only if we have a data type, function, etc.

* docs/INSTALL.ANY, docs/INSTALL, docs/INSTALL.UNX, docs/CUSTOMIZE,
docs/INSTALL.GNU, docs/TRUETYPE, docs/DEBUG, docs/UPGRADE.UNX,
docs/VERSION.DLL, docs/formats.txt: Revised, formatted.
2005-08-30 00:22:46 +00:00
Werner Lemberg 3bfb1c08c1 * src/truetype/ttgload.c [TT_MAX_COMPOSITE_RECURSE]: Removed.
(load_truetype_glyph): Limit recursion depth by `maxComponentDepth'.
2005-08-29 11:59:18 +00:00
Werner Lemberg b82e773b34 * builds/unix/freetype2.in (CFlags): Add missing directory. 2005-08-26 05:50:27 +00:00
Werner Lemberg 169a6d8a04 * docs/CHANGES: Mention gxvalid module.
Formatting and other minor changes.
2005-08-25 06:00:55 +00:00
Werner Lemberg 55b0908ef5 * src/autofit/aflatin.c (af_latin_metrics_scale): Initialize
render mode properly.  Reported by chris@dokein.co.uk.
2005-08-24 08:04:56 +00:00
Suzuki, Toshiya (鈴木俊哉) a438621451 Add gxvalid module to validate TrueType GX/AAT tables.
Modifications on existing files:

	* Jamfile: Register gxvalid module.
	* src/base/Jamfile: Register ftgxval.c.
	* src/base/rule.mk: Register ftgxval.c.
	* docs/INSTALL.ANY: Register gxvalid/gxvalid.c.

	* include/freetype/config/ftheader.h: Add macro to include gxvalid
	header file, FT_GX_VALIDATE_H.
	* include/freetype/config/ftmodule.h: Register gxv_module_class.

	* include/freetype/ftchapters.h: Add comment about gx_validation.
	* include/freetype/ftotval.h: Change keyword FT_VALIDATE_XXX
	to FT_VALIDATE_OTXXX to co-exist gxvalid.
	* include/freetype/tttags.h: Add tag for TrueType GX/AAT tables.

	* include/freetype/internal/ftserv.h: Add macro to use gxvalid
	service, FT_SERVICE_GX_VALIDATE_H
	* include/freetype/internal/fttrace.h: Add trace facilities
	for gxvalid.

	New files on existing directories:

	* include/freetype/internal/services/svgxval.h: Registration of
	validation service for TrueType GX/AAT and classic kern table.
	* include/freetype/ftgxval.h: Public API definition to use gxvalid.
	* src/base/ftgxval.c: Public API of gxvalid.

	New files under src/gxvalid/:

	* src/gxvalid/Jamfile src/gxvalid/README src/gxvalid/module.mk
	src/gxvalid/rules.mk src/gxvalid/gxvalid.c src/gxvalid/gxvalid.h
	src/gxvalid/gxvbsln.c src/gxvalid/gxvcommn.c src/gxvalid/gxvcommn.h
	src/gxvalid/gxverror.h src/gxvalid/gxvfeat.c src/gxvalid/gxvfgen.c
	src/gxvalid/gxvjust.c src/gxvalid/gxvkern.c src/gxvalid/gxvlcar.c
	src/gxvalid/gxvmod.c src/gxvalid/gxvmod.h src/gxvalid/gxvmort.c
	src/gxvalid/gxvmort.h src/gxvalid/gxvmort0.c src/gxvalid/gxvmort1.c
	src/gxvalid/gxvmort2.c src/gxvalid/gxvmort4.c src/gxvalid/gxvmort5.c
	src/gxvalid/gxvmorx.c src/gxvalid/gxvmorx.h src/gxvalid/gxvmorx0.c
	src/gxvalid/gxvmorx1.c src/gxvalid/gxvmorx2.c src/gxvalid/gxvmorx4.c
	src/gxvalid/gxvmorx5.c src/gxvalid/gxvopbd.c src/gxvalid/gxvprop.c
	src/gxvalid/gxvtrak.c: New files, gxvalid body.
2005-08-24 04:31:31 +00:00
Werner Lemberg 2752bd1a46 * src/truetype/ttgload.c (TT_Load_Glyph): Only translate outline
to (0,0) if bit 1 of the `head' table isn't set.  This improves
rendering of buggy fonts.
2005-08-22 07:11:31 +00:00
Wu, Chia-I (吳佳一) 15c1f5d36f * src/truetype/ttdriver.c (Load_Glyph): Don't check the validity of
ttmetrics here.  TrueType fonts with only sbits always have
ttmetrics.valid set to false.

* src/truetype/ttgload.c (TT_Load_Glyph): Check that ttmetrics is
valid before loading outline glyph.

* src/cache/ftcimage.c (FTC_INode_New): Fix a memory leak.
2005-08-20 08:17:44 +00:00
Werner Lemberg 3774b997b0 * src/sfnt/ttload.c (tt_face_load_metrics_header): Ignore missing
`hhea' table for SFNT Mac fonts.  Change based on a patch by
mpsuzuki@hiroshima-u.ac.jp.
2005-08-20 05:45:42 +00:00
Werner Lemberg 53ac64e39f * src/otvalid/otvmod.c (otv_validate): Use ft_validator_run instead
of ft_setjmp.
2005-08-20 05:33:09 +00:00
Werner Lemberg ffa033b1bc * src/truetype/ttgload.c (load_truetype_glyph): Fix compiler
warnings.

Formatting.
2005-08-19 08:56:29 +00:00
Werner Lemberg da245ee30a Forgot to check in last change. 2005-08-18 07:40:32 +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 f20a4d3527 * docs/INSTALL.ANY: Updated. 2005-08-10 13:24:51 +00:00
Werner Lemberg b2d65d75bd * src/sfnt/sfdriver.c (sfnt_interface) [FT_OPTIMIZE_MEMORY]:
Reactivate pointers to tt_find_sbit_image and tt_load_sbit_metrics
to make X work again.
2005-08-03 21:21:11 +00:00
Werner Lemberg 8e3fc5ea0c * src/otvalid/otvcommn.h: Remove dead code.
Formatting.
2005-08-03 21:17:53 +00:00
Wu, Chia-I (吳佳一) 89fff9b9d1 * src/truetype/ttobjs.h (tt_size_run_fpgm, tt_size_run_prep): New functions.
* src/truetype/ttobjs.c (tt_size_run_fpgm, tt_size_run_prep): New functions.
(tt_size_init): Add 4, instead of 2, (phantom) points to twilight zone.
Move code that runs fpgm to tt_size_run_fpgm.
(Reset_Outline_Size): Move code that runs prep to tt_size_run_prep.
(tt_glyphzone_new): Allocate right size of arrays.
Set max_points and max_contours properly.
2005-07-31 11:41:54 +00:00
Wu, Chia-I (吳佳一) 2a41ab9e88 * src/truetype/ttdriver.c (Set_Char_Sizes): Avoid unnecessary
computations and clean up.

* src/truetype/ttobjs.h (struct TT_SizeRec_): Comment on the
internal copy of metrics.
2005-07-26 08:14:03 +00:00
Werner Lemberg baed3dd044 Oops! Undo private change. 2005-07-13 06:58:13 +00:00
Werner Lemberg 07437dba17 * include/freetype/ftoutln.h (FT_Outline_Embolden): Fix prototype.
Reported by Xerxes.
2005-07-13 06:56:08 +00:00
Werner Lemberg 3500df4698 * include/freetype/internal/ftmemory.h (FT_REALLOC_ARRAY): Fix typo.
Reported by Brett Hutley.
2005-07-05 09:00:11 +00:00
David Turner c562162834 * src/sfnt/ftbitmap.c, src/truetype/ttgload.c, src/sfnt/ttcmap.c:
removing compiler warnings (Visual C++ /W4)

        * Jamfile, src/otvalid/{otvcommn.h,otvgdef.c,otvgpos.c,otvgsub.c,
        otvjstf.c}: modified the code to use a different pre-processor trick
        to implement the OTV_NEST1, OTV_NEST2 and OTV_NEST3 macros. The code
        now compiles neatly with Visual C++. The 'otvalid' module has been
        put in the Jamfile build again.
2005-06-30 11:46:46 +00:00
Werner Lemberg 7b33dca43c Formatting. 2005-06-23 20:31:48 +00:00
Wu, Chia-I (吳佳一) 87f9bfc4ea Add an entry about rewritten of `ftview' and `ftstring' 2005-06-22 03:56:14 +00:00
Wu, Chia-I (吳佳一) 8cfb220eb9 * include/freetype/internal/ftobjs.h, src/base/ftobjs.c: New function
ft_glyphslot_grid_fit_metrics.

* src/truetype/ttgload.c (compute_glyph_metrics): Use
ft_glyphslot_grid_fit_metrics.

* src/cff/cffgload.c (cff_slot_load), src/cid/cidgload.c
(cid_slot_load_glyph), src/type1/t1gload.c (T1_Load_Glyph): Use
ft_glyphslot_grid_fit_metrics.
FT_Outline_Get_CBox is called twice.

* src/base/ftsynth.c (FT_GlyphSlot_Embolden): Modify metrics to more
reasonable values when emboldening outline glyphs.  The theoretic
ones are unrealistic.
2005-06-20 09:04:50 +00:00
Werner Lemberg 49f4d34ed3 * src/base/ftoutln.c (FT_Outline_Embolden): Strength should be
halved.

* src/base/ftsynth.c (FT_GlyphSlot_Embolden): Change the default
strength.
Don't increase slot->advance.y.



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

* builds/unix/configure.ac (version_info): Set to 9:9:3.
Currently, we are still binary compatible.

* builds/win32/visualc/index.html,
builds/win32/visualc/freetype.dsp,
builds/win32/visualc/freetype.vcproj: s/219/2110/, s/2.1.9/2.1.10/.

* builds/freetype.mk (refdoc), README, Jamfile (RefDoc):
s/2.1.9/2.1.10/.

* docs/CHANGES, docs/VERSION.DLL: Updated.

* ChangeLog: Split off older entries into...
* ChangeLog.20, ChangeLog.21: These new files.



The next release will be 2.2.0, so don't worry about source code
backwards compatibility.

* include/freetype/ftimage.h (FT_Outline_MoveToFunc,
FT_Outline_LineToFunc, FT_Outline_ConicToFunc,
FT_Outline_CubicToFunc, FT_SpanFunc, FT_Raster_RenderFunc),
include/freetype/ftrender.h (FT_Glyph_TransformFunc,
FT_Renderer_RenderFunc, FT_Renderer_TransformFunc): Decorate
parameters with `const' where appropriate.



* src/sfnt/ttsbit.c (tt_face_load_sbit_image): Compute vertBearingY
to make glyphs centered vertically.

* src/truetype/ttgload.c (compute_glyph_metrics): Compute
vertBearingY to make glyphs centered vertically.
Fix some bugs in vertical metrics:

  . loader->pp3.y and loader->pp4.y are in 26.6 format, not in font
    units.
  . As we use the glyph's cbox to calculate the top bearing now
    there iss no need to adjust `top'.



* src/otvalid/otvcommn.h (OTV_OPTIONAL_TABLE): Use FT_UShort to be
in sync with OTV_OPTIONAL_OFFSET.  Reported by YAMATO Masatake.


* docs/release: Update.
2005-06-16 19:07:08 +00:00
Werner Lemberg 765cb0fa70 * Version 2.1.10 released.
==========================


* src/pcf/readme: Renamed to...
* src/pcf/README: This.
2005-06-08 12:54:15 +00:00
Werner Lemberg 288ce14303 * builds/amiga/*: Added copyright notes, reworked some comments. 2005-06-08 11:56:55 +00:00
Werner Lemberg 0f1c4fa7c6 Minor documentation fixes.
Include stuff created by autogensh. in .cvsignore.
2005-06-06 07:01:47 +00:00
Werner Lemberg 60a04df7b0 Add license. 2005-06-04 23:04:30 +00:00
Werner Lemberg 56c368c47e * Add copyright notices to all files which don't have one.
* docs/license.txt: Renamed to...
* docs/LICENSE.TXT: This.
* docs/FTL.txt: Renamed to...
* docs/FTL.TXT: This.
* docs/GPL.txt: Renamed to...
* docs/GPL.TXT: This.

* docs/PATENTS: Slightly reworded.  Suggested by Sylvain Beucler
<beuc@gnu.org>.
2005-06-04 23:00:25 +00:00
Werner Lemberg 255ce16e1d * include/freetype/ftimage.h (FT_Outline_MoveToFunc,
FT_Outline_LineToFunc, FT_Outline_ConicToFunc,
FT_Outline_CubicToFunc, FT_Raster_RenderFunc),
include/freetype/ftrender.h (FT_Glyph_TransformFunc,
FT_Renderer_RenderFunc, FT_Renderer_TransformFunc): Don't use
`const' to stay compatible with FreeType 2.1.9.
2005-06-04 05:27:18 +00:00
Werner Lemberg 192549559c typos. 2005-06-02 07:14:04 +00:00
Werner Lemberg 82b71922f9 Mention that the otvalid module might be moved to another library. 2005-06-02 07:12:05 +00:00
Werner Lemberg 3d7b1d5528 * src/base/ftstroke.c (ft_stroker_inside): Revert `sigma' patch from
2004-07-11; this gives much better results under normal
circumstances.
2005-06-01 15:30:44 +00:00
Werner Lemberg 38e82be157 * include/freetype/ftbitmap.h (FT_Bitmap_Embolden): Minor
documentation improvements.

* include/freetype/ftoutln.h (FT_Outline_Embolden): Fix typos.

* src/base/ftbitmap.c (FT_Bitmap_Embolden): Add support for bitmap
of pixel_mode FT_PIXEL_MODE_GRAY2 or FT_PIXEL_MODE_GRAY4.
If xstr is larger than 8 and bitmap is of pixel_mode
FT_PIXEL_MODE_MONO, set xstr to 8 instead of returning error.
2005-05-30 19:22:44 +00:00
Werner Lemberg 71d7628175 * src/base/ftbitmap.c (FT_Bitmap_Embolden): Fix emboldening bitmap
of mode FT_PIXEL_MODE_GRAY.  Also add support for mode
FT_PIXEL_MODE_LCD and FT_PIXEL_MODE_LCD_V.
(ft_bitmap_assure_buffer): FT_PIXEL_MODE_LCD and FT_PIXEL_MODE_LCD_V
should have ppb (pixel per byte) 1.
Zero the padding when there's no need to allocate memory.

* src/base/ftsynth.c (FT_GlyphSlot_Embolden): Handle slot->advance
too.
More suited emboldening strength.
2005-05-30 07:54:20 +00:00
Werner Lemberg 25500f8cca Add missing ChangeLog entry. 2005-05-30 07:50:39 +00:00
Werner Lemberg c162eac55c * src/base/ftbitmap.c (FT_Bitmap_Embolden): Handle negative pitch.
Handle FT_PIXEL_MODE_GRAY with num_gray != 256.
Improve speed for FT_PIXEL_MODE_GRAY.
(ft_bitmap_assure_buffer): Accept FT_PIXEL_MODE_LCD and
FT_PIXEL_MODE_LCD_V.
2005-05-28 21:52:37 +00:00
Werner Lemberg e70371c410 * src/base/ftobjs.c (ft_cmap_done_internal): New function.
(FT_CMap_Done): Remove cmap from cmap list.
(destroy_charmaps, FT_CMap_New): Don't call FT_CMap_Done but
ft_cmap_done_internal.
2005-05-27 06:01:28 +00:00
Werner Lemberg 3a36ef7e6e * src/base/ftsynth.c (FT_GlyphSlot_Embolden): Initialize `error'. 2005-05-27 04:18:20 +00:00
Werner Lemberg 6d8c18214e * docs/GPL.txt: Update postal address of FSF.
* include/freetype/ftbitmap.h (FT_Bitmap_Embolden): Improve
documentation.

* src/base/ftsynth.c (FT_BOLD_THRESHOLD): Removed.
(FT_GlyphSlot_Embolden): Check whether slot is bitmap owner.
Always modify the metrics.
2005-05-26 21:02:25 +00:00
Werner Lemberg afb2ba5756 * docs/CHANGES: Updated.
* include/freetype/ftbitmap.h (FT_Bitmap_Embolden): New declaration.

* include/freetype/ftoutln.h (FT_Outline_Embolden): New declaration.

* src/base/ftbitmap.c (ft_bitmap_assure_buffer): New auxiliary
function.
(FT_Bitmap_Embolden): New function.

* src/base/ftoutln.c (FT_Outline_Embolden): New function.

* src/base/ftsynth.c: Don't include FT_INTERNAL_CALC_H and
FT_TRIGONOMETRY_H but FT_BITMAP_H.
(FT_GlyphSlot_Embolden): Use FT_Outline_Embolden or
FT_Bitmap_Embolden.
2005-05-25 05:51:01 +00:00
Werner Lemberg b4119a933e * README.CVS: Mention file permissions. 2005-05-24 13:46:17 +00:00
Werner Lemberg 67d546a8a9 * configure: Always remove config.mk, builds/unix/unix-def.mk, and
builds/unix/unix-cc.mk.  This fixes repeated calls of the script.
Reported by Nelson Beebe and Behdad Esfahbod.
2005-05-24 04:49:42 +00:00
Werner Lemberg b8b8de80c6 Fix ChangeLog. 2005-05-23 21:34:17 +00:00
Werner Lemberg 92aa527a1c * builds/amiga/makefile.os4 (WARNINGS), builds/compiler/gcc-dev.mk
(CFLAGS), builds/compiler/gcc.mk (CFLAGS): Remove
-fno-strict-aliasing.


Say you have `(Foo*)x' and want to assign, pass, or return it as
`(Bar*)'.  If you simply say `x' or `(Bar*)x', then the C compiler
would warn you that type casting incompatible pointer types breaks
strict-aliasing.  The solution is to cast to `(void*)' instead which
is the generic pointer type, so the compiler knows that it should
make no strict-aliasing assumption on `x'.  But the problem with
`(void*)x' is that seems like in C++, unlike C, `void*' is not a
generic pointer type and assigning `void*' to `Bar*' without a cast
causes an error.  The solution is to cast to `Bar*' too, with
`(Bar*)(void*)x' as the result -- this is what the patch does.

* include/freetype/cache/ftccache.h (FTC_CACHE_LOOKUP_CMP),
include/freetype/cache/ftcmru.h (FTC_MRULIST_LOOKUP_CMP): Remove
cast on lvalue, use a temporary pointer instead.
Cast temporarily to (void*) to not break strict aliasing.

* include/freetype/internal/ftmemory.h (FT_MEM_ALLOC,
FT_MEM_REALLOC, FT_MEM_QALLOC, FT_MEM_QREALLOC, FT_MEM_FREE),
src/base/ftglyph.c (FT_Glyph_To_Bitmap): Cast temporarily to (void*)
to not break strict aliasing.

* src/base/ftinit.c (FT_USE_MODULE): Fix wrong type information.

* builds/unix/configure.ac (XX_CFLAGS): Remove -fno-strict-aliasing.

* src/sfnt/rules.mk (SFNT_DRV_SRC): Don't include ttsbit0.c --
it is currently loaded from ttsbit.c.


Other formatting.
2005-05-23 21:33:02 +00:00
David Turner f9e0559778 * include/freetype/cache/ftcache.h, src/cache/ftccache.c,
src/cache/ftcsbits.c: fixing bug #12213 (incorrect behaviour
    of the cache sub-system in low-memory conditions).
2005-05-23 13:04:53 +00:00
Werner Lemberg a4dbed30b2 * src/base/rules.mk (BASE_SRC): Don't add ftsynth.c here but...
(BASE_EXT_SRC): Here.
2005-05-23 12:01:39 +00:00
Werner Lemberg 8a62ea2517 * src/base/rules.mk (BASE_SRC): Add ftsynth.c. 2005-05-22 20:46:40 +00:00
Werner Lemberg e75c81a332 Fix ChangeLog. 2005-05-22 20:43:38 +00:00
Werner Lemberg f814f68231 * src/base/ftrfork.c (raccess_guess_apple_generic): Mark
`version_number' and `entry_length' as unused.
(raccess_guess_linux_double_from_file_name): Remove `memory'.
(raccess_make_file_name): Mark `error' as unused.

* src/bdf/bdflib.c (_bdf_parse_properties): Remove `memory'.

* src/cid/cidobjs.c (cid_face_init): Remove `psnames'.

* src/sfnt/sfobjs.c (sfnt_load_face): Remove `memory'.

* src/truetype/ttgxvar.c (ft_var_readpackedpoints,
ft_var_readpackeddeltas, ft_var_load_avar): Mark `error' as unused.
2005-05-22 20:33:09 +00:00
David Turner 01152db10a * src/base/ftsynth.c (FT_GlyphSlot_Embolden): fixing a bug that produced
unpleasant artefacts when trying to embolden very sharp corners.
2005-05-21 10:42:32 +00:00
Werner Lemberg b9ee7370f6 * docs/CHANGES: Updated.
* src/base/ftbitmap.c: Don't include FT_FREETYPE_H and FT_IMAGE_H
but FT_BITMAP_H.
(FT_Bitmap_Copy): New function (from ftglyph.c).

* include/freetype/ftbitmap.h (FT_Bitmap_Copy): New public
definition.

* src/base/ftglyph.c: Include FT_BITMAP_H.
(ft_bitmap_copy): Move to ftbitmap.c.
(ft_bitmap_glyph_init): Remove `memory' variable.
Create new bitmap object if FT_GLYPH_OWN_BITMAP isn't set.
(ft_bitmap_glyph_copy): Use FT_Bitmap_Copy.
(ft_bitmap_glyph_done): Use FT_Bitmap_Done.
(ft_outline_glyph_init): Use FT_Outline_Copy.

* src/base/ftoutln.c (FT_Outline_Copy): Handle source == target.
(FT_Outline_Done_Internal): Check for valid `memory' pointer.
(FT_Outline_Translate, FT_Outline_Reverse, FT_Outline_Render,
FT_Outline_Transform): Check for valid `outline' pointer.

* src/base/ftobjs.c (FT_New_GlyphSlot): Prepend glyph slot to
face->glyph, otherwise a new second glyph slot cannot be created.
(FT_Done_GlyphSlot): Fix memory leak.
(FT_Open_Face): Updated -- face->glyph is already managed by
FT_New_GlyphSlot.

* src/type42/t42objs.c (T42_GlyphSlot_Done): Updated.
2005-05-20 21:52:19 +00:00
Werner Lemberg 8ae1dceb94 * include/freetype/ftimage.h (FT_Raster_Params),
include/freetype/ftoutln.h (FT_Outline_Translate,
FT_Outline_Transform), src/base/ftoutln.c (FT_Outline_Translate,
FT_Outline_Transform): Decorate parameters with `const' where
appropriate.
Update all callers.

* src/raster/ftraster.c (ft_black_reset), src/smooth/ftgrays.c
(gray_raster_reset): Remove `const' from `pool_base' argument.
2005-05-20 06:22:20 +00:00
Werner Lemberg e623bfa8e2 typo 2005-05-19 13:51:26 +00:00
Werner Lemberg f9fccbee8b * src/raster/ftmisc.h: New file. Only needed if ftraster.c is
compiled as stand-alone.

* src/raster/ftraster.c: Add comment how to compile as stand-alone.
s/FT_CONFIG_OPTION_STATIC_RASTER/FT_STATIC_RASTER/.
s/TT_STATIC_RASTER/FT_STATIC_RASTER/.
[_STANDALONE_]: Include ftimage.h and ftmisc.h.
(FT_TRACE1, FT_TRACE6, ft_memset, FT_MEM_ZERO): Define
conditionally.
(Render_Glyph, Render_Gray_Glyph): Return Raster_Err_None (or
Raster_Err_Unsupported).
(ft_black_new) [_STANDALONE_]: Fix type of `the_raster'.
(ft_black_init, ft_black_reset, ft_black_set_mode, ft_black_render):
Use `ras', not `raster'.
(ft_black_done): Use FT_UNUSED_RASTER.
(Horizontal_Sweep_Init, Horizontal_Sweep_Step,
Horizontal_Gray_Sweep_Span): Use FT_UNUSED_RASTER.


* docs/CHANGES: Updated.
2005-05-19 07:20:24 +00:00
Werner Lemberg eaab4a3c3b * docs/announce: Start updating. 2005-05-18 07:01:59 +00:00
Werner Lemberg fe25ac742d Add missing ChangeLog entry. 2005-05-17 20:37:50 +00:00
Werner Lemberg ce235eaf09 * builds/win32/visualc/freetype.vcproj: Updated.
Exclude debug info for `Release' versions to reduce library size.


* src/base/ftobjs.c (FT_Open_Face): Make it work as documented, this
is, ignore `aface' completely if face_index < 0.  Reported by David
Osborn <spam@habitualhiatus.com>.


* include/freetype/ftimage.h (FT_Outline_MoveToFunc,
FT_Outline_LineTo_Func, FT_Outline_ConicToFunc,
FT_Outline_CubicToFunc), src/smooth/ftgrays.c (gray_render_conic,
gray_render_cubic, gray_move_to, gray_line_to, gray_conic_to,
gray_cubic_to, gray_render_span, gray_sweep): Decorate parameters
with `const' where appropriate.
2005-05-17 20:35:23 +00:00
Werner Lemberg fa420250c5 * include/freetype/ftimage.h (FT_Raster_RenderFunc),
include/freetype/ftrender.h (FT_Glyph_TransformFunc,
FT_Renderer_Render_Func, FT_Renderer_TransformFunc),
src/base/ftglyph.c (ft_outline_glyph_transform),
src/raster/ftrend1.c (ft_raster1_transform, ft_raster1_render),
src/smooth/ftgrays.c (FT_Outline_Decompose, gray_raster_render),
src/smooth/ftsmooth.c (ft_smooth_transform,
ft_smooth_render_generic, ft_smooth_render, ft_smooth_render_lcd,
ft_smooth_render_lcd_v): Decorate parameters with `const' where
appropriate.

* src/raster/ftraster.c (RASTER_RENDER_POOL): Removed.  Obsolete.
(ft_black_render): Decorate parameters with `const' where
appropriate.


* src/sfnt/ttcmap.c (tt_cmap4_set_range): Fix typo (FT_PEEK_SHORT ->
FT_PEEK_USHORT) which caused crashes.  Reported by Ismail Donmez
<ismail@kde.org.tr>.
2005-05-11 20:04:35 +00:00
Werner Lemberg 958f019dc6 * include/freetype/internal/ftserv.h (FT_FACE_FIND_GLOBAL_SERVICE)
[__cplusplus]: Fix typo.
2005-05-09 22:29:36 +00:00
Werner Lemberg 22ad9ef024 Handle unsorted SFNT type 4 cmaps correctly (reported by Dirck
Blaskey).

* src/sfnt/ttcmap.h (TT_CMap): Add member `unsorted'.
* src/sfnt/ttcmac.c: Use SFNT_Err_Ok where appropriate.

(tt_cmap0_validate, tt_cmap2_validate, tt_cmap6_validate,
tt_cmap8_validate, tt_cmap10_validate, tt_cmap12_validate): Use
`FT_Error' as return type.
(tt_cmap4_validate): Use `FT_Error' as return type.
Return error code for unsorted cmap.
(tt_cmap4_char_index, tt_cmap4_char_next): Use old code for unsorted
cmaps.
(tt_face_build_cmaps): Set `unsorted' variable in cmap.


Minor formatting.
2005-05-09 22:11:36 +00:00
Werner Lemberg 43ebad4207 * src/truetype/ttpload.c (tt_face_get_location): Fix typo. 2005-05-07 06:10:19 +00:00
Werner Lemberg 483daa9f74 * src/cff/cffobjs.c (cff_face_init): Set ppem value in top
dictionary for SFNT-based CFF.
2005-05-06 19:24:13 +00:00
Werner Lemberg 5452fbe39d Handle malformed `loca' table entries.
* docs/TODO: Add some bugs which should be fixed.

* include/freetype/internal/tttypes.h (TT_FaceRec): Add `glyf_len'
element.

* src/truetype/ttpload.c (tt_face_load_loca): Get length of `glyf'
table.
(tt_face_get_location): Fix computation of `asize' for malformed
`loca' entries.
2005-05-05 07:44:20 +00:00
David Turner 750fa961c6 * Jamfile: removing otvalid from the list of compiled modules
* include/freetype/internal/ftserv.h: added compiler pragmas to get rid
    of annoying warnings with Visual C++ compiler in maximum warning mode

  * src/autofit/afhints.c, src/autofit/aflatin.c, src/base/ftstroke.c,
    src/bdf/bdfdrivr.c, src/cache/ftcbasic.c, src/cache/ftccmap.c,
    src/cache/ftcmanag.c, src/cff/cffload.c, src/cid/cidload.c,
    src/lzw/zopen.c, src/otvalid/otvgdef.c, src/pcf/pcfread.c,
    src/sfnt/sfobjs.c, src/truetype/ttgxvar.c: removing compiler warnings
2005-05-01 10:11:32 +00:00
Werner Lemberg a0a3aa9323 * docs/TODO: Updated. 2005-04-28 05:34:25 +00:00
Werner Lemberg ea5b856293 * src/otvalid/otvcommn.c
(otv_GSUBGPOS_have_MarkAttachmentType_flag): Handle table == 0.
2005-04-24 21:50:41 +00:00
Werner Lemberg b01676b223 * src/cff/cffobjs.c (cff_face_init): Set default upem value in top
font dict also.
Handle font matrix settings in subfonts.

* src/cff/cffgload.c (cff_slot_load): Use the correct font matrix
for CID-keyed fonts with subfonts.

* docs/formats.txt: Updated.
2005-04-18 07:13:07 +00:00
Werner Lemberg c01c904249 * include/freetype/freetype.h (FT_Vector_Transform),
include/freetype/ftimage.h (FT_Raster_Params),
include/freetype/ftoutln.h, src/base/ftoutln.c (FT_Outline_Get_CBox,
FT_Outline_Copy, FT_Outline_Transform, FT_Vector_Transform,
FT_Outline_Get_Bitmap), src/raster/ftraster.c (ft_black_render),
src/smooth/ftgrays.c (gray_raster_render): Decorate parameters with
`const' where appropriate.

* src/sfnt/ttsbit0.c (tt_sbit_decoder_load_image): Fix arguments
to call of tt_sbit_decoder_load_bitmap.
2005-04-14 16:03:15 +00:00
Werner Lemberg e7602c4b4a * src/type1/t1load.c (parse_charstrings): Catch this non-standard
beginning of the /CharStrings dictionary:

  /CharStrings 118 dict def
  Private begin
  CharStrings begin
2005-04-14 11:43:40 +00:00
Werner Lemberg 1ea53e87c8 * docs/TODO: Updated.
* autogen.sh: Use `--force' for all commands.
2005-04-13 18:12:36 +00:00
Werner Lemberg 4f65eed89c src/pshinter/pshalgo.c (ps_hints_apply): Change scaling values only
if `fitted' is not zero.
2005-04-09 09:50:39 +00:00
Werner Lemberg 8744edfefb * src/truetype/ttgload.c (tt_face_get_metrics) [FT_OPTIMIZE_MEMORY]:
Fix typo which sometimes causes wrong metrics for the last glyph.
2005-04-06 14:48:55 +00:00
Werner Lemberg 14911facac Fix ChangeLog. 2005-04-04 20:38:33 +00:00
David Turner 0529ba8d25 * include/freetype/config/ftoption.h: commenting the definition of
FT_OPTIMIZE_MEMORY for the upcoming 2.1.10 release

    * src/autofit/afhints.c: small tweak to use a bit less heap memory
    within the auto-fitter
2005-04-03 22:09:41 +00:00
Werner Lemberg 730b7b1f79 * src/type1/t1parse.c (T1_New_Parser): Relax the check for a valid
first line in the font.
2005-04-03 20:44:43 +00:00
Werner Lemberg a76108ba0b * docs/CHANGES, include/freetype/freetype.h: Improve documentation
of FT_Set_Pixel_Sizes and FT_Set_Char_Size.
2005-04-03 20:11:42 +00:00
Werner Lemberg e5bcbf95a8 Add comment about hard-coded dropout mode. 2005-04-01 23:57:31 +00:00
Werner Lemberg a6e9ff3d20 * builds/amiga/src/base/ftsystem.c (ft_amiga_stream_io): Fix buffer
offsets after a large read.
2005-03-26 22:57:57 +00:00
Werner Lemberg 2cefb52fc8 * src/autofit/afglobal.c (af_face_globals_get_metrics):
s/index/gidx/.

* src/sfnt/ttsbit0.c (tt_sbit_decoder_load_image): Fix compiler
warnings.

* src/sfnt/rules.mk (SFNT_DRV_SRC): Add ttsbit0.c.

* src/sfnt/ttsbit0.h: Dummy file for build with `make'.
2005-03-26 10:27:09 +00:00
Werner Lemberg 4a80d05e51 Update of the Amiga port.
* builds/amiga/makefile, builds/amiga/makefile.os4,
builds/amiga/smakefile: Included the base extension files
(ftbitmap.c, ftotval.c, ftpfr.c, ftstroke.c, ftxf86.c).
2005-03-26 10:18:38 +00:00
Werner Lemberg 61c2c33ac6 Update of the Amiga port.
* builds/amiga/makefile, builds/amiga/smakefile: Handle new modules.

* builds/amiga/makefile.os4: Makefile for AmigaOS4 SDK.

* builds/amiga/README: Updated.

* builds/amiga/include/freetype/config/ftconfig.h: Handle gcc for
AmigaOS4.

* builds/amiga/include/freetype/config/ftmodule.h: Handle new
modules.

* builds/amiga/src/base/ftdebug.c: Updated to current version of
default ftdebug.c.
Add various include files and macros to have proper support for
both AmigaOS4 and older AmigaOS versions.
Don't declare KVPrintF explicitly.
Replace getenv with GetVar.
Actually enable debugging code.

* builds/amiga/src/base/ftsystem.c: Major rewrite.
2005-03-25 22:18:01 +00:00
Werner Lemberg c740c19112 * tests/*: Removed. 2005-03-23 17:44:34 +00:00
Werner Lemberg a37745bad4 * docs/CHANGES, docs/INSTALL.ANY: Updated.
* include/freetype/ftmoderr.h: Replace `Autohint' with `Autofit'.
Add `OTvalid'.

* src/autofit/aferrors.h: New file.

* src/autofit/afglobal.c, src/autofit/afhints.c,
src/autofit/aflatin.c, src/autofit/afloader.c: s/FT_Err_/AF_Err_/.
Include aferrors.h.

* src/autofit/rules.mk (AUTOF_DRV_H): Include aferrors.h.

* src/otvalid/otverror.h: s/FT_Mod_Err_OTV/FT_Mod_Err_OTvalid/.
2005-03-23 16:45:24 +00:00
David Turner 665279f0d5 removing the 'autohint' module from the library, since it is
now replaced by 'autofit'
2005-03-22 22:10:45 +00:00
Werner Lemberg ebf5585dd0 Formatting. 2005-03-16 01:49:54 +00:00
David Turner 5d02b8a151 * src/bdf/bdflib.c: removing compiler warnings 2005-03-15 23:48:15 +00:00
David Turner 58609c40c8 * docs/CHANGES: updating
* src/type1/t1parse.c (T1_New_Parser), src/type42/t42parse.c
    (t42_parser_init): modifying functions to check the font header before
    allocating anything on the heap.

    * internal/freetype/ftmemory.h: introducing the new macros FT_ARRAY_MAX
    and FT_ARRAY_CHECK

    * src/pcf/pcfread.c, src/pcf/pcfutil.c: minor fixes and simplifications.
    try to protect the PCF driver from doing stupid things with broken fonts.
2005-03-15 23:31:48 +00:00
David Turner 68df4f732d * src/bdf/bdflib.c: various improvements to the bdf loader, mainly
used to reduce the amount of heap size required to only test wether
    we're dealing with a BDF font (the old code allocated 64 Kb right
    before any test).

    * src/lzw/ftlzw.c (FT_Stream_OpenLZW): modified the function to check
    the LZW header before doing anything else. This helps avoid un-necessary
    heap allocations (400 Kb of heap memory for the LZW decoder ! Oh my !)

    * src/gzip/ftgzip.c (FT_Stream_OpenGZip): ditto for the .gz decoder,
    though the code savings is smaller.
2005-03-15 18:18:57 +00:00
Werner Lemberg 1dbcbabf6d Improving comment. 2005-03-11 09:14:21 +00:00
David Turner 465a53243f * src/tools/glnames.py: adding comment explaining the compression
being used for the Adobe Glyph List.
2005-03-10 18:31:49 +00:00
Werner Lemberg c11aeb647c * src/truetype/ttpload.c (tt_face_load_cvt, tt_face_load_fpgm):
Fix serious typo which prevented correct TT rendering.

* include/freetype/internal/ftmemory.h: Undo change from 2005-03-03.
To suppress warnings it is sufficient to use `-fno-strict-aliasing'.
2005-03-10 15:49:45 +00:00
Werner Lemberg 56ef6bc4d6 * src/tools/glnames.py: Formatted.
Format output to be in sync with other FreeType code.
Import `re' and `os.path'.
(StringTable) <__init__>: Add parameter to initialize master table
name.
(StringTable) <dump>: Don't pass master table name.
(StringTable) <dump_sublist>: Emit explanatory comment.
Simplify and make output more human readable.
(t1_bias, glyph_list, adobe_glyph_names): Removed.  Unused.
(main): Use `basename' for file name in header.

* src/psnames/pstables.h: Regenerated.

Other formatting.
2005-03-10 06:28:07 +00:00
David Turner 705620beeb * src/base/ftobjs.c (FT_Set_Char_Sizes): fix for bug #12263 2005-03-09 17:36:02 +00:00
David Turner 12e51f1685 * src/tools/glnames.py: rewrote the generator for the 'pstables.h'
header, which contains various constant tables related to glyph
    names. It now uses a different storage scheme that saves about 20
    Kb and closes bug #12262

  * src/psnames/pstables.h: re-generated header file

  * src/psnames/psmodule.c: rewrote some parts to comply with recent
    changes in 'pstables.h'
2005-03-09 17:33:03 +00:00
Werner Lemberg 3ab770b165 Cosmetic fixes. 2005-03-08 20:24:56 +00:00
Werner Lemberg 8acb867ef2 Formatting. 2005-03-08 11:43:36 +00:00
Werner Lemberg 35fd84b96a Formatting. 2005-03-08 06:00:35 +00:00
David Turner 8d4ccf5384 * src/autofit/aflatin.c (af_latin_metrics_init): fixing bug #12212
(auto-hinter refuses to work if no Unicode charmap in font)
2005-03-06 10:17:28 +00:00
David Turner fe5c906e9c * src/otvalid/{otvgsub.c, otvgpos.c}: making static tables constant 2005-03-06 08:14:36 +00:00
Werner Lemberg b0db0fc2c5 * autogen.sh: New script for bootstrapping.
* README.CVS: New file which documents bootstrapping.

* builds/unix/aclocal.m4, builds/unix/config.guess,
builds/unix/config.sub, builds/unix/configure,
builds/unix/ltmain.sh: Removed.
2005-03-05 17:05:35 +00:00
Werner Lemberg baa662bbea * src/base/ftutil.c: Include FT_INTERNAL_OBJECTS_H. 2005-03-03 23:05:29 +00:00
Werner Lemberg f13516c832 Various fixes for C and C++ compiling.
* src/autofit/*: Add copyright messages.
  Formatting.

* src/autofit/afhints.c (af_glyph_hints_done): Don't use
`AF_Dimension' but `int' for loop counter.

* src/autofit/aflatin.c (af_latin_metrics_init_widths): Don't use
`AF_Dimension' but `int' for loop counter.
Use proper enumeration value for `render_mode'.
(af_latin_metrics_scale_dim): Don't shadow variables.
(af_latin_hints_compute_segments): Use proper cast for `major_dir'
and `segment_dir'.
(af_latin_align_linked_edge, af_latin_hint_edges): Fix arguments of call to
`af_latin_compute_stem_width'.
(af_latin_hints_apply): Don't use `AF_Dimension' but `int' for loop
counter.

* src/base/ftdbgmem.c (ft_mem_table_get_source, FT_DumpMemory): Use
proper cast for memory allocation.

* src/cff/cffdrivr.c (cff_get_kerning): Use proper cast for
initialization of `sfnt'.

* src/sfnt/sfdriver.c: Include `ttkern.h'.

* src/sfnt/ttkern.c (tt_face_get_kerning): Don't shadow variables.

* src/truetype/ttgload.c: Include `ttpload.h'.

* src/truetype/ttpload.c (tt_face_load_loca) [FT_OPTIMIZE_MEMORY]:
Remove redundant variable.
2005-03-03 17:09:08 +00:00
David Turner 1339b974f1 * include/freetype/config/ftmodule.h: moving the order of drivers to
speed up font loading. the pcf and bdf loaders are still slow and
    eat memory like crazy.
2005-03-03 14:10:21 +00:00
David Turner dc736a6ac0 * src/sfnt/ttsbit0.c, src/truetype/ttpload.c: removing compiler
warnings
2005-03-03 14:09:10 +00:00
David Turner 683973b47c * include/freetype/internal/ftobjs.h, src/base/ftutil.c (ft_highpow2),
src/pfr/pfrload.c, src/pfr/pfrobjs.c, src/pfr/pfrtypes.h: implement
    FT_OPTIMIZE_MEMORY, the kerning table is not loaded into the heap
    anymore.
2005-03-03 14:00:23 +00:00
David Turner 0780817a61 * include/freetype/internal/{ftmemory.h,ftserv.h}: removing
compiler warnings with GCC 3.3 and above...
2005-03-03 13:58:13 +00:00
Werner Lemberg 07eac17793 * devel/ftoption.h: Updated to recent changes. 2005-03-03 11:10:45 +00:00
Werner Lemberg b19b0810cd * src/autofit/afdummy.c, src/autofit/afdummy.h
(af_dummy_script_class): Fix type.

* src/autofit/aflatin.c, src/autofit/aflatin.h
(af_latin_script_class): Fix type.

* src/autofit/rules.mk (AUTOF_DRV_SRC): Fix typo.

Formatting.
2005-03-02 11:24:23 +00:00
David Turner 1e03fff62b removing compiler warnings 2005-03-01 22:57:25 +00:00
David Turner 5bc063da2e * src/autofit/{rules.mk,module.mk,afangles.h}: adding missing files
* src/autofit/afloader.c: fixing small bug that could crash the engine
    with certain fonts.
2005-03-01 22:49:32 +00:00
David Turner b9c22aff61 * src/autofit/{afhints.h,afhints.c,aflatin.h,aflatin.c,afloader.c}:
various bug-fixes and drastic heap usage reduction improvements.

    * include/freetype/config/ftmodule.h: the auto-fitter is now the
    only supported auto-hinting module

    * include/freetype/config/ftstdlib.h: adding FT_INT_MAX definition
2005-03-01 15:48:29 +00:00
Werner Lemberg e793092d0a Formatting.
* src/truetype/ttpload.c (tt_face_load_loca): Fix typo.

* src/sfnt/ttkern.c: Include `ttkern.h'.
(FT_COMPONENT): Updated.

* include/freetype/internal/fttrace.h: Add entry for `ttkern'.

* src/sfnt/ttsbit0.c: s/FT_Err_/SFNT_Err_/.
Decorate constants with `U' and `L' where necessary.

* src/sfnt/ttcmap.c (tt_cmap4_next): Remove unused variable.
2005-03-01 02:13:50 +00:00
David Turner 7305f62767 updating ChangeLog 2005-02-28 22:09:48 +00:00
David Turner 6a487b59be * src/base/ftdbgmem.c (FT_DumpMemory): added sorting of memory sources
according to decreasing maximum cumulative allocations.

  * include/freetype/internal/tttypes.h, src/sfnt/ttsbit.c, src/sfnt/ttsbit0.c,
  src/truetype/ttobjs.c, src/cff/cffobjs.c, src/sfnt/sfobjs.c: implementing new
  heap-optimized embedded bitmap loader. This one also fixes bug #12107

  * src/sfnt/sfobjs.c: fixed bug that prevented loading SFNT fonts without
  a 'kern' table.
2005-02-28 22:09:07 +00:00
David Turner 150c0dc616 optimization of linear charmap scanning for Format 4 2005-02-28 17:17:47 +00:00
David Turner fa0eb0c95f * src/sfnt/ttkern.c (tt_face_load_kern): fixing a small bug which returned
invalid (random) values for the horizontal kerning
2005-02-27 21:35:50 +00:00
David Turner e5680279b2 * many, many files: several memory optimizations were implemented to
drastically reduce the heap usage of FreeType, especially in the case
  of memory-mapped files. The idea is to avoid loading and decoding tables
  in the heap, and instead access the raw data whenever possible (i.e.
  when it doesn't compromise performance).

  This had several impacts: first, opening vera.ttf uses a ridiculous amount
  of memory (when the FT_Library footprint is accounted for), until you start
  loading glyphs. Even then, you'll save at least 20 Kb compared to the non
  optimized case. performance of various operations, including open/close
  has also been dramatically improved.

  More optimisations to come. The auto-hinter eats memory like crazy? This
  must be stopped...
2005-02-26 00:12:04 +00:00
David Turner e70d553111 * include/freetype/config/ftoption.h, include/freetype/internal/ttypes.h,
src/truetype/ttpload.c, src/truetype/ttpload.h, src/truetype/ttgload.c:
    added the temporary configuration FT_OPTIMIZE_MEMORY to control various
    optimizations used to reduce the heap footprint of memory-mapped TrueType
    files.

    * src/truetype/ttpload.c (tt_face_load_loca, tt_face_get_location,
    tt_face_done_loca): when FT_OPTIMIZE_MEMORY is set, the locations table
    is read directly from memory-mapped streams, instead of being decoded
    into the heap.

    * src/truetype/ttpload.c: only load the CVT and fpgm tables when the
    bytecode interpreter is compiled in.
2005-02-22 16:53:06 +00:00
David Turner 3e26d07e60 * src/base/ftdbgmem.c: adding the ability to list all allocation sites
in the memory debugger. Also a new function FT_DumpMemory() was added.
	It is only available in builds with FT_DEBUG_MEMORY defined, and you
	must declare it in your own code to use it, i.e. with something
	like:

	  extern void FT_DumpMemory( FT_Memory );

	  ...

	  FT_DumpMemory( memory );

	* include/freetype/config/ftoptions.h: disabling TrueType bytecode
	interpreter !

	* include/freetype/internal/ftmemory.h: adding FT_ARRAY_ZERO, as a
	convenience macro.
2005-02-22 15:38:12 +00:00
Werner Lemberg 014d571407 * builds/unix/ltmain.sh: Regenerated with `libtoolize --force
--copy' from libtool 1.5.14.
* builds/unix/aclocal.m4: Regenerated with `aclocal -I .' from
automake 1.9.4.

* builds/unix/config.guess, builds/unix/config.sub: Updated from
`config' CVS module at subversions.gnu.org.

* builds/unix/install-sh, builds/unix/mkinstalldirs: Updated from
`texinfo' CVS module at subversions.gnu.org.
2005-02-20 08:22:30 +00:00
Werner Lemberg 8e58ff26d2 * src/cff/cffcmap.c (cff_cmap_unicode_init): Don't try to build
a cmap for a CID-keyed font which doesn't have SIDs.
2005-02-14 07:25:07 +00:00
Werner Lemberg 1d565fb01b * src/type1/t1load.c (read_binary_data): Return more meaningful
value.
(parse_encoding, parse_subrs, parse_charstrings, parse_dict): Check
parser error value after call to T1_Skip_PS_Token (where necessary).

* src/type1/t1parse.c (T1_Get_Private_Dict): Check parser error
value after call to T1_Skip_PS_Token.

* src/cid/cidparse.c (cid_parser_new): Check parser error value
after call to cid_parser_skip_PS_token.

* src/type42/t42parse.c (t42_parse_encoding, t42_parse_sfnts,
t42_parse_charstrings, t42_parse_dict): Check parser error value
after call to T1_Skip_PS_Token (where necessary).

* src/psaux/psobjc.c (skip_string, ps_parser_skip_PS_token,
ps_tobytes): Add error messages.
2005-02-13 21:42:42 +00:00
Werner Lemberg a33bd861d7 * configure: Output more variables to the created Makefile so that
it can be used for ft2demos also (if the FT2DEMOS variable is
defined).
2005-02-13 05:46:50 +00:00
Werner Lemberg 0358b21d85 Formatting. 2005-02-10 16:59:37 +00:00
David Turner e99b9a99d7 * src/base/ftbitmap.c (FT_Bitmap_Convert): small improvements to the
conversion function (mainly stupid optimization, because I like
	these... shame on me)

	* src/base/Jamfile: adding ftbitmap.c to the list of compiled files
2005-02-10 16:11:29 +00:00
David Turner 2d4efdab16 forgot to update ChangeLog before previous comment
I suppose I'm rusty :-)
2005-02-10 15:36:21 +00:00
David Turner 37b67724cc Fixing bug #11921 2005-02-10 15:06:00 +00:00
Werner Lemberg fd764556ac Fix ChangeLog. 2005-02-10 08:24:10 +00:00
Werner Lemberg c9114b9926 * builds/unix/freetype-config.in: Add new flag `--ftversion' to
return the FreeType version.  Suggested by George Williams
<gww@silcom.com>.


* docs/CHANGES: Updated.


* src/otvalid/otvmod.c (otv_validate): Deallocate arrays in case
of error.  Reported by YAMANO-UCHI Hidetoshi <mer@din.or.jp>.


* src/psaux/t1decode.c (t1_decoder_parse_charstrings)
<op_closepath>: Accept `T1_Parse_Have_Moveto' state also which can
happen in empty glyphs.  Reported by Ian Brown
<ian.brown@printsoft.de>.
2005-02-10 08:18:27 +00:00
Werner Lemberg 4c1867bfab * src/otlayout/*: Removed. Obsolete. 2005-02-04 00:02:31 +00:00
Werner Lemberg cc7cab815c * builds/unix/ftsystem.c (FT_Stream_Open): Add proper cast for
ft_alloc.
Fix compiler warning.
2004-12-28 23:08:51 +00:00
Werner Lemberg 4e6ea4052a * builds/unix/ltmain.sh: Regenerated with `libtoolize --force
--copy' from libtool 1.5.10.
* builds/unix/aclocal.m4: Regenerated with `aclocal -I .' from
automake 1.9.4.
* builds/unix/configure: Regenerated with autoconf 2.59b.

* builds/unix/config.guess, builds/unix/config.sub: Updated from
`config' CVS module at subversions.gnu.org.

* builds/unix/install-sh: Updated from
`texinfo' CVS module at subversions.gnu.org.
2004-12-28 15:06:58 +00:00
Werner Lemberg 213b9d01b2 * src/cff/cffobjs.c (cff_face_init): Improve computation of
FT_STYLE_BOLD_FLAG.
2004-12-28 08:00:09 +00:00
Werner Lemberg b897e4c9c1 * src/cff/cffobjs.c (cff_face_init): A CFF within an SFNT can have
only a single font.  This is undocumented but has been verified on
the opentype list.
2004-12-28 07:49:15 +00:00
Werner Lemberg af4a4fdd30 * Jamfile (FT2_COMPONENTS): Add `otvalid'. 2004-12-28 07:36:28 +00:00
Werner Lemberg 0f2a415770 * src/base/ftbitmap.c (FT_Bitmap_Convert): Fix compiler warning. 2004-12-28 07:31:35 +00:00
Werner Lemberg b88624fc3b * vms_make.com: Add ftbitmap.obj. 2004-12-15 06:37:03 +00:00
Werner Lemberg 8285d49a70 Small additions to fix reference creation. 2004-12-14 22:32:34 +00:00
Werner Lemberg f2438e1da9 * src/base/ftbitmap.c, include/freetype/ftbitmap.h: New files for
handling various bitmap formats.

* include/freetype/config/ftheader.h (FT_BITMAP_H): New macro.

* src/base/rules.mk (BASE_EXT_SRC): Add ftbitmap.c.

* src/bdf/bdfdrivr.c (BDF_Glyph_Load): Don't convert bitmaps to 8bpp
but return them as-is.

* docs/CHANGES: Mention new bitmap API.
* include/freetype/ftchapter.s: Updated.
2004-12-14 16:01:29 +00:00
Werner Lemberg ece8b20e6c Documentation updates, whitespace. 2004-12-13 23:16:59 +00:00
Werner Lemberg a4aadf5401 Whitespace, sorting. 2004-12-13 11:40:36 +00:00
Werner Lemberg 133eee06bf * src/base/ftobjs.c (FT_Get_Kerning): Make kerning amount
dependent on ppem by scaling down for ppem < 25, then do normal
rounding.  This gives slightly better results than rounding towards
zero.
2004-12-12 06:55:40 +00:00
Werner Lemberg 62f8978794 * src/base/ftobjs.c (FT_Get_Kerning): Always round towards zero
for FT_KERNING_DEFAULT.  This greatly enhances the kerning for
small ppem values.
2004-12-09 22:57:18 +00:00
Werner Lemberg 34f4f39ad8 * src/base/ftobjs.c (ft_glyphslot_clear): Reset `lsb_delta' and
`rsb_delta'.
2004-12-09 22:22:52 +00:00
Werner Lemberg d14023d232 * builds/unix/install.mk (install): Use $(OBJ_BUILD) for ftconfig.h. 2004-12-06 08:42:41 +00:00
Werner Lemberg a3a2a0450d Formatting, copyright years. 2004-12-04 14:23:50 +00:00
Antoine Leca 1e32f2b461 * include/freetype/ttnameid.h: Updated to latest specifications from Microsoft. 2004-12-03 14:58:40 +00:00
Werner Lemberg 4e59336c29 Minor update. 2004-11-30 21:36:18 +00:00
Werner Lemberg 71e5a590e4 * vms_make.com: Include ftbbox.c.
Fix `ccopt'.
Handle `otvalid' module.
Update `vmslib.dat' default values.
Fixes to `libs.opt'.
2004-11-27 08:18:10 +00:00
Werner Lemberg 1ec3963dc8 * src/base/ftoutln.c (FT_OrientationExtremumRec,
ft_orientation_extremum_compute): Removed.
(FT_Outline_Get_Orientation): Rewritten, simplified.

* src/autohint/ahglyph.c: Include FT_OUTLINE_H.
(ah_test_extremum, ah_get_orientation): Removed.
(ah_outline_load): Use FT_Outline_Get_Orientation.

* src/base/ftsynth.c (ft_test_extrama, ft_get_orientation): Removed.
(FT_GlyphSlot_Embolden): Use FT_Outline_Get_Orientation.
2004-11-24 07:08:21 +00:00
Werner Lemberg 85cc0a322e * src/truetype/ttinterp.h: Fix typo. 2004-11-23 22:10:21 +00:00
Werner Lemberg de015d6c28 Minor fixes. 2004-11-23 21:38:16 +00:00
Antoine Leca b4f790fc69 * builds/win32/detect.mk: Corrected logic that detects
Windows NT to use the previous change even when win32 is
forced. Corrected detection of win32 on Win9X.
* builds/dos/detect.mk: Added same correction as for win32
about COPY on Windows NT. Detection of plain DOS 7.x.
2004-11-23 17:53:14 +00:00
Antoine Leca fc9df61408 * builds/dos/detect.mk: Added same correction as for win32
about COPY on Windows NT. Detection of plain DOS 7.x.
2004-11-23 17:49:40 +00:00
Antoine Leca b58191ccf2 * builds/win32/detect.mk: Corrected logic that detects
Windows NT to use the previous change even when win32 is
forced. Corrected detection of win32 on Win9X.
2004-11-23 17:48:52 +00:00
Werner Lemberg 360c271c17 * builds/detect.mk: Undo change from 2004-11-20.
* builds/win32/detect.mk: If the `OS' environment variable contains
`Windows_NT', use `cmd.exe /c copy' for copying files.
2004-11-23 09:17:16 +00:00
Werner Lemberg b2072add4b * builds/detect.mk (dos_setup): Use `cmd.exe' for copying
$(CONFIG_MK) to force lowercase file name under Windows.
2004-11-20 12:45:13 +00:00
Werner Lemberg 80c4ef819b Improve documentation for `FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH'. 2004-11-19 17:02:37 +00:00
Werner Lemberg 9abc7eb5f3 Documentation update. 2004-11-19 16:55:32 +00:00
Werner Lemberg 4d1550e4e3 Improve CHANGES entry. 2004-11-19 14:12:48 +00:00
Werner Lemberg b9ff415dfb Fix a serious bug in the TT hinter.
* src/truetype/ttgload.c (TT_Process_Simple_Glyph): Don't shift
points vertically before hinting.

* docs/CHANGES: Updated.

* src/cache/ftcglyph.c (FTC_GNode_UnselectFamily,
FTC_GCache_Lookup): A new try to fix comparison with zero.
2004-11-19 10:35:52 +00:00
Werner Lemberg bbdee28f75 * builds/unix/configure.ac: Add `-fno-strict-aliasing' if gcc is
used.
* builds/unix/configure: Regenerated.
* builds/unix/config.guess, builds/unix/config.sub: Updated from
`config' CVS module at subversions.gnu.org.


* src/cache/ftcglyph.c (FTC_GNode_UnselectFamily,
FTC_GCache_Lookup): Fix comparison with zero.

* docs/INSTALL.VMS: Updated.

* vms_make.com: Updated.  All `descrip.mms' files are now created
automatically.

* src/*/descrip.mms: Removed.
2004-11-17 08:19:27 +00:00
Owen Taylor faedb01ec5 2004-11-16 Owen Taylor <otaylor@redhat.com>
* builds/unix/freetype-config.in: Supress -L$libdir for
        /usr/lib64 as well as /usr/lib. (Reported by Dan Winship -
        https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=139199)
2004-11-16 13:06:43 +00:00
Werner Lemberg 3605e470c1 Add new function FT_Get_PS_Font_Private().
* include/freetype/internal/services/svpsinfo.h
(PS_GetFontPrivateFunc): New service function.

* include/freetype/t1tables.h, src/base/fttype1.c
(FT_Get_PS_Font_Private): New function.

* src/type1/t1driver.c (t1_ps_get_font_private): New function.
(t1_service_ps_info): Updated.

* src/cff/cffdrivr.c (cff_service_ps_info): Updated.
* src/cid/cidriver.c (cid_service_ps_info): Updated.
* src/type42/t42drivr.c (t42_ps_get_font_private): New function.
(t42_service_ps_info): Updated.

* src/type42/t42parse.c (t42_parse_dict): Remove compiler warning.
2004-11-12 07:02:45 +00:00
Werner Lemberg 023a4bf3be * include/freetype/config/ftstdlib.h: Include `stddef.h'.
(ft_ptrdiff_t): Define.

* include/freetype/fttypes.h (FT_PtrDist): Use `ft_ptrdiff_t'.

* src/cid/cidload.c (cid_parse_dict), src/type1/t1load.c
(parse_dict): Fix compiler warning.
2004-10-14 11:33:04 +00:00
Werner Lemberg 685dd4f7b8 * src/sfnt/ttcmap.c (tt_face_build_cmaps): Check for pointer
overflow.

* src/sfnt/ttload.c (tt_face_load_hdmx): Protect against bad input.
Don't use FT_QNEW_ARRAY but FT_NEW_ARRAY to make deallocation work
in case of failure.

* src/sfnt/ttsbit.c (Load_SBit_Range): Check range intervals.
(tt_face_load_sbit_strikes): Allocate `strike_sbit_ranges' after
frame test.

* src/truetype/ttgload.c (TTLoad_Simple_Glyph): Add assertion for
`flag'.
2004-10-13 05:15:44 +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 dbac48f0b4 * vms_make.com: Updated. 2004-09-13 16:07:55 +00:00
Werner Lemberg ee95b6f0d4 Adding OpenType validation module. The code is based on the
(unfinished) `otlayout' module but has been heavily modified to make
it much more compact.

* src/otvalid/*: New module.

* include/freetype/ftotval.h, src/base/ftotval.c,
include/freetype/internal/services/svotval.h: New files.

* include/freetype/config/ftmodule.h: Add otv_module_class.
* include/freetype/config/ftheader.h (FT_OPENTYPE_VALIDATE_H): New
macro.
* include/freetype/internal/ftserv.h
(FT_SERVICE_OPENTYPE_VALIDATE_H): New macro.
* include/freetype/internal/fttrace.h (otvmodule, otvcommon,
otvbase, otvgdef, otvgpos, otvgsub, otvjstf): New trace components.

* include/freetype/ftchapters.h: Updated.

* src/base/Jamfile (Library), src/base/descrip.mms (OBJS),
src/base/rules.mk (BASE_EXT_SRC): Updated.

* docs/CHANGES: Updated.
2004-09-10 14:39:00 +00:00
Werner Lemberg 2c1e57096f * src/tools/docmaker/sources.py (re_source_block_format2) <column>:
Use lookahead assertion to not match `*/'.  This removes spurious
insertions of `/' in the HTML output.
2004-09-08 13:36:39 +00:00
Werner Lemberg 619e147621 * src/truetype/ttgxvar.c (TT_Vary_Get_Glyph_Deltas): Fix call to
FT_NEW_ARRAY.
2004-09-08 09:47:44 +00:00
Werner Lemberg 645af08157 * include/freetype/internal/ftobjs.h: Don't include
FT_CONFIG_STANDARD_LIBRARY_H.
(FT_Validator, FT_VAlidationLevel, FT_ValidatorRec, FT_VALIDATOR,
ft_validator_init, ft_validator_run, ft_validator_error, FT_INVALID,
FT_INVALID_TOO_SHORT, FT_INVALID_OFFSET, FT_INVALID_FORMAT,
FT_INVALID_GLYPH_ID, FT_INVALID_DATA): Move to...

* include/freetype/internal/ftvalid.h: New file.
Make FT_INVALID return module-specific error codes.

* include/freetype/internal/internal.h (FT_INTERNAL_VALIDATE_H): New
macro.

* include/freetype/fterrors.h: Undefine FT_ERR_PREFIX only if
FT_KEEP_ERR_PREFIX isn't defined.

* src/base/ftobjs.c: Include FT_INTERNAL_VALIDATE_H.

* src/sfnt/ttcmap.h: Don't include FT_INTERNAL_OBJECTS_H but
FT_INTERNAL_VALIDATE_H.

* src/sfnt/ttcmap.c: Don't include FT_INTERNAL_OBJECTS_H but
FT_INTERNAL_VALIDATE_H.
Include sferrors.h before FT_INTERNAL_VALIDATE_H.
s/FT_Err_Ok/SFNT_Err_Ok/.

* src/sfnt/sferrors.h: Define FT_KEEP_ERR_PREFIX.

* src/type1/t1afm.c: Include t1errors.h.
2004-09-06 07:06:56 +00:00
Werner Lemberg 1357c19b65 * docs/DEBUG: Updated. 2004-09-04 06:55:32 +00:00
Werner Lemberg 92c9f105d7 * src/base/ftdebug.c (ft_debug_init): Highest debug level is 7,
not 6.
2004-09-04 06:53:36 +00:00
Werner Lemberg 510b85522c * include/freetype/tttags.h (TTAG_BASE, TTAG_GDEF, TTAG_GPOS,
TTAG_JSTF): New tags.

* include/freetype/fttypes.h (FT_Bytes, FT_Tag): New typedefs.
(FT_Int): Add `signed'.
2004-08-30 05:27:57 +00:00
Werner Lemberg 4b8397c775 * src/otlayout/otlgpos.c (otl_gpos_subtable_validate): Add argument
to pass number of lookups.
Update all callers.
Don't call otl_lookup_list_validate but otl_lookup_validate.
(otl_gpos_validate): Call otl_lookup_list_validate instead of
otl_gpos_subtable_validate.

* src/otlayout/otlgpos.h: Updated.

* src/otlayout/otljstf.c (otl_jstf_max_validate): Add argument to
pass number of lookups.
Update all callers.


* src/cff/cffparse.c (cff_parse_real): s/exp/exponent/ to avoid
compiler warning.


* src/sfnt/ttcmap0.c, src/sfnt/ttcmap0.h: Renamed to...
* src/sfnt/ttcmap.c, src/sfnt/ttcmap.h: This.
* src/sfnt/Jamfile, src/sfnt/rules.mk, src/sfnt/sfdriver.c,
src/sfnt/sfnt.c, src/sfnt/sfobjs.c: Updated.


* builds/compiler/gcc-dev.mk (CFLAGS): Don't add `-Wnested-externs'
if compiler is g++ (v3.3.3 emits a warning otherwise).
2004-08-29 16:50:09 +00:00
Werner Lemberg e79e3d3ee3 * src/otlayout/otlgpos.c (otl_value_length): Return number of bytes,
not number of 16bit entities.
(otl_gpos_lookup2_validate): Check class definition tables for
format 2.
Fix loop for format 2.
(otl_liga_mark2_validate): Fix offset for otl_anchor_validate.
2004-08-28 15:23:04 +00:00
Werner Lemberg b2c40b5bba * src/base/ftmac.c: Don't include truetype/ttobjs.h.
Don't include type1/t1objs.h.
(FT_New_Face_From_FSSpec) [!__MWERKS__]: Remove compiler warnings.
2004-08-28 08:02:46 +00:00
Werner Lemberg 009ce1aba8 * src/otlayout/otlayout.h: Add copyright.
(OTL_INVALID_OFFSET): Removed.

* src/otlayout/otlgdef.h: Include otlayout.h.
Comment out inclusion of otltable.h.

* src/otlayout/otlgpos.c (otl_gpos_lookup4_validate): Fix call
to otl_base_array_validate.
(otl_liga_mark2_validate): Fix `for' loop.

* src/otlayout/otlgsub.c (otl_ligature_validate): Check `glyph_id',
not components array.

* src/otlcommn.c (otl_lookup_get_count, otl_feature_get_count):
Comment out.
(otl_lookup_list_get_count, otl_feature_list_get_count): Activate.
(otl_feature_list_validate, otl_gsubgpos_get_lookup_count):
s/otl_lookup_get_count/otl_lookup_list_get_count/.
(otl_script_list_validate):
s/otl_feature_get_count/otl_feature_list_get_count/.
(otl_script_validate): Call otl_lang_validate for default language.

* src/otlayout/otlcommn.h: Updated.
2004-08-28 07:59:53 +00:00
Werner Lemberg 46b5c4ac31 * src/otlayout/otlgpos.c (otl_gpos_lookup1_validate,
otl_gpos_lookup2_validate, otl_gpos_lookup3_validate,
otl_gpos_lookup4_validate, otl_gpos_lookup5_validate,
otl_gpos_lookup6_validate, otl_gpos_lookup9_validate,
otl_gpos_validate): Update
function arguments.
(otl_gpos_lookup7_validate, otl_gpos_lookup8_validate): Update
function arguments.
Handle NULL offsets correctly.
Check sequence and lookup indices for format 3.
(otl_pos_rule_validate, otl_chain_pos_rule_validate): Add argument
to pass lookup count.
Check sequence and glyph indices.
(otl_gpos_subtable_validate): Update function arguments.
Update callers.

* src/otlayout/otlgpos.h: Updated.

* src/otlayout/otlgsub.c (otl_gsub_lookup1_validate,
otl_gsub_lookup3_validate, otl_gsub_lookup8_validate): Update
function arguments.
Add glyph index checks.
(otl_sequence_validate, otl_alternate_set_validate,
otl_ligature_validate): Add argument to pass glyph count.
Update callers.
Add glyph index check.
(otl_gsub_lookup2_validate, otl_gsub_lookup4_validate): Update
function arguments.
(otl_ligature_set_validate): Add argument to pass glyph count.
Update caller.
(otl_sub_class_rule_validate,
otl_sub_class_rule_set_validate): Removed.
(otl_sub_rule_validate, otl_chain_sub_rule_validate): Add argument
to pass lookup count.
Update callers.
Add lookup index check.
(otl_sub_rule_set_validate, otl_chain_sub_rule_set_validate): Add
argument to pass lookup count.
Update callers.
(otl_gsub_lookup5_validate): Update function arguments.
Handle NULL offsets correctly.
Don't call otl_sub_class_rule_set_validate but
otl_sub_rule_set_validate.
Check sequence and lookup indices for format 3.
(otl_gsub_lookup6_validate): Update function arguments.
Handle NULL offsets correctly.
Check sequence and lookup indices for format 3.
(otl_gsub_lookup7_validate, otl_gsub_validate): Update function
arguments.

* src/otlayout/otlgsub.h: Updated.

* src/otlayout/otlbase.c (otl_base_validate): Handle NULL offsets
correctly.

* src/otlayout/otlcommn.c (otl_class_definition_validate): Fix
compiler warning.
(otl_coverage_get_first, otl_coverage_get_last): New functions.
(otl_lookup_validate): Add arguments to pass lookup and glyph
counts.
Update callers.
(otl_lookup_list_validate): Add argument to pass glyph count.
Update callers.

* src/otlayout/otlcommn.h: Updated.

* src/otlayout/otljstf.c (otl_jstf_extender_validate,
otl_jstf_max_validate, otl_jstf_script_validate,
otl_jstf_priority_validate, otl_jstf_lang_validate): Add parameter
to validate glyph indices.
Update callers.
(otl_jstf_validate): Add parameter which specifies number of glyphs
in font.

* src/otlayout/otljstf.h: Updated.
2004-08-17 23:02:06 +00:00
Werner Lemberg b5a0a34be7 * src/otlayout/otlgpos.c (otl_liga_mark2_validate): Add parameter
to handle possible NULL values properly.
Update all callers.
2004-08-15 15:01:02 +00:00
Werner Lemberg 7085dc9b2e * src/otlayout/gpos.c: Rename counting variables to be more
meaningful.
Add copyright.
(otl_liga_attach_validate): Renamed to...
(otl_liga_mark2_validate): This.
Update all callers.
(otl_mark2_array_validate): Removed.
(otl_gpos_lookup6_validate): Call otl_liga_mark2_validate, not
otl_mark2_array_validate.
(otl_pos_class_set_validate, otl_pos_class_rule_validate): Removed.
(otl_gpos_lookup7_validate): Complete code for format 2.
(otl_chain_pos_class_rule_validate,
otl_chaim_pos_class_set_validate): Removed.
(otl_gpos_lookup8_validate): Don't call
otl_chain_pos_class_set_validate but
otl_chain_pos_rule_set_validate.
Simplify some code.

* src/otlayout/otlgpos.h: Add copyright.
2004-08-15 03:14:02 +00:00
Werner Lemberg adff5b0c21 * src/otlayout/otljstf.c (otl_jstf_gsub_mods_validate): Removed.
(otl_jstf_gpos_mods_validate): Renamed to...
(otl_jstf_gsubgpos_mods_validate): This.
Test whether lookup_count is zero.
(otl_jstf_priority_validate): Use otl_jstf_gsubgpos_mods_validate.
(otl_jstf_validate): Initialize gsub_lookup_count and
gpos_lookup_count if gsub or gpos is zero.

* src/otlayout/otlgsub.c: Rename counting variables to be more
meaningful.
Add copyright.
(otl_gsub_lookup1_validate): Simplify code.
(otl_gsub_lookup2_validate, otl_gsub_lookup3_validate,
otl_gsub_lookup4_validate, otl_gsub_lookup7_validate): Remove unused
variables.
(otl_gsub_lookup5_validate): Remove unused variable.
Fix call to otl_sub_rule_set_validate and
otl_sub_class_rule_set_validate.
(otl_chain_sub_class_rule_validate,
otl_chain_sub_class_set_validate): Removed.
(otl_gsub_lookup6_validate): Remove unused variable.
Fix call to otl_chain_sub_rule_set_validate.
(otl_gsub_lookup7_validate): Handle lookup type 8 also.
(otl_gsub_lookup8_validate: New function.
(otl_gsub_lookup1_apply, otl_gsub_lookup2_apply,
otl_gsub_lookup3_apply): Commented out.
(otl_gsub_validate_funcs): Add otl_gsub_lookup7_validate and
otl_gsub_lookup8_validate.
(otl_gsub_validate): Updated.

* src/otlayout/otlgsub.h: Add copyright.

* src/otlayout/otlcommn.c, src/otlayout/otlcommn.h
(otl_coverage_get_index): Comment out.
2004-08-14 07:20:43 +00:00
Werner Lemberg 80ed03e2bb * src/otlayout/otlcommn.c (otl_gsubgpos_get_lookup_count): New
function.
* src/otlayout/otlcommn.h: Updated.

* src/otlayout/otlbase.c: Rename counting variables to be more
meaningful.
Add copyright message.
* src/otlayout/otlbase.h: Add copyright message.

* src/otlayout/otlgdef.c: Rename counting variables to be more
meaningful.
Add copyright message.
Use OTL_CHECK everywhere.
(otl_caret_value_validate): Remove unused variable.
(otl_gdef_validate): All tables are optional.
* src/otlayout/otlgdef.h: Add copyright message.

* src/otlayout/otljstf.c: Rename counting variables to be more
meaningful.
Add copyright message.
(otl_jstf_gsub_mods_validate, otl_jstf_gpos_mods_validate): Add
parameter to pass lookup count.
Update all callers.
Check lookup array.
(otl_jstf_max_validate):
s/otl_gpos_subtable_check/otl_gpos_subtable_validate/.
(otl_jstf_priority_validate, otl_jstf_lang_validate,
otl_jstf_script_validate): Add two parameters to pass lookup counts.
Update all callers.
(otl_jstf_validate): Add two parameters to pass GPOS and GSUB
table offsets; use otl_gsubgpos_get_lookup_count to convert extract
lookup counts.
Fix typo.
* src/otlayout/otljstf.h: Updated.
Add copyright message.

* src/otlayout/otlgpos.c (otl_gpos_subtable_validate): New function.
(otl_gpos_validate): Use it.
* src/otlayout/otlgpos.h: Updated.
2004-08-13 06:09:08 +00:00
Werner Lemberg 1ac8f43463 * src/otlayout/otcommn.c: Use OTL_CHECK everywhere.
(otl_coverage_validate): Initialize `p',
s/count/num_glyphs/.
s/start_cover/start_coverage/.
(otl_coverage_get_index): Return OTL_Long, not OTL_Int.
Remove unused variables.
(otl_class_definition_validate): s/count/num_glyphs/.
Remove unused variables.
(otl_class_definition_get_value, otl_device_table_get_start,
otl_device_table_get_end, otl_device_table_get_delta,
otl_lookup_get_table, otl_lookup_list_get_count,
otl_lookup_list_get_lookup, otl_lookup_list_get_table,
otl_feature_get_lookups, otl_feature_list_get_count,
otl_feature_list_get_feature, otl_lang_get_count,
otl_lang_get_req_feature, otl_lang_get_features): Commented out
temporarily until we really need it.
(otl_lookup_validate): Removed.
(otl_lookup_table_validate): Renamed to ...
(otl_lookup_validate): This.  Update callers.
(otl_lookup_list_validate): Remove already commented out definition
and move the other definition up.
(otl_feature_validate): Add parameter to pass number of lookups.
Update callers.
Check lookup indices.
(otl_feature_list_validate): Add parameter to pass lookup table.
Update callers.
(otl_lang_validate): Add parameter to pass number of features.
Update callers.
Handle req_feature and check feature indices.
(otl_script_validate): Add parameter to pass number of features.
Update callers.
(otl_script_list_validate): Add parameter to pass feature table.
Update callers.

* src/otlayout/otcommn.h: s/LOCALDEF/LOCAL/.
Comment out the same functions as in otcommn.c.
(otl_script_list_get_script): Removed.

* src/otlayout/otlgsub.c (otl_gsub_lookup1_apply): Change `index' to
type OTL_Long.
(otl_gsub_lookup2_apply, otl_gsub_lookup3_apply): Change `index' to
type OTL_Long.
Fix test.
(otl_gsub_validate): Fix order of validation.

* src/otlayout/otlgpos.c (otl_gpos_validate): Fix order of
validation.
2004-08-12 23:50:37 +00:00
Werner Lemberg ec39a8a391 Make otlayout module compile (without actually working).
* src/otlayout/*: s/OTL_Valid/OTL_Validator/.
s/NULL/0/.

* src/otlayout/otlayout.h: Fix various typos.
(OTL_Bool): New typedef.
(OTL_Int, OTL_Long, OTL_Int16, OTL_Int32): Use `signed' keyword.
(OTL_Err_InvalidArgument): Removed.
(OTL_Err_InvalidData, OTL_Err_InvalidSize): New enum values.
(OTL_MAKE_TAG): Add missing parenthesis.
(OTL_INVALID_DATA): Use OTL_Err_InvalidData.
(OTL_INVALID_TOO_SHORT): Use OTL_Err_InvalidSize.
(OTL_INVALID_FORMAT, OTL_INVALID_OFFSET): New macros.

* src/otlayout/otlgpos.c: s/FT_/OTL_/.
s/OTL_Short/OTL_Int16/.
(otl_gpos_pairset_validate): Add return type.
(otl_base_array_validate): Fix call to otl_anchor_validate.
(otl_liga_array_validate): Fix call to otl_liga_attach_validate.
(otl_gpos_lookup5_validate): Fix typos.
(otl_gpos_lookup6_validate): Fix call to otl_mark2_array_validate.
(otl_gpos_lookup7_validate): Comment out unfinished code.
Fix typos.

* src/otlayout/otlgsub.c: Add forward declaration for
otl_gsub_validate_funcs.
(otl_gsub_lookup1_apply, otl_gsub_lookup2_apply,
otl_gsub_lookup3_apply): Fix call to otl_parser_check_property.
s/otl_coverage_lookup/otl_coverage_get_index/.
(otl_ligature_validate): Add missing variable declaration.
(otl_sub_rule_validate): Fix typo.
(otl_sub_class_rule_validate): Add missing variable declaration.
Fix typo.
(otl_gsub_lookup5_validate): Fix typo.
(otl_gsub_lookup6_validate): Fix call to
otl_chain_sub_class_set_validate.
(otl_gsub_validate_funcs): Don't use `const'.

* src/otlayout/otlcommn.c (otl_class_definition_get_value,
otl_device_table_validate, otl_device_table_get_delta,
otl_lookup_validate, otl_script_validate): Add missing
variable declarations.
(otl_lookup_list_validate): Comment out first definition.
(otl_lookup_list_foreach, otl_feature_list_foreach): Comment out.
(otl_feature_list_validate):
s/otl_feature_table_validate/otl_feature_validate/.
(otl_script_list_validate):
s/otl_script_table_validate/otl_script_validate/.

* src/otlayout/otlcommn.h: Comment out first declaration.
(otl_lookup_list_foreach, otl_feature_list_foreach): Comment out.

* src/otlayout/otlbase.c (otl_base_coord_validate): Fix call to
otl_device_table_validate.
(otl_base_scsript_validate): Add missing variable declarations.
(otl_base_script_list_validate): Fix call to
otl_base_script_validate.
(otl_axis_table_validate): Fix calls to otl_base_tag_list_validate
and otl_base_script_list_validate.
(otl_base_validate): Fix calls to otl_axis_table_validate.

* src/otlayout/otlgdef.c (otl_attach_list_validate): Fix call to
otl_attach_point_validate.
(otl_caret_value_validate): Add missing variable declaration.
Fix call to otl_device_table_validate.
(otl_ligature_glyph_validate): Fix call to otl_caret_value_validate.
(otl_ligature_caret_list_validate): Fix call to
otl_ligature_glyph_validate.
(otl_gdef_validate): Fix calls to otl_class_definition_validate,
otl_attach_list_validate, otl_ligature_caret_list_validate, and
otl_class_definition_validate.

* src/otlayout/otltable.h (otl_table_validate, otl_table_init,
otl_table_set_script): Comment out.

* src/otlayout/otlparse.h (OTL_ParserRec):
s/OTL_Alternate/OTL_GSUB_Alternate/.
(OTL_ParseError): Add OTL_Err_Parser_Memory and
OTL_Err_Parser_Internal.
(otl_parser_error): Fix typo.
(otl_parser_check_property): Remove third argument.

* src/otlayout/otlparse.c (otl_string_ensure):
s/OTL_Parse_Err_Memory/OTL_Err_Parser_Memory/.
(OTL_STRING_ENSURE, otl_parser_error, otl_parser_get_index,
otl_parser_replace_1, otl_parser_replace_n): Fix typos.
(OTL_PARSER_UNCOVERED): Removed.
(otl_parser_check_property): Remove third argument.

* src/otlayout/otljstf.c (otl_jstf_priority_validate): Add missing
variable declaration.

* src/otlayout/otlutils.h (OTL_MEM_REALLOC): Fix typo.
2004-08-12 12:22:28 +00:00
Werner Lemberg 17439423f8 * src/base/ftstream.c (FT_Stream_Close): Don't reset stream->close
to NULL.  This allows custom close functions to delete the FT_STREAM
object.


Add API to get information about SFNT tables.

* include/freetype/internal/services/svsfnt.h
(FT_SFNT_Table_Info_Func): New typedef.
(SFNT_Table): Add it.

* src/base/ftobjs (FT_Sfnt_Table_Info): New function.

* include/freetype/tttables.h: Updated.

* src/sfnt/sfdriver.c (sfnt_table_info): New function.
(sfnt_service_sfnt_table): Add it.

* docs/CHANGES: Updated.


* include/freetype/freetype.h (FREETYPE_PATCH): Set to 10.

* builds/unix/configure.ac (version_info): Set to 9:8:3.
* builds/unix/configure: Updated.

* builds/win32/visualc/index.html,
builds/win32/visualc/freetype.dsp,
builds/win32/visualc/freetype.vcproj: s/219/2110/, s/2.1.9/2.1.10/.

* builds/freetype.mk (refdoc), README, Jamfile (RefDoc):
s/2.1.8/2.1.9/.

* docs/CHANGES, docs/VERSION.DLL: Updated.


* src/base/ftrfork.c (FT_Raccess_Guess)
[!FT_CONFIG_OPTION_GUESSING_EMBEDDED_FORK]: Remove compiler
warnings.
2004-08-11 05:25:37 +00:00
Werner Lemberg 963cfcd012 * src/pfr/pfrload.c (pfr_sort_kerning_pairs): Single-byte
adjustments are unsigned, not signed.
2004-08-08 16:52:29 +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
Werner Lemberg b8fdcd68d2 * src/base/ftobjs.c (FT_Attach_File): Initialize `open.stream'. 2004-08-03 03:28:11 +00:00
Werner Lemberg d232f59383 * docs/CHANGES: Updated.
FreeType now can read kerning values from PFM files.

* src/type1/t1afm.c (T1_Done_AFM): Renamed to...
(T1_Done_Metrics): This.
Update all callers.
(T1_Read_AFM): Make it static.
Don't enter and leave a frame.
(LITTLE_ENDIAN_USHORT, LITTLE_ENDIAN_UINT): New macros.
(T1_Read_PFM): New function.
(T1_Read_Metrics): New higher-level function to be used instead of
T1Read_AFM.
Update all callers.
2004-08-02 05:38:33 +00:00
Werner Lemberg 3273a99160 * src/pcf/pcfread (pcf_load_font), src/bdf/bdfdrivr.c
(BDF_Face_Init), src/truetype/ttgxvar (TT_Get_MM_Var,
tt_face_vary_cvt): Fix compiler warnings.
2004-07-31 23:04:23 +00:00
Werner Lemberg 004f3da80a * src/pcf/pcfread.c (pcf_interpret_style): Always allocate memory for
face->style_name.
* src/pcf/pcfdrivr.c (PCF_Face_Done): Free `style_name'.

* include/freetype/config/ftconfig.h (FT_SIZEOF_LONG): Recognize
five-byte `long' (which is avoided then).
2004-07-28 00:09:02 +00:00
Werner Lemberg 2541a40d95 * src/pcf/pcfdrivr.c (PCF_Set_Pixel_Size): Compare heights, not
ppem values.
(PCF_Set_Point_Size): Don't call PCF_Set_Pixel_Size but provide own
code to compare ppem values.
* src/bdf/bdfdrivr.c (BDF_Set_Pixel_Size): Compare heights, not
ppem values.
(BDF_Set_Point_Size): Don't call BDF_Set_Pixel_Size but provide own
code to compare ppem values.
2004-07-25 21:18:29 +00:00
Werner Lemberg 91d0f1ebbe * src/sfnt/sfobjs.c (sfnt_load_face): Handle
TT_NAME_ID_PREFERRED_FAMILY and TT_NAME_ID_PREFERRED_SUBFAMILY.

* src/cff/cffload.c (cff_font_load): Always create inverse mapping.
Even if the charstring count id different from the CID count, it is
still possible that the font uses a different CID -> GID mapping.
2004-07-25 08:43:35 +00:00
Werner Lemberg 9f8309f12a * src/truetype/ttobjs.c (tt_face_init): Accept 0x00020000 format tag
found in some Arphic fonts made for Chinese version of Windows 3.1.
2004-07-24 21:57:39 +00:00
Werner Lemberg 3fb70ba644 formatting & small beautification 2004-07-19 20:02:35 +00:00
David Turner efa178eed8 disabling the bytecode interpreter again 2004-07-18 07:21:29 +00:00
David Turner ebbb0089af ChangeLog update 2004-07-18 07:16:47 +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 43f0e26c8e * docs/CHANGES: Updated.
* src/base/ftstroke.c (FT_Stroker_ParseOutline): Fix compiler
warning.
2004-07-17 16:45:21 +00:00
David Turner 9f67a45dbe * include/freetype/ftstroke.h: updating documentation comments.
I hereby declare the stroker as OFFICIAL !
2004-07-15 21:13:54 +00:00
David Turner 0634a876d9 * src/base/ftstroke (FT_Stroker_ParseOutline): single points
are not stroked, preventing a bug with pala.ttf and other
        fonts.
2004-07-15 21:08:13 +00:00
Werner Lemberg f68cfd096f * src/base/ftstroke (ft_stroke_border_reverse): Removed. Unused. 2004-07-14 21:30:34 +00:00
David Turner 6a6e6f27ac * src/cache/ftcsbits.c: fixing advance computation for
transformed glyphs
2004-07-12 22:54:09 +00:00
David Turner 77c001e529 * src/base/ftstroke.c: last (?) bugfixes to the stroker. 2004-07-12 20:48:31 +00:00
David Turner 629d7df911 * src/base/ftstroke.c: fixed a bug that prevented the stroker to
correctly generate stroked paths from closed paths, i.e. nearly
        all glyphs in vectorial fonts :-)

        The code is still _very_ buggy though, treat with special care.
2004-07-11 21:09:06 +00:00
Werner Lemberg 5afaa672f3 * src/truetype/ttgload.c (load_truetype_glyph): Fix typo. 2004-06-28 14:19:15 +00:00
Werner Lemberg 3037b069f8 * src/type1/t1afm.c (afm_atoindex): Fix boundary test. Reported
by Dirck Blaskey.
2004-06-26 07:03:53 +00:00
David Turner c28b8c1bfb * src/truetype/ttgload.c, src/truetype/ttxgvar.c: removing
compiler warnings
2004-06-24 20:18:24 +00:00
Werner Lemberg 21ddf945c3 * include/freetype/internal/ftmemory.h [FT_DEBUG_MEMORY]: Declare
FT_QAlloc_Debug and FT_QRealloc_Debug.

* src/base/ftutil.c (FT_QAlloc): Fix error and debug messages.
(FT_QRealloc): Call FT_QAlloc if original pointer is NULL.
Fix error message.
2004-06-24 06:56:06 +00:00
David Turner 4e56c0d8e3 Simple ChangeLog update:
2004-06-23  David Turner   <david@freetype.org>

        * include/freetype/internal/ftmemory.h, src/base/ftutil.c,
        src/base/ftmemdbg.c: introducing the new FT_QAlloc and FT_QRealloc
        functions that do perform allocation without zero-ing out the
        corresponding blocks. Corresponding macros like FT_QALLOC, FT_QNEW,
        etc.. have been defined too

        * include/freetype/config/ftmodule.h: changed the order of modules
        in order to _dramatically_ improve the performance of face open/close
        operations. For example, putting the TrueType driver first in the
        list results in a 5X speedup when opening Vera.ttf !!

        The problem is really that the PCF and/or BDF drivers are broken
        and do a lot more than necessary simply to detect that they
        cannot handle the font file.

        * src/sfnt/ttload.c: small optimization in the kerning table
        verifier, speeds up TrueType face opening by about 7%.

        Also changed code to use the new FT_QNEW_ARRAY call when
        appropriate to slightly improve performance.
2004-06-23 19:29:58 +00:00
David Turner 5290d2fb46 performance optimizations regarding face opening 2004-06-23 15:44:03 +00:00
Werner Lemberg 8ef4183690 * src/bdf/bdfdrivr.h (BDF_FaceRec): New element `default_glyph'.
* src/bdf/bdflib.c (_bdf_add_property, _bdf_parse_start),
src/bdf/bdf.h (bdf_font_t): s/default_glyph/default_char/.

* src/bdf/bdfdrivr.c (BDF_Face_Init): Fix number of glyphs.
Set `default_glyph'.
(BDF_Glyph_Load): Use `default_glyph' for undefined glyph.

* docs/CHANGES: Updated.
2004-06-22 12:28:17 +00:00
Werner Lemberg 83efe779e3 * src/pcf/pcfread.c (pcf_read_TOC, pcf_get_properties,
pcf_get_metrics, pcf_get_bitmaps, pcf_get_encodings): Improve
debugging messages.

* src/pcf/pcfdrivr.c (FT_COMPOMENT): Move up.
(PCF_Face_Init): Simplify code.
2004-06-22 06:24:09 +00:00
Werner Lemberg 11785f56e5 * docs/CHANGES: Updated. 2004-06-21 23:32:31 +00:00
David Turner 2f0fdb9316 fixing a scaling bug in the TrueType glyph loader that generated ugly
artefacts when the TrueType bytecode interpreter was compiled in
2004-06-21 21:16:56 +00:00
Werner Lemberg e5f98e68bb Minor documentation improvement. 2004-06-19 20:50:08 +00:00
Werner Lemberg 79786fba33 * src/winfonts/winfnt.c (FNT_Face_Init): Set x_ppem and y_ppem
based on pixel_width and pixel_height.
(FNT_Size_Set_Pixels): Updated.
2004-06-15 14:13:10 +00:00
Werner Lemberg f9b44e30b5 * src/lzw/zopen.c: Comment out inclusion of `signal.h' and `unistd.h'. 2004-06-15 13:57:00 +00:00
Werner Lemberg fefd874292 * docs/CHANGES: Updated.
Minor clean-ups.
2004-06-12 13:21:20 +00:00
David Turner c12ec72c2f removing obsolete files 2004-06-10 21:30:08 +00:00
David Turner 7246d9d3af removing compiler warning 2004-06-10 20:09:05 +00:00
David Turner b83239b7fd * include/freetype/cache/ftcmru.h, src/cache/ftcbasic.c,
src/cache/ftccache.c, src/cache/ftcglyph.c, src/cache/ftcmanag.c,
        src/cache/ftcsbits.c:
        fixing some annoying bugs and inefficiencies in the cache sub-system.
2004-06-09 21:07:49 +00:00
David Turner 819cbb8aa7 * src/winfonts/winfnt.c: adding missing initialization of the
slot->metrics.width and slot->metrics.height when loading a Windows
        FNT glyph. Thanks to Huw Davies
2004-06-09 20:27:39 +00:00
David Turner 8530a22888 * include/freetype/freetype.h (FT_Glyph_Metrics, FT_GlyphSlotRec),
src/autofit/afloader.c, src/autohint/ahhint.c:
	moved the definition of 'lsb_delta' and 'rsb_delta' from FT_GlyphMetrics
	to FT_GlyphSlotRec. The old location did BREAK BINARY COMPATIBILITY
	of the library !!

        * src/sfnt/sfobjs.c: removing compiler warning
2004-06-09 20:18:35 +00:00
Werner Lemberg 89d4e4bd9a * src/autofit/afloader.c (af_loader_load_g): Set `lsb_delta' and
`rsb_delta' in slot->metrics and tune side bearings slightly.
2004-06-05 06:27:08 +00:00
Werner Lemberg 7d62f526fe * docs/CHANGES: Updated.
Improve inter-letter spacing for autohinted glyphs.

* include/freetype/freetype.h (FT_Glyph_Metrics): Add elements
`lsb_delta' and `rsb_delta'.

* src/autohint/ahhint.c (ah_hinter_load): Set `lsb_delta' and
`rsb_delta' in slot->metrics.
2004-06-04 22:30:10 +00:00
David Turner e664efaddd * src/autofit/*: important fixes to the auto-fitter. The output
now seems to be 100% equivalent to the auto-hinter, while being
        about 2% faster (which proves that script-specific algorithm
        selection isn't a performance problem).

        to test it, change "autohint" to "autofit" in
        <freetype/config/ftmodule.h> and recompile.

        a few more testing is needed before making this the official
        auto-hinting module
2004-06-04 17:41:59 +00:00
Werner Lemberg 56a4d87cb2 * src/truetype/ttgload.c (compute_glyph_metrics): Fix compiler
warnings.
2004-06-03 07:56:21 +00:00
Werner Lemberg e9920c6972 * src/sfnt/sfobjs.c (tt_face_get_name): Make sure that an English
name record for the Apple platform is preferred to a non-English
entry for the Microsoft platform.  Problem reported by HANDA
Ken'ichi.
2004-06-02 21:22:32 +00:00
Werner Lemberg 24bf96c5cc * src/type1/t1load.c (mm_axis_unmap, mm_weights_unmap): New
auxiliary functions.
(T1_Get_MM_Var): Provide axis tags.
Use mm_axis_unmap and mm_weights_unmap to provide default values
for design and normalized axis coordinates.

* include/freetype/t1tables.h (PS_DesignMapRec): Change type of
`design_points' to FT_Long.
Update all users.
2004-05-20 09:21:19 +00:00
Werner Lemberg b6370384ae * src/base/ftbbox.c (BBox_Conic_Check): Fix boundary cases.
Reported by Mikey Anbary <manbary@vizrt.com>.
2004-05-19 09:22:26 +00:00
Werner Lemberg b6420e84ed * src/sfnt/sfobjs.c (sfnt_done_face): Free face->postscript_name. 2004-05-18 20:16:04 +00:00
Werner Lemberg 695ce08c64 * src/sfnt/ttload.c (tt_face_load_max_profile): Always set
face->root.num_glyphs.

* src/sfnt/ttload.c (sfnt_dir_check): Handle `bhed' properly.
2004-05-17 12:38:52 +00:00
Werner Lemberg e260d2538d * src/cache/ftcbasic.c (ftc_basic_family_compare,
ftc_basic_family_init, ftc_basic_family_get_count,
ftc_basic_family_load_bitmap, ftc_basic_family_load_glyph,
ftc_basic_gnode_compare_faceid): Adjust parameters and return types
to prototypes given in header files from include/freetype/cache.
Use casts to proper types locally.
(ftc_basic_image_family_class, ftc_basic_image_cache_class,
ftc_basic_sbit_family_class, ftc_basic_sbit_cache_class): Remove
casts.

* src/cache/ftccback.h: Adjust parameters and return types to
prototypes given in header files from include/freetype/cache.

* src/cache/ftcimage.c (ftc_inode_free, ftc_inode_new,
ftc_inode_weight): Adjust parameters and return types to prototypes
given in header files from include/freetype/cache.  Use casts to
proper types locally.

* src/cache/ftcsbits.c (ftc_snode_free, ftc_snode_new,
ftc_snode_weight, ftc_snode_compare): Adjust parameters and return
types to prototypes given in header files from
include/freetype/cache.  Use casts to proper types locally.

* src/cache/ftccmap.c (ftc_cmap_node_free, ftc_cmap_node_new,
ftc_cmap_node_weight, ftc_cmap_node_compare,
ftc_cmap_node_remove_faceid): Adjust parameters and return types to
prototypes given in header files from include/freetype/cache.  Use
casts to proper types locally.
(ftc_cmap_cache_class): Remove casts.

* src/cache/ftcglyph.c (ftc_gnode_compare, ftc_gcache_init,
ftc_gcache_done): Adjust parameters and return types to prototypes
given in header files from include/freetype/cache.  Use casts to
proper types locally.

* src/cache/ftcmanag.c (ftc_size_node_done, ftc_size_node_compare,
ftc_size_node_init, ftc_size_node_reset,
ftc_size_node_compare_faceid, ftc_face_node_init,
ftc_face_node_done, ftc_face_node_compare: Adjust parameters and
return types to prototypes given in header files from
include/freetype/cache.  Use casts to proper types locally.

(ftc_size_list_class, ftc_face_list_class): Remove casts.


* src/autohint/ahmodule.c (ft_autohinter_init, ft_autohinter_done):
Use FT_Module as parameter and do a cast to FT_AutoHinter locally.
(autohint_module_class): Remove casts.

* src/base/ftglyph.c (ft_bitmap_glyph_init, ft_bitmap_glyph_copy,
ft_bitmap_glyph_done, ft_bitmap_glyph_bbox, ft_outline_glyph_init,
ft_outline_glyph_done, ft_outline_glyph_copy,
ft_outline_glyph_transform, ft_outline_glyph_bbox,
ft_outline_glyph_prepare): Use FT_Glyph as parameter and do a cast
to FT_XXXGlyph locally.
Use FT_CALLBACK_DEF throughout.
(ft_bitmap_glyph_class, ft_outline_glyph_class): Remove casts.

* src/bdf/bdfdrivr.c (bdf_cmap_init, bdf_cmap_done,
bdf_cmap_char_index, bdf_cmap_char_next): Use FT_CMap as parameter
and do a cast to BDF_CMap locally.
(bdf_cmap_class): Remove casts.
2004-05-17 09:25:04 +00:00
Werner Lemberg f258627e83 * src/cff/cffgload.h (CFF_Builder): Remove `error'
* src/cff/cffgload.c (cff_decoder_parse_charstrings): Replace
`Memory_Error' with `Fail' und update all users.
2004-05-13 21:59:17 +00:00
Werner Lemberg efd4e87778 * include/freetype/internal/psaux.h (T1_ParseState): New
enumeration.
(T1_BuilderRec): Replace `path_begun' with `parse_state'.
Remove `error'.
* src/psaux/t1decode.c (t1_decoder_parse_charstrings): Replace
`Memory_Error' with `Fail' and update all users.
Don't use `builder->error'.
Replace `path_begun' with `parse_state' and check parsing states.

* src/psaux/psobjs.c (t1_builder_init, t1_builder_start_point):
Replace `path_begun' with `parse_state' and check parsing states.
2004-05-13 12:59:59 +00:00
Werner Lemberg ee6e92c28e * src/truetype/ttxgvar.c (ft_var_load_avar): Do free arrays in case
of error -- `avar' is optional so we can't rely on tt_done_blend
being called automatically.
2004-05-11 06:45:27 +00:00
Werner Lemberg 19b42a5c3a * src/truetype/ttxgvar.c (ft_var_load_avar, ft_var_load_gvar): Fix
error handling.
2004-05-10 20:54:27 +00:00
Werner Lemberg b78c554d65 * src/pfr/pfrobjs.c, src/pfr/pfrobjs.h (pfr_face_init,
pfr_face_done, pfr_face_get_kerning, pfr_slot_init, pfr_slot_done,
pfr_slot_load): Don't use PFR_XXX but FT_XXX arguments which are
typecast to the proper PFR_XXX types within the function.
Update code accordingly.

* src/pfr/pfrdrivr.c (pfr_get_kerning, pfr_get_advance,
pfr_get_metrics, pfr_get_service): Don't use PFR_XXX but FT_XXX
arguments which are typecast to the proper PFR_XXX types within the
function.
Update code accordingly.
Use FT_CALLBACK_DEF throughout.
(pfr_metrics_service_rec, pfr_driver_class): Remove casts.
2004-05-08 07:00:23 +00:00
Yamato, Masatake (大和正武) 17f4b8b6f0 * src/truetype/ttgxvar.c (ft_var_load_gvar): Use FT_FACE_STREAM.
(*): Rename local variable OffsetToData to offsetToData.
2004-05-07 08:59:29 +00:00
Werner Lemberg 2b54eba36b * src/cff/cffobjs.c (cff_size_done, cff_size_init, cff_size_reset,
cff_slot_done, cff_slot_init, cff_face_init, cff_face_done): Access
root fields directly.
* src/cff/cffdrivr.c (Load_Glyph): Access root fields directly.

* src/truetype/ttgload.c (TT_Process_Simple_Glyph): Save current
frame before calling TT_Vary_Get_Glyph_Deltas.

* src/pcf/pcfdrivr.c (PCF_CMapRec): Rename `cmap' to `root' for
consistency.
(pcf_cmap_init, pcf_cmap_done, pcf_cmap_char_index,
pcf_cmap_char_next): Don't use PCF_XXX but FT_XXX arguments which
are typecast to the proper PCF_XXX types within the function.
Update code accordingly.
(pcf_cmap_class): Remove casts.
(PCF_Face_Done, PCF_Face_Init, PCF_Set_Pixel_Size): Don't use
PCF_XXX but FT_XXX arguments which are typecast to the proper
PCF_XXX types within the function.
Update code accordingly.
Use FT_CALLBACK_DEF throughout.
(PCF_Set_Point_Size): New wrapper function.
(PCF_Glyph_Load, pcf_driver_requester): Use FT_CALLBACK_DEF.
(pcf_driver_class): Remove casts.
2004-05-07 07:08:14 +00:00
Werner Lemberg 3bcad43998 * src/truetype/ttobjs.c (tt_driver_done): Fix typo.
* src/bdf/bdfdrivr.c (BDF_Face_Done, BDF_Face_Init,
BDF_Set_Pixel_Size): Don't use BDF_XXX but FT_XXX arguments which
are typecast to the proper BDF_XXX types within the function.
Update code accordingly.
Use FT_CALLBACK_DEF throughout.
(BDF_Set_Point_Size): New wrapper function.
(bdf_driver_class): Remove casts.

* src/cff/cffdrivr.c (Get_Kerning, Load_Glyph, cff_get_interface):
Don't use CFF_XXX but FT_XXX arguments which are typecast to the
proper CFF_XXX types within the function.
Update code accordingly.
Use FT_CALLBACK_DEF throughout.
(cff_driver_class): Remove casts.

* src/cff/cffobjs.h, src/cff/cffobjs.c (cff_size_done,
cff_size_init, cff_size_reset, cff_slot_done, cff_slot_init,
cff_face_init, cff_face_done, cff_driver_init, cff_driver_done):
Don't use CFF_XXX but FT_XXX arguments which are typecast to the
proper CFF_XXX types within the function.
Update code accordingly.
(cff_point_size_reset): New wrapper function.

* src/cid/cidobjs.h, src/cid/cidobjs.c (cid_slot_done,
cid_slot_init, cid_size_done, cid_size_init, cid_size_reset,
cid_face_done, cid_face_init, cid_driver_init, cid_driver_done):
Don't use CID_XXX but FT_XXX arguments which are typecast to the
proper CID_XXX types within the function.
Update code accordingly.
(cid_point_size_reset): New wrapper function.

* src/cid/cidgload.c, src/cid/cidgload.h (cid_slot_load_glyph):
Don't use CID_XXX but FT_XXX arguments which are typecast to the
proper CID_XXX types within the function.
Update code accordingly.

* src/cid/cidriver.c (cid_get_interface):
Don't use CID_XXX but FT_XXX arguments which are typecast to the
proper CID_XXX types within the function.
Update code accordingly.
Use FT_CALLBACK_DEF.
(t1cid_driver_class): Remove casts.

* src/truetype/ttdriver.c (tt_get_interface): Use FT_CALLBACK_DEF.
* src/truetype/ttgxvar.c (ft_var_load_avar): Don't free non-local
variables (this is done later).
(ft_var_load_avar): Fix call to FT_FRAME_ENTER.
(TT_Get_MM_Var): Fix size for `fvar_fields'.
(TT_Vary_Get_Glyph_Deltas): Handle deallocation of local variables
correctly.

* src/base/ftdbgmem.c (ft_mem_debug_realloc): Don't abort if
current size is zero.
2004-05-06 11:48:35 +00:00
Werner Lemberg 86ae11cf87 * src/truetype/ttobjs.h, src/truetype/ttobjs.c (tt_face_init,
tt_face_done, tt_size_init, tt_size_done, tt_driver_init,
tt_driver_done): Don't use TT_XXX but FT_XXX arguments which are
typecast to the proper TT_XXX within the function.
Update code accordingly.

* src/truetype/ttdriver.c (Get_Kerning, Set_Char_Sizes,
Set_Pixel_Sizes, Load_Glyph, tt_get_interface): Don't use TT_XXX but
FT_XXX arguments which are typecast to the proper TT_XXX within the
function.
Update code accordingly.
(tt_driver_class): Remove casts.
2004-05-04 16:53:45 +00:00
Werner Lemberg 44005cd358 * src/sfnt/ttload.c (tt_face_free_names): Check that `table->names'
is not NULL.  Reported by Gordon Childs <gchilds@quickcut.com.au>.
2004-05-03 21:31:43 +00:00
Werner Lemberg 4cc5df80fe * docs/formats.txt: Add more information on PFR format. 2004-04-30 09:57:49 +00:00
Werner Lemberg eab92f1c48 * docs/formats.txt: New file.
* docs/CHANGES: Updated.
2004-04-29 05:59:49 +00:00
Werner Lemberg 8037541a9a s/pub/freetype/ 2004-04-28 05:25:24 +00:00
Yamato, Masatake (大和正武) d1bc1ff8c8 * include/freetype/internal/tttypes.h (GX_BlendRec_)
[TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Fix a typo.

* src/truetype/ttgxvar.h (GX_BlendRec_): Fix a typo.
2004-04-27 20:25:33 +00:00
Yamato, Masatake (大和正武) 44438c2c47 Use FT_LOCAL instead of FT_LOCAL_DEF for function declarations. 2004-04-27 04:02:16 +00:00
Werner Lemberg 00c01c130b Formatting. 2004-04-26 21:54:56 +00:00
Werner Lemberg e40ac8eec9 Formatting. 2004-04-26 21:42:37 +00:00
Werner Lemberg 25cc3e70c4 Formatting. 2004-04-26 21:41:39 +00:00
Werner Lemberg cdb6e70a36 * src/truetype/ttgxvar.c (ft_var_apply_tuple): Fix typo.
* src/truetype/Jamfile, docs/CHANGES: Updated.
2004-04-26 08:09:30 +00:00
Werner Lemberg 44bb303510 * src/pcf/pcfdrivr.c: Revert change from 2004-04-17.
* src/pcf/pcfutil.c: Use FT_LOCAL_DEF.
* src/pcf/pcfutil.h: Include FT_CONFIG_CONFIG_H.
Use FT_BEGIN_HEADER and FT_END_HEADER.
Use FT_LOCAL.

2004-04-24  George Williams  <gww@silcom.com>

Add support for Apple's distortable font technology (in GX fonts).

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

* include/freetype/ftmm.h (FT_Var_Axis, FT_Var_Named_Style,
FT_MM_Var): New structures.
(FT_Get_MM_Var, FT_Set_Var_Design_Coordinates,
FT_Set_Var_Blend_Coordinates): New function declarations.

* include/freetype/internal/services/svmm.h (FT_Get_MM_Var_Func,
FT_Set_Var_Design_Func): New typedefs.
Update MultiMasters service.

* include/freetype/internal/tttypes.h
[TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include FT_MULTIPLE_MASTERS_H.
(GX_Blend) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: New typedef.
(TT_Face) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: New members `doblend'
and `blend'.

* include/freetype/tttags.h (TTAG_avar, TTAG_cvar, TTAG_gvar): New
macros.

* include/freetype/internal/fttrace.h: Add `ttgxvar'.

* src/base/ftmm.c (FT_Get_MM_Var, FT_Set_Var_Design_Coordinates,
FT_Set_Var_Blend_Coordinates): New functions.

* src/sfnt/sfobjs.c (sfnt_load_face)
[TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Set FT_FACE_FLAG_MULTIPLE_MASTERS
flag for GX var fonts.

* src/truetype/ttgxvar.c, src/truetype/ttgxvar.h: New files.

* src/truetype/truetype.c [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include
ttgxvar.c.

* src/truetype/ttdriver.c [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include
FT_MULTIPLE_MASTERS_H, FT_SERVICE_MULTIPLE_MASTERS_H, and ttgxvar.h.
(tt_service_gx_multi_masters) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]:
New service.
(tt_services) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Updated.

* src/truetype/ttgload.c [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include
ttgxvar.h.
(TT_Process_Simple_Glyph, load_truetype_glyph)
[TT_CONFIG_OPTION_GX_VAR_SUPPORT] :Support GX var fonts.

* src/truetype/ttobjs.c [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include
ttgxvar.h.
(tt_done_face) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Call
tt_done_blend.

* src/truetype/ttpload.c [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include
ttgxvar.h.
(tt_face_load_cvt)  [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Call
tt_face_vary_cvt.

* src/truetype/rules.mk (TT_DRV_SRC): Add ttgxvar.c.

* src/type1/t1driver.c (t1_service_multi_masters): Add T1_Get_MM_Var
and T1_Set_Var_Design.

* src/type1/t1load.c (FT_INT_TO_FIXED, FT_FIXED_TO_INT): New macros.
(T1_Get_MM_Var, T1_Set_Var_Design): New functions.

* src/type1/t1load.h (T1_Get_MM_Var, T1_Set_Var_Design): New
function declarations.
2004-04-25 20:15:11 +00:00
Werner Lemberg e95365b291 * include/freetype/ftcache.h (FT_Get_CharMap_Index): Rename
declaration and move to...
* include/freetype/freetype.h (FT_Get_Charmap_Index): Here.
(FREETYPE_PATCH): Set to 9.

* src/base/ftobjs.c (FT_Get_Charmap_Index): New function.

* builds/unix/configure.ac (version_info): Set to 9:7:3.
* builds/unix/configure: Updated.

* builds/win32/visualc/index.html,
builds/win32/visualc/freetype.dsp,
builds/win32/visualc/freetype.vcproj: s/218/219/.

* builds/freetype.mk (refdoc), README, Jamfile (RefDoc):
s/2.1.8/2.1.9/.

* docs/CHANGES, docs/VERSION.DLL: Updated.
2004-04-24 14:43:37 +00:00
Werner Lemberg 2b32a177f3 * src/cff/cffparse.c (cff_parser_run), src/psaux/psobjs.c
(ps_parser_load_field): Use FT_CHAR_BIT.
2004-04-24 06:06:39 +00:00
Werner Lemberg 07dcc10170 formatting, doc improvements 2004-04-21 22:27:11 +00:00
David Turner 10bf05a31d * src/cff/cffobjs.c (cff_face_init): fixed a small memory leak
* src/autofit/afloader.c, src/autofit/afmodule.c, src/base/ftdebug.c:
        removed compiler warnings

        * src/autofit/aftypes.h, src/lzw/zopen.c, src/pcf/pcfdrivr.c,
        src/pcf/pcfread.c, src/psaux/psobjs.c, src/type42/t42drivr.c:
        changed data arrays to "const" to avoid populating the ".data"
        segment
2004-04-21 14:30:37 +00:00
Werner Lemberg c78df1ef6e * src/psaux/psobjs.c (T1Radix): Renamed to...
(ps_radix): This.
Update current cursor position.

* docs/CHANGES: Updated.
2004-04-21 07:36:38 +00:00
Werner Lemberg c3dc56b85c * src/truetype/ttgload.c, src/truetype/ttgload.h (TT_Load_Glyph),
src/ttdriver.c (Load_Glyph): Change type of `glyph_index' to
FT_UInt.  From Lex Warners.


* src/sfnt/ttload.c (tt_face_load_sfnt_header): Really fix change
from 2004-03-19.

* src/bdf/bdfdrivr.c (BDF_Face_Init): Use `ft_strlen'.

* src/pcf/pcfutil.c, src/pcf/pcfutil.h: Decorate functions with
`static.'.
Remove unused function `RepadBitmap'.
* src/pcf/pcfdrivr.c: Don't include pcfutil.h.
2004-04-19 06:13:50 +00:00
Werner Lemberg 2a37b3055d * builds/unix/freetype-config.in (usage): Fix and improve usage
information.
2004-04-17 18:58:43 +00:00
Werner Lemberg ba80d61c7a * builds/unix/ftconfig.in, builds/vms/ftconfig.h: Define
FT_CHAR_BIT.

* src/base/ftobjs.c (FT_Load_Glyph): Don't apply autohinting if
glyph is vertically distorted or mirrored.

* src/cff/cffgload.c (cff_slot_load): Handle zero `size' properly
for embedded bitmaps.

* docs/CHANGES: Updated.
2004-04-16 09:56:30 +00:00
Werner Lemberg 8a803a6c2b * include/freetype/config/ftconfig.h, src/base/ftstream.c
(FT_Stream_ReadFields): More fixes using FT_CHAR_BIT.

* include/freetype/config/ftconfig.h (FT_CHAR_BIT): New macro.
2004-04-16 03:50:55 +00:00
Werner Lemberg 336bc908c8 * src/cache/ftcsbits.c (ftc_snode_load): Initialize `*asize' in case
of error.
2004-04-15 16:09:31 +00:00
Werner Lemberg 3599a028b6 * src/base/ftmac.c [__GNUC__]: Define OS_INLINE.
* builds/unix/configure.ac: Don't try to remove `-ansi' compilation
switch on the Mac.

* builds/unix/ltmain.sh: Regenerated with `libtoolize --force
--copy' from libtool 1.5.6.
* builds/unix/aclocal.m4: Regenerated with `aclocal -I .' from
automake 1.8a.
* builds/unix/configure: Regenerated with autoconf 2.59a.
2004-04-14 08:49:11 +00:00
Werner Lemberg deadbb53d2 * include/freetype/config/ftconfig.h: Use CHAR_BIT to define
size of FT_SIZEOF_xxx.


* include/freetype/internal/sfnt.h (TT_Find_SBit_Image_Func,
TT_Load_SBit_Metrics_Func): New typedefs.
(SFNT_Interface): Add find_sbit_image and load_sbit_metrics.

* src/sfnt/sfdriver.c (sfnt_interface): Updated.
* src/sfnt/ttsbit.h (tt_find_sbit_image, tt_load_sbit_metrics): New
declarations.
* src/sfnt/ttsbit.c (find_sbit_image): Renamed to...
(tt_find_sbit_image): This.
Updated all callers.
(load_sbit_metrics): Renamed to...
(tt_load_sbit_metrics): This.
Updated all callers.
2004-04-13 21:08:17 +00:00
Werner Lemberg 26eccb409f * configure: Accept makepp also.
* builds/unix/detect.mk: Use proper path to unix-def.mk.
* builds/unix/unix-def.in (BUILD_DIR, PLATFORM): Remove.
* builds/unix/unix.mk (BUILD_DIR, PLATFORM): Define.
Use BUILD_DIR.

* docs/INSTALL, docs/INSTALL.GNU, docs/INSTALL.UNX: Update
documentation on makepp.
2004-04-13 08:35:05 +00:00
Antoine Leca 497cc7c4bf Jamfile to bring in the new lzw module.
My first try at this exercise, please report problems, I lack experience!  Antoine
2004-04-12 18:09:00 +00:00
Werner Lemberg 161438c5b6 * src/lzw/zopen.c: Don't include sys/param.h and sys/stat.h. 2004-04-12 15:31:30 +00:00
Werner Lemberg 391de1a63e * src/lzw/ftlzw.c: Include zopen.h dependent on
FT_CONFIG_OPTION_USE_LZW.

* src/base/ftdebug.c: s/index/idx/ to avoid compiler warnings.
2004-04-11 16:44:54 +00:00
David Turner 4c03580f76 file Jamfile was initially added on branch LAYOUT. 2004-04-05 22:35:00 +00:00
David Turner e7b385cc05 file ot-unicode.h was initially added on branch LAYOUT. 2004-04-05 22:16:12 +00:00
David Turner d28d8587c3 file rules.mk was initially added on branch LAYOUT. 2004-04-05 22:16:12 +00:00
David Turner 746b91f736 file oterrors.h was initially added on branch LAYOUT. 2004-04-05 22:16:12 +00:00
David Turner 50bec622dc file otobjs.c was initially added on branch LAYOUT. 2004-04-05 22:16:12 +00:00
David Turner ff39eca2b6 file otltypes.h was initially added on branch LAYOUT. 2004-04-05 22:16:12 +00:00
David Turner d33e7d87a1 file otdriver.h was initially added on branch LAYOUT. 2004-04-05 22:16:12 +00:00
David Turner 614d71973f file otdriver.c was initially added on branch LAYOUT. 2004-04-05 22:16:12 +00:00
David Turner fea640a408 file otobjs.h was initially added on branch LAYOUT. 2004-04-05 22:16:12 +00:00
David Turner 22e3ea5ce9 file ot.c was initially added on branch LAYOUT. 2004-04-05 22:16:12 +00:00
David Turner 4af82cd869 file otlayout.c was initially added on branch LAYOUT. 2004-04-05 22:16:12 +00:00
David Turner a578d8e429 file otdemo.c was initially added on branch LAYOUT. 2004-04-05 22:16:12 +00:00
David Turner 4e7c4d38d1 file ot-array.c was initially added on branch LAYOUT. 2004-04-05 22:16:11 +00:00
David Turner 732e7b5f20 file ot-info.c was initially added on branch LAYOUT. 2004-04-05 22:16:11 +00:00
David Turner 17ab9c96eb file ftxgsub.h was initially added on branch LAYOUT. 2004-04-05 22:16:11 +00:00
David Turner 9265ad59cd file ot-array.h was initially added on branch LAYOUT. 2004-04-05 22:16:11 +00:00
David Turner 1c963405cd file ot-ruleset.c was initially added on branch LAYOUT. 2004-04-05 22:16:11 +00:00
David Turner fd9176c70c file ot-types.h was initially added on branch LAYOUT. 2004-04-05 22:16:11 +00:00
David Turner 89bfe8f044 file ftxopenf.h was initially added on branch LAYOUT. 2004-04-05 22:16:11 +00:00
David Turner 58eda203c5 file ftxgpos.h was initially added on branch LAYOUT. 2004-04-05 22:16:11 +00:00
David Turner ba0235dcc8 file ftxopen.c was initially added on branch LAYOUT. 2004-04-05 22:16:11 +00:00
David Turner 5d4bac8a0b file ot-ruleset.h was initially added on branch LAYOUT. 2004-04-05 22:16:11 +00:00
David Turner 35837346d1 file ftxgsub.c was initially added on branch LAYOUT. 2004-04-05 22:16:11 +00:00
David Turner 245910ebcb file ot-unicode.c was initially added on branch LAYOUT. 2004-04-05 22:16:11 +00:00
David Turner a568649053 file module.mk was initially added on branch LAYOUT. 2004-04-05 22:16:11 +00:00
David Turner 91e427a091 file ot-info.h was initially added on branch LAYOUT. 2004-04-05 22:16:11 +00:00
David Turner d22f51c363 file ftxopen.h was initially added on branch LAYOUT. 2004-04-05 22:16:11 +00:00
David Turner f8e7b708d1 file gxlayout.h was initially added on branch LAYOUT. 2004-04-05 22:16:10 +00:00
David Turner 40f1aa1126 file otlayout.h was initially added on branch LAYOUT. 2004-04-05 22:16:10 +00:00
David Turner cfe6687b07 file ftltypes.h was initially added on branch LAYOUT. 2004-04-05 22:16:10 +00:00
David Turner bd6e5719c6 file svlayout.h was initially added on branch LAYOUT. 2004-04-05 22:16:10 +00:00
David Turner d2805804f2 file fterrcompat.h was initially added on branch LAYOUT. 2004-04-05 22:16:10 +00:00
David Turner 0a97075869 file ftxgdef.h was initially added on branch LAYOUT. 2004-04-05 22:16:10 +00:00
David Turner 5f8622b492 file demo.mk was initially added on branch LAYOUT. 2004-04-05 22:16:10 +00:00
David Turner 9f92bb7ec0 file ftxgdef.c was initially added on branch LAYOUT. 2004-04-05 22:16:10 +00:00
David Turner 8e65d4e15c file ftxgpos.c was initially added on branch LAYOUT. 2004-04-05 22:16:10 +00:00
David Turner 783ebb280b file README was initially added on branch LAYOUT. 2004-04-05 22:16:10 +00:00
David Turner 702d44e3d3 file ftlayout.c was initially added on branch LAYOUT. 2004-04-05 22:16:10 +00:00
David Turner 0881f69b7b file gxerrors.h was initially added on branch LAYOUT. 2004-04-05 22:16:10 +00:00
David Turner c0ffb2e499 file gxutils.h was initially added on branch LAYOUT. 2004-04-05 22:16:10 +00:00
David Turner 9d64b63f91 file gxfeatreg.h was initially added on branch LAYOUT. 2004-04-05 22:16:10 +00:00
David Turner 83a1807a6f file gxload.h was initially added on branch LAYOUT. 2004-04-05 22:16:10 +00:00
David Turner 8792d83431 file gxfeatreg.c was initially added on branch LAYOUT. 2004-04-05 22:16:10 +00:00
David Turner 4ac5f85305 file gxdump.h was initially added on branch LAYOUT. 2004-04-05 22:16:10 +00:00
David Turner 1e6b8e901e file gxdemo.c was initially added on branch LAYOUT. 2004-04-05 22:16:10 +00:00
David Turner 45471f610e file gx.c was initially added on branch LAYOUT. 2004-04-05 22:16:10 +00:00
David Turner 9a386fe797 file gxdriver.c was initially added on branch LAYOUT. 2004-04-05 22:16:10 +00:00
David Turner 74ab470123 file gxvm.h was initially added on branch LAYOUT. 2004-04-05 22:16:10 +00:00
David Turner c1e5a3d6fa file gxload.c was initially added on branch LAYOUT. 2004-04-05 22:16:10 +00:00
David Turner 5cb8ee1d06 file gxtypes.h was initially added on branch LAYOUT. 2004-04-05 22:16:10 +00:00
David Turner fed172e278 file gxstatetbl.c was initially added on branch LAYOUT. 2004-04-05 22:16:10 +00:00
David Turner 9ff927782f file gxlayout.c was initially added on branch LAYOUT. 2004-04-05 22:16:10 +00:00
David Turner c963748529 file gxutils.c was initially added on branch LAYOUT. 2004-04-05 22:16:10 +00:00
David Turner 96b2e20ee0 file gxdump.c was initially added on branch LAYOUT. 2004-04-05 22:16:10 +00:00
David Turner c46f379117 file gxlookuptbl.h was initially added on branch LAYOUT. 2004-04-05 22:16:10 +00:00
David Turner 4d79423a2f file gxaccess.h was initially added on branch LAYOUT. 2004-04-05 22:16:10 +00:00
David Turner f9412430ea file gxstatetbl.h was initially added on branch LAYOUT. 2004-04-05 22:16:10 +00:00
David Turner 0a5511bc26 file gxlfeatreg.h was initially added on branch LAYOUT. 2004-04-05 22:16:10 +00:00
David Turner 83fa0eb30b file gxlookuptbl.c was initially added on branch LAYOUT. 2004-04-05 22:16:10 +00:00
David Turner d2a980b5a8 file gxobjs.h was initially added on branch LAYOUT. 2004-04-05 22:16:10 +00:00
David Turner 2145381d1c file gxaccess.c was initially added on branch LAYOUT. 2004-04-05 22:16:10 +00:00
David Turner 82fc217a91 file gxvm.c was initially added on branch LAYOUT. 2004-04-05 22:16:10 +00:00
David Turner 83e92c1a05 file fi.c was initially added on branch LAYOUT. 2004-04-05 22:16:10 +00:00
David Turner 8b0540a48c file gxltypes.h was initially added on branch LAYOUT. 2004-04-05 22:16:10 +00:00
David Turner 2ba203d68e file gxlfeatreg.c was initially added on branch LAYOUT. 2004-04-05 22:16:10 +00:00
David Turner 846d1419a9 file gxdriver.h was initially added on branch LAYOUT. 2004-04-05 22:16:10 +00:00
David Turner feb8752ba2 file gxobjs.c was initially added on branch LAYOUT. 2004-04-05 22:16:10 +00:00
David Turner a48001361c file ftlayout.txt was initially added on branch LAYOUT. 2004-04-05 22:16:09 +00:00
David Turner f29c1c5e32 file ftlayout.h was initially added on branch LAYOUT. 2004-04-05 22:16:09 +00:00
Werner Lemberg 7947796cd2 * builds/unix/ltmain.sh: Regenerated with `libtoolize --force
--copy' from libtool 1.5.2.
* builds/unix/aclocal.m4: Regenerated with `aclocal -I .' from
automake 1.8a.
* builds/unix/configure: Regenerated with autoconf 2.59a.
2004-04-03 20:13:43 +00:00
Werner Lemberg 33e906425d * builds/unix/ft-munmap.m4 (FT_MUNMAP_PARAM): Fix arguments of
AC_COMPILE_IFELSE.
* builds/unix/aclocal.m4: Regenerated with `aclocal -I .' from
automake 1.8a.
* builds/unix/configure: Regenerated with autoconf 2.59a.
* builds/unix/config.guess, builds/unix/config.sub: Updated from
`config' CVS module at subversions.gnu.org
* builds/unix/install-sh, builds/unix/mkinstalldirs: Updated from
`texinfo' CVS module at subversions.gnu.org.
* builds/freetype.mk (refdoc): Updated.
2004-04-02 07:13:53 +00:00
Werner Lemberg 611eaa7f3f Handle broken FNT files which don't have a trailing NULL byte
in the face name string.

* src/winfnt/winfnt.h (FNT_FontRec): New member `family_name'.
* src/winfnt/winfnt.c (fnt_font_done): Free font->family_name.
(FNT_Face_Init): Append a final zero byte to the font face name.

* src/sfnt/ttload.c (tt_face_load_sfnt_header): Fix change from
2004-03-19.
2004-04-01 20:35:57 +00:00
Werner Lemberg aeaafaa291 * src/base/descrip.mms (OBJS): Add ftbbox.obj. 2004-03-30 07:58:20 +00:00
Werner Lemberg 8bb07e6386 Add vertical phantom points.
* include/freetype/internal/tttypes.h (TT_LoaderRec): Add
`top_bearing', `vadvance', `pp3, and `pp4'.

* src/autofit/afloader.c (af_loader_load_g): Handle two more points.

* src/autohint/ahhint.c (ah_hinter_load): Handle two more points.
* src/truetype/ttgload.c (Get_VMetrics): New function.
(TT_Load_Simple_Glyph, TT_Process_Simple_Glyph): Handle two more
points.
(load_truetype_glyph): Use Get_VMetrics.
Handle two more points.
(compute_glyph_metrics): Thanks to vertical phantom points we now
can always compute `advance_height' and `top_bearing'.
* src/truetype/ttobjs.h (TT_SubglyphRec): Add vertical phantom
points.


* src/autohint/ahglyph.c (ah_outline_load): Fix allocation of
`news'.

Converting some files to Unix end-of-line convention.
2004-03-27 08:43:17 +00:00
Werner Lemberg 60e0a4d5db * src/bdf/bdfdrivr.c (BDF_Glyph_Load): Fix left side bearing. 2004-03-22 09:25:04 +00:00
Werner Lemberg 9a38e3dd35 * src/cache/ftcmru.c (FTC_MruList_RemoveSelection): Handle a NULL
value for `selection' as `select all'.
2004-03-20 20:44:45 +00:00
Werner Lemberg 2630e54d2a * src/sfnt/ttload.c (tt_face_load_sfnt_header): Reject face_index
values > 0 if loading non-TTC fonts.

* src/base/ftmac.c (open_face_from_buffer): Set positive face_index
to zero before calling FT_Open_Face.

* docs/CHANGES: Updated.
2004-03-20 14:26:38 +00:00
Werner Lemberg 0113f26b85 Delete Jamfile.in, add include/freetype/ftlzw.h. 2004-03-05 10:09:20 +00:00
Werner Lemberg 42153c8842 LZW support 2004-03-05 10:07:37 +00:00
Werner Lemberg 6ea2054fd2 Initial revision 2004-03-05 10:07:37 +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 ed279ac7ae * src/pshinter/pshalgo.c (psh_hint_table_init): Simplify code. 2004-03-03 16:06:17 +00:00
Werner Lemberg bfb712fb36 Add embedded bitmap support to CFF driver.
* src/cff/cffobjs.h (CFF_SizeRec): New structure.

* src/cff/cffgload.c (cff_builder_init): Updated.
(cff_slot_load): Updated.
[TT_CONFIG_OPTION_EMBEDDED_BITMAPS]: Load sbit.

* src/cff/cffobjs.c (sbit_size_reset)
[TT_CONFIG_OPTION_EMBEDDED_BITMAPS]: New function.
(cff_size_get_globals_funcs, cff_size_done, cff_size_init): Updated.
(cff_size_reset): Updated.
[TT_CONFIG_OPTION_EMBEDDED_BITMAPS]: Call sbit_size_reset.

* src/cff/cffdrivr.c (Load_Glyph): Updated.
(cff_driver_class): Use CFF_SizeRec.

* docs/CHANGES: Updated.
2004-03-03 08:21:12 +00:00
Werner Lemberg 0399e121da * src/pshinter/pshglob.c (psh_globals_scale_widths): Don't use
FT_RoundFix but FT_PIX_ROUND.
(psh_blues_snap_stem): Don't use blue_shift but blue_threshold.

*src/pshinter/pshalgo.c (PSH_STRONG_THRESHOLD_MAXIMUM): New macro.
(psh_glyph_find_string_points): Use PSH_STRONG_THRESHOLD_MAXIMUM.
(psh_glyph_find_blue_points): New function.  Needed for fonts like
p052003l.pfb (URW Palladio L Roman) which have flex curves at the
base line within blue zones, but the flex curves aren't covered by
hints.
(ps_hints_apply): Use psh_glyph_find_blue_points.
2004-03-02 07:01:20 +00:00
Werner Lemberg ca7ef5ee06 * builds/unix/configure.ac: Fix compiler flags for
`--with-old-mac-fonts'.
* builds/unix/configure: Regenerated.

* src/base/ftmac.c: s/TARGET_API_MAC_CARBON/!TARGET_API_MAC_OS8/.
(FT_New_Face_From_Resource): New function.
(FT_New_Face): Use FT_New_Face_From_Resource.
(FT_New_Face_From_FSSpec): Use FT_New_Face_From_Resource.
[__MWERKS__]: Don't include FSp_fopen.h.
2004-02-28 19:12:01 +00:00
Werner Lemberg 4387e43029 Fix ChangeLog. 2004-02-27 20:33:53 +00:00
Werner Lemberg d4af90b265 * src/pshinter/pshglob.c (psh_globals_new): Fix value of
`dim->stdw.count'.
Don't assign default values to blue scale and blue shift.
2004-02-27 20:32:39 +00:00
Werner Lemberg e2455bad12 * docs/CHANGES: Updated.
Improve MacOS fond support.  Provide a new API
`FT_New_Face_From_FSSpec' similar to `FT_New_Face'.

* src/base/ftmac.c [__MWERKS__]: Include FSp_fpopen.h.
STREAM_FILE [__MWERKS__]: New macro.
(ft_FSp_stream_close, ft_FSp_stream_io) [__MWERKS__]: New functions.
(file_spec_from_path) [__MWERKS__]: Updated #if statement.
(get_file_type, make_lwfn_spec): Use `const' for argument.
(is_dfont) [TARGET_API_MAC_CARBON]: Removed.
(count_face_sfnt, count_faces): New functions.
(parse_fond): Do some range checking.
(read_lwfn): Change type of second argument.
No longer call FSpOpenResFile.
(OpenFileAsResource): New function.
(FT_New_Face_From_LWFN): Use `const' for second argument.
Use OpenFileAsResource.
(FT_New_Face_From_Suitcase): Change type of second argument.
No longer call FSpOpenResFile.
Loop over all resource indices.
(FT_New_Face_From_dfont) [TARGET_API_MAC_CARBON]: Removed.
(FT_GetFile_From_Mac_Name): Use `const' for first argument.
(ResourceForkSize): Removed.
(FT_New_Face): Updated to use new functions.
(FT_New_Face_From_FSSpec): New function.

* include/freetype/ftmac.h: Updated.
2004-02-26 21:56:27 +00:00
Werner Lemberg 50aedae2be * src/autohint/ahhint.c (ah_hinter_load) <FT_GLYPH_FORMAT_OUTLINE>:
Handle case where outline->num_vedges is zero while computing hinted
metrics.

* src/cff/cffcmap.c (cff_cmap_unicode_init): Provide correct value
for `count'.
2004-02-26 09:08:51 +00:00
Werner Lemberg 675431bec1 * include/freetype/t1tables.h (PS_PrivateRec): Add
`expansion_factor'.

* src/pshinter/pshglob (psh_blues_scale_zones): Fix computation
of blues->no_overshoots -- `blues_scale' is stored with a
magnification of 1000, and `scale' returns fractional pixels.

* src/type1/t1load.c (T1_Open_Face): Initialize `blue_shift',
`blue_fuzz', `expansion_factor', and `blue_scale' according to the
Type 1 specification.

* src/type1/t1tokens.h: Handle `ExpansionFactor'.

* docs/CHANGES: Updated.
2004-02-25 21:17:49 +00:00
Werner Lemberg 754353343e Provide generic access to MacOS resource forks.
* src/base/ftrfork.c, include/freetype/internal/ftrfork.h: New
files.

* src/base/ftobjs.c: Include FT_INTERNAL_RFORK_H.
(Mac_Read_POST_Resource, Mac_Read_sfnt_Resource): Remove arguments
`resource_listoffset' and `resource_data' and adapt code
accordingly.  These values are calculated outside of the function
now.
Add new argument `offsets'.
(IsMacResource): Use `FT_Raccess_Get_HeaderInfo' and
`FT_Raccess_Get_DataOffsets'.
(load_face_in_embedded_rfork): New function.
(load_mac_face): Use load_face_in_embedded_rfork.
(ft_input_stream_new): Renamed to...
(FT_Stream_New): This.  Use FT_BASE_DEF.  Updated all callers.
(ft_input_stream_free): Renamed to...
(FT_Stream_Free): This.  Use FT_BASE_DEF.  Updated all callers.

* src/base/ftbase.c: Include ftrfork.c.

* src/base/rules.mk (BASE_SRC), src/base/Jamfile: Updated.

* include/freetype/internal/internal.h (FT_INTERNAL_RFORK_H):
New macro.

* include/freetype/internal/fttrace.h: Added `rfork' as a new
trace definition.

* include/freetype/internal/ftstream.h: Declare FT_Stream_New and
FT_Stream_Free.

* include/freetype/config/ftoption.h, devel/ftoption.h
(FT_CONFIG_OPTION_GUESSING_EMBEDDED_RFORK): New option.

* include/freetype/config/ftstdlib.h (ft_strrchr): New macro.
2004-02-25 12:58:54 +00:00
Werner Lemberg 460355a5ea * docs/CHANGES: Updated.
* include/freetype/internal/ftdebug.h: Include FT_FREETYPE_H.


Provide a simple API to control FreeType's tracing levels.

* include/freetype/internal/ftdebug.h (FT_Trace_Get_Count,
FT_Trace_Get_Name): New declarations.

* src/base/ftdebug.c (FT_Trace_Get_Count, FT_Trace_Get_Name): New
functions.
2004-02-24 07:52:45 +00:00
David Turner 9bfbf79c9f adding support for dummy script, i.e. no-hinting for non latin glyphs 2004-02-23 21:08:37 +00:00
David Turner 1029ed26af * src/autofit/afhints.c, src/autofit/afhints.h, src/autofit/aflatin.c,
src/autofit/afloader.c, src/types.h: grave bugs were fixed. The
        auto-fitter works, doesn't crashes, but still produces unexpected
        results !!
2004-02-23 20:40:30 +00:00
Werner Lemberg 4cb09724a3 * src/pshinter/pshalgo.c (PSH_STRONG_THRESHOLD): Changed to hold
the accepted shift for strong points in fractional pixels (which
is a heuristic value).
(psh_glyph_find_strong_points): Compute threshold for
psh_hint_table_find_strong_points.
(psh_hint_table_find_strong_point): Add parameter to pass threshold.
2004-02-23 18:22:32 +00:00
Werner Lemberg a5724ef813 * src/pshinter/pshrec.c (ps_mask_table_set_bits): Don't call
ps_mask_table_alloc but ps_mask_table_last.
(ps_hints_t2mask): Use correct position and number for vertical
and horizontal hinter mask bits.

* docs/CHANGES: Updated.
2004-02-21 16:47:20 +00:00
Werner Lemberg 8f1edf742e * src/base/ftstroke.c (FT_Glyph_StrokeBorder): Fix enum handling.
* src/cff/cffdrivr.c (cff_get_cmap_info): Remove compiler warning.
2004-02-20 01:39:05 +00:00
Werner Lemberg c846eac112 * include/freetype/freetype.h: Document FT_LOAD_TARGET_XXX properly.
* src/base/ftglyph.c (ft_bitmap_glyph_class,
ft_outline_glyph_class): Tag with FT_CALLBACK_TABLE_DEF.

* src/smooth/ftsmooth.c (ft_smooth_render): Handle
FT_RENDER_MODE_LIGHT.
2004-02-19 21:39:58 +00:00
Werner Lemberg 09370c8ce0 Fix callback functions in cache module.
* src/cache/ftccback.h: New file for callback declarations.

* src/cache/ftcbasic.c (ftc_basic_family_compare,
ftc_basic_family_init, ftc_basic_family_get_count,
ftc_basic_family_load_bitmap, ftc_basic_family_load_glyph,
ftc_basic_gnode_compare_faceid): Use FT_CALLBACK_DEF.
(ftc_basic_image_family_class, ftc_basic_image_cache_class,
ftc_basic_sbit_family_class, ftc_basic_sbit_cache_class):
Use FT_CALLBACK_TABLE_DEF and local wrapper functions.

* src/cache/ftccache.c: Include ftccback.h.
(ftc_cache_init, ftc_cache_done): New wrapper functions which use
FT_LOCAL_DEF.

* src/cache/ftccmap.c: Include ftccback.h.
(ftc_cmap_cache_class): Use local wrapper functions.

* src/cache/ftcglyph.c: Include ftccback.h.
(ftc_gnode_compare, ftc_gcache_init, ftc_gcache_done): New wrapper
functions which use FT_LOCAL_DEF.

* src/cache/ftcimage.c: Include ftccback.h.
(ftc_inode_free, ftc_inode_new, ftc_inode_weight): New wrapper
functions which use FT_LOCAL_DEF.

* src/cache/ftcmanag.c (ftc_size_list_class, ftc_face_list_class):
Use FT_CALLBACK_TABLE_DEF.

* src/cache;/ftcsbits.c: Include ftccback.h.
(ftc_snode_free, ftc_snode_new, ftc_snode_weight,
ftc_snode_compare): New wrapper functions which use FT_LOCAL_DEF.

* src/cache/rules.mk (CACHE_DRV_H): Add ftccback.h.
2004-02-17 18:41:58 +00:00
Werner Lemberg bb75417ad5 * include/freetype/ftmac.h (FT_GetFile_From_Mac_Name): Fix a typo
(FT_EXPORT_DEF -> FT_EXPORT).

* include/freetype/ftxf86.h (FT_Get_X11_Font_Format): Ditto.
2004-02-17 13:46:17 +00:00
Werner Lemberg 32eb5ce978 * src/base/ftobjs.c (FT_Set_Char_Size): Fix typo. 2004-02-16 12:53:59 +00:00
Werner Lemberg d1d2b458e9 * builds/unix/ftsystem.c: Include errno.h.
(ft_close_stream): Renamed to...
(ft_close_stream_by_munmap): This.
(ft_close_stream_by_free): New function.
(FT_Stream_Open): Use fallback method if mmap fails.
Use proper function for closing the stream.

* src/type1/t1load.c (parse_dict): Initialize `start_binary'.
2004-02-16 09:38:05 +00:00
Werner Lemberg 9472e23a6a * src/type42/t42objs.c (T42_Face_Init), src/type1/t1objs.c
(T1_Face_Init), src/cid/cidobjs.c (cid_face_init): Fix computation
of underline_position and underline_thickness.
2004-02-14 19:21:37 +00:00
Werner Lemberg d233482ef5 * src/base/ftobjs.c (FT_Set_Char_Size): Return immediately if
ppem values don't change.  Suggested by Graham Asher.
2004-02-13 23:48:39 +00:00
Werner Lemberg 95867077e8 * src/cid/cidload.c (cid_face_open): Always allocate
face->cid_stream so that we can deallocate it safely.


Make the PS parser more tolerant w.r.t. non-standard font data.  In
general, an error is only reported in case of a syntax error; a
wrong type is now simply ignored (if possible).  To be independent
of the order of various MM-specific keywords, the parse_shared_dict
routine has been removed -- the PS parser is now capable to skip
this data.  It no longer fails on parsing e.g.

  dup /WeightVector exch def

Since the token following /WeightVector isn't `[' (starting an
array) it is simply ignored.

* include/freetype/fterrdef.h: Define `FT_Err_Ignore' (0xA2) as a
new internal error value.

* src/type1/t1load.c (parse_blend_axis_types,
parse_blend_design_positions, parse_blend_design_map): Return
T1_Err_Ignore if no proper array is following the keyword.
(parse_weight_vector): Use T1_ToTokenArray, initializing `blend'
structure, if necessary.
Return T1_Err_Ignore if no proper array is following the keyword.
(parse_shared_dict): Removed.
(parse_encoding): Set parser->root.error to return T1_Err_Ignore
if no result can be obtained.
Check for errors before accessing `elements' array.
(t1_keywords): Remove /shareddict.
(parse_dict): Reset error if t1_load_keyword returns T1_Err_Ignore.
Set keyword_flag only in case of success.
Check error code if skipping an unrecognized token.
(T1_Open_Face) [!T1_CONFIG_OPTION_NO_MM_SUPPORT]: Call T1_Done_Blend
if blend commands haven't set up a proper MM font.

* src/psaux/psobjs.c (ps_parser_load_field_table): Remove special
code for synthetic fonts.
Return PSaux_Err_Ignore if no proper value has been found.
2004-02-12 08:33:20 +00:00
Werner Lemberg 916838ca68 * src/cff/cffgload.c (cff_decoder_parse_charstrings)
<cff_op_endchar>: Preserve glyph width before calling
cff_operator_seac.

* src/cff/cffgload.c (cff_decoder_parse_charstrings): Handle special
first argument for `hintmask' and `cntrmask' operators also.
2004-02-10 16:02:20 +00:00
Werner Lemberg 53a1edd42b * builds/unix/configure.in: Call AC_SUBST for `enable_shared',
`hardcode_libdir_flag_spec', and `wl'.
* builds/unix/configure: Regenerated.

* builds/unix/freetype-config.in: Make --prefix and --exec-prefix
actually work.
Report a proper --rpath (or -R) value for --libs argument if a
shared library has been built.

* docs/CHANGES: Updated.
2004-02-08 22:45:48 +00:00
Werner Lemberg e0c5044fb8 * src/bdf/bdfdrivr.c (BDF_Face_Init, BDF_Set_Pixel_Size): Fix
computation of various vertical and horizontal metric values.

* src/pcfdrivr.c (PCF_Set_Pixel_Size), src/pcfread (pcf_load_font):
Ditto.
2004-02-08 16:30:37 +00:00
Werner Lemberg 9cef479d3b * builds/win32/visualc/index.html,
builds/win32/visualc/freetype.dsp,
builds/win32/visualc/freetype.dsw, docs/CHANGES: Updated.

* builds/win32/visualc/freetype.sln,
builds/win32/visualc/freetype.vcproj: New files for VS.NET 2003.
2004-02-08 09:07:08 +00:00
Werner Lemberg 0a84eba8a6 * include/freetype/cache/ftccache.h (FTC_CACHE_LOOKUP_CMP):
Initialize `node'.
* src/type1/t1load.c (parse_dict): Initialize `have_integer'.
2004-02-05 14:36:43 +00:00
Werner Lemberg 6b3d00e1a0 * src/type1/t1load.c (parse_dict): Handle `RD' and `-|' commands
outside of /Subrs or /CharStrings.  This can happen if there is
additional code manipulating those two arrays so that FreeType
doesn't recognize them properly.
(T1_Open_Face): Improve an error message.

Remove CR/LF on many files.
2004-02-03 21:34:29 +00:00
Werner Lemberg cf7d908c48 * src/type1/t1load.c (parse_charstrings): Exit immediately if
there are no elements in /CharStrings.  This is needed for fonts
like Optima-Oblique which not only define /CharStrings but access it
also.
2004-02-02 19:41:09 +00:00
David Turner f546bacdcf * src/sfnt/Jamfile: removing "ttcmap" from the list of sources
* src/cache/*, include/freetype/cache/*: fixing a bug after heavy
        testing. The current sources are now "release candidates" for the
        final version of the cache sub-system

        * Jamfile: updating "refdoc" target, and adding "autohint" to the
        list of modules to build. Both the autohinter and autofitter will be
        built by default. But which one will be used is determined by
        the content of "ftmodule.h"

        * src/autofit/*: much updates, but the code is still buggy as hell.
        Aargh..
2004-02-01 16:59:06 +00:00
Werner Lemberg 5972e9abf8 * src/cff/cffgload.c (cff_operator_seac): Fix magnitude of
accent offset.
Update code similarly to the seac support for Type 1 fonts.
(cff_decoder_parse_charstrings) <cff_op_endchar>: Fix magnitude
of accent offset.
Don't hint glyphs twice if seac is emulated.
<cff_op_flex>: Assign correct point tags.
* docs/CHANGES: Updated.

* src/type1/t1parse.c (T1_Get_Private_Dict): Use FT_MEM_MOVE, not
FT_MEM_COPY, for copying the private dict.

* src/type1/t1load.c (parse_subrs): Assign number of subrs only
in first run.
(parse_charstrings): Parse /CharStrings in second run without
assigning values.
(parse_dict): Skip all /CharStrings arrays but the first.  We need
this for non-standard fonts like `Optima' which have different
outlines depending on the resolution.  Note that there is no
guarantee that we get fitting /Subrs and /CharStrings arrays; this
can only be done by a real PS interpreter.
2004-02-01 00:49:56 +00:00
Antoine Leca 4187e61bfe * builds/win32/visualc/index.html: detailled explanations
about forcing CR+LF line endings for the VC++ project files.
2004-01-29 11:25:47 +00:00
Werner Lemberg 658f263949 * src/cff/cffload.c (cff_subfont_load): Initialize `dict'. 2004-01-24 15:06:57 +00:00
Werner Lemberg ef512e3ec6 Add support for the hexadicimal representation of binary data
started with `StartData' in CID-keyed Type 1 fonts.

* include/freetype/internal/t1types.h (CID_FaceRec): Add new
members `binary_data' and `cid_stream'.

* src/cid/cidload.c (cid_read_subrs): Use `face->cid_stream'.
(cid_hex_to_binary): New auxiliary function.
(cid_face_open): Add new argument `face_index' to return quickly
if less than zero.  Updated all callers.
Call `cid_hex_to_binary', then open and assign memory stream to
`face->cid_stream' if `parser->binary_length' is non-zero.
* src/cid/cidload.h: Updated.

* src/cid/cidobjs.c (cid_face_done): Free `binary_data' and
`cid_stream'.

* src/cid/cidparse.c (cid_parser_new): Check arguments to
`StartData' and set parser->binary_length accordingly.
* src/cid/cidparse.h (CID_Parser): New member `binary_length'.

* src/cid/cidgload.c (cid_load_glyph): Use `face->cid_stream'.

* docs/CHANGES: Updated.


include/freetype/config/ftstdlib.h (ft_atoi): Replaced with...
(ft_atol): This.
* src/base/ftdbgmem.c: s/atol/ft_atol/.
* src/type42/t42drivr.c: s/ft_atoi/ft_atol/.
2004-01-23 19:52:40 +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
Werner Lemberg 271b1e1633 * src/type1/t1parse.c (T1_Get_Private_Dict): Skip exactly one
CR, LF, or CR/LF after `eexec'.
2004-01-19 23:31:56 +00:00
David Turner 6654763f83 * src/sfnt/ttsbit.c: removed compiler warning
* src/tools/docmaker/*: updating beautifier tool
2004-01-18 14:10:21 +00:00
David Turner 9fed91d3a2 fix compiler warnings 2004-01-18 14:09:07 +00:00
David Turner fd20da4b75 updating 2004-01-18 09:49:07 +00:00
David Turner 4654d76d39 bug fix 2004-01-16 16:04:38 +00:00
David Turner ee42805e5f * src/tools/docmaker/*: updating the DocMaker tool, adding a new
tool named "docbeauty" to beautify the documentation comments
        (e.g. convert them to a single block border mode)
2004-01-16 14:26:32 +00:00
David Turner 94a8918b8f bug fix 2004-01-16 09:51:42 +00:00
David Turner 8ccb4552a9 updates 2004-01-16 09:51:00 +00:00
David Turner 75820e2072 * include/freetype/ftcache.h, include/freetype/cache/ftcmanag.h:
adding FTC_Manager_LookupSize and FTC_Scaler to the public API
        (they were previously hidden)
2004-01-16 09:07:59 +00:00
David Turner fa0346d6d9 * src/base/ftstroke.c, include/freetype/ftstroke.h: fixing bugs and
adding FT_Glyph_Stroke and FT_Glyph_StrokerBorder APIs
2004-01-16 08:57:05 +00:00
David Turner cd9f3b3b5a formatting 2004-01-16 08:46:51 +00:00
David Turner 16123dfe93 * src/base/ftoutln.c (ft_orientation_extremum_compute): fixing
infinite loop bug !
2004-01-16 08:46:11 +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
Werner Lemberg edeed6b391 * src/cff/cffload.c (cff_font_load): Load charstrings_index earlier.
Use number of charstrings as argument to CFF_Load_FD_Select (as
documented in the CFF specs).
2004-01-15 16:12:36 +00:00
Werner Lemberg f9831a6675 * src/pshinter/pshalgo.c (psh_glyph_init): Move assignment of
`glyph->memory' up to free arrays properly in case of failure.
2004-01-15 11:02:07 +00:00
Werner Lemberg 3d780173fe Make `FT_Get_CMap_Language_ID' work with CFF. Bug reported by
Steve Hartwell <shspamsink@comcast.net>.

* src/cff/cffdrivr.c: Include FT_SERVICE_TT_CMAP_H.
(cff_services): Added an entry for FT_SERVICE_ID_TT_CMAP.
(cff_get_cmap_info): New function.
(cff_service_get_cmap_info) New entry for cff_services.

* src/sfnt/ttcmap0.c: Exit loop after a format match has been found.
Suggested by Steve Hartwell <shspamsink@comcast.net>.
2004-01-11 10:01:08 +00:00
Werner Lemberg 4338dab2f8 * src/base/ftobjs.c (destroy_charmaps): New function.
(destroy_face, open_face): Use `destroy_charmaps'.
2004-01-05 14:41:59 +00:00
Werner Lemberg 9914b97af2 * docs/CHANGES: Updated.
* src/winfonts/winfnt.c (FNT_Size_Set_Pixels): Fix sign of
size->metrics.descender.
2004-01-02 16:33:04 +00:00
Werner Lemberg 84c60bba18 * src/cff/cffgload.c (cff_decoder_parse_charstrings)
[FT_DEBUG_LEVEL_TRACE]: Use `%ld' in FT_TRACE4.
<cff_op_flex1>: Change type of dx and dy to FT_Pos and remove
cast for accessing arguments.
2004-01-01 08:21:30 +00:00
Werner Lemberg f946fc609b * src/truetype/ttgload.c (TT_Load_Simple_Glyph): Revert previous
change.  It's not necessary.
2003-12-31 08:48:21 +00:00
Werner Lemberg 6fd9512aff * src/truetype/ttgload.c (TT_Load_Simple_Glyph): Handle `repeated
flags set' correctly.

* src/cff/cffobjs.c (cff_face_init): Fix memory leak by deallocating
`full' and `weight' properly.
* src/cff/cffgload.c (cff_decoder_parse_charstrings)
<cff_op_hintmask> [FT_DEBUG_LEVEL_TRACE]: Use `0x' as prefix for
tracing output.
2003-12-31 07:51:30 +00:00
Werner Lemberg cb8ede4dca * include/freetype/internal/sfnt.h (TT_Set_SBit_Strike_Func):
Use FT_UInt for ppem values.
* src/sfnt/ttsbit.c (tt_face_set_sbit_strike): Use FT_UInt for
ppem values.
* src/sfnt/ttsbit.h: Updated.

* src/base/ftobjs.c (FT_Set_Pixel_Sizes): Don't allow ppem values
larger than -0FFFF.
2003-12-27 21:44:18 +00:00
Werner Lemberg 80cfbd7073 * src/base/fttrigon.c, src/base/ftgloadr.c: Inlude
FT_INTERNAL_OBJECTS_H.

* src/base/ftstroke.c (FT_Outline_GetInsideBorder,
FT_Outline_GetOutsideBorder): s/or/o/ to make it compile with
C++ compilers.

* src/cache/ftcmru.c, include/freetype/cache/ftcmru.h:
s/select/selection/ to avoid compiler warning.
* src/cff/cffload.h: s/select/ftselect/ to avoid potential
compiler warning.

Formatting.
2003-12-26 07:26:08 +00:00
Werner Lemberg a40b1b64a0 * src/cache/ftcsbits.c (FTC_SNode_Weight):
s/FTC_SBIT_ITEM_PER_NODE/FTC_SBIT_ITEMS_PER_NODE/.
2003-12-25 20:15:51 +00:00
Werner Lemberg c382afc800 Improve documentation. 2003-12-25 00:20:17 +00:00
David Turner cf2c49c80c * fixed compilation problems in the cache sub-system
* partial updates to src/autofit
2003-12-24 18:42:04 +00:00
Werner Lemberg 328abf3094 * src/cff/cffgload.c (cff_lookup_glyph_by_stdcharcode): Handle
CID-keyed fonts.

Remove MS-DOS line endings.

Minor formatting issues.
2003-12-24 13:37:58 +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
David Turner 023612221e * include/freetype/cache/ftccache.h,
include/freetype/cache/ftcmru.h,
        include/freetype/cache/ftcglyph.h,
        src/cache/ftcbasic.c,
        src/cache/ftccache.c,
        src/cache/ftccmap.c,
        src/cache/ftcmanag.c:

          additional speed optimization to the cache sub-system. It is
          now up to 70% faster than the one in the previous table
          release (i.e. 2.1.7). Note that the API did slightly change
          though.
2003-12-23 23:54:00 +00:00
Werner Lemberg 48b6ddb8a8 * include/freetype/ftwinfnt.h (FT_WinFNT_ID_*): New definitions
to describe the `charset' field in FT_WinFNT_HeaderRec.
* src/winfonts/winfnt.c (FNT_Face_Init): Set encoding to
FT_ENCODING_NONE except for FT_WinFNT_ID_MAC.

* include/freetype/freetype.h (FT_Encoding): Improve comment,
based on work by Detlef Wrkner <TetiSoft@apg.lahn.de>.

* docs/CHANGES: Updated.
2003-12-22 23:01:20 +00:00
David Turner 581ec91c27 * include/freetype/ftcache.h,
include/freetype/cache/ftcmanag.h,
        include/freetype/cache/ftccache.h,
        include/freetype/cache/ftcmanag.h,
        include/freetype/cache/ftcmru.h (added),
        include/freetype/cache/ftlru.h (removed),
        include/freetype/cache/ftcsbits.h,
        include/freetype/cache/ftcimage.h,
        include/freetype/cache/ftcglyph.h,
        src/cache/ftcmru.c,
        src/cache/ftcmanag.c,
        src/cache/ftccache.c,
        src/cache/ftcglyph.c,
        src/cache/ftcimage.c,
        src/cache/ftcsbits.c,
        src/cache/ftccmap.c,
        src/cache/ftcbasic.c (added),
        src/cache/ftclru.c (removed):

          *Complete* rewrite of the cache sub-system to "solve" the
          following points:

            - all public APIs have been moved to FT_CACHE_H, everything
              under "include/freetype/cache" is only needed by client
              applications that want to implement their own caches

            - a new function named FTC_Manager_RemoveFaceID to deal
              with the uninstallation of FaceIDs

            - the image and sbit cache are now abstract classes, that
              can be extended much more easily by client applications

            - better performance in certain areas. Further optimizations
              to come shortly anyway...

            - the FTC_CMapCache_Lookup function has changed its signature,
              charmaps can now only be retrieved by index

            - FTC_Manager_Lookup_Face => FTC_Manager_LookupFace
              FTC_Manager_Lookup_Size => FTC_Manager_LookupSize (still in
              private header for the moment)
2003-12-22 21:53:37 +00:00
Werner Lemberg 63abb4bc63 * src/type1/t1load.c (parse_dict): Stop parsing if `eexec' keyword
is encountered.
2003-12-22 11:35:36 +00:00
David Turner 89f331b713 important bug fixes for new cache code 2003-12-21 01:41:32 +00:00
Werner Lemberg 32174ffba2 * devel/ftoption.h: Define FT_DEBUG_MEMORY.
Reverted DEBUG changes in include/freetype/config/ftoption.h.
2003-12-20 07:43:45 +00:00
Werner Lemberg 83da52b4cd * src/cff/cfftypes.h (CFF_MAX_CID_FONTS): Increase to 32. For
example, the Japanese Hiragino font already contains 15 subfonts.

* src/cff/cffload.c (cff_font_load): Deallocate `sids' array for
CID-keyed fonts.
2003-12-20 07:30:05 +00:00
David Turner 57ecae22a7 new version of the cache sub-system - still under debugging 2003-12-19 21:23:58 +00:00
David Turner 9e185f32ce fixing compilation warning 2003-12-19 20:25:14 +00:00
David Turner b4e9ca4222 automatically-generated version updates 2003-12-19 04:03:50 +00:00
David Turner e186c71c4a automatically-generated version updates 2003-12-19 03:59:33 +00:00
Werner Lemberg 8f963be41c * include/freetype/ttnameid.h (TT_ADOBE_ID_LATIN_1): New macro.
* src/type1/t1objs.c (T1_Face_Init): Use TT_ADOBE_ID* values.
2003-12-18 15:29:20 +00:00
Werner Lemberg a9cd856ee2 * src/cff/cfftypes.h (CFF_FontRecDictRec): Change type of
`cid_count' to `FT_ULong'.

* src/cff/cffgload.c (cff_slot_load): Take care of empty `cids'
array.

* src/cff/cffload.c (cff_charset_done): Free `cids' array.
(cff_font_load): Create cids array only for CID-keyed fonts which
are subsetted.

* src/cff/cffobjs.c (cff_face_init): Check the availability of
the PSNames modules for non-pure CFFs also.
Set FT_FACE_FLAG_GLYPH_NAMES for a non-pure CFF also if it isn't
CID-keyed.

* src/cff/rules.mk (CFF_DRV_H): Add cfftypes.h.
2003-12-18 08:18:37 +00:00
Werner Lemberg 7f1458aaa3 * src/sfnt/sfobjs.c (sfnt_init_face): Don't set
FT_FACE_FLAG_GLYPH_NAMES if the font contains a version 3.0 `post'
table.

* docs/CHANGES: Updated.
2003-12-17 21:57:56 +00:00
Werner Lemberg 91a67478ec Add new function FT_Get_CMap_Language_ID to extract the language ID
for TrueType/sfnt fonts.

* include/freetype/internal/services/svttcmap.h: New file.
* include/freetype/internal/ftserv.h (FT_SERVICE_TT_CMAP_H): Add
svttcmap.h.

* src/sfnt/sfdriver.c: Include ttcmap0.h.
(tt_service_get_cmap_info): New service.
(sfnt_services): Updated.

* src/sfnt/ttcmap0.c (tt_cmap*_get_info): New functions.
(tt_cmap*_class_rec): Add tt_cmap*_get_info members.
(tt_get_cmap_info): New function.
* src/sfnt/ttcmap0.h: Include FT_SERVICE_TT_CMAP_H.
(TT_CMap_ClassRec): New field `get_cmap_info'.
(tt_get_cmap_info): New declaration.

* src/base/ftobjs.c: Include FT_SERVICE_TT_CMAP_H.
(FT_Get_CMap_Language_ID): New function implementation.
* include/freetype/tttables.h (FT_Get_CMap_Language_ID): New
function declaration.
2003-12-17 14:28:22 +00:00
Werner Lemberg efe527520a * include/freetype/internal/tttypes.h (TT_TableDirRec,
TT_CMapDirRec, TT_CMapDirEntryRec, TT_CMap0, TT_CMap2SubHeaderRec,
TT_CMap2Rec, TT_CMap4Segment, TT_CMap4Rec, TT_CMap6,
TT_CMapGroupRec, TT_CMap8_12Rec, TT_CMap10Rec, TT_CharMap_Func,
TT_CharNext_Func, TT_CMapTableRec, TT_CharMapRec): Removed.
Obsolete.
* src/cff/cffobjs.h (CFF_CharMapRec): Removed.  Obsolete.
2003-12-16 07:12:40 +00:00
Werner Lemberg b066c1530d * src/sfnt/ttcmap.c, src/sfnt/ttcmap.h: Removed. Obsolete.
* include/freetype/internal/sfnt.h (SFNT_Interface): Remove
obsolete fields `load_charmap' and `free_charmap'.
(TT_CharMap_Load_Func, TT_CharMap_Free_Func): Removed.
* src/sfnt/sfnt.c: Don't include ttcmap.c.
* src/sfnt/rules.mk (SFNT_DRV_SRC): Don't include ttcmap.c.
* src/sfnt/ttload.c: Don't include ttcmap.h.
* src/sfnt/sfdriver.c: Don't include ttcmap.h.
(sfnt_interface): Updated.
2003-12-16 06:42:11 +00:00
Werner Lemberg 7d5fff8b43 Import of Wolfgang's Atari support 2003-12-16 06:15:24 +00:00
Werner Lemberg 9f6e13658a Initial revision 2003-12-16 06:15:24 +00:00
Werner Lemberg e107514301 * docs/CHANGES: Updated. 2003-12-16 06:04:44 +00:00
Werner Lemberg b35093e3f5 Fix documentation. 2003-12-16 05:37:57 +00:00
Werner Lemberg fb4bfddb1a * src/type1/t1gload.c (T1_Parse_Glyph_And_Get_Char_String): Add
cast.
* src/cff/cffdrivr.c (cff_ps_has_glyph_names): Assure that return
value is either 0 or 1.
2003-12-13 18:42:31 +00:00
Werner Lemberg b36d4a53e9 * src/cff/cffdrivr.c (cff_get_glyph_name): Improve error message.
(cff_get_name_index): Return if no PSNames service is available.
(cff_ps_has_glyph_names): Handle CID-keyed fonts correctly.
* src/cff/cfftypes.h (CFF_CharsetRec): New field `cids', used for
CID-keyed fonts.  This is the inverse mapping of `sids'.
* src/cff/cffload.c (cff_charset_load): New argument `invert'.
Initialize charset->cids if `invert' is set.
(cff_font_load): In call to cff_charset_load, set `invert' to true
for CID-keyed fonts.
* src/cff/cffgload.c (cff_slot_load): Handle glyph index as CID
and map it to the real glyph index.

* docs/CHANGES: Updated.
2003-12-12 15:38:39 +00:00
Werner Lemberg 6c98cc3e7c * src/cff/cffobjs.c (cff_face_init): Don't set
FT_FACE_FLAG_GLYPH_NAMES for CID-keyed fonts.
Don't construct a cmap for CID-keyed fonts.
2003-12-12 07:59:16 +00:00
Werner Lemberg 9b067facf1 Use implementation specific SID value 0xFFFF to indicate that
a dictionary element is missing.

* src/cff/cffload.c (cff_subfont_load): Initialize all fields
which hold SIDs to 0xFFFF.
(cff_index_get_sid_string): Handle SID value 0xFFFF.
Handle case where `psnames' is zero.
(cff_font_load): Updated.
Don't load encoding for CID-keyed CFFs.

* src/cff/cffobjs.c (cff_face_init): Updated.
Don't check for PSNames module if font is CID-keyed.
Compute style name properly (using the same algorithm as in the
CID driver).
Fix computation of style flags.

* src/cff/cfftoken.h: Comment out handling of base_font_name.
Rename `postscript' field to `embedded_postscript'
* src/cff/cfftypes.h (CFF_FontRecDictRec): Remove `base_font_name'
and `postscript'.
2003-12-11 17:55:58 +00:00
Werner Lemberg cb3fd79b66 * src/pcf/pcfdrivr.c (pcf_get_charset_id): New function (a clone
of the similar BDF function).
(pcf_service_bdf): Use it.
2003-12-11 06:55:59 +00:00
Werner Lemberg 00915574c3 * src/base/ftobjs.c (load_mac_face): Recent versions of Linux
support Mac's HFS+ file system, thus enable code to read /rsrc on
non-Macintosh platforms also.
2003-12-10 22:10:16 +00:00
Werner Lemberg 25ab491d55 * src/sfnt/sfobjs.c (sfnt_load_face): Set FT_FACE_FLAG_GLYPH_NAMES
only if a `post' table is present.
2003-12-10 20:04:50 +00:00
Werner Lemberg dc8ad54f10 * include/freetype/internal/psaux.h (PS_TableRec): Change type
of `lengths' to FT_PtrDist.
(T1_DecoderRec): Change type of `subrs_len' to FT_PtrDist.
* include/freetype/internal/t1types.h (T1_FontRec): Change type
of `subrs_len' and `charstrings_len' to FT_PtrDist.

* src/base/ftobjs.c (Mac_Read_POST_Resource): Replace `junk'
variable with better solution.
(IsMacResource): Remove unused variable `map_len'.
Replace `junk' variable with better solution.
(FT_Open_Face) [!FT_MACINTOSH]: Add conditional
FT_CONFIG_OPTION_MAC_FONTS.

* src/autohint/ahhint.c (ah_hinter_hint_edges,
ah_hinter_align_strong_points): Add some casts.

* src/base/ftoutln.c (FT_OrientationExtremumRec): Change type
of `pos' to FT_Long.

* src/base/ftobjs.c (Mac_Read_POST_Resource,
Mac_Read_sfnt_Resource): Change type of `len' to FT_Long.

* src/type42/t42parse.c (t42_parse_dict): Add cast for `n_keywords'.
2003-12-09 02:12:14 +00:00
Werner Lemberg 60217b7acd * docs/raster.txt: New file, taken from FreeType 1 and completely
revised.
2003-12-08 21:11:31 +00:00
Werner Lemberg f0b752072d * src/type1/t1driver.c (Get_Interface): Remove FT_UNUSED for
t1_interface.  t1_interface is used.
2003-12-05 10:24:59 +00:00
Werner Lemberg 4e1f5a663c Fix ChangeLog. 2003-12-03 15:04:50 +00:00
Werner Lemberg d90b67384d Documentation fix. 2003-11-28 22:47:26 +00:00
Werner Lemberg b8bae640cd Fix ChangeLog. Formatting. 2003-11-28 22:01:02 +00:00
David Turner a77f713db5 * src/pfr/pfrdrivr.c (pfr_get_metrics): reverting to previous
behaviour. Werner's "fix" was incorrect !!
2003-11-27 21:01:24 +00:00
Werner Lemberg 6f20dd505f * src/base/ftcalc.c, include/freetype/internal/ftcalc.h
(FT_MulDiv_No_Round): Surround code with `#ifdef
TT_CONFIG_OPTION_BYTECODE_INTERPRETER ... #endif'.
2003-11-26 08:24:08 +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 4ff243d90a Fix ChangeLog. Update `CHANGES' file. 2003-11-25 09:30:57 +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 ff9d2415a7 * src/autofit/*: more updates 2003-11-23 21:39:51 +00:00
Werner Lemberg 03f06f0f08 * src/bdf/bdfdrivr.c (bdf_interpret_style), src/pcf/pcfread.c
(pcf_interpret_style): Replace spaces with dashes in properties
SETWIDTH_NAME and ADD_STYLE_NAME to simplify parsing.
2003-11-15 17:44:13 +00:00
Werner Lemberg 51ecb69a88 * docs/CHANGES: Updated.
Handle SETWIDTH_NAME and ADD_STYLE_NAME properties for BDF and PCF
fonts.

* src/bdf/bdfdrivr.c (bdf_interpret_style): New auxiliary function.
(BDF_Face_Init): Don't handle style properties but call
bdf_interpret_style.

* src/pcf/pcfread.c (pcf_interpret_style): New auxiliary function.
(pcf_load_font): Don't handle style properties but call
pcf_interpret_style.
2003-11-13 10:19:27 +00:00
Werner Lemberg d88d5419ad Updated. 2003-11-12 15:16:02 +00:00
Werner Lemberg 5f5f6b3662 Fix documentation error. 2003-11-12 15:15:49 +00:00
Werner Lemberg 56b886620f * include/freetype/freetype.h (FREETYPE_PATCH): Set to 7. 2003-11-09 08:38:13 +00:00
Werner Lemberg e42dbcec21 * Version 2.1.7 released.
=========================


* builds/unix/ft2unix.h: Fix comments.

* builds/unix/ftconfig.in: Synchronized with ANSI version.
Use `#undef' in templates as recommended in the autoconf
documentation.
Since real `#undef' lines don't survive during configuration, use
`/undef' instead; the postprocessing facility of the
AC_CONFIG_HEADERS autoconf macro converts them to `#undef'.

* builds/unix/install.mk (install): Install Unix version of
`ftconfig.h'.

* builds/unix/unix-cc.in (CFLAGS): Set FT_CONFIG_CONFIG_H macro
to include the correct `ftconfig.h' file.

* builds/unix/ft-munmap.m4 (FT_MUNMAP_DECL): Removed.
(FT_MUNMAP_PARAM): Updated syntax to autoconf 2.59.

* builds/unix/freetype2.m4: Updated syntax to autoconf 2.59.

* builds/unix/configure.ac: Use AC_CONFIG_HEADERS instead of
AC_CONFIG_HEADER to create ftconfig.h, and use second argument
to replace `/undef' with `#undef'.
Don't use FT_MUNMAP_DECL but AC_CHECK_DECLS to check for munmap.
Use AS_HELP_STRING in AC_ARG_WITH.
Update syntax to autoconf 2.59.

* builds/unix/ltmain.sh: Regenerated with `libtoolize --force
--copy' from libtool 1.5.
* builds/unix/aclocal.m4: Regenerated with `aclocal -I .' from
automake 1.7.8.
* builds/unix/configure: Regenerated with autoconf 2.59.
* builds/unix/config.guess, builds/unix/config.sub: Updated from
`config' CVS module at subversions.gnu.org
* builds/unix/install-sh, builds/unix/mkinstalldirs: Updated from
`texinfo' CVS module at subversions.gnu.org.

* builds/vms/ftconfig.h: Synchronized with ANSI version.

* docs/CUSTOMIZE: Fix documentation error.
* docs/CHANGES, docs/VERSION.DLL, docs/release: Updated.

* builds/freetype.mk (refdoc): Updated --title.
2003-11-09 08:37:14 +00:00
David Turner 5671e6eef9 * Version 2.1.5 released.
=========================


        * updating README and docs/VERSION.DLL, re-tagging VER-2-1-6
2003-11-08 10:15:51 +00:00
David Turner 700a32ee1c removing "install"
tagging VER-2-1-6
2003-11-06 20:31:27 +00:00
Werner Lemberg 666e3865c6 Mention GPL version. 2003-11-06 14:56:11 +00:00
Werner Lemberg 82906bfb1a * src/sfnt/sfdriver.c: Include FT_SERVICE_SFNT_H.
(sfnt_service_sfnt_table): New service.
(sfnt_services): Updated.

* docs/license.txt: Reworded.
2003-11-04 18:24:20 +00:00
Werner Lemberg ab3e914000 * include/freetype/*: Add a guard to all public header files which
load FT_FREETYPE_H to reject freetype.h from FreeType 1.
2003-11-04 07:44:19 +00:00
Werner Lemberg 9669c52a30 * builds/unix/freetype2.m4, builds/unix/ft-munmap.m4: Protect
first argument of AC_DEFUN with brackets to avoid possible
expansion.
2003-11-04 01:31:26 +00:00
Werner Lemberg adffc13e8a * include/freetype/cache/ftcglyph.h: Don't include stddef.h.
* include/freetype/freetype.h: Fix check for ft2build.h.
2003-11-03 20:12:39 +00:00
Werner Lemberg 55ca408288 * src/base/fttype1.c (FT_Get_PS_Font_Info): Fix incorrectly applied
patch.
2003-11-02 09:07:21 +00:00
Werner Lemberg 3f7ff6afbe * include/freetype/freetype.h: Check that ft2build.h has been
loaded first.
2003-11-02 08:58:53 +00:00
Werner Lemberg 40bb0964f2 * src/base/fttype1.c (FT_Get_PS_Font_Info, FT_Has_PS_Glyph_Names):
Fix parameter order in calls to FT_FACE_FIND_SERVICE.

* include/freetype/internal/ftserv.h
(FT_SERVICE_POSTSCRIPT_NAMES_H): Removed.  Unused.

* src/type42/t42drivr.c (t42_services): Updated.
2003-11-01 14:36:20 +00:00
David Turner 7760595f84 * include/freetype/internal/bdftypes.h: removed obsolete header
* include/freetype/internal/cfftypes.h, src/cff/cfftypes.h,
        src/cff/cffload.h, src/cff/cffobjs.h, src/cff/cffparse.h,
        include/freetype/internal/services/svbdf.h: moving "cfftypes.h" from
        'include/freetype/internal' to 'src/cff' since no other modules needs
        to known about these types

        * include/freetype/internal/t42types.h,
        include/freetype/internal/internal.h, src/type42/t42objs.h,
        src/type42/t42drivr.c, src/type42/t42types.h: moving "t42types.h" from
        'include/freetype/internal' to 'src/type42' since no other modules needs
        to known about these types

        * src/gzip/infblock.c: removing compiler warning

        * include/freetype/internal/services/svpsinfo.h,
        include/freetype/internal/ftserv.h, src/cff/cffdrivr.c,
        src/cid/ciddrivr.c, src/type1/t1driver.c, src/type42/t42drivr.c,
        src/base/fttype1.c: migrating to FT_SERVICE_ID_POSTSCRIPT_INFO defined
        in "svpsinfo.h", removing some sad hacks.
2003-10-29 21:43:52 +00:00
Werner Lemberg 4795b36cf9 * src/type1/t1load.c (parse_encoding): Handle `/Encoding [ ... ]'.
* src/type1/t1parse.c (T1_Get_Private_Dict): Test whether `eexec'
is real.

* src/type42/t42parse.c (t42_parse_encoding): Improve boundary
checking while parsing.

* docs/CHANGES: Updated.
2003-10-23 16:24:10 +00:00
Werner Lemberg 1c0b8e9d72 Only whitespace changes. 2003-10-23 04:54:14 +00:00
Werner Lemberg 3061e893ce * include/freetype/internal/t1types.h (T1_FontRec): `paint_type'
and `stroke_width' aren't pointers.

* src/type42/t42objs.c (T42_Face_Done), src/type1/t1objs.c
(T1_Face_Done): Don't free `paint_type' and `stroke_width'.
2003-10-22 20:24:47 +00:00
Werner Lemberg 80fff78dc6 * src/winfonts/winfnt.c (fnt_cmap_class): Fix position of `const'. 2003-10-21 06:53:19 +00:00
Werner Lemberg 862b4d5a1f Updated. 2003-10-20 08:30:23 +00:00
Werner Lemberg 17d7581918 * src/autohint/ahhint.c (ah_hinter_load_glyph): Patch from
2003-08-18 introduced a severe bug (FT_Render_Glyph was called
twice under some circumstances, causing strange results).  This
is fixed now by clearing the FT_LOAD_RENDER bit of `load_flags'.

* src/base/ftpfr.c (FT_Get_PFR_Metrics): Initialize `error'.
* src/psaux/psobjs.c (ps_tobytes): Initialize `n'.
* src/type42/t42parse.c (t42_parse_sfnts): Initialize `string_size'.
2003-10-20 08:29:46 +00:00
Werner Lemberg 7418415f48 Minor documentation improvements. 2003-10-18 16:56:13 +00:00
Werner Lemberg e3f41982a2 Completely revised Type 42 parser. It now handles both fonts
produced with ttftot42 (tested version 0.3.1) and
TrueTypeToType42.ps (tested version May 2001; it is necessary to
fix the broken header comment to be `%!PS-TrueTypeFont...').

* src/type42/t42objs.c (T42_GlyphSlot_Load): Change fourth
parameter to `FT_UInt'.
* src/type42/t42objs.h: Updated.

* src/type42/t42parse.h (T42_ParserRec): Change type of `in_memory'
to FT_Bool.
(T42_Loader): Change type of `num_chars' and `num_glyphs' to
FT_UInt.
Add `swap_table' element.
* src/type42/t42parse.c (T42_KEYWORD_COUNT, T1_ToFixed,
T1_ToCoordArray, T1_ToTokenArray): Removed.
(T1_ToBytes): New macro.
(t42_is_alpha, t42_hexval): Removed.
(t42_is_space): Handle `\0'.
(t42_parse_encoding): Updated to use new PostScript parser routines
from psaux.
Handle `/Encoding [ ... ]' also.
(T42_Load_Status): New enumeration.
(t42_parse_sfnts): Updated to use new PostScript parser routines
from psaux.
(t42_parse_charstrings): Updated to use new PostScript parser
routines from psaux.
Handle `/CharStrings << ... >>' also.
Don't expect that /.notdef is the first element in dictionary.  Copy
code from type1 module to handle this.
(t42_parse_dict): Updated to use new PostScript parser routines
from psaux.
Remove code for synthetic fonts (which can't occur in Type 42
fonts).
(t42_loader_done): Release `swap_table'.

* src/psaux/psobjs.c (skip_string): Increase `cur' properly.

* src/type1/t1load.c (parse_charstrings): Make test for `.notdef'
faster.
2003-10-16 15:48:39 +00:00
Werner Lemberg 15ee9b5542 * src/autohint/ahglobal.c (blue_chars), src/winfonts/winfnt.c
(fnt_cmap_class_rec, fnt_cmap_class), src/bdf/bdflib.c (empty,
_num_bdf_properties), src/gzip/infutil.c (inflate_mask),
src/gzip/inffixed.h (fixed_bl, fixed_bd, fixed_tl, fixed_td),
src/gzip/inftrees.h (inflate_trees_fixed), srf/gzip/inftrees.c
(inflate_trees_fixed): Decorate with more `const' to avoid
writable global variables which are disallowed on ARM.
2003-10-15 22:20:56 +00:00
Werner Lemberg 5131692505 Formatting. 2003-10-13 06:08:13 +00:00
Werner Lemberg 38c4647427 * src/type1/t1load.c (parse_font_matrix, parse_charstrings): Remove
code specially for synthetic fonts; this is handled elsewhere.
(parse_encoding): Remove code specially for synthetic fonts; this is
handled elsewhere.
Improve boundary checking while parsing.
(parse_dict): Improve boundary checking while parsing.
Use ft_memcmp to simplify code.
2003-10-13 05:58:54 +00:00
Werner Lemberg ed3a7d7b0f * src/type1/t1load.c (parse_dict): Handle synthetic
fonts properly.
(parse_charstrings): Copy correct number of characters into
`name_table'.
2003-10-07 20:06:35 +00:00
Werner Lemberg 34808199ce * src/type1/t1load.c (parse_subrs, parse_dict): Handle synthetic
fonts properly.
2003-10-07 11:54:03 +00:00
Werner Lemberg 52f911a12d Heavy modification of the PS parser to handle comments and strings
correctly.  This doesn't slow down the loading of PS fonts
significantly since charstrings aren't affected.

* include/freetype/config/ftstdlib.h (ft_xdigit): Renamed to...
(ft_isxdigit): This.  Updated all callers.
(ft_isdigit): New alias to `isdigit'.

* include/freetype/internal/psaux.h (PS_Parser_FuncsRec): Renamed
`skip_alpha' to `skip_PS_token'.
Add parameter to `to_bytes' and change some argument types.

* src/psaux/psauxmod.c (ps_parser_funcs): Updated.
* src/psaux/psobjs.c (ft_char_table): New array to map character
codes (ASCII and EBCDIC) of digits to numbers.
(OP): New auxiliary macro holding either `>=' or `<' depending on
the character encoding.
(skip_comment): New function.
(skip_spaces): Use it.
(skip_alpha): Removed.
(skip_literal_string, skip_string): New functions.
(ps_parser_skip_PS_token): New function.  This is a better
replacement of...
(ps_parser_skip_alpha): Removed.
(ps_parser_to_token, ps+parser_to_token_array): Updated.
(T1Radix): Rewritten, using `ft_char_table'.
(t1_toint): Renamed to...
(ps_toint): This.  Update all callers.
Use `ft_char_table'.
(ps_tobytes): Add parameter to handle delimiters and change some
argument types.
Use `ft_char_table'.
(t1_tofixed): Renamed to...
(ps_tofixed): This.  Update all callers.
Use `ft_char_table'.
(t1_tocoordarray): Renamed and updated to...
(ps_tocoordarray): This.  Update all callers.
(t1_tofixedarray): Renamed and updated to...
(ps_tofixedarray): This.  Update all callers.
(t1_tobool): Renamed to...
(ps_tobool): This.  Update all callers.
(ps_parser_load_field): Updated.
(ps_parser_load_field_table): Use `T1_MAX_TABLE_ELEMENTS'
everywhere.
(ps_parser_to_int, ps_parser_to_fixed, ps_parser_to_coord_array,
ps_parser_to_fixed_array): Skip spaces.  Updated.
(ps_parser_to_bytes): Add parameter to handle delimiters and change
some argument types.  Updated.
* src/psaux/psobjs.h: Updated.

* src/cid/cidload.c (cid_parse_dict): Updated.
* src/cid/cidparse.c (cid_parser_new): Check whether the `StartData'
token was really found.
* src/cid/cidparse.h (cid_parser_skip_alpha): Updated and renamed
to...
(cid_parser_skip_PS_token): This.

* src/type1/t1parse.h (T1_ParserRec): Use `FT_Bool' for boolean
fields.
(T1_Skip_Alpha): Replaced with...
(T1_Skip_PS_Token): This new macro.
* src/type1/t1parse.c (hexa_value): Removed.
(T1_Get_Private_Dict): Use `ft_isxdigit' and
`psaux->ps_parser_funcs_to_bytes' for handling ASCII hexadecimal
encoding.
After decrypting, replace the four random bytes at the beginning
with whitespace.
* src/type1/t1load.c (t1_allocate_blend): Use proper error values.
(parser_blend_design_positions, parse_blend_design_map,
parse_weight_vector): Updated.
(is_space): Handle `\f' also.
(is_name_char): Removed.
(read_binary_data): Updated.
(parse_encoding): Use `ft_isdigit'.
Updated.
(parse_subrs): Updated.
(TABLE_EXTEND): New macro.
(parse_charstrings): Updated.
Provide a workaround for buggy fonts which have more entries in the
/CharStrings dictionary then expected; the function now adds some
slots and skips entries which still exceed the new limit.
(parse_dict): Updated.
Terminate on the token `closefile'.

* src/type42/t42parse.c (T1_Skip_Alpha): Replaced with...
(T1_Skip_PS_Token): This new macro.  Updated all callers.
(t42_parse_encoding): Use `ft_isdigit'.


* src/base/ftmm.c (ft_face_get_mm_service): Return FT_Err_OK if
success.
2003-10-07 05:49:41 +00:00
Werner Lemberg d0cb15f1db Delete include/freetype/ftmodule.h. Fix typo. 2003-10-05 09:57:21 +00:00
Werner Lemberg ac3622048f * include/freetype/ftmodule.h: Renamed to...
* include/freetype/ftmodapi.h: This to avoid duplicate file names.
* include/freetype/config/ftheader.h (FT_MODULE_H): Updated.
2003-10-05 09:55:58 +00:00
Werner Lemberg 2ea0d9fb64 * src/base/ftoutln.c (FT_OrientationExtremumRec,
FT_Outline_Get_Orientation): Trivial typo fixes to make it compile.
2003-10-05 07:54:00 +00:00
Werner Lemberg 13472b38d3 * src/winfonts/winfnt.c (FT_WinFNT_HeaderRec): `color_table_offset'
has four bytes, not two.
Fix all users.
(fnt_font_load, FNT_Load_Glyph): Add more font validity tests.
2003-10-02 21:36:18 +00:00
David Turner d25ad56d78 * src/autofit/*: adding first sources of the new multi-script
"auto-fitter"

        * include/freetype/ftoutln.h, src/base/ftoutln.c: adding the
        definition of FT_Outline_Get_Orientation, used to compute the
        fill orientation of a given glyph outline.

        * include/freetype/internal/ftserv.h: fixed trivial bug which
        could crashed the font engine when a cached service pointer was
        retrieved with FT_FACE_LOOKUP_SERVICE
2003-10-02 21:07:10 +00:00
Werner Lemberg d393ca3738 Updated copyright years. 2003-09-30 07:00:42 +00:00
Werner Lemberg c67f55599b Version 2.1.5 is released. 2003-09-30 06:52:24 +00:00
Werner Lemberg 3864f4eae9 * src/cid/cidload.c (cid_parse_dict): Skip token if no keyword is
found.

* src/type1/t1parse.c (IS_T1_WHITESPACE, IS_T1_LINESPACE,
IS_T1_SPACE): Removed.
(PFB_Tag): Removed.
(read_pfb_tag): Don't use PFB_Tag.

* src/type42/t42parse.c (t42_is_space): Handle `\f' also.
(t42_parse_encoding): Handle synthetic fonts.
2003-09-30 06:43:54 +00:00
Werner Lemberg f4c0b921a1 * include/freetype/internal/t1types.h: Don't include
FT_INTERNAL_OBJECTS_H but FT_INTERNAL_SERVICE_H.
* src/truetype/ttobjs.c: Don't include
FT_SERVICE_POSTSCRIPT_NAMES_H.
2003-09-30 05:39:35 +00:00
David Turner c4ec973160 * src/base/ftglyph.c (FT_Get_Glyph): fixing small bug, thanks
to Henry Maddocks for spotting this
2003-09-29 20:35:34 +00:00
David Turner b72d8a8521 * include/freetype/internal/services/svpsname.h (added),
include/freetype/internal/psnames.h (removed),
        include/freetype/internal/internal.h (FT_SERVICE_POSTSCRIPT_NAMES):

          added new service to handle glyph name dictionaries, replacing
          the old internal header named "psnames.h" by "services/svpsname.h"
          note that this is different from "services/svpostnm.h" which only
          handles the retrieval of Postscript font name for a given face.
          (should we merge these two services into a single header ??)


        * include/freetype/internal/ftserv.h: adding
        FT_FACE_FIND_GLOBAL_SERVICE (used to lookup a service globally,
        instead of only within the current module)

        * include/freetype/internal/ftobjs.h, src/base/ftobjs.c: adding
        the new base function ft_module_get_service
2003-09-29 20:33:37 +00:00
Werner Lemberg a259b6dddb * include/freetype/internal/ftserv.h (FT_FACE_FIND_SERVICE):
Fix compilation warning (s/pptr/Pptr/).

* include/freetype/internal/internal.h (FT_INTERNAL_PFR_H,
FT_INTERNAL_FNT_TYPES_H): Removed.
2003-09-22 09:53:56 +00:00
David Turner e2d12842e1 * include/freetype/internal/fnttypes.h,
include/freetype/internal/ftserv.h, src/base/ftbdf.c, src/base/ftmm.c,
        src/base/ftobjs.c, src/base/ftpfr.c, src/base/ftwinfnt.c,
        src/base/ftxf86.c, src/pfr/pfrdrivr.c, src/winfonts/winfnt.c,
        src/winfonts/winfnt.h, include/freetype/internal/service/svwinfnt.h,:

          simplification of service lookup macros, updating the PFR and
          WINFNT font drivers to new services
2003-09-21 17:15:55 +00:00
David Turner 17dd0634f2 * include/freetype/internal/ftserv.h,
include/freetype/internal/service/svpfr.h,
        include/freetype/internal/pfr.h,
        src/base/ftpfr.c:

          migrating the functions of "ftpfr.h" to the new
          service-base internal API

        * src/cff/cffobjs.c, src/cid/cidobjs.c, src/pfr/pfrsbit.c,
        src/psaux/psobjs.c, src/sfnt/sfdriver.c, src/sfnt/sfobjs.c,
        src/truetype/ttobjs.c, src/type1/t1driver.c, src/type1/t1objs.c,
        src/type42/t42objs.c, src/winfonts/winfnt.c:

          removing various compiler warnings
2003-09-21 16:04:05 +00:00
Werner Lemberg 99ee499ef8 * docs/CHANGES: Updated. 2003-09-20 17:23:36 +00:00
Werner Lemberg a126d4c2ef * src/type1/t1parse.c (pfb_tag_fields): Removed.
(read_pfb_tag): Fix code so that it doesn't fail on end-of-file
indicated (0x8003).
2003-09-20 14:25:10 +00:00
Werner Lemberg 46333a118f * include/freetype/internal/ftserv.h (FT_FACE_FIND_SERVICE,
FT_FACE_LOOKUP_SERVICE): Add parameter to pass pointer type.
Ugly, I know, but this is needed for compilation with C++ --
maybe someone knows a better solution?
Updated all callers.

* src/base/ftobjs.c (FT_Get_Name_Index, FT_Get_Glyph_Name): Remove
C++ compiler warnings.

* src/base/ftbdf.c (FT_Get_BDF_Charset_ID, FT_Get_BDF_Property):
Fix order of arguments passed to FT_FACE_FIND_SERVICE.
2003-09-17 19:20:02 +00:00
Werner Lemberg 013efd1410 Formatting. 2003-09-17 05:26:33 +00:00
Werner Lemberg 104dd41d96 * include/freetype/internal/services/bdf.h: Renamed to...
* include/freetype/internal/services/svbdf.h: This.
Add copyright notice.
* include/freetype/internal/services/glyfdict.h: Renamed to...
* include/freetype/internal/services/svgldict.h: This.
Add copyright notice.
* include/freetype/internal/services/multmast.h: Renamed to...
* include/freetype/internal/services/svmm.h: This.
Add copyright notice.
Add FT_BEGIN_HEADER and FT_END_HEADER.
* include/freetype/internal/services/sfnt.h: Renamed to...
* include/freetype/internal/services/svsfnt.h: This.
Add copyright notice.
* include/freetype/internal/services/postname.h: Renamed to...
* include/freetype/internal/services/svpostnm.h: This.
Add copyright notice.
* include/freetype/internal/services/xf86name.h: Renamed to...
* include/freetype/internal/services/svxf86nm.h: This.
Add copyright notice.

* include/freetype/internal/ftserv.h: Add FT_BEGIN_HEADER and
FT_END_HEADER.
Add copyright notice.
Update macro names of services header files.

* builds/freetype.mk (SERVICES_DIR): New variable.
(BASE_H): Add services header files.
2003-09-16 07:57:25 +00:00
Werner Lemberg 754d558893 * src/cff/cffcmap.c: Include `cfferrs.h'.
* src/pfr/pfrdrivr.c: Include `pfrerror.h'.
* src/sfnt/sfdriver.c: Include `sferrors.h'.
* src/psaux/psobjs.h: Add declaration for `ps_parser_to_bytes'.
2003-09-12 20:32:51 +00:00
Werner Lemberg 5e3614f584 * builds/toplevel.mk (distclean): Remove `builds/unix/freetype2.pc'.
* src/cff/cffdrivr.c: Don't load headers twice.

* include/freetype/internal/ftserv.h (FT_SERVICE_SFNT_H): New macro.
* src/base/ftobjs.c: Include FT_SERVICE_SFNT_H.
2003-09-12 19:38:13 +00:00
David Turner db3faffbcf * README, builds/unix/configure, builds/unix/configure.ac,
docs/CHANGES, include/freetype/freetype.h:

          updating version numbers for 2.1.6, and removing obsolete
          warnings in the documentation

        * include/freetype/internal/ftcore.h,
        include/freetype/internal/ftexcept.h,
        include/freetype/internal/fthash.h,
        include/freetype/internal/ftobject.h:

          removing obsolete files
2003-09-11 19:58:19 +00:00
David Turner c313c50208 * include/freetype/ftmm.h, include/freetype/ftmodule.h,
include/freetype/tttables.h, include/freetype/config/ftconfig.h,
          include/freetype/internal/ftobjs.h,
          include/freetype/internal/ftserv.h,
          include/freetype/internal/internal.h,
          include/freetype/internal/sfnt.h,
          include/freetype/internal/tttypes.h,
          include/freetype/internal/services/bdf.h,
          include/freetype/internal/services/glyfdict.h,
          include/freetype/internal/services/multmast.h,
          include/freetype/internal/services/postname.h,
          include/freetype/internal/services/sfnt.h,
          include/freetype/internal/services/xf86name.h,
          src/base/ftbdf.c, src/base/ftmm.c, src/base/ftobjs.c,
          src/base/ftxf86.c, src/bdf/bdfdrivr.c, src/cff/cffdrivr.c,
          src/cid/cidriver.c, src/pcf/pcfdrivr.c, src/sfnt/sfdriver.c,
          src/truetype/ttdriver.c, src/type1/t1driver.c, src/type42/t42drivr.c:

          heavy internal modifications to introduce the concept of
          "module services". This is the first step towards a massive
          simplification of the engine's internals, in order to
          get rid of various numbers of hacks.

          Note that this changes will break source & binary compatibility
          for authors of external font drivers.

          Maybe 2.1.6 will be called 2.2.0 after all :-)
2003-09-11 19:51:54 +00:00
David Turner 7d90a4f05c * src/base/ftpfr.c, src/pfr/pfrtypes.h, src/pfr/pfrload.c,
src/pfr/pfrobjs.c: fixing PFR kerning support. The tables within
        the font file contain (charcode,charcode) kerning pairs, we need
        to convert them to (gindex,gindex) !

        * include/freetype/ftoption.h: commenting out the macro
        TT_CONFIG_OPTION_BYTECODE_INTERPRETER
2003-09-09 20:11:56 +00:00
David Turner 7543f394f7 updating documentation to warn about potential binary compatibility problems 2003-09-01 21:18:03 +00:00
Werner Lemberg ed2a8df000 * src/bdf/bdflib.c (_bdf_readstream): Don't use FT_MEM_COPY but
FT_MEM_MOVE.

* include/freetype/freetype.h (FT_ENCODING_SJIS, FT_ENCODING_GB2312,
FT_ENCODING_BIG5, FT_ENCODING_WANSUNG, FT_ENCODING_JOHAB): New
enumerations of FT_Encoding.  The FT_ENCODING_MS_* variants except
FT_ENCODING_MS_SYMBOL are now deprecated.
Updated all users.
* docs/CHANGES: Document it.
2003-09-01 07:06:06 +00:00
Werner Lemberg cc823200c1 * src/bdf/bdfdrivr.c (BDF_Face_Init): Accept lowercase characters
for spacing.

* src/pcf/pcfread.c (pcf_load_font), src/bdf/bdfdrivr.c
(BDF_Face_Init): Accept lowercase characters for slant and weight.
2003-08-28 10:57:05 +00:00
Werner Lemberg 2bb6ee32c2 Some clean-up. 2003-08-18 08:23:40 +00:00
David Turner fc3da857a9 * include/freetype/config/ftoption.h: disabling TrueType bytecode
interpreter, until the UNPATENTED_HINTING works as advertised
2003-08-17 23:03:36 +00:00
David Turner 5cb5b4c9c3 * src/autohint/ahhint.c (ah_hinter_load_glyph): fixed bug 2003-08-17 23:00:59 +00:00
David Turner 3c40d73d2c * Jamfile: adding the "refdoc" target to the Jamfile in order to
build the API Reference in "docs/reference" automatically

        * include/freetype/t1tables.h, src/cid/cidtoken.h, src/type1/t1tokens.h,
        src/type42/t42parse.c:

        re-setting the types of "italic_angle", "underline_position" and
        "underline_thickness" to their previous values (i.e. long, short and
        ushort), in order to avoid breaking binary compatibility

        * include/freetype/ttunpath.h: fixing documentation comment
2003-08-17 22:31:23 +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 0f4eb3d03d Fix ChangeLog. 2003-08-16 13:17:00 +00:00
Werner Lemberg e52c4ba178 * src/type1/t1gload.c (T1_Load_Glyph), src/cff/cffgload.c
(cff_slot_load), src/cid/cidgload.c (cid_slot_load_glyph): Fix
previous change.
2003-08-06 17:27:14 +00:00
Werner Lemberg e8ff769c7f * src/type1/t1gload.c (T1_Load_Glyph), src/cff/cffgload.c
(cff_slot_load), src/cid/cidgload.c (cid_slot_load_glyph): Apply
font matrix to advance also.
* docs/CHANGES: Updated.
2003-08-06 04:40:48 +00:00
Werner Lemberg 42284f98f2 * builds/unix/configure.ac (version_info): Set to 9:4:3.
* builds/unix/configure: Updated.
* docs/CHANGES, docs/VERSION.DLL: Updated.

* include/freetype/freetype.h (FT_GlyphSlot): Change 2003-06-16
also breaks binary compatibility.  Reintroduce an unsigned integer
at the old position of `flags' called `reserved'.
2003-07-26 06:08:14 +00:00
Werner Lemberg f1c7814718 * src/tools/docmaker/tohtml.py
(chapter_inter, chapter_footer): Add <li> and use special <ul>
class.
(toc_exit): Don't emit </table>.
2003-07-25 22:55:59 +00:00
Werner Lemberg d18e01352c (code_header, code_footer): Don't change font colour directly but
use a special <pre> class.
2003-07-25 22:21:57 +00:00
Werner Lemberg 64f1ba9064 Make reference valid HTML 4.01 transitional.
* src/tools/docmaker/tohtml.py (html_header_1): Add doctype
and charset.
(html_header_2): Fix style elements and add some more.
Fix syntax.
(block_header, block_footer, description_header, description_footer,
marker_header, marker_footer, source_header, source_footer,
chapter_header, chapter_footer): Don't use <center>...</center> but
`align=center' table attribute.
Use double quotes around table widths given in percent.
(keyword_prefix, keyword_suffix): Don't change font colour directly
but use a new <span> class.
(section_synopsis_header, section_synopsis_footer): Don't change
colour.
(print_html_field): <tr> gets the `valign' attribute, not <table>.
(print_html_field_list): Ditto.
(index_exit): Don't use <center>...</center> but `align=center'
table attribute.
(toc_exit, section_enter): Ditto.
(block_enter): Use <h4><a>, not <a><h4>.


This change reimplements fix from 2003-05-30 without breaking
binary compatibility.

* include/freetype/t1tables.h (PS_FontInfoRec): `italic_angle',
`is_fixed_pitch', `underline_position', `underline_thickness' are
reverted to be normal values.

* include/freetype/internal/psaux.h (T1_FieldType): Remove
`T1_FIELD_TYPE_BOOL_P', `T1_FIELD_TYPE_INTEGER_P',
`T1_FIELD_TYPE_FIXED_P', `T1_FIELD_TYPE_FIXED_1000_P'.
(T1_FIELD_TYPE_BOOL_P, T1_FIELD_NUM_P, T1_FIELD_FIXED_P,
T1_FIELD_FIXED_1000_P): Removed.
(T1_FIELD_TYPE_BOOL): Renamed to...
(T1_FIELD_BOOL): New macro.  Updated all callers.

* src/type42/t42parse.c: `italic_angle', `is_fixed_pitch',
`underline_position', `underline_thickness', `paint_type',
`stroke_width' are reverted to be normal values.
(T42_KEYWORD_COUNT): New macro.
(t42_parse_dict): New array `keyword_flags' to mark that a value has
already been assigned to a dictionary entry.
* src/type42/t42objs.c (T42_Face_Init, T42_Face_Done): Updated.

* src/cid/cidtoken.h: `italic_angle', `is_fixed_pitch',
`underline_position', `underline_thickness' are reverted to be
normal values.
* src/cid/cidobjs.c (cid_face_done, cid_face_init): Updated.

* src/psaux/psobjs.c (ps_parser_load_field): Updated.

* src/type1/t1tokens.h: `italic_angle', `is_fixed_pitch',
`underline_position', `underline_thickness', `paint_type',
`stroke_width' are reverted to be normal values.
* src/type1/t1objs.c (T1_Face_Done, T1_Face_Init): Updated.
* src/type1/t1load.c (T1_FIELD_COUNT): New macro.
(parse_dict): Add parameter for keyword flags.
Record only first instance of a field.
(T1_Open_Face): New array `keyword_flags'.
2003-07-25 22:09:53 +00:00
Werner Lemberg f9d864a916 * include/freetype/freetype.h (FREETYPE_PATCH): Set to 5.
* builds/unix/configure.ac (version_info): Set to 10:0:3.
* builds/unix/configure: Updated.
* builds/freetype.mk (refdoc): Fix --title.

* docs/CHANGES, docs/VERSION.DLL, README: Updated.

* src/tools/docmaker/sources.py (re_crossref): Fix regular
expression to handle trailing punctuation characters.
* src/tools/docmaker/tohtml.py (make_html_word): Updated.

* docs/release: New file.
2003-07-25 05:57:21 +00:00
Werner Lemberg 850fee2ccb * include/freetype/internal/psaux.h (PS_Parser_FuncsRec): New
member function `to_bytes'.

* src/psaux/psauxmod.c (ps_parser_funcs): New member
`ps_parser_to_bytes'.
(psaux_module_class): Increase version to 0x20000L.

* src/psaux/psobjs.c (IS_T1_LINESPACE): Add \f.
(IS_T1_NULLSPACE): New macro.
(IS_T1_SPACE): Add it.
(skip_spaces, skip_alpha): New functions.
(ps_parser_skip_spaces, ps_parser_skip_alpha): Use them.
(ps_tobytes, ps_parser_to_bytes): New functions.
2003-07-24 06:16:21 +00:00
Werner Lemberg acf592e72f New file. 2003-07-09 15:24:09 +00:00
Werner Lemberg 0941ccd762 dummy files 2003-07-09 15:22:39 +00:00
Werner Lemberg d97ade8f60 Initial revision 2003-07-09 15:22:39 +00:00
Werner Lemberg 6aa35cd5e8 * builds/freetype.mk (DOC_DIR): New variable.
(refdoc): Use *_DIR variables.
(distclean): Remove documentation files.

* builds/detect.mk (std_setup, dos_setup): Mention `make refdoc'.

* configure: Set DOC_DIR variable.

* builds/freetype.mk (refdoc): New target to build the
documentation.
(.PHONY): Updated.

* include/freetype/freetype.h: Improve documentation of FT_CharMap.
* include/freetype/ftimage,h: Fix documentation of FT_OUTLINE_FLAGS.
* include/freetype/tttables.h: Document FT_Sfnt_Tag.
2003-07-09 15:20:32 +00:00
Werner Lemberg 8292815bb9 * src/bdf/bdfdrivr.c (BDF_Face_Init), src/pcf/pcfread.c
(pcf_load_font): Fix computation of height if PIXEL_SIZE property is
missing.
2003-07-07 07:35:15 +00:00
Werner Lemberg 7b0cc663e8 formatting 2003-07-05 07:46:49 +00:00
Werner Lemberg b5e8c90806 formatting, improving documentation 2003-07-03 13:56:28 +00:00
Werner Lemberg 4ee9b7bab1 * src/cache/ftcsbits.c (ftc_sbit_node_compare): Only add `size' if
there is no error.  Reported by Knut St. Osmundsen
<bird-freetype@anduin.net>.
2003-07-02 15:03:36 +00:00
Werner Lemberg 6d79899362 A new try to synchronize bitmap font access.
include/freetype/freetype.h (FT_Bitmap_Size): `height' is now
defined to return the baseline-to-baseline distance.  This was
already the value returned by the BDF and PCF drivers.

The `width' field now gives the average width.  I wasn't able to
find something better.  It should be taken as informative only.

New fields `size', `x_ppem', and `y_ppem'.

* src/pcf/pcfread.c (pcf_load_font): Updated to properly fill
FT_Bitmap_Size.
Do proper rounding and conversion from 72.27 to 72 points.

* src/bdf/bdfdrivr.c (BDF_Face_Init): Updated to properly fill
FT_Bitmap_Size.
Do proper rounding and conversion from 72.27 to 72 points.

* src/sfnt/sfobjs.c (sfnt_load_face): Updated to properly fill
FT_Bitmap_Size.

* src/winfonts/winfnt.c (FNT_Face_Init): Updated to properly fill
FT_Bitmap_Size.

Redesigning the FNT driver to return multiple faces, not multiple
strikes.  At least one font (app850.fon from WinME) contains
different FNT charmaps for its subfonts.  Consequently, the previous
design of having multiple bitmap strikes in a single font face fails
since we have only one charmap per face.

* include/freetype/internal/fnttypes.h (FNT_Size_Rec): Removed.
(FNT_FaceRec): Remove `num_fonts' field and replace `fonts' with
`font'.

* src/base/ftwinfnt.c (FT_Get_WinFNT_Header): Updated.

* src/winfonts/winfnt.c (fnt_font_load): Don't set pixel_width equal
to pixel_height.
(fnt_face_done_fonts): Removed.
(fnt_face_get_dll_fonts): Renamed to...
(fnt_face_get_dll_font): This.  Add second function argument to
select face index.
Updated to load just one subfont.
(fnt_font_done, FNT_Face_Done): Updated.
(FNT_Face_Init): Handle `face_index'.
Updated.
(FNT_Size_Set_Pixels): Simplified; similar to BDF and PCF, the
bitmap width is now ignored.
(FNT_Load_Glyph): Updated.
Fix glyph index computation.
(winfnt_driver_class): Updated.
2003-07-01 07:28:55 +00:00
Owen Taylor 2c8530bd3d 2003-06-25 Owen Taylor <otaylor@redhat.com>
* src/sfnt/ttload.c (tt_face_load_hdmx): Don't assign
        num_records until we actually decide to load the table,
        otherwise, we'll segfault in tt_face_free_hdmx.
2003-06-30 13:08:58 +00:00
Werner Lemberg 3c41447eef * src/cff/cffdrivr.c (cff_get_glyph_name): Protect agains zero
glyph name pointer.  Reported by Mikey Anbary <manbary@vizrt.com>.
2003-06-25 06:13:36 +00:00
Werner Lemberg 43ba0842af * src/tools/glnames.py: Updated to AGL 2.0.
* src/psnames/pstables.h: Regenerated.


* include/freetype/cache/ftcglyph.h, include/freetype/ttnameid.h,
src/base/ftcalc.c, src/base/fttrigon.c, src/cff/cffgload.c,
src/otlayout/otlgsub.c, src/pshinter/pshrec.c,
src/psnames/psmodule.c, src/sfnt/sfobjs.c, src/truetype/ttdriver.c:
Decorate constants with `U' and `L' if appropriate.

* include/freetype/ftmoderr.h: Updated to include recent module
additions.

* src/pshinter/pshnterr.h (FT_ERR_BASE): Define as
`FT_Mod_Err_PShinter'.
* src/type42/t42error.h (FT_ERR_BASE): Define as
`FT_Mod_Err_Type42'.

* src/pshinter/pshrec.h (PS_HINTS_MAGIC): Removed.  Not used.


* include/freetype/config/ftconfig.h [__MWERKS__]: Define FT_LONG64
and FT_INT64.
2003-06-23 19:26:53 +00:00
Werner Lemberg 8ad2c57e6c Add `src/pshinter/pshnterr.h'. 2003-06-22 15:34:38 +00:00
Werner Lemberg 779afe4b91 * src/winfonts/winfnt.c (FNT_Load_Glyph): Use first_char in
computation of glyph_index.
(FNT_Size_Set_Pixels): To find a strike, first check pixel_height
only, then try to find a better hit by comparing pixel_width also.
Without this fix it isn't possible to access all strikes.
Also compute metrics.max_advance to be in sync with other bitmap
drivers.

* src/base/ftobjs.c (FT_Set_Char_Size): Remove redundant code.
(FT_Set_Pixel_Size): Assign value to `metrics' after validation of
arguments.


Synchronize computation of height and width for bitmap strikes.  The
`width' field in the FT_Bitmap_Size structure is now only useful to
enumerate different strikes.  The `max_advance' field of the
FT_Size_Metrics structure should be used to get the (maximum) width
of a strike.

* src/bdf/bdfdrivr.c (BDF_Face_Init): Don't use AVERAGE_WIDTH for
computing `available_sizes->width' but make it always equal to
`available_sizes->height'.

* src/pcf/pcfread.c (pcf_load_font): Don't use RESOLUTION_X for
computing `available_sizes->width' but make it always equal to
`available_sizes->height'.

* src/truetype/ttdriver.c (Set_Pixel_Sizes): Pass only single
argument to function.

* src/psnames/psmodule.c (ps_unicode_value): Handle `.' after
`uniXXXX' and `uXXXX[X[X]]'.


* src/bdf/bdfdrivr.c: s/FT_Err_/BDF_Err/.
* src/cache/ftccache.c, src/cache/ftcsbits.c, src/cache/ftlru.c:
s/FT_Err_/FTC_Err_/.
* src/cff/cffcmap.c: s/FT_Err_/CFF_Err_/.
* src/pcf/pcfdrivr.c: s/FT_Err_/PCF_Err_/.
* src/psaux/t1cmap.c: Include psauxerr.h.
s/FT_Err_/PSaux_Err_/.
* src/pshinter/pshnterr.h: New file.
* src/pshinter/rules.mk: Updated.
* src/pshinter/pshalgo.c, src/pshinter/pshrec.c: Include pshnterr.h.
s/FT_Err_/PSH_Err_/.
* src/pfr/pfrdrivr.c, src/pfr/pfrobjs.c, src/pfr/pfrsbit.c:
s/FT_Err_/PFR_Err_/.
* src/sfnt/sfdriver.c, src/sfnt/sfobjs.c, src/sfnt/ttcmap0.c,
src/sfnt/ttload.c: s/FT_Err_/SFNT_Err_/.
* src/truetype/ttgload.c: s/FT_Err_/TT_Err_/.
* src/gzip/ftgzip.c: Load FT_MODULE_ERRORS_H and define
FT_ERR_PREFIX and FT_ERR_BASE.
s/FT_Err_/Gzip_Err_/.
2003-06-22 15:33:53 +00:00
Werner Lemberg deb5510a54 * src/cff/cffload (cff_encoding_load): `nleft' must be FT_UInt,
otherwise adding 1 might wrap the result.
2003-06-20 07:50:13 +00:00
Werner Lemberg eb17a92a78 * src/psnames/psmodule.c (ps_unicode_value): Add support to
recognize `uXXXX[X[X]]' glyph names.
Don't handle glyph names starting with `uni' which have more than
four digits.
2003-06-20 07:33:20 +00:00
Werner Lemberg 3c7f11a9b7 updated 2003-06-18 07:06:54 +00:00
Werner Lemberg 7a0241049a * include/freetype/freetype.h (FT_Open_Flags): Replaced with
#defines for the constants.
(FT_Open_Args): Change type of `flags' to FT_UInt.
(FT_GlyphSlot): Move `flags' to FT_Slot_Internal.

* include/freetype/ftimage.h (FT_Outline_Flags, FT_Raster_Flag):
Replaced with #defines for the constants.

* include/freetype/internal/ftobjs.h (FT_Slot_Internal): New
field `flags' (from FT_GlyphSlot).
Updated all affected source files.
(FT_GLYPH_OWN_BITMAP): New macro (from ftgloadr.h).

* include/freetype/internal/ftgloadr.h (FT_GLYPH_OWN_BITMAP): Moved
to ftobjs.h.

* src/base/ftglyph.c (FT_Glyph_To_Bitmap): Use dummy
FT_GlyphSlot_Internal object.
2003-06-18 06:59:57 +00:00
Werner Lemberg d726e41c33 * builds/compiler/gcc.mk, builds/compiler/gcc-dev.mk (CFLAGS):
Add -fno-strict-aliasing to get rid of zillion warnings from gcc
version 3.3.
2003-06-17 22:50:09 +00:00
Werner Lemberg 052904e3a0 * include/freetype/ftglyph.h (ft_glyph_bbox_unscaled,
ft_glyph_bbox_subpixels, ft_glyph_bbox_gridfit,
ft_glyph_bbox_truncate, ft_glyph_bbox_pixels): Replaced with
FT_GLYPH_BBOX_UNSCALED, FT_GLYPH_BBOX_SUBPIXELS,
FT_GLYPH_BBIX_GRIDFIT, FT_GLYPH_BBOX_TRUNCATE, FT_GLYPH_BBOX_PIXELS.
The lowercase variants are now (deprecated aliases) to the uppercase
versions.
Updated all other files.

* include/freetype/ftmodule.h (ft_module_font_driver,
ft_module_renderer, ft_module_hinter, ft_module_styler,
ft_module_driver_scalable, ft_module_driver_no_outlines,
ft_module_driver_has_hinter): Replaced with FT_MODULE_FONT_DRIVER,
FT_MODULE_RENDERER, FT_MODULE_HINTER, FT_MODULE_STYLER,
FT_MODULE_DRIVER_SCALABLE, FT_MODULE_DRIVER_NO_OUTLINES,
FT_MODULE_DRIVER_HAS_HINTER.
The lowercase variants are now (deprecated aliases) to the uppercase
versions.
Updated all other files.

* src/base/ftglyph.c (FT_Glyph_Get_CBox): Handle bbox_mode better
as enumeration.

* src/pcf/pcfdrivr.c (pcf_driver_class), src/winfonts/winfnt.c
(winfnt_driver_class), src/bdf/bdfdrivr.c (bdf_driver_class): Add
the FT_MODULE_DRIVER_NO_OUTLINES flag.
2003-06-17 10:42:27 +00:00
Werner Lemberg 6ae53a79db Minor documentation typos. 2003-06-14 21:39:17 +00:00
Werner Lemberg a959c3c960 * src/pfr/pfrobjs.c (pfr_slot_load): Apply font matrix.
* src/cid/cidload.c: Remove parse_font_bbox code (already enclosed
with #if 0 ... #endif).

* src/type1/t1tokens.h: Handle /FontName.
* src/type1/t1load.c (parse_font_name): Removed.
Remove parse_font_bbox code (already enclosed with #if 0 ...
#endif).

* src/type42/t42parse.c (t42_parse_font_name): Removed.
Remove t42_parse_font_bbox code (already enclosed with #if 0 ...
#endif).
(t42_keywords): Handle /FontName with T1_FIELD_KEY.
2003-06-14 07:40:09 +00:00
Werner Lemberg d5553d35f3 * builds/dos/detect.mk: Test not only for `Dos' but for `DOS' also.
* builds/dos/dos-emx.mk, builds/compiler/emx.mk: New files for
EMX gcc compiler.
* builds/dos/detect.mk: Add target `emx'.

* builds/compiler/watcom.mk (LINK_LIBRARY): GNU Make for DOS doesn't
like a trailing semicolon; add a dummy command.
2003-06-13 07:38:22 +00:00
Werner Lemberg 88c0478dce * include/freetype/internal/psaux.h (T1_FieldType): Add
T1_FIELD_TYPE_KEY.
(T1_FIELD_KEY): New macro.
* src/psaux/psobjs.c (ps_parser_load_field): Handle
T1_FIELD_TYPE_KEY.

* src/cid/cidtoken.h: Use T1_FIELD_KEY for /CIDFontName.


* src/cache/ftlru.c (FT_LruList_Remove_Selection): Decrease
number of nodes.
(FT_LruList_Lookup): Fix assertion for out-of-memory case.
2003-06-12 13:14:15 +00:00
Werner Lemberg 75aae7db17 * src/cid/cidload.c (cid_decrypt): Removed.
(cid_read_subrs): Use t1_decrypt from psaux module.
* src/cid/cidload.h: Updated.
* src/cid/cidgload.c (cid_load_glyph): Use t1_decrypt from psaux
module.
2003-06-12 07:11:05 +00:00
Werner Lemberg fdc042b8a9 * src/cid/cidobjs.c: Apply change 2003-05-31 from <Ron.Dev@gmx.de>.
Compute style flags.
Fix computation of root->height.
* src/cid/cidtoken.h: Handle FontBBox.
* src/cid/cidload.c (cid_load_keyword): Handle
T1_FIELD_LOCATION_BBOX.
(parse_font_bbox): Commented out.
(cid_field_record): Comment out element for parsing FontBBox.

* src/type42/t42parse.c (t42_parse_font_bbox): Commented out.
(t42_keywords): Handle FontBBox with T1_FIELD_BBOX, not with
T1_FIELD_CALLBACK.
(t42_parse_font_bbox): Commented out.
(t42_load_keyword): Handle T1_FIELD_LOCATION_BBOX.
* src/type42/t42objs.c (T42_Face_Init): Apply change 2003-05-31
from <Ron.Dev@gmx.de>.
2003-06-12 04:59:07 +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 a7d6b4dad9 * src/gzip/ftgzip.c: (inflate_mask): Replaced with...
(NO_INFLATE_MASK): This.
* src/gzip/infutil.h: Declare `inflate_mask' conditionally by
NO_INFLATE_MASK.
2003-06-09 20:55:04 +00:00
Werner Lemberg 0240d29cac * src/gzip/ftgzip.c (ft_gzip_file_fill_output): Handle Z_STREAM_END
correctly.

* src/pshinter/pshglob.c (psh_globals_new): Change calculation of
dim->stdw.count to avoid compiler problem.

* src/truetype/ttgload.c (TT_Load_Simple_Glyph): Move the block
variables to the beginning of the function to avoid compiler
problems.
Add casts necessary for 16bit compilers.

* src/pfr/rules.mk (PFR_DRV_SRC): Add pfrsbit.c.
(PFR_DRV_H): Add pfrtypes.h.

* include/freetype/config/ftconfig.h: s/__MWKS__/__MWERKS__/.

* src/pfr/pfrsbit.c (pfr_bitwriter_init): Change type of third
argument to FT_Bool.
(pfr_lookup_bitmap_data): Change type of third and fourth argument
to FT_UInt.  Updated caller.
(pfr_load_bitmap_bits): Change type of fourth argument to FT_Bool.
2003-06-09 15:54:18 +00:00
Werner Lemberg 858f310b80 Completely revised FreeType's make management.
. In all makefiles `/' is used as the path separator.  The
  conversion to the real path separators is done as late as
  possible using $(subst ...).

. $(HOSTSEP) no longer exists.  Now, $(SEP) gives the path separator
  for the operating system, and the new $(COMPILER_SEP) the path
  separator for the compiler tools.

. $(BUILD) has been renamed to $(BUILD_DIR).  In general, all
  directory variables end with `_DIR'.  The variants ending in `_'
  (like `BASE_' have been removed).

The following ChangeLog entries only describe changes which are
not related to the redesign.

* builds/beos/beos-def.mk (BUILD_DIR): Fix typo.
* builds/compiler/watcom.mk (LINK_LIBRARY): Fix linker call to avoid
overlong arguments as suggested by J. Ali Harlow
<ali@avrc.city.ac.uk>.
* builds/dos/dos-wat.mk: New file.
* builds/freetype.mk (FREETYPE_H): Include header files from the
`devel' subdirectory.

* builds/os2/os2-dev.mk, builds/unix/unixddef.mk,
builds/unix/unixddef.mk, builds/win32/w32-bccd.mk,
builds/win32/w32-dev.mk (BUILD_DIR): Fix path.

* builds/unix/configure.ac, builds/unic/configure: Updated.
* builds/unix/unix-def.in (DISTCLEAN): Add `freetype2.pc'.


* devel/ftoption.h: Updated.
2003-06-09 04:46:30 +00:00
Werner Lemberg e0805659bb Fix ChangeLog. 2003-06-08 03:53:39 +00:00
Werner Lemberg 756655bdf8 * src/base/ftmac.c (FT_New_Face_From_SFNT): s/rlen/sfnt_size/ to
make it compile.

* include/freetype/internal/psaux.h, src/truetype/ttgload.h:
s/index/idx/ to fix compiler warnings.

* src/sfnt/ttcmap0.c (tt_face_build_cmaps): Use more `volatile' to
fix compiler warning.

* src/gzip/ftgzip.c (BUILDFIXED): Removed.
* src/gzip/inftrees.c (inflate_trees_fixed) [!BUILDFIXED]: Use
FT_UNUSED to remove compiler warning.
2003-06-07 05:13:22 +00:00
Werner Lemberg 499053c1c5 * include/freetype/ftstroker.h: Renamed to...
* include/freetype/ftstroke.h: This.

* src/base/ftstroker.c: Renamed to...
* src/base/ftstroke.c: This.

* include/freetype/config/ftheader.h (FT_STROKER_H): Updated.

* src/base/descrip.mms, src/base/Jamfile, src/base/rules.mk:
Updated.

* src/pcf/pcfdriver.c: Renamed to...
* src/pcf/pcfdrivr.c: This.
* src/pcf/pcfdriver.h: Renamed to...
* src/pcf/pcfdrivr.h: This.

* src/pcf/Jamfile, src/pcf/rules.mk: Updated.
2003-06-07 04:02:21 +00:00
Werner Lemberg 1ffb911d50 * src/base/ftmac.c (file_spec_from_path) [TARGET_API_MAC_CARBON]:
Add `#if !defined(__MWERKS__)'.
2003-06-06 12:47:59 +00:00
Werner Lemberg bf7c8321f2 * include/freetype/internal/psaux.h (T1_FieldType): Add
T1_FIELD_TYPE_FIXED_1000 and T1_FIELD_TYPE_FIXED_1000_P.
(T1_FIELD_FIXED_1000, T1_FIELD_FIXED_1000_P): New macros.
* src/psaux/psobjs.c (ps_parser_load_field): Handle
T1_FIELD_TYPE_FIXED_1000 and T1_FIELD_TYPE_FIXED_1000_P.

* src/cff/cffparse.c (cff_kind_fixed_thousand): New enumeration.
(CFF_FIELD_FIXED_1000): New macro.
(cff_parser_run): Handle cff_kind_fixed_thousand.
* src/cff/cfftoken.h: Use CFF_FIELD_FIXED_1000 for blue_scale.
* src/cff/cffload (cff_subfont_load): Fix default values of
expansion_factor and blue_scale.

* src/cif/cidtoken.h, src/type1/t1tokens.h: Use T1_FIELD_FIXED_1000
for blue_scale.

* src/pshinter/pshglob.c (psh_globals_new): Fix default value of
blue_scale.
2003-06-06 05:07:53 +00:00
Werner Lemberg 7386197677 * include/freetype/internal/ftdriver.h,
include/freetype/internal/ftobjs.h,
include/freetype/internal/psaux.h, src/cid/cidgload.c,
src/psaux/psobjs.c, src/psaux/t1decode.c, src/psaux/psobjs.h,
src/pshinter/pshrec.c, src/pshinter/pshalgo.c,
src/psnames/psmodule.c, src/raster/ftraster.c, src/sfnt/sfobjs.c,
src/smooth/ftgrays.c, src/smooth/ftsmooth.c, src/truetype/ttobjs.c,
src/truetype/ttdriver.c, src/truetype/ttgload.c, src/type1/t1afm.c,
src/type1/t1gload.c, src/type1/t1gload.h, src/type1/t1load.c,
src/type1/t1objs.c, src/type42/t42parse.c, src/type42/t42parse.h:
Many casts and slight argument type changes to make it work with
a 16bit compiler.
2003-06-05 04:31:05 +00:00
Werner Lemberg 3229b88005 * include/freetype/config/ftoption.h: Defining
TT_CONFIG_OPTION_FORCE_UNPATENTED_HINTING by default is a bad idea
since some fonts (e.g. Arial) produce worse results than without
hinting.  Reverted.
2003-06-05 04:28:17 +00:00
Werner Lemberg 6ab5624330 * src/truetype/ttgload.c (load_truetype_glyph)
[TT_CONFIG_OPTION_BYTECODE_INTERPRETER]: Call
FT_GlyphLoader_CheckPoints before adding phantom points.  This fixes
a segfault bug with fonts (e.g. htst3.ttf) which have nested
subglyphs more than one level deep.  Reported by Anthony Fok.

* include/freetype/config/ftoption.h: Define
TT_CONFIG_OPTION_BYTECODE_INTERPRETER,
TT_CONFIG_OPTION_COMPILE_UNPATENTED_HINTING, and
TT_CONFIG_OPTION_FORCE_UNPATENTED_HINTING to make it the new
default.
2003-06-04 07:59:58 +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 8b88466061 * src/autohint/ahhint.c (ah_hinter_hint_edges): Removed. Just a
wrapper for ah_hint_edges.
(ah_hint_edges): Renamed to...
(ah_hinter_hint_edges): This.

* src/base/ftobjs.c (FT_Set_Hint_Flags): Removed.  Unused.

* include/freetype/internal/ftobjs.h (FT_Face_InternalRec),
include/freetype/internal/psaux.h (T1_DecoderRec),
src/cff/cffgload.h (CFF_Builder): Remove `hint_flags' field.
Unused.

* src/cff/cffgload.c (cff_builder_init): Updated.
(cff_decoder_parse_charstrings) <cff_op_endchar>: Call hinter->apply
with decoder->hint_mode instead of builder->hint_flags.
* src/psaux/t1decode.c (t1_decoder_init): Updated.

* src/base/ftstroker.c (ft_stroke_border_export): s/index/idx/.

* src/sfnt/sfobjs.c (sfnt_load_face): Commented out code which
increased root->height by 15% if the line gap was zero.  There exist
fonts (containing e.g. form drawing characters) which intentionally
have a zero line gap value.
2003-06-03 11:51:43 +00:00
Werner Lemberg f35ff80132 * src/cff/cffobjs.c (cff_face_init): Use symbolic names for
Adobe specific encoding IDs (there was a wrong EID value for custom
encoding).

* src/cff/cffcmap.h (CFF_CMapStdRec): Remove `count'.
* src/cff/cffcmap.c (cff_cmap_encoding_init,
cff_cmap_encoding_done): Updated.
(cff_cmap_encoding_char_index, cff_cmap_encoding_char_next): Use
256 as limit for character code.
2003-06-02 21:58:05 +00:00
Werner Lemberg e20ab691c3 * src/winfonts/winfnt.c (FNT_Load_Glyph): Revert change from
2003-03-20.
2003-06-02 07:24:33 +00:00
Werner Lemberg 64591b7657 * include/freetype/fttrigon.h (FT_Vector_Normalize): Removed.
* src/type1/t1objs.c (T1_Face_Init): Improve algorithm for guessing
the font style by ignoring spaces and hyphens.

* builds/unix/freetype2.in: Fix `Version' field.
2003-06-01 21:30:04 +00:00
Werner Lemberg 65ba724b66 Avoid overwriting of numeric font dictionary entries for synthetic
fonts. Additionally, some entries were handled as `integer' instead
of `number'.

* include/freetype/internal/psaux.h (T1_FieldType): Add
T1_FIELD_TYPE_BOOL_P, T1_FIELD_TYPE_INTEGER_P, and
T1_FIELD_TYPE_FIXED_P.
(T1_FIELD_BOOL_P, T1_FIELD_NUM_P, T1_FIELD_FIXED_P): New macros.
* src/psaux/psobjs.c (ps_parser_load_field): Handle new field types.

* include/freetype/internal/cfftypes.h (CFF_FontRecDict),
src/cff/cfftoken.h: Change type of underline_position and
underline_thickness to FT_Fixed.
* src/cff/cffload.c (cff_subfont_load): Fix default values of
underline_position and underline_thickness.
* src/cff/cffobjs.c (cff_face_init): Set underline_position
and underline_thickness in `root'.

* include/freetype/internal/t1types.h (T1_Font): Change point_type
and stroke_width to pointers.
* include/freetype/t1tables.h (PS_FontInfo): Change italic_angle,
is_fixed_pitch, underline_position, and underline_thickness to
pointers.
* src/type1/t1tokens.h: Change italic_angle, is_fixed_pitch,
underline_position, and underline_thickness to pointers.  Change
the type of the latter two to `fixed'.
Change type of stroke_width to `fixed' and make it a pointer.
Change paint_type to pointer.
* src/type1/t1objs.c (T1_Face_Done): Updated.
(T1_Face_Init): Updated.
Fix assignment of underline_position and underline_thickness.

* src/cid/cidtoken.h: Change italic_angle, is_fixed_pitch,
underline_position, and underline_thickness to pointers.  Change
the type of the latter two to `fixed'.
Change type of stroke_width to `fixed'.
* src/cid/cidobjs.c (cid_face_done): Updated.
(cid_face_init): Updated.
Fix assignment of underline_position and underline_thickness.

* src/type42/t42parse.c: Change italic_angle, is_fixed_pitch,
underline_position, and underline_thickness to pointers.  Change the
type of the latter two to `fixed'.
Change type of stroke_width to `fixed' and make it a pointer.
Change paint_type to pointer.
* src/type42/t42objs.c (T42_Face_Init): Updated.
Fix assignment of underline_position and underline_thickness.
(T42_Face_Done): Updated.

* src/base/ftobjs.c (open_face_from_buffer): Fix compiler warning.
* src/pshinter/pshglob.c, src/pshinter/pshglob.h
(psh_globals_set_scale): Make it a local function.

* test/gview.c: Fix remaming ps3->ps typo.
Formatting.
2003-05-30 09:12:50 +00:00
Werner Lemberg 0bdf608f3d * src/pshinter/pshalgo1.[ch], src/pshinter/pshalgo2.[ch]: Removed.
* src/pshinter/pshalgo.h: Removed.

* src/pshinter/pshalgo3.[ch]: Renamed to...
* src/pshinter/pshalgo.[ch]: New files.
s/PSH3/PSH/.
s/psh3/psh/.
s/ps3/ps/.

* src/pshinter/pshrec.c, src/pshinter/pshinter.c: Updated.
* src/pshinter/rules.mk, src/pshinter/Jamfile: Updated

* src/pshinter/pshglob.[ch] (psh_dimension_snap_width): Commented
out.

* tests/gview.c: Remove code for pshalgo1 and pshalgo2.
Updated.
2003-05-28 22:42:41 +00:00
Werner Lemberg 26fb1bcd05 * vms_make.com: Reworked support for shareable images on VMS. The
first version was kind of a hack; the current implementation of the
procedure to extract the required symbols is much cleaner.

Reworked creation of MMS files, avoiding a number of temporary files
which were created in the previous version.

Further work on creating descrip.mms files on the fly.

* builds/vms/descrip.mms, src/autohint/descrip.mms,
src/type1/descrip.mms: Removed.
2003-05-28 06:27:26 +00:00
Werner Lemberg 75ad4b8365 * src/base/ftglyph.c (FT_Glyph_To_Bitmap): Activate code for
handling `origin'.
2003-05-28 06:10:57 +00:00
Werner Lemberg 4919dc7cf8 * src/pshinter/pshalgo3.c (psh3_glyph_compute_extrema): Skip
contours with only a single point to avoid segfault.

* src/autohint/ahtypes.h (AH_OPTION_NO_STRONG_INTERPOLATION):
Removed since unused.
2003-05-28 05:52:05 +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 282637f6a5 * include/freetype/config/ftstdlib.h (ft_strcat): New wrapper macro
for strcat.

* src/base/ftmac.c (create_lwfn_name): s/isupper/ft_isupper/.
(parse_font): s/memcpy/ft_memcpy/.
(is_dfont) [TARGET_API_MAC_CARBON]: s/memcmp/ft_memcmp/.
* src/base/ftobjs.c (load_mac_face) [FT_MACINTOSH]:
s/strlen/ft_strlen/.
s/strcat/ft_strcat/.
s/strcpy/ft_strcpy/.
* src/gzip/zutil.h: s/memset/ft_memset/.
s/memcmp/ft_memcmp/.

* src/bdf/bdfdrivr.c (BDF_Face_Init), src/pcf/pcfdriver.c
(PCF_Face_Init): Test for charset registry case-insensitively.

* t1load.c (parse_blend_axis_types): Fix compiler warning.

* descrip.mms: Removed.  Now created by...

* vms_make.com: New file.
2003-05-21 07:39:42 +00:00
Werner Lemberg 77c34b8264 * t1load.c (parse_blend_axis_types): Fix compiler warning.
* src/gzip/ftgzip.c (ft_gzip_file_io): Avoid zero value of `delta'
to prevent infinite loop.

* docs/VERSION.DLL: Provide better autoconf snippet to check
FreeType version.

* src/base/ftobjs.c (open_face): Free `internal' not
`face->internal' in case of error to avoid possible segfault.

* src/pshinter/pshalgo3.c (ps3_hints_apply): Check whether we
actually have an outline.
2003-05-20 22:06:38 +00:00
Werner Lemberg 6bd1c6d293 * src/pshinter/pshalgo3.c (ps3_hints_apply): Try to optimize
y_scale so that the top of non-capital letters is aligned on a pixel
boundary whenever possible.

* src/autohint/ahhint.c (ah_hint_edges): Make sure that lowercase
m's maintain their symmetry.
2003-05-20 05:01:49 +00:00
Werner Lemberg 98ceccab51 * src/autohint/ahhint.c (ah_hinter_load_glyph): Oops! David's
patch from yesterday has been resolved already in a different
way.  Reverted.
2003-05-20 04:32:54 +00:00
Werner Lemberg 11367bcce7 * src/autohint/ahhint.c (ah_hinter_load_glyph): Don't scale
y_scale locally but face->size->metrics.y_scale.
2003-05-19 21:42:08 +00:00
Werner Lemberg c98501b042 Add comment to #ifdef section in #ifndef. 2003-05-19 20:34:42 +00:00
Werner Lemberg f379f43403 * src/sfnt/ttcmap0.c (tt_cmap4_char_next): Select proper start
value for `hi' to avoid infinite loop.
2003-05-19 12:45:28 +00:00
Werner Lemberg 51daa4feb1 * src/raster/ftraster.c (Insert_Y_Turn): Fix overflow test.
* include/freetype/config/ftoption.h [FT_CONFIG_OPTION_MAC_FONTS]:
New macro.
* src/base/ftobjs.c: Use it to control mac font support on non-mac
platforms.

Implement partial support of Mac fonts on non-Mac platforms.

* src/base/ftobjs.c (memory_stream_close, new_memory_stream,
open_face_from_buffer, Mac_Read_POST_Resource,
Mac_Read_sfnt_Resource, IsMacResource, IsMacBinary, load_mac_face)
[!FT_MACINTOSH]: New functions.
(FT_Open_Face) [!FT_MACINTOSH]: Use load_mac_face.

* src/base/ftobjs.c (FT_Load_Glyph): Scale linear advance width only
if FT_FACE_FLAG_SCALABLE is set (otherwise we have a division by
zero since FNT and friends don't define `face->units_per_EM').
2003-05-18 22:40:11 +00:00
Werner Lemberg 4f107450e2 * src/base/fttrigon.c (FT_Vector_Rotate): Avoid rounding errors
for small values.

* src/autohint/ahtypes.h (AH_PointRec): Remove unused `in_angle'
and `out_angle' fields.
2003-05-17 12:07:45 +00:00
Werner Lemberg c70818a862 * src/base/ftmac.c (FT_New_Face_From_SFNT): Handle CFF files also.
* include/freetype/freetype.h: Fix typo in comment
(FT_HAS_FIXED_SIZES).
2003-05-15 06:44:09 +00:00
Werner Lemberg 6eb116ef8a * builds/unix/aclocal.m4: Comment out definition of
`allow_undefined_flag' for Darwin 1.3.
* builds/unix/configure.ac: Add option --with-old-mac-fonts.
* builds/unix/ltmain.sh: Fix version numbering for Darwin 1.3.
* builds/unix/configure: Regenerated.

* include/freetype/config/ftconfig.h: Fix conditions for defining
`FT_MACINTOSH'.
* src/base/ftbase.c: Include `ftmac.c' conditionally.
* src/base/ftmac.c: Handle __GNUC__.
2003-05-11 07:12:26 +00:00
Werner Lemberg 1f8f46758e * src/cid/cidload.c (is_alpha): Removed.
(cid_parse_dict): Use `cid_parser_skip_alpha' instead of `is_alpha'.

* src/autohint/ahoptim.c, src/autohint/ahoptim.h: Obsolete, removed.
2003-05-07 10:39:45 +00:00
Werner Lemberg bf40e92dea * src/autohint/ahglyph.c (ah_setup_uv): Exchange `for' loop and
`switch' statement to make it run faster.
(ah_outline_compute_segments): Reset `segment->score' and
`segment->link'.
(ah_outline_link_segments): Provide alternative code which does
the same but runs much faster.
Handle major direction also.
(ah_outline_compute_edges): Scale `edge_distance_threshold' down
after rounding instead of scaling comparison value in loop.

* src/autohint/ahhint.c (ah_hinter_align_stong_points): Provide
alternative code which runs faster.
Handle `before->scale == 0'.

* src/autohint/ahtypes.h (AH_SegmentRec): Move some fields down.
(AH_EdgeRec): Move some fields in structure.
New field `scale'.

* src/sfnt/ttcmap0.c (tt_cmap4_char_next): Use binary search.
2003-05-07 10:21:13 +00:00
Werner Lemberg 110fc56bea * src/autohint/ahoptim.c (LOG): Renamed to...
(AH_OPTIM_LOG): This.
(AH_Dump_Springs): Fix log message format.

* src/autohint/ahhint.c (ah_hint_edges_3): Renamed to...
(ah_hint_edges): This.
2003-05-03 20:13:48 +00:00
Werner Lemberg c6f1c10222 Minor improvements. 2003-05-03 04:47:02 +00:00
Werner Lemberg 0fdb9cc5e2 * src/bdf/bdfdrivr.c (BDF_Set_Pixel_Size): Initialize `max_advance'. 2003-05-02 18:52:17 +00:00
Werner Lemberg a547a532a1 * src/autohint/ahglyph.c (ah_test_extrema): Renamed to...
(ah_test_extremum): This.
2003-05-02 15:16:13 +00:00
Werner Lemberg a3f4da8e99 Minor cleanups. 2003-04-29 13:23:47 +00:00
Werner Lemberg 3a317c69d6 * builds/unix/configure.ac: Generate `freetype.pc' from
`freetype.in'.
* builds/unix/configure: Regenerated.
* builds/unix/install.mk (install, uninstall): Handle `freetype.pc'.

* builds/unix/freetype2.in: New file.  Contains building information
for the `pkg-config' package.
2003-04-28 09:43:32 +00:00
Werner Lemberg 2cba64d30d * src/base/ftobjs.c (FT_Load_Glyph): Fix boundary check for
`glyph_index'.
2003-04-28 08:51:07 +00:00
Graham Asher 9f36499fa7 Added comment for checkin of unpatented hinting system. 2003-04-25 11:43:07 +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
Graham Asher 0798f0c3ec If unpatented hinting is compiled the TrueType face object acquires a
new element, "FT_Bool unpatented_hinting".
2003-04-25 11:36:44 +00:00
Graham Asher 33671d74a2 Added configuration macros (not defined, but in comments) for the
unpatented hinting system.
2003-04-25 11:34:18 +00:00
Graham Asher e32c22371d Added macro FT_UNPATENTED_H to use when including new header
ttunpat.h.
2003-04-25 11:32:39 +00:00
Graham Asher 697885b58c Added header file ttunpat.h defining
FT_PARAM_TAG_UNPATENTED_HINTING.
2003-04-25 11:30:07 +00:00
Werner Lemberg 428c2e4f62 * src/bdf/bdflib.c (hash_bucket, hash_lookup): Use `const' for first
argument.
(bdf_get_font_property): Use `const' for third argument.
Updated all callers.
* src/bdf/bdfdrivr.c (BDF_Face_Init): Set pixel width and height
similar to the PCF driver.
* src/bdf/bdf.h (_hashnode): Use `const' for `key'.
Updated.

* src/gzip/ftgzip.c: C++ doesn't like that the array `inflate_mask'
is declared twice.  It is perhaps better to modify the zlip source
files directly instead of this hack.
(zcalloc, zfree, ft_gzip_stream_close, ft_gzip_stream_io): Add casts
to make build with g++ successful.
2003-04-25 05:35:04 +00:00
David Turner 2dd1e657ba * src/pcf/pcfread.c (pcf_load_font): fixed the computation of
face->num_glyphs, this required increase the value by 1 to respect
        the convention that gindex 0 always corresponds to the "missing
        glyph".
2003-04-24 21:12:18 +00:00
Werner Lemberg 3704aa4525 * builds/unix/unix-cc.in (CFLAGS): Add @CPPFLAGS@. 2003-04-24 06:07:20 +00:00
Werner Lemberg 60f52ce6d6 * builds/unix/freetype-config.in (cflags): Emit FreeType 2's include
files first.  Otherwise there are conflicts with FreeType 1
installed simultaneously.
2003-04-24 05:45:59 +00:00
Werner Lemberg 319c00d7d6 Fixing bugs reported by Nelson Beebe.
* src/base/ftstroker.c (FT_Stroker_ParseOutline): Remove unused
variable `in_path'.

* src/base/ftobjs (ft_glyphslot_set_bitmap): Change type of
second argument to `FT_Byte*'.
* include/freetype/internal/ftobjs.h: Updated.

* src/bdf/bdflib.c (_bdf_readstream): Remove unused variable `res'.
(_bdf_parse_glyphs): Remove unused variable `next'.
Mark `call_data' as unused.

* src/cache/ftlru.c (FT_LruList_Lookup): Remove unused variable
`plast'.

* src/pcf/pcfread.c (pcf_seek_to_table_type): Slight recoding to
actually use `error'.
(pcf_load_font): Remove unused variable `avgw'.

* src/pfr/pfrobjs.c (pfr_face_get_kerning): Change return type
to `void'.
Mark `error' as unused.
* src/pfr/pfrobjs.h: Updated.
* src/pfr/pfrdrivr.c (pfr_get_kerning): Updated.

* src/sfnt/ttload.c (sfnt_dir_check): Remove unused variable
`format_tag'.

* src/sfnt/ttcmap0.c (tt_cmap6_validate, tt_cmap10_validate): Remove
unused variable `start'.
(tt_cmap10_char_next): Remove unused variable `result'

* src/sfnt/sfobjs.c (tt_face_get_name): Mark `error' as unused.

* src/sfnt/sfdriver.c (get_sfnt_postscript_name): Mark `error' as
unused.

* src/type1/t1objs.c (T1_Face_Init): Remove unused variable
`pshinter'.

* src/type1/t1gload.c (T1_Load_Glyph): Use `glyph_data_loaded'
only for FT_CONFIG_OPTION_INCREMENTAL.
2003-04-23 19:48:24 +00:00
Werner Lemberg 13c4a4f171 * src/sfnt/ttcmap0.c (tt_cmap4_validate): Provide a weak variant
of the glyph ID bounding check if FT_VALIDATE_TIGHT is not active.
Without this change, many CJK fonts from Dynalab are rejected.
2003-04-23 18:21:48 +00:00
Werner Lemberg 8b61525b9a * src/base/ftbdf.c (FT_Get_BDF_Property): Check for valid
`get_interface'.
2003-04-23 18:14:51 +00:00
Werner Lemberg fcc5c9115f * src/base/ftmac.c (parse_fond): Fix handling of style names. 2003-04-23 18:10:19 +00:00
Werner Lemberg b442ca1713 Cleanups. 2003-04-23 15:50:27 +00:00
Werner Lemberg 5e6b9edc89 Cleanups. 2003-04-23 15:34:52 +00:00
Werner Lemberg bb3105e256 Cleanups. 2003-04-23 15:17:43 +00:00
Werner Lemberg 9ed254f6b9 Cleanups. 2003-04-23 14:32:58 +00:00
Werner Lemberg 2e57343f90 * src/pfr/pfrload.c (pfr_extra_item_load_font_id): Use FT_PtrDist
instead of FT_Uint for `len'.

Cleanups.
2003-04-23 14:14:06 +00:00
Werner Lemberg 004615e3d0 Cleanups. 2003-04-23 13:17:40 +00:00
Werner Lemberg 917a593780 * src/gzip/ftgzip.c (zcalloc) [!FT_CONFIG_OPTION_SYSTEM_ZLIB]:
Convert K&R format to modern C usage.
(FT_Stream_OpenGzip): Use long constant.

Cleanups.
2003-04-23 07:13:54 +00:00
Werner Lemberg 2acb963baf Cleanups. 2003-04-23 06:47:12 +00:00
Werner Lemberg 9a8898810d * src/cache/ftccache.c (ftc_cache_lookup): Remove shadow declaration
of `manager'.
2003-04-23 06:36:46 +00:00
Werner Lemberg 2d117ea531 Cleanups. 2003-04-23 06:32:41 +00:00
Werner Lemberg 7dc281c88d Cleanups. 2003-04-23 06:07:27 +00:00
Werner Lemberg c8c6bf5c63 Cleanups; adding some copyrights; formatting. 2003-04-23 05:38:13 +00:00
Werner Lemberg 3ae7cc997a Cleanups. 2003-04-22 07:49:24 +00:00
Werner Lemberg 90e979e7be Cleanups. 2003-04-22 06:53:24 +00:00
Werner Lemberg 2d1601930d Cleanups. 2003-04-22 05:51:31 +00:00
Werner Lemberg a854699b41 Small documentation improvements. 2003-04-21 20:39:42 +00:00
Werner Lemberg a16c4a7129 * doc/INSTALL.UNX: Cleaned up.
Other minor fixes/beautifying/formatting.
2003-04-21 13:30:27 +00:00
David Turner 692bbe59da * src/base/ftmac.c (open_face_from_buffer): removed a double-free bug that
had nasty consequences when trying to open an "invalid" font on a Mac.
2003-04-09 07:03:38 +00:00
David Turner b6b6337539 * src/bdf/bdfdrivr.h, src/pcf/pcf.h: changed FT_Short to FT_UShort in
order to be able to access more than 32768 glyphs in fonts
2003-04-09 06:55:57 +00:00
David Turner e0ec6b3d53 * src/type1/t1load.c (T1_Open_Face): fixed the code to make it handle
special cases where a font only contains a ".notdef" glyph (happens in
   PDF-embedded fonts !!). Otherwise, FT_Panic was called !
2003-04-03 15:52:59 +00:00
David Turner 5158fbc03d * README: udpated
* README.UNX: removed (now replaced by docs/INSTALL.UNX)

   * src/pshinter/pshalgo3.c: the hinter now performs as in 2.1.3 and
   will ignore stem quantization only when FT_LOAD_TARGET_SMOOTH is used

   * src/base/ftobjs.c: changed the default computations to include rounding
   in all cases, this is required to provide accurate kerning data when
   native TrueType hinting is enabled.

   * src/type1/t1load.c: the Type 1 loader now accepts more general names
   according to the Postscript spec (the previous one was too restrictive)
2003-03-27 21:35:44 +00:00
David Turner d6ec6eee78 * src/autohint/ahglyph.h, src/autohint/ahglyph.c, src/autohint/ahglobal.c,
src/autohint/ahhint.c: fixed blue-scale problem

    * src/cache/ftccache.c: fixed small bug that could crash the cache
    in rare circumstances (mostly with broken fonts)
2003-03-20 20:58:57 +00:00
David Turner 66cbc20978 * docs/*: serious rewriting of the documentation
* include/freetype/internal/ftobjs.h, src/base/ftobjs.c, src/bdf/bdfdrivr.c,
    src/pcf/pcfdriver.c, src/pfr/pfrsbit.c, src/sfnt/ttsbit.c,
    src/type42/t42objs.c, src/winfonts/winfnt.c: introduced three new functions
    to deal with glyph bitmaps within FT_GlyphSlot objects. these are:

      ft_glyphslot_free_bitmap
      ft_glyphslot_alloc_bitmap
      ft_glyphslot_set_bitmap

    these are much more convenient to use than managing the FT_GLYPH_OWN_BITMAP
    flag manually. the font drivers have been modified to use them as well.

    * src/cache/ftlru.c: fixed an invalid assertion check
2003-03-20 07:04:40 +00:00
David Turner 1c044d7d29 * src/truetyoe/ttdriver.c (Set_Char_Sizes): fixed a small rounding bug.
Actually, it seems that previous versions of FreeType didn't perform
    TrueType rounding exactly as appropriate.
2003-03-15 13:29:49 +00:00
David Turner 562731d487 trying to fix TrueType rendering glitches 2003-03-14 07:31:35 +00:00
David Turner b280537b6d * src/base/ftdbgmem.c, docs/DEBUG.TXT: added new environment variables
to control memory debugging with FreeType. See the description of
    "FT2_DEBUG_MEMORY", "FT2_ALLOC_TOTAL_MAX" and "FT2_ALLOC_COUNT_MAX"
    in DEBUG.TXT

    * src/cache/ftccache.c, src/cache/ftccmap.c, src/cache/ftcsbits.c,
    ftlru.c: fixed the cache sub-system to correctly deal with out-of-memory
    conditions.

    * src/pfr/pfrobjs.c, src/pfr/pfrsbits.c: fixing compiler warnings and a
    small memory leak

    * src/psaux/psobjs.c (t1_reallocate_table): fixed a bug (memory leak) that
    only happened when trying to resize an array would end in an OOM.

    * src/smooth/ftgrays.c: removed compiler warnings / volatile bug

    * src/truetype/ttobjs.c: removed segmentation fault that happened in
    tight memory environments.
2003-03-13 21:07:51 +00:00
David Turner a3c378024b * src/gzip/ftgzip.c (ft_gzip_file_done): fixed memory leak, the ZLib
stream was not properly finalized
2003-02-28 08:32:46 +00:00
David Turner 641afc9c88 adding development directory 2003-02-25 21:45:29 +00:00
David Turner b848b68274 reduce compiler warnings 2003-02-25 21:44:11 +00:00
David Turner fdc4600e5a reduce compiler warnings 2003-02-25 21:31:25 +00:00
David Turner ae26c684db * src/cache/ftccmap.c: the cmap cache now supports UCS-4 charmaps
when available in Asian fonts

    * src/sfnt/ttload.c, src/base/ftobjs.c: changed "asian" to "Asian" in
    comments

    * src/truetype/ttdriver.c (Set_Char_Sizes): fixed a rounding bug when
    computing the scale factors for a given character size in points with
    resolution.
2003-02-25 20:37:50 +00:00
David Turner 229d122e92 * src/gzip/ftgzip.c: fixed a bug that caused FreeType to loop endlessly
when trying to read certain compressed gzip files. The following test
    could be used to reveal the bug:

       touch 0123456789 ; gzip 0123456789 ; ftdump 0123456789.gz


    * src/pfr/pfrobjs.c, src/pfr/pfrload.c, src/pfr/pfrtypes.h: several
    fixes to the PFR font driver:

      - the list of available embedded bitmaps was not correctly set
        in the root FT_FaceRec structure describing the face

      - the glyph loader always tried to load the outlines when
        FT_LOAD_SBITS_ONLY was specified

      - the table loaded now scans for *undocumented* elements of a
        physical font's auxiliary data record, this is necessary to
        retrieve the "real" family and style names.

        NOTE THAT THIS CHANGES THE FAMILY NAME OF MANY PFR FONTS !!
2003-02-25 19:20:12 +00:00
David Turner a41d3f056a * src/autohint/ahhint.c: disabled the advance width "correction" which
seemed to provide more trouble than benefits..
2003-02-18 22:36:04 +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
Graham Asher d4c48e06c0 Updated changelog: change to incremental interface. 2003-02-13 17:56:45 +00:00
Graham Asher 46960df7b3 The incremental interface now passes the old metrics when asking for
replacement metrics so that they can be modified, not just replaced.
For example, CFF fonts need this.
2003-02-13 17:49:27 +00:00
David Turner 3c3b2be67c * docs/CHANGES, docs/VERSION.DLL, docs/TODO: updating documentation for
the 2.1.4 release

    * builds/win32/visualc/freetype.dsp, builds/win32/visualc/index.html:
    updating the project file for 2.1.4
2003-01-31 10:12:40 +00:00
David Turner 4bdf4350f2 various improvements for 2.1.4. see ChangeLog, I've got problems with
copy & paste on my desktop !!
2003-01-30 23:24:18 +00:00
David Turner 032e23aab9 improvements to the Postscript hinter 2003-01-30 14:57:38 +00:00
David Turner 9acb09e060 updated documentation for 2.1.4 2003-01-24 08:30:36 +00:00
David Turner 79c23ae28a * src/sfnt/ttload.c (sfnt_dir_check): relaxed the "head" table size
verification to accept a few broken fonts who pad the size incorrectly
    (the table should be padded, but its "size" field shouldn't per se
     the spec)
2003-01-22 22:53:55 +00:00
David Turner 146ff279b4 * src/autohint/ahhint.c: small fix to the stem width optimisation 2003-01-22 22:47:04 +00:00
David Turner 2f70965f9f * include/freetype/ftbdf.h, include/freetype/internal/bdftypes.h,
src/base/ftbdf.c, src/bdf/bdfdrivr.c, src/pcf/pcfdrivr.c,
    src/pcf/pcfread.h:

      adding a new API, named FT_Get_BDF_Property to retrieve the BDF
      properties of a given PCF or BDF font
2003-01-22 22:45:28 +00:00
Werner Lemberg 0d52639603 * builds/unix/ltmain.sh: Regenerated with `libtoolize --force
--copy' from libtool 1.4.3.
* builds/unix/aclocal.m4: Regenerated with `aclocal -I .' from
automake 1.7.1.
* builds/unix/configure: Regenerated with autoconf 2.54.
* builds/unix/config.guess, builds/unix/config.sub: Updated from
`config' CVS module at subversions.gnu.org.
* builds/unix/install-sh, builds/unix/mkinstalldirs: Updated from
`automake' CVS module at subversions.gnu.org.
2003-01-18 16:39:18 +00:00
David Turner 52e0a7e930 adding missing source file 2003-01-17 08:40:32 +00:00
David Turner feb3d8703f * include/freetype/freetype.h: fixed documentation for FT_Size_Metrics 2003-01-15 23:43:17 +00:00
David Turner 1a20673a9b * include/freetype/freetype.h: fixed documentation for FT_Size_Metrics 2003-01-15 23:02:47 +00:00
David Turner 619d62d933 * src/gzip/ftgzip.c: bugfix: couldn't read certain gzip-ed font files 2003-01-15 23:01:02 +00:00
David Turner 12d09050f5 * include/freetype/config/ftheader.h, include/freetype/internal/fnttypes.h,
include/freetype/ftwinfnt.h, src/base/winfnt.c, src/winfonts/winfnt.c,
    src/base/Jamfile, src/base/rules.mk, src/base/descrip.mms:

      added a Windows .FNT specific API (mostly for Wine). Also fixed a nasty
      bug in the header loader which would cause invalid memory overwrites
2003-01-15 22:48:27 +00:00
Graham Asher cad11476fe Noted addition of 'const' to the first argument to FT_Matrix_Multiply. 2003-01-14 16:00:32 +00:00
Graham Asher be1a8da313 Added 'const' to the first argument to FT_Matrix_Multiply. 2003-01-14 15:53:33 +00:00
Graham Asher 2c425de9ea noted latest change to ttload.c 2003-01-13 10:27:35 +00:00
Graham Asher 550fd43946 TrueType typefaces lacking hmtx (horizontal metrics) tables are tolerated if the
incremental interface system is enabaled and an incremental interface
has been specified. This is necessary to support some typefaces passed
from GhostScript.
2003-01-13 10:20:08 +00:00
David Turner 14018b4af9 2003-01-11 David Chester <davidchester@qmx.net>
* include/freetype/config/ftoption.h, src/autohint/ahglobal.h,
        src/autohint/ahglobal.c, src/autohint/ahglyph.c,
        src/autohint/ahtypes.h:

          included David Chester's patches to the auto-hinter in order to
          slightly improve the output. Note that everything is controlled
          through the new FT_CONFIG_OPTION_CHESTER_HINTS defined at the
          end of "ftoption.h", there are also individual FT_CONFIG_CHESTER_XXX
          macros to control individual "features".

          Note that all improvements are enabled by default, but can be
          tweaked for optimization and testing purpose. The configuration
          macros will most likely disappear in the short future.

2003-01-11  David Turner  <david@freetype.org>

        * include/freetype/internal/fnttypes.h: fixed a structure field
        definition to avoid memory overwrites
2003-01-12 18:26:10 +00:00
David Turner 57ce0bee44 * src/winfonts/winfnt.c: read 16 bytes into "reserved2", not "reserved" 2003-01-08 10:06:19 +00:00
David Turner 77b68b8e73 * src/truetype/ttgload.c: fixing the TrueType loader to handle invalid
composites correctly by limiting the recursion depth
2003-01-08 09:59:17 +00:00
David Turner 265799a933 * src/autohint/ahtypes.h, src/autohint/ahhint.c, src/pshinter/pshalgo3.h,
src/pshinter/pshalgo3.c: implemented the FT_RENDER_MODE_LIGHT hinting
        mode in the auto and postscript hinters
2003-01-08 09:52:32 +00:00
David Turner 6453a819e8 * src/base/ftobjs.c (find_unicode_charmap): fixed the error code
returned when the font doesn't contain a Unicode charmap. This
        allows FT2 to load "symbol.ttf" and a few others correctly since
        the last release
2003-01-08 09:28:34 +00:00
David Turner cce3c80c1f * Jamrules, Jamfile, Jamfile.in, src/*/Jamfile: small changes to
support the compilation of FreeType 2 as part of larger projects with
        their own configuration options (only with Jam)
2003-01-08 09:10:53 +00:00
David Turner 20e33158da * src/base/ftstroker.c: probably the last bug-fixes to the stroker,
the API is likely to change however.

        * src/base/fttrigon.c (FT_Angle_Diff): fixing function, it returned
        invalid values for large negative angle differences (resulting in
        incorrect stroker computations, among other things)

        * src/cache/ftccache.c (ftc_node_unlink): removing incorrect
        assertion, and changing code to avoid hash table size contraction

        * src/base/Jamfile, src/base/rules.mk, src/base/descrip.mms:
        adding "ftstroker.obj" to default build, as optional component
2003-01-07 22:54:02 +00:00
David Turner 91f905885f updated builds/unix/configure by running autoconf 2002-12-26 21:49:40 +00:00
David Turner 8291d253b6 * src/gzip/adler32.c, src/gzip/infblock.c, src/gzip/inflate.c,
src/gzip/inftrees.c, src/gzip/zconf.h, src/gzip/zlib.h,
        src/gzip/zutil.h: updates to allow compilation without compiler
        warnings with LCC-Win32

        * include/freetype/freetype.h, docs/VERSION.DLL,
        builds/unix/configure.ac: updates for the upcoming 2.1.4 release
2002-12-26 20:51:04 +00:00
David Turner 6bb601eaf0 * src/gzip/adler32.c, src/gzip/infblock.c, src/gzip/inflate.c,
src/gzip/inftrees.c, src/gzip/zconf.h, src/gzip/zlib.h,
        src/gzip/zutil.h: updates to allow compilation without compiler
        warnings with LCC-Win32

        * include/freetype/freetype.h, docs/VERSION.DLL,
        builds/unix/configure.ac: updates for the upcoming 2.1.4 release
2002-12-26 20:50:39 +00:00
David Turner 19b6b99967 * builds/unix/configure.ac, builds/unix/unix-cc.in,
builds/unix/unix-def.in: small fix to configure sub-system on Unix
        to allow other programs to correctly link with zlib when needed
2002-12-23 22:40:21 +00:00
David Turner caf4be3cd1 * src/winfonts/winfnt.c: included George Williams' fix to support
version 2 fonts correctly
2002-12-18 22:53:12 +00:00
David Turner c528f6fa41 * src/base/ftobjs.c (find_unicode_charmap): added some comments to
better explain what's happening there

        * src/base/ftobjs.c (open_face): included Graham Asher's fix to
        prevent faces without Unicode charmaps from loading
2002-12-18 22:43:07 +00:00
David Turner 621e488622 2002-12-16 David Turner <david@freetype.org>
* docs/VERSION.DLL: updating document to better explain the differences between
        the three version numbers being used on Unix, as well as provide the AutoConf
        fragment provided by Lars Clausen

        * src/smooth/ftgrays.c (gray_render_conic): fixed small bug that
        prevented bezier arcs with negative vertical coordinates to be rendered
        appropriately


2002-11-27  Vincent Caron <v.caron@zerodeux.net>

        * builds/unix/unix-def.in, builds/unix/freetype-config.in,
        builds/unix/configure.ac, src/gzip/rules.mk, src/gzip/ftgzip.c:
        adding support for system zlib installations when available on the
        target platform (Unix only)
2002-12-16 21:51:24 +00:00
Antoine Leca c96f69dfaa * src/base/ftobjs.c: modified the logic to get Unicode charmaps.
Now it loads UCS-4 charmaps when there is one.
* src/base/ftobjs.c (find_unicode_charmap): new function.
* src/base/ftobjs.c (open_face): refer to the above one.
* src/base/ftobjs.c (FT_Select_Charmap): idem.
2002-12-03 00:39:16 +00:00
Antoine Leca c80e08c29c update of the script codes, according to the TAGS.txt file as distributed on Microsoft site.
This is preliminary, should be modified anyway.
2002-12-03 00:37:10 +00:00
Antoine Leca fc2f3c3ede Correct the name of the controlling macro (was __FTXF86_H__ ...) 2002-11-29 12:56:49 +00:00
David Turner 9967dce2b2 * src/cff/cffload.c (cff_charser_load): modified charset loader to
accept pre-defined charsets, even when the font contains fewer glyphs.
        also enforced more checks to ensure that we never overflow the
        character codes array in the encoding.
2002-11-23 16:41:23 +00:00
David Turner c2278680e7 * src/cff/cffload.c (cff_charser_load): modified charset loader to
accept pre-defined charsets, even when the font contains fewer glyphs
2002-11-23 15:53:57 +00:00
Antoine Leca 4b9a7f6bff Updated according to the recent OpenType from Microsoft 2002-11-15 20:05:58 +00:00
David Turner 6048e3d008 updating documentation & changes 2002-11-13 23:28:08 +00:00
David Turner 5237993a92 fixed a small bug in the sbit cache that caused problems with embedded bitmaps 2002-11-07 09:46:43 +00:00
David Turner e57ca7dec6 * src/otlayout/otlayout.h, src/otlyaout/otlconf.h,
src/otlayout/otlgsub.c, src/otlayout/otlgsub.h, src/otlayout/otlparse.c,
        src/otlayout/otlparse.h, src/otlayout/otlutils.h:

          updating the OpenType Layout code, adding support fot the first
          GSUB lookups. Nothing that really compiles for now though

        * src/autohint/ahhint.c: disabled serif stem width quantization. It
        produces slightly better shapes though this is not distinguishable
        with many fonts.
2002-11-07 01:36:29 +00:00
David Turner 60b32e16e7 2002-11-05 David Turner <david@freetype.org>
* include/freetype/config/ftoption.h, src/gzip/ftgzip.c: added
        support for the FT_CONFIG_OPTION_SYSTEM_ZLIB option, used to specify
        the use of system-wide zlib.

        Note that this macro, as well as FT_CONFIG_OPTION_BYTECODE_INTERPRETER,
        is not #undef-ed anymore. This allows the build system to define them
        depending on the configuration (typically by adding -D flags at
        compile time).

        * src/sfnt/ttcmap0.c (tt_face_build_cmaps): removed compiler warnings
        in optimized mode relative to the "volatile" local variables. This was
        not a compiler bug after all, but the fact that a pointer to a volatile
        variable is not the same than a volatile pointer to a variable :-)

        the fix was to change  "volatile FT_Byte*  p"
        into                   "FT_Byte* volatile  p"

        * src/pfr/pfrload.c, src/pfr/pfrdrivr.c, src/gzip/inftrees.c: removed
        compiler warnings in optimized modes

        * src/gzip/*.[hc]: modified our ZLib copy in order to prevent exporting
        any zlib function names outside of the component. This prevents linking
        problems on some platforms, when applications want to link FreeType
        _and_ ZLib together.


2002-11-05  Juliusz  <jch@pps.jussieu.fr>

        * src/psaux/psobjs.c (ps_table_add): modified increment loop in
        order to implement exponential behaviour
2002-11-06 22:32:54 +00:00
David Turner 54b0bca50c * include/freetype/ftgzip.h, src/gzip/ftgzip.c:
adding support for gzip compressed streams !!

        * src/pcf/pcfdriver.c: adding automatic support for gzip-compressed
        PCF files
2002-10-31 22:19:27 +00:00
David Turner 3249c62523 * include/freetype/internal/internal.h, include/freetype/ftpfr.h,
src/base/ftpfr.c, src/base/Jamfile, src/descrip.mms, src/rules.mk,
        src/pfr/pfrdrivr.c, src/pfr/pfrobjs.c, src/pfr/pfsobjs.h:

        added PFR-specific public API. Fixed the kerning retrievel routine
        (it returned invalid values when the outline and metrics resolution
        differ)

        * src/base/ftsynth.c: fixed the synthetic emboldener. at last.

        * src/base/ftobjs.c: small internal fix to better support
        bitmap-based font formats
2002-10-31 08:30:19 +00:00
Werner Lemberg 2d62446da9 * include/freetype/ftcache.h (FT_POINTER_TO_ULONG): New macro.
(FTC_FACE_ID_HASH): Rewritten, using FT_POINTER_TO_ULONG.
2002-10-25 12:22:31 +00:00
Werner Lemberg b4e18f1d6a Fix header comment. 2002-10-24 21:37:02 +00:00
Werner Lemberg cb544d3ac1 * include/freetype/freetype.h (FT_Encoding): Fix entry for latin-2. 2002-10-23 09:24:23 +00:00
Werner Lemberg eacb9306c0 Formatting; adding file headers. 2002-10-07 10:12:43 +00:00
Werner Lemberg c4c373cee5 * include/freetype/freetype.h (FT_Open_Face): Use `const' for `args'
(suggested by Graham).
* src/base/ftobjs.c (FT_Open_Face): Updated.
(ft_input_stream_new): Ditto.
2002-10-07 09:15:20 +00:00
David Turner 072f7f89d3 * docs/CHANGES: updating 2002-10-05 15:00:36 +00:00
David Turner 80171e06dd * src/pfr/pfrsbit.h, src/pfr/pfrsbit.c, src/pfr/pfrload.c,
src/pfr/pfrgload.c, src/pfr/pfrobjs.c, src/pfr/pfrtypes.h,
        Jamfile, src/base/ftobjs.c: adding support for embedded bitmaps to
        the PFR driver, and rewriting its kerning loader / handler to use all
        kerning pairs in a physical font (and not just the first item).

        * src/tools/docmaker/content.py, src/tools/docmaker/sources.py,
        src/tools/docmaker/tohtml.py: fixing a few nasty bugs

        * src/sfnt/ttcmap0.c: the validator for format 4 sub-tables is
        now capable of dealing with invalid "length" fields at the start
        of the sub-table. This allows fonts like "mg______.ttf" (i.e.
        Marriage) to return accurate charmaps.
2002-10-05 14:57:03 +00:00
Werner Lemberg 4c09ae8002 * src/smooth/ftgrays.c (SUBPIXELS): Add cast to `TPos'.
Update all callers.
(TRUNC): Add cast to `TCoord'.
Update all callers.
(TRaster): Use `TPos' for min_ex, max_ex, min_ey, max_ey, and
last_ey.
Update all casts.
(gray_render_line): Fix casts for `p' and `first'.
2002-10-05 06:57:53 +00:00
Werner Lemberg 90e3dd6e86 * src/bdf/bdflib.c (bdf_load_font): Allocate the _bdf_parse_t
structure with FT_ALLOC instead of using the stack.
2002-10-02 17:04:58 +00:00
Werner Lemberg c219a5e8c4 * src/include/freetype/internal/tttypes.h (num_sbit_strikes,
num_sbit_scales): Use `FT_ULong'.
* src/sfnt/sfobjs.c (sfnt_load_face): Updated accordingly.
* src/sfnt/ttsbit.c (tt_face_set_sbit_strike): Ditto.
(find_sbit_image): Remove cast.
* src/raster/ftrend1.c (ft_raster1_render): Fix cast.

* src/sfnt/ttload.c (tt_face_load_names): Use cast.
* src/sfnt/ttcmap.c (code_to_next2): Use long constant.
(code_to_index4): Use cast.
(code_to_index8_12): Fix cast.
* src/sfnt/ttcmap0.c (tt_cmap4_char_next, tt_cmap8_char_index,
tt_cmap12_char_index): Use cast for `result'.
(tt_face_build_cmaps): Use cast.
* src/sfnt/sfobjs.c (tt_name_entry_ascii_from_ucs4): Use cast for
`code'.
(sfnt_load_face): Use FT_Int32 for `flags'.

* src/smooth/ftgrays.c (gray_render_scanline, gray_render_line,
gray_compute_cbox, gray_convert_glyph, gray_raster_reset): Add casts
to `TCoord' and `int'.
More 16bit fixes.
s/FT_Pos/TPos/.
* src/smooth/ftsmooth.c (ft_smooth_render_generic): Add casts.
2002-09-28 16:40:57 +00:00
Werner Lemberg cfd5dec319 formatting 2002-09-27 18:17:17 +00:00
Werner Lemberg 68e9f92710 * src/sfnt/ttpost.c (load_post_names, tt_face_free_ps_names,
tt_face_get_ps_name): Replace switch statement with if clauses to
make it more portable.

* src/cff/cffobjs.c (cff_face_init): Ditto.

* include/freetype/ftmodule.h (FT_Module_Class): Use `FT_Long' for
`module_size'.
* include/freetype/ftrender.h (FT_Glyph_Class_): Use `FT_Long' for
`glyph_size'.

* src/base/ftobjs.c (FT_Render_Glyph): Change second parameter to
`FT_Render_Mode'.
(FT_Render_Glyph_Internal): Change third parameter to
`FT_Render_Mode'.
* src/base/ftglyph.c (FT_Glyph_To_Bitmap): Change second parameter
to `FT_Render_Mode'.

* src/raster/ftrend1.c (ft_raster1_render): Change third parameter
to `FT_Render_Mode'.
* src/smooth/ftsmooth.c (ft_smooth_render, ft_smooth_render_lcd,
ft_smooth_render_lcd_v): Ditto.
(ft_smooth_render_generic): Change third and fifth parameter to
`FT_Render_Mode'.

* include/freetype/freetype.h, include/freetype/internal/ftobjs.h,
include/freetype/ftglyph.h: Updated.

* src/cff/cffdrivr.c (Load_Glyph), src/pcf/pcfdriver.c
(PCF_Glyph_Load), src/pfr/pfrobjs.c (pfr_slot_load),
src/winfonts/winfnt.c (FNT_Load_Glyph), src/t42/t42objs.c
(T42_GlyphSlot_Load), src/bdf/bdfdrivr.c (BDF_Glyph_Load): Change
fourth parameter to `FT_Int32'.

* src/pfr/pfrobjs.c (pfr_face_init): Add two missing parameters
and declare them as unused.

* src/cid/cidparse.h (CID_Parser): Use FT_Long for `postscript_len'.

* src/psnames/psnames.h (PS_Unicode_Value_Func): Change return
value to FT_UInt32.
* src/psnames/psmodule.c (ps_unicode_value, ps_build_unicode_table):
Updated accordingly.

* src/cff/cffdrivr.c (Get_Kerning): Use FT_Long for `middle'.
(cff_get_glyph_name): Use cast for result of ft_strlen.
* src/cff/cffparse.c (cff_parse_real): User cast for assigning
`exp'.
* src/cff/cffload.c (cff_index_get_pointers): Use FT_ULong for
some local variables.
(cff_charset_load, cff_encoding_load): Use casts to FT_UInt for some
switch statements.
(cff_font_load): Use cast in call to CFF_Load_FD_Select.
* src/cff/cffobjs.c (cff_size_init): Use more casts.
(cff_face_init): Use FT_Int32 for `flags'.
* src/cff/cffgload.c (cff_operator_seac): Use cast for assigning
`adx' and `ady'.
(cff_decoder_parse_charstrings): Use FT_ULong for third parameter.
Use more casts.
* src/cff/cffcmap.c (cff_cmap_unicode_init): Use cast for `count'.

* src/cid/cidload.c (cid_read_subrs): Use FT_ULong for `len'.
* src/cid/cidgload.c (cid_load_glyph): Add missing cast for
`cid_get_offset'.

* src/psaux/t1decode.c (t1_decoder_parse_charstrings) <18>: Use
cast for `num_points'.
(t1_decoder_init): Use cast for assigning `decoder->num_glyphs'.

* src/base/ftdebug.c (ft_debug_init): Use FT_Int.
* include/freetype/internal/ftdriver.h (FT_Slot_LoadFunc): Use
`FT_Int32' for fourth parameter.
* src/base/ftobjs.c (open_face): Use cast for calling
clazz->init_face.

* src/raster/ftraster.c (Set_High_Precision): Use `1' instead of
`1L'.
(Finalize_Profile_Table, Line_Up, ft_black_init): Use casts.
* src/raster/ftrend1.c (ft_raster1_render): Ditto.

* src/sfnt/sfnt_dir_check: Compare `magic' with unsigned long
constant.

* builds/amiga/include/freetype/config/ftmodule.h: Updated.
2002-09-27 11:09:23 +00:00
David Turner b0b8df68d6 updating documentation 2002-09-25 00:10:27 +00:00
David Turner 31654e1bed 2002-09-25 David Turner <david@freetype.org>
* src/autohint/ahtypes.h: disabling metrics hinting in the auto-hinter.
        this produces much better anti-aliased text

2002-09-25  Anthony Fok  <anthony@thizlinux.com>

        * src/sfnt/ttcmap0.c: added support for opens___.ttf (it contains
        a charmap that uses offset=0xFFFFU instead of 0x0000 to indicate a
        missing glyph)
2002-09-24 23:39:58 +00:00
Werner Lemberg e59dc91ff4 * src/truetype/ttdriver.c (Load_Glyph): Fourth parameter must be
FT_Int32.
* src/truetype/ttgload.c, src/truetype/ttgload.h (TT_Load_Glyph):
Ditto.
2002-09-21 18:43:10 +00:00
Werner Lemberg c5e566590d More 16bit fixes.
* src/autohint/ahglobal.c (sort_values): Use FT_Pos for `swap'.
(ah_hinter_compute_widths): Use FT_Pos for `dist'.
Use AH_MAX_WIDTHS.
* src/autohint/ahglyph.c (ah_outline_scale_blue_edges): Use FT_Pos
for `delta'.
(ah_outline_compute_edges): Replace some ints with FT_Int and
FT_Pos.
(ah_test_extrema): Clean up code.
(ah_get_orientation): Use 4 FT_Int variables instead of FT_BBox to
hold indices.
* src/autohint/ahtypes.h (AH_SegmentRec): Change type of `score'
to FT_Pos.
2002-09-21 08:33:27 +00:00
Werner Lemberg 2a922e87fa * builds/unix/config.guess, builds/unix/config.sub: Updated to
recent versions.
2002-09-20 15:45:43 +00:00
David Turner d48575ee3a * src/base/ftobjs.c (FT_Library_Version): bugfix 2002-09-18 23:18:36 +00:00
Werner Lemberg 98add9e68c Formatting, minor doc fixes. 2002-09-18 11:32:12 +00:00
David Turner db3d5c1ad9 updating docs/CHANGES 2002-09-18 07:53:22 +00:00
David Turner 56106fb97d * include/freetype/freetype.h, include/freetype/ftimage.h,
include/freetype/ftstroker.h, include/freetype/ftsysio.h,
        include/freetype/ftsysmem.h, include/freetype/ttnameid.h:
        updating the in-source documentation

        * src/tools/docmaker/tohtml.py: updating the HTML formatter in the
        DocMaker tool

        * src/tools/docmaker.py: removing obsolete file
2002-09-17 22:57:29 +00:00
Werner Lemberg 55e80ec200 More 16bit fixes.
* src/psaux/psobjs.c (reallocate_t1_table): Use FT_Long for
second parameter.
2002-09-17 13:56:44 +00:00
Werner Lemberg bc1837a19b 16bit fixes from Wolfgang Domrse.
* src/type1/t1parse.h (T1_ParserRec): Change type of `base_len'
and `private_len' to FT_Long.
* src/type1/t1parse.c (T1_Get_Private_Dict): Remove cast for
`private_len'.
* src/type1/t1load.c: Use FT_Int cast for most calls of T1_ToInt.
Use FT_PtrDist where appropriate.
(parse_encoding): Use FT_Long for `count' and `n'.
(read_binary_data): Use FT_Long* for second parameter.
* src/type1/t1afm.c (afm_atoindex): Use FT_PtrDist.

* src/cache/ftcsbits.c (ftc_sbit_node_load): Remove unused label.
* src/pshinter/pshalgo3.c (psh3_hint_align): Remove unused variable.
2002-09-17 12:39:19 +00:00
Werner Lemberg 7a99b507ce * src/type1/t1parse.h (T1_ParserRec): Change type of `base_len'
and `private_len' to FT_Long.

* src/cache/ftcsbits.c (ftc_sbit_node_load): Remove unused label.
* src/pshinter/pshalgo3.c (psh3_hint_align): Remove unused variable.
2002-09-17 07:31:17 +00:00
Werner Lemberg 5dfbdf7659 Making ftgrays.c compile stand-alone again.
* include/freetype/ftimage.h: Include ft2build.h only if _STANDALONE_
isn't defined.
* src/smooth/ftgrays.c [_STANDALONE_]: Define ft_memset,
FT_BEGIN_HEADER, FT_END_HEADER.
(FT_MEM_ZERO): Define.
(TRaster) [GRAYS_USE_GAMMA]: Use `unsigned char' instead of FT_Byte.
(gray_render_span, gray_init_gamma): Don't use `FT_UInt'.
Don't cast with `FT_Byte'.
(grays_init_gamma): Don't use `FT_UInt'.

* src/base/ftinit.c (FT_Add_Default_Modules): Improve error message.
* src/pcf/pcfdriver.c (PCF_Face_Done): Improve tracing message.
* include/freetype/config/ftoption.h (FT_MAX_MODULES): Increased
to 32.
2002-09-16 06:15:31 +00:00
David Turner bb076bd0fb cosmetic + typo fixes 2002-09-11 06:13:09 +00:00
Werner Lemberg 73c10ae9f7 * builds/unix/configure.ac (version_info): Set to 9:2:3.
* builds/unix/configure: Regenerated.
* docs/VERSION.DLL: Updated.
2002-09-10 15:17:32 +00:00
David Turner 25f845aa64 * src/cache/ftccache.i: fixed a bug that prevented compilation in
debug mode of template instantiation

        * src/cff/cffparse.c: fixed the CFF table loader. It didn't accept
        empty arrays, and this prevented the loading of certain fonts.

        * src/pshinter/pshalgo2.c, src/pshinter/pshalgo3.c: adding fix to
        prevent seg fault when hints are provided in an empty glyph !!

        * include/freetype/ftimage.h: removed incorrect "zft_" definitions
        and updated constants documentation comments

        * include/freetype/freetype.h (FT_FaceRec): updating documentation
        comment. The "descender" value is always *negative*, not positive !
2002-09-09 23:45:29 +00:00
David Turner 00d9f40cf7 * src/smooth/ftsmooth.c, src/base/ftobjs.c,
include/freetype/config/ftmodule.h: updated to correctly support
        sub-pixel rendering

        * include/freetype/cache/ftcimage.h, include/freetype/cache/ftcsbits.h,
        src/cache/ftcimage.c, src/cache/ftcsbit.c: updated to support sub-pixel
        rendering correctly. Definition of FTC_ImageTypeRec that replaces the
        obsolete FTC_ImageDesc, and has slightly different fields. The
        image type is now determined directly by "load_flags" values.

        * src/autohint/ahtypes.h, src/autohint/ahhint.c,
        src/pshinter/pshalgo3.c, src/pshinter/pshalgo3.h: various enhancements
        to the automatic and Postscript hinters !! and sub-pixel hinting now
        works correctly (see demo programs)
2002-09-08 21:29:11 +00:00
Werner Lemberg 6b5c669b7b * src/cid/cidobjs.c (CID_Size_Init): Renamed to...
(cid_size_init): This.
* src/psaux/psobjs.c (T1_Builder_Add_Point1): Renamed to...
(t1_builder_add_point1): This.

Updated all affected code.

* src/pshinter/pshalgo3.c (psh3_hint_align): Fix compiler warnings.
* src/type1/t1gload.c (T1_Compute_Max_Advance): Ditto.

Formatting, minor doc fixes.
2002-09-05 15:10:54 +00:00
David Turner 08840150b7 * include/freetype/freetype.h: corrected the definition of
ft_encoding_symbol to be FT_ENCODING_MS_SYMBOL (instead of
    the erroneous FT_ENCODING_SYMBOL)

    * builds/unix/unix-def.in: added "datadir" definition
    (thanks to Anthony Fok)
2002-09-04 19:58:47 +00:00
David Turner 86e6a71f53 * README, docs/CHANGES: updating for the 2.1.3 release 2002-08-29 23:18:56 +00:00
David Turner d53bfeb810 * src/pshinter/pshalgo.c: slight modification to the Postscript hinter
to slightly increase the contrast of smooth hinting. This is very similar
    to what the auto-hinter does when it comes to stem width computations.
    However, it produces better results with well-hinted fonts..
2002-08-29 22:50:17 +00:00
David Turner d1245c0dd2 updating sources to support the new FT_LOAD_TARGET_ constants
to support target-specific hinting
2002-08-27 22:34:20 +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 51b6699a35 * docs/VERSION.DLL: New file. 2002-08-27 16:51:02 +00:00
Graham Asher 33d60e2ea0 Noted latest changes to CFF sources. 2002-08-23 10:24:19 +00:00
Graham Asher 9eefed125a Simplified the incremental loading system for CFF fonts and fixed
a problem with the handling of the deprecated version of the Type 2
endchar command, that emulates Type 1 'seac'.
This version now works with the GhostScript-to-FreeType bridge
currently under development.
2002-08-23 10:08:38 +00:00
David Turner 5c0d3a4dca * src/base/ftobject.c, src/base/ftsynth.c, src/base/ftstroker.c,
src/bdf/bdfdrivr.c: removed compiler warnings
2002-08-22 20:35:36 +00:00
Werner Lemberg edbcbde703 Formatting. 2002-08-22 08:49:42 +00:00
Werner Lemberg ec810f8c6a * src/pshinter/pshalgo3.c (psh3_glyph_compute_inflections,
psh3_glyph_compute_extrema, psh3_hint_table_find_strong_point): Fix
compiler warnings and resolve shadowing of local variables.
2002-08-22 06:04:32 +00:00
David Turner 21f433cec9 * src/pshinter/pshalgo3.c, src/base/ftobjs.c, src/base/ftobject.c,
src/autohint/ahglyph.c, include/freetype/freetype.h: fixing typos
        and removing compiler warnings
2002-08-21 22:06:41 +00:00
David Turner f467e6a93f * include/freetype/freetype.h, src/base/ftobjs.c: changing the type
of the "load_flags" parameter of FT_Load_Glyph and FT_Load_Char from
        "FT_Int" to "FT_Int32", this in order to support more options.

        this should only break binary and/or source compatibility on
        16-bit platforms (Atari?)
2002-08-21 21:39:28 +00:00
David Turner a8199d608f * src/tools/docmaker/docmaker.py, src/tools/docmaker/utils.py,
src/tools/docmaker/tohtml.py: updating the DocMaker tool
2002-08-21 21:36:26 +00:00
David Turner 66456162af * src/pshinter/pshalgo3.c, src/autohint/ahangles.c,
src/autohint/ahangles.h, src/autohint/ahglyph.c, src/autohint/ahhint.c,
        src/autohint/ahtypes.h: the automatic and Postscript hinter now
        automatically detect inflection points in glyph outlines and treats
        them specially. This is very useful to prevent nasty effect like the
        disappearing diagonals of "S" and "s" in many, many fonts..
2002-08-21 21:34:59 +00:00
Werner Lemberg 215bf44438 * src/truetype/ttgload.c (TT_Get_Metrics): Add guard for k = 0. 2002-08-21 17:36:20 +00:00
David Turner fd5770b359 - removal of compiler warnings
- slight improvements to the Postscript hinter
2002-08-19 06:06:44 +00:00
Werner Lemberg 9723e7e7ae * builds/unix/install.mk (install, uninstall): Add $(DESTDIR) to
make life easier for package maintainers.
2002-08-19 02:25:43 +00:00
Werner Lemberg d580f9d6c3 * src/pcf/pcfdriver.c (PCF_Glyph_Load): Fix computation of
horiBearingX.
* src/bdf/bdfdrivr.c (BDF_GlyphLoad): Fix computation of
horiBearingY.
2002-08-18 22:02:03 +00:00
Werner Lemberg 1039234c39 Adding some comments. 2002-08-18 07:15:52 +00:00
Werner Lemberg eed446d0d5 Add support for Apple composite glyphs.
* include/freetype/config/ftoption.h
(TT_CONFIG_OPTION_COMPONENT_OFFSET_SCALED): New macro.

* src/truetype/ttgload.c (OVERLAP_COMPOUND, SCALED_COMPONENT_OFFSET,
UNSCALED_COMPONENT_OFFSET): New macros for additional OpenType
glyph loading flags.
(load_truetype_glyph): Implement it.
2002-08-16 12:46:52 +00:00
Werner Lemberg f25ce9d0b3 * src/cff/cffgload.c (cff_free_glyph_data),
src/cff/cffload.c (cff_font_load): Use FT_UNUSED.

* src/base/ftglyph.c (FT_Glyph_To_Bitmap): Initialize `error'.
* src/sfnt/sfobjs.c (SFNT_Load_Face): Fix compiler warning.
2002-08-15 23:07:18 +00:00
Graham Asher 824daa5881 Fixed compiler warnings about unreferenced formal parameters when
FT_CONFIG_OPTION_INCREMENTAL is not defined.
2002-08-15 12:58:21 +00:00
Graham Asher 917589d4bd Noted latest changes to incremental font lolading system. 2002-08-15 12:24:21 +00:00
Graham Asher bd9ca33eda Corrected incremental interface implementation to suit the new system. 2002-08-15 12:15:08 +00:00
Graham Asher 3fd12f1478 Implemented incremental loading for the CFF driver. 2002-08-15 12:10:48 +00:00
Werner Lemberg 3c403e4c17 Some formatting.
* src/cff/cffcmap.c: Remove compiler warnings.
* src/cache/ftccache.c, src/cache/ftccache.i,
src/pfr/pfrload.c, src/pfr/pfrgload.c: s/index/idx/.
* src/cff/cffload.c: s/select/fdselect/.
* src/raster/ftraster.c: s/wait/waiting/.
2002-08-06 21:47:40 +00:00
Graham Asher a170607556 Commented latest change to t1load.c. 2002-08-01 16:20:06 +00:00
Graham Asher 733c255713 T1_Open_Face now tolerates a face with no charstrings if there is
an incremental loading interface. This is essential if incremental
loading of Type 1 fonts supplied by PostScript is to work.
2002-08-01 16:16:16 +00:00
Graham Asher f9b34b5807 Added note about latest changes to incremental interface. 2002-08-01 15:36:50 +00:00
Graham Asher ce12182cfc Modified incremental loading interface to be closer to David Turner's
preferences. The header freetype.h is not now affected, the interface is
specified via an FT_Parameter, the pointer to the interface is hidden in an
internal part of the face record, and all the definitions are in ftincrem.h.
2002-08-01 15:29:17 +00:00
David Turner f52165cc06 * src/tools/docmaker/*: adding new (more advanced) version of
the DocMaker tool. Python with regular expressions rocks..
2002-07-30 18:49:52 +00:00
David Turner 76effc302f * include/freetype/ftincrem.h: adding new experimental header file
to demonstrate a "cleaner" API to support incremental font loading.
        comments appreciated...
2002-07-30 18:42:29 +00:00
Werner Lemberg b3d5e9cf03 s/ft_memset/FT_MEM_SET/.
s/FT_MEM_SET/FT_MEM_ZERO/ where appropriate.
2002-07-28 05:05:24 +00:00
Werner Lemberg bdb10748a7 * src/sfnt/ttload.c (sfnt_dir_check): Make it work with TTCs. 2002-07-27 22:51:28 +00:00
Werner Lemberg b94f3d3ea2 * src/pshinter/pshalgo3.c (psh3_hint_table_record,
psh3_hint_table_init, psh3_hint_table_activate_mask): Fix error
message.

Formatting.
2002-07-26 14:52:29 +00:00
Werner Lemberg 7f74a52a21 Fixing ChangeLog entries.
Some formatting.

* src/truetype/ttgload.c (load_truetype_glyph)
[FT_CONFIG_OPTION_INCREMENTAL]: s/memset/ft_memset/.

* src/autohint/ahhint.c (ah_hint_edges_3): Fix compiler warning.
* src/cff/cffload.c (cff_encoding_load): Remove `memory' variable.
* src/cff/cffcmap.c (cff_cmap_encoding_init): Remove `psnames'
variable.
* src/truetype/ttgload.c (load_truetype_glyph): Remove statement
without effect.
* src/truetype/ttdriver (Get_Char_Index, Get_Next_Char): Removed.
2002-07-26 09:09:10 +00:00
Graham Asher 0327329db5 Changed some tabs to spaces in changelog. 2002-07-25 09:21:54 +00:00
Graham Asher 94e4b5bc0f Fixed silly date error in change log. 2002-07-25 09:20:19 +00:00
Graham Asher fac34ae1a7 Added missing log entry for incremental font loading changes made
on 18th July 2002.
2002-07-25 09:17:46 +00:00
Graham Asher 6ebd6fd51a logged latest change to ttobjs.c 2002-07-24 18:38:45 +00:00
Graham Asher 11f0ab7d64 FIX for bug reported by Sven Neumann [sven@gimp.org] on the FreeType
development forum: "If FT_CONFIG_OPTION_INCREMENTAL is undefined
(this is the default), the TrueType loader crashes in line 852 of
src/truetype/ttgload.c when it tries to access face->glyph_locations.".
2002-07-24 13:58:21 +00:00
Graham Asher 320da730d4 More work on supporting fonts passed from GhostScript:
sfnt_dir_check now ignores the tables 'glyx' and 'locx' which are hacked-out
versions of 'glyf' and 'loca' in some PostScript Type 42 fonts, and will
generally be invalid.
2002-07-19 11:40:51 +00:00
Graham Asher bd8b08513f Added support for incrementally loaded Type 1 faces. 2002-07-18 16:57:43 +00:00
Graham Asher cd0d1dfa04 Changes to support incremental Type 42 fonts: assume a font has glyphs if it
has an incremental interface object.
2002-07-18 16:38:07 +00:00
Graham Asher ea94abb185 Added the incremental loading system for the CID driver.
Tested using my own unit test code.
2002-07-18 16:25:57 +00:00
Graham Asher 13217f2509 Added the incremental loading system for the TrueType driver.
Tested using my own unit test code.
2002-07-18 15:59:23 +00:00
Graham Asher d53cf1df31 Added incremental loading capability to FT_Open_Face.
Not implemented for any drivers yet.
2002-07-18 15:04:29 +00:00
Graham Asher 96089b9569 FT_CONFIG_OPTION_INCREMENTAL is now used to compile
incremental loading stuff conditionally.
2002-07-18 15:03:11 +00:00
Graham Asher 03011c6462 Added a new configuration macro, FT_CONFIG_OPTION_INCREMENTAL,
to enable incremental face loading. By default it is not defined.
2002-07-18 15:02:08 +00:00
Graham Asher 0e2fb07685 Added types and structures to support incremental typeface loading. 2002-07-18 14:05:19 +00:00
David Turner fed59b7cc2 * src/sfnt/ttload.c (TT_Load_SFNT_Header): fixed a recent bug that prevented
OpenType fonts to be recognized by FreeType
2002-07-17 22:51:06 +00:00
David Turner 3e19d85dd4 * include/freetype/config/ftoption.h, include/freetype/internal/tttypes.h,
src/base/ftobjs.c, src/bdf/bdfdrivr.c, src/cff/cffobjs.c,
    src/pcf/pcfdrivr.c, src/sfnt/sfobjs.c, src/sfnt/ttcmap0.c,
    src/sfnt/ttcmap0.h, src/sfnt/ttload.c, src/type1/t1objs.c,
    src/type42/t42objs.c, src/winfonts/winfnt.c: code cleanup,
    FT_CONFIG_OPTION_USE_CMAPS is now the default
2002-07-17 21:52:20 +00:00
David Turner d1214ac947 * include/freetype/config/ftoption.h, include/freetype/internal/tttypes.h,
src/base/ftobjs.c, src/bdf/bdfdrivr.c, src/cff/cffobjs.c,
    src/pcf/pcfdrivr.c, src/sfnt/sfobjs.c, src/sfnt/ttcmap0.c,
    src/sfnt/ttcmap0.h, src/sfnt/ttload.c, src/type1/t1objs.c,
    src/type42/t42objs.c, src/winfonts/winfnt.c: code cleanup,
    FT_CONFIG_OPTION_USE_CMAPS is now the default
2002-07-17 21:14:23 +00:00
David Turner 075c35de55 * include/freetype/cache/ftccache.h, src/cache/ftccache.i,
src/cache/ftccache.c: cleaning up the cache sub-system code, linear
    hashing is now the default
2002-07-17 20:56:48 +00:00
David Turner b55464fafd small fix 2002-07-11 23:55:18 +00:00
David Turner 3314a975b9 small fix 2002-07-11 23:51:44 +00:00
David Turner 7acd73fd6a * src/sfnt/ttload.c, src/sfnt/ttload.h, src/sfnt/ttdriver.c: changing
the SFNT loader to check for SFNT-based font files differently. We now
    ignore the range "helper" fields and check the "head" table's magic
    number instead.
2002-07-11 23:41:14 +00:00
David Turner 660138753b updatinf the object sub-system and dynamic hash table implementations 2002-07-11 16:27:16 +00:00
David Turner 8db6a07021 * include/freetype/t1tables.h, include/freetype/internal/psaux.h,
src/psaux/psobjs.c, src/type1/t1load.c, src/type1/t1tokens.h:
    fixing a bug in the Type 1 loader that prevented valid font bounding
    boxes to be loaded from multiple master fonts.
2002-07-11 11:26:21 +00:00
David Turner d473204c00 * src/cff/cffobjs.c: small fix to select the Unicode charmap by default
when needed
2002-07-10 17:10:21 +00:00
David Turner a87bb79235 * src/cff/cffobjs.c: small fix to allow OpenType fonts to support Adobe
charmaps when needed.
2002-07-10 16:58:10 +00:00
David Turner b9b2cac634 * src/cff/cffcmap.c, src/cff/cffcmap.h, Jamfile, rules.mk: new files added
to support charmaps for CFF fonts

    * src/cff/cffload.c, src/cff/cffload.h, src/cff/cffobjs.c,
    src/cff/cffobjs.h, src/cff/cffparse.c, src/cffparse.h, src/cff/cffgload.c,
    src/cff/cffgload.h: adding support for CFF charmaps, reformatting the
    sources, and removing some bugs in the Encoding and Charset loaders
2002-07-10 16:52:06 +00:00
David Turner ee06410b0a * src/pshinter/pshglob.c: fixed a bug that prevented the hinter from using
correct standard width and height values. resulting in hinting bugs with
    certain fonts (e.g. Utopia)
2002-07-09 16:49:12 +00:00
David Turner 971517ac8e * src/pshinter/pshglob.h, src/pshinter/pshglob.c: adding support for
blue fuzz
2002-07-08 23:13:25 +00:00
David Turner f0f1b6ae15 * src/base/ftglyph.c (FT_Glyph_To_Bitmap): added code to return succesfully
when the function is called with a bitmap glyph (the previous code simply
    returned with an error)
2002-07-08 23:05:14 +00:00
David Turner 02c3aede1b * docs/DEBUG.TXT: adding debugging support documentation
* src/base/ftdebug.c (ft_debug_init), builds/win32/ftdebug.c
    (ft_debug_init), builds/amiga/src/ftdebug.c (ft_debug_init): changed the
    syntax of the FT2_DEBUG environment variable  used to control debugging
    output (i.e. logging and error messages). It must now look like:

       any:6 memory:4 io:3   or
       any:6,memory:4,io:3   or
       any:6;memory:4;io:3
2002-07-08 23:02:32 +00:00
David Turner 27c322e983 * include/freetype/freetype.h, src/base/ftobjs.h,
freetype/internal/ftobjs.h, freetype/internal/psaux.h,
    freetype/internal/pshints.h, src/psaux/t1decode.c, src/cff/cffgload.h,
    src/cff/cffgload.c, src/pshinter/pshalgo1.h, src/pshinter/pshalgo1.c,
    src/pshinter/pshalgo2.h, src/pshinter/pshalgo2.c, src/pshinter/pshalgo3.h,
    src/pshinter/pshalgo3.c: Adding support for hinter-specific bit flags,
    and the new FT_Set_Hint_Flags high-level API
2002-07-08 22:26:11 +00:00
David Turner dcb61e4785 * src/pfr/pfrobjs.c (pfr_slot_load): fixed a small bug that returned
incorrect advances when the outline resolution was different from the
    metrics resolution

    * src/autohint/ahhint.c: removing compiler warnings

    * src/autohint/ahglyph.c: slight improvements to the serif detection
    code. More work is needed though..
2002-07-05 15:54:26 +00:00
David Turner 699053ca75 2002-07-03 David Turner <david@freetype.org>
* src/autohint/ahglobal.c, src/autohint/ahtypes.h, src/autohint/ahhint.c:
    small improvements to the automatic hinter. un-even stem-widths have now
    disappeared and everything looks much better, even if there are still
    issues with serifed fonts.
2002-07-04 22:48:12 +00:00
David Turner 9f7d079c89 adding Owen Taylor's patches to the Postscript hinter for testing 2002-07-03 21:00:26 +00:00
David Turner 26438805c7 where, if a glyph has more than hint mask, the second mask
gets applied to points that should have been covered by the
first mask.
2002-07-01 21:57:36 +00:00
David Turner 49b1a9d00a adding path stroker 2002-07-01 21:54:30 +00:00
David Turner 0c46f70e3e * include/freetype/ftstroker.h, src/base/ftstroker.c, src/base/Jamfile:
adding path stroker component (work in progress)
2002-07-01 21:53:54 +00:00
David Turner d36b4a5985 formatting 2002-07-01 21:52:49 +00:00
David Turner 6ec3f34765 * src/sfnt/ttcmap0.c: fixing the cmap 8 and 12 parsing routines 2002-07-01 21:50:12 +00:00
David Turner ac90c0e811 * include/freetype/fttrigon.h, src/base/fttrigon.c: adding
FT_Vector_From_Polar and FT_Angle_Diff to the trigonometric functions
2002-07-01 21:35:17 +00:00
David Turner 3dff94f54c * include/freetype/internal/ftobject.h: updating the object sub-system
definitions (still experimental)
2002-07-01 21:34:07 +00:00
David Turner 58ad559a34 * include/freetype/ftsynth.h, src/base/ftsynth.c: rewriting the automatic
style synthesis functions, now renamed to FT_GlyphSlot_Oblique and
    FT_GlyphSlot_Embolden
2002-07-01 21:33:48 +00:00
David Turner 0d73b0c49a * include/freetype/internal/ftobject.h: updating the object sub-system
definitions (still experimental)

    * src/base/fthash.c (ft_hash_remove): fixing a small reallocation bug

    * include/freetype/fttrigon.h, src/base/fttrigon.c: adding
    FT_Vector_From_Polar and FT_Angle_Diff to the trigonometric functions

    * include/freetype/ftstroker.h, src/base/ftstroker.c: adding path stroker
    component (work in progress)
2002-06-26 23:45:21 +00:00
David Turner b7e18efcd2 adding path stroker component (first steps) 2002-06-26 22:05:05 +00:00
David Turner 318f3befc6 * src/truetype/ttgload.c (TT_Load_Composite_Glyph),
src/base/ftoutln.c (FT_Vector_Transform): fixed Werner's latest
        fix. FT_Vector_Transform wasn't buggy, the TrueType composite loader
        was...
2002-06-26 20:30:37 +00:00
Werner Lemberg ba7148d80c Added release info. 2002-06-26 11:26:59 +00:00
Werner Lemberg bff86cbeb8 Minor fixes and grammatical corrections/additions. 2002-06-26 05:58:24 +00:00
Werner Lemberg aa89ddb9fc * include/freetype/freetype.h (FREETYPE_PATCH): Set to 3. 2002-06-25 21:37:30 +00:00
David Turner 74c0d93304 documentation updates for 2.1.2 2002-06-23 10:57:31 +00:00
Werner Lemberg 9cbb166d6b Minor fixes. Formatting. 2002-06-22 13:35:41 +00:00
David Turner 0460c1d97e * include/freetype/internal/t42types.h, src/base/fttype1.c,
src/type42/t42objs.h: removed duplicate definition of T42_FaceRec
2002-06-22 10:07:24 +00:00
David Turner 37b263e93a * src/pfr/pfrgload.c (pfr_glyph_load_compound): fixing a small composite
glyph loader bug that caused accents to be misplaced in a number of
    glyphs..
2002-06-22 09:36:53 +00:00
David Turner a0d8abf98d preparing for the 2.1.2 release 2002-06-21 07:42:50 +00:00
David Turner e583a022fb * README, docs/CHANGES: preparing for the 2.1.2 release 2002-06-21 07:42:02 +00:00
David Turner 38f8e894a5 * src/pfr/pfrobjs.h, src/pfr/pfrobjs.c, src/pfr/pfrload.c,
src/pfr/pfrtypes.h: adding Kerning support to the PFR driver
2002-06-21 07:33:23 +00:00
Werner Lemberg 7e3df82efd * src/base/fttype1.c: Include FT_INTERNAL_TYPE42_TYPES_H.
(t1_face_check_cast): Removed.
(FT_Get_PS_Font_Info): Make it work with CID and Type 42 drivers
also.

* src/type42/t42parse.c (t42_parse_sfnts): Fix compiler warning.
2002-06-20 21:03:48 +00:00
Werner Lemberg 87a2bc7b69 * src/base/ftoutln.c (FT_Vector_Transform): Fix serious typo
(xy <-> yx).
* src/truetype/ttgload.c (load_truetype_glyph): Replace `|' with
`||' to make code easier to read.
2002-06-20 10:57:04 +00:00
Werner Lemberg 0657a8ac94 * src/type42/t42objs.c (t42_check_size_change): Removed.
(T42_Size_SetChars, T42_Size_SetPixels): Use FT_Activate_Size
instead.
(T42_GlyphSlot_Load): Remove call to t42_check_size_change.
2002-06-19 19:43:15 +00:00
Werner Lemberg 0bb4a0f93a * src/psaux/t1cmap.c (t1_cmap_custom_char_index,
t1_cmap_custom_char_next): Fix index computation -- indices start
with 0 and not with cmap->first.

Provide default charmaps.

* src/bdf/bdfdrivr.c (BDF_Face_Init), src/pcf/pcfdriver.c
(PCF_Face_Init), src/pfr/pfrobjs.c (pfr_face_init),
src/type1/t1objs (T1_Face_Init), src/winfonts/winfnt.c
(FNT_Face_Init): Implement it.
2002-06-19 15:57:55 +00:00
Werner Lemberg 3afd706dc6 * src/pfr/pfrobjs.c (pfr_face_init): Fix typo. 2002-06-18 20:30:13 +00:00
Leonard Rosenthol d372ee4e1b Added note about VC++ project update 2002-06-18 16:53:39 +00:00
Leonard Rosenthol 0cf2dbaf47 Added the PFR module 2002-06-18 16:51:23 +00:00
Werner Lemberg 0270c36c38 Install freetype2.m4.
* builds/unix/install.mk (install, uninstall): Handle it.

Fix glyph indices for PFR driver.

* src/pfr/pfrcmap.c (pfr_cmap_char_index, pfr_cmap_char_next):
Increase return value by 1.
* src/pfr/pfrobjs.c (pfr_slot_load): Decrease index by 1.
2002-06-17 08:01:32 +00:00
Werner Lemberg fd97d137e0 Fix glyph indices to make index zero always the undefined glyph.
* src/bdf/bdfdrivr.c (bdf_cmap_init): Don't decrease
cmap->num_encodings.
(bdf_cmap_char_index, bdf_cmap_char_next, BDF_Get_Char_Index):
Increase result by 1 for normal cases.
(BDF_Glyph_Load): Decrease index by 1.

* src/pcf/pcfdriver.c (pcf_cmap_char_index, pcf_cmap_char_next,
PCF_Char_Get_Index): Increase result by 1 for normal cases.
(PCF_Glyph_Load): Decrease index by 1.
* src/pcf/pcfread.c (pcf_get_encodings): Don't decrease j for
allocating `encoding'.

* src/base/ftobjs.c (FT_Load_Glyph, FT_Get_Glyph_Name): Fix
bounding tests.
2002-06-16 01:14:16 +00:00
Werner Lemberg d2e3d4ff8c Add new cmap support to BDF driver
* src/bdf/bdfdrivr.c (BDF_CMapRec) [FT_CONFIG_OPTION_USE_CMAPS]:
New structure.
(bdf_cmap_init, bdf_cmap_done, bdf_cmap_char_index,
bdf_cmap_char_next) [FT_CONFIG_OPTION_USE_CMAPS]: New functions.
(BDF_Get_Char_Index) [!FT_CONFIG_OPTION_USE_CMAPS]: Use only
conditionally.
(BDF_Face_Init): Handle `AVERAGE_WIDTH' and `POINT_SIZE' keywords.
Implement new cmap handling.
(bdf_driver_class): Updated.
2002-06-14 08:54:02 +00:00
Werner Lemberg 89df58f8e6 * Makefile, configure, */*.mk, builds/unix/unix-def.in,
docs/CHANGES, docs/INSTALL: s/TOP/TOP_DIR/.
2002-06-14 08:09:25 +00:00
Werner Lemberg 2bf2376ced Typo. 2002-06-12 18:40:30 +00:00
Werner Lemberg bd8e324af9 * src/bdf/bdflib.c: s/FT_Short/short/ for consistency. 2002-06-12 08:43:58 +00:00
David Turner a1e45652be * builds/win32/ftdebug.c: added a missing #endif
* src/sfnt/ttload.c, src/bdf/bdflib.c: removing compiler warnings

        * src/type42/t42objs.c: removed the bug that prevented un-hinted
        outlines to be loaded
2002-06-11 20:35:58 +00:00
Werner Lemberg 5f4e102a42 Minor fixes. 2002-06-11 06:53:15 +00:00
David Turner 25a6e3a167 * include/freetype/internal/ftobjs.h, src/autohint/ahglyph.c,
src/base/ftobjs.c, src/objs/fttype1.c, src/sfnt/ttcmap0.c,
    src/smooth/ftgrays.c: changed uses of "setjmp" and "longjmp"
    to "ft_setjmp" and "ft_lonjmp". Removed direct references to
    <stdio.h> and <setjmp.h> when appropriate, to eventually replace
    them with a FT_CONFIG_STANDARD_LIBRARY_H. Useful for the XFree86
    Font Server backend based on FT2.
2002-06-10 23:03:35 +00:00
David Turner b1d8f73df6 * src/pcf/pcfdriver.c (pcf_cmap_char_next): fixed a bug that caused
the function to return invalid values.
2002-06-10 22:41:57 +00:00
Werner Lemberg 4d12d89dcd New file. 2002-06-08 14:23:50 +00:00
David Turner 47a09ca371 fixed a typo in "src/cache/ftccache.i"
fixed a nasty bug in "src/cache/ftccache.c" (ftc_node_hash_unlink)
2002-06-08 13:51:18 +00:00
David Turner 957fa85682 - removing a typo in ftccache.i that prevented it from compiling correctly
- fixed the infamous bug that caused the cache to crash with large fonts.
  the hash table buckets array wasn't shrinked correctly during cache
  flushes..
2002-06-08 13:48:41 +00:00
Werner Lemberg 995d1165b9 * src/cache/ftccache.i (GEN_CACHE_LOOKUP): Move declaration of
`family' and `hash' up to make it compilable with g++.
2002-06-08 12:50:18 +00:00
Werner Lemberg ad9ce8c682 * builds/amiga/smakefile, builds/amiga/makefile: Updated. 2002-06-08 12:33:57 +00:00
Werner Lemberg 8c90c22dbe * src/cache/ftccache.c (ftc_node_hash_unlink, ftc_node_hash_link)
[FTC_CACHE_USE_LINEAR_HASHING]: Fix returned error code.
Fix debugging messages.

* src/type42/t42error.h: New file.
* src/type42/t42drivr.c, src/type42/t42objs.c,
src/type42/t42parse.c: Use t42 error codes.
* src/type42/rules.mk: Updated.

* src/base/ftnames.c: Include FT_INTERNAL_STREAM_H.

Formatting, adding copyright messages.
2002-06-08 06:47:18 +00:00
David Turner 5a2f39e8ed adding template cache lookup routine 2002-06-08 01:06:31 +00:00
David Turner 4927e37a04 commit last fixes and optimisations to the cache manager.
The performance of cache hits has increased between 20 and 50% !!
2002-06-08 01:05:56 +00:00
David Turner f47d5f0b39 debugging new cache hash table implementation 2002-06-07 22:09:20 +00:00
David Turner 08b7ad4418 * include/freetype/cache/ftccache.h, src/cache/ftccache.c,
src/cache/ftccache.i, src/cache/ftcsbits.c: adding various
          experimental optimisations to the cache manager

        * src/type42/t42parse.c: removing duplicate function
2002-06-07 20:07:44 +00:00
David Turner 7504e48eaa * src/base/ftobjs.c (FT_Render_Glyph_Internal): changed definition
from FT_EXPORT_DEF to FT_BASE_DEF
2002-06-07 07:24:55 +00:00
David Turner 9f95babf3e * src/type42/t42drivr.c, src/type42/t42drivr.h, src/type42/t42parse.c,
src/type42/t42parse.h, src/type42/t42objs.h, src/type42/t42objs.c,
          src/type42/type42.c:

            updated the Type42 driver by splitting it into several files since
            it makes the code easier to read and maintain. Also fixed the bug
            that prevented the correct display of fonts with "ftview"
2002-06-07 07:23:06 +00:00
Werner Lemberg 5a1fae15a9 Add 8bpp support.
* src/bdf/bdflib.c (_bdf_parse_start): Handle 8bpp.
* src/bdf/bdfdrivr.c (BDF_Glyph_Load): Ditto.
* src/bdf/README: Updated.
2002-06-03 20:01:23 +00:00
Werner Lemberg 5be28b0d8c * src/pfr/pfrload.c (pfr_phy_font_done): Free `blue_values' array. 2002-06-02 12:11:48 +00:00
Werner Lemberg 7925edcef4 * src/bdf/bdflib.c (_bdf_readstream): Allocate `buf' dynamically.
(_bdf_parse_glyphs): Use correct size for allocating
`font->unencoded'.
(bdf_load_font): Free array conditionally.
Return proper error code in case of failure.
* src/bdf/bdfdrivr.c (BDF_Face_Init): Make it more robust against
unusual fonts.
2002-05-30 19:29:41 +00:00
Werner Lemberg 5bbb494008 * src/bdf/descrip.mms, src/type42/descrip.mms: New files.
* descrip.mms (all): Updated.

* src/bdf/bdflib.c (_bdf_parse_glyphs): Fix typo which prevented
compilation.
* src/pshglob.c (psh_blues_scale_zones): Fix compiler warning.
2002-05-30 19:22:14 +00:00
David Turner d490e3734d * docs/CHANGES: updating file for upcoming release (2.1.1)
* src/bdf/bdflib.c: removing compiler warnings
2002-05-28 23:40:37 +00:00
Werner Lemberg 02d4d59ac0 * builds/amiga/makefile, builds/amiga/smakefile,
amiga/include/freetype/config/ftmodule.h: Updated to include
support for BDF and Type42 drivers.

* docs/modules.txt: Updated.

* src/bdf/bdflib.c (_bdf_parse_glyphs): Replace floating point math
with calls to `FT_MulDiv'.
2002-05-28 22:38:05 +00:00
David Turner 2a4fa1340e * include/freetype/ftxf86.h, src/base/ftxf86.c: added a new API named
FT_Get_X11_Font_Format to return an X11-compatible string describing the
    font format of a given face. This was put in a new optional base source
    file, corresponding to a new public header (named FT_XFREE86_H since
    this function should only be used within the XFree86 font server IMO).

    * include/freetype/config/ftheader.h: adding FT_XFREE86_H, though it's
    not documented yet.

    * include/freetype/t1tables.h, src/base/fttype1.c: adding two new APIs
    named "FT_Get_PS_Font_Info" and "FT_Has_PS_Glyph_Names". This required
    a new optional source in 'src/base' named "fttype1.c"

    * src/base/Jamfile, src/base/rules.mk, src/base/descrip.mms: updating
    build control files for the new files "ftxf86.c" and "fttype1.c" in
    src/base
2002-05-28 22:07:49 +00:00
David Turner 2f2390cb1b formatting 2002-05-28 21:41:29 +00:00
David Turner 69e7ee0391 * src/pshinter/pshglob.c (psh_blues_scale_zones): fixed a bug that
prevented family blue zones substitution from hapenning correctly
2002-05-28 20:29:12 +00:00
David Turner 665f30d3aa * include/freetype/ftbdf.h: adding documentation comments for the
API reference describing the new function FT_Get_BDF_Charset_ID.
2002-05-28 20:14:28 +00:00
Werner Lemberg 877ff67887 * src/base/ftnames.c (FT_Get_Sfnt_Name): Don't use FT_STREAM_READ_AT
but FT_STREAM_READ.
Declare `stream' variable.
2002-05-28 06:03:10 +00:00
David Turner 791d83a612 * include/freetype/internal/tttypes.h, src/sfnt/ttload.c,
src/sfnt/sfobjs.c, src/sfnt/sfdriver.c, src/base/ftnames.c:
        fixing the SFNT name table loader to support various buggy fonts.
        it now ignores empty name entries, entries with invalid pointer
        offsets and certain fonts containing tables with broken "storageOffset"
        fields.

        name strings are now loaded on demand, which reduces the memory
        requirements for a given FT_Face tremendously (for example, the
        name table of Arial.ttf is about 10Kb and contains 70 names !!)

        finally, this is a _quick_ fix. The whole name table loader and
        interface will be rewritten in a much more cleanly way shortly,
        once CSEH have been introduced in the sources.
2002-05-27 23:52:01 +00:00
Werner Lemberg 4d631e447f Fix comment. 2002-05-27 13:02:37 +00:00
Werner Lemberg 62c2096a33 * builds/unix/ft-munmap.m4: New file, extracted FT_MUNMAP_DECL and
FT_MUNMAP_PARAM from aclocal.m4 into here, so aclocal.m4 can be
rebuilt from sources.  Set macro serial to 1, and use third argument
to AC_DEFINE for our two custom symbols, so ftconfig.in could one day
be rebuilt with autoheader (not recommended now, ftconfig.in is a
custom source file)
2002-05-24 22:05:43 +00:00
Werner Lemberg 233302a83f * include/freetype/config/ftheader.h (FT_BEZIER_H): Removed.
(FT_BDF_H): New macro for accessing `ftbdf.h'.

* src/type42/t42drivr.c (hexval): Fix typo.
2002-05-22 05:41:06 +00:00
Werner Lemberg b1859049e2 * src/psaux/psobjs.c (T1Radix): New function.
(t1_toint): Use it to handle numbers in radix format.

* src/psaux/t1decode.c (T1_Decoder_Parse_Charstrings): Add dummy
for undocumented, obsolete opcode 15.
2002-05-22 04:53:25 +00:00
David Turner b1b476215e * src/bdf/bdflic.c: removed compiler warning, and changed all tables
to the "static const" storage specifier (instead of simply 'static')

        * src/type42/t32drivr.c, src/bdf/bdfdrivr.c:
          removing compiler warnings
2002-05-21 21:17:43 +00:00
David Turner 18914a4f50 * src/type42/t32drivr.c: removing compiler warnings 2002-05-21 20:57:36 +00:00
David Turner 9e883cf668 * include/freetype/internal/ftbdf.h, src/base/ftbdf.c,
src/base/descrip.mms, src/base/Jamfile, src/base/rules.mk:

          Adding a new API called "FT_Get_BDF_Charset_ID" to retrieve
          BDF-specific strings from a face. This is much cleaner
          than accessing the internal types "BDF_Public_Face" defined in
          FT_INTERNAL_BDF_TYPES_H
2002-05-21 20:50:53 +00:00
Werner Lemberg 8ab3260239 * src/bdf/README: Mention Microsoft's SBIT tool.
* src/cff/cffdrivr.c, src/cid/cidriver.c, src/pcf/pcfdriver.c,
src/truetype/ttdriver.c, src/type1/t1driver.c,
src/winfonts/winfnt.c, src/type42/t42drivr.c, src/bdf/bdfdrivr.c
[FT_CONFIG_OPTION_DYNAMIC_DRIVERS]: Completely removed.  It has
been never used.
2002-05-21 20:22:59 +00:00
Werner Lemberg 7cf4d377f4 * src/type42/t42drivr.c: s/T42_ENCODING_TYPE_/T1_ENCODING_TYPE_/.
(parse_font_matrix): Remove unnecessary code.
(parse_sfnts): Initialize some variables.
(t42_driver_class) [TT_CONFIG_OPTION_BYTECODE_INTERPRETER]: Use
ft_module_driver_has_hinter conditionally.
Moved some type 42 specific structure definitions to...
* include/freetype/internal/t42types.h: New file.
* include/freetype/internal/internal.h (FT_INTERNAL_T42_TYPES_H):
New macro.

* include/freetype/cache/ftcsbits.h (FTC_SBit): Added a new field
`num_grays' for specifying the number of used gray levels.
* src/cache/ftcsbits.c (ftc_sbit_node_load): Initialize it.

Adding a driver for BDF fonts written by Francesco Zappa Nardelli
<Francesco.Zappa.Nardelli@ens.fr>.  Heavily modified by me to
better adapt it to FreeType, removing unneeded stuff.  Additionally,
it now supports Mark Leisher's BDF extension for anti-aliased
bitmap glyphs with 2 and 4 bpp.

* src/bdf/*: New driver.
* include/freetype/internal/bdftypes.h: New file.
* include/freetype/internal/fttrace.h: Added BDF driver components.
* include/freetype/fterrdef.h: Added error codes for BDF driver.
* include/freetype/config/ftmodule.h, src/Jamfile: Updated.
* include/freetype/internal/internal.h (FT_INTERNAL_BDF_TYPES_H):
New macro.

* include/freetype/config/ftstdlib.h (ft_sprintf): New alias for
sprintf.

* include/freetype/internal/fttrace.h: Added Type 42 driver
component.
* src/type42/t42drivr.c: Use it.

* include/freetype/internal/internal.h (FT_INTERNAL_PCF_TYPES_H):
New macro.
2002-05-21 14:13:01 +00:00
David Turner 993a8d0445 adding BDF driver 2002-05-18 12:03:43 +00:00
Werner Lemberg b89a42c6c5 * src/type42/Jamfile: New file. 2002-05-17 12:10:04 +00:00
Werner Lemberg 963778153e Adding a driver for Type42 fonts written by Roberto Alameda
<ojancano@geekmail.de>.

* src/type42/*: New driver.
* include/freetype/config/ftmodule.h, src/Jamfile: Updated.
* include/freetype/config/ftstdlib.h (ft_xdigit, ft_memcmp,
ft_atoi): New aliases for xdigit, memcmp, and atoi, respectively.
2002-05-15 06:18:24 +00:00
Werner Lemberg 44cb6fe816 Import of type42 driver 2002-05-15 06:16:57 +00:00
Werner Lemberg 347a714c54 Initial revision 2002-05-15 06:16:57 +00:00
Werner Lemberg bd889e5de9 * src/sfnt/ttload.c (TT_LookUp_Table): Protect against tables
with a zero length value.

* builds/beos/beos.mk: Include `link-std.mk'.

* src/type1/t1load.h (T1_Loader): Renamed to...
(T1_LoaderRec): This.
(T1_Loader): Now pointer to T1_LoaderRec.
* src/type1/t1load.c: Updated.

* include/freetype/internal/t1types.h, src/type1/t1load.c,
src/type1/t1objs.c:
s/T1_ENCODING_TYPE_EXPORT/T1_ENCODING_TYPE_EXPERT/.
2002-05-12 19:59:17 +00:00
Werner Lemberg 95fcaf8df7 * README: Add a note regarding libttf vs. libfreetype. 2002-05-05 22:24:44 +00:00
Werner Lemberg f83ded0174 FreeType 2 can now be built in an external directory with the
configure script also.

* builds/freetype.mk (INCLUDES): Add `OBJ_DIR'.

* builds/unix/detect.mk (have_mk): New variable to test for
external build.
(unix-def.mk): Defined according to value of `have_mk'.
* builds/unix/unix.mk (have_mk): New variable to test for
external build.
Select include paths for unix-def.mk and unix-cc.mk according
to value of `have_mk'.
* builds/unix/unix-def.in (OBJ_BUILD): New variable.
(DISTCLEAN): Use it.
* builds/unix/unix-cc.in (LIBTOOL): Define default value only
if not yet defined.
* builds/unix/install.mk (install): Use `OBJ_BUILD' for installing
freetype-config.

* configure: Don't depend on bash features.
(ft2_dir, abs_curr_dir, abs_ft2_dir): New variables (code
partially taken from Autoconf).
Build a dummy Makefile if not building in source tree.

* docs/INSTALL: Document it.
2002-05-05 10:57:06 +00:00
Werner Lemberg 26aca0244d formatting 2002-05-05 07:40:16 +00:00
David Turner 8cd8907311 * src/truetype/ttgload.c (TT_Load_Glyph): finally fixing the last
bug that prevented FreeType 2.x and FreeType 1.x to produce
          bit-by-bit identical monochrome glyph bitmaps with native TrueType
          hinting. The culprit was a single-bit flag that wasn't set
          correctly by the TrueType glyph loader !!

        * src/otlayout/otlayout.h,
          src/otlayout/otlbase.c,
          src/otlayout/otlbase.h,
          src/otlayout/otlconf.h,
          src/otlayout/otlgdef.c,
          src/otlayout/otlgdef.h,
          src/otlayout/otlgpos.c,
          src/otlayout/otlgpos.h,
          src/otlayout/otlgsub.c,
          src/otlayout/otlgsub.h,
          src/otlayout/otljstf.c,
          src/otlayout/otljstf.h,
          src/otlayout/otltable.c,
          src/otlayout/otltable.h,
          src/otlayout/otltags.h:

            adding OpenType Layout source files. Module is still incomplete
2002-05-04 18:02:59 +00:00
Werner Lemberg 948ee807e1 * src/sfnt/ttcmap0.c (tt_cmap4_char_index): Fix serious typo
(0xFFFU -> 0xFFFFU).

* docs/INSTALL: Fix URL of makepp.

formatting
2002-05-02 06:50:58 +00:00
David Turner 2062286fa8 removed compiler warning 2002-05-01 08:48:35 +00:00
David Turner 1093730447 * include/freetype/internal/fthash.h, src/base/fthash.c:
adding a generic implementation of dynamic hash tables using
          linear algorithm (to get rid of 'stalls' during resizes). This
          will be used in the future in at least three parts of the
          library: the cache sub-system, the object sub-system and
          the memory debugger.

        * include/freetype/internal/ftcore.h: added this header file to
          group all new definitions related to exception handling and
          memory management. It's very likely that this file will disappear
          or be renamed in the future..

        * include/freetype/internal/ftobject.h, include/freetype/ftsysmem.h:
          adding comments to better explain the object sub-system as well
          as the new memory manager interface.
2002-05-01 08:46:56 +00:00
David Turner ad6eaed676 * include/freetype/config/ftstdlib.h: adding an alias for the
'exit' function. This will be used in the near future to panic
          in case of un-expected exception (which shouldn't happen in
          theory, but as everyone knows, shit happens :-) )
2002-05-01 08:43:00 +00:00
David Turner 4f108391d8 * src/sfnt/sfobjs.c (tt_face_get_name): fixing a bug that
caused FreeType to crash when certain broken fonts (e.g.
          "hya6gb.ttf") were opened.

        * src/sfnt/ttload.c (TT_Load_Names): applied a small work-around to
          manage fonts containing a broken name table (e.g. "hya6gb.ttf")

        * src/sfnt/ttcmap0.c (tt_cmap4_validate):
          fixed over-restrictive validation test. the charmap validator
          now accepts overlapping ranges in format 4 charmaps.

        * src/sfnt/ttcmap0.c (tt_cmap4_char_index):
          switched to a binary search algorithm. Certain fonts contain
          more than 170 distinct segments !!
2002-05-01 08:40:53 +00:00
David Turner 3c5a3e45c9 * src/sfnt/ttcmap0.c (tt_cmap4_validate):
fixed over-restrictive validation test. the charmap validator
          now accepts overlapping ranges in format 4 charmaps.

        * src/sfnt/ttcmap0.c (tt_cmap4_char_index):
          switched to a binary search algorithm. Certain fonts contain
          more than 170 distinct segments !!
2002-05-01 08:40:32 +00:00
David Turner af48e32c17 * src/sfnt/ttload.c (TT_Load_Names): applied a small work-around to
manage fonts containing a broken name table (e.g. "hya6gb.ttf")
2002-05-01 08:38:08 +00:00
David Turner df689c25ce * src/sfnt/sfobjs.c (tt_face_get_name): fixing a bug that
caused FreeType to crash when certain broken fonts (like
          "hya6gb.ttf") were opened.
2002-05-01 08:36:12 +00:00
Werner Lemberg 9ca7a15727 * src/base/ftmac.c (p2c_str): Removed.
(file_spec_from_path) [TARGET_API_MAC_CARBON]: Added support for
OS X.
(is_dfont) [TARGET_API_MAC_CARBON]: Define only for OS X.
Handle `nameLen' <= 6 also.
(parse_fond): Remove unused variable `name_table'.
Use functionality of old p2c_str directly.
Add safety checks.
(read_lwfn): Initialize `size_p'.
Check for size_p == NULL.
(new_memory_stream, open_face_from_buffer): Updated to FreeType 2.1.
(FT_New_Face_From_LWFN): Remove unused variable `memory'.
Remove some dead code.
(FT_New_Face_From_SFNT): Remove unused variable `stream'.
(FT_New_Face_From_dfont) [TARGET_API_MAC_CARBON]: Define only for
OS X.
(FT_New_Face_From_FOND): Remove unused variable `error'.
(ResourceForkSize): New function.
(FT_New_Face): Use it.
Handle empty resource forks.
Conditionalize some code for OS X.
Add code to call normal loader as a fallback.

Some more variable renames to avoid troubles on the Mac.

* src/raster/ftraster.c:
s/Unknown|Ascending|Descending|Flat/\1_State/.
* src/smooth/ftgrays.c: s/TScan/TCoord/.

Other changes for the Mac.

* include/freetype/config/ftconfig.h: Define FT_MACINTOSH for
Mac platforms.
* src/base/ftobjs.c: s/macintosh/FT_MACINTOSH/.

* src/raster/ftrend1.c (ft_raster1_render): Make `pitch' always
an even number.
2002-04-30 14:26:49 +00:00
Werner Lemberg 5f0ee94c06 `interface' is reserved on the Mac.
* include/freetype/ftoutln.h, include/freetype/internal/sfnt.h,
src/base/ftoutln.c: s/interface/func_interface/.
* src/base/ftbbox.c (FT_Outline_Get_BBox):
s/interface/bbox_interface/.
* src/cff/cffdrivr.c: s/interface/module_interface/.
* src/cff/cffload.c, src/cff/cffload.h:
s/interface/psnames_interface/.
* src/cid/cidriver.c: s/interface/cid_interface/.
* src/sfnt/sfdriver.c: s/interface/module_interface/.
* src/smooth/ftgrays.c: s/interface/func_interface/.
* src/truetype/ttdriver.c: s/interface/tt_interface/.
* src/type1/t1driver.c: s/interface/t1_interface/.
2002-04-30 06:37:52 +00:00
Werner Lemberg 558ac99de1 * descrip.mms (all): Add pfr driver. 2002-04-29 12:59:32 +00:00
Werner Lemberg 1573adf971 * src/pcf/pcfdriver.c (PCF_Face_Init) [!FT_CONFIG_OPTION_USE_CMAPS]:
`root' -> `face->root'.
* src/sfnt/ttcmap0.c (TT_Build_CMaps) [!FT_CONFIG_OPTION_USE_CMAPS]:
Removed.
* src/sfnt/ttcmap0.c: Declare TT_Build_CMaps only for
FT_CONFIG_OPTION_USE_CMAPS.
2002-04-28 12:25:31 +00:00
Werner Lemberg b658ac9e63 * src/pfr/pfrerror.h: New file.
* include/freetype/ftmoderr.h: Add PFR error codes.
* src/pfr/pfrgload.c: Include pfrerror.h.
Use PCF error codes.
(pfr_extra_item_load_stem_snaps): Fix debug message.
* src/pfr/pfrgload.c: Include pfrerror.h.
Use PCF error codes.
(pfr_extra_item_load_bitmap_info, pfr_glyph_load_simple,
pfr_glyph_load_compound): Fix debug message.
* src/pfr/pfrobjs.c: Include pfrerror.h.
Use PCF error codes.
(pfr_face_init): Return PFR_Err_Unknown_File_Format.
* src/pfr/rules.mk (PFR_DRV_H): Include pfrerror.h.
2002-04-28 10:25:55 +00:00
Werner Lemberg 7b3dc7bb61 * src/cache/ftccache.c (ftc_cache_lookup),
src/cache/ftccmap.c (ftc_cmap_family_init),
src/cache/ftcmanag.c (ftc_family_table_alloc),
src/cache/ftcsbits.c (FTC_SBit_Cache_Lookup): Use FTC_Err_*.
src/cache/ftcimage.c (FTC_Image_Cache_Lookup): Use FTC_Err_*.
(FTC_ImageCache_Lookup): Fix handling of invalid arguments.
2002-04-28 02:48:20 +00:00
David Turner e788049931 adding experimental (alpha) exception support code + system code 2002-04-25 21:42:59 +00:00
Werner Lemberg 3680fd7c5b * builds/unix/configure.ac: Set `version_info' to 9:1:3 (FT2
version 2.0.9 has 9:0:3).
* builds/unix/configure: Regenerated (using autoconf 2.53).
2002-04-22 16:50:27 +00:00
Werner Lemberg fadb6be7e3 * src/pfr/pfrload.c (pfr_extra_items_farse): Fix debug message.
(pfr_phy_font_load): s/size/Size/ for local variable to avoid
compiler warning.
* src/pfr/pfrobjs.c (pfr_face_init): Fix debug message.
(pfr_slot_load): Remove redundant local variable.

adding copyrights, formatting
2002-04-20 05:38:33 +00:00
David Turner 609e28c3be * src/type1/t1gload.h, src/type1/t1gload.c: fixed incorrect
parameter sign-ness in callback function

        * include/freetype/config/ftmodule.h,
          include/freetype/internal/fttrace.h,
          src/Jamfile, src/pfr/*:

          adding a PFR font driver to the FreeType sources. Not that it
          doesn't support embedded bitmaps or kerning tables for now..


        * include/freetype/internal/ftmemory.h: adding the FT_MEM_ZERO
          and FT_ZERO macros

        * include/freetype/internal/ftstream.h: adding the FT_NEXT_OFF3,
          FT_NEXT_UOFF3, FT_NEXT_OFF3_LE and FT_NEXT_UOFF3_LE to parse
          in-memory 24-bit integers.
2002-04-19 15:13:47 +00:00
Werner Lemberg f123ab6e5f Fix ChangeLog. 2002-04-18 14:27:21 +00:00
Werner Lemberg 67ffd8cd19 formatting 2002-04-18 14:26:29 +00:00
David Turner f574960899 * src/base/ftobjs.c, builds/win32/ftdebug.c,
builds/amiga/src/base/ftdebug.c :

            2.1.0 couldn't be linked against applications in Win32 and
            Amiga builds due to changes to "src/base/ftdebug.c" that
            were not properly propagated to "builds/win32" and
            "builds/amiga"..

            this has been fixed. We'll probably make 2.1.1 real
            soon now..


        * include/freetype/internal/ftobject.h,
          include/freetype/internal/ftexcept.h,
          include/freetype/ftsysmem.h,
          include/freetype/ftsysio.h,
          src/base/ftsysmem.c,
          src/base/ftsysio.c:

            adding new experimental files for 2.1.1 (or 2.1.2)
2002-04-18 10:07:26 +00:00
David Turner 1fb2bd92cd adding new experimental header files 2002-04-17 22:54:02 +00:00
Werner Lemberg 6e188b419d formatting 2002-04-17 22:42:13 +00:00
David Turner 88027fdde4 fixing typo preventing compilation in non-debugging modes 2002-04-17 11:32:10 +00:00
David Turner 11cfdd04a2 fixed max advance width computation within T1 driver 2002-04-17 09:37:59 +00:00
Werner Lemberg 9928df86f2 * src/pcf/pcfread (pcf_get_accell): Fix parsing of accelerator
tables.
2002-04-16 13:39:17 +00:00
David Turner 33686f3751 changing options for release 2002-04-15 17:49:45 +00:00
Werner Lemberg 4639c4bddb formatting 2002-04-15 13:37:29 +00:00
David Turner 39e1b17aa6 removed compiler warning 2002-04-15 12:05:02 +00:00
David Turner 498eed268e preparing 2.1.0 release 2002-04-15 12:01:10 +00:00
Werner Lemberg 94ffae5239 * src/cff/cffgload.c (CFF_Parse_CharStrings): s/rand/Rand/ to avoid
compiler warning.

formatting/fixing ChangeLog
2002-04-14 00:54:32 +00:00
David Turner 737fa9acf7 * builds/unix/ftconfig.in, builds/vms/ftconfig.h: Oops, forgot to
update these files too
2002-04-12 10:19:15 +00:00
David Turner d15bc0d13a * README.UNX: updated the Unix-specific quick-compilation guide to
warn about the GNU Make requirement at compile time..

        * include/freetype/config/ftstdlib.h,
          include/freetype/config/ftconfig.h,
          include/freetype/config/ftheader.h,
          include/freetype/internal/ftmemory.h,
          include/freetype/internal/ftobjs.h,

          src/autohint/ahoptim.c,

          src/base/ftdbgmem.c, src/base/ftdebug.c,
          src/base/ftmac.c,    src/base/ftobjs.c,
          src/base/ftsystem.c,

          src/cache/ftcimage.c, src/cache/ftcsbits.c,

          src/cff/cffdriver.c, src/cff/cffload.c, src/cff/cffobjs.c,

          src/cid/cidload.c, src/cid/cidparse.c, src/cid/cidriver.c,

          src/pcf/pcfdriver.c, src/pcf/pcfread.c,

          src/psaux/t1cmap.c, src/psaux/t1decode.c,

          src/pshinter/pshalgo1.c, src/pshinter/pshalgo2.c,
          src/pshinter/pshrec.c,

          src/psnames/psmodule.c,

          src/raster/ftraster.c,

          src/sfnt/sfdriver.c, src/sfnt/ttload.c, src/sfnt/ttpost.c,

          src/smooth/ftgrays.c,

          src/type1/t1afm.c,  src/type1/t1driver.c, src/type1/t1gload.c,
          src/type1/t1load.c, src/type1/t1objs.c,   src/type1/t1parse.c:

            added the new configuration file "ftstdlib.h" used to define
            aliases for all ISO C library functions used by the engine
            (e.g. strlen, qsort, setjmp, etc...)

            this eases the porting of FreeType 2 to exotic environments like
            XFree86 modules/extensions..

            also removed many #include <string.h>, #include <stdlib.h>, etc...
            from the engine's sources where they're not needed..
2002-04-12 09:31:48 +00:00
Werner Lemberg 0cc456aa1a minor fixes 2002-04-11 19:55:58 +00:00
David Turner 35f8480b5a * docs/FTL.txt: updated license text to provide a preffered disclaimer
and adjust copyright dates/extents
2002-04-11 15:17:16 +00:00
David Turner 2c7558ce40 * README, docs/CHANGES, Jamfile.in: updating for the 2.1.0 release 2002-04-11 14:21:16 +00:00
David Turner c495c1ac91 * src/smooth/ftgrays.c (gray_hline): very minor optimization. :-) 2002-04-11 10:34:19 +00:00
Werner Lemberg 04728a8bbe Fixes from the stable branch:
* include/freetype/config/ftoption.h (FT_CONFIG_OPTION_OLD_CALCS):
Removed.
[FT_CONFIG_OPTION_OLD_CALCS]: Removed.
* include/freetype/internal/ftcalc.h, src/base/ftcalc.c
[FT_CONFIG_OPTION_OLD_CALCS]: Removed.

* src/base/fttrigon.c (FT_Vector_Length): Change algorithm to match
output of FreeType 1.

* src/pshinter/pshglob.c (psh_globals_scale_widths): Fixed a small
bug that created un-even stem widths when hinting Postscript fonts.

formatting, updating copyright
2002-04-02 14:50:31 +00:00
Werner Lemberg efa996155e * src/type1/t1driver.c, src/type1/t1parse.c: 16bit fixes.
formatting, copyright updates
2002-04-01 22:01:46 +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 b7b163cb07 * src/sfnt/ttcmap.c: 16bit fixes (0xFFFF -> 0xFFFFU).
* src/sfnt/ttcmap0.c: 16bit fixes.
(TT_Build_CMaps): Simplify debug messages.
(tt_cmap12_char_next): Fix offset.
* src/sfnt/ttload.c (TT_Load_Names, TT_Load_CMap): Fix debug
messages.
(TT_Load_OS2): 16bit fix.
2002-03-31 18:48:24 +00:00
Werner Lemberg 545a75fdd7 * src/psaux/t1cmap.c: s/index/idx/.
* src/psaux/t1decode.c (T1_Decoder_Parse_Charstrings): Fix debug
messages.
2002-03-31 11:18:15 +00:00
Werner Lemberg 1987fb2f72 * src/truetype/ttobjs.c (TT_Size_Init): Fix typo.
* src/otlayout/otlcommn.c, src/otlayout/otlcommn.h: s/index/idx/.
2002-03-31 06:56:56 +00:00
Werner Lemberg 44be4d56fc formatting, copyright 2002-03-30 17:08:04 +00:00
Werner Lemberg afe5351e80 fix entry 2002-03-30 16:47:55 +00:00
Werner Lemberg 8e2339ac7e formatting 2002-03-30 16:46:23 +00:00
Werner Lemberg 48c984b5bb * src/cff/cffdrivr.c (cff_get_glyph_name): Fix debug message.
* src/cff/cffobjs.c (CFF_Driver_Init, CFF_Driver_Done)
[TT_CONFIG_OPTION_EXTEND_ENGINE]: Removed.
* src/cff/sfobjs.c (SFNT_Load_Face)
[TT_CONFIG_OPTION_EXTEND_ENGINE]: Ditto.
* src/truetype/ttobjs.c (TT_Init_Driver, TT_Done_Driver)
[TT_CONFIG_OPTION_EXTEND_ENGINE]: Ditto.

* src/truetype/ttdriver.c, src/truetype/ttobjs.c,
src/truetype/ttobjs.h: Renaming driver functions to the
FT_<Subject>_<Action> scheme:

  TT_Init_Driver => TT_Driver_Init
  TT_Done_Driver => TT_Driver_Done
  TT_Init_Face   => TT_Face_Init
  TT_Done_Face   => TT_Face_Done
  TT_Init_Size   => TT_Size_Init
  TT_Done_Size   => TT_Size_Done
  TT_Reset_Size  => TT_Size_Reset
2002-03-30 16:41:09 +00:00
David Turner 56054f310b fixing the function that computes an ASCII face name 2002-03-30 16:32:47 +00:00
David Turner d76050abd7 removing compiler warnings 2002-03-30 16:14:48 +00:00
David Turner 8a9d58133b updating comments for some TT_FaceRec fields 2002-03-30 16:09:24 +00:00
Werner Lemberg f8ba2005ab * include/freetype/t1tables.h (t1_blend_max): Fix typo.
* src/base/ftstream.c: Simplify FT_ERROR calls.

formatting, copyright update
2002-03-30 13:16:35 +00:00
Werner Lemberg 78e004e843 formatting 2002-03-29 23:23: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
Werner Lemberg 2282f341d6 * src/sfnt/sfdriver.c (get_sfnt_postscript_name): Fix serious typos. 2002-03-28 14:21:15 +00:00
Werner Lemberg 1305f2616d * include/freetype/internal/psaux.h (PSAux_ServiceRec): Fix
compiler warnings.
* include/freetype/internal/t1types.h (T1_FaceRec): Use `const' for
some members.
* src/base/ftapi.c (FT_New_Memory_Stream): Fix typos.
* src/psaux/t1cmap.c (t1_cmap_std_init, t1_cmap_unicode_init): Add
cast.
(t1_cmap_{standard,expert,custom,unicode}_class_rec): Use
`FT_CALLBACK_TABLE_DEF'.
* src/psaux/t1cmap.h: Updated.
* src/sfnt/ttcmap0.c (TT_Build_CMaps): Use `ft_encoding_none'
instead of zero.
* src/type1/t1objs.c (T1_Face_Init): Use casts.
2002-03-28 08:07:16 +00:00
David Turner 94dbf7f022 fixed a small bug in FT_CMaps support 2002-03-26 02:38:39 +00:00
David Turner 4b29d58761 removing compiler warnings 2002-03-25 17:02:26 +00:00
David Turner a6f6ff56b5 formatting 2002-03-25 16:35:13 +00:00
David Turner 2ded2c1d30 * src/base/ftobjs.c, src/sfnt/ttcmap0.c, src/type1/t1objs.c:
various fixes to make the FT_CMaps support work correctly
          (more tests are still needed)
2002-03-22 22:37:40 +00:00
David Turner ed54f28e4a various fixes to the FT_CMaps support 2002-03-22 17:09:52 +00:00
David Turner fa77c87f64 polishing FT_CMaps support for Type 1 format 2002-03-22 15:56:12 +00:00
David Turner effa96496e formatting 2002-03-22 15:55:55 +00:00
David Turner fd88e7c7c8 * include/freetype/internal/ftobjs.h,
src/sfnt/Jamfile, src/sfnt/rules.mk,
          src/sfnt/sfnt.c, src/sfnt/sfobjs.c,
          src/sfnt/ttload.c, src/sfnt/ttcmap0.c, src/sfnt/ttcmap0.h:

            updated the SFNT charmap support to use FT_CMaps
2002-03-22 15:02:38 +00:00
David Turner 7eedf08747 * include/freetype/config/ftheader.h, include/freetype/fterrors.h:
modified "fterrors.h" to include the error definitions list found
        in "fterrdef.h"
2002-03-22 15:00:19 +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 a890c29cb0 * include/freetype/internal/ftstream.h,
src/base/ftstream.c, src/cff/cffload.c, src/pcf/pcfread.c,
          src/sfnt/ttcmap.c, src/sfnt/ttcmap0.c, src/sfnt/ttload.c,
          src/sfnt/ttpost.c, src/sfnt/ttsbit.c,
          src/truetype/ttgload.c, src/truetype/ttpload.c,
          src/winfonts/winfnt.c:

            changed the definitions of stream macros. Examples:

              NEXT_Byte     => FT_NEXT_BYTE
              NEXT_Short    => FT_NEXT_SHORT
              NEXT_UShortLE => FT_NEXT_USHORT_LE
              READ_Short    => FT_READ_SHORT
              GET_Long      => FT_GET_LONG
              etc..

            also introduced the FT_PEEK_XXXX functions..
2002-03-22 12:55:23 +00:00
David Turner 42372fd4d8 * src/psaux/t1cmap.h, src/psaux/t1cmap.c, src/type1/t1cmap.h,
src/type1/t1cmap.c: updating and moving the Type 1 FT_CMap support
        from "src/type1" to "src/psaux" since it's going to be shared
        by the Type 1 and CID font drivers..

        * src/psaux/Jamfile, src/psaux/psaux.c, src/psaux/psauxmod.c,
        src/psaux/rules.mk, include/freetype/internal/psaux.h: added support
        for Type 1 FT_CMaps.
2002-03-21 15:02:54 +00:00
David Turner e2f4e52ac8 * src/base/ftobjs.c (FT_Get_Next_Char): updated to new FT_CMap
definitions
2002-03-21 15:00:13 +00:00
David Turner 5a83a00d11 moving the Type 1 CMap support to "psaux" 2002-03-21 10:39:23 +00:00
David Turner a02976d232 * src/base/ftdbgmem.c (ft_mem_table_destroy): fixed a small bug that
caused the library to crash with Electric Fence when memory debugging
        is used..
2002-03-20 15:37:12 +00:00
David Turner 095a4cc1f3 * src/base/ftgloadr.c (FT_GlyphLoader_CheckSubGlyphs): fixed a memory
allocation bug that was due to un-careful renaming of the FT_SubGlyph
        type..
2002-03-20 15:35:53 +00:00
David Turner 7d3a26425b * renaming stream macros. Examples:
FILE_Skip    => FT_STREAM_SKIP
           FILE_Read    => FT_STREAM_READ
           ACCESS_Frame => FT_FRAME_ENTER
           FORGET_Frame => FT_FRAME_EXIT
           etc...
2002-03-20 10:49:31 +00:00
David Turner 678e0d46cd * src/sfnt/sfdriver.c (get_sfnt_postscript_name): fixed memory leak 2002-03-20 10:47:38 +00:00
David Turner 2bf2b9cc21 * include/freetype/internal/ftobjs.h: changing the definition of
FT_CMap_CharNextFunc slightly

        * src/cff/*.c: updating CFF type definitions.
2002-03-20 09:44:20 +00:00
David Turner 4bd5d0a344 formatting 2002-03-20 09:42:31 +00:00
David Turner eba5ad4b37 no message 2002-03-14 12:56:35 +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 7c0f52a4a9 removing obsolete file 2002-03-14 10:10:41 +00:00
David Turner 429978bdca * include/freetype/internal/psaux.h,
src/cid/cidload.c, src/cidtoken.h,
          src/psaux/psobjs.c, src/psaux/psobjs.h, src/psaux/t1decode.c,
          stc/type1/t1load.c, src/type1/t1tokens.h: updated common Postscript
          type definitions
2002-03-14 10:09:35 +00:00
David Turner f39b7a0c3c formatting 2002-03-14 09:30:52 +00:00
David Turner b93b0f5f7d * include/freetype/internal/ftobjs.h,
src/base/ftapi.c, src/base/ftobjs.c: updated a few face method
          definitions:

            FT_PSName_Requester     => FT_Face_GetPostscriptNameFunc
            FT_Glyph_Name_Requester => FT_Face_GetGlyphNameFunc
            FT_Name_Index_Requester => FT_Face_GetGlyphNameIndexFunc
2002-03-14 09:28:51 +00:00
David Turner ef3c12650e * include/freetype/internal/ftdriver.h,
include/freetype/internal/ftobjs.h,
          src/base/ftapi.c, src/base/ftobjs.c,
          src/cff/cffdrivr.c, src/cff/cffdrivr.h,
          src/cid/cidriver.c, src/cid/cidriver.h,
          src/pcf/pcfdriver.c, src/pcf/pcfdriver.h,
          src/truetype/ttdriver.c, src/truetype/ttdriver.h,
          src/type1/t1driver.c, src/type1/t1driver.h,
          src/winfonts/winfnt.c, src/winfonts/winfnt.h:
          updating the type definitions for font font drivers
2002-03-14 09:22:48 +00:00
David Turner becd3c5cb2 * include/freetype/internal/fnttypes.h, src/winfnt/*.c: updating
the type definitions of the Windows FNT font driver
2002-03-14 09:01:32 +00:00
David Turner ab4fc4da58 * include/freetype/internal/cfftypes.h, src/cff/*.c: updating the
type definitions of the CFF font driver

        (i.e. CFF_Font  => CFF_FontRec
              CFF_Font* => CFF_Font, etc...)
2002-03-14 08:57:10 +00:00
David Turner 9657ef0598 * include/freetype/internal/autohint.h, src/autohint/ahmodule.c,
src/base/ftapi.c, src/base/ftobjs.c: updating the type definitions for
        the auto-hinter module.

        (i.e. FT_AutoHinter_Interface  => FT_AutoHinter_ServiceRec,
              FT_AutoHinter_Interface* => FT_AutoHinter_Service, etc..)
2002-03-14 08:49:59 +00:00
David Turner 329b3ce324 * include/freetype/config/ftoption.h: changed the automatic detection
of Microsoft C compilers to automatically support 64-bit integers only
        since revision 9.00 (i.e. >= Visual C++ 2.0)
2002-03-13 09:37:50 +00:00
Werner Lemberg 4ef4bdf066 * src/base/ftutil.c (FT_Realloc): Use MEM_Set instead of memset. 2002-03-07 23:22:28 +00:00
Werner Lemberg 0d9165e1d6 * src/base/ftdbgmem.c (ft_mem_table_resize, ft_mem_table_new,
ft_mem_table_set, ft_mem_debug_alloc, ft_mem_debug_free,
ft_mem_debug_realloc, ft_mem_debug_done, FT_Alloc_Debug,
FT_Realloc_Debug, FT_Free_Debug): Fix compiler warnings.
* src/base/ftcalc.c (FT_MulFix): Ditto.
* src/cff/cffdrivr.c (cff_get_name_index): Ditto.
* src/cff/cffobjs.c (CFF_Size_Get_Global_Funcs, CFF_Size_Init,
CFF_GlyphSlot_Init): Ditto.
* src/cid/cidobjs.c (CID_GlyphSlot_Init,
CID_Size_Get_Globals_Funcs): Ditto.
* src/type1/t1objs.c (T1_Size_Get_Globals_Funcs, T1_GlyphSlot_Init):
Ditto.
* src/pshinter/pshmod.c (pshinter_interface): Use `static const'.
* src/winfonts/winfnt.c (FNT_Get_Next_Char): Remove unused
variables.

* include/freetype/internal/psaux.h (T1_Builder_Funcs): Renamed
to...
(T1_Builder_FuncsRec): This.
(T1_Builder_Funcs): New typedef.
(PSAux_Interface): Remove compiler warnings.
* src/psaux/psauxmod.c (t1_builder_funcs), src/psaux/psobjs.h
(t1_builder_funcs): Updated.

* src/pshinter/pshglob.h (PSH_Blue_Align): Replaced with ...
(PSH_BLUE_ALIGN_{NONE,TOP,BOT}): New defines.
(PSH_AlignmentRec): Updated.

* include/freetype/internal/ftstream.h (GET_Char, GET_Byte): Fix
typo.
* include/freetype/internal/ftgloadr.h (FT_SubGlyph): Ditto.
* src/base/ftstream (FT_Get_Char): Rename to...
(FT_Stream_Get_Char): This.

* src/base/ftnames.c (FT_Get_Sfnt_Name): s/index/idx/ -- `index' is
a built-in function in gcc, causing warning messages with gcc 3.0.
* src/autohint/ahglyph.c (ah_outline_load): Ditto.
* src/autohint/ahglobal.c (ah_hinter_compute_blues): Ditto.
* src/cache/ftcmanag.c (ftc_family_table_alloc,
ftc_family_table_free, FTC_Manager_Done, FTC_Manager_Register_Cache):
Ditto.
* src/cff/cffload.c (cff_new_index, cff_done_index,
cff_explicit_index, CFF_Access_Element, CFF_Forget_Element,
CFF_Get_Name, CFF_Get_String, CFF_Load_SubFont, CFF_Load_Font,
CFF_Done_Font): Ditto.
* src/psaux/psobjs.c (PS_Table_Add, PS_Parser_LoadField): Ditto.
* src/psaux/t1decode.c (T1_Decoder_Parse_Charstrings): Ditto.
* src/pshinter/pshrec.c (ps_mask_test_bit, ps_mask_clear_bit,
ps_mask_set_bit, ps_dimension_add_t1stem, ps_hints_t1stem3,
* src/pshinter/pshalgo1.c (psh1_hint_table_record,
psh1_hint_table_record_mask, psh1_hint_table_activate_mask): Ditto.
* src/pshinter/pshalgo2.c (psh2_hint_table_record,
psh2_hint_table_record_mask, psh2_hint_table_activate_mask): Ditto.
* src/sfnt/ttpost.c (Load_Format_20, Load_Format_25,
TT_Get_PS_Name): Ditto.
* src/truetype/ttgload.c (TT_Get_Metrics, Get_HMetrics,
load_truetype_glyph): Ditto.
* src/type1/t1load.c (parse_subrs, T1_Open_Face): Ditto.
* src/type1/t1afm.c (T1_Get_Kerning): Ditto.
* include/freetype/cache/ftcmanag.h (ftc_family_table_free): Ditto.
2002-03-07 21:59:59 +00:00
David Turner 83b4a4b515 * include/freetype/freetype.h, include/freetype/internal/ftobjs.h,
src/base/ftobjs.c, src/base/ftinit.c: adding the new FT_Library_Version
        API to return the library's current version in dynamic links.
2002-03-06 12:42:34 +00:00
David Turner 4997097752 * src/pshinter/pshalgo2.c: changed 'print_zone' to 'psh2_print_zone'
* src/pshinter/pshalgo1.c: changed 'print_zone' to 'psh1_print_zone'
2002-03-06 12:39:12 +00:00
David Turner acfea4ddd9 * src/type1/t1objs.c (T1_Face_Init), src/cid/cidobjs.c (CID_Face_Init):
fixed another bug related to the ascender/descender/text height of
        Postscript fonts. Damn, this should have been fixed on 2002-03-04 !
2002-03-06 12:38:15 +00:00
David Turner 9ddeee1d41 formatting 2002-03-06 12:36:22 +00:00
Werner Lemberg 49bcf78d25 * src/pshinter/pshglob.h (PSH_DimensionRec): s/std/stdw/.
* src/pshinter/pshglob.c (psh_global_scale_widths,
psh_dimension_snap_width, psh_globals_destroy, psh_globals_new):
Ditto.
2002-03-06 06:05:56 +00:00
David Turner 28ea6f67c3 * src/sfnt/ttload.c (TT_Load_Names), src/sfnt/sfobjs.c (Get_Name),
src/sfnt/sfdriver.c (get_sfnt_postscript_name): Fixed the loader so
	that it accepts broken fonts like "foxjump.ttf", which made FreeType
	crash when trying to load them.

	Also improved the name table parser to be able to load
	Windows-encoded entries before Macintosh or Unicode ones, since it
	seems some fonts don't have reliable values here anyway.
2002-03-05 16:12:57 +00:00
David Turner fa0c8a70f6 * src/cid/cidriver.c (cid_get_postscript_name): fixed a bug that
caused the CID driver to return Postscript font names with a leading
        slash ("/") as in "/MOEKai-Regular"
2002-03-05 15:57:45 +00:00
David Turner 7d0f0bafab * src/type1/t1objs.c (T1_Face_Init),
src/cff/cffobjs.c (CFF_Face_Init),
          src/cid/cidobjs.c (CID_Face_Init):

            removing the bug that returned global BBox values in
            16.16 fixed format (instead of integer font units).
2002-03-05 15:55:28 +00:00
Werner Lemberg 8a9c0213d9 * builds/unix/aclocal.m4, builds/unix/ltmain.sh: Update to libtool
1.4.2.
Apply a small patch for AIX to make shared libraries work (this
patch is already in the CVS version of libtool).

* builds/unix/config.sub, builds/unix/config.guess: Updated to
recent versions.

* builds/unix/configure.ac: Fix typo
(AC_CONFIG_FILE->AC_CONFIG_FILES).

* builds/unix/configure: Regenerated.
2002-03-05 15:09:59 +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
David Turner 041889e763 * include/freetype/freetype.h: changing version to 2.1.0 to indicate
an unstable branch. Added the declarations of FT_Get_First_Char and
        FT_Get_Next_Char

        * src/base/ftobjs.c: implemented FT_Get_First_Char and FT_Get_Next_Char
2002-02-28 19:28:26 +00:00
David Turner 1c9a3d335f changing patch level to 9 (FT_FREETYPE_PATCH)
adding FT_Get_First_Char and FT_Get_Next_Char
2002-02-28 19:25:50 +00:00
David Turner 29644179cc still more logical transformations. This time, some public API headers have
been touched, while keeping everything backwards-compatible..

        * include/freetype/t1tables.h: re-naming structure types. This done
        basically:

          typedef T1_Struct_
          {
          } T1_Struct;

        becomes:

          typedef PS_StructRec_
          {
          } PS_StructRec, *PS_Struct;

          typedef PS_StructRec  T1_Struct;  /* backwards-compatibility */


        hence, we increase the coherency of the source code by effectuively
        using the 'Rec' prefix for structure types..
2002-02-28 18:59:37 +00:00
David Turner 4e7eeeec7b yet another logical transformation of the internals to make them
more consistent and understandable..

mainly, changing things like PS_Table  => PS_TableRec + *PS_Table
2002-02-28 16:10:29 +00:00
David Turner c03d9cf5cd * src/sfnt/ttload.c (TT_Load_Names): simplifying and securing the
names table loader. Invalid individual name entries are now handled
        correctly. This allows the loading of very buggy fonts like
        "foxjump.ttf" without allocating tons of memory and causing crashes..
2002-02-27 23:10:19 +00:00
David Turner 617a2e1c3c adding several experimental sources:
- OpenType Layout validation and parsing (common tables)
  - Type 1 charmap processing
2002-02-27 21:25:47 +00:00
David Turner 53b3fa1da5 * renaming stream functions to the FT_Subject_Action scheme:
FT_Seek_Stream         => FT_Stream_Seek
          FT_Skip_Stream         => FT_Stream_Skip
          FT_Read_Stream         => FT_Stream_Read
          FT_Read_Stream_At      => FT_Stream_Read_At
          FT_Access_Frame        => FT_Stream_Enter_Frame
          FT_Forget_Frame        => FT_Stream_Exit_Frame
          FT_Extract_Frame       => FT_Stream_Extract_Frame
          FT_Release_Frame       => FT_Stream_Release_Frame
          FT_Get_XXXX            => FT_Stream_Get_XXXX
          FT_Read_XXXX           => FT_Stream_Read_XXXX

          note also that:

          FT_New_Stream( filename, stream ) =>
            FT_Stream_Open( stream, filename )

          (the function doesn't create the FT_Stream structure, it simply
           initializes it for reading)

          FT_New_Memory_Stream( library, FT_Byte*  base, size, stream ) =>
            FT_Stream_Open_Memory( stream, const FT_Byte* base, size )

          FT_Done_Stream => FT_Stream_Close

          note that the name of the stream methods, defined in
          "include/freetype/ftsystem.h" have also been changed without
          problems:

            FT_Stream_IO    => FT_Stream_IOFunc
            FT_Stream_Close => FT_Stream_CloseFunc
2002-02-24 05:26:57 +00:00
David Turner 4d57024d1c * moving all code related to glyph loaders to "internal/ftgloadr.h"
and "src/base/ftgloadr.c".

        Note also that the type "FT_GlyphLoader" is now a pointer to the
        structure "FT_GlyphLoaderRec"..
2002-02-24 02:59:24 +00:00
David Turner 4a23351091 renaming "ft_glyph_own_bitmap" into "FT_GLYPH_OWN_BITMAP" 2002-02-24 02:39:08 +00:00
David Turner d248d8d681 adding API-specific source 2002-02-22 18:29:12 +00:00
David Turner 23ce5d4575 adding new & experimental charmap processor 2002-02-22 18:28:11 +00:00
David Turner 2c2b3734e7 adding glyph loader routines (previously in ftobjs.c) 2002-02-22 17:58:05 +00:00
David Turner 44ef8cae07 adding glyph loader header file (previously in ftobjs.h) 2002-02-22 17:57:35 +00:00
David Turner 33242884f9 adding file containing error definitions (unlike fterrors.h which also
contains macro definitions)..

the changes are not finished yet..
2002-02-22 17:57:05 +00:00
David Turner c919c7d461 adding new file 2002-02-22 14:40:12 +00:00
Werner Lemberg af8df8503f * include/freetype/internal/ftdebug.h (FT_Trace): Remove comma in
enum to avoid compiler warnings.
2002-02-22 00:58:04 +00:00
David Turner 222cec8c20 * include/freetype/internal/ftdebug.h, src/base/ftdebug.c: modified
the debug sub-system initialization. trace levels can now be specified
        within the "FT2_DEBUG" environment variable. See the comments within
        "ftdebug.c" for more details

        * include/freetype/internal/fttrace.h: new file to define the trace
        levels used for debugging. it is used both to define enums and
        toggle names for FT2_DEBUG

        * src/base/ftobjs.c, src/base/ftstream.c: FT_Assert renamed to
        FT_ASSERT

        * include/freetype/internal/ftextend.h, src/base/ftextend.c,
        src/base/Jamfile, src/base/rules.mk: removing "ftextend" from the
        library, since it is now completely obsolete..
2002-02-21 11:48:48 +00:00
David Turner 90839fa969 adding "devel@freetype.org" address for bug reports 2002-02-20 21:49:59 +00:00
Werner Lemberg 258951d7c5 * builds/unix/install.mk (check): New dummy target.
(.PHONY): Add it.
2002-02-20 00:55:59 +00:00
Werner Lemberg b5349a9b75 * builds/freetype.mk (FT_CFLAGS): Use $(INCLUDE_FLAGS) first.
* src/cache/ftccache.c (ftc_cache_resize): Mark `error' as unused
to avoid compiler warning.
* src/cff/cffload.c (CFF_Get_String): Ditto.
* src/cff/cffobjs.c (CFF_StrCopy): Ditto.
* src/psaux/psobjs.c (PS_Table_Done): Ditto.
* src/pcf/pcfread.c (pcf_seek_to_table_type): Ditto.
* src/sfnt/sfdriver.c (get_sfnt_postscript_name): Ditto.
(pcf_get_bitmaps): The same for `sizebitmaps'.
* src/psaux/t1decode.c (T1_Decode_Parse_Charstrings): The same for
`orig_y'.
(t1operator_seac): Comment out more dead code.
* src/pshinter/pshalgo2.c (ps2_hints_apply): Add `DEBUG_HINTER'
conditional.
* src/truetype/ttgload.c (TT_Process_Simple_Glyph,
load_truetype_glyph): Add `TT_CONFIG_OPTION_BYTECODE_INTERPRETER'
conditional.
2002-02-19 16:30:15 +00:00
Werner Lemberg a7d2f5e1c0 * src/autohint/ahglyph.c (ah_outline_link_segments): Remove unused
variables.
* src/autohint/ahhint.c (ah_align_serif_edge): Use FT_UNUSED instead
of UNUSED.
* src/autohint/ahmodule.c (ft_autohinter_reset): Ditto.
* src/pshinter/pshrec.c (ps_mask_table_merge): Fix typo in variable
swapping code.
* src/pshinter/pshglob.h (PSH_Blue_Align): Add PSH_BLUE_ALIGN_NONE.
* src/pshinter/pshglob.c (psh_blues_snap_stem): Use it.
* src/pshinter/pshalgo1.c (psh1_hint_table_optimize): Ditto.
* src/pshinter/pshalgo2.c (psh2_hint_align): Ditto.
* include/freetype/internal/ftobjs.h (UNUSED): Removed.
2002-02-19 01:12:23 +00:00
Werner Lemberg 66b3509bdd Add support for ISOLatin1 PS encoding.
* include/freetype/freetype.h (ft_encoding_latin_1): New tag
(`lat1').
* include/freetype/internal/t1types.h (T1_Encoding_Type): Add
`t1_encoding_isolatin1'.
* src/type1/t1driver.c (Get_Char_Index, Get_Next_Char): Handle
ft_encoding_latin_1.
* src/type1/t1load.c (parse_encoding): Handle `ISOLatin1Encoding'.
* src/type1/t1objs.c (T1_Face_Init): Handle `t1_encoding_isolatin1'.
2002-02-10 12:33:14 +00:00
Werner Lemberg 7c89d18d9f * README: Fix typo.
* docs/CHANGES: Minor fixes.
2002-02-09 17:59:12 +00:00
David Turner 1c6af4855a updating docs for 2.0.8 2002-02-08 14:00:20 +00:00
David Turner 0a2c691030 setting PATH_LEVEL to 8
removing FT_Get_Next_Char from the API (for the 2.0.8 release)
2002-02-08 13:54:10 +00:00
Werner Lemberg 7d69560afb cleaning 2002-02-08 13:11:18 +00:00
David Turner 57b8fcacd3 adding comments to FT_Get_Next_Char 2002-02-08 10:50:12 +00:00
Werner Lemberg 60a1fab094 some cleaning 2002-02-08 06:23:50 +00:00
David Turner 5a902ec20f * src/pcf/pcfread.c (pcf_load_font): removed immature support of
the AVERAGE_WIDTH property..
2002-02-07 16:59:38 +00:00
David Turner 27f6a05ed5 support for embedded fonts in PDF documents. These
often do not have a 'cmap', 'post' and 'name' table and
were not loaded by FreeType previously..

(thanks to Derek B. Noonburgs from XPDF)
2002-02-06 13:59:25 +00:00
David Turner 0489328e97 fixing memory leak in the PCF driver, and managing the
"AVERAGE_WIDTH" property in PCF fonts to return correct
character pixel (width/height) pairs for embedded bitmaps..
2002-02-06 11:22:56 +00:00
David Turner cae232d4f4 removing compiler warnings 2002-02-06 11:22:01 +00:00
Werner Lemberg 0f7c2f1aa5 Adding the function `FT_Get_Next_Char', doing the obvious thing
w.r.t. the selected charmap.

* include/freetype/freetype.h: Add prototype.
* include/freetype/internal/ftdriver.h: Add `FTDriver_getNextChar'
typedef.
(FT_Driver_Class): Use it.
* include/freetype/internal/psnames.h: Add `PS_Next_Unicode_Func'
typedef.
(PSNames_Interface): Use it.
* include/freetype/internal/tttypes.h: Add `TT_CharNext_Func'
typedef.
(TT_CMapTable): Use it.

* src/base/ftobjs.c (FT_Get_Next_Char): New function, implementing
high-level API.
* src/cff/cffdrivr.c (cff_get_next_char): New function.
(cff_driver_class): Add it.
* src/cid/cidriver.c (Cid_Get_Next_Char): New function.
(t1cid_driver_class): Add it.
* src/pcf/pcfdriver.c (PCF_Get_Next_Char): New function.
(pcf_driver_class): Add it.
* src/psnames/psmodule.c (PS_Next_Unicode): New function.
(psnames_interface): Add it.
* src/sfnt/ttcmap.c (code_to_next0, code_to_next2, code_to_next4,
code_to_next6, code_to_next_8_12, code_to_next_10): New auxiliary
functions.
(TT_CharMap_Load): Use them.
* src/truetype/ttdriver.c (Get_Next_Char): New function.
(tt_driver_class): Add it.
* src/type1/t1driver.c (Get_Next_Char): New function.
(t1_driver_class): Add it.
* src/winfnt/winfnt.c (FNT_Get_Next_Char): New function.
(winfnt_driver_class): Add it.

* src/pcf/pcfread.c (pcf_load_font): For now, report Unicode for
Unicode and Latin 1 encodings.
2002-02-04 20:55:58 +00:00
Werner Lemberg 3604d5f558 * builds/unix/freetype-config.in: Add missing `fi'. 2002-02-02 15:05:38 +00:00
David Turner 4c40011140 increasing FREETYPE_PATCH to 7 2002-02-01 09:22:39 +00:00
Werner Lemberg 32b534612d Formatting. 2002-02-01 01:20:11 +00:00
David Turner 944b72986f updating documentation for 2.0.7 2002-01-31 17:42:05 +00:00
Werner Lemberg b0e06e0b8b Fix ChangeLog. 2002-01-30 22:37:52 +00:00
David Turner a40fb43d7e moved INSTALL to docs/INSTALL to get rid of conflicts with the "install"
script on Windows (where the file system doesn't preserve CASE)
2002-01-30 12:56:16 +00:00
David Turner 09c14ae7c8 fixed the "configure" script in the top-level directory..
It didn't work correctly when several arguments were passed
to it. For example, when typing:

  ./configure --disable-shared --prefix=/usr

the "--prefix=/usr" was incorrectly sent to the "make" program..
2002-01-29 18:13:54 +00:00
Werner Lemberg 12a8741e7b * README.UNX: Fix typo.
* builds/unix/install.mk (uninstall): Fix library name for libtool.
2002-01-29 01:11:23 +00:00
Werner Lemberg a9aa69c2c8 * src/pcf/pcfdriver.c (PCF_Done_Face): Fix incorrect destruction of
the face object (face->toc.tables, face->root.family_name,
face->root.available_size, face->charset_encoding,
face->charset_registry are now freed).  Thanks to Niels Moseley.
2002-01-28 23:52:24 +00:00
Werner Lemberg 556ad08f03 * src/type1/t1load.c (parse_encoding): Set `loader->num_chars'.
* src/type1/t1load.c (parse_subrs, parse_charstrings): Use copy
of `base' string for decrypting to not modify the original data.
2002-01-28 13:34:52 +00:00
Werner Lemberg e274290d71 * src/smooth/ftgrays.c (gray_render_scanline): Fix bug which caused
bad rendering of thin lines (less than one pixel thick).
2002-01-28 05:04:22 +00:00
Werner Lemberg 43071cb7f2 * src/cff/cffdrivr.c (cff_get_name_index): Make last patch work
actually.
2002-01-25 22:55:53 +00:00
Werner Lemberg 8880f2c14d * src/cache/ftccache.c (ftc_node_done, ftc_node_destroy): Fix
compilation warnings.
* src/base/descrip.mms (OBJS): Add `ftmm.obj'.
* src/cache/descrip.mms (ftcache.obj): Dependencies added.
2002-01-25 16:05:39 +00:00
Antoine Leca 84712cc3fb * docs/PATENTS: Typo fixed (Thanks to Detlef "Hawkeye" Wuerkner) in the URL for the on-line resource. 2002-01-21 21:57:38 +00:00
Werner Lemberg 3f242ddd52 Undo incorrect commit. 2002-01-19 02:24:22 +00:00
Werner Lemberg 9c8ee92050 * builds/win32/ftdebug.c: New file.
* builds/win32/visualc/freetype.dsp: Updated.

* builds/amiga/src/base/ftsystem.c: Updated for AmigaOS 3.9.
* builds/amiga/README: Updated.
2002-01-19 02:20:45 +00:00
Werner Lemberg 5117ff0b73 * builds/win32/visualc/freetype.dsp: Updated. 2002-01-18 09:00:44 +00:00
Werner Lemberg 2f260409a4 * builds/unix/freetype2.a4: The script was still buggy.
* builds/unix/freetype-config.in: Make it really work for any install
prefix.
2002-01-13 06:36:02 +00:00
Werner Lemberg 51f245a615 * builds/unix/freetype2.a4: Fix some serious bugs. 2002-01-11 02:22:40 +00:00
Werner Lemberg 3975e2e1f5 Formatting. 2002-01-09 21:01:18 +00:00
David Turner db3ac3b360 small speed-up to the anti-aliased renderer 2002-01-09 10:48:25 +00:00
David Turner dc47784610 adding files 2002-01-08 18:34:11 +00:00
David Turner ce9a0441ad added 'configure' and 'install' wrapper scripts to make the
installation process more Unix-friendly :-)
2002-01-08 18:33:55 +00:00
David Turner 32ee45e09f fixed html quoting in DocMaker 2002-01-07 12:09:51 +00:00
David Turner 6096b5a11c updating documentation 2002-01-07 10:40:48 +00:00
David Turner 66f894e76c * include/freetype/config/ftoption.h: setting default options for
a release build (debugging off, bytecode interpreter off)
2002-01-07 10:05:34 +00:00
David Turner f86709a15b * src/base/ftobjs.c, src/base/ftoutln.c, src/cache/ftccmap.c,
src/cff/cffload.c, src/cff/cffobjs.c, src/pshinter/pshalgo2.c,
        src/sfnt/ttload.c, src/sfnt/ttsbit.c: removing small compiler
        warnings (in pedantic compilation modes)
2002-01-07 10:04:09 +00:00
Werner Lemberg ac812959bb formatting 2002-01-06 16:42:44 +00:00
David Turner f7f82d773b the TrueType glyph loader is now much more paranoid, this avoids
unpleasant overwrites in the case of invalid glyph data (found in
the output of buggy font converters)

the computation of auto-hinted stem widths has been modified to
avoid certain color fringes in LCD-decimation rendering (a.k.a.
"ClearType")
2002-01-06 10:13:40 +00:00
David Turner b1748d4044 added README.UNX for Unix users 2002-01-04 16:36:42 +00:00
David Turner 7fe38a5124 remove compiler warnings and a typo in builds/unix/ftsystem.c 2002-01-04 09:47:30 +00:00
Werner Lemberg 1a0a97938a * src/type1/t1objs.c (T1_Face_Init): Add cast to avoid compiler
warning.
2002-01-03 22:06:13 +00:00
David Turner c48bf37bda * builds/unix/ftsystem.c (FT_New_Stream): added a fix to ensure that
all FreeType input streams are closed in child processes of a "fork"
        on Unix systems. This is important to avoid (potential) access
        control issues..
2002-01-03 17:08:20 +00:00
David Turner 662b344c23 * src/type1/t1objs.c (T1_Face_Init): fixed a bug that crashed the
library when dealing with certain weird fonts (like "Stalingrad",
        in "sadn.pfb". This font has no full font name entry.. )

        * src/base/ftoutln.c, include/freetype/ftoutln.h: added the
        FT_Outline_Check API to check the consistency of outline data

        * src/base/ftobjs.c (FT_Load_Glyph): added a call to the new
        FT_Outline_Check to ensure that loaded glyphs are valid. This
        allows certain fonts like "tt1095m_.ttf" to be loaded even though
        it appears they contain really funky glyphs..

        there still is a bug there though.. !!
2002-01-03 16:56:59 +00:00
Werner Lemberg d3a71dd4ac Formatting. 2001-12-31 16:04:26 +00:00
David Turner 1127b2bf3f improving the computation of the advance widths of auto-hinted glyphs,
in order to produce better letter spacing..
2001-12-30 01:30:11 +00:00
Antoine Leca fb009c7449 * builds/dos/detect.mk: Correcting the order for Borland compilers:
16-bit bcc was never selected, always overriden by 32-bit bcc32.
2001-12-25 20:54:33 +00:00
Werner Lemberg f891f91113 * src/pfc/pcfread.c (pcf_load_font): Handle property `POINT_SIZE'
and fix incorrect computation of `available_sizes'.
2001-12-23 01:38:53 +00:00
Werner Lemberg 3681e37db9 Formatting. 2001-12-23 00:56:36 +00:00
Werner Lemberg 2786758c2e New file. 2001-12-22 20:32:20 +00:00
David Turner 9a9edc6624 fixing the autohinter: the advance of auto-hinted glyphs in mono-spaced fonts was incorrect 2001-12-22 16:07:52 +00:00
Werner Lemberg af594e606a * builds/amiga/*: Adaptations to latest changes.
Support added for MorphOS.

* src/pshinter/pshrec.c (FT_COMPONENT): Redefine to `trace_pshrec'.
(ps_mask_table_merge, ps_hints_open, ps_hints_stem,
ps_hints_t1stem3, ps_hints_t2mask, ps_hints_t2counter): Fix
FT_ERROR messages.
* src/pshinter/pshalgo1.c (FT_COMPONENT): Define as
`trace_pshalgo1'.
* src/pshinter/pshalgo2.c (FT_COMPONENT): Define as
`trace_pshalgo2'.
* include/freetype/internal/ftdebug.h (FT_Trace): Updated.

* docs/modules.txt: New file.
2001-12-22 14:38:40 +00:00
David Turner b5c7de5b37 * src/cff/cffgload.c: added a comment regarding "cntrmask" operator
* src/pshinter/pshrec.c: now ignores invalid "hintmask" and "cntrmask"
        operators (instead of returning an error). Glyph 2028 of the CFF font
        "MSung-Light-Acro" couldn't be rendered otherwise (it seems its
        charstring is buggy, though this requires more analysis)..
2001-12-21 21:21:13 +00:00
David Turner 7c0d20814a * src/cff/cffgload.c, src/psaux/t1decode.c, src/pshinter/pshrec.c,
src/pshinter/ahalgo2.c, src/pshinter/pshglob.h: fixed a bug where
        the X and Y axis where inversed in the postscript hinter. this
        caused problem when displaying on non-square surfaces..
2001-12-21 15:59:43 +00:00
David Turner 3a664fca14 * src/cid/cidobjs.c (CID_Face_Done): fixed a memory leak, the subrs
routines were never released when CID faces were destroyed
2001-12-21 15:26:19 +00:00
David Turner 79ea4cd40c * src/cid/cidobjs.c (CID_Face_Done): fixed a memory leak, the subrs
routines were never released when CID faces were destroyed
2001-12-21 15:20:48 +00:00
Werner Lemberg f05003dace Formatting. 2001-12-21 10:57:09 +00:00
David Turner 0515c09637 * src/pshinter/pshglob.c (psh_globals_new): replaced a floating point
constant with a fixed-float equivalent. For some reason, some compilers
        aren't capable of directly computing a floating pointer constant casted
        to FT_Fixed, and will link a math library instead !!
2001-12-21 04:16:42 +00:00
Werner Lemberg f41e71a199 * src/base/ftobjs.c (FT_Done_Library): Remove compiler warning.
Formatting.
2001-12-20 21:22:02 +00:00
Werner Lemberg 21e046e0c4 Formatting.
* src/cache/ftccache.c (ftc_node_destroy, ftc_cache_lookup): Fix
tracing strings.
* src/cache/ftccmap.c (ftc_cmap_family_init): Ditto.
* src/cache/ftcmanag.c (ftc_family_table_alloc,
ftc_family_table_free, FTC_Manager_Check): Ditto.
* src/cache/ftcsbits.c (ftc_sbit_node_load): Ditto.
2001-12-20 17:49:10 +00:00
David Turner 0f58446b3e disabling bytecode interpreter 2001-12-20 13:34:21 +00:00
David Turner 0fcb412ffc * docs/CHANGES: updated for 2.0.6 release
* src/cff/cffload.h, src/cff/cffload.c, src/cff/cffgload.c: updated
        to mode the definition of encoding tables within "cffload.c" instead
        of making them part of a shared header (causing problems in "multi"
        builds)
2001-12-20 13:33:03 +00:00
David Turner c8087481df * docs/TODO: added "stem3 and counter hints support" to the TODO list
for the Postscript hinter

        * docs/BUGS: closed the AUTOHINT-NO-SBITS bug.

        * src/pshinter/pshrec.c (t2_hint_stems), src/cff/cffobjs.h,
        src/cff/cffobjs.c, src/cff/cffload.c, src/cff/cffload.h,
        src/cff/cffgload.c, src/cff/cffgload.h, src/cff/cffdriver.c,
        include/freetype/internal/cfftypes.h: added Postscript hinter support
        to the CFF driver

        * src/base/ftobjs.c (FT_Done_Library): fixed a stupid bug that crashed
        the library on exit
2001-12-20 13:14:18 +00:00
David Turner 85eb669546 * src/type1/t1gload.c (T1_Load_Glyph): enable font matrix transform
on hinted glyphs..

        * src/cid/cidgload.c, src/cid/cidobjs.c, src/cid/cidobjs.h,
        src/cid/cidriver.c, include/freetype/internal/t1types.h: added
        Postscript hinter support to the CID font driver !!
2001-12-20 09:36:21 +00:00
Werner Lemberg 0d535112fd Formatting.
CFF encoding tables moved back from cffload.c to cffload.h.
2001-12-19 22:26:12 +00:00
David Turner 4937a3ebd2 * src/truetype/ttgload.c (TT_Load_Glyph), src/base/ftobjs.c
(FT_Load_Glyph): "fixed" the bug that prevented embedded bitmaps from
        begin loaded when the auto-hinter is used.. This actually is a hack
        but will be enough until the internal re-design scheduled for
        FreeType 2.1
2001-12-19 21:09:16 +00:00
David Turner c40a7e2d50 * include/freetype/cache/ftcache.h: added comments to indicate that
some of the exported functions should only be used by applications
        that need to implement custom cache types

        * src/truetype/ttgload.c: fixed a nasty bug that prevent composites
        from loading correctly. Believe it or not, this was due to an invalid
        macro definition !!
2001-12-19 19:17:35 +00:00
David Turner 8772845cdb * src/sfnt/sfobjs.c (SFNT_Load_Face): make the "post" and "name"
tables optional to load PCL fonts properly
2001-12-19 14:59:23 +00:00
David Turner fc3a316441 * src/raster/ftrend1.c (ft_raster1_render): fixed a nasty outline
shifting bug in the monochrome renderer.

        * README: updated version numbers to 2.0.6
2001-12-19 14:47:28 +00:00
Werner Lemberg aef3fc816b * src/truetype/ttgload.c (load_truetype_glyph): Fix test for invalid
glyph header.
2001-12-17 16:21:22 +00:00
Werner Lemberg c2e97a3072 Updating/Formatting. 2001-12-16 23:53:39 +00:00
Werner Lemberg 5da9dd77f2 * src/base/ftglyph (FT_Glyph_To_Bitmap): Remove compiler warning.
* include/freetype/ftcache.h (FTC_Node_Unref): Removed.  It is
already in ftcmanag.h.
* src/cache/ftcsbits.c (ftc_sbit_node_load): Remove unused variable
`gfam'.
* src/cache/ftcmanag.c (ftc_family_table_alloc,
* ftc_family_table_free): Use FT_EXPORT_DEF.
* include/freetype/cache/ftcmanag.h: Updated.
* src/cache/ftccache.c (ftc_node_destroy): Use FT_EXPORT_DEF.
* src/cache/ftccmap.c (ftc_cmap_node_init): Remove unused variable
`cfam'.
Remove compiler warning.
(FTC_CMapCache_Lookup): Remove compiler warnings.
(ftc_cmap_family_init): Ditto.
(FTC_CMapCache_Lookup): Ditto.

* builds/unix/configure.ac: Increase `version_info' to 8:0:2.
* builds/unix/configure: Regenerated.

* builds/mac/README: Updated.
2001-12-16 08:17:33 +00:00
David Turner 59c9fea654 * src/truetype/ttgload.c (load_truetype_glyph): fixing crash when dealing
with invalid fonts (i.e. glyph size < 10 bytes)..
2001-12-14 15:14:44 +00:00
David Turner 7a1e2c12bf * builds/mac/freetype.mac: a new Makefile to build with MPW on MacOS
classic..
2001-12-14 15:06:15 +00:00
David Turner bce2986d0d fixing hinted advance width bug in all font drivers 2001-12-14 14:52:58 +00:00
David Turner 2b30c17fd3 * src/pshint/pshglob.c: adding correct BlueScale/BlueShift support,
plus family blues processing

    * src/cff/cffgload.c: started adding support for the Postscript hinter
2001-12-12 16:07:29 +00:00
Werner Lemberg 2f5d1b76ca * builds/unix/freetype2.m4: Some portability fixes. 2001-12-12 15:15:44 +00:00
Werner Lemberg fa4ca88346 * src/base/descrip.mms (OBJS): Add ftdebug.obj. 2001-12-11 14:11:11 +00:00
Werner Lemberg 04bfe312a5 * src/sfnt/ttload.c (TT_Load_Generic_Header): Typos. 2001-12-11 14:09:06 +00:00
David Turner 09feefee16 * src/base/fttrigon.c (FT_Cos): fixed a small bug that caused slightly
improper results for FT_Cos and FT_Sin (example: FT_Sin(0) == -1 !!)
2001-12-11 13:49:55 +00:00
David Turner dd27182038 * builds/unix/freetype-config.in: modified the script to prevent
passing "-L/usr/lib" to gcc

        * docs/FTL.TXT: simple fix (change "LICENSE.TXT" to "FTL.TXT")

        * builds/unix/freetype2.m4: added autoconf macro, we need to install
        it in $(prefix)/share/aclocal/freetype2.m4 but I didn't modified
        builds/unix/install.mk yet..
2001-12-11 13:38:52 +00:00
David Turner 7da4824dfb * include/freetype/internal/ftstream.h: fixed the definitions of
GET_LongLE and GET_ULongLE which where incorrect (creating problems
        in the pcf driver)..

        * INSTALL: updated the instructions to build shared libraries with
        Jam.. they were simply erroneous..
2001-12-11 13:14:41 +00:00
David Turner 640078d425 * src/pcf/pcfdriver.c (PCF_Init_Face): allow Xft to use PCF fonts
by setting the "face->metrics.max_advance" correctly..
2001-12-10 10:47:47 +00:00
David Turner 66646404f6 small fix 2001-12-08 00:54:19 +00:00
Werner Lemberg e9e130c071 Formatting. 2001-12-07 21:56:32 +00:00
David Turner 145f94cb26 added new charmap cache. see include/freetype/cache/ftccmap.h 2001-12-07 14:43:45 +00:00
Leonard Rosenthol 6b2e4d4e13 Noted my Mac OS changes from today 2001-12-07 01:51:48 +00:00
Werner Lemberg 69905a2f24 Fix ChangeLog. 2001-12-06 18:37:52 +00:00
Werner Lemberg 41892ed18b * INSTALL: Small update. 2001-12-06 18:37:34 +00:00
Leonard Rosenthol 07c8774ca2 Exported new routine for getting a path from a name 2001-12-06 17:52:40 +00:00
Leonard Rosenthol 7013373eb7 Added support for Mac OS X .dfonts and also getting a filespec for a given font by name 2001-12-06 17:52:06 +00:00
David Turner a09764555c oops, forgot to add new file and remove old one in src/cache 2001-12-06 16:45:26 +00:00
David Turner c8ad30a7a0 * src/base/ftglyph.c (FT_Glyph_To_Bitmap): re-ordered code for debugging
purposes..


    * src/smooth/ftsmooth.c (ft_smooth_render): fixed a nasty hidden bug where
    outline shifting wasn't correctly undone after bitmap rasterization. this
    created problems with certain glyphs (like '"' of certain fonts..) and
    the cache system..
2001-12-05 17:24:34 +00:00
David Turner 14183ea0f8 First of all, a big thanks to Werner and Antoine for their latest work !!
* src/pshinter/pshalgo2.c (psh2_hint_table_init),
      src/pshinter/pshalgo1.c (psh1_hint_table_init): removed compiler
      warnings

    * include/freetype/cache/*, src/cache/*: yet another massive rewrite of
    the caching sub-system, in order to both increase performance and allow
    simpler cache sub-classing. As an example, the code for the image and
    sbit caches is now much simpler

    I still need to update the documentation in www/freetype2/docs/cache.html
    to reflect the new design though..
2001-12-05 15:59:33 +00:00
Werner Lemberg c3b2160869 Formatting.
Cleaning up of ChangeLog.

* docs/license.txt: s/X Windows/X Window System/.

* src/raster/ftraster.c: Fix definition condition of MEM_Set().
* src/smooth/ftgrays.c (M_Y): Change value to 192.
* src/base/ftdbgmem.c (ft_mem_table_destroy): Fix printf() parameter.
Remove unused variable.
* src/cache/ftcimage.c (ftc_image_node_init,
ftc_image_node_compare): Remove unused variables.
* src/cache/ftcsbits.c (ftc_sbit_node_weight): Remove unused
variable.
* src/raster/ftraster.c (MEM_Set): Move definition down to avoid
compiler warning.
* src/autohint/ahhint.c (ah_hinter_hint_edges): Use UNUSED() to
avoid compiler warnings.
* src/pcf/pcfread.c (tableNames): Use `const'.
(pcf_read_TOC): Change counter name to avoid compiler warning.
Use `const'.
* src/pshinter/pshrec.c (ps_hints_close): Remove redundant
declaration.
* src/pshinter/pshalgo1.c (psh1_hint_table_init): Rename variables
to avoid shadowing.
* src/pshinter/pshalgo2.c (psh2_hint_table_activate_mask): Ditto.
* src/type1/t1objs.h: Remove double declarations of `T1_Size_Init()'
and `T1_Size_Done()'.
2001-12-05 01:22:05 +00:00
Antoine Leca d0e6ad636f * include/freetype/ttnameid.h: Added some new Microsoft language
codes and LCIDs as found in MSDN (Passport SDK). Also added
comments about the meaning of bit 57 of OS/2 (TT_UCR_SURROGATES)
which with OpenType v.1.3 now means "there is a character beyond
FFFF in this font". Thanks to Detlef Wuerkner <TetiSoft@apg.lahn.de>
for noticing this.
2001-11-20 19:22:13 +00:00
David Turner f2c56515f5 * src/pshinter/{pshalgo2.c, pshalgo1.c}: fixed stupid bug in sorting
routine that created nasty alignment artefacts.

        * src/pshinter/pshrec.c, tests/gview.c: debugging updates..

        * src/smooth/ftgrays.c: de-activated experimental gamme support,
        apparently, "optimal" gamma tables depend on the monitor type,
        resolution and general karma, so it's better to compute them outside
        of the rasterizer itself..
2001-11-20 01:29:34 +00:00
David Turner adf07a930c * src/smooth/ftgrays.c: adding experimental "gamma" support. This
produces smoother glyphs at small sizes for very little cost

	* src/autohint/ahglyph.c, src/autohint/ahhint.c: various fixes to
	the auto-hinter. They merely improve the output of sans-serif fonts.
	Note that there are still problems with serifed fonts and composites
	(accented characters)

	* tests/gview.c: updated the debugging glyph viewer to show the
	hints generated by the "autohint" module
2001-10-30 23:51:24 +00:00
David Turner 9d7e5e8b8b other auto-hinter experiments not worthy of a Changelog entry 2001-10-29 17:22:12 +00:00
David Turner b92479b8c2 experimental changes to debug the auto-hinter. These are not
worthy of a Changelog entry yet..
2001-10-29 10:45:57 +00:00
David Turner 75133bff1d fixed a small performance bug in the new cache sub-system implementation 2001-10-27 17:36:04 +00:00
Tom Kacvinsky 8d14d4729c Changed a minor typo. 2001-10-26 18:02:15 +00:00
Tom Kacvinsky 0805ec2589 Changed tjk@ams.org to tkacvins@freetype.org. 2001-10-26 18:01:32 +00:00
David Turner cd605b6302 _major_ re-design of the caching sub-system. Still using the same API
though :-)
2001-10-26 16:58:27 +00:00
Leonard Rosenthol ae340bbfec Incorporated changes for faces other than the first 2001-10-26 13:24:39 +00:00
Leonard Rosenthol 3200d68dc6 Changed to reflect current status 2001-10-26 13:23:56 +00:00
Leonard Rosenthol 91ff42258e Added changes about MacOS stuff 2001-10-26 13:23:38 +00:00
David Turner a11cd4e183 a few updates used to debug the auto-hinter as well as
try to improve it significantly
2001-10-26 07:21:38 +00:00
Leonard Rosenthol 2f553a2c38 Added change about ftlib.prj 2001-10-25 16:04:24 +00:00
Leonard Rosenthol a2ccd98a8a Updated project to CodeWarrior 7 and latest FT source files 2001-10-25 15:56:01 +00:00
David Turner dcb2b27ea8 updated comment explaining how to use project-specific
option (and module) files
2001-10-24 23:33:31 +00:00
Tom Kacvinsky 40da4e401b * builds/unix/ftsystem.c (FT_New_Memory): Added a missing `}'. 2001-10-24 14:45:15 +00:00
Tom Kacvinsky 7bb9276686 In function FT_New_Memory, added a missing `}'. 2001-10-24 14:43:40 +00:00
David Turner aa007cd2ed * include/freetype/internal/ftmemory.h, src/base/ftdbgmem.c:
improvements to the memory debugger to report more information in
	case of errors. Also, some allocations that occured through
	REALLOC couldn't be previously catched correctly..
2001-10-24 08:04:00 +00:00
David Turner 5a1de37e7e replaced liberal uses of "memset" by the "MEM_Set" macro call
(some platforms don't provide this ANSI function !!)

some changes to "ftsystem.c" implementations in order to use
the new memory debugger on Unix, VMS and Amiga too !!
2001-10-24 07:32:55 +00:00
David Turner 3a65746f1d replaced liberal uses of "memset" by the "MEM_Set" macro call
(some platforms don't provide this ANSI function !!)
2001-10-24 07:31:03 +00:00
David Turner 6e34ec93bc updating the debugging memory manager to run on Unix, VMS and
Amiga too (since they use a custom version of "ftsystem.c" !!)
2001-10-23 20:19:01 +00:00
David Turner 8dc0fb855e updating debug manager 2001-10-22 20:15:29 +00:00
David Turner 88cdbb34a2 removed bogus warnings 2001-10-22 15:24:32 +00:00
David Turner 950c669060 * include/freetype/internal/ftmemory.h, src/base/ftdbgmem.c: modified
the debugging memory manager to report the location (source file name
        + line number) where leaked memory blocks are allocated in the source
        file..  funny, isn't it ??
2001-10-22 14:50:41 +00:00
David Turner 869fc49017 Added a new debugging memory manager implementation. See the
FT_DEBUG_MEMORY macro definition in "ftoption.h", as well as the
file "src/base/ftdbgmem.c"
2001-10-22 08:32:21 +00:00
Tom Kacvinsky a006a0f5ec 2001-10-21 Tom Kacvinsky <tjk@ams.org>
* src/cff/cffload.c (CFF_Done_Font): Free subfonts array only if
        we are working with a CID keyed CFF font.  Otherwise, a variable
        that was never allocated memory might freed.  This is a correction
        to the previous patch for freeing subfonts.
2001-10-21 20:30:54 +00:00
Tom Kacvinsky dfa4568432 In function CFF_Done_Font, make sure that subfonts are freed only if
we are working with a CID keyed CFF font.  This is to avoid freeing a
variable that might not have been allocated.
2001-10-21 20:26:59 +00:00
Tom Kacvinsky 726a4fa6f1 2001-10-21 Tom Kacvinsky <tjk@ams.org>
* src/cff/cffload.c (CFF_Done_Font): Free the subfonts array to
        avoid a memory leak.
2001-10-21 16:30:59 +00:00
Tom Kacvinsky 98289a2a65 In function CFF_Done_Font, make sure to free the subfonts array to
avoid a memory leak.
2001-10-21 16:29:16 +00:00
David Turner 12d40dac42 * src/type1/t1load.c: fixed memory leak bugs that appeared with certain
synthetized fonts (e.g. CourierBoldOblique, a.k.a. "cobo_____.pfb")

	* src/pshinter/pshalgo2.c, src/pshinter/pshalgo1.c,
	src/pshinter/pshglob.c: removing compiler warnings in pedantic modes
	(in multi-object compilation mode, mainly)
2001-10-21 15:41:11 +00:00
Tom Kacvinsky e6eaadf683 Added another entry for t1load.c related to synthetic fonts: make sure
that custom encodings are not loaded twice (thus avoiding a memory
leak).
2001-10-20 20:49:58 +00:00
Tom Kacvinsky 629bf286e7 In function parse_encoding, add a test to make sure that custom
encodings (i.e., neither StandardEncoding nor ExpertEncoding) are not
loaded twice when the Type 1 font is synthetic.
2001-10-20 20:46:36 +00:00
Tom Kacvinsky 3beab5bd13 Added entries for changes to t1load.c. 2001-10-20 17:53:22 +00:00
Tom Kacvinsky 48f26bc748 In functions parse_font_name and parse_subrs, added a test for when
loading synthetic fonts to make sure that the font name and
subrotuines are not loaded twice.  This is to remove a memory leak
that occurs because the original allocation for these objects is not
deallocated when the objects are read the second time.
2001-10-20 17:44:48 +00:00
Werner Lemberg 620ec14955 renaming todo -> TODO 2001-10-20 01:29:38 +00:00
David Turner 7e4b52d17b getting rid of compiler warnings 2001-10-19 09:17:49 +00:00
David Turner 3b9f1e096d another small test of the CVS loginfo setup 2001-10-19 08:15:28 +00:00
David Turner 0d7ccf1d4e adding or updating files to the old build system to compile
the library with the Postscript hinter correctly..
2001-10-19 07:34:20 +00:00
David Turner b3e1b292cd just testing the CVS loginfo setup 2001-10-18 15:02:47 +00:00
David Turner 043be66c15 just testing the CVS loginfo setup 2001-10-18 14:58:45 +00:00
David Turner b347aaa206 just testing the CVS loginfo setup 2001-10-18 14:57:28 +00:00
David Turner ec3c28a847 just testing the CVS loginfo setup 2001-10-18 14:54:49 +00:00
David Turner 8e005d502d just testing the CVS loginfo setup 2001-10-18 14:50:01 +00:00
David Turner 6043d2bc5d just testing the CVS loginfo setup 2001-10-18 14:49:12 +00:00
David Turner d5fb3512b0 just testing the CVS loginfo setup 2001-10-18 14:45:28 +00:00
David Turner 0ad006b76f just testing the CVS loginfo setup 2001-10-18 14:36:46 +00:00
David Turner 12c6830662 just testing the CVS loginfo setup 2001-10-18 14:35:52 +00:00
David Turner 8d6aae02d8 just testing the CVS loginfo setup 2001-10-18 14:33:11 +00:00
David Turner 835368543f just testing the CVS loginfo setup 2001-10-18 14:31:41 +00:00
David Turner a0b314c044 just testing the CVS loginfo setup 2001-10-18 14:27:43 +00:00
David Turner 3b25cc7b03 just testing the CVS loginfo setup 2001-10-18 14:25:38 +00:00
David Turner 6ea520aad4 just testing the CVS loginfo setup 2001-10-18 14:12:44 +00:00
David Turner 3cb2500966 just testing the CVS loginfo setup 2001-10-18 14:10:23 +00:00
David Turner 5a4c1ff381 just testing the CVS loginfo setup 2001-10-18 14:07:06 +00:00
David Turner 02f3b4889c just testing the CVS loginfo setup 2001-10-18 14:02:15 +00:00
David Turner 730d0540a4 just testing the CVS loginfo setup 2001-10-18 14:00:54 +00:00
David Turner 0ebf28c73e just testing the CVS loginfo setup 2001-10-18 13:58:05 +00:00
David Turner 29d5a0ecbd just testing the CVS loginfo setup 2001-10-18 13:52:47 +00:00
David Turner afa3854202 documentation update 2001-10-18 13:22:01 +00:00
David Turner f373e2d9bc rewrote "glnames.py" to fix a rather nasty bug that made FreeType
return incorrect glyph names for certain glyph indices..
2001-10-18 13:20:01 +00:00
David Turner c9349c9343 updating ChangeLog and Jamfile for the new Postscript hinter 2001-10-18 11:59:08 +00:00
David Turner c55099de40 changing pixel size computations for better accuracy (experimental) 2001-10-18 11:57:52 +00:00
David Turner 540e7cd6c6 Adding glyph hinter debugging program.
WARNING:
You cannot compile this program without a (yet) unavailable
third-party library named "Nirvana".. this is reserved for FreeType
development exclusively..
2001-10-18 11:50:31 +00:00
David Turner 5893c1bb2a add support for new postscript hinter 2001-10-18 11:49:26 +00:00
David Turner 573a98d048 add support for new postscript hinter 2001-10-18 11:46:25 +00:00
David Turner a83bc088ec adding new postscript hinter 2001-10-18 11:38:43 +00:00
David Turner 0e49a4b8e7 adding support to new postscript hinter 2001-10-18 11:26:21 +00:00
David Turner a1471038bd fixing a "bug" that affected the Postscript hinter: growing a memory block
though "realloc" didn't clear the new bytes of memory..
2001-10-18 11:23:51 +00:00
David Turner 39bea028f8 fixed typo 2001-10-18 10:27:56 +00:00
David Turner 1c5802a4b2 updated FT_Div64by32 2001-10-18 09:51:09 +00:00
David Turner ea5a981c7d minimal optimisation submitted by Graham Asher 2001-10-17 14:29:51 +00:00
David Turner 034a19326b documentation update for 2.0.5 2001-10-17 13:57:02 +00:00
David Turner 23bcde193e implementing a new function named "FT_Get_Postscript_Name" to
retrieve a face's "unique" Postscript name
2001-10-17 13:48:10 +00:00
David Turner 40d006af7c tagging files, checking new CVS -> mail script 2001-10-17 11:33:01 +00:00
Werner Lemberg 80b8d77024 Fixed a bug in `glnames.py' that prevented it from generating
correct glyph names tables.  This resulted in the unavailability of
certain glyphs like `Cacute', `cacute' and `lslash' in Unicode
charmaps, even if these were present in the font (causing problems
for Polish users).

* src/tools/glnames.py (mac_standard_names): Fixed.
(t1_standard_strings): Some fixes and renamed to ...
(sid_standard_names): This.
(t1_expert_encoding): Fixed.
(the_adobe_glyph_list): Renamed to ...
(adobe_glyph_names): This.
(the_adobe_glyphs): Renamed to ...
(adobe_glyph_values): This.
(dump_mac_indices, dump_glyph_list, dump_unicode_values, main):
Updated.
* src/psnames/pstables.h: Regenerated.
* src/psnames/psmodule.c (PS_Unicode_Value): Fix offset.
Fix return value.
Use `sid_standard_table' and `ps_names_to_unicode' instead of
`t1_standard_glyphs' and `names_to_unicode'.
(PS_Macintosh_Name): Use `ps_glyph_names' instead of
`standard_glyph_names'.
(PS_Standard_Strings): Use `sid_standard_names' instead of
`t1_standard_glyphs'.
* doc/BUGS, doc/TODO: New documents.
* src/cache/ftlru.c (FT_Lru_Lookup_Node): Fixed a bug that prevented
correct LRU behaviour.
setjmp() and longjmp() are now used for rollback (i.e. when memory
pool overflow occurs).
Function names are now all uniformly prefixed with `gray_'.

* src/smooth/ftgrays.c: Include <setjmp.h>.
(ErrRaster_MemoryOverflow): New macro.
(TArea): New type to store area values in each cell (using `int' was
too small on 16-bit systems).  <limits.h> is included to properly
get the needed data type.
(TCell, TRaster): Use it.
(TRaster): New element `jump_buffer'.
(gray_compute_cbox): Use `RAS_ARG' as the only parameter and get
`outline' from it.
(gray_record_cell): Use longjmp().
(gray_set_cell): Use gray_record_cell() for error handling.
(gray_render_line, gray_render_conic, gray_render_cubic): Simplify.
(gray_convert_glyph_inner): New function, using setjmp().
(gray_convert_glyph): Use it.


Provide a public API to manage multiple size objects for a given
FT_Face in the new header file `ftsizes.h'.

* include/freetype/ftsizes.h: New header file,
* include/freetype/internal/ftobjs.h: Use it.
Remove declarations of FT_New_Size and FT_Done_Size (moved to
ftsizes.h).
* include/freetype/config/ftheader.h (FT_SIZES_H): New macro.
* src/base/ftobjs.c (FT_Activate_Size): New function.
* src/cache/ftcmanag.c: Include ftsizes.h.
(ftc_manager_init_size, ftc_manager_flush_size): Use
FT_Activate_Size.
2001-10-10 19:56:42 +00:00
David Turner 1cd4f85e14 updating CHANGES
preparing for the 2.0.5 release
2001-10-09 07:32:50 +00:00
David Turner b4b96260e4 * src/psnames/pstables.h, src/psnames/psmodule.c, src/tools/glnames.py:
fixed a bug in 'glnames.py' that prevented it from generating correct
	glyph names table. This resulted in the unavailability of certain glyphs
	like "Cacute", "cacute" and "lslash" in Unicode charmaps, even if these
	were present in the font (causing problems for Polish users).
2001-10-08 21:18:11 +00:00
David Turner 4c647903b5 oops, forgot to add this file 2001-10-08 20:46:37 +00:00
David Turner b3ba40ddfd * include/freetype/ftsizes.h, src/base/ftobjs.c, src/cache/ftcmanag.c:
added a new header, named "ftsizes.h" (FT_SIZES_H) to provide a public
	API to manage multiple size objects for a given FT_Face.
2001-10-07 13:30:26 +00:00
David Turner 5b1e81411d * src/cache/ftlru.c (FT_Lru_Lookup_Node): fixed a bug that prevented
correct LRU behaviour
2001-10-07 11:06:07 +00:00
David Turner c4f622c341 * src/smooth/ftgrays: "setjmp/longjmp" is now used for rollback (i.e.
when memory pool overflow occurs), function names are now all prefixed
	with "gray_", and a new type (TArea) is defined to store area value in
	each cell (using "int" was too small on 16-bit systems)..
2001-10-07 10:39:03 +00:00
David Turner 21939455dc Adding a new file named docs/BUGS contained a table of known bugs
of the library

Updated the docs/CHANGES and docs/TODO documents slightly
2001-10-05 14:23:03 +00:00
David Turner 12841de1c7 fixing a bug related to decoding glyph names like "uniXXXX" into
Unicode character codes
2001-10-05 09:42:50 +00:00
Werner Lemberg 4667dd6d17 Add ChangeLog entry. 2001-09-20 12:01:09 +00:00
Werner Lemberg 9e616daa92 Amiga port 2001-09-20 11:58:51 +00:00
Werner Lemberg 76e05c65d5 Initial revision 2001-09-20 11:58:51 +00:00
Werner Lemberg 817a85a8ad * src/type1/t1afm.c (T1_Done_AFM): Free `afm'. 2001-09-15 10:05:12 +00:00
Werner Lemberg 20abe742a7 * src/sfnt/ttcmap.c (code_to_index2): Handle code values with
hi-byte == 0 correctly.

* builds/link-std.mk ($(PROJECT_LIBRARY)): Fix typo.
2001-09-10 13:11:52 +00:00
Werner Lemberg ec342907b3 formatting 2001-09-10 06:55:43 +00:00
David Turner f699cc31b0 file pshoptim.h was initially added on branch VER-2-0-4-PATCH. 2001-09-04 14:17:51 +00:00
David Turner f6bc1510cd file pshoptim.c was initially added on branch VER-2-0-4-PATCH. 2001-09-04 14:17:51 +00:00
David Turner 8ab0add6b4 Martin Muskens bufixes:
- reallocation bug in T1_Table_Add
  - increased accuracy of units per EM computation in T1 fonts
  - support "+" as valid font name character (used in embedded fonts)
2001-08-30 07:59:28 +00:00
David Turner 26160d5b2c fixed Type1 kerning flag setting when reading AFM file 2001-08-30 06:56:03 +00:00
Werner Lemberg bcf8d4b497 * src/sfnt/ttload.c (TT_Load_CMap): Fix frame length of
`cmap_rec_fields'.

* include/freetype/fterrors.h [!FT_CONFIG_OPTION_USE_MODULE_ERRORS]:
Undefine FT_ERR_BASE before defining again.
2001-08-24 23:11:34 +00:00
Werner Lemberg 28df3070f0 * src/truetype/ttinterp.h: Fix prototype of TT_Move_Func.
Some formatting
2001-08-22 18:35:06 +00:00
Werner Lemberg a0d32dc1fa * builds/dos/dos-def.mk (NO_OUTPUT): Don't use `&>' but `>'. 2001-08-21 15:49:24 +00:00
David Turner 67750c8fa4 updating the definition of FT_CONFIG_OPTION_USE_MODULE_ERRORS
to _undefined_ (source compatibility breaking issue) + updated its comment

back from holidays, woohoo :-)
2001-08-21 08:50:45 +00:00
Werner Lemberg 6870f4cf1a * src/base/ftcalc.c (FT_MulDiv): Fixed serious typo. 2001-08-18 05:09:42 +00:00
Werner Lemberg 5dea44438f Updating to OpenType 1.3.
* include/freetype/internal/tttypes.h (TT_CMap0, TT_CMap2, TT_CMap4,
TT_CMap6): Adding field `language'.
(TT_CMapTable): Removing field `language'.
Type of `length' field changed to FT_ULong.
Adding fields for cmaps format 8, 10, and 12.
(TT_CMapGroup): New auxiliary structure.
(TT_CMap8_12, TT_CMap10): New structures.
* include/freetype/tttables.h (TT_HoriHeader, TT_VertHeader):
Removed last element of `Reserved' array.
* include/freetype/ttnameid.h (TT_PLATFORM_CUSTOM, TT_MS_ID_UCS_4,
TT_NAME_ID_CID_FINDFONT_NAME): New macros.

* src/sfnt/ttcmap.c (TT_CharMap_Load): Updated loading of `language'
field to the new structures.
Fixed freeing of arrays in case of unsuccessful loads.
Added support for loading format 8, 10, and 12 cmaps.
(TT_CharMap_Free): Added support for freeing format 8, 10, and 12
cmaps.
(code_to_index4): Small improvement.
(code_to_index6): Ditto.
(code_to_index8_12, code_to_index10): New functions.
* src/sfnt/ttload.c (TT_Load_Metrics_Header): Updated to new
structure.
(TT_Load_CMap): Ditto.

* src/sfnt/sfobjs.c (tt_encodings): Add MS UCS4 table (before MS
Unicode).


* src/type1/t1driver.c (t1_get_name_index): Fix compiler warning.
2001-08-13 11:44:29 +00:00
Tom Kacvinsky 32949c1b97 Added entries for chnages to t1driver.c (new name_index function,
function name change)

Added entries for cffdrivr.c (documentation fix, function name change)
2001-08-09 01:21:24 +00:00
Tom Kacvinsky aea07ccdba Changed function get_cff_glyph_name to cff_get_glyph_name for
consistency.

Minor documentation change for function cff_get_glyph_index.
2001-08-09 01:13:43 +00:00
Tom Kacvinsky cfcec824eb Added function t1_get_name_index and changed Get_Interface to return
this function when the "name_index" function is requested.

Changed get_t1_glyph_name to t1_get_glyph_name for consistency.
2001-08-09 01:06:33 +00:00
Tom Kacvinsky 2eaadd5ad8 Added entries for changes to CFF driver (moved some assignments from
source file to header and added glyph name index requestor function).

Added entries for chnages to FreeType includes for new function
FT_Get_Name_Index.
2001-08-08 11:18:13 +00:00
Tom Kacvinsky 3c6e026a4e Added documentation and prototype for new function FT_Get_Name_Index. 2001-08-08 11:08:58 +00:00
Tom Kacvinsky d2a996c482 Added FT_Name_Index_Requester, a function pointer type defintion used
for in the function FT_Get_Name_Index.
2001-08-08 11:02:12 +00:00
Tom Kacvinsky ff2714feca Added function FT_Get_Name_Index, used to return a glyph index for a
given glyph name only if the driver supports glyph names.
2001-08-08 10:58:08 +00:00
Tom Kacvinsky 52371001d0 Added function cff_get_name_index, used as a requestor function for
FT_Get_Name_Index.  Also, modified cff_get_interface so that it returns the
function cff_get_name_index when the "name_index" function is requested.
2001-08-08 10:51:44 +00:00
Tom Kacvinsky 236f82dbb2 Added definitions of cff_isoadobe_charset, cff_expert_charset, cff_expertsubset_charset,
cff_standard_encoding, and cff_expert_encoding arrays.
2001-08-08 10:45:08 +00:00
Tom Kacvinsky 0f88cdbe36 Removed definitions of cff_isoadobe_charset, cff_expert_charset, cff_expertsubset_charset,
cff_standard_encoding, and cff_expert_encoding arrays to cffload.h.
2001-08-08 10:42:44 +00:00
Werner Lemberg 7dabafd63e * builds/cygwin/*: Removed. Use the unix stuff instead.
* builds/vms/ftconfig.h (FT_CALLBACK_DEF): Updated to change dated
2001-06-27.
2001-07-26 13:17:21 +00:00
Werner Lemberg 49f3cf6546 Add ChangeLog entry. 2001-07-17 12:44:49 +00:00
Werner Lemberg 36af3ea62b * include/freetype/internal/psaux.h (PS_Table): Use FT_Offset for
`cursor' and `capacity'.
* src/psaux/psobjc.c (reallocate_t1_table): Use FT_Long for second
parameter.
(PS_Table_Add): Use FT_Offset for `new_size'.


* src/base/ftsynth.c: Include ftcalc.h unconditionally.
2001-07-17 12:37:54 +00:00
David Turner 59a6a3649f file pshfit.c was initially added on branch VER-2-0-4-PATCH. 2001-07-17 07:24:37 +00:00
David Turner 9fdfe06a0d file pshfit.h was initially added on branch VER-2-0-4-PATCH. 2001-07-17 07:24:37 +00:00
Werner Lemberg a4bf7d660f 2001-07-13 Werner Lemberg <wl@gnu.org>
* src/base/ftsynth.c: Include ftcalc.h unconditionally.
2001-07-12 22:41:08 +00:00
Werner Lemberg 7cf4c6dfa8 formatting 2001-07-12 21:46:44 +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
David Turner ca90a2c46b * include/internal/ftstream.h: modified the definitions
of the FT_GET_XXXX and NEXT_XXXX macros for 16-bit correctness
2001-07-06 13:52:36 +00:00
Werner Lemberg a560a1e018 * src/autohint/ahhint.c (ah_hinter_align_weak_points): Remove
unused variable `edges'.
(ah_hinter_load): Remove unused variables `old_width' and
`new_width'.
* src/cid/cidload.c (cid_decrypt): Use `U' for constant (again).
* src/psaux/psobjs.c (T1_Decrypt): Ditto.
* src/type1/t1parse.c (T1_Get_Private_Dict): Ditto.
2001-07-03 12:45:24 +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
Werner Lemberg 52005c3042 formatting 2001-06-27 23:25:46 +00:00
Werner Lemberg 93616ecb66 next round in function header formatting 2001-06-27 19:46:12 +00:00
Werner Lemberg 99b744164d * src/cid/cidload.c, src/cid/cidload.h (cid_decrypt): Use FT_Offset
instead of FT_Int as type for `length' parameter.
* include/freetype/internal/psaux.h (PSAux_Interface): Updated.


* src/psaux/psobjs.c, src/psaux/psobjs.h (T1_Decrypt): Use FT_Offset
instead of FT_Int as type for `length' parameter.
2001-06-27 17:06:28 +00:00
Werner Lemberg f814d0fafe First round in converting
type foo ( ... )

to

  type
  foo ( ... )

Other minor formatting issues.
2001-06-27 16:18:10 +00:00
David Turner c40f386727 doc update 2001-06-27 12:42:10 +00:00
David Turner 9a554eb2d6 the SFNT Kerning table loader now ensures that the table is correctly
sorted.
2001-06-27 12:40:46 +00:00
David Turner 7ad248a51b formatting/bug fix 2001-06-27 11:08:25 +00:00
David Turner f77581f642 changed the definition of FT_CALLBACK_DEF 2001-06-27 10:54:13 +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
Werner Lemberg 890f313b37 * include/freetype/internal/ftstream.h (FT_GET_OFF3_LE): Fix typo.
* src/base/ftcalc.c (ft_div64by32): Fixed the source to work
correctly on 16-bit systems.
* docs/PATENTS: Added patents disclaimer.  This one was missing!
* docs/CHANGES, docs/todo: Updated for the upcoming 2.0.4 release.
2001-06-26 05:57:19 +00:00
David Turner 2bf99344c3 fixed the 64-bits division computation for 16-bits systems 2001-06-24 17:23:45 +00:00
Werner Lemberg 3974a6058d Formatting. 2001-06-23 22:06:00 +00:00
David Turner c5341fb94e adding Debian build directory 2001-06-23 07:44:51 +00:00
Werner Lemberg 0bf6e0647a Formatting. 2001-06-22 17:17:47 +00:00
Werner Lemberg 0fe9763135 Add cast in pcfread.c. 2001-06-22 17:08:26 +00:00
David Turner b602eba4a1 file psrecord.c was initially added on branch VER-2-0-4-PATCH. 2001-06-22 16:18:54 +00:00
David Turner 411f30a1ba file psrecord.h was initially added on branch VER-2-0-4-PATCH. 2001-06-22 16:18:54 +00:00
David Turner 995ff2046b updated documentation for the 2.0.4 release 2001-06-22 08:45:31 +00:00
Werner Lemberg 38364152e6 * include/freetype/config/ftconfig.h: Add two more `L's to
constants.
Add missing semicolons.

* builds/toplevel.mk: Do similar change as for
builds/unix/detect.mk.

* include/freetype/freetype.h (FT_ENC_TAG): New version to make it
easier to redefine.
* include/freetype/ftimage.h (FT_IMAGE_TAG): Ditto.

* include/freetype/freetype.h (FT_New_Memory_Face): Updated
2001-06-20 08:06:50 +00:00
Werner Lemberg 8eb0353fec Formatting. 2001-06-19 23:03:41 +00:00
David Turner 0b3a99153a * builds/win32/visualc/freetype.dsp, builds/win32/visualc/index.html:
updated the Visual C++ project (for the 2.0.4 release)

        * builds/unix/detect.mk: added rule for AIX detection (which uses
        /usr/sbin/init instead of /sbin/init, go figure..)
2001-06-19 15:45:48 +00:00
David Turner 61f0685683 * include/freetype/fterrors.h: updated some of the error macros to
simplify Werner's latest tricks :o)
2001-06-19 13:41:59 +00:00
Werner Lemberg c43fd3a749 Formatting. 2001-06-19 09:11:18 +00:00
David Turner 8edbcabce1 - updated doc for FT_New_Memory_Face
- removed lots of compiler warnings in lint-style
  warning modes (/W4 with Visual C++)
2001-06-19 08:28:24 +00:00
Werner Lemberg cf24d51531 Minor cleanups to remove compiler warnings.
* include/freetype/cache/ftcmanag.h (FTC_MAX_BYTES_DEFAULT): Use
`L' for constant.
* include/freetype/config/ftoption.h (FT_RENDER_POOL_SIZE): Ditto.
* src/base/ftcalc.c (FT_MulDiv): Use `L' for constant.
* src/base/ftglyph.c (FT_Glyph_Get_CBox): Remove `error' variable.
* src/base/fttrigon.c (ft_trig_arctan_table): Use `L' for constants.
* src/base/ftobjs.c (FT_Done_Size): Fix return value.
(FT_Set_Char_Size, FT_Set_Pixel_Sizes, FT_Get_Kerning): Remove
unused `memory' variable.
* src/autohint/ahglyph.c (ah_get_orientation): Use `L' for constant.
* src/autohint/ahhint.c (ah_hint_edges_3,
ah_hinter_align_edge_points): Remove unused `before' and `after'
variables.
(ah_hinter_align_weak_points): Remove unused `edge_limit' variable.
(ah_hinter_load): Remove unused `new_advance', `start_contour',
and `metrics' variables.
* src/cff/cffload.c (CFF_Load_Encoding): Remove dead code to avoid
compiler warning.
* src/cff/cffobjs.c (CFF_Init_Face): Remove unused `base_offset'
variable.
* src/cff/cffgload.c (CFF_Parse_CharStrings): Remove unused
`outline' variable.
(cff_compute_bias): Use `U' for constant.
* src/cid/cidload.c (cid_decrypt): Ditto.
* src/psaux/psobjs.c (T1_Decrypt): Ditto.
* src/psaux/t1decode.c (T1_Decoder_Parse_CharStrings): Ditto.
* src/sfnt/ttload.c (TT_Load_Kern): Remove unused `version'
variable.
* src/sfnt/ttsbit.c (TT_Load_SBit_Image): Remove unused `top'
variable.
* src/truetype/ttgload.c (load_truetype_glyph): Remove unused
`num_contours' and `ins_offset' variables.
(compute_glyph_metrics): Remove unused `Top' and `x_scale'
variables.
(TT_Load_Glyph): Remove unused `memory' variable.
* src/smooth/ftgrays.c (grays_raster_render): Use `L' for constants.
2001-06-18 14:23:45 +00:00
Werner Lemberg 00a2207fd8 Make the new error scheme source compatible with older FT versions
by introducing another layer.

* include/freetype/fterrors.h (FT_ERRORDEF_, FT_NOERRORDEF_): New
macros.
(FT_NOERRORDEF): Removed.
* include/*/*err*.h: Use FT_ERRORDEF_ and FT_NOERRORDEF_.
2001-06-18 10:35:00 +00:00
Werner Lemberg be5a53654d * include/freetype/freetype.h (FT_ENC_TAG): New macro.
(FT_Encoding_): Use it.
* include/freetype/ftimage.h (FT_IMAGE_TAG): Define it
conditionally.
2001-06-16 11:20:41 +00:00
Werner Lemberg 9e528d0376 formatting 2001-06-16 07:48:30 +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 1b3a0014e2 * src/base/ftcalc.c (FT_MulDiv, FT_DivFix, FT_Sqrt64): Remove
compiler warnings.
2001-06-11 13:26:11 +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 b3f3210b65 * builds/unix/configure.in: Renamed to ...
* builds/unix/configure.ac: This to make sure that autoconf 2.50 is
needed.
Run `autoupdate' on it.
* builds/unix/configure: Regenerated.

* src/autohint/ahhint.c (ah_hinter_load_glyph): Fixed a bug that
corrupted transformed glyphs that were auto-hinted (the transform
was applied twice).

Updating to libtool 1.4.0 and autoconf 2.50.
2001-06-08 12:19:22 +00:00
David Turner 0ebd3338f6 * src/autohint/ahhint.c (ah_hinter_load_glyph): fixed a bug that
corrupted transformed glyphs that were auto-hinted (the transform
        was applied twice !!)
2001-06-08 10:54:43 +00:00
Werner Lemberg f60408c070 removed 2001-06-07 17:37:08 +00:00
Werner Lemberg c0c2abef2d Updating to libtool 1.4.0.
* builds/unix/ltconfig: Removed.
* builds/unix/ltmain.sh, builds/unix/configure.in,
builds/unix/aclocal.m4: Updated.
* builds/unix/configure: Regenerated.
2001-06-07 17:36:17 +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
Werner Lemberg b3d9f882d0 Fixed length of `Reserved' array. 2001-06-06 05:56:59 +00:00
Werner Lemberg a00ff98a50 formatting, minor fixes 2001-05-30 07:53:37 +00:00
David Turner 1c46854ae3 small doc update 2001-05-29 10:52:34 +00:00
David Turner f9e51f3ceb remong the "netware" directory, it was too big for a source release
(904 Kb !!)
2001-05-29 10:19:24 +00:00
Robert Wilhelm b181ae1ac1 Netware port by Ulrich Neumann. 2001-05-28 21:29:58 +00:00
Werner Lemberg 2dffc9a3e6 formatting, update 2001-05-25 05:32:17 +00:00
David Turner 4312f42796 moving documents to the "docs" directory 2001-05-24 15:00:19 +00:00
Werner Lemberg 5579812622 formatting 2001-05-17 06:27:17 +00:00
David Turner 61d6b2b9aa * src/truetype/ttgload.c (load_truetype_glyph): fixed a bug in the
composite loader spotted by Keith Packard.
2001-05-16 17:49:07 +00:00
David Turner 66cb4790bf * src/base/ftcalc.c (FT_DivFix): fixed a bug in the 64-bit code that
created incorrect scale factors !!

    * src/autohint/ahglobal.c, src/autohint/ahglyph.c, src/autohint/ahhint.c:
    fixed the incorrect blue zone computations, and improved the composite
    support. Note that these changes result in improved rendering, while
    sometimes introducing their own artefacts. That's probably the last
    big change to the autohinter before the introduction of its complete
    replacement..
2001-05-14 14:04:23 +00:00
David Turner 6059b0317e formatting 2001-05-14 14:01:00 +00:00
Werner Lemberg ec6ddd5c5b * include/freetype/ftbbox.h: FTBBOX_H -> __FTBBOX_H__.
* include/freetype/fttrigon.h: __FT_TRIGONOMETRY_H__ ->
__FTTRIGON_H__.
Include FT_FREETYPE_H.
Beautified; added copyright.
* src/base/fttrigon.c: Beautified; added copyright.
2001-05-12 18:04:08 +00:00
Werner Lemberg a64c55b17f formatting 2001-05-12 06:40:50 +00:00
David Turner 09d55ceabf * src/cff/cffparse.c, src/cid/cidload.c, src/type1/t1load.c: fixed
the incorrect EM size computation
2001-05-11 18:08:58 +00:00
David Turner ebe85f59c9 * include/freetype/fttrigon.h, src/base/fttrigon.c, src/base/ftbase.c,
src/base/Jamfile, src/base/rules.mk: adding trigonometric functions
    to the core API (using Cordic algorithms).

    * builds/top_level.mk, builds/newline, builds/detect.mk: fixed problems
    with Make on Windows 2000, as well as problems when "make distclean" is
    invoked on a non-Unix platform when there is no "config.mk" in the
    current directory..

    * builds/freetype.mk: fixed a problem with object deletions under
    Dos/Windows/OS/2 systems

    * src/tools: added new directory to hold tools and test programs
    moved docmaker.py, glnames.py to it..

    * src/tools/docmaker.py: improved the script to add the current date
    at the footer of each web page (useful to distinguish between versions)

    * Jamfile: fixed incorrect HDRMACRO argument.

    * TODO: removed the cubic arc bbox computation note, since it has been
    fixed recently..

    * include/freetype/t1tables.h, include/freetype/config/ftoption.h:
    formatting
2001-05-11 14:25:57 +00:00
David Turner b3de817acb * Jamfile: fixed incorrect HDRMACRO argument. 2001-05-11 14:25:02 +00:00
David Turner 69046ac1b2 * TODO: removed the cubic arc bbox computation note, since it has been
fixed recently..
2001-05-11 14:24:35 +00:00
Werner Lemberg 5704f0c984 * include/freetype/internal/ftcalc.h: Move declaration of
FT_SqrtFixed() out of `#ifdef FT_LONG64'.

* src/base/ftcalc.c (FT_MulDiv, FT_MulFix, FT_DivFix): Various tiny
fixes related to rounding in 64-bits routines and
pseudo-"optimizations".
2001-05-09 20:57:45 +00:00
Werner Lemberg 2f41b184be Another small fix from Francesco. 2001-05-08 13:54:36 +00:00
Werner Lemberg fc26ecd9d3 formatting 2001-05-08 13:52:13 +00:00
David Turner 750ddcd576 * src/pcfdriver.c: fixed incorrect bitmap width computation
* docs/docmaker.py: updated the DocMaker script in order to add
    command line options (--output,--prefix,--title), fix the erroneous
    line numbers reported during errors and warnings, and other formatting
    issues..

    * src/base/ftcalc.c: various tiny fixes related to rounding in 64-bits
    routines and pseudo"optimisations" :-)
2001-05-08 12:58:07 +00:00
David Turner bc891834b8 * docs/docmaker.py: updated the DocMaker script in order to add
command line options (--output,--prefix,--title), fix the erroneous
    line numbers reported during errors and warnings, and other formatting
    issues..
2001-05-08 07:48:33 +00:00
Werner Lemberg b06a291ce9 Fix ChangeLog. 2001-04-27 22:40:16 +00:00
David Turner e6d4518f80 * src/base/ftbbox.c (BBox_Cubic_Check): fixed the coefficient
normalization algorithm (invalid final bit position, and invalid
	shift computation..)
2001-04-27 09:49:27 +00:00
Werner Lemberg 3780273e3e * builds/unix/config.guess, builds/unix/config.sub: Updated to
latest versions from gnu.org.

* builds/compiler/gcc-dev.mk: Add `-Wno-long-long' flag.

* include/freetype/internal/ftcalc.h: Define FT_SqrtFixed()
uncoditionally.
* src/base/ftbbox.c: Include FT_INTERNAL_CALC_H.
Fix compiler warnings.
* src/base/ftcalc.c: Fix (potential) compiler warnings.

* src/base/ftcalc.c (FT_SqrtFixed): Corrected/optimized the 32-bit
fixed-point square root computation.  It is now used even with
64-bits integers, as it is _much_ faster than calling FT_Sqrt64 :-)
* src/base/ftbbox.c: Removed invalid "#include FT_BEZIER_H" line.
* src/base/ftbbox.c (BBox_Cubic_Check): Rewrote function to use
direct computations with 16.16 values instead of sub-divisions.  It
is now slower, but proves a point :-)
* src/raster/ftraster.c, src/smooth/ftgrays.c, src/base/ftbbox.c:
Fixed the bezier stack depths.
* src/base/ftcalc.c (FT_MulFix): Minor rounding fix.
* builds/beos: Added BeOS-specific files to the old build system
(no changes were necessary to support BeOS in the Jamfile though).
* ftconfig.h, ftoption.h: Updated "ftconfig.h" to detect 64-bit int
types on platforms where Autoconf is not available).  Also removed
FTCALC_USE_LONG_LONG and replaced it with
FT_CONFIG_OPTION_FORCE_INT64.
* builds/win32/freetype.dsp: Updated the Visual C++ project file.
Doesn't create a DLL yet.
* cffgload.c: Removed a compilation warning.
2001-04-26 13:34:36 +00:00
David Turner c2cd00443b minor optimisations in ftcalc.c 2001-04-26 00:21:48 +00:00
David Turner ec46b28df7 * src/base/ftcalc.c (FT_SqrtFixed): corrected/optimised the 32-bit
fixed-point square root. it is now used even with 64-bits
	ints, as it's simply _much_ faster than calling FT_Sqrt64 :-)

    * src/base/ftbbox.c : removed invalid "#include FT_BEZIER_H" line
2001-04-25 22:56:30 +00:00
David Turner caf72cd6e5 * src/base/ftbbox.c (BBox_Cubic_Check): rewrote function to use
direct computations with 16.16 values instead of sub-divisions.
        It is now slower, but proves a point :-)

        * src/raster/ftraster.c, src/smooth/ftgrays.c, src/base/ftbbox.c :
        fixed the bezier stack depths..

        * src/base/ftcalc.c (FT_MulFix): minor rounding fix

        * builds/beos : added BeOS-specific files to the old build system
        (no changes were necessary to support BeOS in the Jamfile though)
2001-04-25 18:11:16 +00:00
Werner Lemberg cfcfd3c432 * builds/unix/config.guess, builds/unix/config.sub: Updated to
latest versions from gnu.org.
2001-04-24 07:03:25 +00:00
Werner Lemberg c7e1552c0f * builds/compiler/gcc-dev.mk: Add `-Wno-long-long' flag. 2001-04-22 09:49:49 +00:00
Werner Lemberg 526b5d8c2a formatting 2001-04-21 18:34:30 +00:00
David Turner 0027af925a added 64-bit check
removed Visual C++ project update
removed Makefile -> Jam transition
2001-04-21 08:10:12 +00:00
David Turner 6d4fbec1b8 * ftconfig.h, ftoption.h: updated "ftconfig.h" to detect 64-bit int
types on platforms where Autoconf is not available). Also removed
	FTCALC_USE_LONG_LONG and replaced it with FT_CONFIG_OPTION_FORCE_INT64

	* builds/win32/freetype.dsp: updated the Visual C++ project file. Doesn't
	create a DLL yet..

	* cffgload.c: removed a compilation warning
2001-04-20 08:50:36 +00:00
Tom Kacvinsky 9d770c90d1 Fix typos (entires -> entries). 2001-04-11 18:40:27 +00:00
Werner Lemberg ef6ebd6351 formatting 2001-04-11 18:09:49 +00:00
Tom Kacvinsky ed6971b569 2001-04-10 Tom Kacvinsky <tjk@ams.org>
* t1load.c (parse_charstrings): Changed code for placing .notdef
        glyph into slot 0 so that we no longer have a memory access
        violation.

        * t1load.h: In structure T1_Loader, added swap_table (of type
        PS_Table) to facilitate placing the .notdef glyph into slot 0.
2001-04-10 18:21:30 +00:00
Tom Kacvinsky cad797e6f1 In function parse_charstrings, changed code for placing .notdef glyph
into slot 0 so that we no longer have a memory access violation.
2001-04-10 18:15:17 +00:00
Tom Kacvinsky 60ee2812b1 In structure T1_Loader, added swap_table (of type PS_Table) to
facilitate placing the .notdef glyph in slot 0.
2001-04-10 18:13:28 +00:00
Werner Lemberg 800f5096c1 * src/pcf/pcfdriver.c (PCF_Get_Char_Index): Fix return value.
* builds/dos/detect.mk: Add support for bash.
2001-04-10 13:59:58 +00:00
Werner Lemberg cbc9938e68 * builds/os2/*.mk: These files have been forgotten to update to
the structure of similar makefiles.
* builds/dos/*.mk: Ditto.
* builds/ansi/*.mk: Ditto.

* builds/win32/win32-def.mk (BUILD): Fix typo.

* builds/compiler/*.mk (CLEAN_LIBRARY): Don't use NO_OUTPUT.
This is already used in the link_*.mk files.


* src/*/Jamfile: Slight changes	to make files more cryptic.
2001-04-06 07:05:50 +00:00
Werner Lemberg a1844e0927 * Jamfile, src/Jamfile, src/*/Jamfile: Formatted. Slight changes
to give files identical structure.
2001-04-03 21:07:36 +00:00
Werner Lemberg 1429db6c4f * README: Formatting.
* Jamfile: Fix typo.

* src/cff/cffparse.c: Move error code #defines to...
* include/freetype/internal/cfferrs.h: This file.
* src/cff/cffdrivr.c, src/cff/cffobjs.c, src/cff/cffload.c: Replaced
`FT_Err_*' with `CFF_Err_*'.
* src/cid/cidparse.c: Replaced `FT_Err_*' with `T1_Err_*'.
* src/psaux/psobjs.c, src/psaux/t1decode.c: Ditto.
* src/sfnt/sfobcs.c, src/sfnt/ttload.c: Replaced `FT_Err_*' with
`TT_Err_*'.
* src/truetype/ttgload.c, src/truetype/ttobjs.c: Ditto.
* src/type1/t1gload.c, src/type1/t1load.c, src/type1/t1objs.c,
src/type1/t1parse.c: Replaced `FT_Err_*' with `T1_Err_*'.

* include/freetype/internal/cfferrs.h: Add
`CFF_Err_Unknown_File_Format'.
* include/freetype/internal/t1errors.h: Add
`T1_Err_Unknown_File_Format'.
* include/freetype/internal/tterrors.h: Add
`TT_Err_Unknown_File_Format'.

* src/cff/cffload.h: Add `cff_*_encoding' and `cff_*_charset'
references.
* src/psaux/psobjs.c: Include `FT_INTERNAL_TYPE1_ERRORS_H'.

* src/cff/cffobjs.c (CFF_Init_Face, CFF_Done_Face): Use
FT_LOCAL_DEF.
* src/cid/cidobjs.c (CID_Done_Driver): Ditto.
* src/trutype/ttobjs.c (TT_Init_Face, TT_Done_Face, TT_Init_Size):
Ditto.
* src/type1/t1objs.c (T1_Done_Driver): Ditto.
* src/pcf/pcfdriver.c (PCF_Done_Face): Ditto.
* src/pcf/pcf.h: Use FT_LOCAL for `PCF_Done_Face'.
2001-04-02 23:54:01 +00:00
Werner Lemberg ab6d10759a * CHANGES: Reformatted, minor fixes.
* TODO: Updated.
* include/freetype/freetype.h: Formatting.

* Jamrules, Jamfile, src/Jamfile, src/*/Jamfile: Adding jamfiles to
the source tree.  See www.freetype.org/jam/index.html for details.
2001-04-02 21:30:06 +00:00
Tom Kacvinsky 8f031b08ec Formatting 2001-04-02 17:50:08 +00:00
Tom Kacvinsky 679ea64ccc 2001-04-02 Tom Kacvinsky <tjk@ams.org>
* src/sfnt/ttload.c (TT_Load_Metrics): Fix an improper pointer
        dereference.  Submitted by Herbert Duerr <duerr@sun.com>
2001-04-02 17:48:43 +00:00
Tom Kacvinsky 4a1bc8fcf6 In function TT_Load_Metrics, fix improper an improper pointer dereference.
Submitted by herbert duerr <duerr@sun.com>
2001-04-02 17:47:16 +00:00
Tom Kacvinsky 7e0e160d87 2001-03-26 Tom Kacvinsky <tjk@ams.org>
* include/freetype/config/ftconfig.h: Changed hexadecimal
        constants to use suffix U to avoid problems with HP-UX's c89
        compiler.  Submitted by G.W. Lucas <glucas@sonalysts.com>
2001-03-26 23:58:40 +00:00
Tom Kacvinsky e90c5b978f Changed tests for sizes of short, ints, and longs to use the suffix U
on the hexdecimal constants to avoid problems with HP-UX's ANSI
compliant C compiler (c89).  The changes work well with Sun's Forte
compilers.
2001-03-26 23:46:06 +00:00
David Turner 5bf0a39485 * Jamrules, Jamfile, src/Jamfile, src/*/Jamfile: Adding jamfiles
to the source tree. see www.freetype.org/jam/index.html for details
2001-03-24 17:10:09 +00:00
Werner Lemberg 521d8dc2e5 Add 2.0.2 version tag. 2001-03-24 15:26:12 +00:00
David Turner 85d260f628 added small README file 2001-03-24 00:56:26 +00:00
David Turner bbf33f304a small Unix installation update 2001-03-24 00:42:45 +00:00
David Turner d540613a7f small documentation update 2001-03-23 18:19:04 +00:00
David Turner f876b245e9 small documentation update 2001-03-23 18:09:09 +00:00
David Turner a0f89558b9 updated changes 2001-03-23 12:28:59 +00:00
David Turner 1e536983f6 removed obsolete documentation files
they are now moved to the "www" module, under "www/freetype2/docs"
2001-03-23 11:20:35 +00:00
Werner Lemberg 521a2d7a13 * builds/win32/detekt.mk: Fix .PHONY target for Intel compiler.
Renamed "ftnames.h" to "ftsnames.h", and FT_NAMES_H to
FT_SFNT_NAMES_H.
* docs/docmaker.py: Added generation of INDEX link in table of
contents.
* INSTALL, docs/BUILD: Updated documentation to indicate that the
compilation process has changed slightly (no more `src' required in
* 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 add its own directory to the include path at
compile time.  Modified all "rules.mk" and "descrip.mms"
accordingly.

* src/cid/cidobjs.c, src/cid/cidload.c, src/pcf/pcfread.c,
src/type1/t1load.c, src/type1/t1objs.c: Added a few casts to remove
compiler warnings in pedantic modes.
* include/config/ft2build.h, include/config/ftheader.h: The file
top-level <ft2build.h>.

* include/config/ftheader.h: Added new section describing the #include
macros.


the Type 2 glyph charstring (used by conversion programs).
* docs/docmaker.py: Added cross-references generation as well as


seac emulation provided by the Type 2 endchar operator.


* src/cid/cidafm.c, src/cid/cidafm.h: removed un-needed files,
Added support for clipped direct rendering in the smooth renderer.


* src/cff/t2objs.c (T2_Init_Face): For pure CFF fonts, set
2001-03-20 22:58:56 +00:00
David Turner 0e20e1e575 fixed a small mistake 2001-03-20 17:28:02 +00:00
David Turner b8f56fa005 renamed "obj" to "objs" 2001-03-20 15:04:30 +00:00
David Turner 6ce03efb12 * include/freetype/config/ftheader.h, include/freetype/ftsnames.h:
renamed "ftnames.h" to "ftsnames.h", and FT_NAMES_H to FT_SFNT_NAMES_H

	* docs/docmaker.py: added generation of INDEX link in table of contents
2001-03-20 14:50:04 +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 3de5b07cc3 * builds/unix/configure.in: Add $ft_version.
* builds/unix/freetype-config.in: Use it.
* builds/unix/configure: Updated.
2001-03-20 07:52:52 +00:00
Tom Kacvinsky a2e47b2688 Added entries for changes to Type 1 and CFF drivers, related to units
per EM processing in the font matrix parsers.
2001-03-19 14:30:24 +00:00
Tom Kacvinsky f3dad68be8 In function parse_font_matrix(), make sure that the units per em value
is assigned an unsigned short value, first by shifting right 16 bits,
then by casting the results to FT_UShort.
2001-03-19 13:52:31 +00:00
Tom Kacvinsky 70d6f38ed2 Change units per EM assignment in cff_parse_font_bbox(). 2001-03-19 13:44:15 +00:00
David Turner 3798110fc7 fixed a small bug 2001-03-19 11:34:49 +00:00
David Turner 8cfe002db9 renamed <freetype/config/ft2build.h> to 'ftheader.h' to avoid
name conflicts with top-level <ft2build.h>

added some comments for docmaker in ftheader.h in order to
document the header file macros..
2001-03-18 00:26:23 +00:00
David Turner 168e39a15b small update to remove compiler warnings 2001-03-17 23:25:34 +00:00
Tom Kacvinsky c24eff8d83 Another minor typo fix in cff_parse_font_bbox(). 2001-03-17 19:01:25 +00:00
Tom Kacvinsky b2712e2ef5 Corrected a typo in function cff_parse_font_bbox(). 2001-03-17 16:46:25 +00:00
Tom Kacvinsky 99678c3408 Added entries for changes to the BBox processing of the CFF driver. Now
the Type 1, CID, and CFF drivers match in their BBox processing.
2001-03-17 16:44:23 +00:00
Tom Kacvinsky ea48f4588a In function cff_parse_font_bbox(), obtain rounded FT_Fixed values for the
bounding box numbers.
2001-03-17 16:38:49 +00:00
Tom Kacvinsky 8958d03ad1 In function CFF_Init_Face(), when we process a pure CFF font, set
`root->ascender' (`root->descender') to the integer part of the
`root->bbox.yMax' (`root->bbox.yMin', respectively).
2001-03-17 16:36:51 +00:00
Tom Kacvinsky 3952f6c778 Added entries for changes to CFF driver submitted by Sander van der
Wal.  These include adding suppoort for getting a glyph name based on
glyph index, and support for the deprecated operator dotsection.
2001-03-16 15:09:52 +00:00
Tom Kacvinsky 84ad2a2205 Added function get_cff_glyph_name() in order to facilitate getting a
glyph name for glyph index via FT_Get_Glyph_Name().

In function cff_get_interface(), added support for getting a glyph
name via the "glyph_name" module interface (used in the function
FT_Get_Glyph_Name()).  We use the new function get_cff_glyph_name().
2001-03-16 15:03:13 +00:00
Tom Kacvinsky b9561b78c3 In function CFF_Init_Face(), logical or the face flags with
FT_FACE_FLAG_GLYPH_NAMES only if FT_CONFIG_OPTION_NO_GLYPH_NAMES is
not defined.  This is to add support for getting a glyph name from a
glyph index vi FT_Get_Glyph_Name().
2001-03-16 13:40:50 +00:00
Tom Kacvinsky 8316bc596d In function CFF_Parse_CharStrings(), added support for deprecated
operator "dotsection".

Submitted by Sander van der Wal <svdwal@xs4all.nl>
2001-03-16 13:35:56 +00:00
Werner Lemberg 9a8b536fb9 * src/psaux/t1decode.c (T1_Decoder_Parse_Charstrings): Fix error
messages.

* INSTALL, docs/BUILD: We need GNU make 3.78.1 or newer.
2001-03-12 22:33:52 +00:00
Tom Kacvinsky fb68eaf8ac 2001-03-12 Tom Kacvinsky <tjk@ams.org>
* include/freetype/internal/psaux.h:  Changed the lenIV member of
        the T1_Decoder_ struct to be an FT_Int instead of an FT_UInt.
2001-03-12 12:06:30 +00:00
Tom Kacvinsky a25b712c95 Changed the lenIV member of the T1_Decoder_ struct to be an FT_Int
instead of an FT_UInt.
2001-03-12 12:04:29 +00:00
Tom Kacvinsky d15ac62429 Added entries for changes to the Type 1 decoder and the CID font driver (which
take into account the possibility of lenIV seed bytes at the beginning of a
subroutine).
2001-03-12 02:36:49 +00:00
Tom Kacvinsky 68621135db In cid_read_subrs, decode subroutines only if lenIV >= 0. 2001-03-12 02:17:50 +00:00
Tom Kacvinsky e355d008b3 In cid_load_glyph, decrypt charstrings only if lenIV >= 0. 2001-03-12 02:05:17 +00:00
Tom Kacvinsky 9b59f2c385 In function T1_Decoder_Parse_Charstrings, take into account lenIV seed
bytes at the start of a decrypted subroutine.
2001-03-12 01:42:38 +00:00
Werner Lemberg 22e812a8c4 * src/pcf/pcfread.c: Put READ_Fields() always in a conditional to
avoid compiler warnings.
2001-03-11 13:11:43 +00:00
Werner Lemberg 29bac136cb * TODO: Updated.
* src/cid/cidload.c (parse_font_matrix): Added units_per_EM
* src/type1/t1load.c (parse_font_bbox): Changed to use FT_Fixed
2001-03-11 11:28:39 +00:00
Tom Kacvinsky 21fed911e2 Added entry for TODO list. 2001-03-10 20:03:06 +00:00
Tom Kacvinsky 82aca5c0ff Initial revision of TODO list. 2001-03-10 20:00:06 +00:00
Tom Kacvinsky f4f17d4f71 Myriad entires for FT_Fixed number handling in bbox parsing and
assignment code that uses bbox values.
2001-03-10 19:21:19 +00:00
Tom Kacvinsky e5b8bbb892 In function T1_Init_Face, changed the assignment code for ascender,
descender, and max_advance_width.
2001-03-10 19:10:25 +00:00
Tom Kacvinsky 5d362b6b44 Changed parse_font_bbox to use FT_Fixed values for the bbox
assignment, and use rounded values instead.
2001-03-10 19:08:44 +00:00
Tom Kacvinsky 00169a309e In CID_Init_Face, use calculated units_per_EM, and if that is not available, default
to 100 units per EM.  Changed assignment code for ascender and descender values.
2001-03-10 19:06:54 +00:00
Tom Kacvinsky 025c2f3fb6 Added units_per_EM processing to parse_font_matrix, and added FT_Fixed
number handling to parse_font_bbox.
2001-03-10 19:04:41 +00:00
Tom Kacvinsky c2f44c1608 Added implementation of three new functions: FT_RoundFix, FT_CeilFix,
and FT_FloorFix.
2001-03-10 19:02:51 +00:00
Tom Kacvinsky f8220925c9 Added prototypes and notes for three new functions: FT_RoundFix,
FT_CeilFix, and FT_FloorFix.
2001-03-10 19:01:21 +00:00
Werner Lemberg 914b289f16 * src/*/*.c: Added many casts to make code more 64bit-safe. 2001-03-10 17:07:42 +00:00
Werner Lemberg 7124a8e59c * INSTALL, docs/BUILD: We need GNU make 3.78 or newer.
* src/type1/t1objs.c (T1_Init_Face): Minor correction: We must wait
Submitted by Sander van der Wal <svdwal@xs4all.nl>.
2001-03-07 21:20:48 +00:00
Tom Kacvinsky a20e15bc0d Added entry:
* src/type1/t1objs.c (T1_Init_Face): Minor correction:  we must wait
        until parse_font_bbox is changed before we use logical shift rights
        in the assignments of `root->ascender', `root->descender', and
        `root->max_advance_width'.
2001-03-07 20:56:57 +00:00
Tom Kacvinsky bdcfd5246d Minor correction in T1_Init_Face: we must wait until parse_font_bbox
is changed before we use logical shift rights in the assignments of
`root->ascender', `root->descender', and `root->max_advance_width'.
2001-03-07 20:53:08 +00:00
Tom Kacvinsky 5441897bcb Added entry:
* src/type1/t1objs.c (T1_Done_Face): Free `char_name' table to
        avoid a memory leak.
        Submitted by Sander van der Wal <svdwal@xs4all.nl>
2001-03-07 20:43:38 +00:00
Tom Kacvinsky 3f06635b12 2001-03-07 Tom Kacvinsky <tjk@ams.org>
* src/type1/t1objs.c (T1_Done_Face): Free `char_name' table to
	avoid a memory leak.
	Submitted by Sander van der Wal <svdwal@xs4all.nl>
2001-03-07 20:42:18 +00:00
Werner Lemberg 2e35c9b406 formatting 2001-03-06 13:56:42 +00:00
Tom Kacvinsky 0d832659c7 Added entry:
2001-03-05  Tom Kacvinsky <tjk@ams.org>

        * src/cff/cffgload.c (CFF_Load_Glyph): Set glyph control data to the
        the Type 2 glyph charstring (used by conversion programs). Submitted
        by Ha Shao <hashao@chinese.com>.
2001-03-05 16:24:58 +00:00
Tom Kacvinsky e20035ae3c 2001-03-05 Tom Kacvinsky <tjk@ams.org>
* src/cff/cffgload.c (CFF_Load_Glyph): Set glyph control data to the
	the Type 2 glyph charstring (used by conversion programs).
	Submitted by Ha Shao <hashao@chinese.com>.
2001-03-05 16:22:25 +00:00
Antoine Leca ca3035ad4c * include/freetype/ttnameid.h: Correct a stupid typo which prevented
correct compilation (TT_MS_LANGID_TIGRIGNA_ETHIOPIA appeared twice).
I am sorry for the inconvenience :-(.
2001-03-05 00:15:37 +00:00
Werner Lemberg 29179a33ee * builds/unix/detect.mk: Add test for Hurd.
* builds/hurd/detect.mk: Removed.
2001-03-04 22:10:36 +00:00
Werner Lemberg e274cfd3ef * src/autohint/ahtypes.h (AH_Hinter): Add elements
`disable_horz_edges', `disable_vert_edges'.
* src/autohint/ahhint.c	(ah_hint_edges_3, ah_hinter_hint_edges): Use
them (and remove static variables with the same names).
* src/pcf/pcfutil.c (BitOrderInvert): Add `const'.
* docs/glnames.py: Updated to latest pstables.h changes.
* src/psnames/pstables.h: Add more `const'.
* src/pcf/pcfutil.c: Ditto.
* src/base/ftglyph.c (FT_Glyph_To_Bitmap): Fixing typo
(FT_Glyph_Done -> FT_Done_Glyph).
* include/freetype/ttnameid.h: Added some new Microsoft language
codes and LCIDs as found in Office Xp.

* builds/hurd/detect.mk: New file.  Added support to detect the GNU
Hurd operating system as Unix-like.  Fix submitted by Anthony Fok
<foka@debian.org>.

* src/type1/t1gload.c (T1_Load_Glyph): Set glyph control data to the
the Type 1 glyph charstring (used by conversion programs).
Submitted by Ha Shao <hashao@chinese.com>.


* src/base/ftgrays.c (grays_sweep): The function didn't exit
immediately if `num_cells' was 0 as it should.  Thanks to Boris for
finding this out.

* src/base/ftglyph.c (FT_Glyph_To_Bitmap): Fixed memory leak when
bitmap rendering fails (thanks to Graham Asher).

* docs/docmaker.py, include/freetype/*.h: Updated the DocMaker
script to support chapters and section block ordering.  Updated the
public header files accordingly.
* src/base/ftglyph.c (FT_Glyph_Copy): Advance width and glyph format
were not correctly copied.
2001-03-04 21:53:08 +00:00
Antoine Leca 6d27936aa9 * include/freetype/ttnameid.h: added some new Microsoft language
codes and LCIDs as found in Office Xp.
2001-03-01 18:00:44 +00:00
David Turner 8a8d5c88b5 the Type 1 glyph loader now sets the glyph control data to the
T1 charstrings program.
2001-02-28 09:36:13 +00:00
David Turner 131f8ea8d5 added automatic detection for the HURD operating system 2001-02-28 09:09:05 +00:00
David Turner 5aeaad6c39 fixed a bug reported by Graham Asher 2001-02-23 17:47:41 +00:00
David Turner f3b07226c2 fixed a small bug in FT_Glyph_Copy 2001-02-16 16:40:59 +00:00
David Turner 8fe916ca51 fixed a small bug (the advance and format were not copied in
FT_Glyph_Copy)
2001-02-16 16:27:35 +00:00
Werner Lemberg 20e862be32 * builds/unix/config.{guess,sub}: Updated (from ftp.gnu.org). 2001-02-14 08:31:55 +00:00
Werner Lemberg 0b2137e5ca * docs/docmaker.py (DocSection::add_element): Use
`self.print_error()'.


to support chapters and section block ordering.  Updated the public
2001-02-14 04:59:57 +00:00
David Turner e231a65882 update docmaker.py to support chapters and section block ordering
updated public header files, as well as "ftchapters.h" which only
contains comment that hold the list of section chapters..
2001-02-13 17:42:49 +00:00
Werner Lemberg 500dc854f6 formatting 2001-02-10 17:45:01 +00:00
Tom Kacvinsky 16c691c155 minor correction to 2001-02-07 entries. 2001-02-08 23:26:09 +00:00
Tom Kacvinsky 78b5f17a15 * src/cff/cffparse.c (cff_parse_font_matrix): Removed an
unnecessary fprintf( stderr, ... ).
2001-02-08 23:25:19 +00:00
Tom Kacvinsky 1e5f0ee609 Removed an unnecessary fprintf( stderr, ... ) from cff_parse_font_matrix 2001-02-08 23:23:46 +00:00
Tom Kacvinsky 43a9c9d396 Added entry for function is_alpha. Code now makes `-' a valid
alphanumeric character.
2001-02-07 03:48:24 +00:00
Tom Kacvinsky 97094311aa In function is_alpha, make `-' a legal alphanumeric character. This
is so that font names with `-' are fully parsed, etc...
2001-02-07 03:45:49 +00:00
Tom Kacvinsky 1df6a31704 Added entries for changes to CFF and Type 1 drivers, related to units
per EM.  That is, calculate the units per EM based on the FontMatrix.
2001-02-07 01:24:11 +00:00
Tom Kacvinsky 7b91beadab In function T1_Init_Face, added code to get the units_per_EM from the
value assigned in parse_font_matrix, if available.  Default to 1000 if
not available.
2001-02-07 01:14:53 +00:00
Tom Kacvinsky d30bcd20c2 In struct CFF_Font_Dict_, added a units_per_em member to facilitate
passing of units_per_em form function cff_parse_font_matrix.
2001-02-07 01:13:21 +00:00
Tom Kacvinsky c27cd28e22 In function cff_parse_font_matrix, added logic to get the units_per_EM
from the FontMatrix.

Added a new function (cff_parse_fixed_thousand) that gets a real
number fromt he CFF font, but multiplies by 1000 (this is to avoid
rounding errors when placing this real number into a 16.16 fixed
number).

In function cff_parse_real, added code so that the integer part is
moved into the high sixtenn bits of the 16.16 fixed number.
2001-02-07 01:11:54 +00:00
Tom Kacvinsky c97cf17acd In function CFF_Init_Face, added logic to get the units per EM from
the CFF dictionary, if available.
2001-02-07 01:08:34 +00:00
Werner Lemberg e56b411f32 * src/psaux/psobjs.c (shift_elements): Remove if clause (which is
obsolete now).

(reallocate_t1_table, PS_Table_Done): Replace REALLOC() with ALLOC()
+ MEM_Copy() to avoid a memory bug.
2001-02-03 04:34:53 +00:00
Werner Lemberg 65d328ead7 formatting, ChangeLog entry 2001-02-03 03:00:06 +00:00
David Turner 1ae67a2e0c improved docmaker slightly (better indexing, support for "<order>" marker
in section blocks, see "fttypes.h")
2001-02-02 05:24:11 +00:00
Antoine Leca 331780c925 Update of ttnameid.h with the most recent informations from Microsoft's SDK 2001-01-31 03:00:22 +00:00
Tom Kacvinsky 2f41a46a1a Added entries for changes to Type 1 driver (related to FontInfo
dictionaries and units per em).
2001-01-24 22:44:22 +00:00
Tom Kacvinsky b2d5fefea8 In function parse_font_matrix, added heuristic to get units_per_EM
from the font matrix.

In parse_dict, deleted test to see if the FontInfo keyword has been
seen.  Deletion of this test allows fonts without FontInfo
dictionaries to be parsed by the Type 1 driver.

In T1_Open_Face, deleted empty subroutines array test to make sure
fonts with no subroutines still are parsed.
2001-01-24 22:41:20 +00:00
Werner Lemberg f3bdbb4552 another small update of the Unicode range comments 2001-01-22 15:26:02 +00:00
Werner Lemberg 3708bdb35a grammatical fixes 2001-01-19 03:33:30 +00:00
Werner Lemberg 3dac27d9fd * src/pcfread.c (pcf_get_properties, pcf_get_metrics,
pcf_get_bitmaps): Fix compiler errors.

* src/pcf/pcfread.c: Removed some compilation warnings related
2001-01-18 04:00:12 +00:00
Werner Lemberg 9e708eb5fb formatting 2001-01-15 23:11:55 +00:00
David Turner db0717879f some minor changes to allow compilation in all modes, without warnings 2001-01-12 21:49:08 +00:00
Werner Lemberg c7c2c91ad0 * builds/unix/freetype-config.in: Fix problems with separate
--prefix and --exec-prefix.


more robust handling of pathname wildcard matching.
2001-01-12 05:32:04 +00:00
David Turner b6c1bf861a added cross-reference generation 2001-01-12 00:33:30 +00:00
Werner Lemberg 38208a6e6b * docs/docmaker.py: Minor improvements to reduce unwanted spaces
and empty lines in output.
* docs/docmaker.py: Improved script to generate table of contents
and index pages.  It also supports wildcards on non Unix systems.

* include/freetype/*.h, include/freetype/cache/*.h: Updated comments
to include section definitions/delimitations for the API Reference
generator.

* include/freetype/freetype.h: Moved declaration of
`FT_Generic_Finalizer' and the `FT_Generic' structure to...
* include/freetype/fttypes.h: here.
2001-01-11 09:27:49 +00:00
David Turner 0f5616a801 updated documentation in public header files 2001-01-10 11:15:48 +00:00
David Turner 18b55f7bbc improved the docmaker script 2001-01-10 06:53:49 +00:00
Werner Lemberg 4c8815e1a6 * include/freetype/ttnameid.h: Updated Unicode code range comments. 2001-01-05 05:15:49 +00:00
Werner Lemberg d573c7e76b formatting 2001-01-03 07:14:12 +00:00
Tom Kacvinsky d0165401bb Added entries for changes to CFF driver function, variable, and source
file names.
2001-01-03 07:12:49 +00:00
Werner Lemberg c3e987e2aa * builds/vms: Support files for VMS architecture added.
* descrip.mms, src/*/descrip.mms: VMS makefiles added.
* README.VMS: New file.


* LICENSE.TXT: Added info about PCF driver license.
2001-01-03 06:47:10 +00:00
Werner Lemberg 78e8608dde import of vms stuff 2001-01-03 06:38:54 +00:00
Werner Lemberg 53ecd88986 Initial revision 2001-01-03 06:38:54 +00:00
Tom Kacvinsky 332bc32125 Changed to use cfftypes.h instead of t2types.h. Also, we now use
cfferrs.h instead of t2errors.h.
2001-01-03 00:29:35 +00:00
Tom Kacvinsky 0f27de1209 Merged in changes from t2types.h, and made this the canonical `types'
header for the CFF driver.
2001-01-03 00:27:46 +00:00
Tom Kacvinsky 059bcea7ed This file was merged with cfftypes.h and is no longer necessary. 2001-01-03 00:26:56 +00:00
Tom Kacvinsky 5090a09ec9 This file was previously known as t2errors.h. 2001-01-03 00:25:36 +00:00
Tom Kacvinsky 2e7cdb145e Renamed to cfferrs.h. 2001-01-03 00:24:58 +00:00
Tom Kacvinsky 8d1f604993 Changed to use cffgload.{c,h} instead of t2gload.{c,h}. Also, all
occurences of t2_ (T2_) were replaced with cff_ (CFF_, resp.).
2001-01-03 00:21:59 +00:00
Tom Kacvinsky 8050a6b85d This file was previously known as t2gload.h. 2001-01-03 00:17:58 +00:00
Tom Kacvinsky 167e2be410 Renamed to cffgload.h. 2001-01-03 00:17:15 +00:00
Tom Kacvinsky ceac7b9f66 Changed to reflect the changes made in the source files:
we now use cffgload.{c,h} instead of t2gload.{c,h}.
2001-01-03 00:16:24 +00:00
Tom Kacvinsky cd92b11dc6 This file was previously known as t2gload.c. 2001-01-03 00:15:00 +00:00
Tom Kacvinsky fa3d6e9422 Renamed t2gload.c to cffgload.c. 2001-01-03 00:14:11 +00:00
Werner Lemberg 389acc625e * src/pcf/*: New driver module for PCF font format (used in
X Windows).
* include/freetype/internal/ftdebug.h (FT_Trace): Added values for
PCF driver.
* include/freetype/internal/pcftypes.h: New file.
* include/freetype/config/ftmodule.h: Added PCF driver module.


* src/winfonts/winfnt.c (FNT_Get_Char_Index): Fix parameter type.


* builds/modules.mk (clean_module_list): Fixed deletion of module
file in case `make make_module_list' is called before `make setup'.
2001-01-01 17:25:21 +00:00
Werner Lemberg a9f3ccb523 import of PCF driver 2001-01-01 17:24:31 +00:00
Werner Lemberg f28b7bfaea Initial revision 2001-01-01 17:24:31 +00:00
Werner Lemberg 6b76663625 * src/cff/cffload.c (CFF_Load_Charset): Improved error messages.
(CFF_Load_Charset, CFF_Load_Encoding): Remove unnecessary variable
definition.

* src/cff/t2gload.c (t2_lookup_glyph_by_stdcharcode,
t2_operator_seac): Added these functions for use in implementing the
seac emulation provided by the Type 2 endchar operator.
(T2_Parse_CharStrings): Added seac emulation for the endchar
operator.
CFF_Done_Encoding, CFF_Done_Charset): Extended to load and parse the
charset/encoding tables, and free the memory used by them when the
CFF driver is finished with them.  Added tables
2000-12-30 22:14:58 +00:00
Tom Kacvinsky e39266ab7c Added entries for changes to CFF driver sources and headers. We now
have a working charset and encoding parser, along with a working seac
emulation (the 5 argument version of endchar).
2000-12-30 01:18:22 +00:00
Tom Kacvinsky fc1de559ad Changed the structures CFF_Encoding and CFF_Charset. 2000-12-30 01:13:50 +00:00
Tom Kacvinsky 97550fc45a Chnaged the structures CFF_Charset and CFF_Encoding. 2000-12-30 01:13:07 +00:00
Tom Kacvinsky abe0d47265 Added functions t2_lookup_glyph_by_stdcharcode and t2_operator_seac
for use in implementing the seac emulation provided by the Type 2
endchar operator.

Extended T2_Parse_CharStrings to add seac emulation for the endchar
operator.
2000-12-30 00:39:40 +00:00
Tom Kacvinsky 4ba1c0ad6f Added tables
cff_isoadobe_charset
    cff_expert_charset
    cff_expertsubset_charset
    cff_standard_encoding
    cff_expert_encoding

Extended functions CFF_Load_Encoding, CFF_Load_Charset, CFF_Done_Encoding,
and CFF_Done_Charset to load and parse the charset/encoding tables, and
free the memory used by them when FreeType is finished with them.
2000-12-30 00:37:14 +00:00
Tom Kacvinsky 7fdd1e528b Added entries pertaining to the changes needed in the CFF/Type 2
driver for font transforms to work.
2000-12-24 10:05:04 +00:00
Tom Kacvinsky 91a0b65f46 In function T2_Load_Glyph, added code so that the font transform is
applied.
2000-12-24 10:01:54 +00:00
Tom Kacvinsky a05c02c9ca Added code to cff_parse_font_matrix so that the font matrix numbers
are scaled by 1/(matrix->yy).  Also, the offset vector now contains
integer values instead of 16.16 fixed numbers.
2000-12-24 09:57:28 +00:00
Werner Lemberg d85623c241 Minor doc fix. 2000-12-23 16:55:29 +00:00
Tom Kacvinsky 390ec38444 Fixed 2000-12-21 entry for ah_hinter_load and ah_hinter_load_glyph to
be more general.  The problem affected more than synthetic fonts.

Added an entry for changes to ahhint.c.  I mistakenly committed
ahhint.c without removing unnecessay comments.  Furthermore, I did not
remove some code that I had commented out.  Silly me!
2000-12-22 07:35:19 +00:00
Tom Kacvinsky 45fbecbba3 Removed unnecessary comments and commented-out code from ah_hinter_load_glyph. 2000-12-22 07:24:02 +00:00
David Turner 55b7403b58 removing obsolete "cidafm" files 2000-12-22 03:40:14 +00:00
Tom Kacvinsky 42f1d254a1 Added entry for fixes to autohinter (related to synthetic fonts). 2000-12-21 01:34:01 +00:00
Tom Kacvinsky f8d841a746 Changed functions ah_hinter_load and ah_hinter_load_glyph so that
synthetic fonts render correctly.  Previously, the first glyph
rendered from such a font did not have the FontMatrix applied.
2000-12-21 01:25:13 +00:00
Werner Lemberg 594f0c965d * *.mk: Added lots of `.PHONY' targets.
* *.mk: Implemented `platform' target to disable auto-detection.


Added support for clipped direct rendering in the smooth renderer.
This should not break binary compatibility of existing applications.
* include/freetype/fttypes.h, include/freetype/ftimage.h: Move
definition of the FT_BBox structure from the former to the latter.
* include/freetype/ftimage.h: Add `ft_raster_flag_clip' value to
FT_Raster_Flag enumeration.
Add `clip_box' element to FT_Raster_Params structure.
* src/smooth/ftgrays.c (grays_convert_glyph): Implement it.

* src/raster/ftraster.c (ft_black_render): Test for unsupported
direct rendering before testing arguments.
2000-12-20 22:09:41 +00:00
Werner Lemberg 5a2fdc0cbc * INSTALL: Added info about makepp. 2000-12-14 22:57:17 +00:00
David Turner 1eb9a43aa1 fixed small bug (no need to test target pixmap in direct rendering mode) 2000-12-14 21:24:27 +00:00
Werner Lemberg 28ffa1f5d6 * docs/design/modules.html: Removed. Covered by design-*.html.
src/smooth/ftgrays.c: Added support for clipped direct rendering in
the smooth renderer.  This should not break binary compatibility of
existing applications.
* INSTALL: Updated installation instructions on Win32, listing the
new "make setup list" target used to list supported
compilers/targets.
2000-12-14 21:22:15 +00:00
David Turner 859a18a358 support for clipped direct rendering
updated INSTALL file for Win32 case
2000-12-14 18:50:40 +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 6b41954e18 * builds/unix/ftsystem.c: Fixed typos. Fixed inclusion of wrong
ftconfig.h file.
2000-12-13 09:21:59 +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 4978d04e5f sigh,... 2000-12-12 16:39:11 +00:00
Werner Lemberg 16a60e872f next try 2000-12-12 16:29:46 +00:00
Werner Lemberg 9fe338bfb4 next try 2000-12-12 16:06:49 +00:00
Werner Lemberg d96cd73f19 next try 2000-12-12 15:33:01 +00:00
Werner Lemberg b052460a14 another try 2000-12-12 07:35: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 90d9964ec9 * */*.h: Changed body inclusion macro names to start and end with
`__' (those which haven't converted yet).  Fixed minor conversion
issues.

* src/winfonts/winfnt.c: Updated to new header inclusion scheme.

* */*.[ch]: Changed source files to adhere to the new
* src/cff/cff.c, src/cff/rules.mk: Updated.

* */*.[ch]: Now using <ft2build.h> as the default build and setup
2000-12-09 00:45:38 +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 508409434c * src/cache/ftlru.c (FT_Lru_Done): fixed a small memory leak 2000-12-06 18:02:01 +00:00
Werner Lemberg 33d023680f * builds/module.mk: Replaced `xxx #' with `xxx$(space).
* builds/os2/detekt.mk, builds/win32/detekt.mk: Moved comment to
avoid trailing spaces in variable.
* builds/freetype.mk: Use $(D) instead of $D to make statement more
readable.

* docs/docmaker.py: Formatting.

* src/psaux/psauxmod.c: Fixed a broken inclusion of component
header files (an FT_FLAT_COMPILE test was missing).
* src/cache/ftcmanag.c (FTC_Manager_Done): Fixed a bug that caused
an occasional crash when the function was called (due to a dangling
pointer).
* src/base/ftsystem.c (FT_Done_Memory): Fixed an obvious bug:
The ANSI "free()" function was called instead of "memory->free()".
* docs/docmaker.py: Added section filtering, multi-page generation
(index page generation is still missing though).
* builds/unix/install.mk, builds/unix/ft2unix.h: The file "ft2unix.h"
is now installed as <ft2build.h> for Unix systems.  Note that we
still use the "freetype2/freetype" installation path for now.

* many files: Now using <ft2build.h> as the default build and setup
configuration file in all public headers.  Internal source files
still need some changes though.
* builds/devel/ft2build.h, builds/devel/ftoption.h: Created a new
Win32 developer builds.
builds/win32/w32-dev.mk: Changed the developer build targets to
"devel-gcc" and "devel-bcc" in order to be able to develop with the
Borland C++ compiler.
2000-12-06 16:31:30 +00:00
David Turner 940d30640f re-fixed FTC_Manager_Done :-) 2000-12-05 23:07:16 +00:00
David Turner 00004eef27 fixed a broken inclusion of header files (a FT_FLAT_COMPILE test
was missing !!)
2000-12-05 22:28:15 +00:00
David Turner 91bb16583b fixed a bug in FTC_Manager_Done 2000-12-05 22:23:12 +00:00
David Turner ca8d1cda94 fixed small error in last update of FT_Done_Memory 2000-12-05 21:32:02 +00:00
David Turner b404d06a6b updated DocMaker to generate section-specific pages 2000-12-05 14:49:39 +00:00
David Turner 5b939ffb77 update 2000-12-05 08:40:54 +00:00
David Turner e646ff6fe2 fixed an obvious bug in FT_Done_Memory. The ANSI "free" function
was called, instead of "memory->free" !!
2000-12-05 08:39:14 +00:00
David Turner e00615992e fixing Cygwin build 2000-12-04 23:34:42 +00:00
David Turner 8c8af31f5f fixed Unix installation 2000-12-04 23:28:14 +00:00
David Turner d3c8e064a5 - updating the header inclusion scheme to use <ft2build.h> by
default..

- created "builds/devel" to hold developer builds options
  for both Win32 and Unix

- fixed a bug in the winfonts driver, where the glyph image format
  wasn't set correctly..
2000-12-04 22:53:55 +00:00
Werner Lemberg bac727a41b Added 2.0.1 entry 2000-12-02 17:08:55 +00:00
Werner Lemberg 1e8b4ae53c formatting 2000-12-02 17:07:15 +00:00
David Turner ac4cd9516e changes to allow compilation under Unix and Cygwin 2000-12-02 00:35:11 +00:00
Werner Lemberg 2e82c93b9d minor fixes 2000-12-01 21:56:47 +00:00
David Turner efa80f2b43 fixed a few warnings with Borland C++ 2000-12-01 21:43:05 +00:00
David Turner aaac8133dc small updates to the documentation and the configure scripts to
prepare the 2.0.1 release
2000-12-01 18:55:22 +00:00
Werner Lemberg 4c80f0c9ca * INSTALL: Revised.
* builds/compiler/bcc-dev.mk, builds/compiler/visualage.mk,
builds/compiler/bcc.mk, builds/win32/w32-bcc.mk,
builds/win32/w32-bccd.mk: Revised.
* include/freetype/config/ftbuild.h,
include/freetype/internal/internal.h: Revised.
* include/freetype/ftimage.h: Updated to new header inclusion scheme.


* builds/toplevel.mk (.PHONY): Adding `distclean'.
* builds/unix/detect.mk (.PHONY): Adding `devel', `unix', `lcc',
`setup'.


* INSTALL: Slightly updated the quick starter documentation to
include IDE compilation, prevent against BSD Make, and specify "make
setup" instead of a single "make" for build configuration.
* include/config/ftbuild.h, include/internal/internal.h: Added new
configuration files used to determine the location of all public,
configuration, and internal header files for FreeType 2.  Modified
all headers under "include/freetype" to reflect this change.  Note
that we still need to change the library source files themselves
though.
builds/win32/detect.mk: Added new files to support compilation with
the free Borland C++ command-line compiler.  Modified the detection
rules to recognize the new "bcc32" target in "make setup bcc32".
src/truetype/ttobjs.c, src/truetype/ttgload.c,
src/truetype/ttinterp.c: Fixed a few comparisons that Borland C++
didn't really like.  Basically, this compiler complains when FT_UInt
is compared to FT_UShort (apparently, it promotes `UShort' to `Int'
in these cases).
2000-12-01 17:25:58 +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
David Turner 8fba32d2d6 introduced the new <freetype/config/ftbuild.h> file to determine
where is the top-level include directory for all public, configuration
and internal header files..
2000-11-30 23:12:33 +00:00
Tom Kacvinsky c261b63aab Added entries for calculation of `face-height' in t1/t2objs.c. 2000-11-30 21:58:49 +00:00
Tom Kacvinsky 16bf6da6d9 Fixed computation of `face->height'. 2000-11-30 21:56:55 +00:00
Tom Kacvinsky 21da848451 Added calculation of `face->height' for pure CFF fonts. 2000-11-30 21:53:39 +00:00
Werner Lemberg 6c65d91cc7 formatting 2000-11-30 06:23:45 +00:00
David Turner ac83e7e09f fixed a bug in the Conic bezier extrema computation formula.. 2000-11-29 23:59:08 +00:00
Werner Lemberg ada9503d22 * src/base/ftcalc.c (FT_SqrtFixed), src/base/ftobjs.c
(FT_Set_Renderer): Use FT_EXPORT_DEF.
* src/cache/ftcimage.c (FTC_Image_Cache_Lookup),
src/cache/ftcmanag.c (FTC_Manager_Done, FTC_Manager_Reset,
FTC_Manager_Lookup_Face, FTC_Manager_Lookup_Size,
FTC_Manager_Register_Cache), src/cache/ftcsbits.c
(FTC_SBit_Cache_Lookup): Ditto.

* src/include/freetype/cache/ftcglyph.h (FTC_GlyphNode_Init),
src/include/freetype/ftmac.h (FT_New_Face_From_FOND): Use FT_EXPORT.
2000-11-29 17:48:57 +00:00
Werner Lemberg f1ca234473 * src/sfnt/sfdriver.c: Include ttsbit.h and ttpost.h only
conditionally.

* src/truetype/ttdriver.c (Set_Char_Sizes, Set_Pixel_Sizes): Set
`size->strike_index' only conditionally.

* src/type1/t1driver.c, src/type1/t1objs.c: Include t1afm.h only
conditionally.

* src/winfonts/winfnt.h: Move all type definitions to...
* src/include/freetype/internal/fnttypes.h: New file.
* src/winfonts/winfnt.c: Use it.


* include/freetype/internal/ftdebug.h: Replaced FT_CAT and FT_XCAT
with a direct solution (which also satifies picky compilers).
2000-11-29 15:18:54 +00:00
Werner Lemberg bf8155a095 new file 2000-11-29 15:17:44 +00:00
Werner Lemberg d157fcf091 * src/truetype/ttobjs.c (TT_Init_Size): Fix #ifdef's to work with
disabled interpreter also.

* src/base/ftnames.c (FT_Get_Sfnt_Name_Count): Fix incorrect
parentheses.
2000-11-29 04:45:26 +00:00
Werner Lemberg 053e24eace formatting 2000-11-27 19:23:05 +00:00
Tom Kacvinsky f214137fbb Changed entry for src/cff/t2gload.c (T2_Parse_CharStrings) to reflect
changes made for even/odd argument counts.
2000-11-27 08:31:05 +00:00
Tom Kacvinsky 6dc51e9cbd T2_Parse_CharStrings: Added more logic to glyph width setting code to
take into account even/odd argument counts.
2000-11-27 08:22:23 +00:00
Tom Kacvinsky 834b53ed0e Simplied glyph width processing code and the comments pertaining to it. 2000-11-27 03:23:50 +00:00
Tom Kacvinsky ed581a3434 Added entry for src/cff/t2gload.c (T2_Parse_CharStrings):
Modified the glyph width parsing code to be more robust.
2000-11-27 01:00:38 +00:00
Tom Kacvinsky 6037f08474 In function T2_Parse_CharStrings, modified glyph width assignment code
to be more robust.  The code now takes into account glyphs that

   1. have the width given as it is, rather than as a difference against
      `nominal_width', and

   2. have the width operand specified before one of the h/r/vmoveto
      commands or the endchar command.
2000-11-27 00:57:13 +00:00
Werner Lemberg 6dd303db0d * builds/ansi/ansi.mk: Fix inclusion order of files.
* src/type1/t1objs.c (T1_Init_Face): Compute style flags.
2000-11-26 21:25:53 +00:00
Werner Lemberg d1e9249b63 * builds/compiler/ansi-cc.mk (CLEAN_LIBRARY): Fix rule and
conditional.
2000-11-26 10:12:00 +00:00
Werner Lemberg 27695e5dbf * src/type1/t1load.c (parse_subrs, parse_charstrings): Use decrypt
function from PSAux module.

* src/type1/t1parse.c (T1_Done_Parse): Renamed to...
(T1_Finalize_Parser): New function (to avoid name clash with a
function in the PSAux module).
(T1_Decrypt): Removed since it it duplicated in the PSAux module.
(T1_Get_Private_Dict): Added `psaux' as new parameter; use decrypt
function from PSAux module.

* src/type1/t1parse.h: Adapted.
2000-11-23 08:21:13 +00:00
Tom Kacvinsky 7e10ee403c Added an entry for "off by one" error in src/cff/t2load.c (T2_Get_String). 2000-11-23 03:45:52 +00:00
Tom Kacvinsky 3da9d565ee In function T2_Get_String, we called T2_Get_Name with an string id
that was off by one.
2000-11-23 03:43:14 +00:00
David Turner 0fc54d0078 adding cache manager documentation (draft) 2000-11-23 03:01:07 +00:00
Tom Kacvinsky de01c5d9cb Added entry for changes made to t2parse.c (in function parse_t2_real). 2000-11-22 23:37:31 +00:00
Tom Kacvinsky a51b45c607 Make sure that parse_t2_real correctly parses a CFF real number. Added more comments
to the function.
2000-11-22 23:34:56 +00:00
Tom Kacvinsky ef0af208a0 Changed entry for `src/cff/t2objs.c (T2_Init_Face)' so that it is
shorter.
2000-11-22 20:40:29 +00:00
Tom Kacvinsky 30eacee9e6 Added entry for changes to T2_Init_Face (related to pure CFF fonts). 2000-11-22 14:38:29 +00:00
Tom Kacvinsky c3dfbde074 In function T2_Init_Face, make sure that root->num_faces gets
set when loading a pure CFF font, and change units_per_EM to
1000 for a pure CFF font.
2000-11-22 14:34:22 +00:00
Werner Lemberg 5c4f5ebd0d formatting 2000-11-18 04:42:41 +00:00
David Turner e006675e67 added support to synthetic Type 1 fonts. Why didn't
this thing get committed ??
2000-11-16 19:06:28 +00:00
David Turner 3944018091 added auto-hinting support for synthetic (obliqued)
Type 1 fonts
2000-11-16 18:06:55 +00:00
Werner Lemberg 34e52707f0 Formatting; removing tabs. 2000-11-13 16:58:01 +00:00
Tom Kacvinsky b5274f557d Added entry for src/sfnt/ttload.c: Change tracing output in functions
TT_LookUp_Table and TT_Load_Generic_Table.  Change comments preceding
TT_Load_Generic_Table.

Added entry for src/sfnt/sfobjs.c: In function SFNT_Load_Face, set
boolean variable has-outline to true only if the font has a `glyf' or
`CFF ' table.
2000-11-13 07:37:51 +00:00
Tom Kacvinsky 200a1a41e3 In function TT_Load_Generic_Header, change tracing output to indicate
if a `bhed' or `head' table is being read.

In function TT_LookUp_Table, change tracing output to indicate success
or failure of table loading, and place output on one line.
2000-11-13 07:31:21 +00:00
Tom Kacvinsky e0bd0c01d9 In function SFNT_Load_Face, set has_outline to true only if
the font has a `CFF ' or `glyf' table.
2000-11-13 07:26:31 +00:00
Werner Lemberg e397e2a340 * builds/win32/visualc/freetype.dsp: Fix raster1->raster and
type1z->type1.
2000-11-12 06:49:17 +00:00
Tom Kacvinsky e503527c64 Added a --libtool option, which returns the absolute path to the
libtool convenience library.
2000-11-12 02:55:25 +00:00
Tom Kacvinsky 8a2503aaef builds/unix/freetype-config.in, builds/cygwin/freetype-config.in:
Added --libtool option.
2000-11-12 02:53:35 +00:00
Werner Lemberg 84278bc7ef * builds/cygwin/cygwin-def.in: Same fix as previous.
* builds/unix/unix-def.in: Add


so that installation of freetype-config does not fail.
2000-11-11 21:48:05 +00:00
Tom Kacvinsky 2c81833738 Fixed minor type in unix-def.in entry. Oops! 2000-11-11 08:35:24 +00:00
Tom Kacvinsky 5279cd242c Added entry for changes to builds/unix/unix-defs.mk. 2000-11-11 08:32:41 +00:00
Tom Kacvinsky d5d28f89b9 Added
INSTALL_PROGRAM := @INSTALL_PROGRAM@
  INSTALL_SCRIPT  := @INSTALL_SCRIPT@

So that the install of freetype-config does not fail.
2000-11-11 08:29:17 +00:00
Werner Lemberg 9a5a3ae00d New file. 2000-11-11 06:27:58 +00:00
Werner Lemberg 4af2f18cc3 Minor fixes. 2000-11-11 05:55:41 +00:00
Werner Lemberg a82cd844fb Small fixes and formatting. 2000-11-10 22:43:37 +00:00
Werner Lemberg a8df54a3ec Revising, formatting. 2000-11-10 22:39:21 +00:00
Werner Lemberg 15d3dcd900 Revised. 2000-11-10 17:10:14 +00:00
Werner Lemberg 6f36900589 Revised. 2000-11-10 05:45:07 +00:00
Werner Lemberg 361d9b8a7c Revised. 2000-11-09 22:15:34 +00:00
David Turner 85924a8884 fixed typos in the license 2000-11-09 19:14:11 +00:00
David Turner 27c8827f3c small update 2000-11-09 19:10:22 +00:00
David Turner 276e47e7a7 - moved default installation of header files to "include/freetype2"
instead of "include/freetype"

- added generation and installation of "freetype-config" script
2000-11-09 18:29:59 +00:00
David Turner 73622119dd - changing the default include path from "include/freetype"
to "include/freetype2"

- adding template for the "freetype-config" script that is installed
  in the "bin" directory. It is used to retrieve information about
  the current installation path, C flags & linker flags
2000-11-09 18:23:30 +00:00
Werner Lemberg fed760b1bf Revised. 2000-11-09 16:23:23 +00:00
Werner Lemberg 0901f653db Revised. 2000-11-09 08:01:18 +00:00
Werner Lemberg 5330dd6e81 Revised. 2000-11-09 06:26:30 +00:00
David Turner c9d7b5e3ed minor warning with VC++ solved 2000-11-09 03:18:32 +00:00
David Turner 0c426d1ecb updating the "Design of FreeType 2" document 2000-11-09 01:14:31 +00:00
David Turner cd1afc4ef1 fixed a bug in "docs/glnames.py" which caused he generation of an
invalid Mac names table in the file "src/psnames/pstables.h".

This caused FT_Get_Glyph_Name to return invalid glyph names
for certain TrueType fonts..
2000-11-09 00:47:05 +00:00
David Turner 3574643bc0 major reformatting of the "Glyph Conventions" document.
It is now made of 7 different pages and has been updated
2000-11-09 00:01:38 +00:00
Werner Lemberg f42e6595e6 Minor fixes. 2000-11-08 20:21:38 +00:00
David Turner a6c747d2b5 fixed a small bug: the "linearHoriAdvance" and "vertHoriAdvance" were
not set correctly when the auto-hinter is used to load/hint a glyph..
2000-11-08 19:44:48 +00:00
David Turner 5387d894a9 fixed max advance width for fixed-pitch T1 fonts 2000-11-08 19:40:08 +00:00
David Turner 042584a968 changed comments in the cache sub-system sources
to indicate that it is now BETA code, instead of ALPHA
2000-11-08 00:24:58 +00:00
David Turner 23a0670b98 removed the file <freetype/internal/ftlist.h> and corrected
files that depended on it.

the ftlist.c function definitions are now FT_EXPORT_DEF
instead of FT_BASE_DEF
2000-11-08 00:20:25 +00:00
David Turner 94e3bfafa0 fixed a small bug in the abstract chunk cache class 2000-11-08 00:15:58 +00:00
Werner Lemberg 8ec9dfd991 Moving doc comments for BASE functions from source to header files. 2000-11-07 23:56:02 +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
Werner Lemberg 4b68007b4f Complementing David's changes with formatting, adding documentation, etc.
More `*'-convention formatting, adding the `a' resp. `an' prefix to
variables.
2000-11-07 06:30:29 +00:00
David Turner c6fa4aff2e removed deprecated reference to "SemTex" 2000-11-07 02:59:11 +00:00
David Turner 856c578925 removed incorrect comment 2000-11-07 02:44:04 +00:00
David Turner f96594faf0 integrated Yamano-Uchi changes to the base source code. However,
I've made a few modifications:

  - there is no new field named "driver" in "FT_SizeRec"

  - the new fields in "TT_SizeRec" are:

       strike_index   :: value 0xFFFF means "no sbit strike selected"
       strike_metrics :: the FT_Size_Metrics structure corresponding to
                         the currently selected strike

  - the code in "ttload.c" has been somewhat cleaned up too

thanks a lot, Y-U !!

- David
2000-11-06 23:07:51 +00:00
David Turner d18440f14d added simple objects relationships model to the design documentation 2000-11-06 20:37:47 +00:00
David Turner b8849e71c2 adding library model graphics 2000-11-06 20:21:31 +00:00
David Turner 25dee217ab some updates to the cache sub-system. some methods were moved from
the concrete "FTC_Image_Cache" and "FTC_SBit_Cache" to the abstract
"FTC_Glyph_Cache" and "FTC_Chunk_Cache", respectively..

note: this is not the end of changes to the cache sub-system
2000-11-06 19:29:06 +00:00
Werner Lemberg 3a40847c60 Added/restored the `*' convention for output parameters.
Some documentation fixes.
2000-11-06 04:33:56 +00:00
Werner Lemberg 8c883fb542 minor fixes.
Add more gcc warnings for development on UNIX.
2000-11-05 23:41:08 +00:00
Werner Lemberg 91481f8a4b Introduced $(space) in the makefiles to get rid of using the comment
separator for indicating a trailing space.
2000-11-04 23:41:02 +00:00
Werner Lemberg 77fb4cedff removed redundant checks. 2000-11-04 09:41:45 +00:00
Werner Lemberg 88b2e6c330 Ignore build files. 2000-11-04 08:37:45 +00:00
Werner Lemberg 1b6c32fa8b Ignore some UNIX shared build files. 2000-11-04 08:35:44 +00:00
Werner Lemberg dc72aff43d Finishing David's latest changes (there were some errors in it). 2000-11-04 08:33:38 +00:00
David Turner 54e7574946 defining new types to hold "internal" fields of public
objects:

  FT_Face_Internal, FT_Size_Internal, FT_Slot_Internal

these contain some fields that may change between releases
of FreeType, without affecting the size of FT_FaceRec,
FT_SizeRec, FT_GlyphSlotRec, etc.., which means that
drivers wouldn't need to be recompiled if we only add new
fields to an internal structure..

I plan to hack a few things related to the auto-hinter and
I need this move to ensure that we will not break binary
compatibility between 2.0 and 2.1 :-)

- David
2000-11-04 02:52:02 +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 4091109486 Don't access freed variables... 2000-11-03 07:57:51 +00:00
Werner Lemberg 7b45c28dd5 Remove redundant code; fix computation of `last'. 2000-11-03 07:34:29 +00:00
Werner Lemberg a13a473dd9 More C++ fixes. 2000-11-02 15:14:38 +00:00
Werner Lemberg 21fb2d9513 Adding header file for labs(). 2000-11-02 08:20:15 +00:00
Werner Lemberg 098ab26c72 Moving FreeType license to doc dir.
Adding GPL.

Explaining double license in LICENSE.TXT

Minor improvements to make system.
2000-11-02 07:53:08 +00:00
Werner Lemberg 1a951e30b4 new file 2000-11-01 20:27:39 +00:00
Werner Lemberg 9140ae06a6 Adding rules for mingw32 compiler. 2000-11-01 20:27:13 +00:00
Werner Lemberg ab8552321c Fixing include header for a `make multi' build.
Finishing formatting of cache stuff.

Fixed getDriverClass stuff -- added it to winfnt.c also.  Note that this
still has to be documented.
2000-10-31 22:13:54 +00:00
Werner Lemberg e4b32a5dc5 Removing trailing whitespace. 2000-10-31 20:42:18 +00:00
Werner Lemberg dd33561ecb Formatting.
Adding a .cvsignore file.
2000-10-31 19:42:53 +00:00
Werner Lemberg 3dc4374f43 Formatting.
Removed double src/cache/ftcimage.h.

Replaced FTC_Image_Type with #defines since this contains bit flags and not
enumerated values.
2000-10-31 17:49:07 +00:00
David Turner 2909475716 at last, the infamous cache bug is fixed !! 2000-10-31 10:58:23 +00:00
Werner Lemberg d1896124dd Revised/formatted/corrected. 2000-10-31 07:36:53 +00:00
Werner Lemberg 60784a2200 Formatting/correcting the first three parts of the design docs. 2000-10-30 20:46:41 +00:00
Werner Lemberg cf4398a6f5 minor formatting 2000-10-30 19:22:09 +00:00
David Turner 31fa0bdcd8 added page 5 of design documentation 2000-10-30 18:55:47 +00:00
Tom Kacvinsky 6043b2404e In function FTC_ChunkSet_Destroy, changed `manaher' to `manager'. Just
a fix for a silly typo.
2000-10-29 01:47:51 +00:00
David Turner ece6379859 completed the sbit cache, though it's still buggy :-(
major reformatting of the cache subsystem (again)
added substantial documentation too in header files
2000-10-28 23:34:45 +00:00
Werner Lemberg b5084e11f7 Renamed z1* files back to t1*; the same transition for Z1_* structures
Removed obsolete raster1/* files.
2000-10-28 17:10:06 +00:00
Werner Lemberg 1ea9378ad3 Revised. 2000-10-28 16:59:44 +00:00
David Turner 4e4a43631c - completed the abstract chunk cache class
- started implementin a "small-bitmaps" cache derived from it
- (soon a "metrics" cache will be written too)
2000-10-28 13:17:11 +00:00
David Turner 9b8f5c4ce1 small updates:
- reworked slightly the cache manager to better
   differentiate between the abstract class in "ftcglyph.h"
   and the FT_Glyph sub-class in "ftcimage.h", and
   slightly reduced the size of FTC_GlyphNodeRec, saving
   8 bytes on a 32-bit system. Yes, I'm crazy ;-)

 - added build files to compile with LCC on Unix too
   (compile speeds _are_ insane with it). There is unfortunately
   a bug in the version I'm using (LCC 4.1) that prevents it
   to compile FT_MulTo64 correctly (in src/base/ftcalc.c)

   the generated assembly is incorrect, I don't know what
   to do ?? the build files are ok, though..

   you should invoke "make setup lcc" to select them..
2000-10-28 07:26:59 +00:00
David Turner 47c14b9db3 fixing a small bug in FT_Glyph_To_Bitmap:
the glyph advance wasn't copied to the bitmap !!
2000-10-27 00:53:16 +00:00
Werner Lemberg ddbb8e7b6a Some formatting.
Fixed some data types/added header files to remove compiler warnings.

Added trivial input data check to FT_Outline_Get_BBox().

Fixed type1z -> type1 file inclusions.
2000-10-26 10:04:16 +00:00
David Turner 205fc3faf2 updates to the API reference generators
the basic parsing routines seem to work ok
we now generate a list of DocBlock objects from
a list of input file, we now need to sort them
by "kind" (i.e. type/macro/functions) to generate
several web pages, as well as a global index
2000-10-26 07:52:40 +00:00
David Turner a4e2894e03 simple renaming of directories:
"type1z"  -> "type1"
  "raster1" -> "raster"

note that I didn't rename all files. We'll have to endure
the "z1..." crazyness unless we perform a _big_ sed on
the sources :-)
2000-10-26 00:30:33 +00:00
David Turner 3a3ffedcb2 adding "ftbbox" to build rules 2000-10-26 00:08:15 +00:00
David Turner 54169b35f8 - reviving the "ftbbox" component, used to compute exact bounding
box computations

- minor update to docmaker.py, more is coming
2000-10-26 00:06:35 +00:00
David Turner 4cd68a09c5 updating the FT2 design documentation
- note that the "modules.html" will soon disappear, it is now replaced
  by a more general and more detailed series of pages named "design-??.html"

- the images have been seriously reworked, more will come tomorrow
2000-10-25 23:42:02 +00:00
Werner Lemberg 6a4253388b fixes for fixes :-)
formatting; compiles now without warnings on my Linux box
2000-10-24 05:44:59 +00:00
David Turner dc26e7b77f - minor reformatting of "ftmodule.h"
- added missing "const" statements in the source code in order
  to really get rid of writable static variables
2000-10-23 22:46:56 +00:00
David Turner 8aed852923 - reformatting and tiny doc update 2000-10-23 18:33:30 +00:00
David Turner 6fbb95beb1 - added first draft of "Modules in FreeType 2"
- minor formatting / testing in docmaker.py
2000-10-23 18:32:55 +00:00
Werner Lemberg 3c7c5da3bb added development header files to CONFIG_H in the makefiles
increased T1_MAX_CHARSTRINGS_OPERANDS (again) to 256 -- one glyph of the
Chinese MingTiEG-Medium needs it that large
2000-10-19 15:56:22 +00:00
Werner Lemberg 05f0ad098f Converting tabs to spaces in z1load.
Edited FT1's convntns.txt and added it to FT2.
2000-10-19 05:12:00 +00:00
Tom Kacvinsky 40822003da In function parse_encoding, initialize encoding_table.elements to have
.notdef in each entry.

In function parse_charstrings, place the .notdef glyph in index 0, and
add a .notdef glyph if it is missing.

In function Z1_Open_Face, only change min/max encoded char if it is not
.notdef.
2000-10-17 20:25:30 +00:00
Werner Lemberg 5a96b07c1f Fixed two typos spotted by Ryan Martindale <ryan@qsicorp.com>. 2000-10-17 14:29:48 +00:00
Werner Lemberg 47a5f41de6 Added copyright messages to all Makefiles.
Added documentation to FT_Get_Sfnt_* stuff (in ftnames.[ch])

minor other doc fixes
2000-10-17 03:38:43 +00:00
Werner Lemberg c1635d44f9 ftnames.c has been erroneously included twice. 2000-10-15 23:32:01 +00:00
Werner Lemberg 0bf381f7ab Make ftsynth.c work again.
Renamed FT_*_Outline to FT_Outline_*
2000-10-15 21:59:58 +00:00
Werner Lemberg dc268f24ba Fix typo (FT_... -> TT_...) 2000-10-15 17:59:17 +00:00
Tom Kacvinsky 95ac657e18 Minor fix in Z1_Open_Face for building char_index table 2000-10-15 08:53:27 +00:00
Werner Lemberg 6db35342df updated, formatted 2000-10-14 15:24:39 +00:00
Werner Lemberg e73d9957a2 Enabled TT interpreter in development version of ftoption.h 2000-10-14 05:18:59 +00:00
Werner Lemberg e67e349a0b More fixes to the tutorial.
Added artificial Type 1 pid/eid paors to ttnameid.h.
2000-10-13 21:00:36 +00:00
Werner Lemberg 0b7b23edfd complete revision 2000-10-13 07:08:44 +00:00
Werner Lemberg afc01e8845 Completely revised. 2000-10-12 16:09:49 +00:00
Werner Lemberg eddd9909e2 formatting
small fixes
2000-10-12 05:05:40 +00:00
David Turner 3c95d31ed4 formatting 2000-10-12 01:29:14 +00:00
David Turner f559a48e1a formatting 2000-10-12 01:22:29 +00:00
David Turner f88969ab6c the function FTC_Manager_Lookup_Size will return a valid
FT_Face handle, even if no size was found..
2000-10-12 00:28:00 +00:00
David Turner b89fb71ce6 fixed a subtle 64-bit problem that only appears with
Compaq C compiler (though it's really a bug)
2000-10-11 23:39:03 +00:00
Werner Lemberg a7096374ee Added new `ft_glyph_bbox_unscaled' enum; fixing documentation of
FT_Glyph_Get_CBox().

ftnames.c has been omitted from the Makefile.
2000-10-11 23:31:12 +00:00
Werner Lemberg 3d568ac772 A fix from Yamano'uchi to get correct font names. 2000-10-11 14:59:46 +00:00
Werner Lemberg eadc8df24d A fix from Tom to fix the last=first point problem if it is a control point. 2000-10-11 05:52:42 +00:00
Werner Lemberg 4b92cf80c7 provide `export "C"' guard only for default fterror handling. 2000-10-10 03:58:32 +00:00
Werner Lemberg 0634cedb62 patch from Tom to fix a problem with path_begun. 2000-10-09 01:44:40 +00:00
Werner Lemberg c118a32d48 fix documentation 2000-10-07 15:51:50 +00:00
David Turner 2c5b7ebf71 fixed a small bug in the uninstall mode 2000-10-07 01:21:25 +00:00
Werner Lemberg 6fbe4db6b7 minor formatting issues 2000-10-05 04:53:31 +00:00
David Turner f00a4de92b fixed two bugs:
- one bug in the auto-hinter that could cause some program
    crashes with certain fonts

  - fixed the loading of the font matrix "offset" parameters
    in Type 1 and CID-keyed fonts..
2000-10-03 22:03:09 +00:00
David Turner ec0b2cd974 small fix:
when in direct rendering mode, the target bitmap buffer
  is not checked..
2000-10-03 19:22:52 +00:00
David Turner 78dd7104ef small fix:
when in direct rendering mode, the target bitmap buffer
  is not checked..
2000-10-03 19:13:11 +00:00
David Turner a0be99f131 changing the linkage type of
FT_New_GlyphSlot and FT_Done_GlyphSlot to
BASE_DEF instead of FT_EXPORT_DEF
2000-10-03 18:02:02 +00:00
David Turner 896b604ca8 updated the build system:
- new files for the "cygwin" platform
 - new workspace files for Visual C++ in "builds/win32/visualc"
 - updated "docs/BUILD" slightly
2000-10-03 17:51:29 +00:00
David Turner 9e62d694be adding missing image files 2000-10-03 17:08:42 +00:00
David Turner b59bf7e5cc removing obsolete files:
the design of FT2 has evolved considerably since
these documents were written, and it's better not to
include them in order to avoid confusion among
users of the library..
2000-10-03 17:07:28 +00:00
Werner Lemberg 8bb45ec8fb Fixing comment in unixddef.mk which caused a trailing blank.
Adding a new error, FT_Err_Invalid_Pixel_Size (used in winfnt.c)

Fixing FT_Read_Fields() which failed for ft_frame_{bytes,skip}.  This bug
disabled the Winfont driver.

Minor formatting issues.
2000-09-29 06:41:56 +00:00
David Turner 42022c8c94 fixed a bug in the Type 1 and CID font drivers:
the value of the descent returned was positive,
  instead of being negative..
2000-09-27 01:01:10 +00:00
Werner Lemberg 8925009f79 Adding missing code for flat compiling mode. 2000-09-26 13:25:15 +00:00
Werner Lemberg bd547dc6e3 Clean up, formatting etc.
Fixing rules for installing cache headers on Unix.

Updating builds/unix/ftconfig.in.
2000-09-22 21:23:29 +00:00
Werner Lemberg f50c2954d4 Fixed typo in ftimage.h
Fixed sbit on/off flag in cache code.
2000-09-22 06:52:20 +00:00
Werner Lemberg 50dd5858a7 Applied a patch from Hidetoshi for embedded bitmap metrics support. 2000-09-22 03:37:45 +00:00
Werner Lemberg 1a2908bbc0 Added support for (3,0) pid/eid. 2000-09-21 14:10:23 +00:00
David Turner 4e38576a97 fixed a bug that happened when rendering spaces
in monochrome mode..

actually, when outline.num_points == 0, it is legal
to have outline.points == 0 too. The code did return
a FT_Err_Invalid_Outline error incorrectly then because
the checks were not performed in the correct order
2000-09-19 19:44:42 +00:00
David Turner beece1bf39 small update, allow CONFIG_MK to be pre-defined
before inclusion
2000-09-19 18:33:20 +00:00
David Turner 08a91fd0c6 final touches. Cache seems working after all, though the
default cache size of 300 Kb is certainly too high for
now :-)

Need to implement abstract chunk cache and bitmap chunck cache
2000-09-19 02:08:09 +00:00
David Turner ebdce8344a updated the cache sub-system. Major internal rewrite
please be aware that major bug persist..
2000-09-19 01:11:11 +00:00
David Turner 58e932157b removed obsolete file (ftcimage.h)
updated header files
2000-09-19 01:10:25 +00:00
David Turner b71c6af028 fixed minor bug in the smooth renderer which forced
the span callback to be called with y == -1 and count == 0
2000-09-17 17:17:16 +00:00
David Turner 426984e47b major revamp of the build system.
Fixing the Unix Autoconf parts
2000-09-15 23:47:42 +00:00
David Turner 9b11b9e3e4 adding updated cache header files 2000-09-15 22:50:59 +00:00
David Turner d38a4f6593 removed obsolete files 2000-09-15 22:42:43 +00:00
David Turner 046f7a0c31 major revamp of the build system 2000-09-15 22:42:06 +00:00
David Turner b8817177a0 small bug-fix, the linearHoriBearing value was not
loaded not computed correctly
2000-09-15 17:17:17 +00:00
David Turner c9ce9e4e3f small bug-fix 2000-09-15 17:16:49 +00:00
David Turner f2545e8078 fixed a very stupid bug that prevented FT_Outline_Render from
working correctly..
2000-09-15 03:37:16 +00:00
Werner Lemberg f9b0375002 small formatting issues. 2000-09-11 22:50:13 +00:00
David Turner a8194a97db - added a new function called FT_SqrtFixed to compute the
16.16 square root of a 16.16 number (this could come handy
  in a later version of the auto-hinter)

- small fixes to the smooth renderer. It used to use way too
  much line segments when drawing beziers !!
2000-09-02 00:20:42 +00:00
Werner Lemberg 21a27ee3cb Fixed a long outstanding bug with an incorrect offset for reading post
tables.
2000-09-01 14:36:39 +00:00
Werner Lemberg 155a575ad9 Small improvement. 2000-09-01 05:35:49 +00:00
David Turner 7909673992 - the file "ftlist.h" was moved from <freetype/internal/..> to
<freetype/...>

- bugfix for the cache sub-system..
2000-08-30 21:40:45 +00:00
Just van Rossum 6d2596368a updated for new modules and sources (mainly psaux) 2000-08-29 19:10:16 +00:00
Werner Lemberg 353dfeafa3 More warnings fixed. 2000-08-29 18:58:41 +00:00
Werner Lemberg 4a5c142a40 Minor fixes. 2000-08-29 18:37:25 +00:00
Werner Lemberg 4e9dae68b7 Introducing new macro LOCA_VAR to solve some problems with structures
containing function pointers.

FT will now compile again with C++.
2000-08-29 16:50:01 +00:00
David Turner 80b96f350c fixed some bugs in the caching sub-system and improved
its API to enable many kinds of glyph images..

(note that the "ftview" program has been changed to
use the caching sub-system, "ftmulti" and "ftstring"
should come soon).
2000-08-29 16:04:28 +00:00
David Turner e12e313a04 a small optimisation that should speed things a bit.
I'm surprised I didn't do it before..
2000-08-29 16:03:28 +00:00
David Turner 5878a6d2ad a fix to the computation of the font "text height" (i.e. the
baseline-to-baseline distance).

Unfortunately, we cannot rely on the OS/2 fields, like
sTypoAscender or usWinAscent to compute it. Rather,
we only look at the horizontal header's content. In case
the "line gap" is set to 0, we compute the text height as
115% of the ascender+descender value..

(this percentage is based on the values found in many
Windows fonts).
2000-08-29 16:03:01 +00:00
Werner Lemberg dc7f9c8dd0 Formatting.
docmaker.py will now run with older Python versions also.  Small fix.
2000-08-27 07:12:40 +00:00
Werner Lemberg 95853c87f5 Introducing new error code FT_Err_Invalid_Cache_Handle.
Regrouping of error codes.
2000-08-26 22:16:44 +00:00
Just van Rossum 9b4bb291d9 #include <freetype/internal/ftdebug.h> /* for FT_ERROR() */ 2000-08-25 20:00:58 +00:00
Werner Lemberg d1b7475be1 Formatting, small fixes.
Adding basic input parameter checking for exported functions.
2000-08-24 16:29:15 +00:00
David Turner 35db73220c - fixed an horrible FT_LOAD_RENDER bug that returned empty
bitmaps !!

- tested and fixed the image cache object. I'm performing a
  few more checks though, and we'll call the cache sub-system
  completed !!
2000-08-24 12:39:40 +00:00
David Turner 98d2701c58 changed the FTC_Manager_New function to accept "max_faces" and
"max_sizes" parameters

fixed some bugs. the cache manager is now tested and validated
(now, it's time for the glyph image cache)
2000-08-24 11:53:35 +00:00
Just van Rossum 4a47f668a1 fixed typo in FT_FLAT_COMPILE section 2000-08-24 00:43:08 +00:00
David Turner fcf5e68650 renamed "psmodule.c" to "psauxmod.c" 2000-08-24 00:30:24 +00:00
David Turner 888706a317 removing obsolete files 2000-08-23 22:50:39 +00:00
David Turner b8a7a0bdea removing obsolete files. These are moved to a new
CVS module called "ftlayout"
2000-08-23 22:48:50 +00:00
David Turner 34f1c2f5f4 finally, the CID and Type1z driver are finished !!
Werner, please have a look at the code and start
re-formatting it :-)
2000-08-23 22:47:44 +00:00
David Turner 3b2c50eb3b completing the FreeType Cache subsystem files 2000-08-23 21:11:13 +00:00
Werner Lemberg 8728f294bc Formatting, small fixes.
Adding copyright notices etc.
2000-08-23 17:32:42 +00:00
David Turner b466a7650c The FreeType Caching Subsystem - first lines of code
beware, this code is not tested, and probably doesn't compile
correctly.. more information will follow..
2000-08-23 11:22:30 +00:00
David Turner a39acf55f7 updated "psaux" and "type1z".
The Type 1 driver now completely relies on "psaux". I
now need to change the CID driver accordingly, then
finally move the Type 2 parsing routines to "psaux"
when appropriate..
2000-08-23 02:47:57 +00:00
David Turner 5ef3c95377 updating documentation to explain the use of CFG to
pass parameters to the configure script
2000-08-22 23:15:23 +00:00
David Turner d8b4514d43 added preliminary emboldening code.. still _very_
experimental
2000-08-22 22:53:03 +00:00
David Turner 38cb5af01f changed the "devel" setup targets to use "builds/<system>/devel"
as the build directory. This is used to specify a specific
"ftoption.h" that toggles all traces and logging on.

Hence, the default build doesn't need the traces
2000-08-22 22:51:57 +00:00
David Turner 38d979ceb4 adding developer dir hierarchy 2000-08-22 22:50:32 +00:00
David Turner 9748807412 the psaux module is now nearly completed
the "type1z" driver uses it to parse Type 1 charstrings
(not to parse the Type 1 token stream yet though)..
2000-08-22 22:36:33 +00:00
David Turner 48721c11b5 significant updates. The generated HTML is now much
more pleasant..
2000-08-21 23:01:32 +00:00
David Turner f95a603117 minor updates to the "psaux" module.
Werner, please do not start re-formatting my experimental
code until I declare it "finished", because I still make big
changes to it that create lots of CVS conflicts..

thanks for your work, anyway :-)
2000-08-21 04:58:49 +00:00
David Turner c38ddff8ac fixed a _serious_ bug in FT_Glyph_Get_CBox 2000-08-21 04:43:01 +00:00
Werner Lemberg b1c8bf0683 Minor formatting.
Adding copyright/C++ guards to psaux files.
2000-08-17 07:18:04 +00:00
David Turner 24d7024c44 added draft "psaux" code
the t1 driver now reads the complete font matrix

and applies it (some fonts do not work properly without
hinting though...)
2000-08-17 01:09:06 +00:00
David Turner 710354b8e9 fixed the bug that prevented bitmap formats to be loaded
correctly when the auto-hinter is used (symptom: "winfonts"
driver didn't load bitmaps correctly).
2000-08-16 17:04:22 +00:00
Werner Lemberg 9a814fabbf Yamano-uchi added support for SFNT-wrapped CID bitmap font files (with
minor modifications from WL).
2000-08-06 19:48:47 +00:00
Werner Lemberg 29a90e2610 Updating unix/ftconfig.in to recent config/ftconfig.h changes.
More C++ fixes: Introducing LOCAL_FUNC_X for local functions used in
function pointers (there are no local anonymous functions in C++) and
FT_CPLUSPLUS (instead of FT_EXPORT_VAR) to define linkage of structures
which contain function pointers.
2000-08-03 00:03:08 +00:00
Just van Rossum 4174350526 Added little know adx offset to t1operator_seac() -- accent positioning now seems correct. 2000-08-02 02:44:25 +00:00
Werner Lemberg f28b7536ca Add missing header file. 2000-08-02 01:10:59 +00:00
Werner Lemberg 2d310502df Forgot to run autoconf... 2000-08-02 00:20:04 +00:00
Just van Rossum 2fd491d5f3 Fixed Z1_Parse_CharStrings() to work correctly with "open" paths (ie. missing closepath operator) 2000-08-01 23:37:25 +00:00
Just van Rossum dd81f42282 fixed t1_tofixed() to handle floats of the form .001 and -.001 correctly. 2000-08-01 20:47:48 +00:00
Werner Lemberg 07373c8de9 Fixed dec-osf compiler switches. From Tom. 2000-08-01 18:44:18 +00:00
Werner Lemberg 3a89c2a4ac Removing FT_MAKE_OPTION_SINGLE_LIBRARY_OBJECT. It has never worked.
Instead, define BASE_DEF() and BASE_FUNC() similarly to FT_EXPORT_DEF() and
FT_EXPORT_FUNC(), respectively, allowing the programmer to define proper
types and/or export lists for multiple DLLs if necessary (e.g. ftbase.dll --
standalone, fttype1.dll -- needs ftbase.dll, etc.).

The library is finally compiling and linking natively with a C++ compiler!
2000-08-01 17:05:20 +00:00
Werner Lemberg c713d924d8 Added #ifdef's for C++ to all header files. 2000-08-01 13:17:04 +00:00
Werner Lemberg a9f2ddd3dc Added a `distclean' target to remove files which are produced by the UNIX
configure script (in case no config.mk has been created due to errors).
2000-08-01 08:43:44 +00:00
Just van Rossum 80a330afe8 fixed two bugs related to T2 real numbers: the "skipping" code didn't behave correctly (leaving a bad stack ptr), and the actual parsing code also parsed the code (30) as two nibbles. 2000-08-01 07:12:31 +00:00
Just van Rossum 7c64409e86 Some simple patches that allow synthetic fonts to be rendered. *However*: although the FontMatrix is read correctly, it does _not_ seem to be used! I don't understand this... 2000-08-01 04:29:25 +00:00
Werner Lemberg b8431ed776 Use the ANSI offsetof() macro instead of something home-brewn. 2000-08-01 01:34:18 +00:00
Werner Lemberg b1dd3535d5 Added autoconf tests FT_MUNMAP_DECL and FT_MUNMAP_PARAM to fix some devils.
Updating unix/ftsystem.c accordingly.

More warning fixes.
2000-07-31 22:51:00 +00:00
Werner Lemberg e72c9fec17 Simplifying the FIELD_* and FRAME_* macros. Before calling these macros,
you should #define FT_STRUCTURE to the structure which will be filled.

Replaced FT_FIELD_REF with FT_FIELD_SIZE, FT_FIELD_SIZE_DELTA, and
FT_FIELD_OFFSET to make the code more readable; additionally, it should be
more portable because we no longer cast a pointer to an FT_UShort (which
e.g. fails with Sun's C++ compiler) but computes the difference between two
pointers which is guaranteed to work.

Fixing warnings (and C++ errors) while using Sun's latest cc and CC
incarnations.  Most of them are related to variable shadowing.
2000-07-31 18:59:02 +00:00
Werner Lemberg 35ca3426eb Fixing gcc warnings on Solaris. 2000-07-31 12:14:27 +00:00
Werner Lemberg fd9777e9ed Making path of $INSTALL always absolute. 2000-07-31 10:56:42 +00:00
Werner Lemberg 98fba7cfbc Update to latest versions. 2000-07-30 20:21:22 +00:00
Werner Lemberg 28e6a8f75b Applied a patch from Tom Kacvinsky (taken from the curren libtool CVS) to
make it libtool run on OSF.
2000-07-30 09:26:45 +00:00
Werner Lemberg 05c21b8f3d Formatting. 2000-07-29 20:38:19 +00:00
Just van Rossum e97cb9127d FT_Done_Stream(): do stream->close = 0 after calling stream->close(); this makes it safe to call FT_Done_Stream() more than once.
David: please review this; I hope you agree with this minor change.
2000-07-28 03:13:31 +00:00
Just van Rossum 5fe94ff636 Adapted to new external stream semantics. 2000-07-28 02:25:23 +00:00
David Turner 08d78b62e3 removed warning 2000-07-28 01:51:49 +00:00
Just van Rossum d2b93caab7 Oops, I had exaggerated the warning levels a weensy bit... 2000-07-28 01:37:53 +00:00
Just van Rossum 78575d5e42 Updated to reflect the new Mac FOND support setup. 2000-07-28 01:14:09 +00:00
Just van Rossum 622f514c3f Obsolete; Mac FOND support now lives in src/base/ftmac.c. 2000-07-28 01:13:29 +00:00
Just van Rossum 9e830c5d3f Put FT_New_Face() in an #ifndef macintosh switch; ftmac.c provides an extended implementation. 2000-07-28 01:12:34 +00:00
Just van Rossum 6012037b2d Removed Mac fond driver #ifdefs 2000-07-28 01:11:20 +00:00
Just van Rossum ae4bceefa9 Brand new Mac support -- no more muching with changing drivers and reinitializing streams, but a clean layer on top of FT_Open_Face(): an extended version of FT_New_Face(). 2000-07-28 01:10:35 +00:00
Just van Rossum e973e66a0f Header for one Mac-specific additional API call. 2000-07-28 01:08:32 +00:00
Werner Lemberg 58b17f9647 Formatting. 2000-07-27 23:29:08 +00:00
David Turner b169341e48 update to changelog 2000-07-27 21:48:48 +00:00
David Turner c5cdf8bcf1 re-adding a "unix-dev.mk". Debugging libtool output
is just too much of a pain for me, I prefer a good old
static lib without optimizations :-)

"make devel" is back on Unix then..
2000-07-27 21:40:22 +00:00
Werner Lemberg c703b1bf6d *slight* formatting only. Congratulations, David! :-) 2000-07-27 16:57:35 +00:00
David Turner 666b11d59c small fix to the auto-hinter:
the filling direction of each glyph is now re-computed on the
fly, given that we cannot rely on the "flags" field of the
source outline..

this fixes problems with many fonts, including the Arphic ones
(not to say that CJK fonts are handled better for now though..)
2000-07-27 15:59:08 +00:00
Werner Lemberg 6ac722b229 Adapting changes for Unix to other makefiles. 2000-07-27 11:32:13 +00:00
Werner Lemberg 321cd27d0f Removing compiler warnings about unused portions of code.
Now unix.in uses absolute paths also to overcome problems with libtool.
To do that in a consistent way I had to modify the rules how to handle
$OBJ_DIR (and consequently $LIB_DIR): You should set $OBJ_DIR explicitly
on the command line (or environment).
2000-07-27 11:20:20 +00:00
Werner Lemberg 796f9de262 Updating to libtool 1.3.5. 2000-07-26 22:51:03 +00:00
David Turner bc80b12bba small compilation fix on 64-bits machines.. 2000-07-26 22:29:22 +00:00
Werner Lemberg a2a75b7846 Use `patsubst' instead of `subst' in cleaning rule to avoid problems with
filenames which contain `lo' in its name (e.g. ahglobal.lo).
2000-07-26 21:47:19 +00:00
Just van Rossum 1fd410bbe1 now that "type1z" is renamed to "type1"; revert to hardcoding "type1".. 2000-07-26 20:31:18 +00:00
872 changed files with 332865 additions and 95579 deletions

16
.clang-format Normal file
View File

@ -0,0 +1,16 @@
BasedOnStyle: Chromium
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: true
AlignConsecutiveDeclarations: true
AlignConsecutiveMacros: true
AlignEscapedNewlines: true
# AlignOperands: Align
AlignTrailingComments: true
AlwaysBreakAfterReturnType: AllDefinitions
BreakBeforeBraces: Allman
ColumnLimit: 80
DerivePointerAlignment: false
IndentCaseLabels: false
PointerAlignment: Left
SpaceBeforeParens: ControlStatements
SpacesInParentheses: true

7
.gitignore vendored Normal file
View File

@ -0,0 +1,7 @@
/build/
/config.mk
include/dlg/
src/dlg/dlg.c
subprojects/*
!subprojects/*.wrap
/tests/data/*

241
.gitlab-ci.yml Normal file
View File

@ -0,0 +1,241 @@
# CI setup for FreeType.
# https://gitlab.freedesktop.org/freedesktop/freedesktop/-/issues/540
workflow:
rules:
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
- if: $CI_PIPELINE_SOURCE == 'push'
stages:
- build
# FIXME: Use --werror once warnings are fixed.
variables:
MESON_ARGS: --fatal-meson-warnings --default-library=both
MESON_ARGS_WINDOWS: ${MESON_ARGS} --force-fallback-for=zlib
.build windows common:
# TODO: should probably get its own image at some point instead of reusing the GStreamer one
# See https://gitlab.freedesktop.org/gstreamer/gstreamer/container_registry/18035 for latest
image: "registry.freedesktop.org/gstreamer/gstreamer/amd64/windows:2022-07-29.3-main"
stage: 'build'
tags:
- 'docker'
- 'windows'
- '2022'
- 'gstreamer-windows'
.build linux common:
# See
# https://gitlab.freedesktop.org/freetype/docker-images/container_registry/20896
image: 'registry.freedesktop.org/freetype/docker-images/debian:latest'
stage: 'build'
.build macos common:
stage: 'build'
tags:
- 'gst-macos-11.1'
.build windows meson:
extends: '.build windows common'
variables:
# Make sure any failure in PowerShell scripts is fatal.
ErrorActionPreference: 'Stop'
WarningPreference: 'Stop'
# Uncomment the following key if you need to pass custom args, as well
# with the `$env:MESON_ARGS` line in the `script:` blocks.
# MESON_ARGS: >-
# -Dfoo=enabled
# -Dbar=disabled
before_script:
# Update RootCAs in order to access to some sites.
- certutil -generateSSTFromWU "C:\roots.sst"
- Import-Certificate -CertStoreLocation "Cert:\LocalMachine\Root" "C:\roots.sst"
# Make sure meson is up to date so we don't need to rebuild the image
# with each release.
- pip3 install -U 'meson==0.59.*'
- pip3 install -U ninja
script:
# For some reason, options are separated by newlines instead of spaces,
# so we have to replace them first.
#
# - $env:MESON_ARGS = $env:MESON_ARGS.replace("`n"," ")
#
# Gitlab executes PowerShell in docker, but `VsDevCmd.bat` is a batch
# script. Environment variables substitutions is done by PowerShell
# before calling `cmd.exe`, that's why we use `$env:FOO` instead of
# `%FOO%`.
- cmd.exe /C "C:\BuildTools\Common7\Tools\VsDevCmd.bat -host_arch=amd64 -arch=$env:ARCH &&
meson setup build $env:MESON_ARGS_WINDOWS &&
meson compile --verbose -C build &&
meson test -C build &&
meson test -C build --benchmark"
.build windows msbuild:
extends: '.build windows common'
variables:
# Make sure any failure in PowerShell scripts is fatal.
ErrorActionPreference: 'Stop'
WarningPreference: 'Stop'
script:
- git submodule update --init --recursive
- cmd.exe /C "C:\BuildTools\Common7\Tools\VsDevCmd.bat -host_arch=amd64 -arch=$env:ARCH &&
MSBuild.exe -clp:ForceConsoleColor -t:Rebuild
-p:Configuration=Debug
-p:Platform=$env:PLATFORM
-p:UserDefines=FT_DEBUG_LOGGING
MSBuild.sln"
# Format of job names:
# <OS> <Build-Tool> <Build-Params> <Architecture>:
# Windows jobs.
windows meson vs2019 amd64:
extends: '.build windows meson'
variables:
ARCH: 'amd64'
windows meson vs2019 x86:
extends: '.build windows meson'
variables:
ARCH: 'x86'
windows msbuild vs2019 amd64:
extends: '.build windows msbuild'
variables:
ARCH: 'amd64'
PLATFORM: 'x64'
# Linux Jobs.
#
# Jobs with "libs" in the name force-enable libraries.
# They are disabled for the remaining jobs.
linux autotools:
extends: '.build linux common'
script: |
./autogen.sh
./configure --with-brotli=no \
--with-bzip2=no \
--with-harfbuzz=no \
--with-png=no \
--with-zlib=no \
CC=gcc
make -j$(nproc) && make install
linux autotools libs:
extends: '.build linux common'
script: |
./autogen.sh
./configure --with-brotli=yes \
--with-bzip2=yes \
--with-harfbuzz=yes \
--with-png=yes \
--with-zlib=yes \
CC=gcc
make -j$(nproc) && make install
linux autotools libs clang:
extends: '.build linux common'
script: |
./autogen.sh
./configure --with-brotli=yes \
--with-bzip2=yes \
--with-harfbuzz=yes \
--with-png=yes \
--with-zlib=yes \
CC=clang
make -j$(nproc) && make install
linux meson:
extends: '.build linux common'
script: |
meson setup build ${MESON_ARGS} \
-Dbrotli=disabled \
-Dbzip2=disabled \
-Dharfbuzz=disabled \
-Dpng=disabled \
-Dzlib=disabled
meson compile --verbose -C build
meson install -C build
linux meson libs:
extends: '.build linux common'
script: |
meson setup build ${MESON_ARGS} \
-Dbrotli=enabled \
-Dbzip2=enabled \
-Dharfbuzz=disabled \
-Dpng=disabled \
-Dzlib=disabled
meson compile --verbose -C build
meson install -C build
linux cmake:
extends: '.build linux common'
script: |
cmake -B build -D FT_DISABLE_BROTLI=TRUE \
-D FT_DISABLE_BZIP2=TRUE \
-D FT_DISABLE_HARFBUZZ=TRUE \
-D FT_DISABLE_PNG=TRUE \
-D FT_DISABLE_ZLIB=TRUE
cmake --build build --target install
linux cmake libs:
extends: '.build linux common'
script: |
cmake -B build -D FT_REQUIRE_BROTLI=TRUE \
-D FT_REQUIRE_BZIP2=TRUE \
-D FT_REQUIRE_HARFBUZZ=TRUE \
-D FT_REQUIRE_PNG=TRUE \
-D FT_REQUIRE_ZLIB=TRUE
cmake --build build --target install
# MacOS jobs.
macos autotools:
extends: '.build macos common'
before_script:
- '/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"'
script:
- brew install autoconf automake libtool
- ./autogen.sh
- ./configure
- 'make -j$(sysctl -n hw.logicalcpu)'
- make install
macos autotools clang:
extends: '.build macos common'
before_script:
- '/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"'
script:
- brew install autoconf automake libtool
- ./autogen.sh
- './configure CC=clang'
- 'make -j$(sysctl -n hw.logicalcpu)'
- make install
macos meson:
extends: '.build macos common'
script:
- pip3 install --upgrade pip
- pip3 install -U meson
- pip3 install --upgrade certifi
- pip3 install -U ninja
- meson setup build ${MESON_ARGS}
- meson compile --verbose -C build
- sudo meson install -C build

3
.gitmodules vendored Normal file
View File

@ -0,0 +1,3 @@
[submodule "dlg"]
path = subprojects/dlg
url = https://github.com/nyorain/dlg.git

25
.mailmap Normal file
View File

@ -0,0 +1,25 @@
Alexander Borsuk <me@alex.bio> <alexander.borsuk@qnective.com>
Behdad Esfahbod (بهداد اسفهبد) <behdad@behdad.org> <behdad.esfahbod@gmail.com>
Behdad Esfahbod (بهداد اسفهبد) <behdad@behdad.org> <behdad@google.com>
Behdad Esfahbod (بهداد اسفهبد) <behdad@behdad.org>
Ewald Hew (Hew Yih Shiuan 丘毅宣) <ewaldhew@gmail.com>
Moazin Khatti (موؤذن کھٹی) <moazinkhatri@gmail.com>
Priyesh Kumar (प्रियेश कुमार) <priyeshkkumar@gmail.com>
Alexei Podtelezhnikov (Алексей Подтележников) <apodtele@gmail.com>
Nikhil Ramakrishnan (निखिल रामकृष्णन) <ramakrishnan.nikhil@gmail.com>
Dominik Röttsches <drott@chromium.org> <drott@google.com>
Kostya Serebryany <kcc@google.com> <konstantin.s.serebryany@gmail.com>
Suzuki, Toshiya (鈴木俊哉) <mpsuzuki@hiroshima-u.ac.jp> <sssa@flavor1.ipc.hiroshima-u.ac.jp>
Suzuki, Toshiya (鈴木俊哉) <mpsuzuki@hiroshima-u.ac.jp> sssa <sssa@IPA2004-mps.local>
Suzuki, Toshiya (鈴木俊哉) <mpsuzuki@hiroshima-u.ac.jp> sssa <sssa@sssas-powerbook-g4-12.local>
Suzuki, Toshiya (鈴木俊哉) <mpsuzuki@hiroshima-u.ac.jp> suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp>
Bram Tassyns <bramt@enfocus.be> bram tassyns <BramT@enfocus.be>
Bram Tassyns <bramt@enfocus.be> <BramT@enfocus.com>
Anurag Thakur (अनुराग ठाकुर) <anuthadev@gmail.com>
David Turner <david@freetype.org> <david.turner.dev@gmail.com>
David Turner <david@freetype.org> <digit@google.com>
Anuj Verma (अनुज वर्मा) <anujv@iitbhilai.ac.in>
Ben Wagner <bungeman@gmail.com>
Ben Wagner <bungeman@gmail.com> <bungeman@google.com>
Ben Wagner <bungeman@gmail.com> <bungeman@chromium.org>
Nikolaus Waxweiler <madigens@gmail.com> <nikolaus.waxweiler@daltonmaag.com>

904
CHANGES
View File

@ -1,904 +0,0 @@
LATEST CHANGES
- deactivated the trueType bytecode interpreter by default
- deactivated the "src/type1" font driver. Now "src/type1z" is
used by default..
- updates to the build system. We now compile the library correctly
under Unix system through "configure" which is automatically called
on the first "make" invocation.
- added the auto-hinting module !!. Fixing some bugs here and there..
- found some bugs in the composite loader (seac) of the Type1-based
font drivers..
- renamed the directory "freetype2/config" to "freetype2/builds" and
updated all relevant files..
- found a memory leak in the "type1" driver
- incorporated Tom's patches to support flex operators correctly
in OpenType/CFF fonts.. Now all I need is to support pure CFF
and CEF fonts to be done with this driver.. :-)
- added the Windows FNT/FON driver in "src/winfonts". For now,
it always "simulates" a Unicode charmap, so it shouldn't be
considered completed right now..
It's there to be more a proof of concept than anything else
anyway. The driver is a single C source file, that compiles
to 3 Kb of code..
I'm still working on the PCF/BDF drivers.. but I'm too lazy
to finish them now..
- CHANGES TO THE HIGH-LEVEL API
o FT_Get_Kerning has a new parameter that allows you to select
the coordinates of the kerning vector ( font units, scaled,
scaled + grid-fitted ).
o the outline functions are now in <freetype/ftoutln.h> and not
part of <freetype/freetype.h> anymore
o <freetype/ftmodule.h> now contains declarations for
FT_New_Library, FT_Done_Library, FT_Add_Default_Modules
o the so-called convenience functions have moved from "ftoutln.c"
to "ftglyph.c", and are thus available with this optional component
of the library. They are declared in <freetype/ftglyph.h> now..
o anti-aliased rendering is now the default for FT_Render_Glyph
(i.e. corresponds to render_mode == 0 == ft_render_mode_normal).
To generate a monochrome bitmap, use ft_render_mode_mono, or the
FT_LOAD_MONOCHROME flag in FT_Load_Glyph/FT_Load_Char.
FT_LOAD_ANTI_ALIAS is still defined, but values to 0.
o <freetype/freetype.h> now include <freetype/config/ftconfig.h>,
solving a few headaches :-)
o the type FT_GlyphSlotRec has now a "library" field.
- CHANGES TO THE "ftglyph.h" API
This API has been severely modified in order to make it simpler,
clearer, and more efficient. It certainly now looks like a real
"glyph factory" object, and allows client applications to manage
(i.e. transform, bbox and render) glyph images without ever knowing
their original format.
- added support for CID-keyed fonts to the CFF driver.
maybe support for pure CFF + CEF fonts should come in ??
- cleaned up source code in order to avoid two functions with the
same name. Also changed the names of the files in "type1z" from
"t1XXXX" to "z1XXXX" in order to avoid any conflicts.
"make multi" now works well :-)
Also removed the use of "cidafm" for now, even if the source files
are still there. This functionality will certainly go into a specific
module..
- ADDED SUPPORT FOR THE AUTO-HINTER
It works :-) I have a demo program which simply is a copy of "ftview"
that does a FT_Add_Module( library, &autohinter_module_class ) after
library initialisation, and Type 1 & OpenType/CFF fonts are now hinted.
CID fonts are not hinted, as they include no charmap and the auto-hinter
doesn't include "generic" global metrics computations yet..
Now, I need to release this thing to the FreeType 2 source..
- CHANGES TO THE RENDERER MODULES
the monochrome and smooth renderers are now in two distinct directories,
namely "src/raster1" and "src/smooth". Note that the old "src/renderer"
is now gone..
I ditched the 5-gray-levels renderers. Basically, it involved a simple
#define toggle in 'src/raster1/ftraster.c'
FT_Render_Glyph, FT_Outline_Render & FT_Outline_Get_Bitmap now select
the best renderer available, depending on render mode. If the current
renderer for a given glyph image format isn't capable of supporting
the render mode, another one will be found in the library's list.
This means that client applications do not need to switch or set the
renderers themselves (as in the latest change), they'll get what they
want automatically... At last..
Changed the demo programs accordingly..
- 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.
- reformated all modules source code in order to get rid of the basic
data types redifinitions (i.e. "TT_Int" instead of "FT_Int", "T1_Fixed"
instead of "FT_Fixed"). Hence the format-specific prefixes like "TT_",
"T1_", "T2_" and "CID_" are only used for relevant structures..
============================================================================
OLD CHANGES FOR BETA 7
- bug-fixed the OpenType/CFF parser. It now loads and displays my two
fonts nicely, but I'm pretty certain that more testing is needed :-)
- fixed the crummy Type 1 hinter, it now handles accented characters
correctly (well, the accent is not always well placed, but that's
another problem..)
- added the CID-keyed Type 1 driver in "src/cid". Works pretty well for
only 13 Kb of code ;-) Doesn't read AFM files though, nor the really
useful CMAP files..
- fixed two bugs in the smooth renderer (src/base/ftgrays.c). Thanks to
Boris Letocha for spotting them and providing a fix..
- fixed potential "divide by zero" bugs in ftcalc.c.. my god..
- added source code for the OpenType/CFF driver (still incomplete though..)
- modified the SFNT driver slightly to perform more robust header
checks in TT_Load_SFNT_Header. This prevents certain font files
(e.g. some Type 1 Multiple Masters) from being incorrectly "recognized"
as TrueType font files..
- moved a lot of stuff from the TrueType driver to the SFNT module,
this allows greater code re-use between font drivers (e.g. TrueType,
OpenType, Compact-TrueType, etc..)
- added a tiny segment cache to the SFNT Charmap 4 decoder, in order
to minimally speed it up..
- added support for Multiple Master fonts in "type1z". There is also
a new file named <freetype/ftmm.h> which defines functions to
manage them from client applications.
The new file "src/base/ftmm.c" is also optional to the engine..
- various formatting changes (e.g. EXPORT_DEF -> FT_EXPORT_DEF) +
small bug fixes in FT_Load_Glyph, the "type1" driver, etc..
- a minor fix to the Type 1 driver to let them apply the font matrix
correctly (used for many oblique fonts..)
- some fixes for 64-bit systems (mainly changing some FT_TRACE calls
to use %p instead of %lx).. Thanks to Karl Robillard
- fixed some bugs in the sbit loader (src/base/sfnt/ttsbit.c) + added
a new flag, FT_LOAD_CROP_BITMAP to query that bitmaps be cropped when
loaded from a file (maybe I should move the bitmap cropper to the
base layer ??).
- changed the default number of gray levels of the smooth renderer to
256 (instead of the previous 128). Of course, the human eye can't
see any difference ;-)
- removed TT_MAX_SUBGLYPHS, there is no static limit on the number of
subglyphs in a TrueType font now..
=============================================================================
OLD CHANGES 16 May 2000
- tagged "BETA-6" in the CVS tree. This one is a serious release candidate
even though it doesn't incorporate the auto-hinter yet..
- various obsolete files were removed, and copyright header updated
- finally updated the standard raster to fix the monochrome rendering bug
+ re-enable support for 5-gray levels anti-aliasing (suck, suck..)
- created new header files, and modified sources accordingly:
<freetype/fttypes.h> - simple FreeType types, without the API
<freetype/internal/ftmemory.h> - definition of memory-management macros
- added the "DSIG" (OpenType Digital Signature) tag to <freetype/tttags.h>
- light update/cleaning of the build system + changes to the sources in
order to get rid of _all_ compiler warnings with three compilers, i.e:
gcc with "-ansi -pedantic -Wall -W", Visual C++ with "/W3 /WX"
and LCC
IMPORTANT NOTE FOR WIN32-LCC USERS:
|
| It seems the C pre-processor that comes with LCC is broken, it
| doesn't recognize the ANSI standard directives # and ## correctly
| when one of the argument is a macro. Also, something like:
|
| #define F(x) print##x
|
| F(("hello"))
|
| will get incorrectly translated to:
|
| print "hello")
|
| by its pre-processor. For this reason, you simply cannot build
| FreeType 2 in debug mode with this compiler..
- yet another massive grunt work. I've changed the definition of the
EXPORT_DEF, EXPORT_FUNC, BASE_DEF & BASE_FUNC macros. These now take
an argument, which is the function's return value type.
This is necessary to compile FreeType as a DLL on Windows and OS/2.
Depending on the compiler used, a compiler-specific keyword like __export
or __system must be placed before (VisualC++) or after (BorlandC++)
the type..
Of course, this needed a lot of changes throughout the source code
to make it compile again... All cleaned up now, apparently..
Note also that there is a new EXPORT_VAR macro defined to allow the
_declaration_ of an exportable public (constant) variable. This is the
case of the raster interfaces (see ftraster.h and ftgrays.h), as well
as each module's interface (see sfdriver.h, psdriver.h, etc..)
- new feature: it is now possible to pass extra parameters to font
drivers when creating a new face object. For now, this
capability is unused. It could however prove to be useful
in a near future..
the FT_Open_Args structure was changes, as well as the internal
driver interface (the specific "init_face" module function has now
a different signature).
- updated the tutorial (not finished though).
- updated the top-level BUILD document
- fixed a potential memory leak that could occur when loading embedded
bitmaps.
- added the declaration of FT_New_Memory_Face in <freetype/freetype.h>, as
it was missing from the public header (the implementation was already
in "ftobjs.c").
- the file <freetype/fterrors.h> has been seriously updated in order to
allow the automatic generation of error message tables. See the comments
within it for more information.
- major directory hierarchy re-organisation. This was done for two things:
* first, to ease the "manual" compilation of the library by requiring
at lot less include paths :-)
* second, to allow external programs to effectively access internal
data fields. For example, this can be extremely useful if someone
wants to write a font producer or a font manager on top of FreeType.
Basically, you should now use the 'freetype/' prefix for header inclusion,
as in:
#include <freetype/freetype.h>
#include <freetype/ftglyph.h>
Some new include sub-directories are available:
a. the "freetype/config" directory, contains two files used to
configure the build of the library. Client applications should
not need to look at these normally, but they can if they want.
#include <freetype/config/ftoption.h>
#include <freetype/config/ftconfig.h>
b. the "freetype/internal" directory, contains header files that
describes library internals. These are the header files that were
previously found in the "src/base" and "src/shared" directories.
As usual, the build system and the demos have been updated to reflect
the change..
Here's a layout of the new directory hierarchy:
TOP
include/
freetype/
freetype.h
...
config/
ftoption.h
ftconfig.h
ftmodule.h
internal/
ftobjs.h
ftstream.h
ftcalc.h
...
src/
base/
...
sfnt/
psnames/
truetype/
type1/
type1z/
Compiling a module is now much easier, for example, the following should
work when in the TOP directory on an ANSI build:
gcc -c -I./include -I./src/base src/base/ftbase.c
gcc -c -I./include -I./src/sfnt src/sfnt/sfnt.c
etc..
(of course, using -Iconfig/<system> if you provide system-specific
configuration files).
- updated the structure of FT_Outline_Funcs in order to allow
direct coordinate scaling within the outline decomposition routine
(this is important for virtual "on" points with TrueType outlines)
+ updates to the rasters to support this..
- updated the OS/2 table loading code in "src/sfnt/ttload.c" in order
to support version 2 of the table (see OpenType 1.2 spec)
- created "include/tttables.h" and "include/t1tables.h" to allow
client applications to access some of the SFNT and T1 tables of a
face with a procedural interface (see FT_Get_Sfnt_Table())
+ updates to internal source files to reflect the change..
- some cleanups in the source code to get rid of warnings when compiling
with the "-Wall -W -ansi -pedantic" options in gcc.
- debugged and moved the smooth renderer to "src/base/ftgrays.c" and
its header to "include/ftgrays.h"
- updated TT_MAX_SUBGLYPHS to 96 as some CJK fonts have composites with
up to 80 sub-glyphs !! Thanks to Werner
================================================================================
OLD CHANGES - 14-apr-2000
- fixed a bug in the TrueType glyph loader that prevented the correct
loading of some CJK glyphs in mingli.ttf
- improved the standard Type 1 hinter in "src/type1"
- fixed two bugs in the experimental Type 1 driver in "src/type1z"
to handle the new XFree86 4.0 fonts (and a few other ones..)
- the smooth renderer is now complete and supports sub-banding
to render large glyphs at high speed. However, it is still located
in "demos/src/ftgrays.c" and should move to the library itself
in the next beta.. NOTE: The smooth renderer doesn't compile in
stand-alone mode anymore, but this should be fixed RSN..
- introduced convenience functions to more easily deal with glyph
images, see "include/ftglyph.h" for more details, as well as the
new demo program named "demos/src/ftstring.c" that demonstrates
its use
- implemented FT_LOAD_NO_RECURSE in both the TrueType and Type 1
drivers (this is required by the auto-hinter to improve its results).
- changed the raster interface, in order to allow client applications
to provide their own span-drawing callbacks. However, only the
smooth renderer supports this. See "FT_Raster_Params" in the
file "include/ftimage.h"
- fixed a small bug in FT_MulFix that caused incorrect transform
computation !!
- Note: The tutorial is out-of-date, grumpf.. :-(
================================================================================
OLD CHANGES - 12-mar-2000
- changed the layout of configuration files : now, all ANSI configuration
files are located in "freetype2/config". System-specific over-rides
can be placed in "freetype2/config/<system>".
- moved all configuration macros to "config/ftoption.h"
- improvements in the Type 1 driver with AFM support
- changed the fields in the FT_Outline structure : the old "flags"
array is re-named "tags", while all ancient flags are encoded into
a single unsigned int named "flags".
- introduced new flags in FT_Outline.flags (see ft_outline_.... enums in
"ftimage.h").
- changed outline functions to "FT_Outline_<action>" syntax
- added a smooth anti-alias renderer to the demonstration programs
- added Mac graphics driver (thanks Just)
- FT_Open_Face changed in order to received a pointer to a FT_Open_Args
descriptor..
- various cleanups, a few more API functions implemented (see FT_Attach_File)
- updated some docs
================================================================================
OLD CHANGES - 22-feb-2000
- introduced the "psnames" module. It is used to:
o convert a Postscript glyph name into the equivalent Unicode
character code (used by the Type 1 driver(s) to synthetize
on the fly a Unicode charmap).
o provide an interface to retrieve the Postscript names of
the Macintosh, Adobe Standard & Adobe Expert character codes.
(the Macintosh names are used by the SFNT-module postscript
names support routines, while the other two tables are used
by the Type 1 driver(s)).
- introduced the "type1z" alternate Type 1 driver. This is a (still
experimental) driver for the Type 1 format that will ultimately
replace the one in "src/type1". It uses pattern matching to load
data from the font, instead of a finite state analyzer. It works
much better than the "old" driver with "broken" fonts. It is also
much smaller (under 15 Kb).
- the Type 1 drivers (both in "src/type1" and "src/type1z") are
nearly complete. They both provide automatic Unicode charmap
synthesis through the "psnames" module. No re-encoding vector
is needed. (note that they still leak memory due to some code
missing, and I'm getting lazy).
Trivial AFM support has been added to read kerning information
but wasn't exactly tested as it should ;-)
- The TrueType glyph loader has been seriously rewritten (see the
file "src/truetype/ttgload.c". It is now much, much simpler as
well as easier to read, maintain and understand :-) Preliminary
versions introduced a memory leak that has been reported by Jack
Davis, and is now fixed..
- introduced the new "ft_glyph_format_plotter", used to represent
stroked outlines like Windows "Vector" fonts, and certain Type 1
fonts like "Hershey". The corresponding raster will be written
soon.
- FT_New_Memory_Face is gone. Likewise, FT_Open_Face has a new
interface that uses a structure to describe the input stream,
the driver (if required), etc..
TODO
- Write FT_Get_Glyph_Bitmap and FT_Load_Glyph_Bitmap
- Add a function like FT_Load_Character( face, char_code, load_flags )
that would really embbed a call to FT_Get_Char_Index then FT_Load_Glyph
to ease developer's work.
- Update the tutorial !!
- consider adding support for Multiple Master fonts in the Type 1
drivers.
- Test the AFM routines of the Type 1 drivers to check that kerning
information is returned correctly.
- write a decent auto-gridding component !! We need this to release
FreeType 2.0 gold !
----- less urgent needs : ----------
- add a CFF/Type2 driver
- add a BDF driver
- add a FNT/PCF/HBF driver
- add a Speedo driver from the X11 sources
==============================================================================
OLDER CHANGES - 27-jan-2000
- updated the "sfnt" module interface to allow several SFNT-based
drivers to co-exist peacefully
- updated the "T1_Face" type to better separate Postscript font content
from the rest of the FT_Face structure. Might be used later by the
CFF/Type2 driver..
- added an experimental replacement Type 1 driver featuring advanced
(and speedy) pattern matching to retrieve the data from postscript
fonts.
- very minor changes in the implementation of FT_Set_Char_Size and
FT_Set_Pixel_Sizes (they now implement default to ligthen the
font driver's code).
=============================================================================
OLD MESSAGE
This file summarizes the changes that occured since the last "beta" of FreeType 2.
Because the list is important, it has been divided into separate sections:
Table Of Contents:
I High-Level Interface (easier !)
II Directory Structure
III Glyph Image Formats
IV Build System
V Portability
VI Font Drivers
-----------------------------------------------------------------------------------------
High-Level Interface :
The high-level API has been considerably simplified. Here is how :
- resource objects have disappeared. this means that face objects can
now be created with a single function call (see FT_New_Face and
FT_Open_Face)
- when calling either FT_New_Face & FT_Open_Face, a size object and a
glyph slot object are automatically created for the face, and can be
accessed through "face->glyph" and "face->size" if one really needs to.
In most cases, there's no need to call FT_New_Size or FT_New_Glyph.
- similarly, FT_Load_Glyph now only takes a "face" argument (instead of
a glyph slot and a size). Also, it's "result" parameter is gone, as
the glyph image type is returned in the field "face->glyph.format"
- the list of available charmaps is directly accessible through
"face->charmaps", counting "face->num_charmaps" elements. Each
charmap has an 'encoding' field which specifies which known encoding
it deals with. Valid values are, for example :
ft_encoding_unicode (for ASCII, Latin-1 and Unicode)
ft_encoding_apple_roman
ft_encoding_sjis
ft_encoding_adobe_standard
ft_encoding_adobe_expert
other values may be added in the future. Each charmap still holds its
"platform_id" and "encoding_id" values in case the encoding is too
exotic for the current library
-----------------------------------------------------------------------------------------
Directory Structure:
Should seem obvious to most of you:
freetype/
config/ -- configuration sub-makefiles
ansi/
unix/ -- platform-specific configuration files
win32/
os2/
msdos/
include/ -- public header files, those to be included directly
by client apps
src/ -- sources of the library
base/ -- the base layer
sfnt/ -- the sfnt "driver" (see the drivers section below)
truetype/ -- the truetype driver
type1/ -- the type1 driver
shared/ -- some header files shared between drivers
demos/ -- demos/tools
docs/ -- documentation (a bit empty for now)
-----------------------------------------------------------------------------------------
Glyph Image Formats :
Drivers are now able to register new glyph image formats within the library.
For now, the base layer supports of course bitmaps and vector outlines, but
one could imagine something different like colored bitmaps, bi-color
vectors or wathever else (Metafonts anyone ??).
See the file `include/ftimage.h'. Note also that the type FT_Raster_Map is
gone, and is now replaced by FT_Bitmap, which should encompass all known
bitmap types.
Each new image format must provide at least one "raster", i.e. a module
capable of transforming the glyph image into a bitmap. It's also possible
to change the default raster used for a given glyph image format.
The default outline scan-converter now uses 128 levels of grays by default,
which tends to smooth many things. Note that the demo programs have been
updated significantly in order to display these..
-----------------------------------------------------------------------------------------
Build system :
You still need GNU Make to build the library. The build system has been
very seriously re-vamped in order to provide things like :
- automatic host platform detection (reverting to 'config/ansi'
if it is not detected, with pseudo-standard compilation flags)
- the ability to compile from the Makefiles with very different and
exotic compilers. Note that linking the library can be difficult for
some platforms.
For example, the file `config/win32/lcclib.bat' is invoked by the
build system to create the ".lib" file with LCC-Win32 because its
librarian has too many flaws to be invoked directly from the Makefile.
Here's how it works :
- the first time you type `make', the build system runs a series of
sub-makefiles in order to detect your host platform. It then dumps
what it found, and creates a file called `config.mk' in the current
directory. This is a sub-Makefile used to define many important Make
variables used to build the library.
- the second time, the build system detects the `config.mk' then use it
to build the library. All object files go into 'obj' by default, as
well as the library file, but this can easily be changed.
Note that you can run "make setup" to force another host platform detection
even if a `config.mk' is present in the current directory. Another solution
is simply to delete the file, then re-run make.
Finally, the default compiler for all platforms is gcc (for now, this will
hopefully changed in the future). You can however specify a different
compiler by specifying it after the 'setup' target as in :
gnumake setup lcc on Win32 to use the LCC compiler
gnumake setup visualc on Win32 to use Visual C++
See the file `config/<system>/detect.mk' for a list of supported compilers
for your platforms.
It should be relatively easy to write new detection rules files and
config.mk..
Finally, to build the demo programs, go to `demos' and launch GNU Make,
it will use the `config.mk' in the top directory to build the test
programs..
-----------------------------------------------------------------------------------------
Portability :
In the previous beta, a single FT_System object was used to encompass
all low-level operations like thread synchronisation, memory management
and i/o access. This has been greatly simplified :
- thread synchronisation has been dropped, for the simple reason that
the library is already re-entrant, and that if you really need two
threads accessing the same FT_Library, you should really synchronize
access to it yourself with a simple mutex.
- memory management is performed through a very simple object called
"FT_Memory", which really is a table containing a table of pointers
to functions like malloc, realloc and free as well as some user data
(closure).
- resources have disappeared (they created more problems than they
solved), and i/o management have been simplified greatly as a
result. Streams are defined through FT_Stream objects, which can
be either memory-based or disk-based.
Note that each face has its own stream, which is closed only when
the face object is destroyed. Hence, a function like TT_Flush_Face
in 1.x cannot be directly supported. However, if you really need
something like this, you can easily tailor your own streams to achieve
the same feature at a lower level (and use FT_Open_Face instead of
FT_New_Face to create the face).
See the file "include/ftsystem.h" for more details, as well as the
implementations found in "config/unix" and "config/ansi".
-----------------------------------------------------------------------------------------
Font Drivers :
The Font Driver interface has been modified in order to support
extensions & versioning.
The list of the font drivers that are statically linked to the
library at compile time is managed through a new configuration file
called `config/<platform>/ftmodule.h'.
This file is autogenerated when invoking `make modules'. This target
will parse all sub-directories of 'src', looking for a "module.mk"
rules file, used to describe the driver to the build system.
Hence, one should call `make modules' each time a font driver is added
or removed from the `src' directory.
Finally, this version provides a "pseudo-driver" in `src/sfnt'. This
driver doesn't support font files directly, but provides services used
by all TrueType-like font drivers. Hence, its code is shared between
the TrueType & OpenType font formats, and possibly more formats to
come if we're lucky..
-----------------------------------------------------------------------------------------
Extensions support :
The extensions support is inspired by the one found in 1.x.
Now, each font driver has its own "extension registry", which lists
which extensions are available for the font faces managed by the driver.
Extension ids are now strings, rather than 4-byte tags, as this is
usually more readable..
Each extension has:
- some data, associated to each face object
- an interface (table of function pointers)
An extension that is format-specific should simply register itself
to the correct font driver. Here is some example code:
// Registering an extensions
//
FT_Error FT_Init_XXXX_Extension( FT_Library library )
{
FT_DriverInterface* tt_driver;
driver = FT_Get_Driver( library, "truetype" );
if (!driver) return FT_Err_Unimplemented_Feature;
return FT_Register_Extension( driver, &extension_class );
}
// Implementing the extensions
//
FT_Error FT_Proceed_Extension_XXX( FT_Face face )
{
FT_XXX_Extension ext;
FT_XXX_Extension_Interface ext_interface;
ext = FT_Get_Extension( face, "extensionid", &ext_interface );
if (!ext) return error;
return ext_interface->do_it(ext);
}

681
CMakeLists.txt Normal file
View File

@ -0,0 +1,681 @@
# CMakeLists.txt
#
# Copyright (C) 2013-2024 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# Written originally by John Cary <cary@txcorp.com>
#
# This file is part of the FreeType project, and may only be used, modified,
# and distributed under the terms of the FreeType project license,
# LICENSE.TXT. By continuing to use, modify, or distribute this file you
# indicate that you have read the license and understand and accept it
# fully.
#
#
# The following will (1) create a build directory, and (2) change into it and
# call cmake to configure the build with default parameters as a static
# library. See
#
# https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html
#
# for information about debug or release builds, for example
#
# cmake -B build -D CMAKE_BUILD_TYPE=Release
#
#
# For a dynamic library, use
#
# cmake -B build -D BUILD_SHARED_LIBS=true -D CMAKE_BUILD_TYPE=Release
#
# For a framework on OS X, use
#
# cmake -E chdir build cmake -G Xcode -D BUILD_FRAMEWORK:BOOL=true ..
#
# For an iOS static library, use
#
# cmake -E chdir build cmake -G Xcode -D IOS_PLATFORM=OS ..
#
# or
#
# cmake -E chdir build cmake -G Xcode -D IOS_PLATFORM=SIMULATOR ..
#
# or
#
# cmake -E chdir build cmake -G Xcode -D IOS_PLATFORM=SIMULATOR64 ..
#
#
# Finally, build the project with
#
# cmake --build build
#
# Install it with
#
# (sudo) cmake --build build --target install
#
# A binary distribution can be made with
#
# cmake --build build --config Release --target package
#
# Please refer to the cmake manual for further options, in particular, how
# to modify compilation and linking parameters.
#
# Some notes.
#
# - Say `cmake -LAH` to see all configuration options.
#
# - `cmake' creates configuration files in
#
# <build-directory>/include/freetype/config
#
# which should be further modified if necessary.
#
# - You can use `cmake' directly on a freshly cloned FreeType git
# repository.
#
# - `CMakeLists.txt' is provided as-is since it is normally not used by the
# developer team.
#
# - Set the `FT_REQUIRE_ZLIB', `FT_REQUIRE_BZIP2', `FT_REQUIRE_PNG',
# `FT_REQUIRE_HARFBUZZ', and `FT_REQUIRE_BROTLI' CMake variables to `ON'
# or `TRUE' to force using a dependency. Leave a variable undefined
# (which is the default) to use the dependency only if it is available.
# Example:
#
# cmake -B build -D FT_REQUIRE_ZLIB=TRUE \
# -D FT_REQUIRE_BZIP2=TRUE \
# -D FT_REQUIRE_PNG=TRUE \
# -D FT_REQUIRE_HARFBUZZ=TRUE \
# -D FT_REQUIRE_BROTLI=TRUE [...]
#
# - Set `FT_DISABLE_XXX=TRUE' to disable a dependency completely (where
# `XXX' is a CMake package name like `BZip2'). Example for disabling all
# dependencies:
#
# cmake -B build -D FT_DISABLE_ZLIB=TRUE \
# -D FT_DISABLE_BZIP2=TRUE \
# -D FT_DISABLE_PNG=TRUE \
# -D FT_DISABLE_HARFBUZZ=TRUE \
# -D FT_DISABLE_BROTLI=TRUE [...]
#
# - NOTE: If a package is set as DISABLED, it cannot be set as REQUIRED
# without unsetting the DISABLED value first. For example, if
# `FT_DISABLE_HARFBUZZ=TRUE' has been set (Cache is present), you need to
# call `FT_DISABLE_HARFBUZZ=FALSE' before calling
# `FT_REQUIRE_HARFBUZZ=TRUE'.
#
# - Installation of FreeType can be controlled with the CMake variables
# `SKIP_INSTALL_HEADERS', `SKIP_INSTALL_LIBRARIES', and `SKIP_INSTALL_ALL'
# (this is compatible with the same CMake variables in zlib's CMake
# support).
# To minimize the number of cmake_policy() workarounds,
# CMake >= 3 is requested.
cmake_minimum_required(VERSION 3.0...3.5)
if (NOT CMAKE_VERSION VERSION_LESS 3.3)
# Allow symbol visibility settings also on static libraries. CMake < 3.3
# only sets the property on a shared library build.
cmake_policy(SET CMP0063 NEW)
# Support new IN_LIST if() operator.
cmake_policy(SET CMP0057 NEW)
endif ()
include(CheckIncludeFile)
include(CMakeDependentOption)
# CMAKE_TOOLCHAIN_FILE must be set before `project' is called, which
# configures the base build environment and references the toolchain file
if (APPLE)
if (DEFINED IOS_PLATFORM)
if (NOT "${IOS_PLATFORM}" STREQUAL "OS"
AND NOT "${IOS_PLATFORM}" STREQUAL "SIMULATOR"
AND NOT "${IOS_PLATFORM}" STREQUAL "SIMULATOR64")
message(FATAL_ERROR
"IOS_PLATFORM must be set to either OS, SIMULATOR, or SIMULATOR64")
endif ()
if (NOT "${CMAKE_GENERATOR}" STREQUAL "Xcode")
message(AUTHOR_WARNING
"You should use Xcode generator with IOS_PLATFORM enabled to get Universal builds.")
endif ()
if (BUILD_SHARED_LIBS)
message(FATAL_ERROR
"BUILD_SHARED_LIBS can not be on with IOS_PLATFORM enabled")
endif ()
if (BUILD_FRAMEWORK)
message(FATAL_ERROR
"BUILD_FRAMEWORK can not be on with IOS_PLATFORM enabled")
endif ()
# iOS only uses static libraries
set(BUILD_SHARED_LIBS OFF)
set(CMAKE_TOOLCHAIN_FILE
${CMAKE_SOURCE_DIR}/builds/cmake/iOS.cmake)
endif ()
else ()
if (DEFINED IOS_PLATFORM)
message(FATAL_ERROR "IOS_PLATFORM is not supported on this platform")
endif ()
endif ()
project(freetype C)
set(VERSION_MAJOR "2")
set(VERSION_MINOR "13")
set(VERSION_PATCH "2")
# Generate LIBRARY_VERSION and LIBRARY_SOVERSION.
set(LIBTOOL_REGEX "version_info='([0-9]+):([0-9]+):([0-9]+)'")
file(STRINGS "${PROJECT_SOURCE_DIR}/builds/unix/configure.raw"
VERSION_INFO
REGEX ${LIBTOOL_REGEX})
string(REGEX REPLACE
${LIBTOOL_REGEX} "\\1"
LIBTOOL_CURRENT "${VERSION_INFO}")
string(REGEX REPLACE
${LIBTOOL_REGEX} "\\2"
LIBTOOL_REVISION "${VERSION_INFO}")
string(REGEX REPLACE
${LIBTOOL_REGEX} "\\3"
LIBTOOL_AGE "${VERSION_INFO}")
# This is what libtool does internally on Unix platforms.
math(EXPR LIBRARY_SOVERSION "${LIBTOOL_CURRENT} - ${LIBTOOL_AGE}")
set(LIBRARY_VERSION "${LIBRARY_SOVERSION}.${LIBTOOL_AGE}.${LIBTOOL_REVISION}")
# External dependency library detection is automatic. See the notes at the
# top of this file, for how to force or disable dependencies completely.
option(FT_DISABLE_ZLIB
"Disable use of system zlib and use internal zlib library instead." OFF)
cmake_dependent_option(FT_REQUIRE_ZLIB
"Require system zlib instead of internal zlib library." OFF
"NOT FT_DISABLE_ZLIB" OFF)
option(FT_DISABLE_BZIP2
"Disable support of bzip2 compressed fonts." OFF)
cmake_dependent_option(FT_REQUIRE_BZIP2
"Require support of bzip2 compressed fonts." OFF
"NOT FT_DISABLE_BZIP2" OFF)
option(FT_DISABLE_PNG
"Disable support of PNG compressed OpenType embedded bitmaps." OFF)
cmake_dependent_option(FT_REQUIRE_PNG
"Require support of PNG compressed OpenType embedded bitmaps." OFF
"NOT FT_DISABLE_PNG" OFF)
option(FT_DISABLE_HARFBUZZ
"Disable HarfBuzz (used for improving auto-hinting of OpenType fonts)." OFF)
cmake_dependent_option(FT_REQUIRE_HARFBUZZ
"Require HarfBuzz for improving auto-hinting of OpenType fonts." OFF
"NOT FT_DISABLE_HARFBUZZ" OFF)
option(FT_DISABLE_BROTLI
"Disable support of compressed WOFF2 fonts." OFF)
cmake_dependent_option(FT_REQUIRE_BROTLI
"Require support of compressed WOFF2 fonts." OFF
"NOT FT_DISABLE_BROTLI" OFF)
option(FT_ENABLE_ERROR_STRINGS
"Enable support for meaningful error descriptions." OFF)
# Disallow in-source builds
if ("${CMAKE_BINARY_DIR}" STREQUAL "${CMAKE_SOURCE_DIR}")
message(FATAL_ERROR
"In-source builds are not permitted! Make a separate folder for"
" building, e.g.,\n"
" cmake -E make_directory build\n"
" cmake -E chdir build cmake ..\n"
"Before that, remove the files created by this failed run with\n"
" cmake -E remove CMakeCache.txt\n"
" cmake -E remove_directory CMakeFiles")
endif ()
# Add local cmake modules
list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/builds/cmake)
if (BUILD_FRAMEWORK)
if (NOT "${CMAKE_GENERATOR}" STREQUAL "Xcode")
message(FATAL_ERROR
"You should use Xcode generator with BUILD_FRAMEWORK enabled")
endif ()
set(CMAKE_OSX_ARCHITECTURES "$(ARCHS_STANDARD)")
set(BUILD_SHARED_LIBS ON)
endif ()
# Find dependencies
include(FindPkgConfig)
if (NOT FT_DISABLE_HARFBUZZ)
set(HARFBUZZ_MIN_VERSION "2.0.0")
if (FT_REQUIRE_HARFBUZZ)
find_package(HarfBuzz ${HARFBUZZ_MIN_VERSION} REQUIRED)
else ()
find_package(HarfBuzz ${HARFBUZZ_MIN_VERSION})
endif ()
endif ()
if (NOT FT_DISABLE_PNG)
if (FT_REQUIRE_PNG)
find_package(PNG REQUIRED)
else ()
find_package(PNG)
endif ()
endif ()
if (NOT FT_DISABLE_ZLIB)
if (FT_REQUIRE_ZLIB)
find_package(ZLIB REQUIRED)
else ()
find_package(ZLIB)
endif ()
endif ()
if (NOT FT_DISABLE_BZIP2)
# Genuine BZip2 does not provide bzip2.pc, but some platforms have it.
# For better dependency in freetype2.pc, bzip2.pc is searched
# regardless of the availability of libbz2. If bzip2.pc is found,
# Requires.private is used instead of Libs.private.
if (FT_REQUIRE_BZIP2)
find_package(BZip2 REQUIRED)
else ()
find_package(BZip2)
endif ()
pkg_check_modules(PC_BZIP2 bzip2)
endif ()
if (NOT FT_DISABLE_BROTLI)
if (FT_REQUIRE_BROTLI)
find_package(BrotliDec REQUIRED)
else ()
find_package(BrotliDec)
endif ()
endif ()
# Create the configuration file
if (UNIX AND NOT WIN32)
check_include_file("unistd.h" HAVE_UNISTD_H)
check_include_file("fcntl.h" HAVE_FCNTL_H)
file(READ "${PROJECT_SOURCE_DIR}/builds/unix/ftconfig.h.in"
FTCONFIG_H)
if (HAVE_UNISTD_H)
string(REGEX REPLACE
"#undef +(HAVE_UNISTD_H)" "#define \\1 1"
FTCONFIG_H "${FTCONFIG_H}")
endif ()
if (HAVE_FCNTL_H)
string(REGEX REPLACE
"#undef +(HAVE_FCNTL_H)" "#define \\1 1"
FTCONFIG_H "${FTCONFIG_H}")
endif ()
else ()
file(READ "${PROJECT_SOURCE_DIR}/include/freetype/config/ftconfig.h"
FTCONFIG_H)
endif ()
set(FTCONFIG_H_NAME "${PROJECT_BINARY_DIR}/include/freetype/config/ftconfig.h")
if (EXISTS "${FTCONFIG_H_NAME}")
file(READ "${FTCONFIG_H_NAME}" ORIGINAL_FTCONFIG_H)
else ()
set(ORIGINAL_FTCONFIG_H "")
endif ()
if (NOT (ORIGINAL_FTCONFIG_H STREQUAL FTCONFIG_H))
file(WRITE "${FTCONFIG_H_NAME}" "${FTCONFIG_H}")
endif ()
# Create the options file
file(READ "${PROJECT_SOURCE_DIR}/include/freetype/config/ftoption.h"
FTOPTION_H)
if (ZLIB_FOUND)
string(REGEX REPLACE
"/\\* +(#define +FT_CONFIG_OPTION_SYSTEM_ZLIB) +\\*/" "\\1"
FTOPTION_H "${FTOPTION_H}")
endif ()
if (BZIP2_FOUND)
string(REGEX REPLACE
"/\\* +(#define +FT_CONFIG_OPTION_USE_BZIP2) +\\*/" "\\1"
FTOPTION_H "${FTOPTION_H}")
endif ()
if (PNG_FOUND)
string(REGEX REPLACE
"/\\* +(#define +FT_CONFIG_OPTION_USE_PNG) +\\*/" "\\1"
FTOPTION_H "${FTOPTION_H}")
endif ()
if (HARFBUZZ_FOUND)
string(REGEX REPLACE
"/\\* +(#define +FT_CONFIG_OPTION_USE_HARFBUZZ) +\\*/" "\\1"
FTOPTION_H "${FTOPTION_H}")
endif ()
if (BROTLIDEC_FOUND)
string(REGEX REPLACE
"/\\* +(#define +FT_CONFIG_OPTION_USE_BROTLI) +\\*/" "\\1"
FTOPTION_H "${FTOPTION_H}")
endif ()
if (FT_ENABLE_ERROR_STRINGS)
string(REGEX REPLACE
"/\\* +(#define +FT_CONFIG_OPTION_ERROR_STRINGS) +\\*/" "\\1"
FTOPTION_H "${FTOPTION_H}")
endif ()
set(FTOPTION_H_NAME "${PROJECT_BINARY_DIR}/include/freetype/config/ftoption.h")
if (EXISTS "${FTOPTION_H_NAME}")
file(READ "${FTOPTION_H_NAME}" ORIGINAL_FTOPTION_H)
else ()
set(ORIGINAL_FTOPTION_H "")
endif ()
if (NOT (ORIGINAL_FTOPTION_H STREQUAL FTOPTION_H))
file(WRITE "${FTOPTION_H_NAME}" "${FTOPTION_H}")
endif ()
file(GLOB PUBLIC_HEADERS "include/ft2build.h" "include/freetype/*.h")
file(GLOB PUBLIC_CONFIG_HEADERS "include/freetype/config/*.h")
file(GLOB PRIVATE_HEADERS "include/freetype/internal/*.h")
set(BASE_SRCS
src/autofit/autofit.c
src/base/ftbase.c
src/base/ftbbox.c
src/base/ftbdf.c
src/base/ftbitmap.c
src/base/ftcid.c
src/base/ftfstype.c
src/base/ftgasp.c
src/base/ftglyph.c
src/base/ftgxval.c
src/base/ftinit.c
src/base/ftmm.c
src/base/ftotval.c
src/base/ftpatent.c
src/base/ftpfr.c
src/base/ftstroke.c
src/base/ftsynth.c
src/base/fttype1.c
src/base/ftwinfnt.c
src/bdf/bdf.c
src/bzip2/ftbzip2.c
src/cache/ftcache.c
src/cff/cff.c
src/cid/type1cid.c
src/gzip/ftgzip.c
src/lzw/ftlzw.c
src/pcf/pcf.c
src/pfr/pfr.c
src/psaux/psaux.c
src/pshinter/pshinter.c
src/psnames/psnames.c
src/raster/raster.c
src/sdf/sdf.c
src/sfnt/sfnt.c
src/smooth/smooth.c
src/svg/svg.c
src/truetype/truetype.c
src/type1/type1.c
src/type42/type42.c
src/winfonts/winfnt.c
)
if (WIN32)
list(APPEND BASE_SRCS "builds/windows/ftsystem.c")
elseif (UNIX)
list(APPEND BASE_SRCS "builds/unix/ftsystem.c")
else ()
list(APPEND BASE_SRCS "src/base/ftsystem.c")
endif ()
if (WIN32)
enable_language(RC)
list(APPEND BASE_SRCS builds/windows/ftdebug.c
src/base/ftver.rc)
elseif (WINCE)
list(APPEND BASE_SRCS builds/wince/ftdebug.c)
else ()
list(APPEND BASE_SRCS src/base/ftdebug.c)
endif ()
if (BUILD_FRAMEWORK)
list(APPEND BASE_SRCS builds/mac/freetype-Info.plist)
endif ()
if (NOT DISABLE_FORCE_DEBUG_POSTFIX)
set(CMAKE_DEBUG_POSTFIX d)
endif ()
add_library(freetype
${PUBLIC_HEADERS}
${PUBLIC_CONFIG_HEADERS}
${PRIVATE_HEADERS}
${BASE_SRCS}
)
set_target_properties(
freetype PROPERTIES
C_VISIBILITY_PRESET hidden)
target_compile_definitions(
freetype PRIVATE FT2_BUILD_LIBRARY)
if (WIN32)
target_compile_definitions(
freetype PRIVATE _CRT_SECURE_NO_WARNINGS _CRT_NONSTDC_NO_WARNINGS)
if (BUILD_SHARED_LIBS)
target_compile_definitions(
freetype PRIVATE DLL_EXPORT)
endif ()
endif ()
if (BUILD_SHARED_LIBS)
set_target_properties(freetype PROPERTIES
VERSION ${LIBRARY_VERSION}
SOVERSION ${LIBRARY_SOVERSION})
endif ()
# Pick up ftconfig.h and ftoption.h generated above, first.
target_include_directories(
freetype
PUBLIC
$<INSTALL_INTERFACE:include/freetype2>
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/include>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
PRIVATE
${CMAKE_CURRENT_BINARY_DIR}/include
${CMAKE_CURRENT_SOURCE_DIR}/include
# Make <ftconfig.h> available for builds/unix/ftsystem.c.
${CMAKE_CURRENT_BINARY_DIR}/include/freetype/config
)
if (BUILD_FRAMEWORK)
set_property(SOURCE ${PUBLIC_CONFIG_HEADERS}
PROPERTY MACOSX_PACKAGE_LOCATION Headers/config
)
set_target_properties(freetype PROPERTIES
FRAMEWORK TRUE
MACOSX_FRAMEWORK_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/builds/mac/freetype-Info.plist
PUBLIC_HEADER "${PUBLIC_HEADERS}"
XCODE_ATTRIBUTE_INSTALL_PATH "@rpath"
)
endif ()
# 'freetype-interface' is an interface library, to be accessed with
# `EXPORT_NAME Freetype::Freetype`. This is the target name provided by
# CMake's `FindFreetype.cmake`, so we provide it for compatibility.
add_library(freetype-interface INTERFACE)
set_target_properties(freetype-interface PROPERTIES
EXPORT_NAME Freetype::Freetype
INTERFACE_LINK_LIBRARIES freetype)
set(PKGCONFIG_REQUIRES "")
set(PKGCONFIG_REQUIRES_PRIVATE "")
set(PKGCONFIG_LIBS "-L\${libdir} -lfreetype")
set(PKGCONFIG_LIBS_PRIVATE "")
if (ZLIB_FOUND)
target_link_libraries(freetype PRIVATE ${ZLIB_LIBRARIES})
target_include_directories(freetype PRIVATE ${ZLIB_INCLUDE_DIRS})
list(APPEND PKGCONFIG_REQUIRES_PRIVATE "zlib")
endif ()
if (BZIP2_FOUND)
target_link_libraries(freetype PRIVATE ${BZIP2_LIBRARIES})
target_include_directories(freetype PRIVATE ${BZIP2_INCLUDE_DIR}) # not BZIP2_INCLUDE_DIRS
if (PC_BZIP2_FOUND)
list(APPEND PKGCONFIG_REQUIRES_PRIVATE "bzip2")
else ()
list(APPEND PKGCONFIG_LIBS_PRIVATE "-lbz2")
endif ()
endif ()
if (PNG_FOUND)
target_link_libraries(freetype PRIVATE ${PNG_LIBRARIES})
target_compile_definitions(freetype PRIVATE ${PNG_DEFINITIONS})
target_include_directories(freetype PRIVATE ${PNG_INCLUDE_DIRS})
list(APPEND PKGCONFIG_REQUIRES_PRIVATE "libpng")
endif ()
if (HarfBuzz_FOUND)
target_link_libraries(freetype PRIVATE ${HarfBuzz_LIBRARY})
target_include_directories(freetype PRIVATE ${HarfBuzz_INCLUDE_DIRS})
list(APPEND PKGCONFIG_REQUIRES_PRIVATE "harfbuzz >= ${HARFBUZZ_MIN_VERSION}")
endif ()
if (BROTLIDEC_FOUND)
target_link_libraries(freetype PRIVATE ${BROTLIDEC_LIBRARIES})
target_compile_definitions(freetype PRIVATE ${BROTLIDEC_DEFINITIONS})
target_include_directories(freetype PRIVATE ${BROTLIDEC_INCLUDE_DIRS})
list(APPEND PKGCONFIG_REQUIRES_PRIVATE "libbrotlidec")
endif ()
# Installation
include(GNUInstallDirs)
if (NOT SKIP_INSTALL_HEADERS AND NOT SKIP_INSTALL_ALL)
install(
# Note the trailing slash in the argument to `DIRECTORY'!
DIRECTORY ${PROJECT_SOURCE_DIR}/include/
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/freetype2
COMPONENT headers
PATTERN "internal" EXCLUDE
PATTERN "ftconfig.h" EXCLUDE
PATTERN "ftoption.h" EXCLUDE)
install(
FILES ${PROJECT_BINARY_DIR}/include/freetype/config/ftconfig.h
${PROJECT_BINARY_DIR}/include/freetype/config/ftoption.h
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/freetype2/freetype/config
COMPONENT headers)
endif ()
if (NOT SKIP_INSTALL_LIBRARIES AND NOT SKIP_INSTALL_ALL)
# Generate the pkg-config file
file(READ "${PROJECT_SOURCE_DIR}/builds/unix/freetype2.in" FREETYPE2_PC_IN)
string(REPLACE ";" ", " PKGCONFIG_REQUIRES_PRIVATE "${PKGCONFIG_REQUIRES_PRIVATE}")
string(REPLACE "%prefix%" ${CMAKE_INSTALL_PREFIX}
FREETYPE2_PC_IN ${FREETYPE2_PC_IN})
string(REPLACE "%exec_prefix%" "\${prefix}"
FREETYPE2_PC_IN ${FREETYPE2_PC_IN})
string(REPLACE "%libdir%" "\${prefix}/${CMAKE_INSTALL_LIBDIR}"
FREETYPE2_PC_IN ${FREETYPE2_PC_IN})
string(REPLACE "%includedir%" "\${prefix}/${CMAKE_INSTALL_INCLUDEDIR}"
FREETYPE2_PC_IN ${FREETYPE2_PC_IN})
string(REPLACE "%ft_version%" "${LIBTOOL_CURRENT}.${LIBTOOL_REVISION}.${LIBTOOL_AGE}"
FREETYPE2_PC_IN ${FREETYPE2_PC_IN})
if (BUILD_SHARED_LIBS)
string(REPLACE "%PKGCONFIG_REQUIRES%" "${PKGCONFIG_REQUIRES}"
FREETYPE2_PC_IN ${FREETYPE2_PC_IN})
string(REPLACE "%PKGCONFIG_REQUIRES_PRIVATE%" "${PKGCONFIG_REQUIRES_PRIVATE}"
FREETYPE2_PC_IN ${FREETYPE2_PC_IN})
string(REPLACE "%PKGCONFIG_LIBS%" "${PKGCONFIG_LIBS}"
FREETYPE2_PC_IN ${FREETYPE2_PC_IN})
string(REPLACE "%PKGCONFIG_LIBS_PRIVATE%" "${PKGCONFIG_LIBS_PRIVATE}"
FREETYPE2_PC_IN ${FREETYPE2_PC_IN})
else ()
string(REPLACE "%PKGCONFIG_REQUIRES%" "${PKGCONFIG_REQUIRES} ${PKGCONFIG_REQUIRES_PRIVATE}"
FREETYPE2_PC_IN ${FREETYPE2_PC_IN})
string(REPLACE "%PKGCONFIG_REQUIRES_PRIVATE%" ""
FREETYPE2_PC_IN ${FREETYPE2_PC_IN})
string(REPLACE "%PKGCONFIG_LIBS%" "${PKGCONFIG_LIBS} ${PKGCONFIG_LIBS_PRIVATE}"
FREETYPE2_PC_IN ${FREETYPE2_PC_IN})
string(REPLACE "%PKGCONFIG_LIBS_PRIVATE%" ""
FREETYPE2_PC_IN ${FREETYPE2_PC_IN})
endif ()
set(FREETYPE2_PC_IN_NAME "${PROJECT_BINARY_DIR}/freetype2.pc")
if (EXISTS "${FREETYPE2_PC_IN_NAME}")
file(READ "${FREETYPE2_PC_IN_NAME}" ORIGINAL_FREETYPE2_PC_IN)
else ()
set(ORIGINAL_FREETYPE2_PC_IN "")
endif ()
if (NOT (ORIGINAL_FREETYPE2_PC_IN STREQUAL FREETYPE2_PC_IN))
file(WRITE "${FREETYPE2_PC_IN_NAME}" ${FREETYPE2_PC_IN})
endif ()
install(
FILES ${PROJECT_BINARY_DIR}/freetype2.pc
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig
COMPONENT pkgconfig)
include(CMakePackageConfigHelpers)
write_basic_package_version_file(
${PROJECT_BINARY_DIR}/freetype-config-version.cmake
VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}
COMPATIBILITY SameMajorVersion)
install(
TARGETS freetype freetype-interface
EXPORT freetype-targets
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
FRAMEWORK DESTINATION Library/Frameworks
COMPONENT libraries)
install(
EXPORT freetype-targets
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/freetype
FILE freetype-config.cmake
COMPONENT headers)
install(
FILES ${PROJECT_BINARY_DIR}/freetype-config-version.cmake
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/freetype
COMPONENT headers)
endif ()
# Packaging
set(CPACK_PACKAGE_NAME ${CMAKE_PROJECT_NAME})
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "The FreeType font rendering library.")
set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README")
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE.TXT")
set(CPACK_PACKAGE_VERSION_MAJOR ${VERSION_MAJOR})
set(CPACK_PACKAGE_VERSION_MINOR ${VERSION_MINOR})
set(CPACK_PACKAGE_VERSION_PATCH ${VERSION_PATCH})
set(CPACK_PACKAGE_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")
if (WIN32)
set(CPACK_GENERATOR ZIP)
else ()
set(CPACK_GENERATOR TGZ)
endif ()
set(CPACK_COMPONENT_LIBRARIES_DISPLAY_NAME "Libraries")
set(CPACK_COMPONENT_HEADERS_DISPLAY_NAME "C/C++ Headers")
set(CPACK_COMPONENT_LIBRARIES_DESCRIPTION
"Library used to build programs which use FreeType")
set(CPACK_COMPONENT_HEADERS_DESCRIPTION
"C/C++ header files for use with FreeType")
set(CPACK_COMPONENT_HEADERS_DEPENDS libraries)
set(CPACK_COMPONENT_LIBRARIES_GROUP "Development")
set(CPACK_COMPONENT_HEADERS_GROUP "Development")
include(CPack)

36
INSTALL
View File

@ -1,36 +0,0 @@
This is beta software. For now, we only provide installation instructions
for Unix:
1. Build the library (see below)
2. type "make install" (make uninstall provided too)
the library name is "libfreetype.so" (FreeType 1.x uses "libttf.so")
In order to build the library, read the "BUILD" document in the "docs"
directory. Quick starter: go to "freetype2-beta8", then:
Unix (+GNU Make):
- make
- make
Windows + gcc + GNU Make:
- make
- make
Windows + Visual C++ + GNU Make:
- make setup visualc
- make
Windows + Win32-LCC + GNU Make:
- make setup lcc
- make
etc...

View File

@ -1,164 +1,46 @@
The FreeType Project LICENSE
----------------------------
2000-Feb-08
Copyright 1996-2000 by
David Turner, Robert Wilhelm, and Werner Lemberg
Introduction
============
The FreeType Project is distributed in several archive packages;
some of them may contain, in addition to the FreeType font engine,
various tools and contributions which rely on, or relate to, the
FreeType Project.
This license applies to all files found in such packages, and
which do not fall under their own explicit license. The license
affects thus the FreeType font engine, the test programs,
documentation and makefiles, at the very least.
This license was inspired by the BSD, Artistic, and IJG
(Independent JPEG Group) licenses, which all encourage inclusion
and use of free software in commercial and freeware products
alike. As a consequence, its main points are that:
o We don't promise that this software works. However, we are be
interested in any kind of bug reports. (`as is' distribution)
o You can use this software for whatever you want, in parts or
full form, without having to pay us. (`royalty-free' usage)
o You may not pretend that you wrote this software. If you use
it, or only parts of it, in a program, you must acknowledge
somewhere in your documentation that you have used the
FreeType code. (`credits')
We specifically permit and encourage the inclusion of this
software, with or without modifications, in commercial products.
We disclaim all warranties covering The FreeType Project and
assume no liability related to The FreeType Project.
Legal Terms
===========
0. Definitions
--------------
Throughout this license, the terms `package', `FreeType Project',
and `FreeType archive' refer to the set of files originally
distributed by the authors (David Turner, Robert Wilhelm, and
Werner Lemberg) as the `FreeType Project', be they named as alpha,
beta or final release.
`You' refers to the licensee, or person using the project, where
`using' is a generic term including compiling the project's source
code as well as linking it to form a `program' or `executable'.
This program is referred to as `a program using the FreeType
engine'.
This license applies to all files distributed in the original
FreeType Project, including all source code, binaries and
documentation, unless otherwise stated in the file in its
original, unmodified form as distributed in the original archive.
If you are unsure whether or not a particular file is covered by
this license, you must contact us to verify this.
The FreeType Project is copyright (C) 1996-2000 by David Turner,
Robert Wilhelm, and Werner Lemberg. All rights reserved except as
specified below.
1. No Warranty
--------------
THE FREETYPE PROJECT IS PROVIDED `AS IS' WITHOUT WARRANTY OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. IN NO EVENT WILL ANY OF THE AUTHORS OR COPYRIGHT HOLDERS
BE LIABLE FOR ANY DAMAGES CAUSED BY THE USE OR THE INABILITY TO
USE, OF THE FREETYPE PROJECT.
2. Redistribution
FREETYPE LICENSES
-----------------
This license grants a worldwide, royalty-free, perpetual and
irrevocable right and license to use, execute, perform, compile,
display, copy, create derivative works of, distribute and
sublicense the FreeType Project (in both source and object code
forms) and derivative works thereof for any purpose; and to
authorize others to exercise some or all of the rights granted
herein, subject to the following conditions:
The FreeType 2 font engine is copyrighted work and cannot be used
legally without a software license. In order to make this project
usable to a vast majority of developers, we distribute it under two
mutually exclusive open-source licenses.
o Redistribution of source code must retain this license file
(`LICENSE.TXT') unaltered; any additions, deletions or changes
to the original files must be clearly indicated in
accompanying documentation. The copyright notices of the
unaltered, original files must be preserved in all copies of
source files.
This means that *you* must choose *one* of the two licenses described
below, then obey all its terms and conditions when using FreeType 2 in
any of your projects or products.
o Redistribution in binary form must provide a disclaimer that
states that the software is based in part of the work of the
FreeType Team, in the distribution documentation. We also
encourage you to put an URL to the FreeType web page in your
documentation, though this isn't mandatory.
- The FreeType License, found in the file `docs/FTL.TXT`, which is
similar to the original BSD license *with* an advertising clause
that forces you to explicitly cite the FreeType project in your
product's documentation. All details are in the license file.
This license is suited to products which don't use the GNU General
Public License.
These conditions apply to any software derived from or based on
the FreeType Project, not just the unmodified files. If you use
our work, you must acknowledge us. However, no fee need be paid
to us.
Note that this license is compatible to the GNU General Public
License version 3, but not version 2.
3. Advertising
--------------
- The GNU General Public License version 2, found in
`docs/GPLv2.TXT` (any later version can be used also), for
programs which already use the GPL. Note that the FTL is
incompatible with GPLv2 due to its advertisement clause.
Neither the FreeType authors and contributors nor you shall use
the name of the other for commercial, advertising, or promotional
purposes without specific prior written permission.
The contributed BDF and PCF drivers come with a license similar to
that of the X Window System. It is compatible to the above two
licenses (see files `src/bdf/README` and `src/pcf/README`). The same
holds for the source code files `src/base/fthash.c` and
`include/freetype/internal/fthash.h`; they were part of the BDF driver
in earlier FreeType versions.
We suggest, but do not require, that you use one or more of the
following phrases to refer to this software in your documentation
or advertising materials: `FreeType Project', `FreeType Engine',
`FreeType library', or `FreeType Distribution'.
The gzip module uses the zlib license (see `src/gzip/zlib.h`) which
too is compatible to the above two licenses.
As you have not signed this license, you are not required to
accept it. However, as the FreeType Project is copyrighted
material, only this license, or another one contracted with the
authors, grants you the right to use, distribute, and modify it.
Therefore, by using, distributing, or modifying the FreeType
Project, you indicate that you understand and accept all the terms
of this license.
The files `src/autofit/ft-hb.c` and `src/autofit/ft-hb.h` contain code
taken almost verbatim from the HarfBuzz file `hb-ft.cc`, which uses
the 'Old MIT' license, compatible to the above two licenses.
4. Contacts
-----------
There are two mailing lists related to FreeType:
o freetype@freetype.org
Discusses general use and applications of FreeType, as well as
future and wanted additions to the library and distribution.
If you are looking for support, start in this list if you
haven't found anything to help you in the documentation.
o devel@freetype.org
Discusses bugs, as well as engine internals, design issues,
specific licenses, porting, etc.
o http://www.freetype.org
Holds the current FreeType web page, which will allow you to
download our latest development version and read online
documentation.
You can also contact us individually at:
David Turner <david.turner@freetype.org>
Robert Wilhelm <robert.wilhelm@freetype.org>
Werner Lemberg <werner.lemberg@freetype.org>
The MD5 checksum support (only used for debugging in development
builds) is in the public domain.
--- end of LICENSE.TXT ---

2
MSBuild.rsp Normal file
View File

@ -0,0 +1,2 @@
#/p:WindowsTargetPlatformVersion=10.0.16299.0
/p:Configuration="Release"

66
MSBuild.sln Normal file
View File

@ -0,0 +1,66 @@
Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio Express 2012 for Windows Desktop
#
# You can build FreeType with MSBuild as follows
#
# MSBuild.exe -t:Rebuild
# -p:Configuration=Debug
# -p:Platform=x64
# -p:UserDefines=FT_DEBUG_LOGGING
# MSBuild.sln
#
# or with different appropriate switches. The library file
# freetype.dll and/or freetype.lib should appear in the objs/
# folder. A copy should be sent to ../freetype-demos/bin/
# to be used with the demo programs.
#
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "freetype", "builds\windows\vc2010\freetype.vcxproj", "{78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
Debug|ARM64 = Debug|ARM64
Debug|Win32 = Debug|Win32
Debug Static|x64 = Debug Static|x64
Debug Static|ARM64 = Debug Static|ARM64
Debug Static|Win32 = Debug Static|Win32
Release|x64 = Release|x64
Release|ARM64 = Release|ARM64
Release|Win32 = Release|Win32
Release Static|x64 = Release Static|x64
Release Static|ARM64 = Release Static|ARM64
Release Static|Win32 = Release Static|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Debug|x64.ActiveCfg = Debug|x64
{78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Debug|x64.Build.0 = Debug|x64
{78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Debug|ARM64.ActiveCfg = Debug|ARM64
{78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Debug|ARM64.Build.0 = Debug|ARM64
{78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Debug|Win32.ActiveCfg = Debug|Win32
{78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Debug|Win32.Build.0 = Debug|Win32
{78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Debug Static|x64.ActiveCfg = Debug Static|x64
{78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Debug Static|x64.Build.0 = Debug Static|x64
{78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Debug Static|ARM64.ActiveCfg = Debug Static|ARM64
{78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Debug Static|ARM64.Build.0 = Debug Static|ARM64
{78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Debug Static|Win32.ActiveCfg = Debug Static|Win32
{78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Debug Static|Win32.Build.0 = Debug Static|Win32
{78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Release|x64.ActiveCfg = Release|x64
{78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Release|x64.Build.0 = Release|x64
{78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Release|ARM64.ActiveCfg = Release|ARM64
{78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Release|ARM64.Build.0 = Release|ARM64
{78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Release|Win32.ActiveCfg = Release|Win32
{78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Release|Win32.Build.0 = Release|Win32
{78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Release Static|x64.ActiveCfg = Release Static|x64
{78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Release Static|x64.Build.0 = Release Static|x64
{78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Release Static|ARM64.ActiveCfg = Release Static|ARM64
{78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Release Static|ARM64.Build.0 = Release Static|ARM64
{78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Release Static|Win32.ActiveCfg = Release Static|Win32
{78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Release Static|Win32.Build.0 = Release Static|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {90811697-0889-4381-80BC-C3FE8FA4931F}
EndGlobalSection
EndGlobal

View File

@ -3,101 +3,32 @@
#
# Copyright 1996-2000 by
# Copyright (C) 1996-2024 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,
# and distributed under the terms of the FreeType project license,
# LICENSE.TXT. By continuing to use, modify, or distribute this file you
# LICENSE.TXT. By continuing to use, modify, or distribute this file you
# indicate that you have read the license and understand and accept it
# fully.
# This file is designed for GNU Make, do not use it with another Make tool!
# Project names
#
# It works as follows:
#
# - When invoked for the first time, this Makefile will include the rules
# found in `freetype/config/detect.mk'. They are in charge of detecting
# the current platform.
#
# A summary of the detection will be displayed, and the file `config.mk'
# will be created in the current directory.
#
# - When invoked later, this Makefile will include the rules found in
# `config.mk'. This sub-Makefile will define some system-specific
# variables (like compiler, compilation flags, object suffix, etc.), then
# include the rules found in `freetype/config/freetype.mk', used to build
# the library.
#
# See the comments in `config/detect.mk' and `config/freetype.mk' for more
# details on host platform detection and library builds.
PROJECT := freetype
PROJECT_TITLE := FreeType
.PHONY: setup
# The variable TOP holds the path to the topmost directory in the FreeType
# The variable TOP_DIR holds the path to the topmost directory in the project
# engine source hierarchy. If it is not defined, default it to `.'.
#
ifndef TOP
TOP := .
endif
TOP_DIR ?= .
CONFIG_MK := config.mk
# If no configuration sub-makefile is present, or if `setup' is the target
# to be built, run the auto-detection rules to figure out which
# configuration rules file to use.
# The variable OBJ_DIR gives the location where object files and the
# FreeType library are built.
#
# Note that the configuration file is put in the current directory, which is
# not necessarily $(TOP).
OBJ_DIR ?= $(TOP_DIR)/objs
# If `config.mk' is not present, set `check_platform'.
#
ifeq ($(wildcard $(CONFIG_MK)),)
check_platform := 1
endif
# If `setup' is one of the targets requested, set `check_platform'.
#
ifneq ($(findstring setup,$(MAKECMDGOALS)),)
check_platform := 1
endif
# Include the automatic host platform detection rules when we need to
# check the platform.
#
ifdef check_platform
all: setup
# If the module list $(FT_MODULE_LIST) file is not present, generate it.
#
modules: make_module_list setup
include $(TOP)/builds/detect.mk
include $(TOP)/builds/modules.mk
ifeq ($(wildcard $(FT_MODULE_LIST)),)
setup: make_module_list
endif
# IMPORTANT:
#
# `setup' must be defined by the host platform detection rules to create
# the `config.mk' file in the current directory.
else
# A configuration sub-Makefile is present -- simply run it.
#
all: single
modules: make_module_list
BUILD_FREETYPE := yes
include $(CONFIG_MK)
endif # test check_platform
include $(TOP_DIR)/builds/toplevel.mk
# EOF

107
README Normal file
View File

@ -0,0 +1,107 @@
FreeType 2.13.2
===============
Homepage: https://www.freetype.org
FreeType is a freely available software library to render fonts.
It is written in C, designed to be small, efficient, highly
customizable, and portable while capable of producing high-quality
output (glyph images) of most vector and bitmap font formats.
Please read the `docs/CHANGES` file, it contains IMPORTANT
INFORMATION.
Read the files `docs/INSTALL*` for installation instructions; see the
file `docs/LICENSE.TXT` for the available licenses.
For using FreeType's git repository instead of a distribution bundle,
please read file `README.git`. Note that you have to actually clone
the repository; using a snapshot will not work (in other words, don't
use gitlab's 'Download' button).
The FreeType 2 API reference is located in directory `docs/reference`;
use the file `index.html` as the top entry point. [Please note that
currently the search function for locally installed documentation
doesn't work due to cross-site scripting issues.]
Additional documentation is available as a separate package from our
sites. Go to
https://download.savannah.gnu.org/releases/freetype/
and download one of the following files.
freetype-doc-2.13.2.tar.xz
freetype-doc-2.13.2.tar.gz
ftdoc2132.zip
To view the documentation online, go to
https://www.freetype.org/freetype2/docs/
Mailing Lists
-------------
The preferred way of communication with the FreeType team is using
e-mail lists.
general use and discussion: freetype@nongnu.org
engine internals, porting, etc.: freetype-devel@nongnu.org
announcements: freetype-announce@nongnu.org
git repository tracker: freetype-commit@nongnu.org
The lists are moderated; see
https://www.freetype.org/contact.html
how to subscribe.
Bugs
----
Please submit bug reports at
https://gitlab.freedesktop.org/freetype/freetype/-/issues
Alternatively, you might report bugs by e-mail to
`freetype-devel@nongnu.org`. Don't forget to send a detailed
explanation of the problem -- there is nothing worse than receiving a
terse message that only says 'it doesn't work'.
Patches
-------
For larger changes please provide merge requests at
https://gitlab.freedesktop.org/freetype/freetype/-/merge_requests
Alternatively, you can send patches to the `freetype-devel@nongnu.org`
mailing list -- and thank you in advance for your work on improving
FreeType!
Details on the process can be found here:
https://www.freetype.org/developer.html#patches
Enjoy!
The FreeType Team
----------------------------------------------------------------------
Copyright (C) 2006-2024 by
David Turner, Robert Wilhelm, and Werner Lemberg.
This file is part of the FreeType project, and may only be used,
modified, and distributed under the terms of the FreeType project
license, LICENSE.TXT. By continuing to use, modify, or distribute
this file you indicate that you have read the license and understand
and accept it fully.
--- end of README ---

102
README.git Normal file
View File

@ -0,0 +1,102 @@
README.git
==========
repository issues
-----------------
FreeType's official repository site is
https://gitlab.freedesktop.org/freetype ,
from which the 'freetype.git' and 'freetype-demos.git' repositories
can be cloned in the usual way.
git clone https://gitlab.freedesktop.org/freetype/freetype.git
git clone https://gitlab.freedesktop.org/freetype/freetype-demos.git
If you want to use the Savannah mirror instead, you have to do a
slightly different incantation because the repository names contain
digit '2' for historical reasons.
git clone \
https://git.savannah.nongnu.org/git/freetype/freetype2.git \
freetype
git clone \
https://git.savannah.nongnu.org/git/freetype/freetype2-demos.git \
freetype-demos
standard builds with `configure`
--------------------------------
The git repository doesn't contain pre-built configuration scripts for
UNIXish platforms. To generate them say
sh autogen.sh
which in turn depends on the following packages:
automake (1.10.1)
libtool (2.2.4)
autoconf (2.62)
The versions given in parentheses are known to work. Newer versions
should work too, of course. Note that `autogen.sh` also sets up
proper file permissions for the `configure` and auxiliary scripts.
The `autogen.sh` script checks whether the versions of the above three
tools match the numbers above. Otherwise it will complain and suggest
either upgrading or using environment variables to point to more
recent versions of the required tools.
Note that `aclocal` is provided by the 'automake' package on Linux,
and that `libtoolize` is called `glibtoolize` on Darwin (OS X).
alternative build methods
-------------------------
For static builds that don't use platform-specific optimizations, no
configure script is necessary at all; saying
make setup ansi
make
should work on all platforms that have GNU `make` (or `makepp`).
A build with `cmake` or `meson` can be done directly from the git
repository. However, if you want to use the `FT_DEBUG_LOGGING` macro
(see file `docs/DEBUG` for more information) it is currently mandatory
to execute `autogen.sh` in advance; this script clones the 'dlg' git
submodule and copies some files into FreeType's source tree.
Code of Conduct
---------------
Please note that this project is released with a Contributor Code of
Conduct (CoC). By participating in this project you agree to abide by
its terms, which you can find in the following link:
https://www.freedesktop.org/wiki/CodeOfConduct
CoC issues may be raised to the project maintainers at the following
address:
wl@gnu.org
apodtele@gmail.com
----------------------------------------------------------------------
Copyright (C) 2005-2024 by
David Turner, Robert Wilhelm, and Werner Lemberg.
This file is part of the FreeType project, and may only be used,
modified, and distributed under the terms of the FreeType project
license, LICENSE.TXT. By continuing to use, modify, or distribute
this file you indicate that you have read the license and understand
and accept it fully.
--- end of README.git ---

199
autogen.sh Executable file
View File

@ -0,0 +1,199 @@
#!/bin/sh
# Copyright (C) 2005-2024 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,
# and distributed under the terms of the FreeType project license,
# LICENSE.TXT. By continuing to use, modify, or distribute this file you
# indicate that you have read the license and understand and accept it
# fully.
run ()
{
echo "running \`$*'"
eval $*
if test $? != 0 ; then
echo "error while running \`$*'"
exit 1
fi
}
get_major_version ()
{
echo $1 | sed -e 's/\([0-9][0-9]*\)\..*/\1/g'
}
get_minor_version ()
{
echo $1 | sed -e 's/[0-9][0-9]*\.\([0-9][0-9]*\).*/\1/g'
}
get_patch_version ()
{
# tricky: some version numbers don't include a patch
# separated with a point, but something like 1.4-p6
patch=`echo $1 | sed -e 's/[0-9][0-9]*\.[0-9][0-9]*\.\([0-9][0-9]*\).*/\1/g'`
if test "$patch" = "$1"; then
patch=`echo $1 | sed -e 's/[0-9][0-9]*\.[0-9][0-9]*\-p\([0-9][0-9]*\).*/\1/g'`
# if there isn't any patch number, default to 0
if test "$patch" = "$1"; then
patch=0
fi
fi
echo $patch
}
# $1: version to check
# $2: minimum version
compare_to_minimum_version ()
{
MAJOR1=`get_major_version $1`
MAJOR2=`get_major_version $2`
if test $MAJOR1 -lt $MAJOR2; then
echo 0
return
else
if test $MAJOR1 -gt $MAJOR2; then
echo 1
return
fi
fi
MINOR1=`get_minor_version $1`
MINOR2=`get_minor_version $2`
if test $MINOR1 -lt $MINOR2; then
echo 0
return
else
if test $MINOR1 -gt $MINOR2; then
echo 1
return
fi
fi
PATCH1=`get_patch_version $1`
PATCH2=`get_patch_version $2`
if test $PATCH1 -lt $PATCH2; then
echo 0
else
echo 1
fi
}
# check the version of a given tool against a minimum version number
#
# $1: tool path
# $2: tool usual name (e.g. `aclocal')
# $3: tool variable (e.g. `ACLOCAL')
# $4: minimum version to check against
# $5: option field index used to extract the tool version from the
# output of --version
check_tool_version ()
{
field=$5
# assume the output of "[TOOL] --version" is "toolname (GNU toolname foo bar) version"
if test "$field"x = x; then
field=3 # default to 3 for all GNU autotools, after filtering enclosed string
fi
version=`$1 --version | head -1 | sed 's/([^)]*)/()/g' | cut -d ' ' -f $field`
version_check=`compare_to_minimum_version $version $4`
if test "$version_check"x = 0x; then
echo "ERROR: Your version of the \`$2' tool is too old."
echo " Minimum version $4 is required (yours is version $version)."
echo " Please upgrade or use the $3 variable to point to a more recent one."
echo ""
exit 1
fi
}
# Solaris 10's shell doesn't like the `!` operator to negate the exit status.
if test -f ./builds/unix/configure.raw; then
:
else
echo "You must be in the same directory as \`autogen.sh'."
echo "Bootstrapping doesn't work if srcdir != builddir."
exit 1
fi
# On MacOS X, the GNU libtool is named `glibtool'.
HOSTOS=`uname`
if test "$LIBTOOLIZE"x != x; then
:
elif test "$HOSTOS"x = Darwinx; then
LIBTOOLIZE=glibtoolize
else
LIBTOOLIZE=libtoolize
fi
if test "$ACLOCAL"x = x; then
ACLOCAL=aclocal
fi
if test "$AUTOCONF"x = x; then
AUTOCONF=autoconf
fi
check_tool_version $ACLOCAL aclocal ACLOCAL 1.10.1
check_tool_version $LIBTOOLIZE libtoolize LIBTOOLIZE 2.2.4
check_tool_version $AUTOCONF autoconf AUTOCONF 2.62
# This sets FREETYPE version.
eval `sed -n \
-e 's/^#define *\(FREETYPE_MAJOR\) *\([0-9][0-9]*\).*/\1=\2/p' \
-e 's/^#define *\(FREETYPE_MINOR\) *\([0-9][0-9]*\).*/\1=\2/p' \
-e 's/^#define *\(FREETYPE_PATCH\) *\([0-9][0-9]*\).*/\1=\2/p' \
include/freetype/freetype.h`
if test "$FREETYPE_PATCH" = "0"; then
FREETYPE=$FREETYPE_MAJOR.$FREETYPE_MINOR
else
FREETYPE=$FREETYPE_MAJOR.$FREETYPE_MINOR.$FREETYPE_PATCH
fi
echo "FreeType $FREETYPE:"
cd builds/unix
echo "generating \`configure.ac'"
sed -e "s;@VERSION@;$FREETYPE;" \
< configure.raw > configure.ac
run aclocal -I . --force
run $LIBTOOLIZE --force --copy --install
run autoconf --force
chmod +x install-sh
cd ../..
chmod +x ./configure
# Copy all necessary 'dlg' files.
copy_submodule_files ()
{
echo "Copying files from \`subprojects/dlg' to \`src/dlg' and \`include/dlg'"
mkdir include/dlg 2> /dev/null
cp $DLG_INC_DIR/output.h include/dlg
cp $DLG_INC_DIR/dlg.h include/dlg
cp $DLG_SRC_DIR/* src/dlg
}
if test -e ".git"; then
DLG_INC_DIR=subprojects/dlg/include/dlg
DLG_SRC_DIR=subprojects/dlg/src/dlg
if test -d "$DLG_INC_DIR"; then
:
else
echo "Checking out submodule in \`subprojects/dlg':"
git submodule update --init
fi
copy_submodule_files
fi
# EOF

110
builds/amiga/README Normal file
View File

@ -0,0 +1,110 @@
README for the builds/amiga subdirectory.
Copyright (C) 2005-2024 by
Werner Lemberg and Detlef Würkner.
This file is part of the FreeType project, and may only be used, modified,
and distributed under the terms of the FreeType project license,
LICENSE.TXT. By continuing to use, modify, or distribute this file you
indicate that you have read the license and understand and accept it
fully.
The makefile.os4 is for the AmigaOS4 SDK. To use it, type
"make -f makefile.os4", it produces a link library libft2_ppc.a.
The makefile is for ppc-morphos-gcc-2.95.3-bin.tgz (gcc 2.95.3 hosted on
68k-Amiga producing MorphOS-PPC-binaries from http://www.morphos.de).
To use it, type "make assign", then "make"; it produces a link library
libft2_ppc.a.
The smakefile is a makefile for Amiga SAS/C 6.58 (no longer available,
latest sold version was 6.50, updates can be found in Aminet). It is
based on the version found in the sourcecode of ttf.library 0.83b for
FreeType 1.3.1 from Richard Griffith (ragriffi@sprynet.com,
http://ragriffi.home.sprynet.com).
You will also need the latest include files and amiga.lib from the
Amiga web site (https://os.amigaworld.de/download.php?id=3) for
AmigaOS 3.9; the generated code should work under AmigaOS 2.04 and up.
To use it, call "smake assign" and then "smake" from the builds/amiga
directory. The results are:
- A link library "ft2_680x0.lib" (where x depends on the setting of
the CPU entry in the smakefile) containing all FreeType2 parts
except of the init code, debugging code, and the system interface
code.
- ftsystem.o, an object module containing the standard version of the
system interface code which uses fopen() fclose() fread() fseek()
ftell() malloc() realloc() and free() from lib:sc.lib (not pure).
- ftsystempure.o, an object module containing the pure version of the
system interface code which uses Open() Close() Read() Seek()
ExamineFH() AsmAllocPooled() AsmFreePooled() etc. This version can
be used in both normal programs and in Amiga run-time shared system
librarys (can be linked with lib:libinit.o, no copying of DATA and
BSS hunks for each OpenLibrary() necessary). Source code is in
src/base/ftsystem.c.
- ftdebug.o, an object module containing the standard version of the
debugging code which uses vprintf() and exit() (not pure).
Debugging can be turned on in FT:include/freetype/config/ftoption.h
and with FT_SetTraceLevel().
- ftdebugpure.o, an object module containing the pure version of the
debugging code which uses KVPrintf() from lib:debug.lib and no
exit(). For debugging of Amiga run-time shared system libraries.
Source code is in src/base/ftdebug.c.
- NO ftinit.o. Because linking with a link library should result in
linking only the needed object modules in it, but standard
ftsystem.o would force ALL FreeType2 modules to be linked to your
program, I decided to use a different scheme: You must #include
FT:src/base/ftinit.c in your sourcecode and specify with #define
statements which modules you need. See
include/freetype/config/ftmodule.h.
To use in your own programs:
- Insert the #define and #include statements from top of
include/freetype/config/ftmodule.h in your source code and
uncomment the #define statements for the FreeType2 modules you need.
- You can use either PARAMETERS=REGISTER or PARAMETERS=STACK for
calling the FreeType2 functions, because the link library and the
object files are compiled with PARAMETERS=BOTH.
- "smake assign" (assign "FT:" to the FreeType2 main directory).
- Compile your program.
- Link with either ftsystem.o or ftsystempure.o, if debugging enabled
with either ftdebug.o or (ftdebugpure.o and lib:debug.lib), and with
ft2_680x0.lib as link library.
To adapt to other compilers:
- The standard ANSI C maximum length of 31 significant characters in
identifiers is not enough for FreeType2. Check if your compiler has
a minimum length of 40 significant characters or can be switched to
it. "idlen=40" is the option for SAS/C. Setting #define
HAVE_LIMIT_ON_IDENTS in an include file may also work (not tested).
- Make sure that the include directory in builds/amiga is searched
before the normal FreeType2 include directory, so you are able to
replace problematic include files with your own version (same may be
useful for the src directory).
- An example of how to replace/workaround a problematic include file
is include/freetype/config/ftconfig.h; it changes a #define that
would prevent SAS/C from generating XDEF's where it should do that and
then includes the standard FreeType2 include file.
Local Variables:
coding: latin-1
End:

View File

@ -0,0 +1,55 @@
/***************************************************************************/
/* */
/* ftconfig.h */
/* */
/* Amiga-specific configuration file (specification only). */
/* */
/* Copyright (C) 2005-2024 by */
/* Werner Lemberg and Detlef Würkner. */
/* */
/* This file is part of the FreeType project, and may only be used, */
/* modified, and distributed under the terms of the FreeType project */
/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
/* this file you indicate that you have read the license and */
/* understand and accept it fully. */
/* */
/***************************************************************************/
/*
* This is an example how to override the default FreeType2 header files
* with Amiga-specific changes. When the compiler searches this directory
* before the default directory, we can do some modifications.
*
* Here we must change FT_EXPORT_DEF so that SAS/C does
* generate the needed XDEFs.
*/
#if 0
#define FT_EXPORT_DEF( x ) extern x
#endif
#undef FT_EXPORT_DEF
#define FT_EXPORT_DEF( x ) x
/* Now include the original file */
#ifndef __MORPHOS__
#ifdef __SASC
#include "FT:include/freetype/config/ftconfig.h"
#else
#include "/FT/include/freetype/config/ftconfig.h"
#endif
#else
/* We must define that, it seems that
* lib/gcc-lib/ppc-morphos/2.95.3/include/syslimits.h is missing in
* ppc-morphos-gcc-2.95.3-bin.tgz (gcc for 68k producing MorphOS PPC elf
* binaries from http://www.morphos.de)
*/
#define _LIBC_LIMITS_H_
#include "/FT/include/freetype/config/ftconfig.h"
#endif
/*
Local Variables:
coding: latin-1
End:
*/

View File

@ -0,0 +1,158 @@
/***************************************************************************/
/* */
/* ftmodule.h */
/* */
/* Amiga-specific FreeType module selection. */
/* */
/* Copyright (C) 2005-2024 by */
/* Werner Lemberg and Detlef Würkner. */
/* */
/* This file is part of the FreeType project, and may only be used, */
/* modified, and distributed under the terms of the FreeType project */
/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
/* this file you indicate that you have read the license and */
/* understand and accept it fully. */
/* */
/***************************************************************************/
/*
* To avoid that all your programs include all FreeType modules,
* you copy the following piece of source code into your own
* source file and specify which modules you really need in your
* application by uncommenting the appropriate lines.
*/
/*
//#define FT_USE_AUTOFIT // autofitter
//#define FT_USE_RASTER // monochrome rasterizer
//#define FT_USE_SMOOTH // anti-aliasing rasterizer
//#define FT_USE_TT // truetype font driver
//#define FT_USE_T1 // type1 font driver
//#define FT_USE_T42 // type42 font driver
//#define FT_USE_T1CID // cid-keyed type1 font driver // no cmap support
//#define FT_USE_CFF // opentype font driver
//#define FT_USE_BDF // bdf bitmap font driver
//#define FT_USE_PCF // pcf bitmap font driver
//#define FT_USE_PFR // pfr font driver
//#define FT_USE_WINFNT // windows .fnt|.fon bitmap font driver
//#define FT_USE_OTV // opentype validator
//#define FT_USE_GXV // truetype gx validator
#include "FT:src/base/ftinit.c"
*/
/* Make sure that the needed support modules are built in.
* Dependencies can be found by searching for FT_Get_Module.
*/
#ifdef FT_USE_T42
#define FT_USE_TT
#endif
#ifdef FT_USE_TT
#define FT_USE_SFNT
#endif
#ifdef FT_USE_CFF
#define FT_USE_SFNT
#define FT_USE_PSHINT
#define FT_USE_PSNAMES
#endif
#ifdef FT_USE_T1
#define FT_USE_PSAUX
#define FT_USE_PSHINT
#define FT_USE_PSNAMES
#endif
#ifdef FT_USE_T1CID
#define FT_USE_PSAUX
#define FT_USE_PSHINT
#define FT_USE_PSNAMES
#endif
#ifdef FT_USE_PSAUX
#define FT_USE_PSNAMES
#endif
#ifdef FT_USE_SFNT
#define FT_USE_PSNAMES
#endif
/* Now include the modules */
#ifdef FT_USE_AUTOFIT
FT_USE_MODULE( FT_Module_Class, autofit_module_class )
#endif
#ifdef FT_USE_TT
FT_USE_MODULE( FT_Driver_ClassRec, tt_driver_class )
#endif
#ifdef FT_USE_T1
FT_USE_MODULE( FT_Driver_ClassRec, t1_driver_class )
#endif
#ifdef FT_USE_CFF
FT_USE_MODULE( FT_Driver_ClassRec, cff_driver_class )
#endif
#ifdef FT_USE_T1CID
FT_USE_MODULE( FT_Driver_ClassRec, t1cid_driver_class )
#endif
#ifdef FT_USE_PFR
FT_USE_MODULE( FT_Driver_ClassRec, pfr_driver_class )
#endif
#ifdef FT_USE_T42
FT_USE_MODULE( FT_Driver_ClassRec, t42_driver_class )
#endif
#ifdef FT_USE_WINFNT
FT_USE_MODULE( FT_Driver_ClassRec, winfnt_driver_class )
#endif
#ifdef FT_USE_PCF
FT_USE_MODULE( FT_Driver_ClassRec, pcf_driver_class )
#endif
#ifdef FT_USE_PSAUX
FT_USE_MODULE( FT_Module_Class, psaux_module_class )
#endif
#ifdef FT_USE_PSNAMES
FT_USE_MODULE( FT_Module_Class, psnames_module_class )
#endif
#ifdef FT_USE_PSHINT
FT_USE_MODULE( FT_Module_Class, pshinter_module_class )
#endif
#ifdef FT_USE_RASTER
FT_USE_MODULE( FT_Renderer_Class, ft_raster1_renderer_class )
#endif
#ifdef FT_USE_SFNT
FT_USE_MODULE( FT_Module_Class, sfnt_module_class )
#endif
#ifdef FT_USE_SMOOTH
FT_USE_MODULE( FT_Renderer_Class, ft_smooth_renderer_class )
#endif
#ifdef FT_USE_OTV
FT_USE_MODULE( FT_Module_Class, otv_module_class )
#endif
#ifdef FT_USE_BDF
FT_USE_MODULE( FT_Driver_ClassRec, bdf_driver_class )
#endif
#ifdef FT_USE_GXV
FT_USE_MODULE( FT_Module_Class, gxv_module_class )
#endif
/*
Local Variables:
coding: latin-1
End:
*/

293
builds/amiga/makefile Normal file
View File

@ -0,0 +1,293 @@
#
# Makefile for FreeType2 link library using ppc-morphos-gcc-2.95.3-bin.tgz
# (gcc 2.95.3 hosted on 68k-Amiga producing MorphOS-PPC-binaries from
# http://www.morphos.de)
#
# Copyright (C) 2005-2024 by
# Werner Lemberg and Detlef Würkner.
#
# This file is part of the FreeType project, and may only be used, modified,
# and distributed under the terms of the FreeType project license,
# LICENSE.TXT. By continuing to use, modify, or distribute this file you
# indicate that you have read the license and understand and accept it
# fully.
#
# to build from the builds/amiga directory call
#
# make assign
# make
#
# Your programs source code should start with this
# (uncomment the parts you do not need to keep the program small):
# ---8<---
#define FT_USE_AUTOFIT // autofitter
#define FT_USE_RASTER // monochrome rasterizer
#define FT_USE_SMOOTH // anti-aliasing rasterizer
#define FT_USE_TT // truetype font driver
#define FT_USE_T1 // type1 font driver
#define FT_USE_T42 // type42 font driver
#define FT_USE_T1CID // cid-keyed type1 font driver
#define FT_USE_CFF // opentype font driver
#define FT_USE_BDF // bdf bitmap font driver
#define FT_USE_PCF // pcf bitmap font driver
#define FT_USE_PFR // pfr font driver
#define FT_USE_WINFNT // windows .fnt|.fon bitmap font driver
#define FT_USE_OTV // opentype validator
#define FT_USE_GXV // truetype gx validator
#include "FT:src/base/ftinit.c"
# ---8<---
#
# link your programs with libft2_ppc.a and either ftsystem.ppc.o or ftsystempure.ppc.o
# (and either ftdebug.ppc.o or ftdebugpure.ppc.o if you enabled FT_DEBUG_LEVEL_ERROR or
# FT_DEBUG_LEVEL_TRACE in include/freetype/config/ftoption.h).
all: libft2_ppc.a ftsystem.ppc.o ftsystempure.ppc.o
assign:
assign FT: //
FTSRC = /FT/src
CC = ppc-morphos-gcc
AR = ppc-morphos-ar rc
RANLIB = ppc-morphos-ranlib
LD = ppc-morphos-ld
CFLAGS = -DFT2_BUILD_LIBRARY -O2 -I/emu/emulinclude/includegcc -I/emu/include -Iinclude -I$(FTSRC) -I/FT/include
#
# FreeType2 library base
#
ftbase.ppc.o: $(FTSRC)/base/ftbase.c
$(CC) -c $(CFLAGS) -o $@ $<
ftinit.ppc.o: $(FTSRC)/base/ftinit.c
$(CC) -c $(CFLAGS) -o $@ $<
ftsystem.ppc.o: $(FTSRC)/base/ftsystem.c
$(CC) -c $(CFLAGS) -o $@ $<
# pure version for use in run-time library etc
ftsystempure.ppc.o: src/base/ftsystem.c
$(CC) -c $(CFLAGS) -o $@ $<
ftdebug.ppc.o: $(FTSRC)/base/ftdebug.c
$(CC) -c $(CFLAGS) -o $@ $<
# pure version for use in run-time library etc
ftdebugpure.ppc.o: src/base/ftdebug.c
$(CC) -c $(CFLAGS) -o $@ $<
#
# FreeType2 library base extensions
#
ftbbox.ppc.o: $(FTSRC)/base/ftbbox.c
$(CC) -c $(CFLAGS) -o $@ $<
ftbdf.ppc.o: $(FTSRC)/base/ftbdf.c
$(CC) -c $(CFLAGS) -o $@ $<
ftbitmap.ppc.o: $(FTSRC)/base/ftbitmap.c
$(CC) -c $(CFLAGS) -o $@ $<
ftcid.ppc.o: $(FTSRC)/base/ftcid.c
$(CC) -c $(CFLAGS) -o $@ $<
ftfstype.ppc.o: $(FTSRC)/base/ftfstype.c
$(CC) -c $(CFLAGS) -o $@ $<
ftgasp.ppc.o: $(FTSRC)/base/ftgasp.c
$(CC) -c $(CFLAGS) -o $@ $<
ftglyph.ppc.o: $(FTSRC)/base/ftglyph.c
$(CC) -c $(CFLAGS) -o $@ $<
ftgxval.ppc.o: $(FTSRC)/base/ftgxval.c
$(CC) -c $(CFLAGS) -o $@ $<
ftmm.ppc.o: $(FTSRC)/base/ftmm.c
$(CC) -c $(CFLAGS) -o $@ $<
ftotval.ppc.o: $(FTSRC)/base/ftotval.c
$(CC) -c $(CFLAGS) -o $@ $<
ftpatent.ppc.o: $(FTSRC)/base/ftpatent.c
$(CC) -c $(CFLAGS) -o $@ $<
ftpfr.ppc.o: $(FTSRC)/base/ftpfr.c
$(CC) -c $(CFLAGS) -o $@ $<
ftstroke.ppc.o: $(FTSRC)/base/ftstroke.c
$(CC) -c $(CFLAGS) -o $@ $<
ftsynth.ppc.o: $(FTSRC)/base/ftsynth.c
$(CC) -c $(CFLAGS) -o $@ $<
fttype1.ppc.o: $(FTSRC)/base/fttype1.c
$(CC) -c $(CFLAGS) -o $@ $<
ftwinfnt.ppc.o: $(FTSRC)/base/ftwinfnt.c
$(CC) -c $(CFLAGS) -o $@ $<
#
# FreeType2 library autofitting module
#
autofit.ppc.o: $(FTSRC)/autofit/autofit.c
$(CC) -c $(CFLAGS) -o $@ $<
#
# FreeType2 library postscript hinting module
#
pshinter.ppc.o: $(FTSRC)/pshinter/pshinter.c
$(CC) -c $(CFLAGS) -o $@ $<
#
# FreeType2 library PS support module
#
psaux.ppc.o: $(FTSRC)/psaux/psaux.c
$(CC) -c $(CFLAGS) -o $@ $<
#
# FreeType2 library PS glyph names module
#
psnames.ppc.o: $(FTSRC)/psnames/psnames.c
$(CC) -c $(CFLAGS) -o $@ $<
#
# FreeType2 library monochrome raster module
#
raster.ppc.o: $(FTSRC)/raster/raster.c
$(CC) -c $(CFLAGS) -o $@ $<
#
# FreeType2 library anti-aliasing raster module
#
smooth.ppc.o: $(FTSRC)/smooth/smooth.c
$(CC) -c $(CFLAGS) -o $@ $<
#
# FreeType2 library 'sfnt' module
#
sfnt.ppc.o: $(FTSRC)/sfnt/sfnt.c
$(CC) -c $(CFLAGS) -o $@ $<
#
# FreeType2 library glyph and image caching system
#
ftcache.ppc.o: $(FTSRC)/cache/ftcache.c
$(CC) -c $(CFLAGS) -o $@ $<
#
# FreeType2 library OpenType font driver
#
cff.ppc.o: $(FTSRC)/cff/cff.c
$(CC) -c $(CFLAGS) -o $@ $<
#
# FreeType2 library TrueType font driver
#
truetype.ppc.o: $(FTSRC)/truetype/truetype.c
$(CC) -c $(CFLAGS) -o $@ $<
#
# FreeType2 library Type1 font driver
#
type1.ppc.o: $(FTSRC)/type1/type1.c
$(CC) -c $(CFLAGS) -o $@ $<
#
# FreeType2 library Type42 font driver
#
type42.ppc.o: $(FTSRC)/type42/type42.c
$(CC) -c $(CFLAGS) -o $@ $<
#
# FreeType2 library CID-keyed Type1 font driver
#
type1cid.ppc.o: $(FTSRC)/cid/type1cid.c
$(CC) -c $(CFLAGS) -o $@ $<
#
# FreeType2 library BDF bitmap font driver
#
bdf.ppc.o: $(FTSRC)/bdf/bdf.c
$(CC) -c $(CFLAGS) -o $@ $<
#
# FreeType2 library PCF bitmap font driver
#
pcf.ppc.o: $(FTSRC)/pcf/pcf.c
$(CC) -c $(CFLAGS) -o $@ $<
#
# FreeType2 library gzip support for compressed PCF bitmap fonts
#
gzip.ppc.o: $(FTSRC)/gzip/ftgzip.c
$(CC) -c $(CFLAGS) -o $@ $<
# FreeType2 library bzip2 support for compressed PCF bitmap fonts
#
bzip2.ppc.o: $(FTSRC)/bzip2/ftbzip2.c
$(CC) -c $(CFLAGS) -o $@ $<
#
# FreeType2 library compress support for compressed PCF bitmap fonts
#
lzw.ppc.o: $(FTSRC)/lzw/ftlzw.c
$(CC) -c $(CFLAGS) -o $@ $<
#
# FreeType2 library PFR font driver
#
pfr.ppc.o: $(FTSRC)/pfr/pfr.c
$(CC) -c $(CFLAGS) -o $@ $<
#
# FreeType2 library Windows FNT/FON bitmap font driver
#
winfnt.ppc.o: $(FTSRC)/winfonts/winfnt.c
$(CC) -c $(CFLAGS) -o $@ $<
#
# FreeType2 library TrueTypeGX Validator
#
gxvalid.ppc.o: $(FTSRC)/gxvalid/gxvalid.c
$(CC) -c $(CFLAGS) -o $@ $<
#
# FreeType2 library OpenType validator
#
otvalid.ppc.o: $(FTSRC)/otvalid/otvalid.c
$(CC) -c $(CFLAGS) -o $@ $<
BASEPPC = ftbase.ppc.o ftbbox.ppc.o ftbdf.ppc.o ftbitmap.ppc.o ftcid.ppc.o \
oftfstype.ppc.o ftgasp.ppc.o ftglyph.ppc.o \
ftgxval.ppc.o ftmm.ppc.o ftotval.ppc.o \
ftpatent.ppc.o ftpfr.ppc.o ftstroke.ppc.o ftsynth.ppc.o \
fttype1.ppc.o ftwinfnt.ppc.o
DEBUGPPC = ftdebug.ppc.o ftdebugpure.ppc.o
AFITPPC = autofit.ppc.o
GXVPPC = gxvalid.ppc.o
OTVPPC = otvalid.ppc.o
PSPPC = psaux.ppc.o psnames.ppc.o pshinter.ppc.o
RASTERPPC = raster.ppc.o smooth.ppc.o
FONTDPPC = cff.ppc.o type1.ppc.o type42.ppc.o type1cid.ppc.o truetype.ppc.o\
bdf.ppc.o pcf.ppc.o pfr.ppc.o winfnt.ppc.o
libft2_ppc.a: $(BASEPPC) $(AFITPPC) $(GXVPPC) $(OTVPPC) $(PSPPC) $(RASTERPPC) sfnt.ppc.o ftcache.ppc.o $(FONTDPPC) gzip.ppc.o bzip2.ppc.o lzw.ppc.o
$(AR) $@ $(BASEPPC) $(AFITPPC) $(GXVPPC) $(OTVPPC) $(PSPPC) $(RASTERPPC) sfnt.ppc.o ftcache.ppc.o $(FONTDPPC) gzip.ppc.o bzip2.ppc.o lzw.ppc.o
-@ ($(RANLIB) $@ || true) >/dev/null 2>&1
#Local Variables:
#coding: latin-1
#End:

297
builds/amiga/makefile.os4 Normal file
View File

@ -0,0 +1,297 @@
#
# Makefile for FreeType2 link library using gcc 4.0.3 from the
# AmigaOS4 SDK
#
# Copyright (C) 2005-2024 by
# Werner Lemberg and Detlef Würkner.
#
# This file is part of the FreeType project, and may only be used, modified,
# and distributed under the terms of the FreeType project license,
# LICENSE.TXT. By continuing to use, modify, or distribute this file you
# indicate that you have read the license and understand and accept it
# fully.
# to build from the builds/amiga directory call
#
# make -f makefile.os4
#
# Your programs source code should start with this
# (uncomment the parts you do not need to keep the program small):
# ---8<---
#define FT_USE_AUTOFIT // autofitter
#define FT_USE_RASTER // monochrome rasterizer
#define FT_USE_SMOOTH // anti-aliasing rasterizer
#define FT_USE_TT // truetype font driver
#define FT_USE_T1 // type1 font driver
#define FT_USE_T42 // type42 font driver
#define FT_USE_T1CID // cid-keyed type1 font driver
#define FT_USE_CFF // opentype font driver
#define FT_USE_BDF // bdf bitmap font driver
#define FT_USE_PCF // pcf bitmap font driver
#define FT_USE_PFR // pfr font driver
#define FT_USE_WINFNT // windows .fnt|.fon bitmap font driver
#define FT_USE_OTV // opentype validator
#define FT_USE_GXV // truetype gx validator
#include "FT:src/base/ftinit.c"
# ---8<---
#
# link your programs with libft2_ppc.a and either ftsystem.ppc.o or ftsystempure.ppc.o
# (and either ftdebug.ppc.o or ftdebugpure.ppc.o if you enabled FT_DEBUG_LEVEL_ERROR or
# FT_DEBUG_LEVEL_TRACE in include/freetype/config/ftoption.h).
all: assign libft2_ppc.a ftsystem.ppc.o ftsystempure.ppc.o
assign:
assign FT: //
CC = ppc-amigaos-gcc
AR = ppc-amigaos-ar
RANLIB = ppc-amigaos-ranlib
DIRFLAGS = -Iinclude -I/FT/src -I/FT/include -I/SDK/include
WARNINGS = -Wall -W -Wundef -Wpointer-arith -Wbad-function-cast \
-Waggregate-return -Wwrite-strings -Wshadow
OPTIONS = -DFT2_BUILD_LIBRARY -DNDEBUG -fno-builtin
OPTIMIZE = -O2 -fomit-frame-pointer -fstrength-reduce -finline-functions
CFLAGS = -mcrt=clib2 $(DIRFLAGS) $(WARNINGS) $(FT2FLAGS) $(OPTIONS) $(OPTIMIZE)
#
# FreeType2 library base
#
ftbase.ppc.o: FT:src/base/ftbase.c
$(CC) -c $(CFLAGS) -o $@ /FT/src/base/ftbase.c
ftinit.ppc.o: FT:src/base/ftinit.c
$(CC) -c $(CFLAGS) -o $@ /FT/src/base/ftinit.c
ftsystem.ppc.o: FT:src/base/ftsystem.c
$(CC) -c $(CFLAGS) -o $@ /FT/src/base/ftsystem.c
# pure version for use in run-time library etc
ftsystempure.ppc.o: src/base/ftsystem.c
$(CC) -c $(CFLAGS) -o $@ src/base/ftsystem.c
#
# FreeType2 library base extensions
#
ftbbox.ppc.o: FT:src/base/ftbbox.c
$(CC) -c $(CFLAGS) -o $@ /FT/src/base/ftbbox.c
ftbdf.ppc.o: FT:src/base/ftbdf.c
$(CC) -c $(CFLAGS) -o $@ /FT/src/base/ftbdf.c
ftbitmap.ppc.o: FT:src/base/ftbitmap.c
$(CC) -c $(CFLAGS) -o $@ /FT/src/base/ftbitmap.c
ftcid.ppc.o: FT:src/base/ftcid.c
$(CC) -c $(CFLAGS) -o $@ /FT/src/base/ftcid.c
ftdebug.ppc.o: FT:src/base/ftdebug.c
$(CC) -c $(CFLAGS) -o $@ /FT/src/base/ftdebug.c
# pure version for use in run-time library etc
ftdebugpure.ppc.o: src/base/ftdebug.c
$(CC) -c $(CFLAGS) -o $@ src/base/ftdebug.c
ftfstype.ppc.o: FT:src/base/ftfstype.c
$(CC) -c $(CFLAGS) -o $@ /FT/src/base/ftfstype.c
ftgasp.ppc.o: FT:src/base/ftgasp.c
$(CC) -c $(CFLAGS) -o $@ /FT/src/base/ftgasp.c
ftglyph.ppc.o: FT:src/base/ftglyph.c
$(CC) -c $(CFLAGS) -o $@ /FT/src/base/ftglyph.c
ftgxval.ppc.o: FT:src/base/ftgxval.c
$(CC) -c $(CFLAGS) -o $@ /FT/src/base/ftgxval.c
ftmm.ppc.o: FT:src/base/ftmm.c
$(CC) -c $(CFLAGS) -o $@ /FT/src/base/ftmm.c
ftotval.ppc.o: FT:src/base/ftotval.c
$(CC) -c $(CFLAGS) -o $@ /FT/src/base/ftotval.c
ftpatent.ppc.o: FT:src/base/ftpatent.c
$(CC) -c $(CFLAGS) -o $@ /FT/src/base/ftpatent.c
ftpfr.ppc.o: FT:src/base/ftpfr.c
$(CC) -c $(CFLAGS) -o $@ /FT/src/base/ftpfr.c
ftstroke.ppc.o: FT:src/base/ftstroke.c
$(CC) -c $(CFLAGS) -o $@ /FT/src/base/ftstroke.c
ftsynth.ppc.o: FT:src/base/ftsynth.c
$(CC) -c $(CFLAGS) -o $@ /FT/src/base/ftsynth.c
fttype1.ppc.o: FT:src/base/fttype1.c
$(CC) -c $(CFLAGS) -o $@ /FT/src/base/fttype1.c
ftwinfnt.ppc.o: FT:src/base/ftwinfnt.c
$(CC) -c $(CFLAGS) -o $@ /FT/src/base/ftwinfnt.c
#
# FreeType2 library autofitting module
#
autofit.ppc.o: FT:src/autofit/autofit.c
$(CC) -c $(CFLAGS) -o $@ /FT/src/autofit/autofit.c
#
# FreeType2 library postscript hinting module
#
pshinter.ppc.o: FT:src/pshinter/pshinter.c
$(CC) -c $(CFLAGS) -o $@ /FT/src/pshinter/pshinter.c
#
# FreeType2 library PS support module
#
psaux.ppc.o: FT:src/psaux/psaux.c
$(CC) -c $(CFLAGS) -o $@ /FT/src/psaux/psaux.c
#
# FreeType2 library PS glyph names module
#
psnames.ppc.o: FT:src/psnames/psnames.c
$(CC) -c $(CFLAGS) -o $@ /FT/src/psnames/psnames.c
#
# FreeType2 library monochrome raster module
#
raster.ppc.o: FT:src/raster/raster.c
$(CC) -c $(CFLAGS) -o $@ /FT/src/raster/raster.c
#
# FreeType2 library anti-aliasing raster module
#
smooth.ppc.o: FT:src/smooth/smooth.c
$(CC) -c $(CFLAGS) -o $@ /FT/src/smooth/smooth.c
#
# FreeType2 library 'sfnt' module
#
sfnt.ppc.o: FT:src/sfnt/sfnt.c
$(CC) -c $(CFLAGS) -o $@ /FT/src/sfnt/sfnt.c
#
# FreeType2 library glyph and image caching system
#
ftcache.ppc.o: FT:src/cache/ftcache.c
$(CC) -c $(CFLAGS) -o $@ /FT/src/cache/ftcache.c
#
# FreeType2 library OpenType font driver
#
cff.ppc.o: FT:src/cff/cff.c
$(CC) -c $(CFLAGS) -o $@ /FT/src/cff/cff.c
#
# FreeType2 library TrueType font driver
#
truetype.ppc.o: FT:src/truetype/truetype.c
$(CC) -c $(CFLAGS) -o $@ /FT/src/truetype/truetype.c
#
# FreeType2 library Type1 font driver
#
type1.ppc.o: FT:src/type1/type1.c
$(CC) -c $(CFLAGS) -o $@ /FT/src/type1/type1.c
#
# FreeType2 library Type42 font driver
#
type42.ppc.o: FT:src/type42/type42.c
$(CC) -c $(CFLAGS) -o $@ /FT/src/type42/type42.c
#
# FreeType2 library CID-keyed Type1 font driver
#
type1cid.ppc.o: FT:src/cid/type1cid.c
$(CC) -c $(CFLAGS) -o $@ /FT/src/cid/type1cid.c
#
# FreeType2 library BDF bitmap font driver
#
bdf.ppc.o: FT:src/bdf/bdf.c
$(CC) -c $(CFLAGS) -o $@ /FT/src/bdf/bdf.c
#
# FreeType2 library PCF bitmap font driver
#
pcf.ppc.o: FT:src/pcf/pcf.c
$(CC) -c $(CFLAGS) -o $@ /FT/src/pcf/pcf.c
#
# FreeType2 library gzip support for compressed PCF bitmap fonts
#
gzip.ppc.o: FT:src/gzip/ftgzip.c
$(CC) -c $(CFLAGS) -o $@ /FT/src/gzip/ftgzip.c
#
# FreeType2 library bzip2 support for compressed PCF bitmap fonts
#
bzip2.ppc.o: FT:src/bzip2/ftbzip2.c
$(CC) -c $(CFLAGS) -o $@ /FT/src/bzip2/ftbzip2.c
#
# FreeType2 library compress support for compressed PCF bitmap fonts
#
lzw.ppc.o: FT:src/lzw/ftlzw.c
$(CC) -c $(CFLAGS) -o $@ /FT/src/lzw/ftlzw.c
#
# FreeType2 library PFR font driver
#
pfr.ppc.o: FT:src/pfr/pfr.c
$(CC) -c $(CFLAGS) -o $@ /FT/src/pfr/pfr.c
#
# FreeType2 library Windows FNT/FON bitmap font driver
#
winfnt.ppc.o: FT:src/winfonts/winfnt.c
$(CC) -c $(CFLAGS) -o $@ /FT/src/winfonts/winfnt.c
#
# FreeType2 library TrueTypeGX Validator
#
gxvalid.ppc.o: FT:src/gxvalid/gxvalid.c
$(CC) -c $(CFLAGS) -Wno-aggregate-return -o $@ /FT/src/gxvalid/gxvalid.c
#
# FreeType2 library OpenType validator
#
otvalid.ppc.o: FT:src/otvalid/otvalid.c
$(CC) -c $(CFLAGS) -o $@ /FT/src/otvalid/otvalid.c
BASE = ftbase.ppc.o ftbbox.ppc.o ftbdf.ppc.o ftbitmap.ppc.o ftcid.ppc.o \
ftfstype.ppc.o ftgasp.ppc.o ftglyph.ppc.o \
ftgxval.ppc.o ftmm.ppc.o ftotval.ppc.o \
ftpatent.ppc.o ftpfr.ppc.o ftstroke.ppc.o ftsynth.ppc.o \
fttype1.ppc.o ftwinfnt.ppc.o
DEBUG = ftdebug.ppc.o ftdebugpure.ppc.o
AFIT = autofit.ppc.o
GXV = gxvalid.ppc.o
OTV = otvalid.ppc.o
PS = psaux.ppc.o psnames.ppc.o pshinter.ppc.o
RASTER = raster.ppc.o smooth.ppc.o
FONTD = cff.ppc.o type1.ppc.o type42.ppc.o type1cid.ppc.o truetype.ppc.o\
bdf.ppc.o pcf.ppc.o pfr.ppc.o winfnt.ppc.o
libft2_ppc.a: $(BASE) $(AFIT) $(GXV) $(OTV) $(PS) $(RASTER) sfnt.ppc.o ftcache.ppc.o $(FONTD) gzip.ppc.o lzw.ppc.o
$(AR) r $@ $(BASE) $(AFIT) $(GXV) $(OTV) $(PS) $(RASTER) sfnt.ppc.o ftcache.ppc.o $(FONTD) gzip.ppc.o lzw.ppc.o
$(RANLIB) $@
#Local Variables:
#coding: latin-1
#End:

299
builds/amiga/smakefile Normal file
View File

@ -0,0 +1,299 @@
#
# Makefile for FreeType2 link library using Amiga SAS/C 6.58
#
# Copyright (C) 2005-2024 by
# Werner Lemberg and Detlef Würkner.
#
# This file is part of the FreeType project, and may only be used, modified,
# and distributed under the terms of the FreeType project license,
# LICENSE.TXT. By continuing to use, modify, or distribute this file you
# indicate that you have read the license and understand and accept it
# fully.
# to build from the builds/amiga directory call
#
# smake assign
# smake
#
# Your programs source code should start with this
# (uncomment the parts you do not need to keep the program small):
# ---8<---
#define FT_USE_AUTOFIT // autofitter
#define FT_USE_RASTER // monochrome rasterizer
#define FT_USE_SMOOTH // anti-aliasing rasterizer
#define FT_USE_TT // truetype font driver
#define FT_USE_T1 // type1 font driver
#define FT_USE_T42 // type42 font driver
#define FT_USE_T1CID // cid-keyed type1 font driver
#define FT_USE_CFF // opentype font driver
#define FT_USE_BDF // bdf bitmap font driver
#define FT_USE_PCF // pcf bitmap font driver
#define FT_USE_PFR // pfr font driver
#define FT_USE_WINFNT // windows .fnt|.fon bitmap font driver
#define FT_USE_OTV // opentype validator
#define FT_USE_GXV // truetype gx validator
#include "FT:src/base/ftinit.c"
# ---8<---
#
# link your programs with ft2_680x0.lib and either ftsystem.o or ftsystempure.o
# (and either ftdebug.o or ftdebugpure.o if you enabled FT_DEBUG_LEVEL_ERROR or
# FT_DEBUG_LEVEL_TRACE in include/freetype/config/ftoption.h).
OBJBASE = ftbase.o ftbbox.o ftbdf.o ftbitmap.o ftcid.o ftfstype.o \
ftgasp.o ftglyph.o ftgxval.o ftmm.o ftotval.o \
ftpatent.o ftpfr.o ftstroke.o ftsynth.o fttype1.o ftwinfnt.o
OBJSYSTEM = ftsystem.o ftsystempure.o
OBJDEBUG = ftdebug.o ftdebugpure.o
OBJAFIT = autofit.o
OBJGXV = gxvalid.o
OBJOTV = otvalid.o
OBJPS = psaux.o psnames.o pshinter.o
OBJRASTER = raster.o smooth.o
OBJSFNT = sfnt.o
OBJCACHE = ftcache.o
OBJFONTD = cff.o type1.o type42.o type1cid.o\
truetype.o winfnt.o bdf.o pcf.o pfr.o
CORE = FT:src/
CPU = 68000
#CPU = 68020
#CPU = 68030
#CPU = 68040
#CPU = 68060
OPTIMIZER = optinlocal
SCFLAGS = optimize opttime optsched strmerge data=faronly idlen=50 cpu=$(CPU)\
idir=include/ idir=$(CORE) idir=FT:include/ nostackcheck nochkabort\
noicons ignore=79,85,110,306 parameters=both define=FT2_BUILD_LIBRARY
LIB = ft2_$(CPU).lib
# sample linker options
OPTS = link lib=$(LIB),lib:sc.lib,lib:amiga.lib,lib:debug.lib\
smallcode smalldata noicons utillib
# sample program entry
#myprog: myprog.c ftsystem.o $(LIB)
# sc $< programname=$@ ftsystem.o $(SCFLAGS) $(OPTS)
all: $(LIB) $(OBJSYSTEM) $(OBJDEBUG)
assign:
assign FT: //
# uses separate object modules in lib to make for easier debugging
# also, can make smaller programs if entire engine is not used
ft2_$(CPU).lib: $(OBJBASE) $(OBJAFIT) $(OBJOTV) $(OBJPS) $(OBJRASTER) $(OBJSFNT) $(OBJCACHE) $(OBJFONTD) lzw.o gzip.o bzip2.o
oml $@ r $(OBJBASE) $(OBJAFIT) $(OBJOTV) $(OBJPS) $(OBJRASTER) $(OBJSFNT) $(OBJCACHE) $(OBJFONTD) lzw.o gzip.o bzip2.o
clean:
-delete \#?.o
realclean: clean
-delete ft2$(CPU).lib
#
# freetype library base
#
ftbase.o: $(CORE)base/ftbase.c
sc $(SCFLAGS) objname=$@ $<
ftinit.o: $(CORE)base/ftinit.c
sc $(SCFLAGS) objname=$@ $<
ftsystem.o: $(CORE)base/ftsystem.c
sc $(SCFLAGS) objname=$@ $<
ftsystempure.o: src/base/ftsystem.c ## pure version for use in run-time library etc
sc $(SCFLAGS) objname=$@ $<
ftdebug.o: $(CORE)base/ftdebug.c
sc $(SCFLAGS) objname=$@ $<
ftdebugpure.o: src/base/ftdebug.c ## pure version for use in run-time library etc
sc $(SCFLAGS) objname=$@ $<
#
# freetype library base extensions
#
ftbbox.o: $(CORE)base/ftbbox.c
sc $(SCFLAGS) objname=$@ $<
ftbdf.o: $(CORE)base/ftbdf.c
sc $(SCFLAGS) objname=$@ $<
ftbitmap.o: $(CORE)base/ftbitmap.c
sc $(SCFLAGS) objname=$@ $<
ftcid.o: $(CORE)base/ftcid.c
sc $(SCFLAGS) objname=$@ $<
ftfstype.o: $(CORE)base/ftfstype.c
sc $(SCFLAGS) objname=$@ $<
ftgasp.o: $(CORE)base/ftgasp.c
sc $(SCFLAGS) objname=$@ $<
ftglyph.o: $(CORE)base/ftglyph.c
sc $(SCFLAGS) objname=$@ $<
ftgxval.o: $(CORE)base/ftgxval.c
sc $(SCFLAGS) objname=$@ $<
ftmm.o: $(CORE)base/ftmm.c
sc $(SCFLAGS) objname=$@ $<
ftotval.o: $(CORE)base/ftotval.c
sc $(SCFLAGS) objname=$@ $<
ftpatent.o: $(CORE)base/ftpatent.c
sc $(SCFLAGS) objname=$@ $<
ftpfr.o: $(CORE)base/ftpfr.c
sc $(SCFLAGS) objname=$@ $<
ftstroke.o: $(CORE)base/ftstroke.c
sc $(SCFLAGS) objname=$@ $<
ftsynth.o: $(CORE)base/ftsynth.c
sc $(SCFLAGS) objname=$@ $<
fttype1.o: $(CORE)base/fttype1.c
sc $(SCFLAGS) objname=$@ $<
ftwinfnt.o: $(CORE)base/ftwinfnt.c
sc $(SCFLAGS) objname=$@ $<
#
# freetype library autofitter module
#
autofit.o: $(CORE)autofit/autofit.c
sc $(SCFLAGS) objname=$@ $<
#
# freetype library PS hinting module
#
pshinter.o: $(CORE)pshinter/pshinter.c
sc $(SCFLAGS) objname=$@ $<
#
# freetype library PS support module
#
psaux.o: $(CORE)psaux/psaux.c
sc $(SCFLAGS) objname=$@ $<
#
# freetype library PS glyph names module
#
psnames.o: $(CORE)psnames/psnames.c
sc $(SCFLAGS) code=far objname=$@ $<
#
# freetype library monochrome raster module
#
raster.o: $(CORE)raster/raster.c
sc $(SCFLAGS) objname=$@ $<
#
# freetype library anti-aliasing raster module
#
smooth.o: $(CORE)smooth/smooth.c
sc $(SCFLAGS) objname=$@ $<
#
# freetype library 'sfnt' module
#
sfnt.o: $(CORE)sfnt/sfnt.c
sc $(SCFLAGS) objname=$@ $<
#
# freetype library glyph and image caching system (still experimental)
#
ftcache.o: $(CORE)cache/ftcache.c
sc $(SCFLAGS) objname=$@ $<
#
# freetype library OpenType font driver
#
cff.o: $(CORE)cff/cff.c
sc $(SCFLAGS) objname=$@ $<
#
# freetype library TrueType font driver
#
truetype.o: $(CORE)truetype/truetype.c
sc $(SCFLAGS) objname=$@ $<
#
# freetype library Type1 font driver
#
type1.o: $(CORE)type1/type1.c
sc $(SCFLAGS) objname=$@ $<
#
# FreeType2 library Type42 font driver
#
type42.o: $(CORE)type42/type42.c
sc $(SCFLAGS) objname=$@ $<
#
# freetype library CID-keyed Type1 font driver
#
type1cid.o: $(CORE)cid/type1cid.c
sc $(SCFLAGS) objname=$@ $<
#
# freetype library CID-keyed Type1 font driver extensions
#
#cidafm.o: $(CORE)cid/cidafm.c
# sc $(SCFLAGS) objname=$@ $<
#
# freetype library BDF bitmap font driver
#
bdf.o: $(CORE)bdf/bdf.c
sc $(SCFLAGS) objname=$@ $<
#
# freetype library PCF bitmap font driver
#
pcf.o: $(CORE)pcf/pcf.c
sc $(SCFLAGS) objname=$@ $<
#
# freetype library gzip support for compressed PCF bitmap fonts
#
gzip.o: $(CORE)gzip/ftgzip.c
sc $(SCFLAGS) define FAR objname=$@ $<
#
# freetype library bzip2 support for compressed PCF bitmap fonts
#
bzip2.o: $(CORE)bzip2/ftbzip2.c
sc $(SCFLAGS) define FAR objname=$@ $<
#
# freetype library compress support for compressed PCF bitmap fonts
#
lzw.o: $(CORE)lzw/ftlzw.c
sc $(SCFLAGS) objname=$@ $<
#
# freetype library PFR font driver
#
pfr.o: $(CORE)pfr/pfr.c
sc $(SCFLAGS) objname=$@ $<
#
# freetype library Windows FNT/FON bitmap font driver
#
winfnt.o: $(CORE)winfonts/winfnt.c
sc $(SCFLAGS) objname=$@ $<
#
# freetype library TrueTypeGX validator
#
gxvalid.o: $(CORE)gxvalid/gxvalid.c
sc $(SCFLAGS) objname=$@ $<
#
# freetype library OpenType validator
#
otvalid.o: $(CORE)otvalid/otvalid.c
sc $(SCFLAGS) objname=$@ $<
#Local Variables:
#coding: latin-1
#End:

View File

@ -0,0 +1,348 @@
/****************************************************************************
*
* ftdebug.c
*
* Debugging and logging component for amiga (body).
*
* Copyright (C) 1996-2024 by
* David Turner, Robert Wilhelm, Werner Lemberg, and Detlef Wuerkner.
*
* This file is part of the FreeType project, and may only be used,
* modified, and distributed under the terms of the FreeType project
* license, LICENSE.TXT. By continuing to use, modify, or distribute
* this file you indicate that you have read the license and
* understand and accept it fully.
*
*/
/**************************************************************************
*
* This component contains various macros and functions used to ease the
* debugging of the FreeType engine. Its main purpose is in assertion
* checking, tracing, and error detection.
*
* There are now three debugging modes:
*
* - trace mode
*
* Error and trace messages are sent to the log file (which can be the
* standard error output).
*
* - error mode
*
* Only error messages are generated.
*
* - release mode:
*
* No error message is sent or generated. The code is free from any
* debugging parts.
*
*/
/*
* Based on the default `ftdebug.c' file,
* replaced `vprintf' with `KVPrintF',
* commented out `exit',
* replaced `getenv' with `GetVar'.
*/
#include <exec/types.h>
#include <utility/tagitem.h>
#include <dos/exall.h>
#include <dos/var.h>
#define __NOLIBBASE__
#define __NOLOBALIFACE__
#define __USE_INLINE__
#include <proto/dos.h>
#include <clib/debug_protos.h>
#ifndef __amigaos4__
extern struct Library* DOSBase;
#else
extern struct DOSIFace* IDOS;
#endif
#include <ft2build.h>
#include <freetype/freetype.h>
#include <freetype/internal/ftdebug.h>
#ifdef FT_DEBUG_LEVEL_ERROR
/* documentation is in ftdebug.h */
FT_BASE_DEF( void )
FT_Message( const char* fmt,
... )
{
va_list ap;
va_start( ap, fmt );
KVPrintF( fmt, ap );
va_end( ap );
}
/* documentation is in ftdebug.h */
FT_BASE_DEF( void )
FT_Panic( const char* fmt,
... )
{
va_list ap;
va_start( ap, fmt );
KVPrintF( fmt, ap );
va_end( ap );
/* exit( EXIT_FAILURE ); */
}
/* documentation is in ftdebug.h */
FT_BASE_DEF( int )
FT_Throw( FT_Error error,
int line,
const char* file )
{
#if 0
/* activating the code in this block makes FreeType very chatty */
fprintf( stderr,
"%s:%d: error 0x%02x: %s\n",
file,
line,
error,
FT_Error_String( error ) );
#else
FT_UNUSED( error );
FT_UNUSED( line );
FT_UNUSED( file );
#endif
return 0;
}
#endif /* FT_DEBUG_LEVEL_ERROR */
#ifdef FT_DEBUG_LEVEL_TRACE
/* array of trace levels, initialized to 0; */
/* this gets adjusted at run-time */
static int ft_trace_levels_enabled[trace_count];
/* array of trace levels, always initialized to 0 */
static int ft_trace_levels_disabled[trace_count];
/* a pointer to either `ft_trace_levels_enabled' */
/* or `ft_trace_levels_disabled' */
int* ft_trace_levels;
/* define array of trace toggle names */
#define FT_TRACE_DEF( x ) #x ,
static const char* ft_trace_toggles[trace_count + 1] =
{
#include <freetype/internal/fttrace.h>
NULL
};
#undef FT_TRACE_DEF
/* documentation is in ftdebug.h */
FT_BASE_DEF( FT_Int )
FT_Trace_Get_Count( void )
{
return trace_count;
}
/* documentation is in ftdebug.h */
FT_BASE_DEF( const char * )
FT_Trace_Get_Name( FT_Int idx )
{
int max = FT_Trace_Get_Count();
if ( idx < max )
return ft_trace_toggles[idx];
else
return NULL;
}
/* documentation is in ftdebug.h */
FT_BASE_DEF( void )
FT_Trace_Disable( void )
{
ft_trace_levels = ft_trace_levels_disabled;
}
/* documentation is in ftdebug.h */
FT_BASE_DEF( void )
FT_Trace_Enable( void )
{
ft_trace_levels = ft_trace_levels_enabled;
}
/**************************************************************************
*
* Initialize the tracing sub-system. This is done by retrieving the
* value of the `FT2_DEBUG' environment variable. It must be a list of
* toggles, separated by spaces, `;', or `,'. Example:
*
* export FT2_DEBUG="any:3 memory:7 stream:5"
*
* This requests that all levels be set to 3, except the trace level for
* the memory and stream components which are set to 7 and 5,
* respectively.
*
* See the file `include/freetype/internal/fttrace.h' for details of
* the available toggle names.
*
* The level must be between 0 and 7; 0 means quiet (except for serious
* runtime errors), and 7 means _very_ verbose.
*/
FT_BASE_DEF( void )
ft_debug_init( void )
{
/* const char* ft2_debug = ft_getenv( "FT2_DEBUG" ); */
char buf[256];
const char* ft2_debug = &buf[0];
/* if ( ft2_debug ) */
if ( GetVar( "FT2_DEBUG", (STRPTR)ft2_debug, 256, LV_VAR ) > 0 )
{
const char* p = ft2_debug;
const char* q;
for ( ; *p; p++ )
{
/* skip leading whitespace and separators */
if ( *p == ' ' || *p == '\t' || *p == ',' || *p == ';' || *p == '=' )
continue;
/* read toggle name, followed by ':' */
q = p;
while ( *p && *p != ':' )
p++;
if ( !*p )
break;
if ( *p == ':' && p > q )
{
FT_Int n, i, len = (FT_Int)( p - q );
FT_Int level = -1, found = -1;
for ( n = 0; n < trace_count; n++ )
{
const char* toggle = ft_trace_toggles[n];
for ( i = 0; i < len; i++ )
{
if ( toggle[i] != q[i] )
break;
}
if ( i == len && toggle[i] == 0 )
{
found = n;
break;
}
}
/* read level */
p++;
if ( *p )
{
level = *p - '0';
if ( level < 0 || level > 7 )
level = -1;
}
if ( found >= 0 && level >= 0 )
{
if ( found == trace_any )
{
/* special case for `any' */
for ( n = 0; n < trace_count; n++ )
ft_trace_levels_enabled[n] = level;
}
else
ft_trace_levels_enabled[found] = level;
}
}
}
}
ft_trace_levels = ft_trace_levels_enabled;
}
#else /* !FT_DEBUG_LEVEL_TRACE */
FT_BASE_DEF( void )
ft_debug_init( void )
{
/* nothing */
}
FT_BASE_DEF( FT_Int )
FT_Trace_Get_Count( void )
{
return 0;
}
FT_BASE_DEF( const char * )
FT_Trace_Get_Name( FT_Int idx )
{
FT_UNUSED( idx );
return NULL;
}
FT_BASE_DEF( void )
FT_Trace_Disable( void )
{
/* nothing */
}
/* documentation is in ftdebug.h */
FT_BASE_DEF( void )
FT_Trace_Enable( void )
{
/* nothing */
}
#endif /* !FT_DEBUG_LEVEL_TRACE */
/* END */

View File

@ -0,0 +1,530 @@
/***************************************************************************/
/* */
/* ftsystem.c */
/* */
/* Amiga-specific FreeType low-level system interface (body). */
/* */
/* Copyright (C) 1996-2024 by */
/* David Turner, Robert Wilhelm, Werner Lemberg and Detlef Würkner. */
/* */
/* This file is part of the FreeType project, and may only be used, */
/* modified, and distributed under the terms of the FreeType project */
/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
/* this file you indicate that you have read the license and */
/* understand and accept it fully. */
/* */
/***************************************************************************/
/*************************************************************************/
/* */
/* This file contains the Amiga interface used by FreeType to access */
/* low-level, i.e. memory management, i/o access as well as thread */
/* synchronisation. */
/* */
/*************************************************************************/
/*************************************************************************/
/* */
/* Maintained by Detlef Würkner <TetiSoft@apg.lahn.de> */
/* */
/* Based on the original ftsystem.c, */
/* modified to avoid fopen(), fclose(), fread(), fseek(), ftell(), */
/* malloc(), realloc(), and free(). */
/* */
/* Those C library functions are often not thread-safe or cant be */
/* used in a shared Amiga library. If that's not a problem for you, */
/* you can of course use the default ftsystem.c with C library calls */
/* instead. */
/* */
/* This implementation needs exec V39+ because it uses AllocPooled() etc */
/* */
/*************************************************************************/
#define __NOLIBBASE__
#define __NOGLOBALIFACE__
#define __USE_INLINE__
#include <proto/exec.h>
#include <dos/stdio.h>
#include <proto/dos.h>
#ifdef __amigaos4__
extern struct ExecIFace *IExec;
extern struct DOSIFace *IDOS;
#else
extern struct Library *SysBase;
extern struct Library *DOSBase;
#endif
#define IOBUF_SIZE 512
/* structure that helps us to avoid
* useless calls of Seek() and Read()
*/
struct SysFile
{
BPTR file;
ULONG iobuf_start;
ULONG iobuf_end;
UBYTE iobuf[IOBUF_SIZE];
};
#ifndef __amigaos4__
/* C implementation of AllocVecPooled (see autodoc exec/AllocPooled) */
APTR
Alloc_VecPooled( APTR poolHeader,
ULONG memSize )
{
ULONG newSize = memSize + sizeof ( ULONG );
ULONG *mem = AllocPooled( poolHeader, newSize );
if ( !mem )
return NULL;
*mem = newSize;
return mem + 1;
}
/* C implementation of FreeVecPooled (see autodoc exec/AllocPooled) */
void
Free_VecPooled( APTR poolHeader,
APTR memory )
{
ULONG *realmem = (ULONG *)memory - 1;
FreePooled( poolHeader, realmem, *realmem );
}
#endif
#include <ft2build.h>
#include FT_CONFIG_CONFIG_H
#include <freetype/internal/ftdebug.h>
#include <freetype/ftsystem.h>
#include <freetype/fterrors.h>
#include <freetype/fttypes.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/*************************************************************************/
/* */
/* MEMORY MANAGEMENT INTERFACE */
/* */
/*************************************************************************/
/*************************************************************************/
/* */
/* It is not necessary to do any error checking for the */
/* allocation-related functions. This is done by the higher level */
/* routines like ft_mem_alloc() or ft_mem_realloc(). */
/* */
/*************************************************************************/
/*************************************************************************/
/* */
/* <Function> */
/* ft_alloc */
/* */
/* <Description> */
/* The memory allocation function. */
/* */
/* <Input> */
/* memory :: A pointer to the memory object. */
/* */
/* size :: The requested size in bytes. */
/* */
/* <Return> */
/* The address of newly allocated block. */
/* */
FT_CALLBACK_DEF( void* )
ft_alloc( FT_Memory memory,
long size )
{
#ifdef __amigaos4__
return AllocVecPooled( memory->user, size );
#else
return Alloc_VecPooled( memory->user, size );
#endif
}
/*************************************************************************/
/* */
/* <Function> */
/* ft_realloc */
/* */
/* <Description> */
/* The memory reallocation function. */
/* */
/* <Input> */
/* memory :: A pointer to the memory object. */
/* */
/* cur_size :: The current size of the allocated memory block. */
/* */
/* new_size :: The newly requested size in bytes. */
/* */
/* block :: The current address of the block in memory. */
/* */
/* <Return> */
/* The address of the reallocated memory block. */
/* */
FT_CALLBACK_DEF( void* )
ft_realloc( FT_Memory memory,
long cur_size,
long new_size,
void* block )
{
void* new_block;
#ifdef __amigaos4__
new_block = AllocVecPooled ( memory->user, new_size );
#else
new_block = Alloc_VecPooled ( memory->user, new_size );
#endif
if ( new_block != NULL )
{
CopyMem ( block, new_block,
( new_size > cur_size ) ? cur_size : new_size );
#ifdef __amigaos4__
FreeVecPooled ( memory->user, block );
#else
Free_VecPooled ( memory->user, block );
#endif
}
return new_block;
}
/*************************************************************************/
/* */
/* <Function> */
/* ft_free */
/* */
/* <Description> */
/* The memory release function. */
/* */
/* <Input> */
/* memory :: A pointer to the memory object. */
/* */
/* block :: The address of block in memory to be freed. */
/* */
FT_CALLBACK_DEF( void )
ft_free( FT_Memory memory,
void* block )
{
#ifdef __amigaos4__
FreeVecPooled( memory->user, block );
#else
Free_VecPooled( memory->user, block );
#endif
}
/*************************************************************************/
/* */
/* RESOURCE MANAGEMENT INTERFACE */
/* */
/*************************************************************************/
/*************************************************************************/
/* */
/* The macro FT_COMPONENT is used in trace mode. It is an implicit */
/* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */
/* messages during execution. */
/* */
#undef FT_COMPONENT
#define FT_COMPONENT io
/* We use the macro STREAM_FILE for convenience to extract the */
/* system-specific stream handle from a given FreeType stream object */
#define STREAM_FILE( stream ) ( (struct SysFile *)stream->descriptor.pointer )
/*************************************************************************/
/* */
/* <Function> */
/* ft_amiga_stream_close */
/* */
/* <Description> */
/* The function to close a stream. */
/* */
/* <Input> */
/* stream :: A pointer to the stream object. */
/* */
FT_CALLBACK_DEF( void )
ft_amiga_stream_close( FT_Stream stream )
{
struct SysFile* sysfile;
sysfile = STREAM_FILE( stream );
Close ( sysfile->file );
FreeMem ( sysfile, sizeof ( struct SysFile ));
stream->descriptor.pointer = NULL;
stream->size = 0;
stream->base = NULL;
}
/*************************************************************************/
/* */
/* <Function> */
/* ft_amiga_stream_io */
/* */
/* <Description> */
/* The function to open a stream. */
/* */
/* <Input> */
/* stream :: A pointer to the stream object. */
/* */
/* offset :: The position in the data stream to start reading. */
/* */
/* buffer :: The address of buffer to store the read data. */
/* */
/* count :: The number of bytes to read from the stream. */
/* */
/* <Return> */
/* The number of bytes actually read. */
/* */
FT_CALLBACK_DEF( unsigned long )
ft_amiga_stream_io( FT_Stream stream,
unsigned long offset,
unsigned char* buffer,
unsigned long count )
{
struct SysFile* sysfile;
unsigned long read_bytes;
if ( count != 0 )
{
sysfile = STREAM_FILE( stream );
/* handle the seek */
if ( (offset < sysfile->iobuf_start) || (offset + count > sysfile->iobuf_end) )
{
/* requested offset implies we need a buffer refill */
if ( !sysfile->iobuf_end || offset != sysfile->iobuf_end )
{
/* a physical seek is necessary */
Seek( sysfile->file, offset, OFFSET_BEGINNING );
}
sysfile->iobuf_start = offset;
sysfile->iobuf_end = 0; /* trigger a buffer refill */
}
/* handle the read */
if ( offset + count <= sysfile->iobuf_end )
{
/* we have buffer and requested bytes are all inside our buffer */
CopyMem( &sysfile->iobuf[offset - sysfile->iobuf_start], buffer, count );
read_bytes = count;
}
else
{
/* (re)fill buffer */
if ( count <= IOBUF_SIZE )
{
/* requested bytes is a subset of the buffer */
read_bytes = Read( sysfile->file, sysfile->iobuf, IOBUF_SIZE );
if ( read_bytes == -1UL )
{
/* error */
read_bytes = 0;
}
else
{
sysfile->iobuf_end = offset + read_bytes;
CopyMem( sysfile->iobuf, buffer, count );
if ( read_bytes > count )
{
read_bytes = count;
}
}
}
else
{
/* we actually need more than our buffer can hold, so we decide
** to do a single big read, and then copy the last IOBUF_SIZE
** bytes of that to our internal buffer for later use */
read_bytes = Read( sysfile->file, buffer, count );
if ( read_bytes == -1UL )
{
/* error */
read_bytes = 0;
}
else
{
ULONG bufsize;
bufsize = ( read_bytes > IOBUF_SIZE ) ? IOBUF_SIZE : read_bytes;
sysfile->iobuf_end = offset + read_bytes;
sysfile->iobuf_start = sysfile->iobuf_end - bufsize;
CopyMem( &buffer[read_bytes - bufsize] , sysfile->iobuf, bufsize );
}
}
}
}
else
{
read_bytes = 0;
}
return read_bytes;
}
/* documentation is in ftobjs.h */
FT_BASE_DEF( FT_Error )
FT_Stream_Open( FT_Stream stream,
const char* filepathname )
{
struct FileInfoBlock* fib;
struct SysFile* sysfile;
if ( !stream )
return FT_THROW( Invalid_Stream_Handle );
#ifdef __amigaos4__
sysfile = AllocMem ( sizeof (struct SysFile ), MEMF_SHARED );
#else
sysfile = AllocMem ( sizeof (struct SysFile ), MEMF_PUBLIC );
#endif
if ( !sysfile )
{
FT_ERROR(( "FT_Stream_Open:" ));
FT_ERROR(( " could not open `%s'\n", filepathname ));
return FT_THROW( Cannot_Open_Resource );
}
sysfile->file = Open( (STRPTR)filepathname, MODE_OLDFILE );
if ( !sysfile->file )
{
FreeMem ( sysfile, sizeof ( struct SysFile ));
FT_ERROR(( "FT_Stream_Open:" ));
FT_ERROR(( " could not open `%s'\n", filepathname ));
return FT_THROW( Cannot_Open_Resource );
}
fib = AllocDosObject( DOS_FIB, NULL );
if ( !fib )
{
Close ( sysfile->file );
FreeMem ( sysfile, sizeof ( struct SysFile ));
FT_ERROR(( "FT_Stream_Open:" ));
FT_ERROR(( " could not open `%s'\n", filepathname ));
return FT_THROW( Cannot_Open_Resource );
}
if ( !( ExamineFH( sysfile->file, fib ) ) )
{
FreeDosObject( DOS_FIB, fib );
Close ( sysfile->file );
FreeMem ( sysfile, sizeof ( struct SysFile ));
FT_ERROR(( "FT_Stream_Open:" ));
FT_ERROR(( " could not open `%s'\n", filepathname ));
return FT_THROW( Cannot_Open_Resource );
}
stream->size = fib->fib_Size;
FreeDosObject( DOS_FIB, fib );
stream->descriptor.pointer = (void *)sysfile;
stream->pathname.pointer = (char*)filepathname;
sysfile->iobuf_start = 0;
sysfile->iobuf_end = 0;
stream->pos = 0;
stream->read = ft_amiga_stream_io;
stream->close = ft_amiga_stream_close;
if ( !stream->size )
{
ft_amiga_stream_close( stream );
FT_ERROR(( "FT_Stream_Open:" ));
FT_ERROR(( " opened `%s' but zero-sized\n", filepathname ));
return FT_THROW( Cannot_Open_Stream );
}
FT_TRACE1(( "FT_Stream_Open:" ));
FT_TRACE1(( " opened `%s' (%ld bytes) successfully\n",
filepathname, stream->size ));
return FT_Err_Ok;
}
#ifdef FT_DEBUG_MEMORY
extern FT_Int
ft_mem_debug_init( FT_Memory memory );
extern void
ft_mem_debug_done( FT_Memory memory );
#endif
/* documentation is in ftobjs.h */
FT_BASE_DEF( FT_Memory )
FT_New_Memory( void )
{
FT_Memory memory;
#ifdef __amigaos4__
memory = (FT_Memory)AllocVec( sizeof ( *memory ), MEMF_SHARED );
#else
memory = (FT_Memory)AllocVec( sizeof ( *memory ), MEMF_PUBLIC );
#endif
if ( memory )
{
#ifdef __amigaos4__
memory->user = CreatePool( MEMF_SHARED, 16384, 16384 );
#else
memory->user = CreatePool( MEMF_PUBLIC, 16384, 16384 );
#endif
if ( memory->user == NULL )
{
FreeVec( memory );
memory = NULL;
}
else
{
memory->alloc = ft_alloc;
memory->realloc = ft_realloc;
memory->free = ft_free;
#ifdef FT_DEBUG_MEMORY
ft_mem_debug_init( memory );
#endif
}
}
return memory;
}
/* documentation is in ftobjs.h */
FT_BASE_DEF( void )
FT_Done_Memory( FT_Memory memory )
{
#ifdef FT_DEBUG_MEMORY
ft_mem_debug_done( memory );
#endif
DeletePool( memory->user );
FreeVec( memory );
}
/*
Local Variables:
coding: latin-1
End:
*/
/* END */

77
builds/ansi/ansi-def.mk Normal file
View File

@ -0,0 +1,77 @@
#
# FreeType 2 configuration rules for a `normal' ANSI system
#
# Copyright (C) 1996-2024 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,
# and distributed under the terms of the FreeType project license,
# LICENSE.TXT. By continuing to use, modify, or distribute this file you
# indicate that you have read the license and understand and accept it
# fully.
DELETE := rm -f
CAT := cat
SEP := /
PLATFORM_DIR := $(TOP_DIR)/builds/ansi
PLATFORM := ansi
# This is used for `make refdoc' and `make refdoc-venv'
#
BIN := bin
# The directory where all library files are placed.
#
# By default, this is the same as $(OBJ_DIR); however, this can be changed
# to suit particular needs.
#
LIB_DIR := $(OBJ_DIR)
# The name of the final library file. Note that the DOS-specific Makefile
# uses a shorter (8.3) name.
#
LIBRARY := lib$(PROJECT)
# Path inclusion flag. Some compilers use a different flag than `-I' to
# specify an additional include path. Examples are `/i=' or `-J'.
#
I := -I
# C flag used to define a macro before the compilation of a given source
# object. Usually it is `-D' like in `-DDEBUG'.
#
D := -D
# The link flag used to specify a given library file on link. Note that
# this is only used to compile the demo programs, not the library itself.
#
L := -l
# Target flag.
#
T := -o$(space)
# C flags
#
# These should concern: debug output, optimization & warnings.
#
# Use the ANSIFLAGS variable to define the compiler flags used to enforce
# ANSI compliance.
#
CFLAGS ?= -c
# ANSIFLAGS: Put there the flags used to make your compiler ANSI-compliant.
#
ANSIFLAGS ?=
# EOF

View File

@ -1,9 +1,9 @@
#
# FreeType 2 configuration rules for a `normal' ANSI compiler
# FreeType 2 configuration rules for a `normal' pseudo ANSI compiler/system
#
# Copyright 1996-2000 by
# Copyright (C) 1996-2024 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,
@ -13,122 +13,9 @@
# fully.
ifndef TOP
TOP := .
endif
include $(TOP_DIR)/builds/ansi/ansi-def.mk
include $(TOP_DIR)/builds/compiler/ansi-cc.mk
include $(TOP_DIR)/builds/link_std.mk
DELETE := rm -f
SEP := /
HOSTSEP := $(SEP)
BUILD := $(TOP)/builds/ansi
PLATFORM := ansi
# The directory where all object files are placed.
#
# Note that this is not $(TOP)/obj!
# This lets you build the library in your own directory with something like
#
# set TOP=.../path/to/freetype2/top/dir...
# mkdir obj
# make -f $TOP/Makefile setup [options]
# make -f $TOP/Makefile
#
OBJ_DIR := obj
# The directory where all library files are placed.
#
# By default, this is the same as $(OBJ_DIR), however, this can be changed
# to suit particular needs.
#
LIB_DIR := $(OBJ_DIR)
# The object file extension (for standard and static libraries). This can be
# .o, .tco, .obj, etc., depending on the platform.
#
O := o
SO := o
# The library file extension (for standard and static libraries). This can
# be .a, .lib, etc., depending on the platform.
#
A := a
SA := a
# The name of the final library file. Note that the DOS-specific Makefile
# uses a shorter (8.3) name.
#
LIBRARY := libfreetype
# Path inclusion flag. Some compilers use a different flag than `-I' to
# specify an additional include path. Examples are `/i=' or `-J'.
#
I := -I
# C flag used to define a macro before the compilation of a given source
# object. Usually is `-D' like in `-DDEBUG'.
#
D := -D
# The link flag used to specify a given library file on link. Note that
# this is only used to compile the demo programs, not the library itself.
#
L := -l
# Target flag.
#
T := -o # Don't remove this comment line! We need the space after `-o'.
# C flags
#
# These should concern: debug output, optimization & warnings.
#
# Use the ANSIFLAGS variable to define the compiler flags used to enfore
# ANSI compliance.
#
ifndef CFLAGS
CFLAGS := -c
endif
# ANSIFLAGS: Put there the flags used to make your compiler ANSI-compliant.
#
ANSIFLAGS :=
ifdef BUILD_FREETYPE
# Now include the main sub-makefile. It contains all the rules used to
# build the library with the previous variables defined.
#
include $(TOP)/builds/freetype.mk
# The cleanup targets.
#
clean_freetype: clean_freetype_std
distclean_freetype: distclean_freetype_std
# Librarian to use to build the static library
#
FT_LIBRARIAN := $(AR) -r
# This final rule is used to link all object files into a single library.
# It is part of the system-specific sub-Makefile because not all
# librarians accept a simple syntax like
#
# librarian library_file {list of object files}
#
$(FT_LIBRARY): $(OBJECTS_LIST)
-$(DELETE) $@
$(FT_LIBRARIAN) $@ $(OBJECTS_LIST)
endif
# EOF

20
builds/atari/ATARI.H Normal file
View File

@ -0,0 +1,20 @@
#if defined( GXVALID_H_ )
#pragma warn -aus /* too many unevaluated variables in gxvalid */
#endif
#ifndef ATARI_H
#define ATARI_H
#pragma warn -stu
/* PureC doesn't like 32bit enumerations */
#ifndef FT_IMAGE_TAG
#define FT_IMAGE_TAG( value, _x1, _x2, _x3, _x4 ) value
#endif /* FT_IMAGE_TAG */
#ifndef FT_ENC_TAG
#define FT_ENC_TAG( value, a, b, c, d ) value
#endif /* FT_ENC_TAG */
#endif /* ATARI_H */

37
builds/atari/FNames.SIC Normal file
View File

@ -0,0 +1,37 @@
/* the following changes file names for PureC projects */
if (argc > 0)
{
ordner = argv[0];
if (basename(ordner) == "") /* ist Ordner */
{
ChangeFilenames(ordner);
}
}
proc ChangeFilenames(folder)
local i,entries,directory,file;
{
entries = filelist(directory,folder);
for (i = 0; i < entries; ++i)
{
file = directory[i,0];
if ((directory[i,3]&16) > 0) /* subdirectory */
{
ChangeFilenames(folder+file+"\\");
}
else
{
if ((stricmp(suffix(file),".h")==0)|(stricmp(suffix(file),".c")==0))
ChangeFilename(folder,file);
}
}
}
proc ChangeFilename(path,datei)
local newfile,err;
{
newfile=datei;
newfile[0]=(newfile[0] | 32) ^ 32;
err=files.rename("-q",path+datei,newfile);
}

32
builds/atari/FREETYPE.PRJ Normal file
View File

@ -0,0 +1,32 @@
;FreeType project file
FREETYPE.LIB
.C [-K -P -R -A]
.L [-J -V]
.S
=
..\..\src\base\ftsystem.c
..\..\src\base\ftdebug.c
..\..\src\base\ftinit.c
..\..\src\base\ftglyph.c
..\..\src\base\ftmm
..\..\src\base\ftbbox
..\..\src\base\ftbase.c
..\..\src\autohint\autohint.c
;..\..\src\cache\ftcache.c
..\..\src\cff\cff.c
..\..\src\cid\type1cid.c
..\..\src\psaux\psaux.c
..\..\src\pshinter\pshinter.c
..\..\src\psnames\psnames.c
..\..\src\raster\raster.c
..\..\src\sfnt\sfnt.c
..\..\src\smooth\smooth.c
..\..\src\truetype\truetype.c
..\..\src\type1\type1.c
..\..\src\type42\type42.c

51
builds/atari/README.TXT Normal file
View File

@ -0,0 +1,51 @@
Compiling FreeType 2 with PureC compiler
========================================
[See below for a German version.]
To compile FreeType 2 as a library the following changes must be applied:
- All *.c files must start with an uppercase letter.
(In case GEMSCRIPT is available:
Simply drag the whole FreeType 2 directory to the file `FNames.SIC'.)
- You have to change the INCLUDE directory in PureC's compiler options
to contain both the `INCLUDE' and `freetype2\include' directory.
Example:
INCLUDE;E:\freetype2\include
- The file `freetype/include/Ft2build.h' must be patched as follows to
include ATARI.H:
#ifndef FT2_BUILD_GENERIC_H_
#define FT2_BUILD_GENERIC_H_
#include "ATARI.H"
Compilieren von FreeType 2 mit PureC
====================================
Um FreeType 2 als eine Bibliothek (library) zu compilieren, muss folgendes
ge„ndert werden:
- Alle *.c-files m<>ssen mit einem GROSSBUCHSTABEN beginnen.
(Falls GEMSCRIPT zur Verf<72>gung steht:
Den kompletten Ordner freetype2 auf die Datei `FNames.SIC' draggen.)
- In den Compiler-Optionen von PureC muss das INCLUDE directory auf INCLUDE
und freetype2\include verweisen. Z.B.:
INCLUDE;E:\freetype2\include
- In der Datei freetype/include/Ft2build.h muss zu Beginn
ein #include "ATARI.H" wie folgt eingef<65>gt werden:
#ifndef FT2_BUILD_GENERIC_H_
#define FT2_BUILD_GENERIC_H_
#include "ATARI.H"
--- end of README.TXT ---

View File

@ -0,0 +1,181 @@
#!/usr/bin/env awk
function shift( array, \
junk, elm0, l )
{
elm0 = array[0]
for ( l = 0; l < asorti( array, junk ) - 1; l++ )
array[l] = array[l+1];
delete array[l]
return elm0
}
function init_cpp_src_line()
{
logical_line = ""
delete break_pos
}
function shift_valid_bp( array, \
junk, elm )
{
elm = -1
if ( 0 < asorti( array, junk ) )
do {
elm = shift( array )
} while ( 0 > elm );
return elm
}
function check_cpp_src_line_break_pos( \
i, junk )
{
printf( "break_pos:" )
for ( i = 0; i < asorti( break_pos, junk ); i++ )
printf( " %d", break_pos[i] );
printf( "\n" )
}
function check_cpp_src_line()
{
printf( "logical_line[%s]\n", logical_line )
check_cpp_src_line_break_pos()
}
function append_line( phys_line, \
filt_line, bp_len )
{
filt_line = phys_line
sub( /\\$/, " ", filt_line )
logical_line = logical_line filt_line
bp_len = asorti( break_pos, junk )
break_pos[bp_len] = length( logical_line ) - 1
}
function print_line( \
c0, c1, i, junk, part_str )
{
c0 = 0
while( asorti( break_pos, junk ) > 1 )
{
if ( ( c1 = shift_valid_bp( break_pos ) ) < 1 )
{
part_str = substr( logical_line, c0 + 1 )
printf( "%s\n", part_str )
return
}
part_str = substr( logical_line, c0 + 1, c1 - c0 + 1 )
gsub( / $/, "\\", part_str )
printf( "%s\n", part_str )
c0 = c1 + 1
}
part_str = substr( logical_line, c0 + 1 )
printf( "%s\n", part_str )
}
function shrink_spaces( pos, \
tail, removed_length, k )
{
tail = substr( logical_line, pos )
sub( /^[ \t]+/, " ", tail )
removed_length = length( logical_line ) - pos - length( tail ) + 1
logical_line = substr( logical_line, 0, pos - 1 ) tail
for ( k = 0; k < asorti( break_pos, junk ); k++ )
if ( ( pos + removed_length ) <= break_pos[k] )
break_pos[k] = break_pos[k] - removed_length;
else if ( pos <= break_pos[k] )
break_pos[k] = -1;
return removed_length
}
function shrink_spaces_to_linebreak( pos, \
junk, part_str, removed_length, i )
{
for ( i = 0; i < asorti( break_pos, junk ) && break_pos[i] < pos ; i++ )
;
if ( break_pos[i] < 1 )
return;
part_str = substr( logical_line, pos, break_pos[i] - pos + 1 )
sub( /^[ \t]+/, " ", part_str )
removed_length = ( break_pos[i] - pos + 1 ) - length( part_str )
tail = substr( logical_line, pos + removed_length )
logical_line = substr( logical_line, 0, pos - 1 ) tail
for ( ; i < asorti( break_pos, junk ); i++ )
break_pos[i] -= removed_length;
return removed_length
}
function delete_linebreaks_in_2nd_token( \
tail, paren_depth, junk, i, j, k, l )
{
if ( logical_line ~ /^[ \t]*#[ \t]*define[ \t]+[0-9A-Za-z_]+\(/ )
{
tail = logical_line
sub( /^[ \t]*#[ \t]*define[ \t]+[0-9A-Za-z_]+/, "", tail )
paren_depth = 0
l = 0
i = length( logical_line ) - length( tail ) + 1 # seek to the 1st op paren
j = i
do {
if ( substr( logical_line, j, 2 ) ~ /[ \t][ \t]/ )
l = shrink_spaces( j );
else if ( substr( logical_line, j, 1 ) == "(" )
paren_depth += 1;
else if ( substr( logical_line, j, 1 ) == ")" )
paren_depth -= 1;
j += 1
} while ( j < length( logical_line ) && paren_depth != 0 )
for ( k = 0; k < asorti( break_pos, junk ); k++ )
if ( i <= break_pos[k] && break_pos[k] < j )
break_pos[k] = -1;
if ( l > 0 )
shrink_spaces_to_linebreak( j );
}
}
BEGIN{
init_cpp_src_line()
}
{
append_line( $0 )
if ( $0 !~ /\\$/ )
{
delete_linebreaks_in_2nd_token()
print_line()
init_cpp_src_line()
}
}
END{
if ( 0 < length( logical_line ) )
{
delete_linebreaks_in_2nd_token()
print_line()
}
}

40
builds/atari/gen-purec-patch.sh Executable file
View File

@ -0,0 +1,40 @@
#!/bin/sh
TOP_DIR=.
OBJ_DIR=.
for x in "$@"
do
case x"$x" in
x--srcdir=* | x--topdir=* )
TOP_DIR=`echo $x | sed 's/^--[a-z]*dir=//'`
;;
x--builddir=* | x--objdir=* )
OBJ_DIR=`echo $x | sed 's/^--[a-z]*dir=//'`
;;
esac
done
mkdir -p ${OBJ_DIR}/builds/atari/tmp/orig
( cd ${TOP_DIR} && find . -name '*.[CHch]' -type f | fgrep -v builds/atari/tmp | cpio -o ) | \
( cd ${OBJ_DIR}/builds/atari/tmp/orig && cpio -idum )
cp ${TOP_DIR}/builds/atari/deflinejoiner.awk ${OBJ_DIR}/builds/atari/tmp
pushd ${OBJ_DIR}/builds/atari/tmp
cp -pr orig purec
for f in `cd orig && find . -type f`
do
echo filter $f
env LANG=C awk -f deflinejoiner.awk < orig/$f > purec/$f
done
echo '#define FT2_BUILD_LIBRARY' > purec/include/ft2build.h
echo '#include "ATARI.H"' >> purec/include/ft2build.h
env LANG=C awk -f deflinejoiner.awk < orig/include/ft2build.h >> purec/include/ft2build.h
env LANG=C diff -ur orig purec > ../purec.diff
popd
rm -rf ${OBJ_DIR}/builds/atari/tmp

79
builds/beos/beos-def.mk Normal file
View File

@ -0,0 +1,79 @@
#
# FreeType 2 configuration rules for a BeOS system
#
# this is similar to the "ansi-def.mk" file, except for BUILD and PLATFORM
#
# Copyright (C) 1996-2024 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,
# and distributed under the terms of the FreeType project license,
# LICENSE.TXT. By continuing to use, modify, or distribute this file you
# indicate that you have read the license and understand and accept it
# fully.
DELETE := rm -f
CAT := cat
SEP := /
PLATFORM_DIR := $(TOP_DIR)/builds/beos
PLATFORM := beos
# This is used for `make refdoc' and `make refdoc-venv'
#
BIN := bin
# The directory where all library files are placed.
#
# By default, this is the same as $(OBJ_DIR); however, this can be changed
# to suit particular needs.
#
LIB_DIR := $(OBJ_DIR)
# The name of the final library file. Note that the DOS-specific Makefile
# uses a shorter (8.3) name.
#
LIBRARY := lib$(PROJECT)
# Path inclusion flag. Some compilers use a different flag than `-I' to
# specify an additional include path. Examples are `/i=' or `-J'.
#
I := -I
# C flag used to define a macro before the compilation of a given source
# object. Usually it is `-D' like in `-DDEBUG'.
#
D := -D
# The link flag used to specify a given library file on link. Note that
# this is only used to compile the demo programs, not the library itself.
#
L := -l
# Target flag.
#
T := -o$(space)
# C flags
#
# These should concern: debug output, optimization & warnings.
#
# Use the ANSIFLAGS variable to define the compiler flags used to enforce
# ANSI compliance.
#
CFLAGS ?= -c
# ANSIFLAGS: Put there the flags used to make your compiler ANSI-compliant.
#
ANSIFLAGS ?=
# EOF

19
builds/beos/beos.mk Normal file
View File

@ -0,0 +1,19 @@
#
# FreeType 2 configuration rules for a BeOS system
#
# Copyright (C) 1996-2024 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,
# and distributed under the terms of the FreeType project license,
# LICENSE.TXT. By continuing to use, modify, or distribute this file you
# indicate that you have read the license and understand and accept it
# fully.
include $(TOP_DIR)/builds/beos/beos-def.mk
include $(TOP_DIR)/builds/compiler/ansi-cc.mk
include $(TOP_DIR)/builds/link_std.mk
# EOF

41
builds/beos/detect.mk Normal file
View File

@ -0,0 +1,41 @@
#
# FreeType 2 configuration file to detect an BeOS host platform.
#
# Copyright (C) 1996-2024 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,
# and distributed under the terms of the FreeType project license,
# LICENSE.TXT. By continuing to use, modify, or distribute this file you
# indicate that you have read the license and understand and accept it
# fully.
.PHONY: setup
ifeq ($(PLATFORM),ansi)
ifdef BE_HOST_CPU
PLATFORM := beos
endif # test MACHTYPE beos
endif
ifeq ($(PLATFORM),beos)
DELETE := rm -f
CAT := cat
SEP := /
PLATFORM_DIR := $(TOP_DIR)/builds/beos
CONFIG_FILE := beos.mk
setup: std_setup
endif # test PLATFORM beos
# EOF

View File

@ -0,0 +1,52 @@
# FindBrotliDec.cmake
#
# Copyright (C) 2019-2024 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# Written by Werner Lemberg <wl@gnu.org>
#
# This file is part of the FreeType project, and may only be used, modified,
# and distributed under the terms of the FreeType project license,
# LICENSE.TXT. By continuing to use, modify, or distribute this file you
# indicate that you have read the license and understand and accept it
# fully.
#
#
# Try to find libbrotlidec include and library directories.
#
# If found, the following variables are set.
#
# BROTLIDEC_INCLUDE_DIRS
# BROTLIDEC_LIBRARIES
find_package(PkgConfig QUIET)
pkg_check_modules(PC_BROTLIDEC QUIET libbrotlidec)
if (PC_BROTLIDEC_VERSION)
set(BROTLIDEC_VERSION "${PC_BROTLIDEC_VERSION}")
endif ()
find_path(BROTLIDEC_INCLUDE_DIRS
NAMES brotli/decode.h
HINTS ${PC_BROTLIDEC_INCLUDEDIR}
${PC_BROTLIDEC_INCLUDE_DIRS}
PATH_SUFFIXES brotli)
find_library(BROTLIDEC_LIBRARIES
NAMES brotlidec
HINTS ${PC_BROTLIDEC_LIBDIR}
${PC_BROTLIDEC_LIBRARY_DIRS})
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(
BrotliDec
REQUIRED_VARS BROTLIDEC_INCLUDE_DIRS BROTLIDEC_LIBRARIES
FOUND_VAR BROTLIDEC_FOUND
VERSION_VAR BROTLIDEC_VERSION)
mark_as_advanced(
BROTLIDEC_INCLUDE_DIRS
BROTLIDEC_LIBRARIES)

View File

@ -0,0 +1,203 @@
# Copyright (c) 2012, Intel Corporation
# Copyright (c) 2019 Sony Interactive Entertainment Inc.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice, this
# list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
# * Neither the name of Intel Corporation nor the names of its contributors may
# be used to endorse or promote products derived from this software without
# specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
# Try to find Harfbuzz include and library directories.
#
# After successful discovery, this will set for inclusion where needed:
# HarfBuzz_INCLUDE_DIRS - containg the HarfBuzz headers
# HarfBuzz_LIBRARIES - containg the HarfBuzz library
#[=======================================================================[.rst:
FindHarfBuzz
--------------
Find HarfBuzz headers and libraries.
Imported Targets
^^^^^^^^^^^^^^^^
``HarfBuzz::HarfBuzz``
The HarfBuzz library, if found.
``HarfBuzz::ICU``
The HarfBuzz ICU library, if found.
Result Variables
^^^^^^^^^^^^^^^^
This will define the following variables in your project:
``HarfBuzz_FOUND``
true if (the requested version of) HarfBuzz is available.
``HarfBuzz_VERSION``
the version of HarfBuzz.
``HarfBuzz_LIBRARIES``
the libraries to link against to use HarfBuzz.
``HarfBuzz_INCLUDE_DIRS``
where to find the HarfBuzz headers.
``HarfBuzz_COMPILE_OPTIONS``
this should be passed to target_compile_options(), if the
target is not used for linking
#]=======================================================================]
find_package(PkgConfig QUIET)
pkg_check_modules(PC_HARFBUZZ QUIET harfbuzz)
set(HarfBuzz_COMPILE_OPTIONS ${PC_HARFBUZZ_CFLAGS_OTHER})
set(HarfBuzz_VERSION ${PC_HARFBUZZ_CFLAGS_VERSION})
find_path(HarfBuzz_INCLUDE_DIR
NAMES hb.h
HINTS ${PC_HARFBUZZ_INCLUDEDIR} ${PC_HARFBUZZ_INCLUDE_DIRS}
PATH_SUFFIXES harfbuzz
)
find_library(HarfBuzz_LIBRARY
NAMES ${HarfBuzz_NAMES} harfbuzz
HINTS ${PC_HARFBUZZ_LIBDIR} ${PC_HARFBUZZ_LIBRARY_DIRS}
)
if (HarfBuzz_INCLUDE_DIR AND NOT HarfBuzz_VERSION)
if (EXISTS "${HarfBuzz_INCLUDE_DIR}/hb-version.h")
file(READ "${HarfBuzz_INCLUDE_DIR}/hb-version.h" _harfbuzz_version_content)
string(REGEX MATCH "#define +HB_VERSION_STRING +\"([0-9]+\\.[0-9]+\\.[0-9]+)\"" _dummy "${_harfbuzz_version_content}")
set(HarfBuzz_VERSION "${CMAKE_MATCH_1}")
endif ()
endif ()
if ("${HarfBuzz_FIND_VERSION}" VERSION_GREATER "${HarfBuzz_VERSION}")
if (HarfBuzz_FIND_REQUIRED)
message(FATAL_ERROR
"Required version (" ${HarfBuzz_FIND_VERSION} ")"
" is higher than found version (" ${HarfBuzz_VERSION} ")")
else ()
message(WARNING
"Required version (" ${HarfBuzz_FIND_VERSION} ")"
" is higher than found version (" ${HarfBuzz_VERSION} ")")
unset(HarfBuzz_VERSION)
unset(HarfBuzz_INCLUDE_DIRS)
unset(HarfBuzz_LIBRARIES)
return ()
endif ()
endif ()
# Find components
if (HarfBuzz_INCLUDE_DIR AND HarfBuzz_LIBRARY)
set(_HarfBuzz_REQUIRED_LIBS_FOUND ON)
set(HarfBuzz_LIBS_FOUND "HarfBuzz (required): ${HarfBuzz_LIBRARY}")
else ()
set(_HarfBuzz_REQUIRED_LIBS_FOUND OFF)
set(HarfBuzz_LIBS_NOT_FOUND "HarfBuzz (required)")
endif ()
if (NOT CMAKE_VERSION VERSION_LESS 3.3)
if ("ICU" IN_LIST HarfBuzz_FIND_COMPONENTS)
pkg_check_modules(PC_HARFBUZZ_ICU QUIET harfbuzz-icu)
set(HarfBuzz_ICU_COMPILE_OPTIONS ${PC_HARFBUZZ_ICU_CFLAGS_OTHER})
find_path(HarfBuzz_ICU_INCLUDE_DIR
NAMES hb-icu.h
HINTS ${PC_HARFBUZZ_ICU_INCLUDEDIR} ${PC_HARFBUZZ_ICU_INCLUDE_DIRS}
PATH_SUFFIXES harfbuzz
)
find_library(HarfBuzz_ICU_LIBRARY
NAMES ${HarfBuzz_ICU_NAMES} harfbuzz-icu
HINTS ${PC_HARFBUZZ_ICU_LIBDIR} ${PC_HARFBUZZ_ICU_LIBRARY_DIRS}
)
if (HarfBuzz_ICU_LIBRARY)
if (HarfBuzz_FIND_REQUIRED_ICU)
list(APPEND HarfBuzz_LIBS_FOUND "ICU (required): ${HarfBuzz_ICU_LIBRARY}")
else ()
list(APPEND HarfBuzz_LIBS_FOUND "ICU (optional): ${HarfBuzz_ICU_LIBRARY}")
endif ()
else ()
if (HarfBuzz_FIND_REQUIRED_ICU)
set(_HarfBuzz_REQUIRED_LIBS_FOUND OFF)
list(APPEND HarfBuzz_LIBS_NOT_FOUND "ICU (required)")
else ()
list(APPEND HarfBuzz_LIBS_NOT_FOUND "ICU (optional)")
endif ()
endif ()
endif ()
endif ()
if (NOT HarfBuzz_FIND_QUIETLY)
if (HarfBuzz_LIBS_FOUND)
message(STATUS "Found the following HarfBuzz libraries:")
foreach (found ${HarfBuzz_LIBS_FOUND})
message(STATUS " ${found}")
endforeach ()
endif ()
if (HarfBuzz_LIBS_NOT_FOUND)
message(STATUS "The following HarfBuzz libraries were not found:")
foreach (found ${HarfBuzz_LIBS_NOT_FOUND})
message(STATUS " ${found}")
endforeach ()
endif ()
endif ()
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(HarfBuzz
FOUND_VAR HarfBuzz_FOUND
REQUIRED_VARS HarfBuzz_INCLUDE_DIR HarfBuzz_LIBRARY _HarfBuzz_REQUIRED_LIBS_FOUND
VERSION_VAR HarfBuzz_VERSION
)
if (NOT CMAKE_VERSION VERSION_LESS 3.1)
if (HarfBuzz_LIBRARY AND NOT TARGET HarfBuzz::HarfBuzz)
add_library(HarfBuzz::HarfBuzz UNKNOWN IMPORTED GLOBAL)
set_target_properties(HarfBuzz::HarfBuzz PROPERTIES
IMPORTED_LOCATION "${HarfBuzz_LIBRARY}"
INTERFACE_COMPILE_OPTIONS "${HarfBuzz_COMPILE_OPTIONS}"
INTERFACE_INCLUDE_DIRECTORIES "${HarfBuzz_INCLUDE_DIR}"
)
endif ()
if (HarfBuzz_ICU_LIBRARY AND NOT TARGET HarfBuzz::ICU)
add_library(HarfBuzz::ICU UNKNOWN IMPORTED GLOBAL)
set_target_properties(HarfBuzz::ICU PROPERTIES
IMPORTED_LOCATION "${HarfBuzz_ICU_LIBRARY}"
INTERFACE_COMPILE_OPTIONS "${HarfBuzz_ICU_COMPILE_OPTIONS}"
INTERFACE_INCLUDE_DIRECTORIES "${HarfBuzz_ICU_INCLUDE_DIR}"
)
endif ()
endif ()
mark_as_advanced(
HarfBuzz_INCLUDE_DIR
HarfBuzz_ICU_INCLUDE_DIR
HarfBuzz_LIBRARY
HarfBuzz_ICU_LIBRARY
)
if (HarfBuzz_FOUND)
set(HarfBuzz_LIBRARIES ${HarfBuzz_LIBRARY} ${HarfBuzz_ICU_LIBRARY})
set(HarfBuzz_INCLUDE_DIRS ${HarfBuzz_INCLUDE_DIR} ${HarfBuzz_ICU_INCLUDE_DIR})
endif ()

270
builds/cmake/iOS.cmake Normal file
View File

@ -0,0 +1,270 @@
# iOS.cmake
#
# Copyright (C) 2014-2024 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# Written by David Wimsey <david@wimsey.us>
#
# This file is part of the FreeType project, and may only be used, modified,
# and distributed under the terms of the FreeType project license,
# LICENSE.TXT. By continuing to use, modify, or distribute this file you
# indicate that you have read the license and understand and accept it
# fully.
#
#
# This file is derived from the files `Platform/Darwin.cmake' and
# `Platform/UnixPaths.cmake', which are part of CMake 2.8.4. It has been
# altered for iOS development.
# Options
# -------
#
# IOS_PLATFORM = OS | SIMULATOR
#
# This decides whether SDKS are selected from the `iPhoneOS.platform' or
# `iPhoneSimulator.platform' folders.
#
# OS - the default, used to build for iPhone and iPad physical devices,
# which have an ARM architecture.
# SIMULATOR - used to build for the Simulator platforms, which have an
# x86 architecture.
#
# CMAKE_IOS_DEVELOPER_ROOT = /path/to/platform/Developer folder
#
# By default, this location is automatically chosen based on the
# IOS_PLATFORM value above. If you manually set this variable, it
# overrides the default location and forces the use of a particular
# Developer Platform.
#
# CMAKE_IOS_SDK_ROOT = /path/to/platform/Developer/SDKs/SDK folder
#
# By default, this location is automatically chosen based on the
# CMAKE_IOS_DEVELOPER_ROOT value. In this case it is always the most
# up-to-date SDK found in the CMAKE_IOS_DEVELOPER_ROOT path. If you
# manually set this variable, it forces the use of a specific SDK
# version.
#
#
# Macros
# ------
#
# set_xcode_property (TARGET XCODE_PROPERTY XCODE_VALUE)
#
# A convenience macro for setting Xcode specific properties on targets.
#
# Example:
#
# set_xcode_property(myioslib IPHONEOS_DEPLOYMENT_TARGET "3.1")
#
# find_host_package (PROGRAM ARGS)
#
# A macro to find executable programs on the host system, not within the
# iOS environment. Thanks to the `android-cmake' project for providing
# the command.
# standard settings
set(CMAKE_SYSTEM_NAME Darwin)
set(CMAKE_SYSTEM_VERSION 1)
set(UNIX True)
set(APPLE True)
set(IOS True)
# required as of cmake 2.8.10
set(CMAKE_OSX_DEPLOYMENT_TARGET ""
CACHE STRING "Force unset of the deployment target for iOS" FORCE
)
# determine the cmake host system version so we know where to find the iOS
# SDKs
find_program(CMAKE_UNAME uname /bin /usr/bin /usr/local/bin)
if (CMAKE_UNAME)
exec_program(uname ARGS -r OUTPUT_VARIABLE CMAKE_HOST_SYSTEM_VERSION)
string(REGEX REPLACE "^([0-9]+)\\.([0-9]+).*$" "\\1"
DARWIN_MAJOR_VERSION "${CMAKE_HOST_SYSTEM_VERSION}")
endif (CMAKE_UNAME)
# skip the platform compiler checks for cross compiling
set(CMAKE_CXX_COMPILER_WORKS TRUE)
set(CMAKE_C_COMPILER_WORKS TRUE)
# all iOS/Darwin specific settings - some may be redundant
set(CMAKE_SHARED_LIBRARY_PREFIX "lib")
set(CMAKE_SHARED_LIBRARY_SUFFIX ".dylib")
set(CMAKE_SHARED_MODULE_PREFIX "lib")
set(CMAKE_SHARED_MODULE_SUFFIX ".so")
set(CMAKE_MODULE_EXISTS 1)
set(CMAKE_DL_LIBS "")
set(CMAKE_C_OSX_COMPATIBILITY_VERSION_FLAG
"-compatibility_version ")
set(CMAKE_C_OSX_CURRENT_VERSION_FLAG
"-current_version ")
set(CMAKE_CXX_OSX_COMPATIBILITY_VERSION_FLAG
"${CMAKE_C_OSX_COMPATIBILITY_VERSION_FLAG}")
set(CMAKE_CXX_OSX_CURRENT_VERSION_FLAG
"${CMAKE_C_OSX_CURRENT_VERSION_FLAG}")
# hidden visibility is required for cxx on iOS
set(CMAKE_C_FLAGS_INIT "")
set(CMAKE_CXX_FLAGS_INIT
"-headerpad_max_install_names -fvisibility=hidden -fvisibility-inlines-hidden")
set(CMAKE_C_LINK_FLAGS
"-Wl,-search_paths_first ${CMAKE_C_LINK_FLAGS}")
set(CMAKE_CXX_LINK_FLAGS
"-Wl,-search_paths_first ${CMAKE_CXX_LINK_FLAGS}")
set(CMAKE_PLATFORM_HAS_INSTALLNAME 1)
set(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS
"-dynamiclib -headerpad_max_install_names")
set(CMAKE_SHARED_MODULE_CREATE_C_FLAGS
"-bundle -headerpad_max_install_names")
set(CMAKE_SHARED_MODULE_LOADER_C_FLAG
"-Wl,-bundle_loader,")
set(CMAKE_SHARED_MODULE_LOADER_CXX_FLAG
"-Wl,-bundle_loader,")
set(CMAKE_FIND_LIBRARY_SUFFIXES
".dylib" ".so" ".a")
# hack: If a new cmake (which uses CMAKE_INSTALL_NAME_TOOL) runs on an old
# build tree (where `install_name_tool' was hardcoded), and where
# CMAKE_INSTALL_NAME_TOOL isn't in the cache and still cmake didn't
# fail in `CMakeFindBinUtils.cmake' (because it isn't rerun), hardcode
# CMAKE_INSTALL_NAME_TOOL here to `install_name_tool' so it behaves as
# it did before.
if (NOT DEFINED CMAKE_INSTALL_NAME_TOOL)
find_program(CMAKE_INSTALL_NAME_TOOL install_name_tool)
endif (NOT DEFINED CMAKE_INSTALL_NAME_TOOL)
# set up iOS platform unless specified manually with IOS_PLATFORM
if (NOT DEFINED IOS_PLATFORM)
set(IOS_PLATFORM "OS")
endif (NOT DEFINED IOS_PLATFORM)
set(IOS_PLATFORM ${IOS_PLATFORM} CACHE STRING "Type of iOS Platform")
# check the platform selection and setup for developer root
if (${IOS_PLATFORM} STREQUAL "OS")
set(IOS_PLATFORM_LOCATION "iPhoneOS.platform")
# this causes the installers to properly locate the output libraries
set(CMAKE_XCODE_EFFECTIVE_PLATFORMS "-iphoneos")
elseif (${IOS_PLATFORM} STREQUAL "SIMULATOR")
set(IOS_PLATFORM_LOCATION "iPhoneSimulator.platform")
# this causes the installers to properly locate the output libraries
set(CMAKE_XCODE_EFFECTIVE_PLATFORMS "-iphonesimulator")
else (${IOS_PLATFORM} STREQUAL "OS")
message(FATAL_ERROR
"Unsupported IOS_PLATFORM value selected. Please choose OS or SIMULATOR.")
endif (${IOS_PLATFORM} STREQUAL "OS")
# set up iOS developer location unless specified manually with
# CMAKE_IOS_DEVELOPER_ROOT --
# note that Xcode 4.3 changed the installation location; choose the most
# recent one available
set(XCODE_POST_43_ROOT
"/Applications/Xcode.app/Contents/Developer/Platforms/${IOS_PLATFORM_LOCATION}/Developer")
set(XCODE_PRE_43_ROOT
"/Developer/Platforms/${IOS_PLATFORM_LOCATION}/Developer")
if (NOT DEFINED CMAKE_IOS_DEVELOPER_ROOT)
if (EXISTS ${XCODE_POST_43_ROOT})
set(CMAKE_IOS_DEVELOPER_ROOT ${XCODE_POST_43_ROOT})
elseif (EXISTS ${XCODE_PRE_43_ROOT})
set(CMAKE_IOS_DEVELOPER_ROOT ${XCODE_PRE_43_ROOT})
endif (EXISTS ${XCODE_POST_43_ROOT})
endif (NOT DEFINED CMAKE_IOS_DEVELOPER_ROOT)
set(CMAKE_IOS_DEVELOPER_ROOT ${CMAKE_IOS_DEVELOPER_ROOT}
CACHE PATH "Location of iOS Platform"
)
# find and use the most recent iOS SDK unless specified manually with
# CMAKE_IOS_SDK_ROOT
if (NOT DEFINED CMAKE_IOS_SDK_ROOT)
file(GLOB _CMAKE_IOS_SDKS "${CMAKE_IOS_DEVELOPER_ROOT}/SDKs/*")
if (_CMAKE_IOS_SDKS)
list(SORT _CMAKE_IOS_SDKS)
list(REVERSE _CMAKE_IOS_SDKS)
list(GET _CMAKE_IOS_SDKS 0 CMAKE_IOS_SDK_ROOT)
else (_CMAKE_IOS_SDKS)
message(FATAL_ERROR
"No iOS SDK's found in default search path ${CMAKE_IOS_DEVELOPER_ROOT}. Manually set CMAKE_IOS_SDK_ROOT or install the iOS SDK.")
endif (_CMAKE_IOS_SDKS)
message(STATUS "Toolchain using default iOS SDK: ${CMAKE_IOS_SDK_ROOT}")
endif (NOT DEFINED CMAKE_IOS_SDK_ROOT)
set(CMAKE_IOS_SDK_ROOT ${CMAKE_IOS_SDK_ROOT}
CACHE PATH "Location of the selected iOS SDK"
)
# set the sysroot default to the most recent SDK
set(CMAKE_OSX_SYSROOT ${CMAKE_IOS_SDK_ROOT}
CACHE PATH "Sysroot used for iOS support"
)
# set the architecture for iOS --
# note that currently both ARCHS_STANDARD_32_BIT and
# ARCHS_UNIVERSAL_IPHONE_OS set armv7 only, so set both manually
if (${IOS_PLATFORM} STREQUAL "OS")
set(IOS_ARCH $(ARCHS_STANDARD_32_64_BIT))
else (${IOS_PLATFORM} STREQUAL "OS")
set(IOS_ARCH i386)
endif (${IOS_PLATFORM} STREQUAL "OS")
set(CMAKE_OSX_ARCHITECTURES ${IOS_ARCH}
CACHE string "Build architecture for iOS"
)
# set the find root to the iOS developer roots and to user defined paths
set(CMAKE_FIND_ROOT_PATH
${CMAKE_IOS_DEVELOPER_ROOT}
${CMAKE_IOS_SDK_ROOT}
${CMAKE_PREFIX_PATH}
CACHE string "iOS find search path root"
)
# default to searching for frameworks first
set(CMAKE_FIND_FRAMEWORK FIRST)
# set up the default search directories for frameworks
set(CMAKE_SYSTEM_FRAMEWORK_PATH
${CMAKE_IOS_SDK_ROOT}/System/Library/Frameworks
${CMAKE_IOS_SDK_ROOT}/System/Library/PrivateFrameworks
${CMAKE_IOS_SDK_ROOT}/Developer/Library/Frameworks
)
# only search the iOS SDKs, not the remainder of the host filesystem
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
# this little macro lets you set any Xcode specific property
macro(set_xcode_property TARGET XCODE_PROPERTY XCODE_VALUE)
set_property(TARGET ${TARGET}
PROPERTY XCODE_ATTRIBUTE_${XCODE_PROPERTY} ${XCODE_VALUE})
endmacro(set_xcode_property)
# this macro lets you find executable programs on the host system
macro(find_host_package)
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE NEVER)
set(IOS FALSE)
find_package(${ARGN})
set(IOS TRUE)
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
endmacro(find_host_package)
# eof

157
builds/cmake/testbuild.sh Executable file
View File

@ -0,0 +1,157 @@
#!/bin/sh -e
# Copyright (C) 2015-2024 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,
# and distributed under the terms of the FreeType project license,
# LICENSE.TXT. By continuing to use, modify, or distribute this file you
# indicate that you have read the license and understand and accept it
# fully.
# This script tests the CMake build. Simply run
#
# builds/cmake/testbuild.sh
#
# or
#
# BUILD_SHARED_LIBS=1 builds/cmake/testbuild.sh
#
# The script:
#
# - builds the main CMakeLists.txt
# - builds and runs a small test app in a separate build tree so
# the config-module is tested, too
#
# Options (environment variables):
#
# - The variable BUILD_SHARED_LIBS will be forwarded to the CMake project
# that builds the library.
#
# prepare temporary dir
cd `dirname $0`/../..
ftdir=`pwd`
tmpdir=/tmp/freetype-cmake-testbuild
rm -rf $tmpdir
mkdir -p $tmpdir
# build and install freetype
if test -n "$BUILD_SHARED_LIBS"; then
bsl=-DBUILD_SHARED_LIBS=$BUILD_SHARED_LIBS
else
bsl=-UBUILD_SHARED_LIBS
fi
build_opts="-DWITH_ZLIB=0 \
-DWITH_BZip2=0 \
-DWITH_PNG=0 \
-DWITH_HarfBuzz=0 \
$bsl \
-DCMAKE_INSTALL_PREFIX=$tmpdir/out"
(set -x; cmake -H$ftdir \
-B$tmpdir/ftb \
-DCMAKE_BUILD_TYPE=Debug \
$build_opts)
(set -x; cmake --build $tmpdir/ftb \
--config Debug \
--target install)
(set -x; cmake $tmpdir/ftb \
-DCMAKE_BUILD_TYPE=Release)
(set -x; cmake --build $tmpdir/ftb \
--config Release \
--target install \
--clean-first)
# create test project CMakeLists.txt
cat >$tmpdir/CMakeLists.txt << END
cmake_minimum_required(VERSION 2.6)
project(freetype-cmake-testbuild)
find_package(Freetype REQUIRED CONFIG)
add_executable(freetype-cmake-test main.c)
target_link_libraries(freetype-cmake-test freetype)
enable_testing()
add_test(freetype-cmake-test freetype-cmake-test)
END
# create test project main.c
cat >$tmpdir/main.c << END
#include <stdio.h>
#include <stdlib.h>
#include <ft2build.h>
#include <freetype/freetype.h>
FT_Library library;
int main(int argc,
char*argv[])
{
FT_Error error;
FT_Int major = 0;
FT_Int minor = 0;
FT_Int patch = 0;
error = FT_Init_FreeType(&library);
if (error)
return EXIT_FAILURE;
FT_Library_Version(library, &major, &minor, &patch);
if (major != FREETYPE_MAJOR
|| minor != FREETYPE_MINOR
|| patch != FREETYPE_PATCH)
return EXIT_FAILURE;
printf("FT_Library_Version: %d.%d.%d\n", major, minor, patch);
error = FT_Done_FreeType(library);
if (error)
return EXIT_FAILURE;
return EXIT_SUCCESS;
}
END
# build and test
mkdir -p $tmpdir/tb
cd $tmpdir/tb
LD_LIBRARY_PATH=$tmpdir/out/lib:$LD_LIBRARY_PATH
DYLD_LIBRARY_PATH=$tmpdir/out/lib:$DYLD_LIBRARY_PATH
export LD_LIBRARY_PATH
export DYLD_LIBRARY_PATH
(set -x; cmake $tmpdir \
-DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_PREFIX_PATH=$tmpdir/out)
(set -x; cmake --build . \
--config Debug)
(set -x; ctest -V -C Debug)
(set -x; cmake . \
-DCMAKE_BUILD_TYPE=Release)
(set -x; cmake --build . \
--config Release \
--clean-first)
(set -x; ctest -V -C Release)
rm -rf $tmpdir
# EOF

View File

@ -0,0 +1,80 @@
#
# FreeType 2 generic pseudo ANSI compiler
#
# Copyright (C) 1996-2024 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,
# and distributed under the terms of the FreeType project license,
# LICENSE.TXT. By continuing to use, modify, or distribute this file you
# indicate that you have read the license and understand and accept it
# fully.
# Compiler command line name
#
CC := cc
COMPILER_SEP := $(SEP)
# The object file extension (for standard and static libraries). This can be
# .o, .tco, .obj, etc., depending on the platform.
#
O := o
SO := o
# The library file extension (for standard and static libraries). This can
# be .a, .lib, etc., depending on the platform.
#
A := a
SA := a
# Path inclusion flag. Some compilers use a different flag than `-I' to
# specify an additional include path. Examples are `/i=' or `-J'.
#
I := -I
# C flag used to define a macro before the compilation of a given source
# object. Usually it is `-D' like in `-DDEBUG'.
#
D := -D
# The link flag used to specify a given library file on link. Note that
# this is only used to compile the demo programs, not the library itself.
#
L := -l
# Target flag.
#
T := -o$(space)
# C flags
#
# These should concern: debug output, optimization & warnings.
#
# Use the ANSIFLAGS variable to define the compiler flags used to enforce
# ANSI compliance.
#
CFLAGS ?= -c
# ANSIFLAGS: Put there the flags used to make your compiler ANSI-compliant.
#
# we assume the compiler is already strictly ANSI
#
ANSIFLAGS ?=
# Library linking
#
CLEAN_LIBRARY ?= $(DELETE) $(subst /,$(SEP),$(PROJECT_LIBRARY))
LINK_LIBRARY = $(AR) -r $@ $(subst /,$(COMPILER_SEP),$(OBJECTS_LIST))
# EOF

View File

@ -0,0 +1,86 @@
#
# FreeType 2 Borland C++-specific with NO OPTIMIZATIONS + DEBUGGING
#
# Copyright (C) 1996-2024 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,
# and distributed under the terms of the FreeType project license,
# LICENSE.TXT. By continuing to use, modify, or distribute this file you
# indicate that you have read the license and understand and accept it
# fully.
# Compiler command line name
#
CC := bcc32
COMPILER_SEP := $(SEP)
# The object file extension (for standard and static libraries). This can be
# .o, .tco, .obj, etc., depending on the platform.
#
O := obj
SO := obj
# The library file extension (for standard and static libraries). This can
# be .a, .lib, etc., depending on the platform.
#
A := lib
SA := lib
# Path inclusion flag. Some compilers use a different flag than `-I' to
# specify an additional include path. Examples are `/i=' or `-J'.
#
I := -I
# C flag used to define a macro before the compilation of a given source
# object. Usually it is `-D' like in `-DDEBUG'.
#
D := -D
# The link flag used to specify a given library file on link. Note that
# this is only used to compile the demo programs, not the library itself.
#
L :=
# Target flag -- no trailing space.
#
T := -o
TE := -e
# C flags
#
# These should concern: debug output, optimization & warnings.
#
# Use the ANSIFLAGS variable to define the compiler flags used to enforce
# ANSI compliance.
#
CFLAGS ?= -q -c -y -d -v -Od -w-par -w-ccc -w-rch -w-pro -w-aus
# ANSIFLAGS: Put there the flags used to make your compiler ANSI-compliant.
#
ANSIFLAGS ?= -A
# Library linking
#
CLEAN_LIBRARY ?= $(DELETE) $(subst /,$(SEP),$(PROJECT_LIBRARY))
LINK_LIBRARY = tlib /u /P128 $(subst /,$(COMPILER_SEP),$@ $(OBJECTS_LIST:%=+%))
# Borland C++ specific temporary files
#
CLEAN += \
$(subst /,$(SEP),$(TOP_DIR)/apinames.$(O)) \
$(subst /,$(SEP),$(OBJ_DIR)/apinames.tds)
# EOF

86
builds/compiler/bcc.mk Normal file
View File

@ -0,0 +1,86 @@
#
# FreeType 2 Borland C++-specific rules
#
# Copyright (C) 1996-2024 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,
# and distributed under the terms of the FreeType project license,
# LICENSE.TXT. By continuing to use, modify, or distribute this file you
# indicate that you have read the license and understand and accept it
# fully.
# Compiler command line name
#
CC := bcc32
COMPILER_SEP := $(SEP)
# The object file extension (for standard and static libraries). This can be
# .o, .tco, .obj, etc., depending on the platform.
#
O := obj
SO := obj
# The library file extension (for standard and static libraries). This can
# be .a, .lib, etc., depending on the platform.
#
A := lib
SA := lib
# Path inclusion flag. Some compilers use a different flag than `-I' to
# specify an additional include path. Examples are `/i=' or `-J'.
#
I := -I
# C flag used to define a macro before the compilation of a given source
# object. Usually it is `-D' like in `-DDEBUG'.
#
D := -D
# The link flag used to specify a given library file on link. Note that
# this is only used to compile the demo programs, not the library itself.
#
L :=
# Target flag -- no trailing space.
#
T := -o
TE := -e
# C flags
#
# These should concern: debug output, optimization & warnings.
#
# Use the ANSIFLAGS variable to define the compiler flags used to enforce
# ANSI compliance.
#
CFLAGS ?= -c -q -y -d -v -Od -w-par -w-ccc -w-rch -w-pro -w-aus
# ANSIFLAGS: Put there the flags used to make your compiler ANSI-compliant.
#
ANSIFLAGS ?= -A
# Library linking
#
CLEAN_LIBRARY ?= $(DELETE) $(subst /,$(SEP),$(PROJECT_LIBRARY))
LINK_LIBRARY = tlib /u /P128 $(subst /,$(COMPILER_SEP),$@ $(OBJECTS_LIST:%=+%))
# Borland C++ specific temporary files
#
CLEAN += \
$(subst /,$(SEP),$(TOP_DIR)/apinames.$(O)) \
$(subst /,$(SEP),$(OBJ_DIR)/apinames.tds)
# EOF

77
builds/compiler/emx.mk Normal file
View File

@ -0,0 +1,77 @@
#
# FreeType 2 emx-specific definitions
#
# Copyright (C) 2003-2024 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,
# and distributed under the terms of the FreeType project license,
# LICENSE.TXT. By continuing to use, modify, or distribute this file you
# indicate that you have read the license and understand and accept it
# fully.
# Compiler command line name
#
CC := set GCCOPT="-ansi -pedantic"; gcc
COMPILER_SEP := /
# The object file extension (for standard and static libraries). This can be
# .o, .tco, .obj, etc., depending on the platform.
#
O := o
SO := o
# The library file extension (for standard and static libraries). This can
# be .a, .lib, etc., depending on the platform.
#
A := a
SA := a
# Path inclusion flag. Some compilers use a different flag than `-I' to
# specify an additional include path. Examples are `/i=' or `-J'.
#
I := -I
# C flag used to define a macro before the compilation of a given source
# object. Usually it is `-D' like in `-DDEBUG'.
#
D := -D
# The link flag used to specify a given library file on link. Note that
# this is only used to compile the demo programs, not the library itself.
#
L := -l
# Target flag.
#
T := -o$(space)
# C flags
#
# These should concern: debug output, optimization & warnings.
#
# Use the ANSIFLAGS variable to define the compiler flags used to enforce
# ANSI compliance.
#
CFLAGS ?= -c -g -O6 -Wall
# ANSIFLAGS: Put there the flags used to make your compiler ANSI-compliant.
#
ANSIFLAGS ?=
# Library linking
#
CLEAN_LIBRARY ?= $(DELETE) $(subst /,$(SEP),$(PROJECT_LIBRARY))
LINK_LIBRARY = $(foreach m,$(OBJECTS_LIST),$(AR) -r $@ $(m);) echo > nul
# EOF

View File

@ -0,0 +1,96 @@
#
# FreeType 2 gcc-specific with NO OPTIMIZATIONS + DEBUGGING
#
# Copyright (C) 1996-2024 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,
# and distributed under the terms of the FreeType project license,
# LICENSE.TXT. By continuing to use, modify, or distribute this file you
# indicate that you have read the license and understand and accept it
# fully.
# Compiler command line name
#
CC := gcc
COMPILER_SEP := /
# The object file extension (for standard and static libraries). This can be
# .o, .tco, .obj, etc., depending on the platform.
#
O := o
SO := o
# The library file extension (for standard and static libraries). This can
# be .a, .lib, etc., depending on the platform.
#
A := a
SA := a
# Path inclusion flag. Some compilers use a different flag than `-I' to
# specify an additional include path. Examples are `/i=' or `-J'.
#
I := -I
# C flag used to define a macro before the compilation of a given source
# object. Usually it is `-D' like in `-DDEBUG'.
#
D := -D
# The link flag used to specify a given library file on link. Note that
# this is only used to compile the demo programs, not the library itself.
#
L := -l
# Target flag.
#
T := -o$(space)
# C flags
#
# These should concern: debug output, optimization & warnings.
#
# Use the ANSIFLAGS variable to define the compiler flags used to enforce
# ANSI compliance.
#
ifndef CFLAGS
ifeq ($(findstring g++,$(CC)),)
nested_externs := -Wnested-externs
strict_prototypes := -Wstrict-prototypes
endif
CFLAGS := -c -g -O0 \
-Wall \
-W \
-Wundef \
-Wshadow \
-Wpointer-arith \
-Wwrite-strings \
-Wredundant-decls \
-Wno-long-long \
$(nested_externs) \
$(strict_prototypes)
endif
# ANSIFLAGS: Put there the flags used to make your compiler ANSI-compliant.
# You can override this on the command line.
#
ANSIFLAGS ?= -std=c99 -pedantic
# Library linking
#
CLEAN_LIBRARY ?= $(DELETE) $(subst /,$(SEP),$(PROJECT_LIBRARY))
LINK_LIBRARY = $(AR) -r $@ $(OBJECTS_LIST)
# EOF

77
builds/compiler/gcc.mk Normal file
View File

@ -0,0 +1,77 @@
#
# FreeType 2 gcc-specific definitions
#
# Copyright (C) 1996-2024 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,
# and distributed under the terms of the FreeType project license,
# LICENSE.TXT. By continuing to use, modify, or distribute this file you
# indicate that you have read the license and understand and accept it
# fully.
# Compiler command line name
#
CC := gcc
COMPILER_SEP := /
# The object file extension (for standard and static libraries). This can be
# .o, .tco, .obj, etc., depending on the platform.
#
O := o
SO := o
# The library file extension (for standard and static libraries). This can
# be .a, .lib, etc., depending on the platform.
#
A := a
SA := a
# Path inclusion flag. Some compilers use a different flag than `-I' to
# specify an additional include path. Examples are `/i=' or `-J'.
#
I := -I
# C flag used to define a macro before the compilation of a given source
# object. Usually it is `-D' like in `-DDEBUG'.
#
D := -D
# The link flag used to specify a given library file on link. Note that
# this is only used to compile the demo programs, not the library itself.
#
L := -l
# Target flag.
#
T := -o$(space)
# C flags
#
# These should concern: debug output, optimization & warnings.
#
# Use the ANSIFLAGS variable to define the compiler flags used to enforce
# ANSI compliance.
#
CFLAGS ?= -c -g -O3 -Wall
# ANSIFLAGS: Put there the flags used to make your compiler ANSI-compliant.
#
ANSIFLAGS ?= -std=c99 -pedantic
# Library linking
#
CLEAN_LIBRARY ?= $(DELETE) $(subst /,$(SEP),$(PROJECT_LIBRARY))
LINK_LIBRARY = $(AR) -r $@ $(OBJECTS_LIST)
# EOF

85
builds/compiler/intelc.mk Normal file
View File

@ -0,0 +1,85 @@
#
# FreeType 2 Intel C/C++ definitions (VC++ compatibility mode)
#
# Copyright (C) 1996-2024 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,
# and distributed under the terms of the FreeType project license,
# LICENSE.TXT. By continuing to use, modify, or distribute this file you
# indicate that you have read the license and understand and accept it
# fully.
# compiler command line name
#
CC := icl
COMPILER_SEP := $(SEP)
# The object file extension (for standard and static libraries). This can be
# .o, .tco, .obj, etc., depending on the platform.
#
O := obj
SO := obj
# The library file extension (for standard and static libraries). This can
# be .a, .lib, etc., depending on the platform.
#
A := lib
SA := lib
# Path inclusion flag. Some compilers use a different flag than `-I' to
# specify an additional include path. Examples are `/i=' or `-J'.
#
I := /I
# C flag used to define a macro before the compilation of a given source
# object. Usually it is `-D' like in `-DDEBUG'.
#
D := /D
# The link flag used to specify a given library file on link. Note that
# this is only used to compile the demo programs, not the library itself.
#
L := /Fl
# Target flag.
#
T := /Fo
TE := /Fe
# C flags
#
# These should concern: debug output, optimization & warnings.
#
# Use the ANSIFLAGS variable to define the compiler flags used to enforce
# ANSI compliance.
#
# Note that the Intel C/C++ compiler version 4.5 complains about
# the use of FT_FIELD_OFFSET with "value must be arithmetic type"!
# This really looks like a bug in the compiler because the macro
# _does_ compute an arithmetic value, so we disable this warning
# with "/Qwd32".
#
CFLAGS ?= /nologo /c /Ox /G5 /W3 /Qwd32
# ANSIFLAGS: Put there the flags used to make your compiler ANSI-compliant.
#
ANSIFLAGS ?= /Qansi_alias /Za
# Library linking
#
#CLEAN_LIBRARY =
LINK_LIBRARY = lib /nologo /out:$(subst /,$(COMPILER_SEP),$@ $(OBJECTS_LIST))
# EOF

View File

@ -0,0 +1,83 @@
#
# FreeType 2 Unix LCC specific definitions
#
# Copyright (C) 1996-2024 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,
# and distributed under the terms of the FreeType project license,
# LICENSE.TXT. By continuing to use, modify, or distribute this file you
# indicate that you have read the license and understand and accept it
# fully.
# Command line name
#
CC := lcc
COMPILER_SEP := $(SEP)
# The object file extension (for standard and static libraries). This can be
# .o, .tco, .obj, etc., depending on the platform.
#
O := o
SO := o
# The library file extension (for standard and static libraries). This can
# be .a, .lib, etc., depending on the platform.
#
A := a
SA := a
# Path inclusion flag. Some compilers use a different flag than `-I' to
# specify an additional include path. Examples are `/i=' or `-J'.
#
I := -I
# C flag used to define a macro before the compilation of a given source
# object. Usually it is `-D' like in `-DDEBUG'.
#
D := -D
# The link flag used to specify a given library file on link. Note that
# this is only used to compile the demo programs, not the library itself.
#
L := -l
# Target flag.
#
T := -o$(space)
# C flags
#
# These should concern: debug output, optimization & warnings.
#
# Use the ANSIFLAGS variable to define the compiler flags used to enforce
# ANSI compliance.
#
CFLAGS ?= -c -g
# ANSIFLAGS: Put there the flags used to make your compiler ANSI-compliant.
#
# LCC is pure ANSI anyway!
#
# the "-A" flag simply increments verbosity about non ANSI code
#
ANSIFLAGS ?= -A
# library linking
#
CLEAN_LIBRARY ?= $(DELETE) $(PROJECT_LIBRARY)
LINK_LIBRARY = $(AR) -r $@ $(OBJECTS_LIST)
# EOF

View File

@ -0,0 +1,76 @@
#
# FreeType 2 Visual Age C++ specific definitions
#
# Copyright (C) 1996-2024 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,
# and distributed under the terms of the FreeType project license,
# LICENSE.TXT. By continuing to use, modify, or distribute this file you
# indicate that you have read the license and understand and accept it
# fully.
# command line compiler name
#
CC := icc
COMPILER_SEP := $(SEP)
# The object file extension (for standard and static libraries). This can be
# .o, .tco, .obj, etc., depending on the platform.
#
O := obj
SO := obj
# The library file extension (for standard and static libraries). This can
# be .a, .lib, etc., depending on the platform.
#
A := lib
SA := lib
# Path inclusion flag. Some compilers use a different flag than `-I' to
# specify an additional include path. Examples are `/i=' or `-J'.
#
I := /I
# C flag used to define a macro before the compilation of a given source
# object. Usually it is `-D' like in `-DDEBUG'.
#
D := /D
# The link flag used to specify a given library file on link. Note that
# this is only used to compile the demo programs, not the library itself.
#
L := /Fl
# Target flag.
#
T := /Fo
# C flags
#
# These should concern: debug output, optimization & warnings.
#
CFLAGS ?= /Q- /Gd+ /O2 /G5 /W3 /C
# ANSIFLAGS: Put there the flags used to make your compiler ANSI-compliant.
#
ANSI_FLAGS := /Sa
# Library linking
#
#CLEAN_LIBRARY :=
LINK_LIBRARY = lib /nologo /out:$(subst /,$(COMPILER_SEP),$@ $(OBJECTS_LIST))
# EOF

View File

@ -0,0 +1,82 @@
#
# FreeType 2 Visual C++ definitions
#
# Copyright (C) 1996-2024 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,
# and distributed under the terms of the FreeType project license,
# LICENSE.TXT. By continuing to use, modify, or distribute this file you
# indicate that you have read the license and understand and accept it
# fully.
# compiler command line name
#
CC := cl
COMPILER_SEP := $(SEP)
# The object file extension (for standard and static libraries). This can be
# .o, .tco, .obj, etc., depending on the platform.
#
O := obj
SO := obj
# The library file extension (for standard and static libraries). This can
# be .a, .lib, etc., depending on the platform.
#
A := lib
SA := lib
# Path inclusion flag. Some compilers use a different flag than `-I' to
# specify an additional include path. Examples are `/i=' or `-J'.
#
I := /I
# C flag used to define a macro before the compilation of a given source
# object. Usually it is `-D' like in `-DDEBUG'.
#
D := /D
# The link flag used to specify a given library file on link. Note that
# this is only used to compile the demo programs, not the library itself.
#
L := /Fl
# Target flag.
#
T := /Fo
# Target executable flag
#
TE := /Fe
# C flags
#
# These should concern: debug output, optimization & warnings.
#
# Use the ANSIFLAGS variable to define the compiler flags used to enforce
# ANSI compliance.
#
CFLAGS ?= /nologo /c /Ox /W3 /WX
# ANSIFLAGS: Put there the flags used to make your compiler ANSI-compliant.
#
ANSIFLAGS ?= /Za /D_CRT_SECURE_NO_DEPRECATE
# Library linking
#
#CLEAN_LIBRARY =
LINK_LIBRARY = lib /nologo /out:$(subst /,$(COMPILER_SEP),$@ $(OBJECTS_LIST))
# EOF

81
builds/compiler/watcom.mk Normal file
View File

@ -0,0 +1,81 @@
#
# FreeType 2 Watcom-specific definitions
#
# Copyright (C) 1996-2024 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,
# and distributed under the terms of the FreeType project license,
# LICENSE.TXT. By continuing to use, modify, or distribute this file you
# indicate that you have read the license and understand and accept it
# fully.
# Compiler command line name
#
CC := wcc386
COMPILER_SEP := $(SEP)
# The object file extension (for standard and static libraries). This can be
# .o, .tco, .obj, etc., depending on the platform.
#
O := obj
SO := obj
# The library file extension (for standard and static libraries). This can
# be .a, .lib, etc., depending on the platform.
#
A := lib
SA := lib
# Path inclusion flag. Some compilers use a different flag than `-I' to
# specify an additional include path. Examples are `/i=' or `-J'.
#
I := -I=
# C flag used to define a macro before the compilation of a given source
# object. Usually it is `-D' like in `-DDEBUG'.
#
D := -D
# The link flag used to specify a given library file on link. Note that
# this is only used to compile the demo programs, not the library itself.
#
L := -l
# Target flag.
#
T := -FO=
# C flags
#
# These should concern: debug output, optimization & warnings.
#
# Use the ANSIFLAGS variable to define the compiler flags used to enforce
# ANSI compliance.
#
CFLAGS ?= -zq
# ANSIFLAGS: Put there the flags used to make your compiler ANSI-compliant.
#
ANSIFLAGS ?= -za
# Library linking
#
CLEAN_LIBRARY ?= $(DELETE) $(subst /,$(SEP),$(PROJECT_LIBRARY))
LINK_LIBRARY = $(subst /,$(COMPILER_SEP), \
wlib -q -n $@; \
$(foreach m, $(OBJECTS_LIST), wlib -q $@ +$(m);) \
echo > nul)
# EOF

View File

@ -0,0 +1,81 @@
#
# FreeType 2 Win32-LCC specific definitions
#
# Copyright (C) 1996-2024 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,
# and distributed under the terms of the FreeType project license,
# LICENSE.TXT. By continuing to use, modify, or distribute this file you
# indicate that you have read the license and understand and accept it
# fully.
# Command line name
#
CC := lcc
COMPILER_SEP := $(SEP)
# The object file extension (for standard and static libraries). This can be
# .o, .tco, .obj, etc., depending on the platform.
#
O := obj
SO := obj
# The library file extension (for standard and static libraries). This can
# be .a, .lib, etc., depending on the platform.
#
A := lib
SA := lib
# Path inclusion flag. Some compilers use a different flag than `-I' to
# specify an additional include path. Examples are `/i=' or `-J'.
#
I := -I
# C flag used to define a macro before the compilation of a given source
# object. Usually it is `-D' like in `-DDEBUG'.
#
D := -D
# The link flag used to specify a given library file on link. Note that
# this is only used to compile the demo programs, not the library itself.
#
L := -Fl
# Target flag.
#
T := -Fo
# C flags
#
# These should concern: debug output, optimization & warnings.
#
# Use the ANSIFLAGS variable to define the compiler flags used to enforce
# ANSI compliance.
#
CFLAGS ?= -c -g2 -O
# ANSIFLAGS: Put there the flags used to make your compiler ANSI-compliant.
#
# LCC is pure ANSI anyway!
#
ANSIFLAGS ?=
# library linking
#
#CLEAN_LIBRARY :=
LINK_LIBRARY = lcclib /out:$(subst /,$(COMPILER_SEP),$@ $(OBJECTS_LIST))
# EOF

View File

@ -3,7 +3,7 @@
#
# Copyright 1996-2000 by
# Copyright (C) 1996-2024 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,
@ -16,9 +16,9 @@
# This sub-Makefile is in charge of detecting the current platform. It sets
# the following variables:
#
# BUILD The configuration and system-specific directory. Usually
# `freetype/builds/$(PLATFORM)' but can be different for
# custom builds of the library.
# PLATFORM_DIR The configuration and system-specific directory. Usually
# `builds/$(PLATFORM)' but can be different for custom builds
# of the library.
#
# The following variables must be defined in system specific `detect.mk'
# files:
@ -30,31 +30,27 @@
# DELETE The shell command used to remove a given file.
# COPY The shell command used to copy one file.
# SEP The platform-specific directory separator.
# COMPILER_SEP The separator used in arguments of the compilation tools.
# CC The compiler to use.
#
# You need to set the following variable(s) before calling it:
#
# TOP The top-most directory in the FreeType library source
# TOP_DIR The top-most directory in the FreeType library source
# hierarchy. If not defined, it will default to `.'.
# If TOP is not defined, default it to `.'
#
ifndef TOP
TOP := .
endif
# Set auto-detection default to `ansi' resp. UNIX-like operating systems.
# Note that we delay the evaluation of $(BUILD_CONFIG_), $(BUILD), and
# $(CONFIG_RULES).
#
PLATFORM := ansi
DELETE := $(RM)
COPY := cp
SEP := /
PLATFORM := ansi
DELETE := $(RM)
COPY := cp
CAT := cat
SEP := /
BUILD_CONFIG_ = $(TOP)$(SEP)builds$(SEP)
BUILD = $(BUILD_CONFIG_)$(PLATFORM)
CONFIG_RULES = $(BUILD)$(SEP)$(CONFIG_FILE)
BUILD_CONFIG := $(TOP_DIR)/builds
# These two assignments must be delayed.
PLATFORM_DIR = $(BUILD_CONFIG)/$(PLATFORM)
CONFIG_RULES = $(PLATFORM_DIR)/$(CONFIG_FILE)
# We define the BACKSLASH variable to hold a single back-slash character.
# This is needed because a line like
@ -70,61 +66,63 @@ CONFIG_RULES = $(BUILD)$(SEP)$(CONFIG_FILE)
#
BACKSLASH := $(strip \ )
# Now, include all detection rule files found in the `builds/<system>'
# directories. Note that the calling order of the various `detect.mk' files
# isn't predictable.
# Find all auto-detectable platforms.
#
include $(wildcard $(BUILD_CONFIG_)*/detect.mk)
PLATFORMS := $(notdir $(subst /detect.mk,,$(wildcard $(BUILD_CONFIG)/*/detect.mk)))
.PHONY: $(PLATFORMS) ansi
# Filter out platform specified as setup target.
#
PLATFORM := $(firstword $(filter $(MAKECMDGOALS),$(PLATFORMS)))
# If no setup target platform was specified, enable auto-detection/
# default platform.
#
ifeq ($(PLATFORM),)
PLATFORM := ansi
endif
# If the user has explicitly asked for `ansi' on the command line,
# disable auto-detection.
#
ifeq ($(findstring ansi,$(MAKECMDGOALS)),)
# Now, include all detection rule files found in the `builds/<system>'
# directories. Note that the calling order of the various `detect.mk'
# files isn't predictable.
#
include $(wildcard $(BUILD_CONFIG)/*/detect.mk)
endif
# In case no detection rule file was successful, use the default.
#
ifndef CONFIG_FILE
CONFIG_FILE := ansi.mk
setup: std_setup
.PHONY: setup
endif
# The following targets are equivalent, with the exception that they use
# a slightly different syntax for the `echo' command.
# Flash out and copy rules.
#
# std_setup: defined for most (i.e. Unix-like) platforms
# dos_setup: defined for Dos-ish platforms like Dos, Windows & OS/2
#
.PHONY: std_setup dos_setup
.PHONY: std_setup
std_setup:
@echo ""
@echo "FreeType build system -- automatic system detection"
@echo ""
@echo "The following settings are used:"
@echo ""
@echo " platform $(PLATFORM)"
@echo " compiler $(CC)"
@echo " configuration directory $(BUILD)"
@echo " configuration rules $(CONFIG_RULES)"
@echo ""
@echo "If this does not correspond to your system or settings please remove the file"
@echo "\`$(CONFIG_MK)' from this directory then read the INSTALL file for help."
@echo ""
@echo "Otherwise, simply type \`make' again to build the library."
@echo ""
@$(COPY) $(CONFIG_RULES) $(CONFIG_MK)
$(info )
$(info $(PROJECT_TITLE) build system -- automatic system detection)
$(info )
$(info The following settings are used:)
$(info )
$(info $(empty) platform $(PLATFORM))
$(info $(empty) compiler $(CC))
$(info $(empty) configuration directory $(subst /,$(SEP),$(PLATFORM_DIR)))
$(info $(empty) configuration rules $(subst /,$(SEP),$(CONFIG_RULES)))
$(info )
$(info If this does not correspond to your system or settings please remove the file)
$(info `$(CONFIG_MK)' from this directory then read the INSTALL file for help.)
$(info )
$(info Otherwise, simply type `$(MAKE)' again to build the library,)
$(info or `$(MAKE) refdoc' to build the API reference (this needs Python >= 3.5).)
$(info )
@$(COPY) $(subst /,$(SEP),$(CONFIG_RULES) $(CONFIG_MK))
dos_setup:
@echo ÿ
@echo FreeType build system -- automatic system detection
@echo ÿ
@echo The following settings are used:
@echo ÿ
@echo ÿÿplatformÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ$(PLATFORM)
@echo ÿÿcompilerÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ$(CC)
@echo ÿÿconfiguration directoryÿÿÿÿÿÿ$(BUILD)
@echo ÿÿconfiguration rulesÿÿÿÿÿÿÿÿÿÿ$(CONFIG_RULES)
@echo ÿ
@echo If this does not correspond to your system or settings please remove the file
@echo '$(CONFIG_MK)' from this directory then read the INSTALL file for help.
@echo ÿ
@echo Otherwise, simply type 'make' again to build the library.
@echo ÿ
@$(COPY) $(subst /,\,$(CONFIG_RULES) $(CONFIG_MK)) > nul
# EOF

View File

@ -3,7 +3,7 @@
#
# Copyright 1996-2000 by
# Copyright (C) 1996-2024 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,
@ -13,75 +13,140 @@
# fully.
# We test for the COMSPEC environment variable, then run the `ver'
# command-line program to see if its output contains the word `Dos'.
#
# If this is true, we are running a Dos-ish platform (or an emulation).
#
.PHONY: setup
ifeq ($(PLATFORM),ansi)
ifdef COMSPEC
# Test for DJGPP by checking the DJGPP environment variable, which must be
# set in order to use the system (ie. it will always be present when the
# `make' utility is run).
#
# We test for the COMSPEC environment variable, then run the `ver'
# command-line program to see if its output contains the word `Dos' or
# `DOS'.
#
# If this is true, we are running a Dos-ish platform (or an emulation).
#
ifdef DJGPP
PLATFORM := dos
else
ifdef COMSPEC
is_dos := $(findstring DOS,$(subst Dos,DOS,$(shell ver)))
is_dos := $(findstring Dos,$(shell ver))
# We try to recognize a Dos session under OS/2. The `ver' command
# returns `Operating System/2 ...' there, so `is_dos' should be empty.
#
# To recognize a Dos session under OS/2, we check COMSPEC for the
# substring `MDOS\COMMAND'
#
ifeq ($(is_dos),)
is_dos := $(findstring MDOS\COMMAND,$(COMSPEC))
endif
# We try to recognize a Dos session under OS/2. The `ver' command
# returns `Operating System/2 ...' there, so `is_dos' should be empty.
#
# To recognize a Dos session under OS/2, we check COMSPEC for the
# substring `MDOS\COMMAND'
#
ifeq ($(is_dos),)
is_dos := $(findstring MDOS\COMMAND,$(COMSPEC))
endif
# We also try to recognize Dos 7.x without Windows 9X launched.
# See builds/windows/detect.mk for explanations about the logic.
#
ifeq ($(is_dos),)
ifdef winbootdir
#ifneq ($(OS),Windows_NT)
# If windows is available, do not trigger this test.
ifndef windir
is_dos := $(findstring Windows,$(strip $(shell ver)))
endif
#endif
endif
endif
endif # test COMSPEC
ifneq ($(is_dos),)
PLATFORM := dos
DELETE := del
COPY := copy
# Use DJGPP (i.e. gcc) by default.
#
CONFIG_FILE := dos-gcc.mk
SEP := /
ifndef CC
CC := gcc
endif
# additionally, we provide hooks for various other compilers
#
ifneq ($(findstring turboc,$(MAKECMDGOALS)),) # Turbo C
CONFIG_FILE := dos-tcc.mk
SEP := $(BACKSLASH)
CC := tcc
.PHONY: turboc
endif
ifneq ($(findstring watcom,$(MAKECMDGOALS)),) # Watcom C/C++
CONFIG_FILE := dos-wat.mk
SEP := $(BACKSLASH)
CC := wcc386
.PHONY: watcom
endif
ifneq ($(findstring borlandc16,$(MAKECMDGOALS)),) # Borland C/C++ 16-bit
CONFIG_FILE := dos-bcc.mk
SEP := $(BACKSLASH)
CC := bcc
.PHONY: borlandc16
endif
ifneq ($(findstring borlandc,$(MAKECMDGOALS)),) # Borland C/C++ 32-bit
CONFIG_FILE := dos-bcc.mk
SEP := $(BACKSLASH)
CC := bcc32
.PHONY: borlandc
endif
setup: dos_setup
endif # test Dos
endif # test COMSPEC
endif # test PLATFORM
endif # test DJGPP
endif # test PLATFORM ansi
ifeq ($(PLATFORM),dos)
# Use DJGPP (i.e. gcc) by default.
#
CONFIG_FILE := dos-gcc.mk
CC ?= gcc
# additionally, we provide hooks for various other compilers
#
ifneq ($(findstring emx,$(MAKECMDGOALS)),) # EMX gcc
CONFIG_FILE := dos-emx.mk
CC := gcc
.PHONY: emx
emx: setup
@cd .
endif
ifneq ($(findstring turboc,$(MAKECMDGOALS)),) # Turbo C
CONFIG_FILE := dos-tcc.mk
CC := tcc
.PHONY: turboc
turboc: setup
@cd .
endif
ifneq ($(findstring watcom,$(MAKECMDGOALS)),) # Watcom C/C++
CONFIG_FILE := dos-wat.mk
CC := wcc386
.PHONY: watcom
watcom: setup
@cd .
endif
ifneq ($(findstring borlandc,$(MAKECMDGOALS)),) # Borland C/C++ 32-bit
CONFIG_FILE := dos-bcc.mk
CC := bcc32
.PHONY: borlandc
borlandc: setup
@cd .
endif
ifneq ($(findstring borlandc16,$(MAKECMDGOALS)),) # Borland C/C++ 16-bit
CONFIG_FILE := dos-bcc.mk
CC := bcc
.PHONY: borlandc16
borlandc16: setup
@cd .
endif
ifneq ($(findstring bash,$(SHELL)),) # check for bash
SEP := /
DELETE := rm
COPY := cp
CAT := cat
setup: std_setup
else
SEP := $(BACKSLASH)
DELETE := del
CAT := type
# Setting COPY is a bit trickier. We can be running DJGPP on some
# Windows NT derivatives, like XP. See builds/windows/detect.mk for
# explanations why we need hacking here.
#
ifeq ($(OS),Windows_NT)
COPY := cmd.exe /c copy
else
COPY := copy
endif # test NT
setup: std_setup
endif
endif # test PLATFORM dos
# EOF

48
builds/dos/dos-def.mk Normal file
View File

@ -0,0 +1,48 @@
#
# FreeType 2 DOS specific definitions
#
# Copyright (C) 1996-2024 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,
# and distributed under the terms of the FreeType project license,
# LICENSE.TXT. By continuing to use, modify, or distribute this file you
# indicate that you have read the license and understand and accept it
# fully.
DELETE := del
CAT := type
SEP := $(strip \ )
PLATFORM_DIR := $(TOP_DIR)/builds/dos
PLATFORM := dos
# This is used for `make refdoc' and `make refdoc-venv'
#
BIN := Scripts
# The executable file extension (for tools), *with* leading dot.
#
E := .exe
# The directory where all library files are placed.
#
# By default, this is the same as $(OBJ_DIR); however, this can be changed
# to suit particular needs.
#
LIB_DIR := $(OBJ_DIR)
# The name of the final library file. Note that the DOS-specific Makefile
# uses a shorter (8.3) name.
#
LIBRARY := $(PROJECT)
# The NO_OUTPUT macro is used to ignore the output of commands.
#
NO_OUTPUT = > nul
# EOF

21
builds/dos/dos-emx.mk Normal file
View File

@ -0,0 +1,21 @@
#
# FreeType 2 configuration rules for the EMX gcc compiler
#
# Copyright (C) 2003-2024 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,
# and distributed under the terms of the FreeType project license,
# LICENSE.TXT. By continuing to use, modify, or distribute this file you
# indicate that you have read the license and understand and accept it
# fully.
include $(TOP_DIR)/builds/dos/dos-def.mk
include $(TOP_DIR)/builds/compiler/emx.mk
include $(TOP_DIR)/builds/link_dos.mk
# EOF

View File

@ -3,7 +3,7 @@
#
# Copyright 1996-2000 by
# Copyright (C) 1996-2024 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,
@ -13,122 +13,9 @@
# fully.
ifndef TOP
TOP := .
endif
include $(TOP_DIR)/builds/dos/dos-def.mk
include $(TOP_DIR)/builds/compiler/gcc.mk
include $(TOP_DIR)/builds/link_dos.mk
DELETE := rm -f
SEP := /
HOSTSEP := $(strip \ )
BUILD := $(TOP)/builds/dos
PLATFORM := dos
# The directory where all object files are placed.
#
# Note that this is not $(TOP)/obj!
# This lets you build the library in your own directory with something like
#
# set TOP=.../path/to/freetype2/top/dir...
# mkdir obj
# make -f %TOP%/Makefile setup [options]
# make -f %TOP%/Makefile
#
OBJ_DIR := obj
# The directory where all library files are placed.
#
# By default, this is the same as $(OBJ_DIR), however, this can be changed
# to suit particular needs.
#
LIB_DIR := $(OBJ_DIR)
# The object file extension (for standard and static libraries). This can be
# .o, .tco, .obj, etc., depending on the platform.
#
O := o
SO := o
# The library file extension (for standard and static libraries). This can
# be .a, .lib, etc., depending on the platform.
#
A := a
SA := a
# The name of the final library file. Note that the DOS-specific Makefile
# uses a shorter (8.3) name.
#
LIBRARY := libfreetype
# Path inclusion flag. Some compilers use a different flag than `-I' to
# specify an additional include path. Examples are `/i=' or `-J'.
#
I := -I
# C flag used to define a macro before the compilation of a given source
# object. Usually is `-D' like in `-DDEBUG'.
#
D := -D
# The link flag used to specify a given library file on link. Note that
# this is only used to compile the demo programs, not the library itself.
#
L := -l
# Target flag.
#
T := -o # Don't remove this comment line! We need the space after `-o'.
# C flags
#
# These should concern: debug output, optimization & warnings.
#
# Use the ANSIFLAGS variable to define the compiler flags used to enfore
# ANSI compliance.
#
ifndef CFLAGS
CFLAGS := -c -g -O6 -Wall
endif
# ANSIFLAGS: Put there the flags used to make your compiler ANSI-compliant.
#
ANSIFLAGS := -ansi -pedantic
ifdef BUILD_FREETYPE
# Now include the main sub-makefile. It contains all the rules used to
# build the library with the previous variables defined.
#
include $(TOP)/builds/freetype.mk
# The cleanup targets.
#
clean_freetype: clean_freetype_dos
distclean_freetype: distclean_freetype_dos
# Librarian to use to build the static library
#
FT_LIBRARIAN := $(AR) -r
# This final rule is used to link all object files into a single library.
# It is part of the system-specific sub-Makefile because not all
# librarians accept a simple syntax like:
#
# librarian library_file {list of object files}
#
$(FT_LIBRARY): $(OBJECTS_LIST)
-$(DELETE) $@
$(FT_LIBRARIAN) $@ $(OBJECTS_LIST)
endif
# EOF

20
builds/dos/dos-wat.mk Normal file
View File

@ -0,0 +1,20 @@
#
# FreeType 2 configuration rules for the Watcom C/C++ compiler
#
# Copyright (C) 2003-2024 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,
# and distributed under the terms of the FreeType project license,
# LICENSE.TXT. By continuing to use, modify, or distribute this file you
# indicate that you have read the license and understand and accept it
# fully.
include $(TOP_DIR)/builds/dos/dos-def.mk
include $(TOP_DIR)/builds/compiler/watcom.mk
include $(TOP_DIR)/builds/link_dos.mk
# EOF

80
builds/exports.mk Normal file
View File

@ -0,0 +1,80 @@
#
# FreeType 2 exports sub-Makefile
#
# Copyright (C) 2005-2024 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,
# and distributed under the terms of the FreeType project license,
# LICENSE.TXT. By continuing to use, modify, or distribute this file you
# indicate that you have read the license and understand and accept it
# fully.
# DO NOT INVOKE THIS MAKEFILE DIRECTLY! IT IS MEANT TO BE INCLUDED BY
# OTHER MAKEFILES.
# This sub-Makefile is used to compute the list of exported symbols whenever
# the EXPORTS_LIST variable is defined by one of the platform or compiler
# specific build files.
#
# EXPORTS_LIST contains the name of the `list' file, for example a Windows
# .DEF file.
#
ifneq ($(EXPORTS_LIST),)
# CCexe is the compiler used to compile the `apinames' tool program
# on the host machine. This isn't necessarily the same as the compiler
# which can be a cross-compiler for a different architecture, for example.
#
ifeq ($(CCexe),)
CCexe := $(CC)
endif
# TE acts like T, but for executables instead of object files.
ifeq ($(TE),)
TE := $T
endif
# The list of public headers we're going to parse.
PUBLIC_HEADERS := $(filter-out $(PUBLIC_DIR)/ftmac.h, \
$(wildcard $(PUBLIC_DIR)/*.h))
ifneq ($(ftmac_c),)
PUBLIC_HEADERS += $(PUBLIC_DIR)/ftmac.h
endif
# The `apinames' source and executable. We use $E_BUILD as the host
# executable suffix, which *includes* the final dot.
#
# Note that $(APINAMES_OPTIONS) is empty, except for Windows compilers.
#
APINAMES_SRC := $(subst /,$(SEP),$(TOP_DIR)/src/tools/apinames.c)
APINAMES_EXE := $(subst /,$(SEP),$(OBJ_DIR)/apinames$(E_BUILD))
$(APINAMES_EXE): $(APINAMES_SRC)
$(CCexe) $(CCexe_CFLAGS) $(TE)$@ $< $(CCexe_LDFLAGS)
.PHONY: symbols_list
symbols_list: $(EXPORTS_LIST)
# We manually add TT_New_Context and TT_RunIns, which are needed by TT
# debuggers, to the EXPORTS_LIST.
#
$(EXPORTS_LIST): $(APINAMES_EXE) $(PUBLIC_HEADERS)
$(subst /,$(SEP),$(APINAMES_EXE)) -o$@ $(APINAMES_OPTIONS) $(PUBLIC_HEADERS)
@echo TT_New_Context >> $(EXPORTS_LIST)
@echo TT_RunIns >> $(EXPORTS_LIST)
$(PROJECT_LIBRARY): $(EXPORTS_LIST)
CLEAN += $(EXPORTS_LIST) \
$(APINAMES_EXE)
endif
# EOF

View File

@ -3,7 +3,7 @@
#
# Copyright 1996-2000 by
# Copyright (C) 1996-2024 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,
@ -20,15 +20,19 @@
# The following variables (set by other Makefile components, in the
# environment, or on the command line) are used:
#
# BUILD The architecture dependent directory,
# e.g. `$(TOP)/builds/unix'.
# PLATFORM_DIR The architecture-dependent directory,
# e.g., `$(TOP_DIR)/builds/unix'. Added to INCLUDES also.
#
# OBJ_DIR The directory in which object files are created.
#
# LIB_DIR The directory in which the library is created.
#
# DOC_DIR The directory in which the API reference is created.
#
# INCLUDES A list of directories to be included additionally.
# Usually empty.
#
# DEVEL_DIR Development directory which is added to the INCLUDES
# variable before the standard include directories.
#
# CFLAGS Compilation flags. This overrides the default settings
# in the platform-specific configuration files.
@ -40,9 +44,9 @@
# file for `src/base/ftdebug.c'. [For a normal build, this
# file does nothing.]
#
# FT_MODULE_LIST The file which contains the list of modules for the
# current build. Usually, this is automatically created by
# `modules.mk'.
# FTMODULE_H The file which contains the list of module classes for
# the current build. Usually, this is automatically
# created by `modules.mk'.
#
# BASE_OBJ_S
# BASE_OBJ_M A list of base objects (for single object and multiple
@ -62,7 +66,8 @@
# variables which is to be removed for the `clean' resp.
# `distclean' target.
#
# TOP, SEP,
# TOP_DIR, SEP,
# COMPILER_SEP,
# LIBRARY, CC,
# A, I, O, T Check `config.mk' for details.
@ -70,7 +75,7 @@
# The targets `objects' and `library' are defined at the end of this
# Makefile after all other rules have been included.
#
.PHONY: single objects library
.PHONY: single multi objects library refdoc refdoc-venv
# default target -- build single objects and library
#
@ -83,60 +88,78 @@ multi: objects library
# The FreeType source directory, usually `./src'.
#
SRC := $(TOP)$(SEP)src
SRC_DIR := $(TOP_DIR)/src
# The directory where the base layer components are placed, usually
# `./src/base'.
#
BASE_DIR := $(SRC)$(SEP)base
BASE_DIR := $(SRC_DIR)/base
# Other derived directories.
#
PUBLIC_DIR := $(TOP_DIR)/include/freetype
INTERNAL_DIR := $(PUBLIC_DIR)/internal
SERVICES_DIR := $(INTERNAL_DIR)/services
CONFIG_DIR := $(PUBLIC_DIR)/config
# A few short-cuts in order to avoid typing $(SEP) all the time for the
# directory separator.
# The documentation directory.
#
# For example: $(SRC_) equals to `./src/' where `.' is $(TOP).
#
#
SRC_ := $(SRC)$(SEP)
BASE_ := $(BASE_DIR)$(SEP)
OBJ_ := $(OBJ_DIR)$(SEP)
LIB_ := $(LIB_DIR)$(SEP)
PUBLIC_ := $(TOP)$(SEP)include$(SEP)freetype$(SEP)
INTERNAL_ := $(PUBLIC_)internal$(SEP)
CONFIG_ := $(PUBLIC_)config$(SEP)
DOC_DIR ?= $(TOP_DIR)/docs
# The final name of the library file.
#
FT_LIBRARY := $(LIB_)$(LIBRARY).$A
PROJECT_LIBRARY := $(LIB_DIR)/$(LIBRARY).$A
# include paths
#
# IMPORTANT NOTE: The architecture-dependent directory must ALWAYS be placed
# in front of the include list. Porters are then able to
# before the standard include list. Porters are then able to
# put their own version of some of the FreeType components
# in the `freetype/builds/<system>' directory, as these
# files will override the default sources.
# in the `builds/<system>' directory, as these files will
# override the default sources.
#
INCLUDES := $(BUILD) $(TOP)$(SEP)include $(SRC)
INCLUDES := $(subst /,$(COMPILER_SEP),$(OBJ_DIR) \
$(DEVEL_DIR) \
$(PLATFORM_DIR) \
$(TOP_DIR)/include)
INCLUDE_FLAGS = $(INCLUDES:%=$I%)
INCLUDE_FLAGS := $(INCLUDES:%=$I%)
# For a development build, we assume that the external library dependencies
# defined in `ftoption.h' are fulfilled, so we directly access the necessary
# include directory information using `pkg-config'.
#
ifdef DEVEL_DIR
INCLUDE_FLAGS += $(shell pkg-config --cflags libpng)
INCLUDE_FLAGS += $(shell pkg-config --cflags harfbuzz)
INCLUDE_FLAGS += $(shell pkg-config --cflags libbrotlidec)
endif
# C flags used for the compilation of an object file. This must include at
# least the paths for the `base' and `builds/<system>' directories;
# debug/optimization/warning flags + ansi compliance if needed.
#
FT_CFLAGS = $(CFLAGS) $(INCLUDE_FLAGS)
FT_CC = $(CC) $(FT_CFLAGS)
FT_COMPILE = $(CC) $(ANSIFLAGS) $(FT_CFLAGS)
# Include the `modules' rules file.
# $(INCLUDE_FLAGS) should come before $(CFLAGS) to avoid problems with
# old FreeType versions.
#
include $(TOP)/builds/modules.mk
# Note what we also define the macro FT2_BUILD_LIBRARY when building
# FreeType. This is required to let our sources include the internal
# headers (something forbidden by clients).
#
# `CPPFLAGS' might be specified by the user in the environment.
#
FT_CFLAGS = $(CPPFLAGS) \
$(CFLAGS) \
$DFT2_BUILD_LIBRARY
FT_COMPILE := $(CC) $(ANSIFLAGS) $(INCLUDE_FLAGS) $(FT_CFLAGS)
# Include the `exports' rules file.
#
include $(TOP_DIR)/builds/exports.mk
# Initialize the list of objects.
@ -145,50 +168,59 @@ OBJECTS_LIST :=
# Define $(PUBLIC_H) as the list of all public header files located in
# `$(TOP)/include/freetype'. $(BASE_H) and $(CONFIG_H) are defined
# similarly.
# `$(TOP_DIR)/include/freetype'. $(INTERNAL_H), and $(CONFIG_H) are defined
# similarly. $(FTOPTION_H) is the option file used in the compilation.
#
# This is used to simplify the dependency rules -- if one of these files
# changes, the whole library is recompiled.
#
PUBLIC_H := $(wildcard $(PUBLIC_)*.h)
BASE_H := $(wildcard $(INTERNAL_)*.h)
CONFIG_H := $(wildcard $(CONFIG_)*.h)
ifneq ($(wildcard $(OBJ_DIR)/ftoption.h),)
FTOPTION_H := $(OBJ_DIR)/ftoption.h
else ifneq ($(wildcard $(PLATFORM_DIR)/ftoption.h),)
FTOPTION_H := $(PLATFORM_DIR)/ftoption.h
endif
FREETYPE_H := $(PUBLIC_H) $(BASE_H) $(CONFIG_H)
PUBLIC_H := $(wildcard $(PUBLIC_DIR)/*.h)
INTERNAL_H := $(wildcard $(INTERNAL_DIR)/*.h) \
$(wildcard $(SERVICES_DIR)/*.h)
CONFIG_H := $(wildcard $(CONFIG_DIR)/*.h) \
$(wildcard $(PLATFORM_DIR)/config/*.h) \
$(FTMODULE_H) \
$(FTOPTION_H)
DEVEL_H := $(wildcard $(TOP_DIR)/devel/*.h)
FREETYPE_H := $(PUBLIC_H) $(INTERNAL_H) $(CONFIG_H) $(DEVEL_H)
# ftsystem component
#
ifndef FTSYS_SRC
FTSYS_SRC = $(BASE_)ftsystem.c
endif
FTSYS_SRC ?= $(BASE_DIR)/ftsystem.c
FTSYS_OBJ = $(OBJ_)ftsystem.$O
FTSYS_OBJ := $(OBJ_DIR)/ftsystem.$O
OBJECTS_LIST += $(FTSYS_OBJ)
$(FTSYS_OBJ): $(FTSYS_SRC) $(FREETYPE_H)
$(FT_COMPILE) $T$@ $<
$(FT_COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $<)
# ftdebug component
#
ifndef FTDEBUG_SRC
FTDEBUG_SRC = $(BASE_)ftdebug.c
endif
FTDEBUG_SRC ?= $(BASE_DIR)/ftdebug.c
FTDEBUG_OBJ = $(OBJ_)ftdebug.$O
FTDEBUG_OBJ := $(OBJ_DIR)/ftdebug.$O
OBJECTS_LIST += $(FTDEBUG_OBJ)
$(FTDEBUG_OBJ): $(FTDEBUG_SRC) $(FREETYPE_H)
$(FT_COMPILE) $T$@ $<
$(FT_COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $<)
# Include all rule files from FreeType components.
#
include $(wildcard $(SRC)/*/rules.mk)
include $(SRC_DIR)/base/rules.mk
include $(patsubst %,$(SRC_DIR)/%/rules.mk,$(MODULES))
include $(SRC_DIR)/dlg/rules.mk
# ftinit component
@ -202,22 +234,35 @@ include $(wildcard $(SRC)/*/rules.mk)
# which contain additional include paths and macros used to compile the
# single `ftinit.c' source.
#
FTINIT_SRC := $(BASE_)ftinit.c
FTINIT_OBJ := $(OBJ_)ftinit.$O
FTINIT_SRC := $(BASE_DIR)/ftinit.c
FTINIT_OBJ := $(OBJ_DIR)/ftinit.$O
OBJECTS_LIST += $(FTINIT_OBJ)
$(FTINIT_OBJ): $(FTINIT_SRC) $(FREETYPE_H) $(FT_MODULE_LIST)
$(FT_COMPILE) $T$@ $<
$(FTINIT_OBJ): $(FTINIT_SRC) $(FREETYPE_H)
$(FT_COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $<)
# All FreeType library objects
# ftver component
#
# By default, we include the base layer extensions. These could be
# omitted on builds which do not want them.
# The VERSIONINFO resource `ftver.rc' contains version and copyright
# to be compiled by windres and tagged into DLL usually.
#
OBJ_M = $(BASE_OBJ_M) $(BASE_EXT_OBJ) $(DRV_OBJS_M)
OBJ_S = $(BASE_OBJ_S) $(BASE_EXT_OBJ) $(DRV_OBJS_S)
ifneq ($(RC),)
FTVER_SRC := $(BASE_DIR)/ftver.rc
FTVER_OBJ := $(OBJ_DIR)/ftver.$O
OBJECTS_LIST += $(FTVER_OBJ)
$(FTVER_OBJ): $(FTVER_SRC)
$(RC) -o $@ $<
endif
# All FreeType library objects.
#
OBJ_M := $(BASE_OBJ_M) $(BASE_EXT_OBJ) $(DRV_OBJS_M) $(DLG_OBJS_M)
OBJ_S := $(BASE_OBJ_S) $(BASE_EXT_OBJ) $(DRV_OBJS_S) $(DLG_OBJS_S)
# The target `multi' on the Make command line indicates that we want to
@ -237,43 +282,104 @@ endif
objects: $(OBJECTS_LIST)
library: $(FT_LIBRARY)
library: $(PROJECT_LIBRARY)
.c.$O:
$(FT_COMPILE) $T$@ $<
# Run `docwriter' in the current Python environment.
#
PYTHON ?= python
refdoc:
@echo Running docwriter...
$(PYTHON) -m docwriter \
--prefix=ft2 \
--title=FreeType-$(version) \
--site=reference \
--output=$(DOC_DIR) \
$(PUBLIC_DIR)/*.h \
$(PUBLIC_DIR)/config/*.h \
$(PUBLIC_DIR)/cache/*.h
@echo Building static site...
cd $(DOC_DIR) && $(PYTHON) -m mkdocs build
@echo Done.
# Variables for running `refdoc' with Python's `virtualenv'. The
# environment is created in `DOC_DIR/env' and is gitignored.
#
# We still need to cd into `DOC_DIR' to build `mkdocs' because paths in
# `mkdocs.yml' are relative to the current working directory.
#
VENV_NAME := env
VENV_DIR := $(DOC_DIR)$(SEP)$(VENV_NAME)
ENV_PYTHON := $(VENV_DIR)$(SEP)$(BIN)$(SEP)$(PYTHON)
refdoc-venv:
@echo Setting up virtualenv for Python...
virtualenv --python=$(PYTHON) $(VENV_DIR)
@echo Installing docwriter...
$(ENV_PYTHON) -m pip install docwriter
@echo Running docwriter...
$(ENV_PYTHON) -m docwriter \
--prefix=ft2 \
--title=FreeType-$(version) \
--site=reference \
--output=$(DOC_DIR) \
$(PUBLIC_DIR)/*.h \
$(PUBLIC_DIR)/config/*.h \
$(PUBLIC_DIR)/cache/*.h
@echo Building static site...
cd $(DOC_DIR) && $(VENV_NAME)$(SEP)$(BIN)$(SEP)python -m mkdocs build
@echo Done.
.PHONY: clean_project_std distclean_project_std
# Standard cleaning and distclean rules. These are not accepted
# on all systems though.
#
clean_freetype_std:
clean_project_std:
-$(DELETE) $(BASE_OBJECTS) $(OBJ_M) $(OBJ_S) $(CLEAN)
distclean_freetype_std: clean_freetype_std
-$(DELETE) $(FT_LIBRARY)
distclean_project_std: clean_project_std
-$(DELETE) $(PROJECT_LIBRARY)
-$(DELETE) *.orig *~ core *.core $(DISTCLEAN)
.PHONY: clean_project_dos distclean_project_dos
# The Dos command shell does not support very long list of arguments, so
# we are stuck with wildcards.
#
clean_freetype_dos:
-$(DELETE) $(subst $(SEP),$(HOSTSEP),$(OBJ_))*.$O $(CLEAN) 2> nul
# Don't break the command lines with \; this prevents the "del" command from
# working correctly on Win9x.
#
clean_project_dos:
-$(DELETE) $(subst /,$(SEP),$(OBJ_DIR)/*.$O $(CLEAN) $(NO_OUTPUT))
distclean_freetype_dos: clean_freetype_dos
-$(DELETE) $(subst $(SEP),$(HOSTSEP),$(FT_LIBRARY)) $(DISTCLEAN) 2> nul
distclean_project_dos: clean_project_dos
-$(DELETE) $(subst /,$(SEP),$(PROJECT_LIBRARY) $(DISTCLEAN) $(NO_OUTPUT))
.PHONY: remove_config_mk remove_ftmodule_h
# Remove configuration file (used for distclean).
#
remove_config_mk:
-$(DELETE) $(subst $(SEP),$(HOSTSEP),$(CONFIG_MK))
-$(DELETE) $(subst /,$(SEP),$(CONFIG_MK) $(NO_OUTPUT))
# The `config.mk' file must define `clean_freetype' and
# `distclean_freetype'. Implementations may use to relay these to either
# the `std' or `dos' versions from above, or simply provide their own
# implementation.
# Remove module list (used for distclean).
#
clean: clean_freetype
distclean: distclean_freetype remove_config_mk
remove_ftmodule_h:
-$(DELETE) $(subst /,$(SEP),$(FTMODULE_H) $(NO_OUTPUT))
.PHONY: clean distclean
# The `config.mk' file must define `clean_project' and `distclean_project'.
# Implementations may use to relay these to either the `std' or `dos'
# versions from above, or simply provide their own implementation.
#
clean: clean_project
distclean: distclean_project remove_config_mk remove_ftmodule_h
-$(DELETE) $(subst /,$(SEP),$(DOC_DIR)/*.html $(NO_OUTPUT))
# EOF

42
builds/link_dos.mk Normal file
View File

@ -0,0 +1,42 @@
#
# Link instructions for Dos-like systems (Dos, Win32, OS/2)
#
# Copyright (C) 1996-2024 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,
# and distributed under the terms of the FreeType project license,
# LICENSE.TXT. By continuing to use, modify, or distribute this file you
# indicate that you have read the license and understand and accept it
# fully.
ifdef BUILD_PROJECT
.PHONY: clean_project distclean_project
# Now include the main sub-makefile. It contains all the rules used to
# build the library with the previous variables defined.
#
include $(TOP_DIR)/builds/$(PROJECT).mk
# The cleanup targets.
#
clean_project: clean_project_dos
distclean_project: distclean_project_dos
# This final rule is used to link all object files into a single library.
# this is compiler-specific
#
$(PROJECT_LIBRARY): $(OBJECTS_LIST)
ifdef CLEAN_LIBRARY
-$(CLEAN_LIBRARY) $(NO_OUTPUT)
endif
$(LINK_LIBRARY)
endif
# EOF

42
builds/link_std.mk Normal file
View File

@ -0,0 +1,42 @@
#
# Link instructions for standard systems
#
# Copyright (C) 1996-2024 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,
# and distributed under the terms of the FreeType project license,
# LICENSE.TXT. By continuing to use, modify, or distribute this file you
# indicate that you have read the license and understand and accept it
# fully.
ifdef BUILD_PROJECT
.PHONY: clean_project distclean_project
# Now include the main sub-makefile. It contains all the rules used to
# build the library with the previous variables defined.
#
include $(TOP_DIR)/builds/$(PROJECT).mk
# The cleanup targets.
#
clean_project: clean_project_std
distclean_project: distclean_project_std
# This final rule is used to link all object files into a single library.
# this is compiler-specific
#
$(PROJECT_LIBRARY): $(OBJECTS_LIST)
ifdef CLEAN_LIBRARY
-$(CLEAN_LIBRARY) $(NO_OUTPUT)
endif
$(LINK_LIBRARY)
endif
# EOF

View File

@ -0,0 +1,209 @@
# File: FreeType.m68k_cfm.make
# Target: FreeType.m68k_cfm
# Created: Thursday, October 27, 2005 09:23:25 PM
MAKEFILE = FreeType.m68k_cfm.make
\xA5MondoBuild\xA5 = {MAKEFILE} # Make blank to avoid rebuilds when makefile is modified
ObjDir = :objs:
Includes = \xB6
-ansi strict \xB6
-includes unix \xB6
-i :include: \xB6
-i :src: \xB6
-i :include:freetype:config:
Sym-68K = -sym off
COptions = \xB6
-d FT_MACINTOSH=1 \xB6
-d HAVE_FSSPEC=1 \xB6
-d HAVE_FSREF=0 \xB6
-d HAVE_QUICKDRAW_TOOLBOX=1 \xB6
-d HAVE_QUICKDRAW_CARBON=0 \xB6
-d HAVE_ATS=0 \xB6
-d FT2_BUILD_LIBRARY \xB6
-d FT_CONFIG_CONFIG_H="<ftconfig.h>" \xB6
-d FT_CONFIG_MODULES_H="<ftmodule.h>" \xB6
{Includes} {Sym-68K} -model cfmseg
### Source Files ###
SrcFiles = \xB6
:src:autofit:autofit.c \xB6
:builds:mac:ftbase.c \xB6
:src:base:ftbbox.c \xB6
:src:base:ftbdf.c \xB6
:src:base:ftbitmap.c \xB6
:src:base:ftdebug.c \xB6
:src:base:ftfstype.c \xB6
:src:base:ftglyph.c \xB6
:src:base:ftgxval.c \xB6
:src:base:ftinit.c \xB6
:src:base:ftmm.c \xB6
:src:base:ftotval.c \xB6
:src:base:ftpfr.c \xB6
:src:base:ftstroke.c \xB6
:src:base:ftsynth.c \xB6
:src:base:ftsystem.c \xB6
:src:base:fttype1.c \xB6
:src:base:ftwinfnt.c \xB6
:src:cache:ftcache.c \xB6
:src:bdf:bdf.c \xB6
:src:cff:cff.c \xB6
:src:cid:type1cid.c \xB6
# :src:gxvalid:gxvalid.c \xB6
:src:gzip:ftgzip.c \xB6
:src:bzip2:ftbzip2.c \xB6
:src:lzw:ftlzw.c \xB6
:src:otvalid:otvalid.c \xB6
:src:pcf:pcf.c \xB6
:src:pfr:pfr.c \xB6
:src:psaux:psaux.c \xB6
:src:pshinter:pshinter.c \xB6
:src:psnames:psmodule.c \xB6
:src:raster:raster.c \xB6
:src:sfnt:sfnt.c \xB6
:src:smooth:smooth.c \xB6
:src:truetype:truetype.c \xB6
:src:type1:type1.c \xB6
:src:type42:type42.c \xB6
:src:winfonts:winfnt.c
### Object Files ###
ObjFiles-68K = \xB6
"{ObjDir}autofit.c.o" \xB6
"{ObjDir}ftbase.c.o" \xB6
"{ObjDir}ftbbox.c.o" \xB6
"{ObjDir}ftbdf.c.o" \xB6
"{ObjDir}ftbitmap.c.o" \xB6
"{ObjDir}ftdebug.c.o" \xB6
"{ObjDir}ftfstype.c.o" \xB6
"{ObjDir}ftglyph.c.o" \xB6
"{ObjDir}ftgxval.c.o" \xB6
"{ObjDir}ftinit.c.o" \xB6
"{ObjDir}ftmm.c.o" \xB6
"{ObjDir}ftotval.c.o" \xB6
"{ObjDir}ftpfr.c.o" \xB6
"{ObjDir}ftstroke.c.o" \xB6
"{ObjDir}ftsynth.c.o" \xB6
"{ObjDir}ftsystem.c.o" \xB6
"{ObjDir}fttype1.c.o" \xB6
"{ObjDir}ftwinfnt.c.o" \xB6
"{ObjDir}ftcache.c.o" \xB6
"{ObjDir}bdf.c.o" \xB6
"{ObjDir}cff.c.o" \xB6
"{ObjDir}type1cid.c.o" \xB6
# "{ObjDir}gxvalid.c.o" \xB6
"{ObjDir}ftgzip.c.o" \xB6
"{ObjDir}ftbzip2.c.o" \xB6
"{ObjDir}ftlzw.c.o" \xB6
"{ObjDir}otvalid.c.o" \xB6
"{ObjDir}pcf.c.o" \xB6
"{ObjDir}pfr.c.o" \xB6
"{ObjDir}psaux.c.o" \xB6
"{ObjDir}pshinter.c.o" \xB6
"{ObjDir}psmodule.c.o" \xB6
"{ObjDir}raster.c.o" \xB6
"{ObjDir}sfnt.c.o" \xB6
"{ObjDir}smooth.c.o" \xB6
"{ObjDir}truetype.c.o" \xB6
"{ObjDir}type1.c.o" \xB6
"{ObjDir}type42.c.o" \xB6
"{ObjDir}winfnt.c.o"
### Libraries ###
LibFiles-68K =
### Default Rules ###
.c.o \xC4 .c {\xA5MondoBuild\xA5}
{C} {depDir}{default}.c -o {targDir}{default}.c.o {COptions}
### Build Rules ###
:builds:mac:ftbase.c \xC4\xC4 :src:base:ftbase.c
Duplicate :src:base:ftbase.c :builds:mac:ftbase.c
"{ObjDir}ftbase.c.o" \xC4\xC4 :builds:mac:ftbase.c
{C} :builds:mac:ftbase.c -o "{ObjDir}ftbase.c.o" \xB6
-i :builds:mac: \xB6
-i :src:base: \xB6
{COptions}
FreeType.m68k_cfm \xC4\xC4 FreeType.m68k_cfm.o
FreeType.m68k_cfm.o \xC4\xC4 {ObjFiles-68K} {LibFiles-68K} {\xA5MondoBuild\xA5}
Lib \xB6
-o {Targ} \xB6
{ObjFiles-68K} \xB6
{LibFiles-68K} \xB6
{Sym-68K} \xB6
-mf -d
### Required Dependencies ###
"{ObjDir}autofit.c.o" \xC4 :src:autofit:autofit.c
# "{ObjDir}ftbase.c.o" \xC4 :src:base:ftbase.c
"{ObjDir}ftbbox.c.o" \xC4 :src:base:ftbbox.c
"{ObjDir}ftbdf.c.o" \xC4 :src:base:ftbdf.c
"{ObjDir}ftbitmap.c.o" \xC4 :src:base:ftbitmap.c
"{ObjDir}ftdebug.c.o" \xC4 :src:base:ftdebug.c
"{ObjDir}ftfstype.c.o" \xC4 :src:base:ftfstype.c
"{ObjDir}ftglyph.c.o" \xC4 :src:base:ftglyph.c
"{ObjDir}ftgxval.c.o" \xC4 :src:base:ftgxval.c
"{ObjDir}ftinit.c.o" \xC4 :src:base:ftinit.c
"{ObjDir}ftmm.c.o" \xC4 :src:base:ftmm.c
"{ObjDir}ftotval.c.o" \xC4 :src:base:ftotval.c
"{ObjDir}ftpfr.c.o" \xC4 :src:base:ftpfr.c
"{ObjDir}ftstroke.c.o" \xC4 :src:base:ftstroke.c
"{ObjDir}ftsynth.c.o" \xC4 :src:base:ftsynth.c
"{ObjDir}ftsystem.c.o" \xC4 :src:base:ftsystem.c
"{ObjDir}fttype1.c.o" \xC4 :src:base:fttype1.c
"{ObjDir}ftwinfnt.c.o" \xC4 :src:base:ftwinfnt.c
"{ObjDir}ftcache.c.o" \xC4 :src:cache:ftcache.c
"{ObjDir}bdf.c.o" \xC4 :src:bdf:bdf.c
"{ObjDir}cff.c.o" \xC4 :src:cff:cff.c
"{ObjDir}type1cid.c.o" \xC4 :src:cid:type1cid.c
# "{ObjDir}gxvalid.c.o" \xC4 :src:gxvalid:gxvalid.c
"{ObjDir}ftgzip.c.o" \xC4 :src:gzip:ftgzip.c
"{ObjDir}ftbzip2.c.o" \xC4 :src:bzip2:ftbzip2.c
"{ObjDir}ftlzw.c.o" \xC4 :src:lzw:ftlzw.c
"{ObjDir}otvalid.c.o" \xC4 :src:otvalid:otvalid.c
"{ObjDir}pcf.c.o" \xC4 :src:pcf:pcf.c
"{ObjDir}pfr.c.o" \xC4 :src:pfr:pfr.c
"{ObjDir}psaux.c.o" \xC4 :src:psaux:psaux.c
"{ObjDir}pshinter.c.o" \xC4 :src:pshinter:pshinter.c
"{ObjDir}psmodule.c.o" \xC4 :src:psnames:psmodule.c
"{ObjDir}raster.c.o" \xC4 :src:raster:raster.c
"{ObjDir}sfnt.c.o" \xC4 :src:sfnt:sfnt.c
"{ObjDir}smooth.c.o" \xC4 :src:smooth:smooth.c
"{ObjDir}truetype.c.o" \xC4 :src:truetype:truetype.c
"{ObjDir}type1.c.o" \xC4 :src:type1:type1.c
"{ObjDir}type42.c.o" \xC4 :src:type42:type42.c
"{ObjDir}winfnt.c.o" \xC4 :src:winfonts:winfnt.c
### Optional Dependencies ###
### Build this target to generate "include file" dependencies. ###
Dependencies \xC4 $OutOfDate
MakeDepend \xB6
-append {MAKEFILE} \xB6
-ignore "{CIncludes}" \xB6
-objdir "{ObjDir}" \xB6
-objext .o \xB6
{Includes} \xB6
{SrcFiles}

View File

@ -0,0 +1,208 @@
# File: FreeType.m68k_far.make
# Target: FreeType.m68k_far
# Created: Tuesday, October 25, 2005 03:34:05 PM
MAKEFILE = FreeType.m68k_far.make
\xA5MondoBuild\xA5 = {MAKEFILE} # Make blank to avoid rebuilds when makefile is modified
ObjDir = :objs:
Includes = \xB6
-includes unix \xB6
-i :include: \xB6
-i :src: \xB6
-i :include:freetype:config:
Sym-68K = -sym off
COptions = \xB6
-d FT_MACINTOSH=1 \xB6
-d HAVE_FSSPEC=1 \xB6
-d HAVE_FSREF=0 \xB6
-d HAVE_QUICKDRAW_TOOLBOX=1 \xB6
-d HAVE_QUICKDRAW_CARBON=0 \xB6
-d HAVE_ATS=0 \xB6
-d FT2_BUILD_LIBRARY \xB6
-d FT_CONFIG_CONFIG_H="<ftconfig.h>" \xB6
-d FT_CONFIG_MODULES_H="<ftmodule.h>" \xB6
{Includes} {Sym-68K} -model far
### Source Files ###
SrcFiles = \xB6
:src:autofit:autofit.c \xB6
:builds:mac:ftbase.c \xB6
:src:base:ftbbox.c \xB6
:src:base:ftbdf.c \xB6
:src:base:ftbitmap.c \xB6
:src:base:ftdebug.c \xB6
:src:base:ftfstype.c \xB6
:src:base:ftglyph.c \xB6
:src:base:ftgxval.c \xB6
:src:base:ftinit.c \xB6
:src:base:ftmm.c \xB6
:src:base:ftotval.c \xB6
:src:base:ftpfr.c \xB6
:src:base:ftstroke.c \xB6
:src:base:ftsynth.c \xB6
:src:base:ftsystem.c \xB6
:src:base:fttype1.c \xB6
:src:base:ftwinfnt.c \xB6
:src:cache:ftcache.c \xB6
:src:bdf:bdf.c \xB6
:src:cff:cff.c \xB6
:src:cid:type1cid.c \xB6
:src:gxvalid:gxvalid.c \xB6
:src:gzip:ftgzip.c \xB6
:src:bzip2:ftbzip2.c \xB6
:src:lzw:ftlzw.c \xB6
:src:otvalid:otvalid.c \xB6
:src:pcf:pcf.c \xB6
:src:pfr:pfr.c \xB6
:src:psaux:psaux.c \xB6
:src:pshinter:pshinter.c \xB6
:src:psnames:psmodule.c \xB6
:src:raster:raster.c \xB6
:src:sfnt:sfnt.c \xB6
:src:smooth:smooth.c \xB6
:src:truetype:truetype.c \xB6
:src:type1:type1.c \xB6
:src:type42:type42.c \xB6
:src:winfonts:winfnt.c
### Object Files ###
ObjFiles-68K = \xB6
"{ObjDir}autofit.c.o" \xB6
"{ObjDir}ftbase.c.o" \xB6
"{ObjDir}ftbbox.c.o" \xB6
"{ObjDir}ftbdf.c.o" \xB6
"{ObjDir}ftbitmap.c.o" \xB6
"{ObjDir}ftdebug.c.o" \xB6
"{ObjDir}ftfstype.c.o" \xB6
"{ObjDir}ftglyph.c.o" \xB6
"{ObjDir}ftgxval.c.o" \xB6
"{ObjDir}ftinit.c.o" \xB6
"{ObjDir}ftmm.c.o" \xB6
"{ObjDir}ftotval.c.o" \xB6
"{ObjDir}ftpfr.c.o" \xB6
"{ObjDir}ftstroke.c.o" \xB6
"{ObjDir}ftsynth.c.o" \xB6
"{ObjDir}ftsystem.c.o" \xB6
"{ObjDir}fttype1.c.o" \xB6
"{ObjDir}ftwinfnt.c.o" \xB6
"{ObjDir}ftcache.c.o" \xB6
"{ObjDir}bdf.c.o" \xB6
"{ObjDir}cff.c.o" \xB6
"{ObjDir}type1cid.c.o" \xB6
"{ObjDir}gxvalid.c.o" \xB6
"{ObjDir}ftgzip.c.o" \xB6
"{ObjDir}ftbzip2.c.o" \xB6
"{ObjDir}ftlzw.c.o" \xB6
"{ObjDir}otvalid.c.o" \xB6
"{ObjDir}pcf.c.o" \xB6
"{ObjDir}pfr.c.o" \xB6
"{ObjDir}psaux.c.o" \xB6
"{ObjDir}pshinter.c.o" \xB6
"{ObjDir}psmodule.c.o" \xB6
"{ObjDir}raster.c.o" \xB6
"{ObjDir}sfnt.c.o" \xB6
"{ObjDir}smooth.c.o" \xB6
"{ObjDir}truetype.c.o" \xB6
"{ObjDir}type1.c.o" \xB6
"{ObjDir}type42.c.o" \xB6
"{ObjDir}winfnt.c.o"
### Libraries ###
LibFiles-68K =
### Default Rules ###
.c.o \xC4 .c {\xA5MondoBuild\xA5}
{C} {depDir}{default}.c -o {targDir}{default}.c.o {COptions} \xB6
-ansi strict
### Build Rules ###
:builds:mac:ftbase.c \xC4\xC4 :src:base:ftbase.c
Duplicate :src:base:ftbase.c :builds:mac:ftbase.c
"{ObjDir}ftbase.c.o" \xC4\xC4 :builds:mac:ftbase.c
{C} :builds:mac:ftbase.c -o "{ObjDir}ftbase.c.o" \xB6
-i :builds:mac: \xB6
-i :src:base: \xB6
{COptions}
FreeType.m68k_far \xC4\xC4 FreeType.m68k_far.o
FreeType.m68k_far.o \xC4\xC4 {ObjFiles-68K} {LibFiles-68K} {\xA5MondoBuild\xA5}
Lib \xB6
-o {Targ} \xB6
{ObjFiles-68K} \xB6
{LibFiles-68K} \xB6
{Sym-68K} \xB6
-mf -d
### Required Dependencies ###
"{ObjDir}autofit.c.o" \xC4 :src:autofit:autofit.c
# "{ObjDir}ftbase.c.o" \xC4 :src:base:ftbase.c
"{ObjDir}ftbbox.c.o" \xC4 :src:base:ftbbox.c
"{ObjDir}ftbdf.c.o" \xC4 :src:base:ftbdf.c
"{ObjDir}ftbitmap.c.o" \xC4 :src:base:ftbitmap.c
"{ObjDir}ftdebug.c.o" \xC4 :src:base:ftdebug.c
"{ObjDir}ftfstype.c.o" \xC4 :src:base:ftfstype.c
"{ObjDir}ftglyph.c.o" \xC4 :src:base:ftglyph.c
"{ObjDir}ftgxval.c.o" \xC4 :src:base:ftgxval.c
"{ObjDir}ftinit.c.o" \xC4 :src:base:ftinit.c
"{ObjDir}ftmm.c.o" \xC4 :src:base:ftmm.c
"{ObjDir}ftotval.c.o" \xC4 :src:base:ftotval.c
"{ObjDir}ftpfr.c.o" \xC4 :src:base:ftpfr.c
"{ObjDir}ftstroke.c.o" \xC4 :src:base:ftstroke.c
"{ObjDir}ftsynth.c.o" \xC4 :src:base:ftsynth.c
"{ObjDir}ftsystem.c.o" \xC4 :src:base:ftsystem.c
"{ObjDir}fttype1.c.o" \xC4 :src:base:fttype1.c
"{ObjDir}ftwinfnt.c.o" \xC4 :src:base:ftwinfnt.c
"{ObjDir}ftcache.c.o" \xC4 :src:cache:ftcache.c
"{ObjDir}bdf.c.o" \xC4 :src:bdf:bdf.c
"{ObjDir}cff.c.o" \xC4 :src:cff:cff.c
"{ObjDir}type1cid.c.o" \xC4 :src:cid:type1cid.c
"{ObjDir}gxvalid.c.o" \xC4 :src:gxvalid:gxvalid.c
"{ObjDir}ftgzip.c.o" \xC4 :src:gzip:ftgzip.c
"{ObjDir}ftbzip2.c.o" \xC4 :src:bzip2:ftbzip2.c
"{ObjDir}ftlzw.c.o" \xC4 :src:lzw:ftlzw.c
"{ObjDir}otvalid.c.o" \xC4 :src:otvalid:otvalid.c
"{ObjDir}pcf.c.o" \xC4 :src:pcf:pcf.c
"{ObjDir}pfr.c.o" \xC4 :src:pfr:pfr.c
"{ObjDir}psaux.c.o" \xC4 :src:psaux:psaux.c
"{ObjDir}pshinter.c.o" \xC4 :src:pshinter:pshinter.c
"{ObjDir}psmodule.c.o" \xC4 :src:psnames:psmodule.c
"{ObjDir}raster.c.o" \xC4 :src:raster:raster.c
"{ObjDir}sfnt.c.o" \xC4 :src:sfnt:sfnt.c
"{ObjDir}smooth.c.o" \xC4 :src:smooth:smooth.c
"{ObjDir}truetype.c.o" \xC4 :src:truetype:truetype.c
"{ObjDir}type1.c.o" \xC4 :src:type1:type1.c
"{ObjDir}type42.c.o" \xC4 :src:type42:type42.c
"{ObjDir}winfnt.c.o" \xC4 :src:winfonts:winfnt.c
### Optional Dependencies ###
### Build this target to generate "include file" dependencies. ###
Dependencies \xC4 $OutOfDate
MakeDepend \xB6
-append {MAKEFILE} \xB6
-ignore "{CIncludes}" \xB6
-objdir "{ObjDir}" \xB6
-objext .o \xB6
{Includes} \xB6
{SrcFiles}

View File

@ -0,0 +1,212 @@
# File: FreeType.ppc_carbon.make
# Target: FreeType.ppc_carbon
# Created: Friday, October 28, 2005 03:40:06 PM
MAKEFILE = FreeType.ppc_carbon.make
\xA5MondoBuild\xA5 = {MAKEFILE} # Make blank to avoid rebuilds when makefile is modified
ObjDir = :objs:
Includes = \xB6
-ansi strict \xB6
-includes unix \xB6
-i :include: \xB6
-i :src: \xB6
-i :include:freetype:config:
Sym-PPC = -sym off
PPCCOptions = \xB6
-d FT_MACINTOSH=1 \xB6
-d HAVE_FSSPEC=1 \xB6
-d HAVE_FSREF=1 \xB6
-d HAVE_QUICKDRAW_TOOLBOX=1 \xB6
-d HAVE_QUICKDRAW_CARBON=1 \xB6
-d HAVE_ATS=0 \xB6
-d FT2_BUILD_LIBRARY \xB6
-d FT_CONFIG_CONFIG_H="<ftconfig.h>" \xB6
-d FT_CONFIG_MODULES_H="<ftmodule.h>" \xB6
{Includes} {Sym-PPC} -d TARGET_API_MAC_CARBON=1
### Source Files ###
SrcFiles = \xB6
:src:autofit:autofit.c \xB6
:builds:mac:ftbase.c \xB6
:src:base:ftbbox.c \xB6
:src:base:ftbdf.c \xB6
:src:base:ftbitmap.c \xB6
:src:base:ftdebug.c \xB6
:src:base:ftfstype.c \xB6
:src:base:ftglyph.c \xB6
:src:base:ftgxval.c \xB6
:src:base:ftinit.c \xB6
:src:base:ftmm.c \xB6
:src:base:ftotval.c \xB6
:src:base:ftpfr.c \xB6
:src:base:ftstroke.c \xB6
:src:base:ftsynth.c \xB6
:src:base:ftsystem.c \xB6
:src:base:fttype1.c \xB6
:src:base:ftwinfnt.c \xB6
:src:cache:ftcache.c \xB6
:src:bdf:bdf.c \xB6
:src:cff:cff.c \xB6
:src:cid:type1cid.c \xB6
:src:gxvalid:gxvalid.c \xB6
:src:gzip:ftgzip.c \xB6
:src:bzip2:ftbzip2.c \xB6
:src:lzw:ftlzw.c \xB6
:src:otvalid:otvalid.c \xB6
:src:pcf:pcf.c \xB6
:src:pfr:pfr.c \xB6
:src:psaux:psaux.c \xB6
:src:pshinter:pshinter.c \xB6
:src:psnames:psmodule.c \xB6
:src:raster:raster.c \xB6
:src:sfnt:sfnt.c \xB6
:src:smooth:smooth.c \xB6
:src:truetype:truetype.c \xB6
:src:type1:type1.c \xB6
:src:type42:type42.c \xB6
:src:winfonts:winfnt.c
### Object Files ###
ObjFiles-PPC = \xB6
"{ObjDir}autofit.c.x" \xB6
"{ObjDir}ftbase.c.x" \xB6
"{ObjDir}ftbbox.c.x" \xB6
"{ObjDir}ftbdf.c.x" \xB6
"{ObjDir}ftbitmap.c.x" \xB6
"{ObjDir}ftdebug.c.x" \xB6
"{ObjDir}ftfstype.c.x" \xB6
"{ObjDir}ftglyph.c.x" \xB6
"{ObjDir}ftgxval.c.x" \xB6
"{ObjDir}ftinit.c.x" \xB6
"{ObjDir}ftmm.c.x" \xB6
"{ObjDir}ftotval.c.x" \xB6
"{ObjDir}ftpfr.c.x" \xB6
"{ObjDir}ftstroke.c.x" \xB6
"{ObjDir}ftsynth.c.x" \xB6
"{ObjDir}ftsystem.c.x" \xB6
"{ObjDir}fttype1.c.x" \xB6
"{ObjDir}ftwinfnt.c.x" \xB6
"{ObjDir}ftcache.c.x" \xB6
"{ObjDir}bdf.c.x" \xB6
"{ObjDir}cff.c.x" \xB6
"{ObjDir}type1cid.c.x" \xB6
"{ObjDir}gxvalid.c.x" \xB6
"{ObjDir}ftgzip.c.x" \xB6
"{ObjDir}ftbzip2.c.x" \xB6
"{ObjDir}ftlzw.c.x" \xB6
"{ObjDir}otvalid.c.x" \xB6
"{ObjDir}pcf.c.x" \xB6
"{ObjDir}pfr.c.x" \xB6
"{ObjDir}psaux.c.x" \xB6
"{ObjDir}pshinter.c.x" \xB6
"{ObjDir}psmodule.c.x" \xB6
"{ObjDir}raster.c.x" \xB6
"{ObjDir}sfnt.c.x" \xB6
"{ObjDir}smooth.c.x" \xB6
"{ObjDir}truetype.c.x" \xB6
"{ObjDir}type1.c.x" \xB6
"{ObjDir}type42.c.x" \xB6
"{ObjDir}winfnt.c.x"
### Libraries ###
LibFiles-PPC =
### Default Rules ###
.c.x \xC4 .c {\xA5MondoBuild\xA5}
{PPCC} {depDir}{default}.c -o {targDir}{default}.c.x {PPCCOptions}
### Build Rules ###
:builds:mac:ftbase.c \xC4\xC4 :src:base:ftbase.c
Duplicate :src:base:ftbase.c :builds:mac:ftbase.c
"{ObjDir}ftbase.c.x" \xC4\xC4 :builds:mac:ftbase.c
{PPCC} :builds:mac:ftbase.c -o {ObjDir}ftbase.c.x \xB6
-i :builds:mac: \xB6
-i :src:base: \xB6
{PPCCOptions}
FreeType.ppc_carbon \xC4\xC4 FreeType.ppc_carbon.o
FreeType.ppc_carbon.o \xC4\xC4 {ObjFiles-PPC} {LibFiles-PPC} {\xA5MondoBuild\xA5}
PPCLink \xB6
-o {Targ} \xB6
{ObjFiles-PPC} \xB6
{LibFiles-PPC} \xB6
{Sym-PPC} \xB6
-mf -d \xB6
-t 'XCOF' \xB6
-c 'MPS ' \xB6
-xm l
### Required Dependencies ###
"{ObjDir}autofit.c.x" \xC4 :src:autofit:autofit.c
# "{ObjDir}ftbase.c.x" \xC4 :builds:mac:ftbase.c
"{ObjDir}ftbbox.c.x" \xC4 :src:base:ftbbox.c
"{ObjDir}ftbdf.c.x" \xC4 :src:base:ftbdf.c
"{ObjDir}ftbitmap.c.x" \xC4 :src:base:ftbitmap.c
"{ObjDir}ftdebug.c.x" \xC4 :src:base:ftdebug.c
"{ObjDir}ftfstype.c.x" \xC4 :src:base:ftfstype.c
"{ObjDir}ftglyph.c.x" \xC4 :src:base:ftglyph.c
"{ObjDir}ftgxval.c.x" \xC4 :src:base:ftgxval.c
"{ObjDir}ftinit.c.x" \xC4 :src:base:ftinit.c
"{ObjDir}ftmm.c.x" \xC4 :src:base:ftmm.c
"{ObjDir}ftotval.c.x" \xC4 :src:base:ftotval.c
"{ObjDir}ftpfr.c.x" \xC4 :src:base:ftpfr.c
"{ObjDir}ftstroke.c.x" \xC4 :src:base:ftstroke.c
"{ObjDir}ftsynth.c.x" \xC4 :src:base:ftsynth.c
"{ObjDir}ftsystem.c.x" \xC4 :src:base:ftsystem.c
"{ObjDir}fttype1.c.x" \xC4 :src:base:fttype1.c
"{ObjDir}ftwinfnt.c.x" \xC4 :src:base:ftwinfnt.c
"{ObjDir}ftcache.c.x" \xC4 :src:cache:ftcache.c
"{ObjDir}bdf.c.x" \xC4 :src:bdf:bdf.c
"{ObjDir}cff.c.x" \xC4 :src:cff:cff.c
"{ObjDir}type1cid.c.x" \xC4 :src:cid:type1cid.c
"{ObjDir}gxvalid.c.x" \xC4 :src:gxvalid:gxvalid.c
"{ObjDir}ftgzip.c.x" \xC4 :src:gzip:ftgzip.c
"{ObjDir}ftbzip2.c.x" \xC4 :src:bzip2:ftbzip2.c
"{ObjDir}ftlzw.c.x" \xC4 :src:lzw:ftlzw.c
"{ObjDir}otvalid.c.x" \xC4 :src:otvalid:otvalid.c
"{ObjDir}pcf.c.x" \xC4 :src:pcf:pcf.c
"{ObjDir}pfr.c.x" \xC4 :src:pfr:pfr.c
"{ObjDir}psaux.c.x" \xC4 :src:psaux:psaux.c
"{ObjDir}pshinter.c.x" \xC4 :src:pshinter:pshinter.c
"{ObjDir}psmodule.c.x" \xC4 :src:psnames:psmodule.c
"{ObjDir}raster.c.x" \xC4 :src:raster:raster.c
"{ObjDir}sfnt.c.x" \xC4 :src:sfnt:sfnt.c
"{ObjDir}smooth.c.x" \xC4 :src:smooth:smooth.c
"{ObjDir}truetype.c.x" \xC4 :src:truetype:truetype.c
"{ObjDir}type1.c.x" \xC4 :src:type1:type1.c
"{ObjDir}type42.c.x" \xC4 :src:type42:type42.c
"{ObjDir}winfnt.c.x" \xC4 :src:winfonts:winfnt.c
### Optional Dependencies ###
### Build this target to generate "include file" dependencies. ###
Dependencies \xC4 $OutOfDate
MakeDepend \xB6
-append {MAKEFILE} \xB6
-ignore "{CIncludes}" \xB6
-objdir "{ObjDir}" \xB6
-objext .x \xB6
{Includes} \xB6
{SrcFiles}

View File

@ -0,0 +1,213 @@
# File: FreeType.ppc_classic.make
# Target: FreeType.ppc_classic
# Created: Thursday, October 27, 2005 07:42:43 PM
MAKEFILE = FreeType.ppc_classic.make
\xA5MondoBuild\xA5 = {MAKEFILE} # Make blank to avoid rebuilds when makefile is modified
ObjDir = :objs:
Includes = \xB6
-ansi strict \xB6
-includes unix \xB6
-i :include: \xB6
-i :src: \xB6
-i :include:freetype:config:
Sym-PPC = -sym off
PPCCOptions = \xB6
-d FT_MACINTOSH=1 \xB6
-d HAVE_FSSPEC=1 \xB6
-d HAVE_FSREF=0 \xB6
-d HAVE_QUICKDRAW_TOOLBOX=1 \xB6
-d HAVE_QUICKDRAW_CARBON=0 \xB6
-d HAVE_ATS=0 \xB6
-d FT2_BUILD_LIBRARY \xB6
-d FT_CONFIG_CONFIG_H="<ftconfig.h>" \xB6
-d FT_CONFIG_MODULES_H="<ftmodule.h>" \xB6
{Includes} {Sym-PPC}
### Source Files ###
SrcFiles = \xB6
:src:autofit:autofit.c \xB6
:builds:mac:ftbase.c \xB6
:src:base:ftbbox.c \xB6
:src:base:ftbdf.c \xB6
:src:base:ftbitmap.c \xB6
:src:base:ftdebug.c \xB6
:src:base:ftfstype.c \xB6
:src:base:ftglyph.c \xB6
:src:base:ftgxval.c \xB6
:src:base:ftinit.c \xB6
:src:base:ftmm.c \xB6
:src:base:ftotval.c \xB6
:src:base:ftpfr.c \xB6
:src:base:ftstroke.c \xB6
:src:base:ftsynth.c \xB6
:src:base:ftsystem.c \xB6
:src:base:fttype1.c \xB6
:src:base:ftwinfnt.c \xB6
:src:cache:ftcache.c \xB6
:src:bdf:bdf.c \xB6
:src:cff:cff.c \xB6
:src:cid:type1cid.c \xB6
:src:gxvalid:gxvalid.c \xB6
:src:gzip:ftgzip.c \xB6
:src:bzip2:ftbzip2.c \xB6
:src:lzw:ftlzw.c \xB6
:src:otvalid:otvalid.c \xB6
:src:pcf:pcf.c \xB6
:src:pfr:pfr.c \xB6
:src:psaux:psaux.c \xB6
:src:pshinter:pshinter.c \xB6
:src:psnames:psmodule.c \xB6
:src:raster:raster.c \xB6
:src:sfnt:sfnt.c \xB6
:src:smooth:smooth.c \xB6
:src:truetype:truetype.c \xB6
:src:type1:type1.c \xB6
:src:type42:type42.c \xB6
:src:winfonts:winfnt.c
### Object Files ###
ObjFiles-PPC = \xB6
"{ObjDir}autofit.c.x" \xB6
"{ObjDir}ftbase.c.x" \xB6
"{ObjDir}ftbbox.c.x" \xB6
"{ObjDir}ftbdf.c.x" \xB6
"{ObjDir}ftbitmap.c.x" \xB6
"{ObjDir}ftdebug.c.x" \xB6
"{ObjDir}ftfstype.c.x" \xB6
"{ObjDir}ftglyph.c.x" \xB6
"{ObjDir}ftgxval.c.x" \xB6
"{ObjDir}ftinit.c.x" \xB6
"{ObjDir}ftmm.c.x" \xB6
"{ObjDir}ftotval.c.x" \xB6
"{ObjDir}ftpfr.c.x" \xB6
"{ObjDir}ftstroke.c.x" \xB6
"{ObjDir}ftsynth.c.x" \xB6
"{ObjDir}ftsystem.c.x" \xB6
"{ObjDir}fttype1.c.x" \xB6
"{ObjDir}ftwinfnt.c.x" \xB6
"{ObjDir}ftcache.c.x" \xB6
"{ObjDir}bdf.c.x" \xB6
"{ObjDir}cff.c.x" \xB6
"{ObjDir}type1cid.c.x" \xB6
"{ObjDir}gxvalid.c.x" \xB6
"{ObjDir}ftgzip.c.x" \xB6
"{ObjDir}ftbzip2.c.x" \xB6
"{ObjDir}ftlzw.c.x" \xB6
"{ObjDir}otvalid.c.x" \xB6
"{ObjDir}pcf.c.x" \xB6
"{ObjDir}pfr.c.x" \xB6
"{ObjDir}psaux.c.x" \xB6
"{ObjDir}pshinter.c.x" \xB6
"{ObjDir}psmodule.c.x" \xB6
"{ObjDir}raster.c.x" \xB6
"{ObjDir}sfnt.c.x" \xB6
"{ObjDir}smooth.c.x" \xB6
"{ObjDir}truetype.c.x" \xB6
"{ObjDir}type1.c.x" \xB6
"{ObjDir}type42.c.x" \xB6
"{ObjDir}winfnt.c.x"
### Libraries ###
LibFiles-PPC =
### Default Rules ###
.c.x \xC4 .c {\xA5MondoBuild\xA5}
{PPCC} {depDir}{default}.c -o {targDir}{default}.c.x {PPCCOptions}
### Build Rules ###
:builds:mac:ftbase.c \xC4\xC4 :src:base:ftbase.c
Duplicate :src:base:ftbase.c :builds:mac:ftbase.c
"{ObjDir}ftbase.c.x" \xC4\xC4 :builds:mac:ftbase.c
{PPCC} :builds:mac:ftbase.c -o "{ObjDir}ftbase.c.x" \xB6
-i :builds:mac: \xB6
-i :src:base: \xB6
{PPCCOptions}
FreeType.ppc_classic \xC4\xC4 FreeType.ppc_classic.o
FreeType.ppc_classic.o \xC4\xC4 {ObjFiles-PPC} {LibFiles-PPC} {\xA5MondoBuild\xA5}
PPCLink \xB6
-o {Targ} \xB6
{ObjFiles-PPC} \xB6
{LibFiles-PPC} \xB6
{Sym-PPC} \xB6
-mf -d \xB6
-t 'XCOF' \xB6
-c 'MPS ' \xB6
-xm l
### Required Dependencies ###
"{ObjDir}autofit.c.x" \xC4 :src:autofit:autofit.c
# "{ObjDir}ftbase.c.x" \xC4 :builds:mac:ftbase.c
"{ObjDir}ftbbox.c.x" \xC4 :src:base:ftbbox.c
"{ObjDir}ftbdf.c.x" \xC4 :src:base:ftbdf.c
"{ObjDir}ftbitmap.c.x" \xC4 :src:base:ftbitmap.c
"{ObjDir}ftdebug.c.x" \xC4 :src:base:ftdebug.c
"{ObjDir}ftfstype.c.x" \xC4 :src:base:ftfstype.c
"{ObjDir}ftglyph.c.x" \xC4 :src:base:ftglyph.c
"{ObjDir}ftgxval.c.x" \xC4 :src:base:ftgxval.c
"{ObjDir}ftinit.c.x" \xC4 :src:base:ftinit.c
"{ObjDir}ftmm.c.x" \xC4 :src:base:ftmm.c
"{ObjDir}ftotval.c.x" \xC4 :src:base:ftotval.c
"{ObjDir}ftpfr.c.x" \xC4 :src:base:ftpfr.c
"{ObjDir}ftstroke.c.x" \xC4 :src:base:ftstroke.c
"{ObjDir}ftsynth.c.x" \xC4 :src:base:ftsynth.c
"{ObjDir}ftsystem.c.x" \xC4 :src:base:ftsystem.c
"{ObjDir}fttype1.c.x" \xC4 :src:base:fttype1.c
"{ObjDir}ftwinfnt.c.x" \xC4 :src:base:ftwinfnt.c
"{ObjDir}ftcache.c.x" \xC4 :src:cache:ftcache.c
"{ObjDir}bdf.c.x" \xC4 :src:bdf:bdf.c
"{ObjDir}cff.c.x" \xC4 :src:cff:cff.c
"{ObjDir}type1cid.c.x" \xC4 :src:cid:type1cid.c
"{ObjDir}gxvalid.c.x" \xC4 :src:gxvalid:gxvalid.c
"{ObjDir}ftgzip.c.x" \xC4 :src:gzip:ftgzip.c
"{ObjDir}ftbzip2.c.x" \xC4 :src:bzip2:ftbzip2.c
"{ObjDir}ftlzw.c.x" \xC4 :src:lzw:ftlzw.c
"{ObjDir}otvalid.c.x" \xC4 :src:otvalid:otvalid.c
"{ObjDir}pcf.c.x" \xC4 :src:pcf:pcf.c
"{ObjDir}pfr.c.x" \xC4 :src:pfr:pfr.c
"{ObjDir}psaux.c.x" \xC4 :src:psaux:psaux.c
"{ObjDir}pshinter.c.x" \xC4 :src:pshinter:pshinter.c
"{ObjDir}psmodule.c.x" \xC4 :src:psnames:psmodule.c
"{ObjDir}raster.c.x" \xC4 :src:raster:raster.c
"{ObjDir}sfnt.c.x" \xC4 :src:sfnt:sfnt.c
"{ObjDir}smooth.c.x" \xC4 :src:smooth:smooth.c
"{ObjDir}truetype.c.x" \xC4 :src:truetype:truetype.c
"{ObjDir}type1.c.x" \xC4 :src:type1:type1.c
"{ObjDir}type42.c.x" \xC4 :src:type42:type42.c
"{ObjDir}winfnt.c.x" \xC4 :src:winfonts:winfnt.c
### Optional Dependencies ###
### Build this target to generate "include file" dependencies. ###
Dependencies \xC4 $OutOfDate
MakeDepend \xB6
-append {MAKEFILE} \xB6
-ignore "{CIncludes}" \xB6
-objdir "{ObjDir}" \xB6
-objext .x \xB6
{Includes} \xB6
{SrcFiles}

View File

@ -1,11 +1,393 @@
This folder contains supporting code and CodeWarrior Pro 4 project
files to build the FreeType library.
This folder contains
Notes:
The library will be built as a static lib in the obj/ folder.
* Makefile skeletons for Apple MPW (Macintosh's Programmer's Workshop)
Just van Rossum, <just@letterror.com>
* Python script to generate MPW makefile from skeleton
DISCLAIMER: this subdirectory is *not* being maintained by the
FreeType team, but by Just van Rossum. It's being released under
the same terms as FreeType (see LICENSE.TXT).
* Metrowerks CodeWarrior 9.0 project file in XML format
------------------------------------------------------------
1. What is this
---------------
Files in this directory are designed to build FreeType
running on classic MacOS. To build FreeType running on
Mac OS X, build as the system is UNIX.
However, Mac OS X is most useful to manipulate files in
vanilla FreeType to fit classic MacOS.
The information about MacOS specific API is written in
appendix of this document.
2. Requirement
--------------
You can use MPW: a free-charged developer environment
by Apple, or CodeWarrior: a commercial developer
environment by Metrowerks. GCC for MPW and Symantec
"Think C" are not tested at present.
2-1. Apple MPW
--------------
Following C compilers are tested:
m68k target: Apple SC 8.9.0d3e1
ppc target: Apple MrC 5.0.0d3c1
The final MPW-GM (official release on 1999/Dec) is too
old and cannot compile FreeType, because bundled C
compilers cannot search header files in sub directories.
Updating by the final MPW-PR (pre-release on 2001/Feb)
is required.
Required files are downloadable from:
http://macintoshgarden.org/apps/macintosh-programmers-workshop
Also you can find documents how to update by MPW-PR.
Python is required to restore MPW makefiles from the
skeletons. Python bundled to Mac OS X is enough. For
classic MacOS, MacPython is available:
https://homepages.cwi.nl/~jack/macpython/
MPW requires all files are typed by resource fork.
ResEdit bundled to MPW is enough. In Mac OS X,
/Developer/Tools/SetFile of DevTool is useful to
manipulate from commandline.
2-2. Metrowerks CodeWarrior
---------------------------
XML project file is generated and tested by
CodeWarrior 9.0. Older versions are not tested
at all. At present, static library for ppc target
is available in the project file.
3. How to build
---------------
3-1. Apple MPW
--------------
Detailed building procedure by Apple MPW is
described in following.
3-1-1. Generate MPW makefiles from the skeletons
------------------------------------------------
Here are 4 skeletons for following targets are
included.
- FreeType.m68k_far.make.txt
Ancient 32bit binary executable format for
m68k MacOS: System 6, with 32bit addressing
mode (far-pointer-model) So-called "Toolbox"
API is used.
- FreeType.m68k_cfm.make.txt
CFM binary executable format for m68k MacOS:
System 7. So-called "Toolbox" API is used.
- FreeType.ppc_classic.make.txt
CFM binary executable format for ppc MacOS:
System 7, MacOS 8, MacOS 9. So-called "Toolbox"
API is used.
- FreeType.ppc_carbon.make.txt
CFM binary executable format for ppc MacOS:
MacOS 9. Carbon API is used.
At present, static library is only supported,
although targets except of m68k_far are capable
to use shared library.
MPW makefile syntax uses 8bit characters. To keep
from violating them during version control, here
we store skeletons in pure ASCII format. You must
generate MPW makefile by Python script ascii2mpw.py.
In Mac OS X terminal, you can convert as:
python builds/mac/ascii2mpw.py \
< builds/mac/FreeType.m68k_far.make.txt \
> FreeType.m68k_far.make
The skeletons are designed to use in the top
directory where there are builds, include, src etc.
You must name the generated MPW makefile by removing
".txt" from source skeleton name.
3-1-2. Add resource forks to related files
------------------------------------------
MPW's Make and C compilers cannot recognize files
without resource fork. You have to add resource
fork to the files that MPW uses. In Mac OS X
terminal of the system, you can do as:
find . -name '*.[ch]' -exec \
/Developer/Tools/SetFile -a l -c "MPS " -t TEXT \{\} \;
find . -name '*.make' -exec \
/Developer/Tools/SetFile -a l -c "MPS " -t TEXT \{\} \;
3-1-3. Open MPW shell and build
-------------------------------
Open MPW shell and go to the top directory that
FreeType sources are extracted (MPW makefile must
be located in there), from "Set Directory" in
"Directory" menu.
Choose "Build" from "Build" menu, and type the
name of project by removing ".make" from MPW
makefile, as: FreeType.m68k_far
If building is successfully finished, you can find
built library in objs/ directory.
3-2. Metrowerks CodeWarrior
---------------------------
Detailed building procedure by Metrowerks
CodeWarrior (CW) 9.0 is described in following.
3-2-1. Import XML project file
------------------------------
CW XML project file is not ready for double-
click. Start CodeWarrior IDE, and choose
"Import project" in "File" menu. Choose XML
project file: builds/mac/ftlib.prj.xml.
In next, you will be asked where to save CW
native project file: you must choose
"builds/mac/ftlib.prj". The project file is
designed with relative path from there. After
CW native project file is generated, it is
automatically loaded, small project window
titled "ftlib.prj" is displayed.
3-2-2. Building
---------------
Choose "Make" from "Project" menu. If building
is successfully finished, you can find built
library at objs/FreeTypeLib.
4. TODO
-------
4-1. All modules should be included
-----------------------------------
At present, MPW makefiles and CW project file are
just updated versions of these by Leonard. Some
modules are added after the last maintenance, they
are not included.
4-2. Working test with ftdemos
------------------------------
At present, MPW makefiles and CW project file can
build FreeType for classic MacOS. But their working
behaviours are not tested at all. Building ftdemos
for classic MacOS and working test is required.
APPENDIX I
----------
A-1. Framework dependencies
---------------------------
src/base/ftmac.c adds two Mac-specific features to
FreeType. These features are based on MacOS libraries.
* accessing resource-fork font
The fonts for classic MacOS store their graphical data
in resource forks which cannot be accessed via ANSI C
functions. FreeType2 provides functions to handle such
resource fork fonts, they are based on File Manager
framework of MacOS. In addition, HFS and HFS+ file
system driver of Linux is supported. Following
functions are for this purpose.
FT_New_Face_From_Resource()
FT_New_Face_From_FSSpec()
FT_New_Face_From_FSRef()
* resolving font name to font file
The font menu of MacOS application prefers font name
written in FOND resource than sfnt resource. FreeType2
provides functions to find font file by name in MacOS
application, they are based on QuickDraw Font Manager
and Apple Type Service framework of MacOS.
FT_GetFile_From_Mac_Name()
FT_GetFile_From_Mac_ATS_Name()
Working functions for each MacOS are summarized as
following.
upto MacOS 6:
not tested (you have to obtain MPW 2.x)
MacOS 7.x, 8.x, 9.x (without CarbonLib):
FT_GetFile_From_Mac_Name()
FT_New_Face_From_Resource()
FT_New_Face_From_FSSpec()
MacOS 9.x (with CarbonLib):
FT_GetFile_From_Mac_Name()
FT_New_Face_From_Resource()
FT_New_Face_From_FSSpec()
FT_New_Face_From_FSRef()
Mac OS X upto 10.4.x:
FT_GetFile_From_Mac_Name() deprecated
FT_New_Face_From_FSSpec() deprecated
FT_GetFile_From_Mac_ATS_Name() deprecated?
FT_New_Face_From_FSRef()
A-2. Deprecated Functions
-------------------------
A-2-1. FileManager
------------------
For convenience to write MacOS application, ftmac.c
provides functions to specify a file by FSSpec and FSRef,
because the file identification pathname had ever been
unrecommended method in MacOS programming.
Toward to MacOS X 10.4 & 5, Carbon functions using FSSpec
datatype is noticed as deprecated, and recommended to
migrate to FSRef datatype. The big differences of FSRef
against FSSpec are explained in Apple TechNotes 2078.
https://developer.apple.com/library/archive/technotes/tn2078/
- filename length: the max length of file
name of FSRef is 255 chars (it is limit of HFS+),
that of FSSpec is 31 chars (it is limit of HFS).
- filename encoding: FSSpec is localized by
legacy encoding for each language system,
FSRef is Unicode enabled.
A-2-2. FontManager
------------------
Following functions receive QuickDraw fontname:
FT_GetFile_From_Mac_Name()
QuickDraw is deprecated and replaced by Quartz
since Mac OS X 10.4. They are still kept for
backward compatibility. By undefinition of
HAVE_QUICKDRAW in building, you can change these
functions to return FT_Err_Unimplemented always.
Replacement functions are added for migration.
FT_GetFile_From_Mac_ATS_Name()
They are usable on Mac OS X only. On older systems,
these functions return FT_Err_Unimplemented always.
The detailed incompatibilities and possibility
of FontManager emulation without QuickDraw is
explained in
http://gyvern.ipc.hiroshima-u.ac.jp/~mpsuzuki/ats_benchmark.html
A-3. Framework Availabilities
-----------------------------
The framework of MacOS are often revised, especially
when new format of binary executable is introduced.
Following table is the minimum version of frameworks
to use functions used in FreeType2. The table is
extracted from MPW header files for assembly language.
*** NOTE ***
The conditional definition of available data type
in MPW compiler is insufficient. You can compile
program using FSRef data type for older systems
(MacOS 7, 8) that don't know FSRef data type.
+-------------------+-----------------------------+
CPU | mc680x0 | PowerPC |
+---------+---------+---------+---------+---------+
Binary Executable Format | Classic | 68K-CFM | CFM | CFM | Mach-O |
+---------+---------+---------+---------+---------+
Framework API | Toolbox | Toolbox | Toolbox | Carbon | Carbon |
+---------+---------+---------+---------+---------+
+---------+---------+---------+---------+---------+
| ?(*) |Interface|Interface|CarbonLib|Mac OS X |
| |Lib |Lib | | |
* Files.h +---------+---------+---------+---------+---------+
PBGetFCBInfoSync() | o | 7.1- | 7.1- | 1.0- | o |
FSMakeFSSpec() | o | 7.1- | 7.1- | 1.0- | o |
FSGetForkCBInfo() | o | (**) | 9.0- | 1.0- | o |
FSpMakeFSRef() | o | (**) | 9.0- | 1.0- | o |
FSGetCatalogInfo() | o | (**) | 9.0- | 1.0- | -10.3 |
FSPathMakeRef() | x | x | x | 1.1- | -10.3 |
+---------+---------+---------+---------+---------+
+---------+---------+---------+---------+---------+
| ?(*) |Font |Font |CarbonLib|Mac OS X |
| |Manager |Manager | | |
* Fonts.h +---------+---------+---------+---------+---------+
FMCreateFontFamilyIterator() | x | x | 9.0- | 1.0- | -10.3 |
FMDisposeFontFamilyIterator() | x | x | 9.0- | 1.0- | -10.3 |
FMGetNextFontFamily() | x | x | 9.0- | 1.0- | -10.3 |
FMGetFontFamilyName() | x | x | 9.0- | 1.0- | -10.3 |
FMCreateFontFamilyInstanceIterator() | x | x | 9.0- | 1.0- | -10.3 |
FMDisposeFontFamilyInstanceIterator() | x | x | 9.0- | 1.0- | -10.3 |
FMGetNextFontFamilyInstance() | x | x | 9.0- | 1.0- | -10.3 |
+---------+---------+---------+---------+---------+
+---------+---------+---------+---------+---------+
| - | - | - |CarbonLib|Mac OS X |
* ATSFont.h (***) +---------+---------+---------+---------+---------+
ATSFontFindFromName() | x | x | x | x | o |
ATSFontGetFileSpecification() | x | x | x | x | o |
+---------+---------+---------+---------+---------+
(*)
In the "Classic": the original binary executable
format, these framework functions are directly
transformed to MacOS system call. Therefore, the
exact availability should be checked by running
system.
(**)
InterfaceLib is bundled to MacOS and its version
is usually equal to MacOS. There's no separate
update for InterfaceLib. It is supposed that
there's no InterfaceLib 9.x for m68k platforms.
In fact, these functions are FSRef dependent.
(***)
ATSUI framework is available on ATSUnicode 8.5 on
ppc Toolbox CFM, CarbonLib 1.0 too. But its base:
ATS font manager is not published in these versions.
------------------------------------------------------------
Last update: 2013-Nov-03.
Currently maintained by
suzuki toshiya, <mpsuzuki@hiroshima-u.ac.jp>
Originally prepared by
Leonard Rosenthol, <leonardr@lazerware.com>
Just van Rossum, <just@letterror.com>

24
builds/mac/ascii2mpw.py Executable file
View File

@ -0,0 +1,24 @@
#!/usr/bin/env python
import sys
import string
if len( sys.argv ) == 1 :
for asc_line in sys.stdin.readlines():
mpw_line = string.replace(asc_line, "\\xA5", "\245")
mpw_line = string.replace(mpw_line, "\\xB6", "\266")
mpw_line = string.replace(mpw_line, "\\xC4", "\304")
mpw_line = string.replace(mpw_line, "\\xC5", "\305")
mpw_line = string.replace(mpw_line, "\\xFF", "\377")
mpw_line = string.replace(mpw_line, "\n", "\r")
mpw_line = string.replace(mpw_line, "\\n", "\n")
sys.stdout.write(mpw_line)
elif sys.argv[1] == "-r" :
for mpw_line in sys.stdin.readlines():
asc_line = string.replace(mpw_line, "\n", "\\n")
asc_line = string.replace(asc_line, "\r", "\n")
asc_line = string.replace(asc_line, "\245", "\\xA5")
asc_line = string.replace(asc_line, "\266", "\\xB6")
asc_line = string.replace(asc_line, "\304", "\\xC4")
asc_line = string.replace(asc_line, "\305", "\\xC5")
asc_line = string.replace(asc_line, "\377", "\\xFF")
sys.stdout.write(asc_line)

View File

@ -0,0 +1,36 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
"https://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
<string>freetype</string>
<key>CFBundleGetInfoString</key>
<string>FreeType ${PROJECT_VERSION}</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>FreeType</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>${PROJECT_VERSION}</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>${PROJECT_VERSION}</string>
</dict>
</plist>

Binary file not shown.

1194
builds/mac/ftlib.prj.xml Normal file

File diff suppressed because it is too large Load Diff

1542
builds/mac/ftmac.c Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,117 @@
#!/usr/bin/env python3
#
# Copyright (C) 2020-2024 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,
# and distributed under the terms of the FreeType project license,
# LICENSE.TXT. By continuing to use, modify, or distribute this file you
# indicate that you have read the license and understand and accept it
# fully.
"""Extract the FreeType version numbers from `<freetype/freetype.h>`.
This script parses the header to extract the version number defined there.
By default, the full dotted version number is printed, but `--major`,
`--minor` or `--patch` can be used to only print one of these values
instead.
"""
from __future__ import print_function
import argparse
import os
import re
import sys
# Expected input:
#
# ...
# #define FREETYPE_MAJOR 2
# #define FREETYPE_MINOR 10
# #define FREETYPE_PATCH 2
# ...
RE_MAJOR = re.compile(r"^ \#define \s+ FREETYPE_MAJOR \s+ (.*) $", re.X)
RE_MINOR = re.compile(r"^ \#define \s+ FREETYPE_MINOR \s+ (.*) $", re.X)
RE_PATCH = re.compile(r"^ \#define \s+ FREETYPE_PATCH \s+ (.*) $", re.X)
def parse_freetype_header(header):
major = None
minor = None
patch = None
for line in header.splitlines():
line = line.rstrip()
m = RE_MAJOR.match(line)
if m:
assert major == None, "FREETYPE_MAJOR appears more than once!"
major = m.group(1)
continue
m = RE_MINOR.match(line)
if m:
assert minor == None, "FREETYPE_MINOR appears more than once!"
minor = m.group(1)
continue
m = RE_PATCH.match(line)
if m:
assert patch == None, "FREETYPE_PATCH appears more than once!"
patch = m.group(1)
continue
assert (
major and minor and patch
), "This header is missing one of FREETYPE_MAJOR, FREETYPE_MINOR or FREETYPE_PATCH!"
return (major, minor, patch)
def main():
parser = argparse.ArgumentParser(description=__doc__)
group = parser.add_mutually_exclusive_group()
group.add_argument(
"--major",
action="store_true",
help="Only print the major version number.",
)
group.add_argument(
"--minor",
action="store_true",
help="Only print the minor version number.",
)
group.add_argument(
"--patch",
action="store_true",
help="Only print the patch version number.",
)
parser.add_argument(
"input",
metavar="FREETYPE_H",
help="The input freetype.h header to parse.",
)
args = parser.parse_args()
with open(args.input) as f:
header = f.read()
version = parse_freetype_header(header)
if args.major:
print(version[0])
elif args.minor:
print(version[1])
elif args.patch:
print(version[2])
else:
print("%s.%s.%s" % version)
return 0
if __name__ == "__main__":
sys.exit(main())

View File

@ -0,0 +1,115 @@
#!/usr/bin/env python3
#
# Copyright (C) 2020-2024 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,
# and distributed under the terms of the FreeType project license,
# LICENSE.TXT. By continuing to use, modify, or distribute this file you
# indicate that you have read the license and understand and accept it
# fully.
"""Extract the libtool version from `configure.raw`.
This script parses the `configure.raw` file to extract the libtool version
number. By default, the full dotted version number is printed, but
`--major`, `--minor` or `--patch` can be used to only print one of these
values instead.
"""
from __future__ import print_function
import argparse
import os
import re
import sys
# Expected input:
#
# ...
# version_info='23:2:17'
# ...
RE_VERSION_INFO = re.compile(r"^version_info='(\d+):(\d+):(\d+)'")
def parse_configure_raw(header):
major = None
minor = None
patch = None
for line in header.splitlines():
line = line.rstrip()
m = RE_VERSION_INFO.match(line)
if m:
assert major == None, "version_info appears more than once!"
major = m.group(1)
minor = m.group(2)
patch = m.group(3)
continue
assert (
major and minor and patch
), "This input file is missing a version_info definition!"
return (major, minor, patch)
def main():
parser = argparse.ArgumentParser(description=__doc__)
group = parser.add_mutually_exclusive_group()
group.add_argument(
"--major",
action="store_true",
help="Only print the major version number.",
)
group.add_argument(
"--minor",
action="store_true",
help="Only print the minor version number.",
)
group.add_argument(
"--patch",
action="store_true",
help="Only print the patch version number.",
)
group.add_argument(
"--soversion",
action="store_true",
help="Only print the libtool library suffix.",
)
parser.add_argument(
"input",
metavar="CONFIGURE_RAW",
help="The input configure.raw file to parse.",
)
args = parser.parse_args()
with open(args.input) as f:
raw_file = f.read()
version = parse_configure_raw(raw_file)
if args.major:
print(version[0])
elif args.minor:
print(version[1])
elif args.patch:
print(version[2])
elif args.soversion:
# Convert libtool version_info to the library suffix.
# (current,revision, age) -> (current - age, age, revision)
print(
"%d.%s.%s"
% (int(version[0]) - int(version[2]), version[2], version[1])
)
else:
print("%s.%s.%s" % version)
return 0
if __name__ == "__main__":
sys.exit(main())

View File

@ -0,0 +1,89 @@
#!/usr/bin/env python3
#
# Copyright (C) 2020-2024 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,
# and distributed under the terms of the FreeType project license,
# LICENSE.TXT. By continuing to use, modify, or distribute this file you
# indicate that you have read the license and understand and accept it
# fully.
"""Generate FreeType reference documentation."""
from __future__ import print_function
import argparse
import glob
import os
import subprocess
import sys
def main():
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument(
"--input-dir",
required=True,
help="Top-level FreeType source directory.",
)
parser.add_argument(
"--version", required=True, help='FreeType version (e.g. "2.x.y").'
)
parser.add_argument(
"--output-dir", required=True, help="Output directory."
)
args = parser.parse_args()
# Get the list of input files of interest.
include_dir = os.path.join(args.input_dir, "include")
include_config_dir = os.path.join(include_dir, "config")
include_cache_dir = os.path.join(include_dir, "cache")
all_headers = (
glob.glob(os.path.join(args.input_dir, "include", "freetype", "*.h"))
+ glob.glob(
os.path.join(
args.input_dir, "include", "freetype", "config", "*.h"
)
)
+ glob.glob(
os.path.join(
args.input_dir, "include", "freetype", "cache", "*.h"
)
)
)
if not os.path.exists(args.output_dir):
os.makedirs(args.output_dir)
else:
assert os.path.isdir(args.output_dir), (
"Not a directory: " + args.output_dir
)
cmds = [
sys.executable,
"-m",
"docwriter",
"--prefix=ft2",
"--title=FreeType-" + args.version,
"--site=reference",
"--output=" + args.output_dir,
] + all_headers
print("Running docwriter...")
subprocess.check_call(cmds)
print("Building static site...")
subprocess.check_call(
[sys.executable, "-m", "mkdocs", "build"], cwd=args.output_dir
)
return 0
if __name__ == "__main__":
sys.exit(main())

View File

@ -0,0 +1,177 @@
#!/usr/bin/env python3
#
# Copyright (C) 2020-2024 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,
# and distributed under the terms of the FreeType project license,
# LICENSE.TXT. By continuing to use, modify, or distribute this file you
# indicate that you have read the license and understand and accept it
# fully.
"""Parse modules.cfg and dump its output either as ftmodule.h or a list of
base extensions.
"""
from __future__ import print_function
import argparse
import os
import re
import sys
# Expected input:
#
# ...
# FONT_MODULES += <name>
# HINTING_MODULES += <name>
# RASTER_MODULES += <name>
# AUX_MODULES += <name>
# BASE_EXTENSIONS += <name>
# ...
def parse_modules_cfg(input_file):
lists = {
"FONT_MODULES": [],
"HINTING_MODULES": [],
"RASTER_MODULES": [],
"AUX_MODULES": [],
"BASE_EXTENSIONS": [],
}
for line in input_file.splitlines():
line = line.rstrip()
# Ignore empty lines and those that start with a comment.
if not line or line[0] == "#":
continue
items = line.split()
assert len(items) == 3 and items[1] == "+=", (
"Unexpected input line [%s]" % line
)
assert items[0] in lists, (
"Unexpected configuration variable name " + items[0]
)
lists[items[0]].append(items[2])
return lists
def generate_ftmodule(lists):
result = "/* This is a generated file. */\n"
for driver in lists["FONT_MODULES"]:
if driver == "sfnt": # Special case for the sfnt 'driver'.
result += "FT_USE_MODULE( FT_Module_Class, sfnt_module_class )\n"
continue
name = {
"truetype": "tt",
"type1": "t1",
"cid": "t1cid",
"type42": "t42",
"winfonts": "winfnt",
}.get(driver, driver)
result += (
"FT_USE_MODULE( FT_Driver_ClassRec, %s_driver_class )\n" % name
)
for module in lists["HINTING_MODULES"]:
result += (
"FT_USE_MODULE( FT_Module_Class, %s_module_class )\n" % module
)
for module in lists["RASTER_MODULES"]:
names = {
"raster": ("ft_raster1",),
"smooth": ("ft_smooth",),
"svg": ("ft_svg",),
"sdf": ("ft_sdf", "ft_bitmap_sdf"),
}.get(module)
for name in names:
result += (
"FT_USE_MODULE( FT_Renderer_Class, %s_renderer_class )\n" % name
)
for module in lists["AUX_MODULES"]:
if module in ("psaux", "psnames", "otvalid", "gxvalid"):
name = {
"gxvalid": "gxv",
"otvalid": "otv",
}.get(module, module)
result += (
"FT_USE_MODULE( FT_Module_Class, %s_module_class )\n" % name
)
result += "/* EOF */\n"
return result
def generate_main_modules(lists):
return "\n".join(
lists["FONT_MODULES"]
+ lists["HINTING_MODULES"]
+ lists["RASTER_MODULES"]
)
def generate_aux_modules(lists):
return "\n".join(lists["AUX_MODULES"])
def generate_base_extensions(lists):
return "\n".join(lists["BASE_EXTENSIONS"])
def main():
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument(
"--format",
required=True,
choices=(
"ftmodule.h",
"main-modules",
"aux-modules",
"base-extensions-list",
),
help="Select output format.",
)
parser.add_argument(
"input",
metavar="CONFIGURE_RAW",
help="The input configure.raw file to parse.",
)
parser.add_argument("--output", help="Output file (default is stdout).")
args = parser.parse_args()
with open(args.input) as f:
input_data = f.read()
lists = parse_modules_cfg(input_data)
if args.format == "ftmodule.h":
result = generate_ftmodule(lists)
elif args.format == "main-modules":
result = generate_main_modules(lists)
elif args.format == "aux-modules":
result = generate_aux_modules(lists)
elif args.format == "base-extensions-list":
result = generate_base_extensions(lists)
else:
assert False, "Invalid output format!"
if args.output:
with open(args.output, "w") as f:
f.write(result)
else:
print(result)
return 0
if __name__ == "__main__":
sys.exit(main())

View File

@ -0,0 +1,115 @@
#!/usr/bin/env python3
#
# Copyright (C) 2020-2024 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,
# and distributed under the terms of the FreeType project license,
# LICENSE.TXT. By continuing to use, modify, or distribute this file you
# indicate that you have read the license and understand and accept it
# fully.
"""Toggle settings in `ftoption.h` file based on command-line arguments.
This script takes an `ftoption.h` file as input and rewrites
`#define`/`#undef` lines in it based on `--enable=CONFIG_VARNAME` or
`--disable=CONFIG_VARNAME` arguments passed to it, where `CONFIG_VARNAME` is
configuration variable name, such as `FT_CONFIG_OPTION_USE_LZW`, that may
appear in the file.
Note that if one of `CONFIG_VARNAME` is not found in the input file, this
script exits with an error message listing the missing variable names.
"""
import argparse
import os
import re
import sys
def main():
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument(
"input", metavar="FTOPTION_H", help="Path to input ftoption.h file."
)
parser.add_argument("--output", help="Output to file instead of stdout.")
parser.add_argument(
"--enable",
action="append",
default=[],
help="Enable a given build option (e.g. FT_CONFIG_OPTION_USE_LZW).",
)
parser.add_argument(
"--disable",
action="append",
default=[],
help="Disable a given build option.",
)
args = parser.parse_args()
common_options = set(args.enable) & set(args.disable)
if common_options:
parser.error(
"Options cannot be both enabled and disabled: %s"
% sorted(common_options)
)
return 1
with open(args.input) as f:
input_file = f.read()
options_seen = set()
new_lines = []
for line in input_file.splitlines():
# Expected formats:
# #define <CONFIG_VAR>
# /* #define <CONFIG_VAR> */
# #undef <CONFIG_VAR>
line = line.rstrip()
if line.startswith("/* #define ") and line.endswith(" */"):
option_name = line[11:-3].strip()
option_enabled = False
elif line.startswith("#define "):
option_name = line[8:].strip()
option_enabled = True
elif line.startswith("#undef "):
option_name = line[7:].strip()
option_enabled = False
else:
new_lines.append(line)
continue
options_seen.add(option_name)
if option_enabled and option_name in args.disable:
line = "#undef " + option_name
elif not option_enabled and option_name in args.enable:
line = "#define " + option_name
new_lines.append(line)
result = "\n".join(new_lines) + "\n"
# Sanity check that all command-line options were actually processed.
cmdline_options = set(args.enable) | set(args.disable)
assert cmdline_options.issubset(
options_seen
), "Could not find options in input file: " + ", ".join(
sorted(cmdline_options - options_seen)
)
if args.output:
with open(args.output, "w") as f:
f.write(result)
else:
print(result)
return 0
if __name__ == "__main__":
sys.exit(main())

View File

@ -2,7 +2,8 @@
# FreeType 2 modules sub-Makefile
#
# Copyright 1996-2000 by
# Copyright (C) 1996-2024 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,
@ -19,57 +20,60 @@
# This file is in charge of handling the generation of the modules list
# file.
.PHONY: make_module_list clean_module_list remake_module_list
# MODULE_LIST, as its name suggests, indicates where the modules list
# resides. For now, it is in `include/freetype/config/ftmodule.h'.
# Build the modules list.
#
ifndef FT_MODULE_LIST
FT_MODULE_LIST := $(TOP)$(SEP)include$(SEP)freetype$(SEP)config$(SEP)ftmodule.h
endif
$(FTMODULE_H): $(MODULES_CFG)
$(FTMODULE_H_INIT)
$(FTMODULE_H_CREATE)
$(FTMODULE_H_DONE)
# To build the modules list, we invoke the `make_module_list' target.
#
# This rule is commented out by default since FreeType comes already with
# a ftmodule.h file.
#
#$(FT_MODULE_LIST): make_module_list
# Before the modules list file can be generated, we must remove the file in
# order to `clean' the list.
#
clean_module_list:
@-$(DELETE) $(subst $(SEP),$(HOSTSEP),$(FT_MODULE_LIST))
@-echo Regenerating the modules list in $(FT_MODULE_LIST)...
make_module_list: clean_module_list
@echo done.
# Trailing spaces are protected with a `#' sign to avoid accidental
# removing.
#
ifneq ($(findstring $(PLATFORM),dos win32 win16 os2),)
OPEN_MODULE := @echo #
CLOSE_MODULE := >> $(subst $(SEP),$(HOSTSEP),$(FT_MODULE_LIST))
ifneq ($(findstring $(PLATFORM),dos windows os2),)
OPEN_MODULE := @echo$(space)
CLOSE_MODULE := >> $(subst /,$(SEP),$(FTMODULE_H))
REMOVE_MODULE := @-$(DELETE) $(subst /,$(SEP),$(FTMODULE_H))
else
OPEN_MODULE := @echo "
CLOSE_MODULE := " >> $(FT_MODULE_LIST)
OPEN_MODULE := @echo "
CLOSE_MODULE := " >> $(FTMODULE_H)
REMOVE_MODULE := @-$(DELETE) $(FTMODULE_H)
endif
define FTMODULE_H_INIT
$(REMOVE_MODULE)
$(info Generating modules list in $(FTMODULE_H)...)
$(OPEN_MODULE)/* This is a generated file. */$(CLOSE_MODULE)
endef
# It is no mistake that the final closing parenthesis is on the
# next line -- it produces proper newlines during the expansion
# of `foreach'.
#
define FTMODULE_H_CREATE
$(foreach COMMAND,$(FTMODULE_H_COMMANDS),$($(COMMAND))
)
endef
define FTMODULE_H_DONE
$(OPEN_MODULE)/* EOF */$(CLOSE_MODULE)
$(info done.)
endef
# $(OPEN_DRIVER) & $(CLOSE_DRIVER) are used to specify a given font driver
# in the `module.mk' rules file.
#
OPEN_DRIVER := $(OPEN_MODULE)FT_USE_MODULE(
CLOSE_DRIVER := )$(CLOSE_MODULE)
ECHO_DRIVER := @echo "* module: #
ECHO_DRIVER := @echo "* module:$(space)
ECHO_DRIVER_DESC := (
ECHO_DRIVER_DONE := )"
# Each `module.mk' in the `src' sub-dirs is used to add one rule to the
# target `make_module_list'.
# Each `module.mk' in the `src/*' subdirectories adds a variable with
# commands to $(FTMODULE_H_COMMANDS). Note that we can't use SRC_DIR here.
#
include $(wildcard $(TOP)/src/*/module.mk)
-include $(patsubst %,$(TOP_DIR)/src/%/module.mk,$(MODULES))
# EOF

View File

@ -3,7 +3,7 @@
#
# Copyright 1996-2000 by
# Copyright (C) 1996-2024 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,
@ -13,50 +13,69 @@
# fully.
.PHONY: setup
ifeq ($(PLATFORM),ansi)
ifdef OS2_SHELL
PLATFORM := os2
COPY := copy
DELETE := del
CONFIG_FILE := os2-gcc.mk # gcc-emx by default
SEP := /
# additionally, we provide hooks for various other compilers
#
ifneq ($(findstring visualage,$(MAKECMDGOALS)),) # Visual Age C++
CONFIG_FILE := os2-icc.mk
SEP := $(BACKSLASH)
CC := icc
.PHONY: visualage
endif
ifneq ($(findstring watcom,$(MAKECMDGOALS)),) # Watcom C/C++
CONFIG_FILE := os2-wat.mk
SEP := $(BACKSLASH)
CC := wcc386
.PHONY: watcom
endif
ifneq ($(findstring borlandc,$(MAKECMDGOALS)),) # Borland C++ 32-bit
CONFIG_FILE := os2-bcc.mk
SEP := $(BACKSLASH)
CC := bcc32
.PHONY: borlandc
endif
ifneq ($(findstring devel,$(MAKECMDGOALS)),) # development target
CONFIG_FILE := os2-dev.mk
CC := gcc
SEP := /
devel: setup
endif
setup: dos_setup
endif # test OS2_SHELL
endif # test PLATFORM
endif
#EOF
ifeq ($(PLATFORM),os2)
COPY := copy
DELETE := del
CAT := type
SEP := $(BACKSLASH)
# gcc-emx by default
CONFIG_FILE := os2-gcc.mk
# additionally, we provide hooks for various other compilers
#
ifneq ($(findstring visualage,$(MAKECMDGOALS)),) # Visual Age C++
CONFIG_FILE := os2-icc.mk
CC := icc
.PHONY: visualage
visualage: setup
@cd .
endif
ifneq ($(findstring watcom,$(MAKECMDGOALS)),) # Watcom C/C++
CONFIG_FILE := os2-wat.mk
CC := wcc386
.PHONY: watcom
watcom: setup
@cd .
endif
ifneq ($(findstring borlandc,$(MAKECMDGOALS)),) # Borland C++ 32-bit
CONFIG_FILE := os2-bcc.mk
CC := bcc32
.PHONY: borlandc
borlandc: setup
@cd .
endif
ifneq ($(findstring devel,$(MAKECMDGOALS)),) # development target
CONFIG_FILE := os2-dev.mk
CC := gcc
.PHONY: devel
devel: setup
@cd .
endif
setup: std_setup
endif # test PLATFORM os2
# EOF

48
builds/os2/os2-def.mk Normal file
View File

@ -0,0 +1,48 @@
#
# FreeType 2 OS/2 specific definitions
#
# Copyright (C) 1996-2024 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,
# and distributed under the terms of the FreeType project license,
# LICENSE.TXT. By continuing to use, modify, or distribute this file you
# indicate that you have read the license and understand and accept it
# fully.
DELETE := del
CAT := type
SEP := $(strip \ )
PLATFORM_DIR := $(TOP_DIR)/builds/os2
PLATFORM := os2
# This is used for `make refdoc' and `make refdoc-venv'
#
BIN := Scripts
# The executable file extension (for tools), *with* leading dot.
#
E := .exe
# The directory where all library files are placed.
#
# By default, this is the same as $(OBJ_DIR); however, this can be changed
# to suit particular needs.
#
LIB_DIR := $(OBJ_DIR)
# The name of the final library file. Note that the DOS-specific Makefile
# uses a shorter (8.3) name.
#
LIBRARY := $(PROJECT)
# The NO_OUTPUT macro is used to ignore the output of commands.
#
NO_OUTPUT = 2> nul
# EOF

View File

@ -1,11 +1,11 @@
#
# FreeType 2 configuration rules for OS/2 + gcc
# FreeType 2 configuration rules for OS/2 + GCC
#
# Development version without optimizations.
#
# Copyright 1996-2000 by
# Copyright (C) 1996-2024 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,
@ -15,123 +15,16 @@
# fully.
ifndef TOP
TOP := .
endif
DEVEL_DIR := $(TOP_DIR)/devel
DELETE := del
SEP := /
HOSTSEP := $(strip \ )
BUILD := $(TOP)/builds/os2
PLATFORM := os2
CC := gcc
# include OS/2-specific definitions
include $(TOP_DIR)/builds/os2/os2-def.mk
# The directory where all object files are placed.
#
# Note that this is not $(TOP)/obj!
# This lets you build the library in your own directory with something like
#
# set TOP=.../path/to/freetype2/top/dir...
# mkdir obj
# make -f %TOP%/Makefile setup [options]
# make -f %TOP%/Makefile
#
OBJ_DIR := obj
# include gcc-specific definitions
include $(TOP_DIR)/builds/compiler/gcc-dev.mk
# include linking instructions
include $(TOP_DIR)/builds/link_dos.mk
# The directory where all library files are placed.
#
# By default, this is the same as $(OBJ_DIR), however, this can be changed
# to suit particular needs.
#
LIB_DIR := $(OBJ_DIR)
# The object file extension (for standard and static libraries). This can be
# .o, .tco, .obj, etc., depending on the platform.
#
O := o
SO := o
# The library file extension (for standard and static libraries). This can
# be .a, .lib, etc., depending on the platform.
#
A := a
SA := a
# The name of the final library file. Note that the DOS-specific Makefile
# uses a shorter (8.3) name.
#
LIBRARY := libfreetype
# Path inclusion flag. Some compilers use a different flag than `-I' to
# specify an additional include path. Examples are `/i=' or `-J'.
#
I := -I
# C flag used to define a macro before the compilation of a given source
# object. Usually is `-D' like in `-DDEBUG'.
#
D := -D
# The link flag used to specify a given library file on link. Note that
# this is only used to compile the demo programs, not the library itself.
#
L := -l
# Target flag.
#
T := -o # Don't remove this comment line! We need the space after `-o'.
# C flags
#
# These should concern: debug output, optimization & warnings.
#
# Use the ANSIFLAGS variable to define the compiler flags used to enfore
# ANSI compliance.
#
ifndef CFLAGS
CFLAGS := -c -g -O0 -Wall
endif
# ANSIFLAGS: Put there the flags used to make your compiler ANSI-compliant.
#
ANSIFLAGS := -ansi -pedantic
ifdef BUILD_FREETYPE
# Now include the main sub-makefile. It contains all the rules used to
# build the library with the previous variables defined.
#
include $(TOP)/builds/freetype.mk
# The cleanup targets.
#
clean_freetype: clean_freetype_dos
distclean_freetype: distclean_freetype_dos
# Librarian to use to build the static library
#
FT_LIBRARIAN := $(AR) -r
# This final rule is used to link all object files into a single library.
# It is part of the system-specific sub-Makefile because not all
# librarians accept a simple syntax like
#
# librarian library_file {list of object files}
#
$(FT_LIBRARY): $(OBJECTS_LIST)
-$(DELETE) $(subst $(SEP),$(HOSTSEP),$(FT_LIBRARY)) 2> nul
$(FT_LIBRARIAN) $@ $(OBJECTS_LIST)
endif
# EOF

View File

@ -1,9 +1,9 @@
#
# FreeType 2 configuration rules for OS/2 + gcc
# FreeType 2 configuration rules for the OS/2 + gcc
#
# Copyright 1996-2000 by
# Copyright (C) 1996-2024 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,
@ -13,123 +13,14 @@
# fully.
ifndef TOP
TOP := .
endif
# include OS/2-specific definitions
include $(TOP_DIR)/builds/os2/os2-def.mk
DELETE := del
SEP := /
HOSTSEP := $(strip \ )
BUILD := $(TOP)/builds/os2
PLATFORM := os2
CC := gcc
# include gcc-specific definitions
include $(TOP_DIR)/builds/compiler/gcc.mk
# The directory where all object files are placed.
#
# Note that this is not $(TOP)/obj!
# This lets you build the library in your own directory with something like
#
# set TOP=.../path/to/freetype2/top/dir...
# mkdir obj
# make -f %TOP%/Makefile setup [options]
# make -f %TOP%/Makefile
#
OBJ_DIR := obj
# include linking instructions
include $(TOP_DIR)/builds/link_dos.mk
# The directory where all library files are placed.
#
# By default, this is the same as $(OBJ_DIR), however, this can be changed
# to suit particular needs.
#
LIB_DIR := $(OBJ_DIR)
# The object file extension (for standard and static libraries). This can be
# .o, .tco, .obj, etc., depending on the platform.
#
O := o
SO := o
# The library file extension (for standard and static libraries). This can
# be .a, .lib, etc., depending on the platform.
#
A := a
SA := a
# The name of the final library file. Note that the DOS-specific Makefile
# uses a shorter (8.3) name.
#
LIBRARY := libfreetype
# Path inclusion flag. Some compilers use a different flag than `-I' to
# specify an additional include path. Examples are `/i=' or `-J'.
#
I := -I
# C flag used to define a macro before the compilation of a given source
# object. Usually is `-D' like in `-DDEBUG'.
#
D := -D
# The link flag used to specify a given library file on link. Note that
# this is only used to compile the demo programs, not the library itself.
#
L := -l
# Target flag.
#
T := -o # Don't remove this comment line! We need the space after `-o'.
# C flags
#
# These should concern: debug output, optimization & warnings.
#
# Use the ANSIFLAGS variable to define the compiler flags used to enfore
# ANSI compliance.
#
ifndef CFLAGS
CFLAGS := -c -g -O6 -Wall
endif
# ANSIFLAGS: Put there the flags used to make your compiler ANSI-compliant.
#
ANSIFLAGS := -ansi -pedantic
ifdef BUILD_FREETYPE
# Now include the main sub-makefile. It contains all the rules used to
# build the library with the previous variables defined.
#
include $(TOP)/builds/freetype.mk
# The cleanup targets.
#
clean_freetype: clean_freetype_dos
distclean_freetype: distclean_freetype_dos
# Librarian to use to build the static library
#
FT_LIBRARIAN := $(AR) -r
# This final rule is used to link all object files into a single library.
# It is part of the system-specific sub-Makefile because not all
# librarians accept a simple syntax like
#
# librarian library_file {list of object files}
#
$(FT_LIBRARY): $(OBJECTS_LIST)
-$(DELETE) $(subst $(SEP),$(HOSTSEP),$(FT_LIBRARY)) 2> nul
$(FT_LIBRARIAN) $@ $(OBJECTS_LIST)
endif
# EOF

72
builds/symbian/bld.inf Normal file
View File

@ -0,0 +1,72 @@
//
// FreeType 2 project for the symbian platform
//
// Copyright (C) 2008-2024 by
// David Turner, Robert Wilhelm, and Werner Lemberg.
//
// This file is part of the FreeType project, and may only be used, modified,
// and distributed under the terms of the FreeType project license,
// LICENSE.TXT. By continuing to use, modify, or distribute this file you
// indicate that you have read the license and understand and accept it
// fully.
PRJ_PLATFORMS
DEFAULT
PRJ_MMPFILES
freetype.mmp
PRJ_EXPORTS
../../include/freetype/ft2build.h
../../include/freetype/config/ftconfig.h config/ftconfig.h
../../include/freetype/config/ftheader.h config/ftheader.h
../../include/freetype/config/ftmodule.h config/ftmodule.h
../../include/freetype/config/ftoption.h config/ftoption.h
../../include/freetype/config/ftstdlib.h config/ftstdlib.h
../../include/freetype/freetype.h freetype.h
../../include/freetype/ftadvanc.h ftadvanc.h
../../include/freetype/ftautoh.h ftautoh.h
../../include/freetype/ftbbox.h ftbbox.h
../../include/freetype/ftbdf.h ftbdf.h
../../include/freetype/ftbitmap.h ftbitmap.h
../../include/freetype/ftbzip2.h ftbzip2.h
../../include/freetype/ftcache.h ftcache.h
../../include/freetype/ftcffdrv.h ftcffdrv.h
../../include/freetype/ftcid.h ftcid.h
../../include/freetype/fterrdef.h fterrdef.h
../../include/freetype/fterrors.h fterrors.h
../../include/freetype/ftfntfmt.h ftfntfmt.h
../../include/freetype/ftgasp.h ftgasp.h
../../include/freetype/ftglyph.h ftglyph.h
../../include/freetype/ftgxval.h ftgxval.h
../../include/freetype/ftgzip.h ftgzip.h
../../include/freetype/ftimage.h ftimage.h
../../include/freetype/ftincrem.h ftincrem.h
../../include/freetype/ftlcdfil.h ftlcdfil.h
../../include/freetype/ftlist.h ftlist.h
../../include/freetype/ftlzw.h ftlzw.h
../../include/freetype/ftmac.h ftmac.h
../../include/freetype/ftmm.h ftmm.h
../../include/freetype/ftmodapi.h ftmodapi.h
../../include/freetype/ftmoderr.h ftmoderr.h
../../include/freetype/ftotval.h ftotval.h
../../include/freetype/ftoutln.h ftoutln.h
../../include/freetype/ftparams.h ftparams.h
../../include/freetype/ftpcfdrv.h ftpcfdrv.h
../../include/freetype/ftpfr.h ftpfr.h
../../include/freetype/ftrender.h ftrender.h
../../include/freetype/ftsizes.h ftsizes.h
../../include/freetype/ftsnames.h ftsnames.h
../../include/freetype/ftstroke.h ftstroke.h
../../include/freetype/ftsynth.h ftsynth.h
../../include/freetype/ftsystem.h ftsystem.h
../../include/freetype/ftt1drv.h ftt1drv.h
../../include/freetype/fttrigon.h fttrigon.h
../../include/freetype/ftttdrv.h ftttdrv.h
../../include/freetype/fttypes.h fttypes.h
../../include/freetype/ftwinfnt.h ftwinfnt.h
../../include/freetype/t1tables.h t1tables.h
../../include/freetype/ttnameid.h ttnameid.h
../../include/freetype/tttables.h tttables.h
../../include/freetype/tttags.h tttags.h

146
builds/symbian/freetype.mmp Normal file
View File

@ -0,0 +1,146 @@
//
// FreeType 2 makefile for the symbian platform
//
// Copyright (C) 2008-2024 by
// David Turner, Robert Wilhelm, and Werner Lemberg.
//
// This file is part of the FreeType project, and may only be used, modified,
// and distributed under the terms of the FreeType project license,
// LICENSE.TXT. By continuing to use, modify, or distribute this file you
// indicate that you have read the license and understand and accept it
// fully.
target freetype.lib
targettype lib
macro NDEBUG
macro FT2_BUILD_LIBRARY
sourcepath ..\..\src\autofit
source autofit.c
sourcepath ..\..\src\base
source ftbase.c
source ftbbox.c
source ftbdf.c
source ftbitmap.c
source ftcid.c
source ftfstype.c
source ftgasp.c
source ftglyph.c
source ftgxval.c
source ftinit.c
source ftmm.c
source ftotval.c
source ftpatent.c
source ftpfr.c
source ftstroke.c
source ftsynth.c
source ftsystem.c
source fttype1.c
source ftwinfnt.c
sourcepath ..\..\src\bdf
source bdf.c
sourcepath ..\..\src\bzip2
source ftbzip2.c
sourcepath ..\..\src\cache
source ftcache.c
sourcepath ..\..\src\cff
source cff.c
sourcepath ..\..\src\cid
source type1cid.c
sourcepath ..\..\src\gzip
source ftgzip.c
sourcepath ..\..\src\lzw
source ftlzw.c
sourcepath ..\..\src\pcf
source pcf.c
sourcepath ..\..\src\pfr
source pfr.c
sourcepath ..\..\src\psaux
source psaux.c
sourcepath ..\..\src\pshinter
source pshinter.c
sourcepath ..\..\src\psnames
source psmodule.c
sourcepath ..\..\src\raster
source raster.c
sourcepath ..\..\src\sfnt
source sfnt.c
sourcepath ..\..\src\smooth
source smooth.c
sourcepath ..\..\src\truetype
source truetype.c
sourcepath ..\..\src\type1
source type1.c
sourcepath ..\..\src\type42
source type42.c
sourcepath ..\..\src\winfonts
source winfnt.c
systeminclude ..\..\include
systeminclude \epoc32\include\stdapis
userinclude ..\..\src\autofit
userinclude ..\..\src\bdf
userinclude ..\..\src\bzip2
userinclude ..\..\src\cache
userinclude ..\..\src\cff
userinclude ..\..\src\cid
userinclude ..\..\src\gxvalid
userinclude ..\..\src\gzip
userinclude ..\..\src\lzw
userinclude ..\..\src\otvalid
userinclude ..\..\src\pcf
userinclude ..\..\src\pfr
userinclude ..\..\src\psaux
userinclude ..\..\src\pshinter
userinclude ..\..\src\psnames
userinclude ..\..\src\raster
userinclude ..\..\src\sfnt
userinclude ..\..\src\smooth
userinclude ..\..\src\truetype
userinclude ..\..\src\type1
userinclude ..\..\src\type42
userinclude ..\..\src\winfonts

316
builds/toplevel.mk Normal file
View File

@ -0,0 +1,316 @@
#
# FreeType build system -- top-level sub-Makefile
#
# Copyright (C) 1996-2024 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,
# and distributed under the terms of the FreeType project license,
# LICENSE.TXT. By continuing to use, modify, or distribute this file you
# indicate that you have read the license and understand and accept it
# fully.
# This file is designed for GNU Make, do not use it with another Make tool!
#
# It works as follows:
#
# - When invoked for the first time, this Makefile includes the rules found
# in `PROJECT/builds/detect.mk'. They are in charge of detecting the
# current platform.
#
# A summary of the detection is displayed, and the file `config.mk' is
# created in the current directory.
#
# - When invoked later, this Makefile includes the rules found in
# `config.mk'. This sub-Makefile defines some system-specific variables
# (like compiler, compilation flags, object suffix, etc.), then includes
# the rules found in `PROJECT/builds/PROJECT.mk', used to build the
# library.
#
# See the comments in `builds/detect.mk' and `builds/PROJECT.mk' for more
# details on host platform detection and library builds.
# First of all, check whether we have `$(value ...)'. We do this by testing
# for `$(eval ...)' which has been introduced in the same GNU make version.
eval_available :=
$(eval eval_available := T)
ifneq ($(eval_available),T)
$(error FreeType's build system needs a Make program which supports $$(value))
endif
.PHONY: all dist distclean modules setup
# The `space' variable is used to avoid trailing spaces in defining the
# `T' variable later.
#
empty :=
space := $(empty) $(empty)
# The main configuration file, defining the `XXX_MODULES' variables. We
# prefer a `modules.cfg' file in OBJ_DIR over TOP_DIR.
#
ifndef MODULES_CFG
MODULES_CFG := $(TOP_DIR)/modules.cfg
ifneq ($(wildcard $(OBJ_DIR)/modules.cfg),)
MODULES_CFG := $(OBJ_DIR)/modules.cfg
endif
endif
# FTMODULE_H, as its name suggests, indicates where the FreeType module
# class file resides.
#
FTMODULE_H ?= $(OBJ_DIR)/ftmodule.h
include $(MODULES_CFG)
# The list of modules we are using.
#
MODULES := $(FONT_MODULES) \
$(HINTING_MODULES) \
$(RASTER_MODULES) \
$(AUX_MODULES)
CONFIG_MK ?= config.mk
# If no configuration sub-makefile is present, or if `setup' is the target
# to be built, run the auto-detection rules to figure out which
# configuration rules file to use.
#
# Note that the configuration file is put in the current directory, which is
# not necessarily $(TOP_DIR).
# If `config.mk' is not present, set `check_platform'.
#
ifeq ($(wildcard $(CONFIG_MK)),)
check_platform := 1
endif
# If `setup' is one of the targets requested, set `check_platform'.
#
ifneq ($(findstring setup,$(MAKECMDGOALS)),)
check_platform := 1
endif
# Include the automatic host platform detection rules when we need to
# check the platform.
#
ifdef check_platform
all modules: setup
include $(TOP_DIR)/builds/detect.mk
# For builds directly from the git repository we need to copy files
# from `subprojects/dlg' to `src/dlg' and `include/dlg'.
#
ifeq ($(wildcard $(TOP_DIR)/src/dlg/dlg.*),)
ifeq ($(wildcard $(TOP_DIR)/subprojects/dlg/*),)
copy_submodule: check_out_submodule
endif
setup: copy_submodule
endif
# This rule makes sense for Unix only to remove files created by a run of
# the configure script which hasn't been successful (so that no
# `config.mk' has been created). It uses the built-in $(RM) command of
# GNU make. Similarly, `nul' is created if e.g. `make setup windows' has
# been erroneously used.
#
# Note: This test is duplicated in `builds/unix/detect.mk'.
#
is_unix := $(strip $(wildcard /sbin/init) \
$(wildcard /usr/sbin/init) \
$(wildcard /dev/null) \
$(wildcard /hurd/auth))
ifneq ($(is_unix),)
distclean:
$(RM) $(TOP_DIR)/builds/unix/config.cache
$(RM) $(TOP_DIR)/builds/unix/config.log
$(RM) $(TOP_DIR)/builds/unix/config.status
$(RM) $(TOP_DIR)/builds/unix/unix-def.mk
$(RM) $(TOP_DIR)/builds/unix/unix-cc.mk
$(RM) $(TOP_DIR)/builds/unix/freetype2.pc
$(RM) nul
endif # test is_unix
# IMPORTANT:
#
# `setup' must be defined by the host platform detection rules to create
# the `config.mk' file in the current directory.
else
# A configuration sub-Makefile is present -- simply run it.
#
all: single
BUILD_PROJECT := yes
include $(CONFIG_MK)
endif # test check_platform
.PHONY: check_out_submodule copy_submodule
check_out_submodule:
$(info Checking out submodule in `subprojects/dlg')
git -C $(TOP_DIR) submodule update --init
copy_submodule:
$(info Copying files from `subprojects/dlg' to `src/dlg' and `include/dlg')
ifeq ($(wildcard $(TOP_DIR)/include/dlg),)
mkdir $(subst /,$(SEP),$(TOP_DIR)/include/dlg)
endif
$(COPY) $(subst /,$(SEP),$(TOP_DIR)/subprojects/dlg/include/dlg/output.h $(TOP_DIR)/include/dlg)
$(COPY) $(subst /,$(SEP),$(TOP_DIR)/subprojects/dlg/include/dlg/dlg.h $(TOP_DIR)/include/dlg)
$(COPY) $(subst /,$(SEP),$(TOP_DIR)/subprojects/dlg/src/dlg/dlg.c $(TOP_DIR)/src/dlg)
# We always need the list of modules in ftmodule.h.
#
all setup: $(FTMODULE_H)
# The `modules' target unconditionally rebuilds the module list.
#
modules:
$(FTMODULE_H_INIT)
$(FTMODULE_H_CREATE)
$(FTMODULE_H_DONE)
include $(TOP_DIR)/builds/modules.mk
# get FreeType version string using built-in string functions
#
hash := \#
work := $(strip $(shell $(CAT) \
$(subst /,$(SEP),$(TOP_DIR)/include/freetype/freetype.h)))
work := $(subst $(hash)define$(space)FREETYPE_MAJOR$(space),MAjOR=,$(work))
work := $(subst $(hash)define$(space)FREETYPE_MINOR$(space),MInOR=,$(work))
work := $(subst $(hash)define$(space)FREETYPE_PATCH$(space),PAtCH=,$(work))
major := $(subst MAjOR=,,$(filter MAjOR=%,$(work)))
minor := $(subst MInOR=,,$(filter MInOR=%,$(work)))
patch := $(subst PAtCH=,,$(filter PAtCH=%,$(work)))
work :=
# ifneq ($(findstring x0x,x$(patch)x),)
# version := $(major).$(minor)
# winversion := $(major)$(minor)
# else
version := $(major).$(minor).$(patch)
winversion := $(major)$(minor)$(patch)
version_tag := VER-$(major)-$(minor)-$(patch)
# endif
# This target builds the tarballs.
#
# Not to be run by a normal user -- there are no attempts to make it
# generic.
dist:
-rm -rf tmp
rm -f freetype-$(version).tar.gz
rm -f freetype-$(version).tar.xz
rm -f ft$(winversion).zip
for d in `find . -wholename '*/.git' -prune \
-o -type f \
-o -print` ; do \
mkdir -p tmp/$$d ; \
done ;
currdir=`pwd` ; \
for f in `find . -wholename '*/.git' -prune \
-o -name .gitattributes \
-o -name .gitignore \
-o -name .gitlab-ci.yml \
-o -name .gitmodules \
-o -name .mailmap \
-o -type d \
-o -print` ; do \
ln -s $$currdir/$$f tmp/$$f ; \
done
cd tmp ; \
$(MAKE) devel ; \
$(MAKE) do-dist
mv tmp freetype-$(version)
tar -H ustar -chf - freetype-$(version) \
| gzip -9 -c > freetype-$(version).tar.gz
tar -H ustar -chf - freetype-$(version) \
| xz -c > freetype-$(version).tar.xz
@# Use CR/LF for zip files.
zip -lr9 ft$(winversion).zip freetype-$(version)
rm -fr freetype-$(version)
# The locations of the latest `config.guess' and `config.sub' versions (from
# GNU `config' git repository), relative to the `tmp' directory used during
# `make dist'.
#
CONFIG_GUESS = ~/git/config/config.guess
CONFIG_SUB = ~/git/config/config.sub
# We also use this repository to access the gnulib script that converts git
# commit messages to a ChangeLog file.
CHANGELOG_SCRIPT = ~/git/config/gitlog-to-changelog
# Don't say `make do-dist'. Always use `make dist' instead.
#
.PHONY: do-dist
do-dist: distclean refdoc
@# Without removing the files, `autoconf' and friends follow links.
rm -f $(TOP_DIR)/builds/unix/aclocal.m4
rm -f $(TOP_DIR)/builds/unix/configure.ac
rm -f $(TOP_DIR)/builds/unix/configure
sh autogen.sh
rm -rf $(TOP_DIR)/builds/unix/autom4te.cache
cp $(CONFIG_GUESS) $(TOP_DIR)/builds/unix
cp $(CONFIG_SUB) $(TOP_DIR)/builds/unix
@# Generate `ChangeLog' file with commits since release 2.11.0
@# (when we stopped creating this file manually).
$(CHANGELOG_SCRIPT) \
--format='%B%n' \
--no-cluster \
-- VER-2-11-0..$(version_tag) \
> ChangeLog
@# Remove intermediate files created by the `refdoc' target.
rm -rf $(TOP_DIR)/docs/markdown
rm -f $(TOP_DIR)/docs/mkdocs.yml
@# Remove more stuff related to git.
rm -rf $(TOP_DIR)/subprojects/dlg
# EOF

18
builds/unix/.gitignore vendored Normal file
View File

@ -0,0 +1,18 @@
aclocal.m4
autom4te.cache
config.cache
config.guess
config.log
config.status
config.sub
configure
configure.ac
freetype2.pc
freetype-config
ftconfig.h
ftoption.h
install-sh
libtool
ltmain.sh
unix-cc.mk
unix-def.mk

430
builds/unix/aclocal.m4 vendored
View File

@ -1,430 +0,0 @@
## libtool.m4 - Configure libtool for the target system. -*-Shell-script-*-
## Copyright (C) 1996-1999 Free Software Foundation, Inc.
## Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation; either version 2 of the License, or
## (at your option) any later version.
##
## This program is distributed in the hope that it will be useful, but
## WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
## General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with this program; if not, write to the Free Software
## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
##
## As a special exception to the GNU General Public License, if you
## distribute this file as part of a program that contains a
## configuration script generated by Autoconf, you may include it under
## the same distribution terms that you use for the rest of that program.
# serial 40 AC_PROG_LIBTOOL
AC_DEFUN(AC_PROG_LIBTOOL,
[AC_REQUIRE([AC_LIBTOOL_SETUP])dnl
# Save cache, so that ltconfig can load it
AC_CACHE_SAVE
# Actually configure libtool. ac_aux_dir is where install-sh is found.
CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \
LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \
LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" \
DLLTOOL="$DLLTOOL" AS="$AS" OBJDUMP="$OBJDUMP" \
${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig --no-reexec \
$libtool_flags --no-verify $ac_aux_dir/ltmain.sh $lt_target \
|| AC_MSG_ERROR([libtool configure failed])
# Reload cache, that may have been modified by ltconfig
AC_CACHE_LOAD
# This can be used to rebuild libtool when needed
LIBTOOL_DEPS="$ac_aux_dir/ltconfig $ac_aux_dir/ltmain.sh"
# Always use our own libtool.
LIBTOOL='$(SHELL) $(top_builddir)/libtool'
AC_SUBST(LIBTOOL)dnl
# Redirect the config.log output again, so that the ltconfig log is not
# clobbered by the next message.
exec 5>>./config.log
])
AC_DEFUN(AC_LIBTOOL_SETUP,
[AC_PREREQ(2.13)dnl
AC_REQUIRE([AC_ENABLE_SHARED])dnl
AC_REQUIRE([AC_ENABLE_STATIC])dnl
AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl
AC_REQUIRE([AC_CANONICAL_HOST])dnl
AC_REQUIRE([AC_CANONICAL_BUILD])dnl
AC_REQUIRE([AC_PROG_RANLIB])dnl
AC_REQUIRE([AC_PROG_CC])dnl
AC_REQUIRE([AC_PROG_LD])dnl
AC_REQUIRE([AC_PROG_NM])dnl
AC_REQUIRE([AC_PROG_LN_S])dnl
dnl
case "$target" in
NONE) lt_target="$host" ;;
*) lt_target="$target" ;;
esac
# Check for any special flags to pass to ltconfig.
libtool_flags="--cache-file=$cache_file"
test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared"
test "$enable_static" = no && libtool_flags="$libtool_flags --disable-static"
test "$enable_fast_install" = no && libtool_flags="$libtool_flags --disable-fast-install"
test "$ac_cv_prog_gcc" = yes && libtool_flags="$libtool_flags --with-gcc"
test "$ac_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld"
ifdef([AC_PROVIDE_AC_LIBTOOL_DLOPEN],
[libtool_flags="$libtool_flags --enable-dlopen"])
ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL],
[libtool_flags="$libtool_flags --enable-win32-dll"])
AC_ARG_ENABLE(libtool-lock,
[ --disable-libtool-lock avoid locking (might break parallel builds)])
test "x$enable_libtool_lock" = xno && libtool_flags="$libtool_flags --disable-lock"
test x"$silent" = xyes && libtool_flags="$libtool_flags --silent"
# Some flags need to be propagated to the compiler or linker for good
# libtool support.
case "$lt_target" in
*-*-irix6*)
# Find out which ABI we are using.
echo '[#]line __oline__ "configure"' > conftest.$ac_ext
if AC_TRY_EVAL(ac_compile); then
case "`/usr/bin/file conftest.o`" in
*32-bit*)
LD="${LD-ld} -32"
;;
*N32*)
LD="${LD-ld} -n32"
;;
*64-bit*)
LD="${LD-ld} -64"
;;
esac
fi
rm -rf conftest*
;;
*-*-sco3.2v5*)
# On SCO OpenServer 5, we need -belf to get full-featured binaries.
SAVE_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -belf"
AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf,
[AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no])])
if test x"$lt_cv_cc_needs_belf" != x"yes"; then
# this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
CFLAGS="$SAVE_CFLAGS"
fi
;;
ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL],
[*-*-cygwin* | *-*-mingw*)
AC_CHECK_TOOL(DLLTOOL, dlltool, false)
AC_CHECK_TOOL(AS, as, false)
AC_CHECK_TOOL(OBJDUMP, objdump, false)
;;
])
esac
])
# AC_LIBTOOL_DLOPEN - enable checks for dlopen support
AC_DEFUN(AC_LIBTOOL_DLOPEN, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])])
# AC_LIBTOOL_WIN32_DLL - declare package support for building win32 dll's
AC_DEFUN(AC_LIBTOOL_WIN32_DLL, [AC_BEFORE([$0], [AC_LIBTOOL_SETUP])])
# AC_ENABLE_SHARED - implement the --enable-shared flag
# Usage: AC_ENABLE_SHARED[(DEFAULT)]
# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to
# `yes'.
AC_DEFUN(AC_ENABLE_SHARED, [dnl
define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl
AC_ARG_ENABLE(shared,
changequote(<<, >>)dnl
<< --enable-shared[=PKGS] build shared libraries [default=>>AC_ENABLE_SHARED_DEFAULT],
changequote([, ])dnl
[p=${PACKAGE-default}
case "$enableval" in
yes) enable_shared=yes ;;
no) enable_shared=no ;;
*)
enable_shared=no
# Look at the argument we got. We use all the common list separators.
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
for pkg in $enableval; do
if test "X$pkg" = "X$p"; then
enable_shared=yes
fi
done
IFS="$ac_save_ifs"
;;
esac],
enable_shared=AC_ENABLE_SHARED_DEFAULT)dnl
])
# AC_DISABLE_SHARED - set the default shared flag to --disable-shared
AC_DEFUN(AC_DISABLE_SHARED, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
AC_ENABLE_SHARED(no)])
# AC_ENABLE_STATIC - implement the --enable-static flag
# Usage: AC_ENABLE_STATIC[(DEFAULT)]
# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to
# `yes'.
AC_DEFUN(AC_ENABLE_STATIC, [dnl
define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl
AC_ARG_ENABLE(static,
changequote(<<, >>)dnl
<< --enable-static[=PKGS] build static libraries [default=>>AC_ENABLE_STATIC_DEFAULT],
changequote([, ])dnl
[p=${PACKAGE-default}
case "$enableval" in
yes) enable_static=yes ;;
no) enable_static=no ;;
*)
enable_static=no
# Look at the argument we got. We use all the common list separators.
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
for pkg in $enableval; do
if test "X$pkg" = "X$p"; then
enable_static=yes
fi
done
IFS="$ac_save_ifs"
;;
esac],
enable_static=AC_ENABLE_STATIC_DEFAULT)dnl
])
# AC_DISABLE_STATIC - set the default static flag to --disable-static
AC_DEFUN(AC_DISABLE_STATIC, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
AC_ENABLE_STATIC(no)])
# AC_ENABLE_FAST_INSTALL - implement the --enable-fast-install flag
# Usage: AC_ENABLE_FAST_INSTALL[(DEFAULT)]
# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to
# `yes'.
AC_DEFUN(AC_ENABLE_FAST_INSTALL, [dnl
define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, no, yes))dnl
AC_ARG_ENABLE(fast-install,
changequote(<<, >>)dnl
<< --enable-fast-install[=PKGS] optimize for fast installation [default=>>AC_ENABLE_FAST_INSTALL_DEFAULT],
changequote([, ])dnl
[p=${PACKAGE-default}
case "$enableval" in
yes) enable_fast_install=yes ;;
no) enable_fast_install=no ;;
*)
enable_fast_install=no
# Look at the argument we got. We use all the common list separators.
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
for pkg in $enableval; do
if test "X$pkg" = "X$p"; then
enable_fast_install=yes
fi
done
IFS="$ac_save_ifs"
;;
esac],
enable_fast_install=AC_ENABLE_FAST_INSTALL_DEFAULT)dnl
])
# AC_ENABLE_FAST_INSTALL - set the default to --disable-fast-install
AC_DEFUN(AC_DISABLE_FAST_INSTALL, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
AC_ENABLE_FAST_INSTALL(no)])
# AC_PROG_LD - find the path to the GNU or non-GNU linker
AC_DEFUN(AC_PROG_LD,
[AC_ARG_WITH(gnu-ld,
[ --with-gnu-ld assume the C compiler uses GNU ld [default=no]],
test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
AC_REQUIRE([AC_PROG_CC])dnl
AC_REQUIRE([AC_CANONICAL_HOST])dnl
AC_REQUIRE([AC_CANONICAL_BUILD])dnl
ac_prog=ld
if test "$ac_cv_prog_gcc" = yes; then
# Check if gcc -print-prog-name=ld gives a path.
AC_MSG_CHECKING([for ld used by GCC])
ac_prog=`($CC -print-prog-name=ld) 2>&5`
case "$ac_prog" in
# Accept absolute paths.
changequote(,)dnl
[\\/]* | [A-Za-z]:[\\/]*)
re_direlt='/[^/][^/]*/\.\./'
changequote([,])dnl
# Canonicalize the path of ld
ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
done
test -z "$LD" && LD="$ac_prog"
;;
"")
# If it fails, then pretend we aren't using GCC.
ac_prog=ld
;;
*)
# If it is relative, then search for the first ld in PATH.
with_gnu_ld=unknown
;;
esac
elif test "$with_gnu_ld" = yes; then
AC_MSG_CHECKING([for GNU ld])
else
AC_MSG_CHECKING([for non-GNU ld])
fi
AC_CACHE_VAL(ac_cv_path_LD,
[if test -z "$LD"; then
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
for ac_dir in $PATH; do
test -z "$ac_dir" && ac_dir=.
if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
ac_cv_path_LD="$ac_dir/$ac_prog"
# Check to see if the program is GNU ld. I'd rather use --version,
# but apparently some GNU ld's only accept -v.
# Break only if it was the GNU/non-GNU ld that we prefer.
if "$ac_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then
test "$with_gnu_ld" != no && break
else
test "$with_gnu_ld" != yes && break
fi
fi
done
IFS="$ac_save_ifs"
else
ac_cv_path_LD="$LD" # Let the user override the test with a path.
fi])
LD="$ac_cv_path_LD"
if test -n "$LD"; then
AC_MSG_RESULT($LD)
else
AC_MSG_RESULT(no)
fi
test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
AC_PROG_LD_GNU
])
AC_DEFUN(AC_PROG_LD_GNU,
[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], ac_cv_prog_gnu_ld,
[# I'd rather use --version here, but apparently some GNU ld's only accept -v.
if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
ac_cv_prog_gnu_ld=yes
else
ac_cv_prog_gnu_ld=no
fi])
])
# AC_PROG_NM - find the path to a BSD-compatible name lister
AC_DEFUN(AC_PROG_NM,
[AC_MSG_CHECKING([for BSD-compatible nm])
AC_CACHE_VAL(ac_cv_path_NM,
[if test -n "$NM"; then
# Let the user override the test.
ac_cv_path_NM="$NM"
else
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do
test -z "$ac_dir" && ac_dir=.
if test -f $ac_dir/nm || test -f $ac_dir/nm$ac_exeext ; then
# Check to see if the nm accepts a BSD-compat flag.
# Adding the `sed 1q' prevents false positives on HP-UX, which says:
# nm: unknown option "B" ignored
if ($ac_dir/nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
ac_cv_path_NM="$ac_dir/nm -B"
break
elif ($ac_dir/nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
ac_cv_path_NM="$ac_dir/nm -p"
break
else
ac_cv_path_NM=${ac_cv_path_NM="$ac_dir/nm"} # keep the first match, but
continue # so that we can try to find one that supports BSD flags
fi
fi
done
IFS="$ac_save_ifs"
test -z "$ac_cv_path_NM" && ac_cv_path_NM=nm
fi])
NM="$ac_cv_path_NM"
AC_MSG_RESULT([$NM])
])
# AC_CHECK_LIBM - check for math library
AC_DEFUN(AC_CHECK_LIBM,
[AC_REQUIRE([AC_CANONICAL_HOST])dnl
LIBM=
case "$lt_target" in
*-*-beos* | *-*-cygwin*)
# These system don't have libm
;;
*-ncr-sysv4.3*)
AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw")
AC_CHECK_LIB(m, main, LIBM="$LIBM -lm")
;;
*)
AC_CHECK_LIB(m, main, LIBM="-lm")
;;
esac
])
# AC_LIBLTDL_CONVENIENCE[(dir)] - sets LIBLTDL to the link flags for
# the libltdl convenience library, adds --enable-ltdl-convenience to
# the configure arguments. Note that LIBLTDL is not AC_SUBSTed, nor
# is AC_CONFIG_SUBDIRS called. If DIR is not provided, it is assumed
# to be `${top_builddir}/libltdl'. Make sure you start DIR with
# '${top_builddir}/' (note the single quotes!) if your package is not
# flat, and, if you're not using automake, define top_builddir as
# appropriate in the Makefiles.
AC_DEFUN(AC_LIBLTDL_CONVENIENCE, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
case "$enable_ltdl_convenience" in
no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;;
"") enable_ltdl_convenience=yes
ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;;
esac
LIBLTDL=ifelse($#,1,$1,['${top_builddir}/libltdl'])/libltdlc.la
INCLTDL=ifelse($#,1,-I$1,['-I${top_builddir}/libltdl'])
])
# AC_LIBLTDL_INSTALLABLE[(dir)] - sets LIBLTDL to the link flags for
# the libltdl installable library, and adds --enable-ltdl-install to
# the configure arguments. Note that LIBLTDL is not AC_SUBSTed, nor
# is AC_CONFIG_SUBDIRS called. If DIR is not provided, it is assumed
# to be `${top_builddir}/libltdl'. Make sure you start DIR with
# '${top_builddir}/' (note the single quotes!) if your package is not
# flat, and, if you're not using automake, define top_builddir as
# appropriate in the Makefiles.
# In the future, this macro may have to be called after AC_PROG_LIBTOOL.
AC_DEFUN(AC_LIBLTDL_INSTALLABLE, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
AC_CHECK_LIB(ltdl, main,
[test x"$enable_ltdl_install" != xyes && enable_ltdl_install=no],
[if test x"$enable_ltdl_install" = xno; then
AC_MSG_WARN([libltdl not installed, but installation disabled])
else
enable_ltdl_install=yes
fi
])
if test x"$enable_ltdl_install" = x"yes"; then
ac_configure_args="$ac_configure_args --enable-ltdl-install"
LIBLTDL=ifelse($#,1,$1,['${top_builddir}/libltdl'])/libltdl.la
INCLTDL=ifelse($#,1,-I$1,['-I${top_builddir}/libltdl'])
else
ac_configure_args="$ac_configure_args --enable-ltdl-install=no"
LIBLTDL="-lltdl"
INCLTDL=
fi
])
dnl old names
AC_DEFUN(AM_PROG_LIBTOOL, [indir([AC_PROG_LIBTOOL])])dnl
AC_DEFUN(AM_ENABLE_SHARED, [indir([AC_ENABLE_SHARED], $@)])dnl
AC_DEFUN(AM_ENABLE_STATIC, [indir([AC_ENABLE_STATIC], $@)])dnl
AC_DEFUN(AM_DISABLE_SHARED, [indir([AC_DISABLE_SHARED], $@)])dnl
AC_DEFUN(AM_DISABLE_STATIC, [indir([AC_DISABLE_STATIC], $@)])dnl
AC_DEFUN(AM_PROG_LD, [indir([AC_PROG_LD])])dnl
AC_DEFUN(AM_PROG_NM, [indir([AC_PROG_NM])])dnl
dnl This is just to silence aclocal about the macro not being used
ifelse([AC_DISABLE_FAST_INSTALL])dnl

View File

@ -0,0 +1,177 @@
# ===========================================================================
# https://www.gnu.org/software/autoconf-archive/ax_compare_version.html
# ===========================================================================
#
# SYNOPSIS
#
# AX_COMPARE_VERSION(VERSION_A, OP, VERSION_B, [ACTION-IF-TRUE], [ACTION-IF-FALSE])
#
# DESCRIPTION
#
# This macro compares two version strings. Due to the various number of
# minor-version numbers that can exist, and the fact that string
# comparisons are not compatible with numeric comparisons, this is not
# necessarily trivial to do in a autoconf script. This macro makes doing
# these comparisons easy.
#
# The six basic comparisons are available, as well as checking equality
# limited to a certain number of minor-version levels.
#
# The operator OP determines what type of comparison to do, and can be one
# of:
#
# eq - equal (test A == B)
# ne - not equal (test A != B)
# le - less than or equal (test A <= B)
# ge - greater than or equal (test A >= B)
# lt - less than (test A < B)
# gt - greater than (test A > B)
#
# Additionally, the eq and ne operator can have a number after it to limit
# the test to that number of minor versions.
#
# eq0 - equal up to the length of the shorter version
# ne0 - not equal up to the length of the shorter version
# eqN - equal up to N sub-version levels
# neN - not equal up to N sub-version levels
#
# When the condition is true, shell commands ACTION-IF-TRUE are run,
# otherwise shell commands ACTION-IF-FALSE are run. The environment
# variable 'ax_compare_version' is always set to either 'true' or 'false'
# as well.
#
# Examples:
#
# AX_COMPARE_VERSION([3.15.7],[lt],[3.15.8])
# AX_COMPARE_VERSION([3.15],[lt],[3.15.8])
#
# would both be true.
#
# AX_COMPARE_VERSION([3.15.7],[eq],[3.15.8])
# AX_COMPARE_VERSION([3.15],[gt],[3.15.8])
#
# would both be false.
#
# AX_COMPARE_VERSION([3.15.7],[eq2],[3.15.8])
#
# would be true because it is only comparing two minor versions.
#
# AX_COMPARE_VERSION([3.15.7],[eq0],[3.15])
#
# would be true because it is only comparing the lesser number of minor
# versions of the two values.
#
# Note: The characters that separate the version numbers do not matter. An
# empty string is the same as version 0. OP is evaluated by autoconf, not
# configure, so must be a string, not a variable.
#
# The author would like to acknowledge Guido Draheim whose advice about
# the m4_case and m4_ifvaln functions make this macro only include the
# portions necessary to perform the specific comparison specified by the
# OP argument in the final configure script.
#
# LICENSE
#
# Copyright (c) 2008 Tim Toolan <toolan@ele.uri.edu>
#
# Copying and distribution of this file, with or without modification, are
# permitted in any medium without royalty provided the copyright notice
# and this notice are preserved. This file is offered as-is, without any
# warranty.
#serial 13
dnl #########################################################################
AC_DEFUN([AX_COMPARE_VERSION], [
AC_REQUIRE([AC_PROG_AWK])
# Used to indicate true or false condition
ax_compare_version=false
# Convert the two version strings to be compared into a format that
# allows a simple string comparison. The end result is that a version
# string of the form 1.12.5-r617 will be converted to the form
# 0001001200050617. In other words, each number is zero padded to four
# digits, and non digits are removed.
AS_VAR_PUSHDEF([A],[ax_compare_version_A])
A=`echo "$1" | sed -e 's/\([[0-9]]*\)/Z\1Z/g' \
-e 's/Z\([[0-9]]\)Z/Z0\1Z/g' \
-e 's/Z\([[0-9]][[0-9]]\)Z/Z0\1Z/g' \
-e 's/Z\([[0-9]][[0-9]][[0-9]]\)Z/Z0\1Z/g' \
-e 's/[[^0-9]]//g'`
AS_VAR_PUSHDEF([B],[ax_compare_version_B])
B=`echo "$3" | sed -e 's/\([[0-9]]*\)/Z\1Z/g' \
-e 's/Z\([[0-9]]\)Z/Z0\1Z/g' \
-e 's/Z\([[0-9]][[0-9]]\)Z/Z0\1Z/g' \
-e 's/Z\([[0-9]][[0-9]][[0-9]]\)Z/Z0\1Z/g' \
-e 's/[[^0-9]]//g'`
dnl # In the case of le, ge, lt, and gt, the strings are sorted as necessary
dnl # then the first line is used to determine if the condition is true.
dnl # The sed right after the echo is to remove any indented white space.
m4_case(m4_tolower($2),
[lt],[
ax_compare_version=`echo "x$A
x$B" | sed 's/^ *//' | sort -r | sed "s/x${A}/false/;s/x${B}/true/;1q"`
],
[gt],[
ax_compare_version=`echo "x$A
x$B" | sed 's/^ *//' | sort | sed "s/x${A}/false/;s/x${B}/true/;1q"`
],
[le],[
ax_compare_version=`echo "x$A
x$B" | sed 's/^ *//' | sort | sed "s/x${A}/true/;s/x${B}/false/;1q"`
],
[ge],[
ax_compare_version=`echo "x$A
x$B" | sed 's/^ *//' | sort -r | sed "s/x${A}/true/;s/x${B}/false/;1q"`
],[
dnl Split the operator from the subversion count if present.
m4_bmatch(m4_substr($2,2),
[0],[
# A count of zero means use the length of the shorter version.
# Determine the number of characters in A and B.
ax_compare_version_len_A=`echo "$A" | $AWK '{print(length)}'`
ax_compare_version_len_B=`echo "$B" | $AWK '{print(length)}'`
# Set A to no more than B's length and B to no more than A's length.
A=`echo "$A" | sed "s/\(.\{$ax_compare_version_len_B\}\).*/\1/"`
B=`echo "$B" | sed "s/\(.\{$ax_compare_version_len_A\}\).*/\1/"`
],
[[0-9]+],[
# A count greater than zero means use only that many subversions
A=`echo "$A" | sed "s/\(\([[0-9]]\{4\}\)\{m4_substr($2,2)\}\).*/\1/"`
B=`echo "$B" | sed "s/\(\([[0-9]]\{4\}\)\{m4_substr($2,2)\}\).*/\1/"`
],
[.+],[
AC_WARNING(
[invalid OP numeric parameter: $2])
],[])
# Pad zeros at end of numbers to make same length.
ax_compare_version_tmp_A="$A`echo $B | sed 's/./0/g'`"
B="$B`echo $A | sed 's/./0/g'`"
A="$ax_compare_version_tmp_A"
# Check for equality or inequality as necessary.
m4_case(m4_tolower(m4_substr($2,0,2)),
[eq],[
test "x$A" = "x$B" && ax_compare_version=true
],
[ne],[
test "x$A" != "x$B" && ax_compare_version=true
],[
AC_WARNING([invalid OP parameter: $2])
])
])
AS_VAR_POPDEF([A])dnl
AS_VAR_POPDEF([B])dnl
dnl # Execute ACTION-IF-TRUE / ACTION-IF-FALSE.
if test "$ax_compare_version" = "true" ; then
m4_ifvaln([$4],[$4],[:])dnl
m4_ifvaln([$5],[else $5])dnl
fi
]) dnl AX_COMPARE_VERSION

View File

@ -0,0 +1,66 @@
# ===========================================================================
# https://www.gnu.org/software/autoconf-archive/ax_prog_python_version.html
# ===========================================================================
#
# SYNOPSIS
#
# AX_PROG_PYTHON_VERSION([VERSION],[ACTION-IF-TRUE],[ACTION-IF-FALSE])
#
# DESCRIPTION
#
# Makes sure that python supports the version indicated. If true the shell
# commands in ACTION-IF-TRUE are executed. If not the shell commands in
# ACTION-IF-FALSE are run. Note if $PYTHON is not set (for example by
# running AC_CHECK_PROG or AC_PATH_PROG) the macro will fail.
#
# Example:
#
# AC_PATH_PROG([PYTHON],[python])
# AX_PROG_PYTHON_VERSION([2.4.4],[ ... ],[ ... ])
#
# This will check to make sure that the python you have supports at least
# version 2.4.4.
#
# NOTE: This macro uses the $PYTHON variable to perform the check.
# AX_WITH_PYTHON can be used to set that variable prior to running this
# macro. The $PYTHON_VERSION variable will be valorized with the detected
# version.
#
# LICENSE
#
# Copyright (c) 2009 Francesco Salvestrini <salvestrini@users.sourceforge.net>
#
# Copying and distribution of this file, with or without modification, are
# permitted in any medium without royalty provided the copyright notice
# and this notice are preserved. This file is offered as-is, without any
# warranty.
#serial 12
AC_DEFUN([AX_PROG_PYTHON_VERSION],[
AC_REQUIRE([AC_PROG_SED])
AC_REQUIRE([AC_PROG_GREP])
AS_IF([test -n "$PYTHON"],[
ax_python_version="$1"
AC_MSG_CHECKING([for python version])
changequote(<<,>>)
python_version=`$PYTHON -V 2>&1 | $GREP "^Python " | $SED -e 's/^.* \([0-9]*\.[0-9]*\.[0-9]*\)/\1/'`
changequote([,])
AC_MSG_RESULT($python_version)
AC_SUBST([PYTHON_VERSION],[$python_version])
AX_COMPARE_VERSION([$ax_python_version],[le],[$python_version],[
:
$2
],[
:
$3
])
],[
AC_MSG_WARN([could not find the python interpreter])
$3
])
])

522
builds/unix/ax_pthread.m4 Normal file
View File

@ -0,0 +1,522 @@
# ===========================================================================
# https://www.gnu.org/software/autoconf-archive/ax_pthread.html
# ===========================================================================
#
# SYNOPSIS
#
# AX_PTHREAD([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
#
# DESCRIPTION
#
# This macro figures out how to build C programs using POSIX threads. It
# sets the PTHREAD_LIBS output variable to the threads library and linker
# flags, and the PTHREAD_CFLAGS output variable to any special C compiler
# flags that are needed. (The user can also force certain compiler
# flags/libs to be tested by setting these environment variables.)
#
# Also sets PTHREAD_CC and PTHREAD_CXX to any special C compiler that is
# needed for multi-threaded programs (defaults to the value of CC
# respectively CXX otherwise). (This is necessary on e.g. AIX to use the
# special cc_r/CC_r compiler alias.)
#
# NOTE: You are assumed to not only compile your program with these flags,
# but also to link with them as well. For example, you might link with
# $PTHREAD_CC $CFLAGS $PTHREAD_CFLAGS $LDFLAGS ... $PTHREAD_LIBS $LIBS
# $PTHREAD_CXX $CXXFLAGS $PTHREAD_CFLAGS $LDFLAGS ... $PTHREAD_LIBS $LIBS
#
# If you are only building threaded programs, you may wish to use these
# variables in your default LIBS, CFLAGS, and CC:
#
# LIBS="$PTHREAD_LIBS $LIBS"
# CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
# CXXFLAGS="$CXXFLAGS $PTHREAD_CFLAGS"
# CC="$PTHREAD_CC"
# CXX="$PTHREAD_CXX"
#
# In addition, if the PTHREAD_CREATE_JOINABLE thread-attribute constant
# has a nonstandard name, this macro defines PTHREAD_CREATE_JOINABLE to
# that name (e.g. PTHREAD_CREATE_UNDETACHED on AIX).
#
# Also HAVE_PTHREAD_PRIO_INHERIT is defined if pthread is found and the
# PTHREAD_PRIO_INHERIT symbol is defined when compiling with
# PTHREAD_CFLAGS.
#
# ACTION-IF-FOUND is a list of shell commands to run if a threads library
# is found, and ACTION-IF-NOT-FOUND is a list of commands to run it if it
# is not found. If ACTION-IF-FOUND is not specified, the default action
# will define HAVE_PTHREAD.
#
# Please let the authors know if this macro fails on any platform, or if
# you have any other suggestions or comments. This macro was based on work
# by SGJ on autoconf scripts for FFTW (http://www.fftw.org/) (with help
# from M. Frigo), as well as ac_pthread and hb_pthread macros posted by
# Alejandro Forero Cuervo to the autoconf macro repository. We are also
# grateful for the helpful feedback of numerous users.
#
# Updated for Autoconf 2.68 by Daniel Richard G.
#
# LICENSE
#
# Copyright (c) 2008 Steven G. Johnson <stevenj@alum.mit.edu>
# Copyright (c) 2011 Daniel Richard G. <skunk@iSKUNK.ORG>
# Copyright (c) 2019 Marc Stevens <marc.stevens@cwi.nl>
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
# Free Software Foundation, either version 3 of the License, or (at your
# option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
# Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program. If not, see <https://www.gnu.org/licenses/>.
#
# As a special exception, the respective Autoconf Macro's copyright owner
# gives unlimited permission to copy, distribute and modify the configure
# scripts that are the output of Autoconf when processing the Macro. You
# need not follow the terms of the GNU General Public License when using
# or distributing such scripts, even though portions of the text of the
# Macro appear in them. The GNU General Public License (GPL) does govern
# all other use of the material that constitutes the Autoconf Macro.
#
# This special exception to the GPL applies to versions of the Autoconf
# Macro released by the Autoconf Archive. When you make and distribute a
# modified version of the Autoconf Macro, you may extend this special
# exception to the GPL to apply to your modified version as well.
#serial 30
AU_ALIAS([ACX_PTHREAD], [AX_PTHREAD])
AC_DEFUN([AX_PTHREAD], [
AC_REQUIRE([AC_CANONICAL_TARGET])
AC_REQUIRE([AC_PROG_CC])
AC_REQUIRE([AC_PROG_SED])
AC_LANG_PUSH([C])
ax_pthread_ok=no
# We used to check for pthread.h first, but this fails if pthread.h
# requires special compiler flags (e.g. on Tru64 or Sequent).
# It gets checked for in the link test anyway.
# First of all, check if the user has set any of the PTHREAD_LIBS,
# etcetera environment variables, and if threads linking works using
# them:
if test "x$PTHREAD_CFLAGS$PTHREAD_LIBS" != "x"; then
ax_pthread_save_CC="$CC"
ax_pthread_save_CFLAGS="$CFLAGS"
ax_pthread_save_LIBS="$LIBS"
AS_IF([test "x$PTHREAD_CC" != "x"], [CC="$PTHREAD_CC"])
AS_IF([test "x$PTHREAD_CXX" != "x"], [CXX="$PTHREAD_CXX"])
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
LIBS="$PTHREAD_LIBS $LIBS"
AC_MSG_CHECKING([for pthread_join using $CC $PTHREAD_CFLAGS $PTHREAD_LIBS])
AC_LINK_IFELSE([AC_LANG_CALL([], [pthread_join])], [ax_pthread_ok=yes])
AC_MSG_RESULT([$ax_pthread_ok])
if test "x$ax_pthread_ok" = "xno"; then
PTHREAD_LIBS=""
PTHREAD_CFLAGS=""
fi
CC="$ax_pthread_save_CC"
CFLAGS="$ax_pthread_save_CFLAGS"
LIBS="$ax_pthread_save_LIBS"
fi
# We must check for the threads library under a number of different
# names; the ordering is very important because some systems
# (e.g. DEC) have both -lpthread and -lpthreads, where one of the
# libraries is broken (non-POSIX).
# Create a list of thread flags to try. Items with a "," contain both
# C compiler flags (before ",") and linker flags (after ","). Other items
# starting with a "-" are C compiler flags, and remaining items are
# library names, except for "none" which indicates that we try without
# any flags at all, and "pthread-config" which is a program returning
# the flags for the Pth emulation library.
ax_pthread_flags="pthreads none -Kthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config"
# The ordering *is* (sometimes) important. Some notes on the
# individual items follow:
# pthreads: AIX (must check this before -lpthread)
# none: in case threads are in libc; should be tried before -Kthread and
# other compiler flags to prevent continual compiler warnings
# -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h)
# -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads), Tru64
# (Note: HP C rejects this with "bad form for `-t' option")
# -pthreads: Solaris/gcc (Note: HP C also rejects)
# -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it
# doesn't hurt to check since this sometimes defines pthreads and
# -D_REENTRANT too), HP C (must be checked before -lpthread, which
# is present but should not be used directly; and before -mthreads,
# because the compiler interprets this as "-mt" + "-hreads")
# -mthreads: Mingw32/gcc, Lynx/gcc
# pthread: Linux, etcetera
# --thread-safe: KAI C++
# pthread-config: use pthread-config program (for GNU Pth library)
case $target_os in
freebsd*)
# -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able)
# lthread: LinuxThreads port on FreeBSD (also preferred to -pthread)
ax_pthread_flags="-kthread lthread $ax_pthread_flags"
;;
hpux*)
# From the cc(1) man page: "[-mt] Sets various -D flags to enable
# multi-threading and also sets -lpthread."
ax_pthread_flags="-mt -pthread pthread $ax_pthread_flags"
;;
openedition*)
# IBM z/OS requires a feature-test macro to be defined in order to
# enable POSIX threads at all, so give the user a hint if this is
# not set. (We don't define these ourselves, as they can affect
# other portions of the system API in unpredictable ways.)
AC_EGREP_CPP([AX_PTHREAD_ZOS_MISSING],
[
# if !defined(_OPEN_THREADS) && !defined(_UNIX03_THREADS)
AX_PTHREAD_ZOS_MISSING
# endif
],
[AC_MSG_WARN([IBM z/OS requires -D_OPEN_THREADS or -D_UNIX03_THREADS to enable pthreads support.])])
;;
solaris*)
# On Solaris (at least, for some versions), libc contains stubbed
# (non-functional) versions of the pthreads routines, so link-based
# tests will erroneously succeed. (N.B.: The stubs are missing
# pthread_cleanup_push, or rather a function called by this macro,
# so we could check for that, but who knows whether they'll stub
# that too in a future libc.) So we'll check first for the
# standard Solaris way of linking pthreads (-mt -lpthread).
ax_pthread_flags="-mt,-lpthread pthread $ax_pthread_flags"
;;
esac
# Are we compiling with Clang?
AC_CACHE_CHECK([whether $CC is Clang],
[ax_cv_PTHREAD_CLANG],
[ax_cv_PTHREAD_CLANG=no
# Note that Autoconf sets GCC=yes for Clang as well as GCC
if test "x$GCC" = "xyes"; then
AC_EGREP_CPP([AX_PTHREAD_CC_IS_CLANG],
[/* Note: Clang 2.7 lacks __clang_[a-z]+__ */
# if defined(__clang__) && defined(__llvm__)
AX_PTHREAD_CC_IS_CLANG
# endif
],
[ax_cv_PTHREAD_CLANG=yes])
fi
])
ax_pthread_clang="$ax_cv_PTHREAD_CLANG"
# GCC generally uses -pthread, or -pthreads on some platforms (e.g. SPARC)
# Note that for GCC and Clang -pthread generally implies -lpthread,
# except when -nostdlib is passed.
# This is problematic using libtool to build C++ shared libraries with pthread:
# [1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=25460
# [2] https://bugzilla.redhat.com/show_bug.cgi?id=661333
# [3] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=468555
# To solve this, first try -pthread together with -lpthread for GCC
AS_IF([test "x$GCC" = "xyes"],
[ax_pthread_flags="-pthread,-lpthread -pthread -pthreads $ax_pthread_flags"])
# Clang takes -pthread (never supported any other flag), but we'll try with -lpthread first
AS_IF([test "x$ax_pthread_clang" = "xyes"],
[ax_pthread_flags="-pthread,-lpthread -pthread"])
# The presence of a feature test macro requesting re-entrant function
# definitions is, on some systems, a strong hint that pthreads support is
# correctly enabled
case $target_os in
darwin* | hpux* | linux* | osf* | solaris*)
ax_pthread_check_macro="_REENTRANT"
;;
aix*)
ax_pthread_check_macro="_THREAD_SAFE"
;;
*)
ax_pthread_check_macro="--"
;;
esac
AS_IF([test "x$ax_pthread_check_macro" = "x--"],
[ax_pthread_check_cond=0],
[ax_pthread_check_cond="!defined($ax_pthread_check_macro)"])
if test "x$ax_pthread_ok" = "xno"; then
for ax_pthread_try_flag in $ax_pthread_flags; do
case $ax_pthread_try_flag in
none)
AC_MSG_CHECKING([whether pthreads work without any flags])
;;
*,*)
PTHREAD_CFLAGS=`echo $ax_pthread_try_flag | sed "s/^\(.*\),\(.*\)$/\1/"`
PTHREAD_LIBS=`echo $ax_pthread_try_flag | sed "s/^\(.*\),\(.*\)$/\2/"`
AC_MSG_CHECKING([whether pthreads work with "$PTHREAD_CFLAGS" and "$PTHREAD_LIBS"])
;;
-*)
AC_MSG_CHECKING([whether pthreads work with $ax_pthread_try_flag])
PTHREAD_CFLAGS="$ax_pthread_try_flag"
;;
pthread-config)
AC_CHECK_PROG([ax_pthread_config], [pthread-config], [yes], [no])
AS_IF([test "x$ax_pthread_config" = "xno"], [continue])
PTHREAD_CFLAGS="`pthread-config --cflags`"
PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`"
;;
*)
AC_MSG_CHECKING([for the pthreads library -l$ax_pthread_try_flag])
PTHREAD_LIBS="-l$ax_pthread_try_flag"
;;
esac
ax_pthread_save_CFLAGS="$CFLAGS"
ax_pthread_save_LIBS="$LIBS"
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
LIBS="$PTHREAD_LIBS $LIBS"
# Check for various functions. We must include pthread.h,
# since some functions may be macros. (On the Sequent, we
# need a special flag -Kthread to make this header compile.)
# We check for pthread_join because it is in -lpthread on IRIX
# while pthread_create is in libc. We check for pthread_attr_init
# due to DEC craziness with -lpthreads. We check for
# pthread_cleanup_push because it is one of the few pthread
# functions on Solaris that doesn't have a non-functional libc stub.
# We try pthread_create on general principles.
AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <pthread.h>
# if $ax_pthread_check_cond
# error "$ax_pthread_check_macro must be defined"
# endif
static void *some_global = NULL;
static void routine(void *a)
{
/* To avoid any unused-parameter or
unused-but-set-parameter warning. */
some_global = a;
}
static void *start_routine(void *a) { return a; }],
[pthread_t th; pthread_attr_t attr;
pthread_create(&th, 0, start_routine, 0);
pthread_join(th, 0);
pthread_attr_init(&attr);
pthread_cleanup_push(routine, 0);
pthread_cleanup_pop(0) /* ; */])],
[ax_pthread_ok=yes],
[])
CFLAGS="$ax_pthread_save_CFLAGS"
LIBS="$ax_pthread_save_LIBS"
AC_MSG_RESULT([$ax_pthread_ok])
AS_IF([test "x$ax_pthread_ok" = "xyes"], [break])
PTHREAD_LIBS=""
PTHREAD_CFLAGS=""
done
fi
# Clang needs special handling, because older versions handle the -pthread
# option in a rather... idiosyncratic way
if test "x$ax_pthread_clang" = "xyes"; then
# Clang takes -pthread; it has never supported any other flag
# (Note 1: This will need to be revisited if a system that Clang
# supports has POSIX threads in a separate library. This tends not
# to be the way of modern systems, but it's conceivable.)
# (Note 2: On some systems, notably Darwin, -pthread is not needed
# to get POSIX threads support; the API is always present and
# active. We could reasonably leave PTHREAD_CFLAGS empty. But
# -pthread does define _REENTRANT, and while the Darwin headers
# ignore this macro, third-party headers might not.)
# However, older versions of Clang make a point of warning the user
# that, in an invocation where only linking and no compilation is
# taking place, the -pthread option has no effect ("argument unused
# during compilation"). They expect -pthread to be passed in only
# when source code is being compiled.
#
# Problem is, this is at odds with the way Automake and most other
# C build frameworks function, which is that the same flags used in
# compilation (CFLAGS) are also used in linking. Many systems
# supported by AX_PTHREAD require exactly this for POSIX threads
# support, and in fact it is often not straightforward to specify a
# flag that is used only in the compilation phase and not in
# linking. Such a scenario is extremely rare in practice.
#
# Even though use of the -pthread flag in linking would only print
# a warning, this can be a nuisance for well-run software projects
# that build with -Werror. So if the active version of Clang has
# this misfeature, we search for an option to squash it.
AC_CACHE_CHECK([whether Clang needs flag to prevent "argument unused" warning when linking with -pthread],
[ax_cv_PTHREAD_CLANG_NO_WARN_FLAG],
[ax_cv_PTHREAD_CLANG_NO_WARN_FLAG=unknown
# Create an alternate version of $ac_link that compiles and
# links in two steps (.c -> .o, .o -> exe) instead of one
# (.c -> exe), because the warning occurs only in the second
# step
ax_pthread_save_ac_link="$ac_link"
ax_pthread_sed='s/conftest\.\$ac_ext/conftest.$ac_objext/g'
ax_pthread_link_step=`AS_ECHO(["$ac_link"]) | sed "$ax_pthread_sed"`
ax_pthread_2step_ac_link="($ac_compile) && (echo ==== >&5) && ($ax_pthread_link_step)"
ax_pthread_save_CFLAGS="$CFLAGS"
for ax_pthread_try in '' -Qunused-arguments -Wno-unused-command-line-argument unknown; do
AS_IF([test "x$ax_pthread_try" = "xunknown"], [break])
CFLAGS="-Werror -Wunknown-warning-option $ax_pthread_try -pthread $ax_pthread_save_CFLAGS"
ac_link="$ax_pthread_save_ac_link"
AC_LINK_IFELSE([AC_LANG_SOURCE([[int main(void){return 0;}]])],
[ac_link="$ax_pthread_2step_ac_link"
AC_LINK_IFELSE([AC_LANG_SOURCE([[int main(void){return 0;}]])],
[break])
])
done
ac_link="$ax_pthread_save_ac_link"
CFLAGS="$ax_pthread_save_CFLAGS"
AS_IF([test "x$ax_pthread_try" = "x"], [ax_pthread_try=no])
ax_cv_PTHREAD_CLANG_NO_WARN_FLAG="$ax_pthread_try"
])
case "$ax_cv_PTHREAD_CLANG_NO_WARN_FLAG" in
no | unknown) ;;
*) PTHREAD_CFLAGS="$ax_cv_PTHREAD_CLANG_NO_WARN_FLAG $PTHREAD_CFLAGS" ;;
esac
fi # $ax_pthread_clang = yes
# Various other checks:
if test "x$ax_pthread_ok" = "xyes"; then
ax_pthread_save_CFLAGS="$CFLAGS"
ax_pthread_save_LIBS="$LIBS"
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
LIBS="$PTHREAD_LIBS $LIBS"
# Detect AIX lossage: JOINABLE attribute is called UNDETACHED.
AC_CACHE_CHECK([for joinable pthread attribute],
[ax_cv_PTHREAD_JOINABLE_ATTR],
[ax_cv_PTHREAD_JOINABLE_ATTR=unknown
for ax_pthread_attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do
AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <pthread.h>],
[int attr = $ax_pthread_attr; return attr /* ; */])],
[ax_cv_PTHREAD_JOINABLE_ATTR=$ax_pthread_attr; break],
[])
done
])
AS_IF([test "x$ax_cv_PTHREAD_JOINABLE_ATTR" != "xunknown" && \
test "x$ax_cv_PTHREAD_JOINABLE_ATTR" != "xPTHREAD_CREATE_JOINABLE" && \
test "x$ax_pthread_joinable_attr_defined" != "xyes"],
[AC_DEFINE_UNQUOTED([PTHREAD_CREATE_JOINABLE],
[$ax_cv_PTHREAD_JOINABLE_ATTR],
[Define to necessary symbol if this constant
uses a non-standard name on your system.])
ax_pthread_joinable_attr_defined=yes
])
AC_CACHE_CHECK([whether more special flags are required for pthreads],
[ax_cv_PTHREAD_SPECIAL_FLAGS],
[ax_cv_PTHREAD_SPECIAL_FLAGS=no
case $target_os in
solaris*)
ax_cv_PTHREAD_SPECIAL_FLAGS="-D_POSIX_PTHREAD_SEMANTICS"
;;
esac
])
AS_IF([test "x$ax_cv_PTHREAD_SPECIAL_FLAGS" != "xno" && \
test "x$ax_pthread_special_flags_added" != "xyes"],
[PTHREAD_CFLAGS="$ax_cv_PTHREAD_SPECIAL_FLAGS $PTHREAD_CFLAGS"
ax_pthread_special_flags_added=yes])
AC_CACHE_CHECK([for PTHREAD_PRIO_INHERIT],
[ax_cv_PTHREAD_PRIO_INHERIT],
[AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <pthread.h>]],
[[int i = PTHREAD_PRIO_INHERIT;
return i;]])],
[ax_cv_PTHREAD_PRIO_INHERIT=yes],
[ax_cv_PTHREAD_PRIO_INHERIT=no])
])
AS_IF([test "x$ax_cv_PTHREAD_PRIO_INHERIT" = "xyes" && \
test "x$ax_pthread_prio_inherit_defined" != "xyes"],
[AC_DEFINE([HAVE_PTHREAD_PRIO_INHERIT], [1], [Have PTHREAD_PRIO_INHERIT.])
ax_pthread_prio_inherit_defined=yes
])
CFLAGS="$ax_pthread_save_CFLAGS"
LIBS="$ax_pthread_save_LIBS"
# More AIX lossage: compile with *_r variant
if test "x$GCC" != "xyes"; then
case $target_os in
aix*)
AS_CASE(["x/$CC"],
[x*/c89|x*/c89_128|x*/c99|x*/c99_128|x*/cc|x*/cc128|x*/xlc|x*/xlc_v6|x*/xlc128|x*/xlc128_v6],
[#handle absolute path differently from PATH based program lookup
AS_CASE(["x$CC"],
[x/*],
[
AS_IF([AS_EXECUTABLE_P([${CC}_r])],[PTHREAD_CC="${CC}_r"])
AS_IF([test "x${CXX}" != "x"], [AS_IF([AS_EXECUTABLE_P([${CXX}_r])],[PTHREAD_CXX="${CXX}_r"])])
],
[
AC_CHECK_PROGS([PTHREAD_CC],[${CC}_r],[$CC])
AS_IF([test "x${CXX}" != "x"], [AC_CHECK_PROGS([PTHREAD_CXX],[${CXX}_r],[$CXX])])
]
)
])
;;
esac
fi
fi
test -n "$PTHREAD_CC" || PTHREAD_CC="$CC"
test -n "$PTHREAD_CXX" || PTHREAD_CXX="$CXX"
AC_SUBST([PTHREAD_LIBS])
AC_SUBST([PTHREAD_CFLAGS])
AC_SUBST([PTHREAD_CC])
AC_SUBST([PTHREAD_CXX])
# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
if test "x$ax_pthread_ok" = "xyes"; then
ifelse([$1],,[AC_DEFINE([HAVE_PTHREAD],[1],[Define if you have POSIX threads libraries and header files.])],[$1])
:
else
ax_pthread_ok=no
$2
fi
AC_LANG_POP
])dnl AX_PTHREAD

1273
builds/unix/config.guess vendored

File diff suppressed because it is too large Load Diff

1319
builds/unix/config.sub vendored

File diff suppressed because it is too large Load Diff

2514
builds/unix/configure vendored

File diff suppressed because it is too large Load Diff

View File

@ -1,74 +0,0 @@
dnl This file is part of the FreeType project.
dnl
dnl Process this file with autoconf to produce a configure script.
dnl
AC_INIT(ftconfig.in)
dnl Configuration file -- stay in 8.3 limit
AC_CONFIG_HEADER(ftconfig.h:ftconfig.in)
version_info='6:0:0'
AC_SUBST(version_info)
dnl checks for system type
AC_CANONICAL_SYSTEM
dnl checks for programs
AC_PROG_CC
AC_PROG_CPP
dnl get Compiler flags right.
if test "x$CC" = xgcc; then
XX_CFLAGS="-Wall"
XX_ANSIFLAGS="-pedantic -ansi"
else
case "$host" in
*-dec-osf*)
XX_CFLAGS="-std1 -O2 -g3"
XX_ANSIFLAGS=
;;
*)
XX_CFLAGS=
XX_ANSIFLAGS=
;;
esac
fi
AC_SUBST(XX_CFLAGS)
AC_SUBST(XX_ANSIFLAGS)
AC_CHECK_PROG(RMF, rm, rm -f)
AC_CHECK_PROG(RMDIR, rmdir, rmdir)
AC_PROG_INSTALL
dnl checks for header files
AC_HEADER_STDC
AC_CHECK_HEADERS(fcntl.h unistd.h)
dnl checks for typedefs, structures, and compiler characteristics
AC_C_CONST
AC_CHECK_SIZEOF(int)
AC_CHECK_SIZEOF(long)
dnl Checks for library functions.
dnl Here we check whether we can use our mmap file component.
AC_FUNC_MMAP
if test "$ac_cv_func_mmap_fixed_mapped" != yes; then
FTSYS_SRC='$(BASE_)ftsystem.c'
else
FTSYS_SRC='$(BUILD)/ftsystem.c'
fi
AC_SUBST(FTSYS_SRC)
AC_CHECK_FUNCS(memcpy memmove)
AM_PROG_LIBTOOL
dnl create the Unix-specific sub-Makefile `builds/unix/unix.mk' that will be
dnl used by the build system
dnl
AC_OUTPUT(unix.mk:unix.in)
dnl end of configure.in

1179
builds/unix/configure.raw Normal file

File diff suppressed because it is too large Load Diff

View File

@ -3,7 +3,7 @@
#
# Copyright 1996-2000 by
# Copyright (C) 1996-2024 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,
@ -12,48 +12,88 @@
# indicate that you have read the license and understand and accept it
# fully.
.PHONY: setup
ifeq ($(PLATFORM),ansi)
has_init := $(strip $(wildcard /sbin/init))
ifneq ($(has_init),)
# Note: this test is duplicated in "builds/toplevel.mk".
#
is_unix := $(strip $(wildcard /sbin/init) \
$(wildcard /usr/sbin/init) \
$(wildcard /dev/null) \
$(wildcard /hurd/auth))
ifneq ($(is_unix),)
PLATFORM := unix
COPY := cp
DELETE := rm -f
# If a Unix platform is detected, the configure script is called and
# `unix.mk' is created.
#
# Arguments to `configure' should be in the CFG variable. Example:
#
# make CFG="--prefix=/usr --disable-static"
#
# If you need to set CFLAGS or LDFLAGS, do it here also.
#
# Feel free to add support for other platform specific compilers in this
# directory (e.g. solaris.mk + changes here to detect the platform).
#
CONFIG_FILE := unix.mk
setup: unix.mk
unix: setup
endif # test is_unix
endif # test PLATFORM ansi
# If `devel' is the requested target, use `-g -O0' as the default value
# for CFLAGS if CFLAGS isn't set.
ifeq ($(PLATFORM),unix)
COPY := cp
DELETE := rm -f
CAT := cat
# If `devel' is the requested target, we use a special configuration
# file named `unix-dev.mk'. It disables optimization and libtool.
#
ifneq ($(findstring devel,$(MAKECMDGOALS)),)
CONFIG_FILE := unix-dev.mk
CC := gcc
.PHONY: devel
devel: setup
@:
else
# If `lcc' is the requested target, we use a special configuration
# file named `unix-lcc.mk'. It disables libtool for LCC.
#
ifneq ($(findstring devel,$(MAKECMDGOALS)),)
ifndef CFLAGS
USE_CFLAGS := CFLAGS="-g -O0"
endif
devel: setup
ifneq ($(findstring lcc,$(MAKECMDGOALS)),)
CONFIG_FILE := unix-lcc.mk
CC := lcc
.PHONY: lcc
lcc: setup
@:
else
# If a Unix platform is detected, the configure script is called and
# `unix-def.mk' together with `unix-cc.mk' is created.
#
# Arguments to `configure' should be in the CFG variable. Example:
#
# make CFG="--prefix=/usr --disable-static"
#
# If you need to set CFLAGS or LDFLAGS, do it here also.
#
# Feel free to add support for other platform specific compilers in
# this directory (e.g. solaris.mk + changes here to detect the
# platform).
#
CONFIG_FILE := unix.mk
must_configure := 1
.PHONY: unix
unix: setup
@:
endif
endif
setup: std_setup
have_Makefile := $(wildcard $(OBJ_DIR)/Makefile)
unix.mk: builds/unix/unix.in
cd builds/unix; $(USE_CFLAGS) ./configure $(CFG)
setup: std_setup
ifdef must_configure
ifneq ($(have_Makefile),)
# we are building FT2 not in the src tree
$(TOP_DIR)/builds/unix/configure $(value CFG)
else
cd builds/unix; \
./configure $(value CFG)
endif
endif
endif # test PLATFORM unix
endif # test Unix
endif # test PLATFORM
# EOF

View File

@ -0,0 +1,211 @@
#! /bin/sh
#
# Copyright (C) 2000-2024 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,
# and distributed under the terms of the FreeType project license,
# LICENSE.TXT. By continuing to use, modify, or distribute this file you
# indicate that you have read the license and understand and accept it
# fully.
LC_ALL=C
export LC_ALL
# if `pkg-config' is available, use values from `freetype2.pc'
%PKG_CONFIG% --atleast-pkgconfig-version 0.24 >/dev/null 2>&1
if test $? -eq 0 ; then
# note that option `--variable' is not affected by the
# PKG_CONFIG_SYSROOT_DIR environment variable
if test "x$SYSROOT" != "x" ; then
PKG_CONFIG_SYSROOT_DIR="$SYSROOT"
export PKG_CONFIG_SYSROOT_DIR
fi
prefix=`%PKG_CONFIG% --variable prefix freetype2`
exec_prefix=`%PKG_CONFIG% --variable exec_prefix freetype2`
includedir=`%PKG_CONFIG% --variable includedir freetype2`
libdir=`%PKG_CONFIG% --variable libdir freetype2`
version=`%PKG_CONFIG% --modversion freetype2`
cflags=`%PKG_CONFIG% --cflags freetype2`
dynamic_libs=`%PKG_CONFIG% --libs freetype2`
static_libs=`%PKG_CONFIG% --static --libs freetype2`
else
prefix="%prefix%"
exec_prefix="%exec_prefix%"
includedir="%includedir%"
libdir="%libdir%"
version=%ft_version%
cflags="-I${SYSROOT}$includedir/freetype2"
dynamic_libs="-lfreetype"
static_libs="%LIBSSTATIC_CONFIG%"
if test "${SYSROOT}$libdir" != "/usr/lib" &&
test "${SYSROOT}$libdir" != "/usr/lib64" ; then
libs_L="-L${SYSROOT}$libdir"
fi
fi
orig_prefix=$prefix
orig_exec_prefix=$exec_prefix
orig_includedir=$includedir
orig_libdir=$libdir
include_suffix=`echo $includedir | sed "s|$prefix||"`
lib_suffix=`echo $libdir | sed "s|$exec_prefix||"`
usage()
{
cat <<EOF
Usage: freetype-config [OPTION]...
Get FreeType compilation and linking information.
Options:
--prefix display \`--prefix' value used for building the
FreeType library
--prefix=PREFIX override \`--prefix' value with PREFIX
--exec-prefix display \`--exec-prefix' value used for building
the FreeType library
--exec-prefix=EPREFIX override \`--exec-prefix' value with EPREFIX
--version display libtool version of the FreeType library
--ftversion display FreeType version number
--libs display flags for linking with the FreeType library
--libtool display library name for linking with libtool
--cflags display flags for compiling with the FreeType
library
--static make command line options display flags
for static linking
--help display this help and exit
EOF
exit $1
}
if test $# -eq 0 ; then
usage 1 1>&2
fi
while test $# -gt 0 ; do
case "$1" in
-*=*)
optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'`
;;
*)
optarg=
;;
esac
case $1 in
--prefix=*)
prefix=$optarg
local_prefix=yes
;;
--prefix)
echo_prefix=yes
;;
--exec-prefix=*)
exec_prefix=$optarg
exec_prefix_set=yes
local_prefix=yes
;;
--exec-prefix)
echo_exec_prefix=yes
;;
--version)
echo_version=yes
break
;;
--ftversion)
echo_ft_version=yes
;;
--cflags)
echo_cflags=yes
;;
--libs)
echo_libs=yes
;;
--libtool)
echo_libtool=yes
;;
--static)
show_static=yes
;;
--help)
usage 0
;;
*)
usage 1 1>&2
;;
esac
shift
done
if test "$local_prefix" = "yes" ; then
if test "$exec_prefix_set" != "yes" ; then
exec_prefix=$prefix
fi
fi
if test "$local_prefix" = "yes" ; then
includedir=${prefix}${include_suffix}
if test "$exec_prefix_set" = "yes" ; then
libdir=${exec_prefix}${lib_suffix}
else
libdir=${prefix}${lib_suffix}
fi
fi
if test "$echo_version" = "yes" ; then
echo $version
fi
if test "$echo_prefix" = "yes" ; then
echo ${SYSROOT}$prefix
fi
if test "$echo_exec_prefix" = "yes" ; then
echo ${SYSROOT}$exec_prefix
fi
if test "$echo_ft_version" = "yes" ; then
major=`grep define ${SYSROOT}$includedir/freetype2/freetype/freetype.h \
| grep FREETYPE_MAJOR \
| sed 's/.*[ ]\([0-9][0-9]*\).*/\1/'`
minor=`grep define ${SYSROOT}$includedir/freetype2/freetype/freetype.h \
| grep FREETYPE_MINOR \
| sed 's/.*[ ]\([0-9][0-9]*\).*/\1/'`
patch=`grep define ${SYSROOT}$includedir/freetype2/freetype/freetype.h \
| grep FREETYPE_PATCH \
| sed 's/.*[ ]\([0-9][0-9]*\).*/\1/'`
echo $major.$minor.$patch
fi
if test "$echo_cflags" = "yes" ; then
echo $cflags | sed "s|$orig_includedir/freetype2|$includedir/freetype2|"
fi
if test "$echo_libs" = "yes" ; then
if test "$show_static" = "yes" ; then
libs="$libs_L $static_libs"
else
libs="$libs_L $dynamic_libs"
fi
echo $libs | sed "s|$orig_libdir|$libdir|"
fi
if test "$echo_libtool" = "yes" ; then
echo ${SYSROOT}$libdir/libfreetype.la
fi
# EOF

14
builds/unix/freetype2.in Normal file
View File

@ -0,0 +1,14 @@
prefix=%prefix%
exec_prefix=%exec_prefix%
libdir=%libdir%
includedir=%includedir%
Name: FreeType 2
URL: https://freetype.org
Description: A free, high-quality, and portable font engine.
Version: %ft_version%
Requires: %PKGCONFIG_REQUIRES%
Requires.private: %PKGCONFIG_REQUIRES_PRIVATE%
Libs: %PKGCONFIG_LIBS%
Libs.private: %PKGCONFIG_LIBS_PRIVATE%
Cflags: -I${includedir}/freetype2

194
builds/unix/freetype2.m4 Normal file
View File

@ -0,0 +1,194 @@
# Configure paths for FreeType2
# Marcelo Magallon 2001-10-26, based on `gtk.m4` by Owen Taylor
#
# Copyright (C) 2001-2024 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,
# and distributed under the terms of the FreeType project license,
# LICENSE.TXT. By continuing to use, modify, or distribute this file you
# indicate that you have read the license and understand and accept it
# fully.
#
# As a special exception to the FreeType project license, this file may be
# distributed as part of a program that contains a configuration script
# generated by Autoconf, under the same distribution terms as the rest of
# that program.
#
# serial 7
# AC_CHECK_FT2([MINIMUM-VERSION [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
# Test for FreeType 2, and define FT2_CFLAGS and FT2_LIBS.
# MINIMUM-VERSION is what libtool reports; the default is '7.0.1' (this is
# FreeType 2.0.4).
#
# To make this code work with older autoconf versions, `AS_HELP_STRING` is
# not quoted.
#
AC_DEFUN([AC_CHECK_FT2],
[# Get the cflags and libraries from the freetype-config script
#
AC_ARG_WITH([ft-prefix],
AS_HELP_STRING([--with-ft-prefix=PREFIX],
[Prefix where FreeType is installed (optional)]),
[ft_config_prefix="$withval"],
[ft_config_prefix=""])
AC_ARG_WITH([ft-exec-prefix],
AS_HELP_STRING([--with-ft-exec-prefix=PREFIX],
[Exec prefix where FreeType is installed (optional)]),
[ft_config_exec_prefix="$withval"],
[ft_config_exec_prefix=""])
AC_ARG_ENABLE([freetypetest],
AS_HELP_STRING([--disable-freetypetest],
[Do not try to compile and run a test FreeType program]),
[],
[enable_fttest=yes])
if test x$ft_config_exec_prefix != x ; then
ft_config_args="$ft_config_args --exec-prefix=$ft_config_exec_prefix"
if test x${FT2_CONFIG+set} != xset ; then
FT2_CONFIG=$ft_config_exec_prefix/bin/freetype-config
fi
fi
if test x$ft_config_prefix != x ; then
ft_config_args="$ft_config_args --prefix=$ft_config_prefix"
if test x${FT2_CONFIG+set} != xset ; then
FT2_CONFIG=$ft_config_prefix/bin/freetype-config
fi
fi
if test "x$FT2_CONFIG" = x ; then
AC_PATH_TOOL([FT2_CONFIG], [freetype-config], [no])
fi
min_ft_version=m4_if([$1], [], [7.0.1], [$1])
AC_MSG_CHECKING([for FreeType -- version >= $min_ft_version])
no_ft=""
if test "$FT2_CONFIG" = "no" ; then
no_ft=yes
else
FT2_CFLAGS=`$FT2_CONFIG $ft_config_args --cflags`
FT2_LIBS=`$FT2_CONFIG $ft_config_args --libs`
ft_config_major_version=`$FT2_CONFIG $ft_config_args --version | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
ft_config_minor_version=`$FT2_CONFIG $ft_config_args --version | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
ft_config_micro_version=`$FT2_CONFIG $ft_config_args --version | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
ft_min_major_version=`echo $min_ft_version | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
ft_min_minor_version=`echo $min_ft_version | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
ft_min_micro_version=`echo $min_ft_version | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
if test x$enable_fttest = xyes ; then
ft_config_is_lt=""
if test $ft_config_major_version -lt $ft_min_major_version ; then
ft_config_is_lt=yes
else
if test $ft_config_major_version -eq $ft_min_major_version ; then
if test $ft_config_minor_version -lt $ft_min_minor_version ; then
ft_config_is_lt=yes
else
if test $ft_config_minor_version -eq $ft_min_minor_version ; then
if test $ft_config_micro_version -lt $ft_min_micro_version ; then
ft_config_is_lt=yes
fi
fi
fi
fi
fi
if test x$ft_config_is_lt = xyes ; then
no_ft=yes
else
ac_save_CFLAGS="$CFLAGS"
ac_save_LIBS="$LIBS"
CFLAGS="$CFLAGS $FT2_CFLAGS"
LIBS="$FT2_LIBS $LIBS"
#
# Sanity checks for the results of freetype-config to some extent.
#
AC_RUN_IFELSE([
AC_LANG_SOURCE([[
#include <ft2build.h>
#include <freetype/freetype.h>
#include <stdio.h>
#include <stdlib.h>
int
main(void)
{
FT_Library library;
FT_Error error;
error = FT_Init_FreeType(&library);
if (error)
return 1;
else
{
FT_Done_FreeType(library);
return 0;
}
}
]])
],
[],
[no_ft=yes],
[echo $ECHO_N "cross compiling; assuming OK... $ECHO_C"])
CFLAGS="$ac_save_CFLAGS"
LIBS="$ac_save_LIBS"
fi # test $ft_config_version -lt $ft_min_version
fi # test x$enable_fttest = xyes
fi # test "$FT2_CONFIG" = "no"
if test x$no_ft = x ; then
AC_MSG_RESULT([yes])
m4_if([$2], [], [:], [$2])
else
AC_MSG_RESULT([no])
if test "$FT2_CONFIG" = "no" ; then
AC_MSG_WARN([
The freetype-config script installed by FreeType 2 could not be found.
If FreeType 2 was installed in PREFIX, make sure PREFIX/bin is in
your path, or set the FT2_CONFIG environment variable to the
full path to freetype-config.
])
else
if test x$ft_config_is_lt = xyes ; then
AC_MSG_WARN([
Your installed version of the FreeType 2 library is too old.
If you have different versions of FreeType 2, make sure that
correct values for --with-ft-prefix or --with-ft-exec-prefix
are used, or set the FT2_CONFIG environment variable to the
full path to freetype-config.
])
else
AC_MSG_WARN([
The FreeType test program failed to run. If your system uses
shared libraries and they are installed outside the normal
system library path, make sure the variable LD_LIBRARY_PATH
(or whatever is appropriate for your system) is correctly set.
])
fi
fi
FT2_CFLAGS=""
FT2_LIBS=""
m4_if([$3], [], [:], [$3])
fi
AC_SUBST([FT2_CFLAGS])
AC_SUBST([FT2_LIBS])])
# end of freetype2.m4

32
builds/unix/ft-munmap.m4 Normal file
View File

@ -0,0 +1,32 @@
## FreeType specific autoconf tests
#
# Copyright (C) 2002-2024 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,
# and distributed under the terms of the FreeType project license,
# LICENSE.TXT. By continuing to use, modify, or distribute this file you
# indicate that you have read the license and understand and accept it
# fully.
# serial 2
AC_DEFUN([FT_MUNMAP_PARAM],
[AC_MSG_CHECKING([for munmap's first parameter type])
AC_COMPILE_IFELSE([
AC_LANG_SOURCE([[
#include <unistd.h>
#include <sys/mman.h>
int munmap(void *, size_t);
]])
],
[AC_MSG_RESULT([void *])
AC_DEFINE([MUNMAP_USES_VOIDP],
[],
[Define to 1 if the first argument of munmap is of type void *])],
[AC_MSG_RESULT([char *])])
])
# end of ft-munmap.m4

52
builds/unix/ftconfig.h.in Normal file
View File

@ -0,0 +1,52 @@
/****************************************************************************
*
* ftconfig.h.in
*
* UNIX-specific configuration file (specification only).
*
* Copyright (C) 1996-2024 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
* modified, and distributed under the terms of the FreeType project
* license, LICENSE.TXT. By continuing to use, modify, or distribute
* this file you indicate that you have read the license and
* understand and accept it fully.
*
*/
/**************************************************************************
*
* This header file contains a number of macro definitions that are used by
* the rest of the engine. Most of the macros here are automatically
* determined at compile time, and you should not need to change it to port
* FreeType, except to compile the library with a non-ANSI compiler.
*
* Note however that if some specific modifications are needed, we advise
* you to place a modified copy in your build directory.
*
* The build directory is usually `builds/<system>`, and contains
* system-specific files that are always included first when building the
* library.
*
*/
#ifndef FTCONFIG_H_
#define FTCONFIG_H_
#include <ft2build.h>
#include FT_CONFIG_OPTIONS_H
#include FT_CONFIG_STANDARD_LIBRARY_H
#undef HAVE_UNISTD_H
#undef HAVE_FCNTL_H
#include <freetype/config/integer-types.h>
#include <freetype/config/public-macros.h>
#include <freetype/config/mac-support.h>
#endif /* FTCONFIG_H_ */
/* END */

View File

@ -1,172 +0,0 @@
/***************************************************************************/
/* */
/* ftconfig.in */
/* */
/* UNIX-specific configuration file (specification only). */
/* */
/* Copyright 1996-2000 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
/* modified, and distributed under the terms of the FreeType project */
/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
/* this file you indicate that you have read the license and */
/* understand and accept it fully. */
/* */
/***************************************************************************/
/*************************************************************************/
/* */
/* This header file contains a number of macro definitions that are used */
/* by the rest of the engine. Most of the macros here are automatically */
/* determined at compile time, and you should not need to change it to */
/* port FreeType, except to compile the library with a non-ANSI */
/* compiler. */
/* */
/* Note however that if some specific modifications are needed, we */
/* advise you to place a modified copy in your build directory. */
/* */
/* The build directory is usually `freetype/builds/<system>', and */
/* contains system-specific files that are always included first when */
/* building the library. */
/* */
/*************************************************************************/
#ifndef FTCONFIG_H
#define FTCONFIG_H
/* Include the header file containing all developer build options */
#include <freetype/config/ftoption.h>
/*************************************************************************/
/* */
/* PLATFORM-SPECIFIC CONFIGURATION MACROS */
/* */
/* These macros can be toggled to suit a specific system. The current */
/* ones are defaults used to compile FreeType in an ANSI C environment */
/* (16bit compilers are also supported). Copy this file to your own */
/* `freetype/builds/<system>' directory, and edit it to port the engine. */
/* */
/*************************************************************************/
#define HAVE_UNISTD_H 0
#define HAVE_FCNTL_H 0
#define SIZEOF_INT 2
#define SIZEOF_LONG 2
#define FT_SIZEOF_INT SIZEOF_INT
#define FT_SIZEOF_LONG SIZEOF_LONG
/* Preferred alignment of data */
#define FT_ALIGNMENT 8
/* UNUSED is a macro used to indicate that a given parameter is not used */
/* -- this is only used to get rid of unpleasant compiler warnings */
#ifndef FT_UNUSED
#define FT_UNUSED( arg ) ( (arg) = (arg) )
#endif
/*************************************************************************/
/* */
/* AUTOMATIC CONFIGURATION MACROS */
/* */
/* These macros are computed from the ones defined above. Don't touch */
/* their definition, unless you know precisely what you are doing. No */
/* porter should need to mess with them. */
/* */
/*************************************************************************/
/*************************************************************************/
/* */
/* IntN types */
/* */
/* Used to guarantee the size of some specific integers. */
/* */
typedef signed short FT_Int16;
typedef unsigned short FT_UInt16;
#if FT_SIZEOF_INT == 4
typedef signed int FT_Int32;
typedef unsigned int FT_UInt32;
#elif FT_SIZEOF_LONG == 4
typedef signed long FT_Int32;
typedef unsigned long FT_UInt32;
#else
#error "no 32bit type found -- please check your configuration files"
#endif
#if FT_SIZEOF_LONG == 8
/* FT_LONG64 must be defined if a 64-bit type is available */
#define FT_LONG64
#define FT_INT64 long
#else
/*************************************************************************/
/* */
/* Many compilers provide the non-ANSI `long long' 64-bit type. You can */
/* activate it by defining the FTCALC_USE_LONG_LONG macro in */
/* `ftoption.h'. */
/* */
/* Note that this will produce many -ansi warnings during library */
/* compilation, and that in many cases, the generated code will be */
/* neither smaller nor faster! */
/* */
#ifdef FTCALC_USE_LONG_LONG
#define FT_LONG64
#define FT_INT64 long long
#endif /* FTCALC_USE_LONG_LONG */
#endif /* FT_SIZEOF_LONG == 8 */
#ifdef FT_MAKE_OPTION_SINGLE_OBJECT
#define LOCAL_DEF static
#define LOCAL_FUNC static
#else
#define LOCAL_DEF extern
#define LOCAL_FUNC /* nothing */
#endif
#ifdef FT_MAKE_OPTION_SINGLE_LIBRARY_OBJECT
#define BASE_DEF( x ) static x
#define BASE_FUNC( x ) static x
#else
#define BASE_DEF( x ) extern x
#define BASE_FUNC( x ) extern x
#endif
#ifndef FT_EXPORT_DEF
#define FT_EXPORT_DEF( x ) extern x
#endif
#ifndef FT_EXPORT_FUNC
#define FT_EXPORT_FUNC( x ) extern x
#endif
#ifndef FT_EXPORT_VAR
#define FT_EXPORT_VAR( x ) extern x
#endif
#endif /* FTCONFIG_H */
/* END */

Some files were not shown because too many files have changed in this diff Show More