src


Log

Author Commit Date CI Message
Werner Lemberg 8b755445 2017-01-06T11:47:55 [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'.
Werner Lemberg 348d39c6 2017-01-05T12:29:55 Comment.
Werner Lemberg 563ae780 2017-01-04T20:16:34 Update copyright year.
Werner Lemberg a7c2f44b 2017-01-04T13:12:03 * src/pcf/pcfdrivr.c (PCF_Face_Init): Trace compression format.
Werner Lemberg c9d47724 2017-01-04T10:00:49 [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.
Werner Lemberg 025226ae 2017-01-04T07:45:44 [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.
Werner Lemberg 8982405f 2017-01-03T09:46:19 [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.
Werner Lemberg 624b6802 2017-01-03T09:42:41 [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.
Werner Lemberg 69414e7a 2017-01-03T06:53:13 * src/cff/cffparse.c (cff_parse_num): Simplify.
Werner Lemberg 248eaa4f 2017-01-03T00:27:07 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.
Werner Lemberg bdec162d 2017-01-01T20:51:55 [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.
Werner Lemberg 63765a8f 2017-01-01T10:43:41 [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.
Werner Lemberg 24be60b5 2017-01-01T08:20:38 */*: Use hex numbers for errors in tracing messages.
Werner Lemberg e9a154e7 2016-12-31T21:41:08 [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.
Werner Lemberg 8fb9d22a 2016-12-30T19:51:37 [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.
Werner Lemberg 6b21d128 2016-12-30T10:00:54 [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.
Werner Lemberg 7591bf11 2016-12-29T21:39:06 [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.
Werner Lemberg 91fc3bd7 2016-12-29T21:34:46 * src/truetype/ttgxvar.c (TT_Get_MM_Var): Check axis data. Reported as https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=348
Werner Lemberg 18018510 2016-12-29T21:30:06 [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.
Werner Lemberg 84b0d992 2016-12-29T10:38:51 */*: Use `0.5f' for tracing 16.16 numbers.
Werner Lemberg 346b1417 2016-12-29T06:03:40 [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.
Werner Lemberg 6fb549dd 2016-12-28T22:23:33 [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.
Werner Lemberg c4a1ef3c 2016-12-28T21:22:45 [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.
Werner Lemberg c4cd34a9 2016-12-28T08:33:35 [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.
Werner Lemberg 0a943b63 2016-12-27T07:50:22 Formatting.
Werner Lemberg e5e3556f 2016-12-27T06:49:37 [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.
Werner Lemberg f80c4473 2016-12-26T23:57:45 Replace `++foo' and `--foo' with `foo++' and `foo--', resp.
Werner Lemberg 4441f7b2 2016-12-26T17:08:17 Replace `foo == NULL' and `foo != NULL' with `!foo' and `foo', resp. Other minor formatting.
Werner Lemberg 37c72f66 2016-12-25T22:55:25 Minor formatting.
Werner Lemberg a300c1c3 2016-12-24T09:27:15 * src/truetype/ttpload.c (tt_face_load_hdmx): Ignore `version'. Problem reported by 張俊芝 <418092625@qq.com>.
Werner Lemberg d1db57c2 2016-12-24T09:05:16 * 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>.
Werner Lemberg fde0b78c 2016-12-24T08:17:19 * 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>.
Werner Lemberg 1fecdfe3 2016-12-24T07:50:45 * src/sfnt/sfobjs.c (sfnt_init_face): Fix tracing.
Werner Lemberg 7f733399 2016-12-22T10:12:17 * src/base/ftrfork.c (FT_Raccess_Get_DataOffsets): Check `count'. Reported as https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=308
Werner Lemberg b44e6c20 2016-12-22T08:30:15 [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.
Werner Lemberg ada82971 2016-12-22T08:25:42 [ftfuzzer] Always use Adobe CFF engine. * src/tools/ftfuzzer/ftfuzzer.cc (FT_Global::FT_Global): Implement it.
Werner Lemberg 72091103 2016-12-21T23:46:29 * 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.
Werner Lemberg d44daf9e 2016-12-21T23:03:48 * src/truetype/ttgxvar.c (TT_Vary_Apply_Glyph_Deltas): Thinko. Don't apply deltas twice for non-phantom points. Spotted by Ben Wagner.
Werner Lemberg e6a429e2 2016-12-21T20:27:48 [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'.
Werner Lemberg 64a91137 2016-12-21T19:30:33 [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.
Werner Lemberg 57a6733d 2016-12-21T06:52:23 [base] Improve sanity check for Mac resources (#49888). * src/base/ftobjs.c (Mac_Read_sfnt_Resource): Abort if `rlen' is not positive.
Werner Lemberg ded4bdb5 2016-12-20T23:26:38 [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.
Werner Lemberg b5573032 2016-12-20T23:22:06 ftobjs.c: Formatting.
Werner Lemberg d5fe8da7 2016-12-20T22:03:40 Spelling.
Werner Lemberg 70704b34 2016-12-20T12:27:22 [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.
Ben Wagner cc576f80 2016-12-20T11:37:42 [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.
Werner Lemberg a1e85f11 2016-12-20T10:52:26 [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.
Werner Lemberg 5743df77 2016-12-18T21:01:03 [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'.
Werner Lemberg ca3d4019 2016-12-18T18:23:19 * src/cff/cffobjs.c (cff_face_init): Make named instances work.
Werner Lemberg a8652c59 2016-12-18T18:12:03 [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.
Werner Lemberg 25f3ac2b 2016-12-18T15:50:18 [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.
Werner Lemberg eb6d0208 2016-12-18T09:29:58 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.
Werner Lemberg 8f633a08 2016-12-18T06:42:31 [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.
Werner Lemberg 4cd68179 2016-12-17T22:52:50 * src/cff/cffload.c (cff_build_blend_vector): Remove redundant code.
Werner Lemberg 6949797d 2016-12-17T21:05:54 More code formatting.
Werner Lemberg 5d664b6d 2016-12-17T20:47:42 Use FT_SET_ERROR where useful. Other minor code formatting.
Werner Lemberg db17ceb4 2016-12-17T13:39:31 * src/truetype/ttobjs.c (tt_face_init): Simplify conditional code.
Werner Lemberg 7c75b166 2016-12-17T13:28:24 [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.
Werner Lemberg 3b125e95 2016-12-17T10:02:19 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.
Werner Lemberg 50ff6c1e 2016-12-17T07:44:46 * src/cff/cffload.c (cff_load_private_dict): Always init `blend'. Reported as https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=295
Werner Lemberg df2cf43e 2016-12-16T11:38:20 [truetype] Fix `cvar' sanity test. Reported by Dave Arnold. * src/truetype/ttgxvar.c (tt_face_vary_cvt): Use tuple count mask.
Werner Lemberg 68620248 2016-12-16T11:15:17 [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'.
Werner Lemberg beecf80a 2016-12-16T08:52:03 [cff] Fix heap buffer overflow (#49858). * src/cff/cffparse.c (cff_parser_run): Add one more stack size check.
Werner Lemberg 01658be6 2016-12-15T23:10:59 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.
Dave Arnold edf40148 2016-12-15T21:56:44 [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.
Dave Arnold 9f62d2ca 2016-12-15T20:27:47 [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.
Werner Lemberg 3bd79cc2 2016-12-15T14:34:57 [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.
Dave Arnold aa0c4b4f 2016-12-15T14:04:51 [truetype] Provide function to apply `HVAR' advance width variation. * src/truetype/ttgxvar.c (tt_hadvance_adjust): New function. * src/truetype/ttgxvar.h: Updated.
Dave Arnold 097cd874 2016-12-15T12:58:26 [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.
Dave Arnold abd58581 2016-12-15T12:17:22 [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.
Dave Arnold 010e0614 2016-12-15T11:22:15 [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.
Dave Arnold 41533b95 2016-12-15T00:00:45 [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.
Werner Lemberg 0918325e 2016-12-14T20:44:11 [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.
Werner Lemberg c628a7df 2016-12-14T19:31:42 [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'.
Werner Lemberg a7dc0c35 2016-12-14T18:54:21 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.
Werner Lemberg ab22b43b 2016-12-14T18:34:55 * src/truetype/ttgxvar.c (tt_get_var_blend): Fix compiler warning.
Werner Lemberg 4e07516e 2016-12-14T18:25:44 [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.
Werner Lemberg 8b174b4b 2016-12-11T09:16:52 [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.
Werner Lemberg 27bdb36c 2016-12-10T09:56:03 [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.
Werner Lemberg 3205a44d 2016-12-09T06:55:34 [sfnt] Revert change from 2016-12-08. I missed the functionality of `ft_module_get_service', which makes the change unnecessary.
Werner Lemberg 29aa9577 2016-12-08T08:59:34 [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.
Werner Lemberg ffd8f622 2016-12-06T07:25:16 [cff] Code shuffling. This is a preparation for better integrating Dave Arnold's changes.
Dave Arnold bcae6574 2016-12-05T22:08:15 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.
Werner Lemberg c0fae7da 2016-12-06T11:13:19 * 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
Werner Lemberg 602be7c8 2016-12-01T11:36:37 [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.
Oleksandr Chekhovskyi 255828c8 2016-12-01T07:07:22 [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.
Werner Lemberg 1d28f697 2016-11-29T18:45:22 [smooth] Revert previous commit. Already fixed with 6ca54c64.
Werner Lemberg d949a3db 2016-11-29T12:09:56 [smooth] Avoid conditional jump on uninitialized value (#49711). * src/smooth/ftgrays.c (gray_raster_render): Initialize `worker'.
Nikolaus Waxweiler b37b799c 2016-11-27T16:30:53 [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.
Werner Lemberg 48c77da3 2016-11-17T07:37:50 Add minor comment to avoid confusion (#19044).
Werner Lemberg e1ee5476 2016-11-06T12:39:05 * src/base/ftobjs.c (FT_Render_Glyph_Internal): Fix tracing.
Werner Lemberg 1c6fd994 2016-11-06T12:37:55 [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.
Werner Lemberg 565db95b 2016-11-06T12:33:51 [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.
Werner Lemberg 37e193e9 2016-11-06T12:32:51 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.
Behdad Esfahbod b72858c9 2016-11-03T06:41:00 [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.
Werner Lemberg 328d6844 2016-10-29T00:18:56 [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.
Werner Lemberg ddf38726 2016-10-27T07:27:27 [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.
Werner Lemberg 9c45ac39 2016-10-26T16:00:00 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.
Werner Lemberg 56140907 2016-10-26T08:10:59 * src/type1/t1load.c (parse_subrs): Fix limit check. Reported as https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=81
Alexei Podtelezhnikov c5f1bc4b 2016-10-25T22:31:42 [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.