Commit Graph

265 Commits

Author SHA1 Message Date
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 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
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
Werner Lemberg d0cfb4e1b2 Update all copyright notices. 2022-01-11 10:54:10 +01:00
Werner Lemberg d899b200f6 * src/sfnt/sfobjs.c (sfnt_open_font): Fix typo. 2021-11-08 12:27:04 +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
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 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 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
Alexei Podtelezhnikov 44c59414eb * src/sfnt/sfobjs.c (sfnt_load_face): Tweak allocation macro. 2021-05-06 22:54:03 -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 caff87b1f9 * src/sfnt/sfobjs.c (sfnt_init_face): Revert macro change. 2021-04-26 22:45:40 -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
Werner Lemberg b6e8a71266 Update all copyright notices. 2021-01-17 07:18:48 +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
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 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 e5038be704 Update all copyright notices. 2020-01-19 17:05:19 +01: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 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 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 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 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 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 7585997024 Update all copyright notices. 2019-02-23 10:07:09 +01: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
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 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
Ben Wagner 96b5e50090 * src/sfnt/sfobjs.c (sfnt_done_face): Fix memory leak (#54435). 2018-08-10 22:24:26 +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 7edc937fe6 s/palette_types/palette_flags/.
Suggested by Behdad.
2018-07-02 11:50:04 +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 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 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
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
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
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
Werner Lemberg 713d68ee9f [sfnt] Prefer `CBDT'/`CBLC' over `glyf' table (#53154). 2018-02-17 18:35:15 +01:00
Werner Lemberg 0a0c22569d Update copyright year. 2018-01-02 09:33:57 +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 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
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 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 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
Alexei Podtelezhnikov abeb28f161 * src/sfnt/sfobjs.c (sfnt_load_face): Ignore No_Unicode_Glyph_Name. 2017-07-01 16:48:32 -04: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 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 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