summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* [truetype] Fix style name handling for variation fonts.VF-fixesWerner Lemberg2023-05-063-2/+25
| | | | | | | | | | | * include/freetype/internal/tttypes.h (TT_FaceRec): New field `non_var_style_name`. * src/sfnt/sfobjs.c (sfnt_load_face): Initialize `non_var_style_name`. (sfnt_done_face): Free `non_var_style_name`. * src/truetype/ttgxvar.c (TT_Set_Named_Instance): Restore non-VF style name if switching back to non-VF mode.
* [truetype] Fix PostScript name handling for variation fonts.Werner Lemberg2023-05-068-38/+123
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A variation font's PostScript name of a named instance is usually different from the PostScript name of an unnamed instance. However, if a change between a named instance and an unnamed instance with exactly the same design axis values happened, it was possible that the PostScript name wasn't correctly updated. This commit reorganizes the code to handle this issue within the top-level API functions, using a new service to trigger recomputation of the PostScript name. * include/freetype/internal/services/svmm.h (FT_Construct_PS_Name_Func): New typedef. (FT_Service_MultiMasters): New field `construct_ps_name`. (FT_DEFINE_SERVICE_MULTIMASTERSREC): Updated. * src/base/ftmm.c (FT_Set_Var_Design_Coordinates, FT_Set_MM_Blend_Coordinates, FT_Set_Var_Blend_Coordinates): Call `mm->construct_ps_name` to handle `postscript_name`. (FT_Set_Named_Instance): Call `mm->construct_ps_name` to handle `postscript_name`. Use shortcut. * src/cff/cffdrivr.c (cff_construct_ps_name): New function. (cff_service_multi_masters): Updated. * src/truetype/ttgxvar.c (tt_set_mm_blend): Don't handle `postscript_name`. (TT_Set_MM_Blend): Simplify. (TT_Set_Named_Instance): Return -1 if axis values haven't changed. Don't set `face_index`. (tt_construct_ps_name): 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. * src/type1/t1load.c (T1_Set_MM_Blend): Simplify.
* * include/freetype/internal/services/svmm.h: Minor changes.Werner Lemberg2023-05-061-5/+5
|
* [truetype] Fix deactivation of variation font handling.Werner Lemberg2023-05-066-46/+49
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | According to the documentation, the functions `FT_Set_Named_Instance`, `FT_Set_MM_Design_Coordinates`, `FT_Set_Var_Design_Coordinates`, and `FT_Set_Var_Blend_Coordinates` can unset the `FT_FACE_FLAG_VARIATION` flag. (The same is true for `FT_Set_MM_WeightVector` but this information was accidentally omitted from the documentation.) However, if a call of these functions didn't change the axis values this could fail because internal shortcuts exited too early. This commit reorganizes the code to handle `FT_FACE_FLAG_VARIATION` in the top-level API functions, also taking care of the issue at hand. * src/base/ftmm.c (FT_Set_MM_Design_Coordinates, FT_Set_MM_WeightVector, FT_Set_Var_Design_Coordinates, FT_Set_MM_Blend_Coordinates, FT_Set_Var_Blend_Coordinates): Handle `FT_FACE_FLAG_VARIATION`. * src/truetype/ttgxvar.c (TT_Set_MM_Blend, TT_Set_Var_Design, TT_Set_Named_Instance) Don't handle `FT_FACE_FLAG_VARIATION`. * src/type1/t1load.c (T1_Set_MM_Blend, T1_Set_MM_WeightVector, T1_Set_MM_Design): Ditto. * src/cff/cffobjs.c (cff_face_init): Use `FT_Set_Named_Instance` instead of low-level functions. * src/truetype/ttobjs.c (tt_face_init): Ditto.
* s/set_instance/set_named_instance/Werner Lemberg2023-04-286-14/+18
| | | | | | | | | | | | | | | | | | | * include/freetype/internal/services/svmm.h (FT_Set_Instance_Func): Renamed to... (FT_Set_Named_Instance_Func): ...this. (FT_Service_MultiMasters): Rename `set_instance` to `set_named_instance`. (FT_DEFINE_SERVICE_MULTIMASTERSREC): Updated. * src/base/ftmm.c (FT_Set_Named_Instance): Updated. * src/cff/cffdrivr.c (cff_set_instance): Renamed to... (cff_set_named_instance): ...this. (cff_service_multi_masters): Updated. * src/cff/cffobjs.c (cff_face_init): Updated. * src/truetype/ttdriver.c (tt_service_gx_multi_masters): Updated. * src/type1/t1driver.c (t1_service_multi_masters): Updated.
* New Variation Font function `FT_Get_Default_Named_Instance`.Werner Lemberg2023-04-2811-91/+249
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | * include/freetype/ftmm.h, src/base/ftmm.c (FT_Get_Default_Named_Instance): New function. * include/freetype/internal/services/svmm.h (FT_Get_Default_Named_Instance_Func): New typedef. (FT_Service_MultiMasters): New field `get_default_named_instance`. (FT_DEFINE_SERVICE_MULTIMASTERSREC): Updated. * include/freetype/internal/tttypes.h (TT_Face): New field `var_default_named_instance`. * src/sfnt/sfobjc.s (sfnt_init_face): Initialize `var_default_named_instance`. * src/cff/cffdrivr.c (cff_get_default_named_instance): New function. (cff_service_multi_masters): Updated. * src/truetype/ttgxvar.c (TT_Get_MM_Var): Initialize `var_default_named_instance`. (TT_Get_Default_Named_Instance): 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. * docs/CHANGES: Updated.
* * src/cff/cffdrivr.c (cff_ps_get_font_info): Reject 'CFF2' format.Werner Lemberg2023-04-281-0/+6
|
* * src/cid/cidgload.c (cid_load_glyph): Fix compiler warnings.Werner Lemberg2023-04-281-2/+2
|
* Minor documentation updates.Werner Lemberg2023-04-283-23/+34
|
* * src/ttgxvar.c: Minor changes.Werner Lemberg2023-04-272-19/+22
| | | | | (TT_Get_MM_Var): Improve tracing messages. (tt_set_mm_blend): Minor speed-up.
* s/this is,/that is,/Werner Lemberg2023-04-2716-28/+28
|
* [bdf] Clean up the atom property parsing.Alexei Podtelezhnikov2023-04-262-31/+25
| | | | | | | | * src/bdflib.c (bdf_is_atom_): Refactor code with fewer checks. (bdf_list_join_): Return NULL. (bdf_add_comment_): Use const argument. (bdf_get_property): Ditto, ditto, make the function static. * src/bdf.h (bdf_get_property): Remove prototype.
* Improve/add source comments and documentation.Werner Lemberg2023-04-252-10/+12
|
* [sfnt] Fix handling of PS names for Variation Fonts.Werner Lemberg2023-04-251-8/+6
| | | | | | | * src/sfnt/sfdriver.c (get_win_string, get_apple_string): Continue construction of string if an invalid character is encountered. Fixes #1218.
* [t1cid] Change the trace messages of the charstrings retrieval errors.suzuki toshiya2023-04-241-5/+40
| | | | | | | | | | | | | | | | | | | The t1cid driver catches 3 types of errors in the charstrings retrieval; A) The invalid FD number, there are 2 subtypes; A-1) FD number is the maximum number fitting to FDBytes. A-2) FD number is greater than num_dicts. B) Declared length is overrunning. C) Declared length is invalid (its end is before its head). Considering that some widely distributed fonts (e.g., "CJKV" book by O'Reilly) have A-1 errors in the unimplemented glyphs, the trace level for A-1 is calmed to level 1. The errors A-2, B, and C would be irregular; their trace levels are kept at level 0, but the updated trace messages include the CID number.
* [truetype] Fix `make multi'.suzuki toshiya2023-04-241-0/+1
| | | | | * src/truetype/ttgxvar.c: Include freetype/internal/services/svmetric.h for the FT_Service_MetricsVariations type definition.
* [services] FT_Size_Reset_Func to return FT_ErrorBen Wagner2023-04-191-1/+1
| | | | | | | | | | | | | | The `MetricsVariations` `FT_Size_Reset_Func` is currently defined to return `void`, but the implementations return `FT_Error`. Even though the pointers passed will be the same at runtime, calling a function through a pointer of a different type from the original function pointer type is undefined behavior. This may be caught at runtime by Control Flow Integrity with something like clang's `cfi-icall`. Issue: https://crbug.com/1433651 * include/freetype/internal/services/svmetric.h (FT_Size_Reset_Func): return `FT_Error` instead of `void`.
* [truetype] tt_size_reset_height to take FT_SizeBen Wagner2023-04-172-5/+9
| | | | | | | | | | | | | | | | | | The `MetricsVariations` `FT_Size_Reset_Func` is defined to take an `FT_Size`. Because `tt_size_reset_height` is to be used as such a function, it must also take an `FT_Size` instead of a `TT_Size`. Even though the pointers passed will be the same at runtime, calling a function through a pointer of a different type from the original function pointer type is undefined behavior. This may be caught at runtime by Control Flow Integrity with something like clang's `cfi-icall`. Issue: https://crbug.com/1433651 * src/truetype/ttobjs.h (tt_size_reset_height): take `FT_Size` * src/truetype/ttobjs.c (tt_size_reset_height): take `FT_Size` and update documentation
* * src/truetype/ttinterp.c: Remove outdated comments.Werner Lemberg2023-04-131-10/+0
|
* [sfnt, truetype] Add `size_reset` to `MetricsVariations`.Ben Wagner2023-04-1110-56/+93
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a generalization of commit ``` commit e6699596af5c5d6f0ae0ea06e19df87dce088df8 Author: Werner Lemberg <wl@gnu.org> Date: Thu Feb 2 11:38:04 2017 +0100 [truetype] Fix MVAR post-action handling. ``` It is also possible for plain `CFF ` style fonts to contain an `fvar` and `MVAR` table and use `cff_metrics_adjust`. `tt_size_reset` should only be called with `TT_Size` and never with `CFF_Size`. Allow the "metrics-variations" service to specify the correct function (if any) to reset `FT_Size`s after adjusting metrics. * src/truetype/ttobjs.c (tt_size_reset): Split off some functionality into... (tt_size_reset_height): ... this new function. * src/truetype/ttdriver.c (tt_service_metrics_variations): Add `size_reset`. (tt_size_select, tt_size_request): Updated. * src/truetype/ttobjs.h: Updated. * include/freetype/internal/services/svmetric.h (MetricsVariations): Add `size_reset`. (FT_DEFINE_SERVICE_METRICSVARIATIONSREC): Updated. * include/freetype/internal/tttypes.h (TT_FaceRec_): Rename `var` to `tt_var` and add `face_var`. * src/cff/cffdrivr.c (cff_service_metrics_variations): Add `size_reset`. (cff_hadvance_adjust, cff_metrics_adjust): Updated. * src/cff/cffobjs.c (cff_face_init): Use `face_var`. * src/sfnt/sfobjs.c (sfnt_init_face): Initialize `face_var`. * src/sfnt/ttmtx.c (tt_face_get_metrics): Use `tt_var`. * src/truetype/ttgxvar.c (tt_size_reset_iterator): Renamed to... (ft_size_reset_iterator): ... this new function. Call `size_reset`. (tt_apply_mvar): Pass `size_reset` to `ft_size_reset_iterator`. Fixes #1211
* * src/cff/cffcmap.c (cff_cmap_encoding_char_next): Abbreviate.Alexei Podtelezhnikov2023-04-101-18/+6
|
* Align `char_next` return types.Alexei Podtelezhnikov2023-04-107-19/+19
| | | | | | | This is mostly cosmetic because FT_UInt and FT_UInt32 are likely identical. * src/sfnt/ttcmap.c, src/cff/cffcmap.c, src/psaux/t1cmap.c, src/psnames/psmodule.c, include/freetype/internal/service/svpcsmap.h, src/pfr/pfrcmap.c, src/winfonts/winfnt.c (*_char_next): return FT_UInt.
* [sfnt] Clean up CMAP{4,12,13} handling.Alexei Podtelezhnikov2023-04-081-79/+27
| | | | | | | | | | | This moves the charcode overflow checks upstream and turns some while-loops into the do-while ones to avoid the uninitialized warnings. This should slightly reduce the number of checks and jumps. * src/sfnt/ttcmap.c (tt_cmap{4,12,13}_next, tt_cmap{4.12.13}_char_map_linear): Remove the charcode overflow check. (tt_cmap{4,12,13}_char_map_binary): Ditto and use do-while. (tt_cmap{12,13}_char_next): Add the overflow check.
* * src/sfnt/ttpost.c (load_format_25): Do not abort frame reading.Alexei Podtelezhnikov2023-04-021-4/+1
|
* * src/sfnt/ttpost.c (load_format_*): Streamline frame reading.Alexei Podtelezhnikov2023-04-021-2/+8
|
* * src/sfnt/ttpost.c: Formatting and comments.Alexei Podtelezhnikov2023-04-021-5/+6
|
* [sfnt] Consolidate POST version 2.0 and 2.5 (pt 2).Alexei Podtelezhnikov2023-04-011-107/+61
| | | | | | | * src/sfnt/ttpost.c (load_format_20, load_format_25): Update arguments and move shared calls and checks upstream to... (load_post_names): ... this function. (tt_face_free_ps_names, tt_face_get_ps_name): Updated.
* [sfnt] Consolidate POST version 2.0 and 2.5 (pt 1).Alexei Podtelezhnikov2023-04-012-107/+40
| | | | | | | | | | | The deprecated POST version 2.5 can be handled using the data structures of version 2.0. The goal is to reduce the footprint. * include/freetype/internal/tttypes.h (TT_Post_Names): Absorb and... (TT_Post_20, TT_Post_25): ... remove these structures. src/sfnt/ttpost.c (load_post_names, tt_face_get_ps_name, tt_face_free_ps_names, load_format_20): Updated accordingly. (load_format_25): ditto and convert offsets to glyph indices.
* [sfnt] Miscellaneous POST clean-ups.Alexei Podtelezhnikov2023-03-311-25/+24
| | | | | | | * src/sfnt/ttpost.c (load_format_20): Decrease casts. (load_format_25): Check the table length and impose a theoretical glyph number limit usable with 8-bit offset. Decrease casts. (load_post_names): Pass the mapping data length without 2 bytes.
* * src/sfnt/ttpost.c (load_format_20): Simplify comutations.Alexei Podtelezhnikov2023-03-301-24/+11
|
* [sfnt] Streamline POST format 2.0 handing (cont'd).Alexei Podtelezhnikov2023-03-292-25/+13
| | | | | | | * src/sfnt/ttpost.c (load_format_20): Co-allocate the string data and their pointers, which makes it easier to handle and free them. (tt_face_free_ps_names): Updated. * include/freetype/internal/tttypes.h (TT_Post_20): Update type.
* [cff] Simplify `t2_strings` management in the old engine.Alexei Podtelezhnikov2023-03-202-58/+7
| | | | | | | * src/cff/cffparse.c (cff_parser_run): Allocate the charstring buffers and the list nodes together so that they can be freed at once. (finalize_t2_strings): Removed as no longer needed. (cff_parser_done): Updated.
* [cff] Rework the stream limit checks.Alexei Podtelezhnikov2023-03-191-63/+22
| | | | | | | | | | | | | The old stream limit checks, before 6986ddac1ece, were good but pointless for the crafted t2_strings. Checking limits there is not necessary as they are created to hold all data. By using two conditions, we can detect the actual crossing of the stream boundary as appropriate for the stream pointer only. The t2_strings parsing will not be triggering these checks. * src/cff/cffparse.c (cff_parser_within_limits): Removed. (cff_parse_real, cff_parse_integer): Redesign the stream limit check. (cff_parse_num, do fixed, cff_parse_fixed_dynamic): Update callers.
* * src/truetype/ttgload.c (TT_Load_Simple_Glyph): Use for-loop.Alexei Podtelezhnikov2023-03-171-2/+2
| | | | | Even though we never call `TT_Load_Simple_Glyph` with zero contours, out of abundance of precaution, let's handle this case properly.
* [truetype] Clean up zeroing and local variables.Alexei Podtelezhnikov2023-03-171-29/+18
| | | | | * src/truetype/ttgload.c (TT_Process_Simple_Glyph): Avoid zeroing. (load_truetype_glyph): Avoid zeroing and clean local variables.
* * include/freetype/ftsystem.h (FT_Stream_IoFunc): Improve documentation.Werner Lemberg2023-03-161-12/+4
| | | | Fixes #1208.
* * src/base/ftsynth.c (FT_GlyphSlot_AdjustWeight): New API.Alexei Podtelezhnikov2023-03-162-6/+26
|
* [truetype] Clean up glyph loading.Alexei Podtelezhnikov2023-03-151-25/+14
| | | | | | * src/truetype/ttgload.c (TT_Load_Simple_Glyph): Clean space checking. (TT_Hint_Glyph): Don't copy the outline structure. (TT_Process_Simple_Glyph): Cosmetic update.
* * src/truetype/ttgload.c (TT_Load_Simple_Glyph): Clean up.Alexei Podtelezhnikov2023-03-151-36/+18
|
* builds/vms/apinames_vms.bash: Fix `unzip` artifactWerner Lemberg2023-03-131-0/+0
| | | | | | | | The problem occured when unpacking a zip file created on OpenVMS on Linux. While OpenVMS knows many different file formats, Unix only knows stream-LF and binary. In principle `zip` on Linux should have translated the file to stream-LF but failed to do so. That caused the file to incorrectly contain only one line with control-characters.
* [truetype] Fix recent fallout in memory management.Alexei Podtelezhnikov2023-03-101-33/+30
| | | | | | | * src/truetype/ttgload.c (TT_Process_Composite_Glyph, TT_Load_Simple_Glyph): Clean up old instructions regardless of new ones, postpone setting `control_len` and `control_data` until... (TT_Load_Glyph): ... the exit from this function.
* Update VMS installation support.Jouk Jansen2023-03-106-317/+435
|
* * src/truetype/ttgload.c (TT_Hint_Glyph): Mostly cosmetic update.Alexei Podtelezhnikov2023-03-091-16/+14
| | | | | | The number of instructions is now taken from the executed context. Technically, this means that `control_len` and `control_data` values are no longer _used_ internally but only expose them.
* apinames.c: Add comment.Werner Lemberg2023-03-081-1/+2
|
* [gzip] File `infback.c` is not needed.Werner Lemberg2023-03-072-645/+0
| | | | | * src/gzip/infback.c: Remove. * src/gzip/rules.mk (GZIP_DRV_SRCS): Updated.
* [apinames] Fix VMS handling of overly long function names.Werner Lemberg2023-03-072-7/+270
| | | | | | | | | | | | | | | | Based on ideas from Jouk Jansen <joukj@hrem.nano.tudelft.nl>. * src/tools/vms_shorten_symbol.c: New file, taken from https://sourceforge.net/p/vms-ports/vmsshortsym/ci/default/tree/vms_shorten_symbol.c with some minor edits to allow compilation with C++ and being included in another source code file. * src/tools/apinames.c: Include `vms_shorten_symbol.c`. (PROGRAM_VERSION): Set to '0.5'. (names_dump) [OUTPUT_VMS_OPT]: Call `vms_shorten_symbol` to get unique function identifiers not longer than 31 characters.
* * src/tools/apinames.c (panic): Accept variable number of arguments.Werner Lemberg2023-03-071-2/+14
|
* * src/truetype/ttgload.c (TT_Process_Composite_Glyph): Fix leak too.Alexei Podtelezhnikov2023-03-061-0/+2
|
* * src/truetype/ttgload.c (TT_Load_Simple_Glyph): Triage memory leak.Alexei Podtelezhnikov2023-03-061-0/+2
| | | | | | This leak has been introduced in the previous commit and immediately detected: https://chromium-review.googlesource.com/c/chromium/src/+/4313202
* [truetype] Simplify memory management.Alexei Podtelezhnikov2023-03-063-148/+64
| | | | | | | | | | | | Instead of using `Update_Max`, switch to regular FreeType memory allocation macros, stop pre-allocating the glyph instruction arrays. * src/truetype/ttgload.c (TT_Load_Simple_Glyph, TT_Process_Composite_Glyph): Switch to regular memory allocation. * src/truetype/ttinterp.c (Update_Max): Removed. (TT_Load_Context): Reallocate stack and free old instructions. (Modify_CVT_Check, Ins_WS): Switch to regular memory allocation. * src/truetype/ttinterp.h (Update_Max): Removed.