src/cff/cffload.c


Log

Author Commit Date CI Message
Werner Lemberg 6ceeb87f 2018-07-05T22:31:10 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.
Werner Lemberg 9ac9060d 2018-06-03T09:01:17 [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.
Werner Lemberg 3b8f1680 2018-04-04T20:26:08 [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.
Werner Lemberg 0a0c2256 2018-01-02T09:33:57 Update copyright year.
Werner Lemberg 068a7a03 2017-12-18T20:34:05 * src/*/*: Only use `ft_' and `FT_' variants of stdc library stuff.
Werner Lemberg 63b91548 2017-12-07T14:33:44 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'.
Werner Lemberg 71fecc53 2017-12-05T12:06:29 Improve tracing messages by using singular and plural forms. * src/*/*.c: Implement it.
Ewald Hew 94f6d57a 2017-10-16T11:48:31 [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.
Alexei Podtelezhnikov ccb0f799 2017-10-15T14:19:13 [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.
John Tytgat 1df35d94 2017-10-04T22:46:36 [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'.
Werner Lemberg 9b549fa6 2017-09-30T16:36:28 [base,cff,cid] Whitespace, formatting.
Ewald Hew 645d1b86 2017-09-25T06:28:25 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.
Ewald Hew b624868b 2017-09-24T22:32:40 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.
Werner Lemberg dcd8de27 2017-06-09T11:21:58 */*: Remove `OVERFLOW_' prefix. This increases readability.
Werner Lemberg 86670429 2017-06-05T06:20:53 [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.
Werner Lemberg 5a3490e0 2017-03-31T09:35:58 * 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
Dave Arnold fdbef538 2017-03-17T07:28:11 [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.
Dave Arnold 0bf95b58 2017-03-17T07:22:55 [cff] Fix CFF2 stack allocation. * src/cff/cffparse.c (cff_parser_init) add 1 for operator.
Werner Lemberg 981c23b7 2017-03-15T11:35:26 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.
Werner Lemberg 5eb0fd5e 2017-03-12T20:46:56 [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.
Werner Lemberg e706798d 2017-02-20T09:15:13 [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.
Werner Lemberg 156b30b1 2017-02-20T09:06:22 [cff] Sanitize `initialRandomSeed'. * src/cff/cffload.c (cff_load_private_dict): Make `initial_random_seed' value always positive.
Werner Lemberg 563ae780 2017-01-04T20:16:34 Update copyright year.
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 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 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 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 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 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 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 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.
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 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 2ecf89b4 2016-09-28T19:06:21 */*: s/FT_MEM_ZERO/FT_ZERO/ where appropriate.
Werner Lemberg f0fa7a67 2016-09-03T06:33:36 [cff] Avoid null pointer passed to FT_MEM_COPY (#48984). * src/cff/cffload.c (cff_index_get_name): Check `byte_len'.
Alexei Podtelezhnikov e8542260 2016-04-08T23:21:34 Typos.
Werner Lemberg 8ed9eaf1 2016-02-15T20:41:58 [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.
Werner Lemberg 658f530e 2016-02-15T14:28:28 [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.
Werner Lemberg 32950391 2016-02-15T12:54:40 Whitespace.
Werner Lemberg 813aca51 2016-02-14T16:03:15 [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.
Werner Lemberg 4c00dfb4 2016-02-07T11:43:03 Whitespace.
Werner Lemberg 9adeab64 2016-01-13T11:54:10 Update copyright year.
Werner Lemberg 14d6b5d7 2015-08-13T15:22:17 [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.
Werner Lemberg 3a8d0537 2015-02-20T08:35:32 [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.
Werner Lemberg f57fc59e 2015-01-17T20:41:43 Run `src/tools/update-copyright'.
Werner Lemberg 08c628d1 2014-02-26T14:18:03 [cff] Fix Savannah bug #41693. * src/cff/cffload.c (CFF_Load_FD_Select): Reject empty array.
John Tytgat 9bcfab87 2013-08-06T08:55:19 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.
Werner Lemberg 94152819 2013-05-04T16:40:12 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.
Werner Lemberg 06474c3e 2013-04-13T18:53:28 [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.
Werner Lemberg e3c93015 2013-03-14T11:21:17 */*: Use FT_Err_Ok only. This is a purely mechanical conversion.
Werner Lemberg 059bc335 2013-03-14T10:27:35 */*: 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.
Werner Lemberg 55127272 2012-11-13T09:22:11 [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.
Werner Lemberg 70cf8c5e 2011-11-26T20:09:39 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.
Werner Lemberg d05d56ff 2011-11-26T18:13:09 [cff] Fix error code. * src/cff/cffload.c (cff_font_load): Do it.
Werner Lemberg 35ab70c1 2011-08-25T13:41:16 [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.
suzuki toshiya e62c876b 2011-06-15T02:48:33 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'.
Werner Lemberg d38ba0c9 2010-09-19T20:51:19 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'.
suzuki toshiya 73aa20ca 2010-09-20T01:30:38 [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.
suzuki toshiya d2d843a0 2010-09-20T01:28:17 [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.
suzuki toshiya a0f43f20 2010-09-20T01:26:56 [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'.
suzuki toshiya b3e1954d 2010-09-20T01:22:34 [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.
Werner Lemberg 5220ef58 2010-09-13T07:32:22 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'.
Werner Lemberg 0e95b3d1 2010-08-29T10:46:26 [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>.
Werner Lemberg c73e1605 2010-07-06T10:44:56 Pacify compiler. * src/cff/cffload.c (cff_index_get_pointers): Initialize `new_bytes'.
Werner Lemberg e23ba91a 2010-06-25T21:55:14 Fix Savannah bug #30254. * src/cff/cffload.c (cff_index_get_pointers): Do sanity check for first offset also.
Werner Lemberg f765e440 2010-06-24T10:34:29 */*: Use module specific error names where appropriate.
Werner Lemberg 370aea80 2010-06-08T08:37:11 Formatting.
suzuki toshiya cef43bde 2010-03-14T23:12:13 Fix `multi build' for Tytgat's CFF driver improvement. * src/base/cffload.h (cff_index_get_name): Added.
Werner Lemberg 03b3da8b 2010-03-02T13:00:55 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.
suzuki toshiya b16a9426 2009-08-01T00:32:25 cff: Type large constants > 0x7FFF as long for 16-bit systems.
Bram Tassyns 3d3ba056 2009-07-05T14:54:59 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.
Werner Lemberg 858abbed 2009-06-26T06:15:41 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.
Oran Agra 2589e5fd 2009-04-05T17:34:40 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.
Werner Lemberg 0545ec1c 2009-03-20T06:49:10 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.
Werner Lemberg b66efefd 2009-03-12T08:07:49 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).
Werner Lemberg 07e81817 2009-03-11T21:29:54 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.
Werner Lemberg 3d2f06f3 2008-07-16T06:13:34 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.
Werner Lemberg 048b7563 2008-04-13T05:55:36 * src/psaux/psconv.c (PS_Conv_ToFixed): Increase precision if integer part is zero.
Werner Lemberg a10d2b7c 2007-12-04T22:05:54 * src/cff/cffload.c (cff_subfont_load): Don't use logical OR to concatenate error codes. * src/sfnt/ttsbit.c (Load_SBit_Range): Ditto.
Werner Lemberg ef915c36 2007-07-16T20:46:05 * 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.
David Turner c0f9c4aa 2007-02-12T14:55:03 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
Werner Lemberg d7855663 2007-01-25T13:53:56 formatting, rearranging
David Turner a42567bf 2007-01-25T12:23:37 - same CFF loader fix (stricter checking though than Werner's version) - document light auto-hinter improvements
Werner Lemberg b1be9e8b 2007-01-25T11:50:00 * src/cff/cffload.c (cff_index_get_pointers): Handle last entry correctly. This fixes Savannah bug #18867. * docs/CHANGES: Document it. Other formatting.
Werner Lemberg 9b774e28 2007-01-16T06:11:27 Remove trailing whitespace. From Alexei.
Werner Lemberg ac250b22 2007-01-13T14:01:36 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.
Werner Lemberg be5f797f 2007-01-06T07:51:48 * src/cff/cffload.c (cff_index_init): Remove unused variable. (cff_index_read_offset): s/perror/errorp/ to avoid global shadowing.
Werner Lemberg f6294399 2007-01-06T07:47:45 formatting, copyright years
David Turner 91a3402d 2007-01-05T14:47:08 - don't load metrics table in memory, reduces heap usage - forgot to commit the changes in cffload.c that are already documented
David Turner 5dbdb6c3 2007-01-05T13:14:08 * 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
David Turner 3a2131a3 2007-01-05T10:51:56 formatting
Werner Lemberg 913a3650 2006-11-19T09:19:17 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'.
Werner Lemberg e88c5261 2006-10-24T05:46:26 * src/cff/cffload.c (cff_encoding_load): Remove unused variable. * src/base/ftobjs.c (FT_Select_Charmap): Disallow FT_ENCODING_NONE as argument.
Werner Lemberg 715e96ec 2006-10-24T05:28:45 formatting, improving ChangeLog entries