aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
27 hours* src/pshinter/pshrec.c (ps_hints_stem): Correct argument.upstream-masterAlexei Podtelezhnikov
4 days[psaux] Fix location and type order in initializerBen Wagner
`T1_FIELD_ZERO` is used to zero initialize a `T1_FieldRec`. `T1_FIELD_ZERO` is currently initilizing `T1_FieldRec::location` with a `T1_FieldType` and `T1_FieldRec::type` with a `T1_FieldLocation`. This was detected with `-Wenum-conversion`. * include/freetype/internal/psaux.h (T1_FIELD_ZERO): correct order of initalizers
4 days* include/freetype/internal/psaux.h: Fix g++ warning.Alexei Podtelezhnikov
Reported by Hin-Tak Leung.
4 days[colr] Avoid overflow in range checksBen Wagner
In 32 bit builds `FT_ULong` is 32 bits and can silently overflow when a large number is read into one and then it is summed or multiplied with another number. Checks for range overflow must be written so that they themselves do not overflow. Also ensure that the table_size is always the first part of the range check and consistently use `<` or `<=`. * src/sfnt/ttcolr.c (tt_face_load_colr): Avoid overflow. (find_base_glyph_v1_record): Remove old work-around. Bug: https://issues.chromium.org/issues/41495455 Bug: https://issues.chromium.org/issues/40945818
5 days.mailmap: Fix entry for Ben Wagner.Werner Lemberg
6 days[sdf, bsdf] Use shared FT_SqrtFixed. Alexei Podtelezhnikov
FT_SqrtFixed (95b0fe2a6dff) is faster and does not overflow. * src/sdf/ftsdfcommin.h (square_root): Replace with a macro. * src/sdf/ftsdfcommin.c (square_root): Remove function.
7 days* src/autofit/aflatin.c (af_latin_metrics_scale_dim): Remove FT_ABS.Alexei Podtelezhnikov
See https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=68679
9 days* src/sfnt/sfwoff2.c (woff2_open_font): Fix copy-paste typo.Alexei Podtelezhnikov
9 days[woff,woff2] Limit the number of tables and use FT_MSB. Alexei Podtelezhnikov
The upper limit of 4095 is implied by the SFNT header format where the multiplication by 16 would overflow without it. * src/sfnt/sfwoff.c (woff_open_font): Updated. * src/sfnt/sfwoff2.c (woff2_open_font): Ditto.
9 days[woff2] Disallow zero table font entriesBen Wanger
The existing code already disallows zero table woff2 overall, but still allows for individual CollectionFontEntry to create font instances with zero tables. Such fonts are not useful so error early. This also fixes an MSAN discovered issue where if a CollectionFontEntry numTables is zero then the sfnt_header was not fully initialized. * src/sfnt/sfwoff2.c (woff2_open_font): error on zero tables, always initalize sfnt_header Fixes: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=68384
10 days[sfnt] Use faster macros in checksums.Alexei Podtelezhnikov
* src/truetype/ttobjs.c (tt_synth_sfnt_checksum): Use FT_NEXT_XXX. * src/sfnt/sfwoff2.c (compute_ULong_sum): Use macros.
11 days* src/sfnt/sfwoff2.c (compute_ULong_sum): Clean up.Alexei Podtelezhnikov
12 days* docs/CHANGES: Updated.Alexei Podtelezhnikov
12 days* src/cache/ftccache.c (FTC_Cache_RemoveFaceID): Remove nodes instantly.Alexei Podtelezhnikov
12 days[cache] Remove unused `node_reset`.Alexei Podtelezhnikov
* src/cache/ftcmru.h (FTC_MruListClassRec): Remove `node_reset` field. * src/cache/ftcbasic.c (ftc_basic_{image,sbit}_family_class): Ditto. * src/cache/ftcmanag.c (ftc_face_list_class): Ditto. (ftc_size_node_reset): Remove function. * src/cache/ftcglyph.h: Fix comment.
12 days* src/cache/ftcmru.c (FTC_MruList_New): Do not reset nodes.Alexei Podtelezhnikov
Resetting of the size nodes can crash, if a parent face purge happens simultaneously and destroys the node. It is safer to create a new node. Fixes #1270, reopened with a separate issue.
2024-04-27* src/cache/ftcimage.c (ftc_inode_weight): Formatting.Alexei Podtelezhnikov
2024-04-27Document the SDF spread further.Alexei Podtelezhnikov
2024-04-22* include/freetype/ftdriver.h: s/truncated/clamped/.Alexei Podtelezhnikov
2024-04-22Improve SDF documentation.Alexei Podtelezhnikov
2024-04-21[cache] Minor tweaks.Alexei Podtelezhnikov
* src/cache/ftcimage.c (ftc_inode_free): Remove unnecessary check. * src/cache/ftcmanag.c (FTC_Manager_Done): Do not zero before freeing.
2024-04-20* src/cache/ftcbasic.c: Cosmetic harmonization.Alexei Podtelezhnikov
2024-04-20[cache] Reduce type mismatches.Alexei Podtelezhnikov
* src/cache/ftcbasic.c (FTC_BasicAttrRec): Match type of `load_flags` to its main purpose in `FT_Load_Glyph`. (FTC_ImageCache_Lookup{,Scaler},FTC_SBitCache_Lookup{,Scaler}): Updated.
2024-04-19* src/cache/{ftcbasic.c,ftccmap.c}: Use FTC_INLINE.Alexei Podtelezhnikov
2024-04-19[cache] Tweak headers.Alexei Podtelezhnikov
* src/cache/ftccback.h: Include less and move `ftc_node_destroy`... * src/cache/ftccache.h: ... to here. * src/cache/ftcmanag.c: Include less.
2024-04-18* src/cache/ftcglyph.c [!FTC_INLINE]: Fix compilation.Alexei Podtelezhnikov
2024-04-17[cache] Improve MRU list management. Alexei Podtelezhnikov
* src/cache/ftcmru.c (FTC_MruList_Remove): Cosmetic. (FTC_MruList_New): Accept only valid changes. * src/cache/ftcmanag.c (ftc_size_node_done): Simplify.
2024-04-17[cache] Fix error handling.Alexei Podtelezhnikov
Manipulate the cache after a face is requested or a size is looked up successfully. Fixes #1270. * src/cache/ftcmanag.c (ftc_size_node_init, ftc_size_node_reset, ftc_face_node_init): Check for errors before accepting a change. * src/cache/ftcmru.c (FTC_MruList_New): Do nothing if reset fails.
2024-04-14[smooth] Switch to vertical bisections.Alexei Podtelezhnikov
With horizontal bisections, the smallest section is a whole single scanline. Almost horizontal lines or other complex scanlines can easily overflow the rendering pool. Switching to vertical bisections splits the scanlines and should rule out the overflows. Fixes #1269. * src/smooth/ftgrays.c (gray_convert_glyph): Bisect vertically.
2024-04-14* src/smooth/ftgrays.c (gray_convert_glyph): Refactor for convenience.Alexei Podtelezhnikov
2024-04-14[smooth] Store persistent clipping box.Alexei Podtelezhnikov
* src/smooth/ftgrays.c (gray_TWorker, gray_raster_render): Add and set the new structure field. (gray_convert_glyph): Use it.
2024-03-08[colr] Ensure enough bytes for PaintColrLayersBen Wanger
* src/sfnt/ttcolr.c (read_paint): check that there are five additional bytes to be read when reading PaintColrLayers. Reported as https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=66566
2024-03-08Avoid n^2 scanning for binary data.Ben Wagner
When creating a CID parser the location of the 'StartData' or '/sfnts' tokens needs to be known. However, the token parser requires that the entire document be in memory and flattening the entire stream into memory is to be avoided. To avoid forcing the entire stream into memory, previously this code would scan through the stream looking for 'StartData' or '/sfnts' as strings. However, these strings could have been in a comment or string token, so the stream would be read into memory up to that point and the parser run to check that these strings were actually tokens. This forced a parser restart from the beginning each time; as a result, data with many 'StartData' non-tokens would take n^2 time to check. * src/cid/cidparse.c (cid_parser_new): Change algorithm to make the initial scan look for the last possible 'StartData' or '/sfnts' string in the stream. The stream is read forward instead of backward as a typical normal CID font will have one 'StartData' toward the beginning of the data and it it much faster to read the data from beginning to end instead of end to beginning. For memory-based fonts the limit is set to the end of the stream since the stream is already in memory. Then the parser is run once to look for 'StartData' or '/sfnts' tokens. If they are found the parser is re-set to reflect this new information. Reported as https://issues.chromium.org/issues/40201695
2024-03-06* CMakeLists.txt: Bump required version to 3.5. Alexei Podtelezhnikov
Fixes #1267.
2024-03-04meson: Use the standard dependency mechanism to find bzip2Jordan Williams
This follows standard conventions in Meson by using the pkg-config file. This change allows Conan to switch to the Meson build system.
2024-02-29[cff, truetype] Always set up default variable instance.Ben Wanger
For default variable instances `cff_face_init` did not set the blend. This mostly worked as later use of the unset blend produced the default variation. However, if a user called `TT_Get_MM_Var` the blend would be partially set up, but not fully. In particular the number of axes, the axis definitions, and the instance locations would be set up, but not the current instance location (`coords` and `normalizedcoords`). This could lead to the default instances of CFF2 fonts erroring on any use of `blend`. Ensure the default variable instance is fully set up by always calling `FT_Set_Named_Instance` on a variable face. * src/cff/cffobjs.c (cff_face_init): Call `FT_Set_Named_Instance` on default instances. * src/truetype/ttobjs.c (tt_face_init): Ditto. Fixes #1268.
2024-02-23* src/truetype/ttgxvar.c (ft_var_to_normalized): Integer overflow.Werner Lemberg
Reported as https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=66543
2024-01-27Update all copyright notices.Alexei Podtelezhnikov
2024-01-27* src/sfnt/ttgpos.c (tt_gpos_get_glyph_class): Fix warning C4018.Alexei Podtelezhnikov
2024-01-27Add support for kerning from 'GPOS' tables.David Saltzman
This commit adds support for kerning from 'GPOS' tables, while maintaining support for basic 'kern' tables. `FT_HAS_KERNING` will be true for a font with either available and `FT_Get_Kerning` will still use the basic 'kern' table data if avilable, otherwise check the GPOS 'kern' feature. This feature is disabled by default; it can be enabled with the `TT_CONFIG_OPTION_GPOS_KERNING` flag. Only basic kerning (pair positioning with just an x advance) is supported from the GPOS layout features; support for that was added to make the existing `FT_Get_Kerning` API more consistently functional. FreeType does not intend to extend itself to further GPOS functionality though; a higher-level library like HarfBuzz can be used instead for that. * include/freetype/config/ftoption.h, include/devel/ftoption.h (TT_CONFIG_OPTION_GPOS_KERNING): New configuration option. * include/freetype/internal/fttrace.h: Add `ttgpos` trace handler. * include/freetype/internal/sfnt.h (SFNT_Interface): Add `load_gpos` and `get_gpos_kerning` fields. (FT_DEFINE_SFNT_INTERFACE): Updated. * include/freetype/internal/tttypes.h: Include `fttypes.h`. (TT_FaceRec) [TT_CONFIG_OPTION_GPOS_KERNING]: Add `gpos_table` and `gpos_kerning_available` fields. * src/sfnt/ttgpos.c, src/sfnt/ttgpos.h: New files. * src/sfnt/sfdriver.c [TT_CONFIG_OPTION_GPOS_KERNING]: Include `ttgpos.h`. (sfnt_interface): Updated. * src/sfnt/sfnt.c: Include `ttgpos.c`. * src/sfnt/sfobjs.c [TT_CONFIG_OPTION_GPOS_KERNING]: Include `ttgpos.h`. (sfnt_load_face) [TT_CONFIG_OPTION_GPOS_KERNING]: Load and free GPOS kerning data; check GPOS kerning availability. * src/truetype/ttdriver.c (tt_get_kerning): Use GPOS kerning if there's no 'kern' table.
2024-01-14[smooth] Remove SSE2.Alexei Podtelezhnikov
As a result of 7b308a29dd10, the regular 64-bit execution is now faster than SSE2. The rendering speed of script fonts at 64 ppem or larger is improved by about 3% without SSE2. See !314 for the testing results. * src/smooth/ftgrays.c (gray_render_conic)[FT_INT64]: Remove SSE2 code.
2024-01-13* CMakeLists.txt: Accommodate MingGW.Alexei Podtelezhnikov
See https://github.com/StephanTLavavej/mingw-distro/issues/97.
2024-01-08* src/sfnt/ttcolr.c (find_base_glyph_v1_record): Fix build in C90 mode.Ozkan Sezer
2024-01-06[base] Fix up Mac resource forks and dfonts.Alexei Podtelezhnikov
* src/base/ftobjs.c (IsMacResource): Assign `face_index`. * src/base/ftmac.c (FT_New_Face_From_Suitcase): Ditto after rework.
2024-01-04[sfnt] Restrict POST version 1.0.Alexei Podtelezhnikov
A font has surfaced with `post` version 1.0 and fewer than 258 glyphs. Its glyphs did not correspond to their names. We now reject such `post` strictly following specifications. * src/sfnt/ttpost.c (tt_face_get_ps_name): Check the number of glyphs for version 1.0.
2024-01-03* .gitlab-ci.yml: Use detached CI pipelines. Alexei Podtelezhnikov
See issue freedesktop/freedesktop#540.
2024-01-02[sfnt] Guard access in 'COLR' v1 glyph binary search.Werner Lemberg
Reported as https://bugs.chromium.org/p/chromium/issues/detail?id=1505216 * src/sfnt/ttcolr.c (find_base_glyph_v1_record): Guard access of the search pointer during binary search. The pointer needs to be checked as we go as the test that compares number of v1 glyphs with table size at the time of loading the table is not sufficient on its own. A scenario is possible in which the `BaseGlyphRecord` list extends into non-`BaseGlyphRecord` parts of the 'COLR' v1 table (but passed the size comparison check). Then, at those locations, invalid glyph ID values are read and may provoke an invalid read due to reassigning min and max values during the binary search.
2023-12-18[ci] Add support for MSBuild on Windows.Alexei Podtelezhnikov
This adds msbuild job for VS2019 (x64). * .gitlab-ci.yml: Added "windows msbuild vs2019 amd64".
2023-12-14[CFF] Extract `BlueValues` as `Fixed` rather than `Int`.Skef Iterum
This is a follow-up to commit 26a7f047, [cff] Make blend operator work with floats in private dicts. which addressed the 'party baseline' bug. However, the reporting user indicated that the default location and some other points in design space rendered OK, but other points in design space still had problems. The most obvious issue being that the x-heights of lower-case letters did not align; see https://github.com/adobe-fonts/source-serif/issues/121#issuecomment-1773794136 After some analysis we determined that this was due to an interaction between `BlueValue` rounding and the zone-based algorithm. In short, for a point to be considered in a zone it must fall within the bounds of the zone. (There is a slop factor in some cases, but only a very small one.) In the Adobe-contributed side of the code, point values are not integer-rounded, instead they're kept as (some form of) fixed. Rounding just the `BlueValues` means that points that need to be considered within a zone will fall outside of it at some points in design space. The majority of this patch changes the storage and parsing of `BlueValues` to keep them as `FT_Fixed`. No significant code changes were needed because the values are converted to `Fixed` anyway when stored in `CF_BlueRec`. No attempt was made to address problems in the older pshinter code beyond converting the values from `FT_Fixed` to `FT_Short` when copying the private dictionary. (However, as the point values are also rounded in that code, the problem is much less likely to occur, although inconsistency between rounding and truncation could cause an analogous problem.) * include/freetype/internal/cfftypes.h (CFF_PrivateRec): Use `FT_Fixed` for `blue_values`, `other_blues`, `family_blues`, and `family_other_blues`. * src/cff/cffload.c (cff_blend_doBlend): Updated. * src/cff/cffobjs.c (CFF_fixedToInt): New macro. (cff_make_private_dict): Use it. * src/cff/cffparse.h (cff_kind_delta_fixed): New enum value. * src/cff/cffparse.c (do_fixed): Updated. (CFF_FIELD_DELTA, CFF_FIELD_DELTA_FIXED, CFF_DELTA_KIND): New set of macros, replacing `CFF_FIELD_DELTA`. (cff_parser_run): Updated to handle fixed-float deltas. * src/cff/cfftoken.h: Updated to use `CFF_FIELD_DELTA_FIXED` for blue values. * src/psaux/psblues.c (cf2_blueToFixed): Removed, no longer needed. (cf2_blues_init): Updated. * src/pxaux/psft.c, src/pxaux/psft.h (cf2_getBlueValues, cf2_getOtherBlues, cf2_getFamilyBlues, cf2_getFamilyOtherBlues): Updated signatures. * src/psaux/psobjs.c (t1_make_subfont): Updated.
2023-12-14[psaux] Improve tracing.Skef Iterum
* src/psaux/psintrp.c (cf2_doBlend, cf2_interpT2CharString [cf2_cmdBLEND]): Show blended values.