summaryrefslogtreecommitdiff
path: root/src/type1/t1load.c
Commit message (Collapse)AuthorAgeFilesLines
* * src/type1/t1load.c (T1_Get_MM_Var): Optimize array zeroing.Alexei Podtelezhnikov2023-02-251-5/+4
|
* [type1/MM] Round design coordinates.Alexei Podtelezhnikov2023-02-101-5/+6
| | | | | | | | | | The design coordinates for MM fonts were not rounded. For example, `FT_Get_Var_Design_Coordinates` returned values with fractional part. * src/type1/t1load.c (mm_axis_unmap): Refactor with rounding. * include/freetype/ftmm.h (FT_Var_Axis, FT_Set_Var_Design_Coordinates, FT_Get_Var_Design_Coordinates): Reword documentation.
* [truetype, type1] Additional variation tags.Alexei Podtelezhnikov2023-02-081-0/+4
| | | | | | | | | Sync with https://learn.microsoft.com/en-us/typography/opentype/spec/dvaraxisreg#registered-axis-tags * src/truetype/ttgxvar.h (TTAG_ital): New tag. * src/truetype/ttgxvar.c (TT_Get_MM_Var): Use it. * src/type1/t1load.c (T1_Get_MM_Var): Handle 'slnt' and 'ital'.
* Update all copyright notices.Werner Lemberg2023-01-171-1/+1
|
* Whitespace.Werner Lemberg2022-04-011-6/+6
|
* [psaux, type1, type42] Avoid annecessary zeroing.Alexei Podtelezhnikov2022-01-201-2/+2
| | | | | | * src/psaux/psobjs.c (ps_table_new): Use FT_QNEW_ARRAY. * src/type1/t1load.c (parse_encoding): Ditto. * src/type42/t42parse.c (t42_parse_encoding): Ditto.
* [bdf,type1] Avoid unnecessary hash zeroing.Alexei Podtelezhnikov2022-01-151-1/+1
| | | | | * src/bdf/bdflib.c (_bdf_parse_start): Use `FT_QALLOC`. * src/type1/t1load.c (parse_subrs): Use `FT_QNEW`.
* Update all copyright notices.Werner Lemberg2022-01-111-1/+1
|
* Fix clang warnings.Werner Lemberg2021-11-141-10/+10
| | | | | | | | | | | * src/gxvalid/gxvcmmn.h (GXV_SET_ERR_IF_PARANOID): Use 'do' block. * src/gxvalid/gxvmod.c (GXV_TABLE_LOAD, GXV_TABLE_VALIDATE): Ditto. * src/smooth/ftgrays.c (gray_convert_glyph): Add cast. * src/type1/t1gload.c (T1_Parse_Glyph_And_Get_Char_String): Remove cast. * src/type1/t1load.c (read_binay_data): Use `FT_ULong` for `size` parameter. (parse_subrs, parse_charstrings, parse_dict): Ditto; also add some casts.
* Formatting.Werner Lemberg2021-10-261-8/+8
|
* [mm] Tolerate missing Blend dictionary entriesBen Wagner2021-10-251-3/+3
| | | | | | | | | | | | | | | In a Multiple Master font, the Blend dictionary must contain valid Private, FontInfo, and FontBBox. The current code will error if any of these are present and invalid, but will not error and will provide uninitialized data if the Blend dictionary exists but does not contain one of these entries. This change reverts to the older behavior of treating any missing entries as containing all zero data and not returning an error. In the future it may be best to keep track of when these are actually initialized and error if they are not. * src/type1/t1load.c (t1_allocate_blend): Zero initiailize.
* [mm] Delay setting blend weight and design position.Ben Wagner2021-10-211-32/+50
| | | | | | | | | | | | | | | | | | | | Previously the `blend->weight_vector`, `blend->default_weight_vector`, and `blend->design_pos` were set early to allocated but uninitialized memory under the assumption that the memory would eventually be initialized. However, it is possible that some of the required keywords may not actually be present, leaving the memory uninitialized. This is different from a present but invalid table, which would produce an error. Reported as https://bugs.chromium.org/p/chromium/issues/detail?id=1261762 * src/type1/t1load.c (t1_allocate_blend): Remove early allocation and initialization. (parse_blend_design_positions, parse_weight_vector): Parse into local and assign to blend if valid. (T1_Open_Face): Check that if a blend exists that it has the weight vector and design positions.
* [type1] Revert to signed size for binary data.Alexei Podtelezhnikov2021-10-111-11/+11
| | | | | | | | Recently introduced and reported as https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=39838 * src/type1/t1load.c (read_binary_data): Reject negative size. (parse_subrs, parse_charstrings): Use customary signed size.
* [psaux] Signedness revisions.Alexei Podtelezhnikov2021-10-101-3/+3
| | | | | | | | | Unsigned indexes are easier to check. * src/psaux/cffdecode.c (cff_decoder_parse_charstrings): Updated. * src/psaux/psintrp.c (cf2_interpT2CharString): Ditto. * src/psaux/t1decode.c (t1_decoder_parse_charstrings): Ditto. * src/type1/t1load.c (read_binary_data): Ditto.
* Minor type adjustments.Alexei Podtelezhnikov2021-09-141-5/+5
| | | | | | * src/cff/cffobjs.c (cff_face_init): Reduce casting. * src/truetype/ttobjs.c (tt_size_ready_bytecode): Ditto. * src/type1/t1load.c (T1_Set_MM_Design): Ditto.
* [type1] Avoid MM memory zeroing.Alexei Podtelezhnikov2021-05-071-7/+7
| | | | | | * src/type1/t1load.c (t1_allocate_blend, parse_blend_design_map): Tweak allocation macros. * src/type1/t1objs.c (T1_Face_Done): Minor.
* [cff,type1,type42] s/FT_ALLOC/FT_QALLOC/ for initialized buffers.Alexei Podtelezhnikov2021-04-231-3/+3
| | | | | | | | | | * src/cff/cffload.c (cff_index_get_pointers, cff_index_get_name): Do not zero out the buffer. * src/cff/cffdrivr.c (cff_ps_get_font_info): Ditto. * src/type1/t1load.c (parse_subrs, parse_charstrings, parse_blend_axis_types): Ditto. * src/type1/t1parse.c (T1_New_Parser, T1_Get_Private_Dict): Ditto. * src/type42/t42parse.c (t42_parser_init): Ditto.
* * src/*: Don't use more than one '\n' in `FT_TRACE` and `FT_ERROR`.Werner Lemberg2021-02-041-4/+4
| | | | | | | | This ensures good logging output, with all lines having a proper prefix (if requested). This is a continuation of a similar patch from 2020-12-02, which missed some locations.
* Update all copyright notices.Werner Lemberg2021-01-171-1/+1
|
* Fix `-Wformat' compiler warnings.Priyesh Kumar2020-07-281-3/+3
| | | | | | * src/*: Fix format specifiers. * builds/unix/ftsystem.c (FT_Stream_Open): Ditto.
* Make macros for header file names optional.David Turner2020-06-081-5/+5
| | | | | | | | | | | | | | | | | We no longer have to take care of the 8.3 file name limit; this allows us (a) to introduce longer, meaningful file names, and (b) to avoid macro names in `#include' lines altogether since some compilers (most notably Visual C++) doesn't support this properly. */*: Replace #include FOO_H with #include <freetype/foo.h> or something similar. Also update the documentation.
* Update all copyright notices.Werner Lemberg2020-01-191-1/+1
|
* [type1] Fix `FT_Get_Var_Axis_Flags' (#56804).Werner Lemberg2019-08-261-9/+33
| | | | | * src/type1/t1load.c (T1_Get_MM_Var): Allocate space for axis flags. Also remove redundant assignment.
* [type1,type42] Use `const' for string literals.Alexei Podtelezhnikov2019-06-101-19/+12
| | | | | | | | | | | * include/freetype/internal/psaux.h (PS_Table_FuncsRec): Updated. * include/freetype/internal/t1types.h (T1_EncodingRec): Updated. * src/psaux/psobjs.[ch] (ps_table_add): Updated. * src/type1/t1load.c (T1_Open_Face, parse_encoding): Updated. * src/type42/t42objs.c (T42_Open_Face): Updated. * src/type42/t42parse.c (t42_parse_encoding): Updated. * src/cff/cffobjs.c (cff_face_init): Minor.
* Update all copyright notices.Werner Lemberg2019-02-231-1/+1
|
* Update copyright years.Werner Lemberg2019-01-221-1/+1
|
* [type1,cff] Add FT_{Set,Get}_MM_WeightVector API calls.Chris Liddell2018-11-271-0/+69
| | | | | | | | | | | | | | | | | | | | | | | | | | | | For multiple master fonts, common usage (in Postscript) is to modify the WeightVector of an existing font instance, this addition supports that use. * include/freetype/ftmm.h, src/base/ftmm.c (FT_Set_MM_WeightVector, FT_Get_MM_WeightVector): New API functions. * include/freetype/internalservices/svmm.h (FT_Set_MM_WeightVector_Func, FT_Get_MM_WeightVector_Func): New function types. (MultiMasters): Add `set_mm_weightvector' and `get_mm_weightvector' members. (FT_DEFINE_SERVICE_MULTIMASTERSREC): Updated. * src/cffcffdrivr.c (cff_set_mm_weightvector, cff_get_mm_weightvector): New functions. (cff_service_multi_masters): Register them. * src/truetype/ttdriver.c (tt_service_gx_multi_masters): Updated. This driver doesn't use the new interface. * src/type1/t1load.c (T1_Set_MM_WeightVector, T1_Get_MM_WeightVector): New functions. * src/type1/t1driver.c (t1_service_multi_masters): Register them. * src/type1/t1load.h: Updated.
* * src/type1/t1load.c (t1_set_mm_blend): Optimized.Alexei Podtelezhnikov2018-10-311-9/+16
|
* Avoid endless loop while tracing (#54858).Werner Lemberg2018-10-201-7/+13
| | | | | * src/type1/t1load.c (parse_buildchar): Guard tracing stuff with FT_DEBUG_LEVEL_TRACE.
* Fix handing of `FT_Bool'.Werner Lemberg2018-09-251-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | Before this commit we had code like (FT_Bool)( globals->glyph_styles[gindex] & 0x8000) Since `FT_Bool' is defined to be an `unsigned char', the code evaluated to something like (unsigned char)( 0x8532 & 0x8000) which in turn expanded to (unsigned char)( 0x8000) and finally yielded 0x00 – i.e., false – not as expected. Problem reported and analyzed by Tony Smith <tony.smith@macro4.com>. * include/freetype/fttypes.h (FT_BOOL): Add a comparison against zero so that we always have a Boolean expression. */*: Replace castings to `FT_Bool' with calls to `FT_BOOL' where possible.
* Don't use `trace_' prefix for FT_COMPONENT arguments.Werner Lemberg2018-08-151-1/+1
| | | | | | | | * include/freetype/internal/ftdebug.h (FT_TRACE_COMP, FT_TRACE_COMP_): New auxiliary macros to add `trace_' prefix. (FT_TRACE): Use `FT_TRACE_COMP'. */* (FT_COMPONENT): Updated.
* Fix clang warnings.Werner Lemberg2018-08-041-1/+1
| | | | | | | | | | | | * src/base/ftoutln.c (FT_Outline_EmboldenXY): Fix type of `orientation'. * src/gxvalid/gxvcommn.c (gx_lookup_value_read): Fix signature. * src/pcf/pcfread.c (pcf_get_encodings): Fix type of some variables. Add cast. * src/type1/t1load.c (parse_weight_vector): Fix cast.
* * src/cid/cidtoken.h: Handle `XUID' keyword.Werner Lemberg2018-07-311-1/+1
|
* [psaux, type1] Trace PostScript dictionaries and other things.Werner Lemberg2018-07-251-2/+98
| | | | | | | | | | | | | | | | | | | | | | | | | The tracing of /Encoding, /Subrs, and /Charstrings is rudimentary right now. * src/psaux/psobjs.c (ps_parser_load_field, ps_parser_load_field_table): Add tracing calls. * src/psaux/t1decode.c (t1_decoder_parse_charstrings): Make tracing output more compact. * src/type1/t1gload.c (T1_Compute_Max_Advance, T1_Get_Advances): Add tracing messages. * src/type1/t1load.c (parse_blend_axis_types, parse_blend_design_positions, parse_blend_design_map, parse_weight_vector, t1_load_keyword, t1_parse_font_matrix, parse_encoding, parse_subrs, parse_charstrings, T1_Open_Face): Add tracing calls. * src/type1/t1objs.c (T1_Face_Init): Add tracing call. * src/sfnt/sfobjs.c (sfnt_init_face): Make tracing message more verbose.
* [type1] Check relationship between number of axes and designs.Werner Lemberg2018-07-241-9/+16
| | | | | | | | | | | | | | For Multiple Masters fonts We don't support intermediate designs; this implies that number_of_designs == 2 ^^ number_of_axes Reported as https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=9557 * src/type1/t1load.c (T1_Open_Face): Ensure above constraint. (T1_Get_MM_Var): Remove now redundant test.
* New base function `FT_Matrix_Check' (#54019).Werner Lemberg2018-06-241-0/+7
| | | | | | | | | | | | * src/base/ftcalc.c (FT_Matrix_Check): New base function to properly reject degenerate font matrices. * include/freetype/internal/ftcalc.h: Updated. * src/cff/cffparse.c (cff_parse_font_matrix), src/cid/cidload.c (cid_parse_font_matrix), src/type1/t1load.c (t1_parse_font_matrix), src/type42/t42parse.c (t42_parse_font_matrix): Use `FT_Matrix_Check'.
* [GSoC] src/*.*: Convert block comments to `light' style.Werner Lemberg2018-06-031-92/+92
| | | | | | | | | | | 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.
* [cff, type1] Sanitize `BlueFuzz' and `BlueShift'.Werner Lemberg2018-04-041-0/+18
| | | | | | | | | | | | 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.
* Update copyright year.Werner Lemberg2018-01-021-1/+1
|
* Speed up FT_Set_Var_{Design,Blend}_Coordinates if curr == new.Werner Lemberg2017-12-201-2/+10
| | | | | | | | | | | | | | We exit early if the current design or blend coordinates are identical to the new ones. * src/truetype/ttgxvar.c (tt_set_mm_blend, TT_Set_Var_Design): Implement it, returning internal error code -1 if there will be no variation change. * src/type1/t1load.c (t1_set_mm_blend): Ditto. * src/base/ftmm.c (FT_Set_Var_Design_Coordinates, FT_Set_MM_Blend_Coordinates, FT_Set_Var_Blend_Coordinates): Updated.
* Allow (again) encoding vectors with more than 256 elements (#52464).Werner Lemberg2017-11-271-16/+18
| | | | | | | | | | In version 2.6.1, this has been disallowed to better reject malformed fonts; however, this restriction was too strong. This time, we only take the first 256 elements into account, since encoding arrays are always accessed with a 8bit integer, according to the PostScript Language Reference. * src/type1/t1load.c (parse_encoding): Implement it.
* Make `FT_Set_Named_Instance' work.Werner Lemberg2017-10-071-0/+12
| | | | | | | | | | | | | | * src/cff/cffdrivr.c (cff_set_instance): New function. (cff_service_multi_masters): Register it. * src/truetype/ttgxvar.c (TT_Set_Named_Instance): New function. * src/truetype/ttgxvar.h: Updated. * src/truetype/ttdriver.c (tt_service_gx_multi_masters): Register it. * src/type1/t1load.c (T1_Reset_MM_Blend): New function. * src/type1/t1load.h: Updated. * src/type1/t1driver.c (t1_service_multi_masters): Register it.
* Make `FT_FACE_FLAG_VARIATION' work.Werner Lemberg2017-10-071-2/+24
| | | | | | | | | | | | | | | | | | | | * 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'.
* [type1] Minor code shuffling.Werner Lemberg2017-10-071-3/+12
| | | | | | * src/type1/t1load.c (T1_Set_MM_Blend): Make it a wrapper of... (t1_set_mm_blend): ...this new function. (T1_Set_MM_Design): Use `t1_set_mm_blend'.
* [cff, truetype] Integer overflows.Werner Lemberg2017-06-031-2/+2
| | | | | | | | | | | | | Reported as https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2047 https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2057 * src/cff/cf2hints.c (cf2_hintmap_map): Use OVERFLOW_SUB_INT32. * src/truetype/ttinterp.c (Ins_ADD): Use OVERFLOW_ADD_LONG. (Ins_SUB): Use OVERFLOW_SUB_LONG. (Ins_NEG): Use NEG_LONG.
* Update copyright year.Werner Lemberg2017-01-041-1/+1
|
* [truetype, type1] Implement `FT_Get_Var_Design_Coordinates'.Werner Lemberg2016-12-271-5/+27
| | | | | | | * src/truetype/ttgxvar.c (TT_Get_Var_Design): Implement. (TT_Set_Var_Design): Fix tracing. * src/type1/t1load.c (T1_Get_Var_Design): Implement.
* Replace `++foo' and `--foo' with `foo++' and `foo--', resp.Werner Lemberg2016-12-261-5/+5
|
* More code formatting.Werner Lemberg2016-12-171-1/+1
|
* Add `FT_Get_Var_Design_Coordinates' function.Dave Arnold2016-12-061-0/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | 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.