summaryrefslogtreecommitdiff
path: root/src/sfnt/ttsbit.c
Commit message (Collapse)AuthorAgeFilesLines
* * src/*: Replace leading underscores with trailing ones in dummy variables.Werner Lemberg2023-02-261-1/+1
| | | | This is to avoid clang warnings.
* Fix `FT_LOCAL` and `FT_LOCAL_DEF` tags.Werner Lemberg2023-02-081-1/+1
|
* Fix 'fall-through' warning messages.Werner Lemberg2023-02-081-1/+1
| | | | | | | Modern compilers get more insistent on that... * include/freetype/internal/compiler-macros.h (FALL_THROUGH): Define. * src/*: Use it instead of `/* fall through */` comments.
* Update all copyright notices.Werner Lemberg2023-01-171-1/+1
|
* * src/sfnt/ttsbit.c (tt_face_load_strike_metrics): Simplify calculations.Alexei Podtelezhnikov2022-10-181-21/+12
|
* * src/sfnt/ttsbit.c (tt_face_load_strike_metrics): Use lighter FT_DivFix.Alexei Podtelezhnikov2022-09-291-4/+2
|
* Add `FT_FACE_FLAG_SBIX_OVERLAY` and `FT_HAS_SBIX_OVERLAY`.Werner Lemberg2022-03-251-10/+1
| | | | | | | | * include/freetype/freetype.h (FT_FACE_FLAG_SBIX_OVERLAY, FT_HAS_SBIX_OVERLAY): New macro. * src/sfnt/ttsbit.c (tt_face_load_sbit): Handle `FT_FACE_FLAG_SBIX_OVERLAY`. Remove obsolete tracing message.
* [truetype] Fix 'sbix' table handling.Werner Lemberg2022-03-251-2/+19
| | | | | | | | | | | | | | | | | * src/sfnt/ttsbit.c (tt_face_load_sbix_image): Correct calculation of 'metrics->horiBearingY'. Set vertical metrics. * src/sfnt/sfobjs.c (sfnt_load_face): Adjust setting of `FT_FACE_FLAG_SBIX`. Handle metrics of fonts with 'sbix' table. * src/truetype/ttgload.c (TT_Load_Glyph): For 'sbix' embedded bitmaps, apply bbox offset and bearing values of the corresponding glyph in the 'glyf' table if it exists and has a contour. * src/truetype/ttobjs.c (tt_face_init): Handle font with 'sbix' table. Fixes issue #998.
* Update all copyright notices.Werner Lemberg2022-01-111-1/+1
|
* [sfnt] Avoid 'runtime error: applying zero offset to null pointer'.Werner Lemberg2022-01-071-0/+3
| | | | | * src/sfnt/ttsbit.c (tt_sbit_decoder_load_byte_aligned): Exit early if `line` is NULL.
* * src/*: Don't use more than one '\n' in `FT_TRACE` and `FT_ERROR`.Werner Lemberg2021-02-041-8/+12
| | | | | | | | 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-1/+1
| | | | | | * src/*: Fix format specifiers. * builds/unix/ftsystem.c (FT_Stream_Open): Ditto.
* Remove redundant inclusion of `ft2build.h'.Werner Lemberg2020-06-131-1/+0
| | | | | | | * */*: Remove `#include <ft2build.h>' where possible. * include/freetype/freetype.h: Remove cpp error about missing inclusion of `ft2build.h'.
* Make macros for header file names optional.David Turner2020-06-081-4/+4
| | | | | | | | | | | | | | | | | 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
|
* Update all copyright notices.Werner Lemberg2019-02-231-1/+1
|
* Update copyright years.Werner Lemberg2019-01-221-1/+1
|
* 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.
* * src/sfnt/ttsbit.c (tt_sbit_decoder_load_compound): Follow specs.Alexei Podtelezhnikov2018-08-101-2/+2
|
* [GSoC] src/*.*: Convert block comments to `light' style.Werner Lemberg2018-06-031-29/+29
| | | | | | | | | | | 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.
* [sfnt] Correctly handle missing bitmaps in sbix format (#53404).Ben Wagner2018-03-231-1/+1
| | | | * src/sfnt/ttfsbit.c (tt_face_load_sbix_image): Fix return value.
* Update copyright year.Werner Lemberg2018-01-021-1/+1
|
* Improve tracing messages by using singular and plural forms.Werner Lemberg2017-12-051-2/+3
| | | | * src/*/*.c: Implement it.
* [sfnt, truetype] Improve handling of missing sbits.Werner Lemberg2017-08-111-2/+9
| | | | | | | | | | | | | | | | | | | | Requested by Behdad. Modern bitmap-only SFNTs like `NotoColorEmoji.ttf' don't contain entries in the bitmap strike(s) for empty glyphs. Instead, they rely that a space glyph gets created from the font's metrics data. This commit makes FreeType behave accordingly. * include/freetype/fterrdef.h (FT_Err_Missing_Bitmap): New error code. * src/sfnt/ttsbit.c (tt_sbit_decoder_load_image): Change error codes to make a distinction between a missing bitmap in a composite and a simple missing bitmap. * src/truetype/ttgload.c (TT_Load_Glyph): For a missing bitmap (in a bitmap-only font), synthesize an empty bitmap glyph if metrics are available.
* [sfnt] Return proper scaling values for SBIX bitmaps.Werner Lemberg2017-05-151-0/+9
| | | | | | Problem reported by Hin-Tak Leung <htl10@users.sourceforge.net>. * src/sfnt/ttsbit.c (tt_face_load_strike_metrics): Implement it.
* Improve `make multi'.Werner Lemberg2017-03-181-1/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * src/autofit/aflatin2.c: Guard file with FT_OPTION_AUTOFIT2. * src/base/ftmac.c: Guard more parts of the file with FT_MACINTOSH. * src/psaux/afmparse.c: Guard file with T1_CONFIG_OPTION_NO_AFM. * src/sfnt/pngshim.c: Guard file with TT_CONFIG_OPTION_EMBEDDED_BITMAPS also. * src/sfnt/ttbdf.c: Avoid empty source file. * src/sfnt/ttpost.c: Guard file with TT_CONFIG_OPTION_POSTSCRIPT_NAMES. * src/sfnt/ttsbit.c: Guard file with TT_CONFIG_OPTION_EMBEDDED_BITMAPS. * src/truetype/ttgxvar.c, src/truetype/ttinterp.c: Avoid empty source file. * src/truetype/ttsubpix.c: Guard file with TT_USE_BYTECODE_INTERPRETER also. * src/type1/t1afm.c: Guard file with T1_CONFIG_OPTION_NO_AFM. * src/autofit/autofit.c, src/base/ftbase.c, src/cache/ftcache.c, src/cff/cff.c, src/cid/type1cid.c, src/gxvalid/gxvalid.c, src/pcf/pcf.c, src/pfr/pfr.c, src/psaux/psaux.c, src/pshinter/pshinter.c, src/psnames/psnames.c, src/raster/raster.c, src/sfnt/sfnt.c, src/smooth/smooth.c, src/truetype/truetype.c, src/type1/type1.c, src/type42/type42.c: Remove conditionals; sort entries.
* Fixes for conditional compilation.Werner Lemberg2017-03-171-0/+3
| | | | | | | | | | | | | | | | | | | * src/autofit/afcjk.c, src/autofit/afindic.c: Include `afcjk.h' earlier. * src/sfnt/sfobjs.c (sfnt_init_face): Put `memory' variable into TT_CONFIG_OPTION_GX_VAR_SUPPORT block. (sfnt_done_face): Protect some code with TT_CONFIG_OPTION_GX_VAR_SUPPORT. * src/sfnt/ttsbit.c (tt_face_load_sbix_image): Remove compiler warning. * src/truetype/ttgload.c (TT_Load_Simple_Glyph): Put `tmp' variable into TT_USE_BYTECODE_INTERPRETER block. (tt_loader_init): Put `error' variable into TT_USE_BYTECODE_INTERPRETER block.
* Update copyright year.Werner Lemberg2017-01-041-1/+1
|
* * src/sfnt/ttsbit.c (tt_face_load_sbit): Allow more version values.Werner Lemberg2016-12-241-1/+5
| | | | | | Some fonts seem to have the `version' field in the wrong byte order. Problem reported by 張俊芝 <418092625@qq.com>.
* [sfnt] Improve FT_LOAD_BITMAP_METRICS_ONLY for `sbix' format.Werner Lemberg2016-11-061-8/+13
| | | | | | | | | | | 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.
* [sfnt] Speed up `sbix' lookup.Werner Lemberg2016-11-061-25/+26
| | | | | | | | | | | | | | 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.
* Introduce a way of quickly retrieving (embedded) bitmap metrics.Werner Lemberg2016-11-061-15/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `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.
* [sfnt] Disable bitmap strikes if we don't have a bitmap data table.Werner Lemberg2016-10-011-1/+12
| | | | | * src/sfnt/ttsbit.c (tt_face_load_sbit): Check whether we have a bitmap data table.
* [sfnt] Fix previous commit.Werner Lemberg2016-09-101-10/+21
| | | | | | | | | | | | | | | | | | | Problems reported as https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=40 We now map the strike index right before accessing the physical data, not earlier. * src/sfnt/sfobjs.c (sfnt_load_face): Set `face->sbit_strike_map' after creating the map so that... * src/sfnt/ttsbit.c (tt_face_load_strike_metrics): ... this function can be used before and after setting up `sbit_strike_map'. (tt_face_set_sbit_strike): Revert change. (tt_sbit_decoder_init, tt_face_load_sbix_image): Map strike index. * src/truetype/ttdriver.c (tt_size_select): Revert change.
* [sfnt] Don't provide (completely) broken strike data.Werner Lemberg2016-09-091-2/+10
| | | | | | | | | | | | | | | | | | | | | | | FreeType tries to sanitize strike header data; we now reject completely broken ones. * include/freetype/internal/tttypes.h (TT_FaceRec): New `sbit_strike_map' array pointer. * src/base/ftobjs.c (FT_Match_Size): Reject matches where either width or height would be zero. Add tracing message in case of error. * src/sfnt/sfobjs.c (sfnt_load_face): Populate `sbit_strike_map', only using (more or less) valid strike header data for FT_Face's `available_sizes' array. (sfnt_done_face): Updated. * src/sfnt/ttsbit.c (tt_face_set_sbit_strike): Use `sbit_strike_map'. (tt_face_load_strike_metrics): Improve tracing. * src/truetype/ttdriver.c (tt_size_select): Use `sbit_strike_map'.
* [sfnt] Avoid left shift of negative value (#48980).Werner Lemberg2016-09-021-1/+1
| | | | | * src/sfnt/ttsbit.c (tt_sbit_decoder_load_bit_aligned): Use unsigned constant.
* [sfnt] Cache offset and size to bitmap data table.Werner Lemberg2016-08-261-10/+27
| | | | | | | | | | | | | This commit avoids `EBDT' and friends being looked up again and again while loading a single embedded bitmap. * include/freetype/internal/tttypes.h (TT_FaceRec) [TT_CONFIG_OPTION_EMBEDDED_BITMAPS]: New fields `ebdt_start' and `ebdt_size'. * src/sfnt/ttsbit.c (tt_sbit_decoder_init): Move table lookup to ... (tt_face_load_sbit): ... this function; also store the table size and offset.
* [sfnt] Fix `FT_Get_Advance' for bitmap strikes.Werner Lemberg2016-08-071-0/+10
| | | | | | | | | | | | | | `FT_Get_Advance' returns 0 for bitmap fonts. It first gets the advance value from the font table and then scales it by the `font->size->metrics->x_scale' field. But `FT_Select_Size' doesn't set that value for bitmap fonts and the advance gets scaled to zero. Taken from https://github.com/behdad/harfbuzz/issues/252 * src/sfnt/ttsbit.c (tt_face_load_strike_metrics) <TT_SBIT_TABLE_TYPE_EBLC>: Set scale values.
* Update copyright year.Werner Lemberg2016-01-131-1/+1
|
* [sfnt] Accept version 3 of `EBLC' and `CBLC' tables also.Behdad Esfahbod2015-11-081-1/+2
| | | | * src/sfnt/ttsbit.c (tt_face_load_sbit): Implement it.
* [sfnt] Ignore embedded bitmaps with zero size (#46379).Werner Lemberg2015-11-051-0/+6
| | | | | * src/sfnt/ttsbit.c (tt_sbit_decoder_load_bit_aligned): Implement it.
* [sfnt] Protect against zero-size bitmaps (#46345).Werner Lemberg2015-11-031-1/+2
| | | | | * src/sfnt/ttsbit.c (tt_sbit_decoder_load_bitmap): Check `glyph_size'.
* [sfnt] Handle infinite recursion in bitmap strikes (#46344).Werner Lemberg2015-10-311-21/+47
| | | | | | | | | | | | * src/sfnt/ttsbit.c (TT_SBitDecoder_LoadFunc, tt_sbit_decoder_load_bitmap, tt_sbit_decoder_load_byte_aligned, tt_sbit_decoder_load_bit_aligned, tt_sbit_decoder_load_png): Add argument for recursion depth. (tt_sbit_decoder_load_compound): Add argument for recursion depth. Increase recursion counter for recursive call. (tt_sbit_decoder_load_image): Add argument for recursion depth. Check recurse depth. (tt_face_load_sbit_image): Updated.
* Thinkos and omissions.Werner Lemberg2015-10-241-4/+5
|
* [sfnt] Sanitize bitmap strike glyph height.Werner Lemberg2015-10-241-1/+59
| | | | | | | Problem reported by Nikolay Sivov <bunglehead@gmail.com>. * src/sfnt/ttsbit.c (tt_face_load_strike_metrics): Avoid zero value for `metrics->height' by applying some heuristics.
* [sfnt] Fix some signed overflows (#46149).Werner Lemberg2015-10-081-11/+13
| | | | | * src/sfnt/ttsbit.c (tt_face_load_strike_metrics) <TT_SBIT_TABLE_TYPE_SBIX>: Use `FT_MulDiv'.
* Fix some bugs found by clang's `-fsanitize=undefined' (#45661).Werner Lemberg2015-08-011-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * src/base/ftrfork.c (FT_Raccess_Get_HeaderInfo): Only accept positive values from header. Check overflow. * src/base/ftoutln.c (SCALED): Correctly handle left-shift of negative values. * src/bdf/bdf.h (_bdf_glyph_modified, _bdf_set_glyph_modified, _bdf_clear_glyph_modified): Use unsigned long constant. * src/bdf/bdfdrivr.c (BDF_Size_Select, BDF_Glyph_Load): Don't left-shift values that can be negative. * src/pcf/pcfdrivr.c (PCF_Size_Select, PCF_Glyph_Load): Don't left-shift values that can be negative. * src/raster/ftraster.c (SCALED): Correctly handle left-shift of negative values. * src/sfnt/ttsbit.c (tt_face_load_strike_metrics): Don't left-shift values that can be negative. * src/truetype/ttgload.c (TT_Load_Composite_Glyph, compute_glyph_metrics, load_sbit_image): Don't left-shift values that can be negative.
* [base] Rename `FT_Bitmap_New' to `FT_Bitmap_Init'.Werner Lemberg2015-03-101-1/+1
| | | | | | | * include/ftbitmap.h, src/base/ftbitmap.c: Implement it. Update all callers. * docs/CHANGES: Updated.
* [sfnt] Signedness fixes.Werner Lemberg2015-02-221-26/+32
| | | | | | | | * src/sfnt/pngshim.c, src/sfnt/sfobjs.c, src/sfnt/ttcmap.c, src/sfnt/ttkern.c, src/sfnt/ttload.c, src/sfnt/ttpost.c, src/sfnt/ttsbit.c: Apply. * src/sfnt/sfdriver.c: Apply. (sfnt_get_ps_name): Simplify.