Commit Graph

224 Commits

Author SHA1 Message Date
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
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 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 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 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
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 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 99fb3c3ab8 Comment updates. 2017-03-05 11:32:41 +01: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 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 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 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 563ae78022 Update copyright year. 2017-01-04 20:16:34 +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 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 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 1fecdfe346 * src/sfnt/sfobjs.c (sfnt_init_face): Fix tracing. 2016-12-24 07:50:45 +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 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 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
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 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 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 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 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 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 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 9adeab6452 Update copyright year. 2016-01-13 11:54:10 +01: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 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 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 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
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
Alexei Podtelezhnikov 792db0b9a9 [cff,cid,pfr,sfnt,winfonts] NULL. 2015-04-15 23:20:23 -04: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 f57fc59e01 Run `src/tools/update-copyright'. 2015-01-17 20:41:43 +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