summaryrefslogtreecommitdiff
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
* [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-067-56/+88
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `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.
* [truetype] Clamp variation requests to valid range.Behdad Esfahbod2016-11-031-13/+20
| | | | | | | | This is required by OpenType 1.8; it also avoids rounding surprises. * src/truetype/ttgxvar.c (TT_Set_Var_Design): Clamp design coordinates outside of the allowed range to always stay within the range instead of producing an error.
* [truetype] Remove clang warnings.Werner Lemberg2016-10-292-9/+12
| | | | | | | | | * src/truetype/ttinterp.h (TT_ExecContextRec): Using `FT_ULong' for loop counter handling. * src/truetype/ttinterp.c: Updated. (Ins_SCANTYPE): Use signed constant. (TT_RunIns): Ensure `num_twilight_points' is 16bit.
* [truetype] Fix commit from 2014-11-24.Werner Lemberg2016-10-271-4/+5
| | | | | | | Problem reported by Hin-Tak Leung <htl10@users.sourceforge.net>. * src/truetype/ttpload.c (tt_face_load_hdmx): Fix file checking logic.
* Add `FT_Get_{MM,Var}_Blend_Coordinates' functions.Werner Lemberg2016-10-267-0/+164
| | | | | | | | | | | | | | | | | | | | | | | | | | | * include/freetype/ftmm.h: Declare. * include/freetype/internal/services/svmm.h (FT_Get_MM_Blend_Func): New typedef. (MultiMasters): New MM service function `get_mm_blend'. (FT_DEFINE_SERVICE_MULTIMASTERSREC): Updated. Update all callers. * src/base/ftmm.c (FT_Get_MM_Blend_Coordinates, FT_Get_Var_Blend_Coordinates): Implement. * src/truetype/ttdriver.c: Updated. * src/truetype/ttgxvar.c (TT_Get_MM_Blend): New function to handle `get_mm_blend' service. * src/truetype/ttgxvar.h: Updated. * src/type1/t1driver.c: Updated. * src/type1/t1load.c (T1_Get_MM_Blend): New function to handle `get_mm_blend' service. * src/type1/t1load.h: Updated. * docs/CHANGES: Document.
* * src/type1/t1load.c (parse_subrs): Fix limit check.Werner Lemberg2016-10-261-1/+1
| | | | | | Reported as https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=81
* [cff] Correct cmap format reporting (#24819).Alexei Podtelezhnikov2016-10-251-3/+2
| | | | | * src/cff/cffdrivr.c (cff_get_cmap_info): Throw an error on synthetic charmap instead of guessing its format and language.
* [truetype] Fix SCANTYPE instruction (#49394).Werner Lemberg2016-10-221-2/+2
| | | | * src/truetype/ttinterp.c (Ins_SCANTYPE): Only use lower 16bits.
* [sfnt] Improve handling of invalid post 2.5 tables [#49393].Werner Lemberg2016-10-221-1/+3
| | | | | * src/sfnt/ttpost.c (load_format_25): We need at least a single table entry.
* [truetype] Fix handling of `cvar' table data.Werner Lemberg2016-10-141-2/+7
| | | | | | | | | Reported as https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=53 * src/truetype/ttgxvar.c (tt_face_vary_cvt): Ignore invalid CVT indices.
* URL updates.Alexei Podtelezhnikov2016-10-131-1/+1
|
* [psaux] Fix handling of invalid flex subrs.Werner Lemberg2016-10-111-12/+13
| | | | | | | | | Problem reported as https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=52 * src/psaux/t1decode.c (t1_decoder_parse_charstrings) <op_callothersubr>: Set `flex_state' after error checking.
* * src/truetype/ttgxvar.c (tt_done_blend): Fix deallocation.Werner Lemberg2016-10-111-2/+5
|
* * src/cid/cidload.c (cid_face_open): Properly propagate `error'.Werner Lemberg2016-10-081-3/+5
|
* [cid] Fix parsing of subr offsets.Werner Lemberg2016-10-081-2/+2
| | | | | | Bug introduced 2016-05-16. * src/cid/cidparse.c (cid_parser_new): Fix off-by-one error.
* [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.
* [smooth] Remove impossibility.Alexei Podtelezhnikov2016-10-011-7/+2
| | | | | * src/smooth/ftgrays.c (TWorker): Rearrange fields. (gray_convert_glyph): Remove impossible condition and clean up.
* [pcf] Enrich family name with foundry name and glyph width info.Werner Lemberg2016-09-301-2/+51
| | | | | | | | | | | | | | | | | | | | | This is a very old patch from openSuSE (from 2006, submitted to FreeType in 2011) that I forgot to apply. https://build.opensuse.org/package/view_file/openSUSE:Factory/freetype2/freetype2-bitmap-foundry.patch Prepend the foundry name plus a space to the family name. There are many fonts just called `Fixed' which look completely different, and which have nothing to do with each other. When selecting `Fixed' in KDE or Gnome one gets results that appear rather random, the style changes often if one changes the size and one cannot select some fonts at all. We also check whether we have `wide' characters; all put together, we get family names like `Sony Fixed' or `Misc Fixed Wide'. * src/pcf/pcfread.c (pcf_load_font): Implement it. * docs/CHANGES: Document it.
* [ftfuzzer] Speed up.Werner Lemberg2016-09-291-0/+4
| | | | | * src/tools/ftfuzzer/ftfuzzer.cc (LLVMFuzzerTestOneInput): Don't check for embedded bitmaps if we have a non-default instance.
* Comments.Werner Lemberg2016-09-291-1/+1
|
* [truetype] Disallow bitmap strokes for non-default instances.Werner Lemberg2016-09-293-8/+15
| | | | | | | | | | | | | | | | | | Also speed up access of default instances if GX variations are active. * include/freetype/internal/tttypes.h (TT_FaceRec): Add `is_default_instance' member. * src/sfnt/sfobjs.c (sfnt_init_face): Initialize `is_default_instance'. * src/truetype/ttgload.c (TT_Process_Simple_Glyph, load_truetype_glyph): Add test for default instance. (TT_Load_Glyph): Load embedded bitmaps for default instance only. * src/truetype/ttgxvar.c (TT_Set_MM_Blend): Compute `is_default_instance'.
* [truetype] Clean up `TT_Face' structure.Werner Lemberg2016-09-291-11/+3
| | | | | | | | * include/freetype/internal/tttypes.h (TT_FaceRec): Remove unused fields `horz_metrics' and `vert_metrics'. Update documentation. * src/sfnt/sfobjs.c (sfnt_done_face): Updated.
* More FT_ZERO usage.Werner Lemberg2016-09-286-8/+14
| | | | | | | | | | | | | | | | | | * src/gxvalid/gxvcommn.c (gxv_ClassTable_validate): s/ft_memset/FT_MEM_ZERO/. * src/psaux/t1decode.c (t1_decoder_parse_charstrings): s/ft_memset/FT_ARRAY_ZERO/. * src/raster/ftraster.c (FT_ZERO): Define. (ft_black_new): Use it. * src/raster/ftrend1.c (ft_raster1_get_cbox): s/FT_MEM_ZERO/FT_ZERO/. * src/smooth/ftgrays.c (FT_ZERO): Define. (gray_raster_new): Use it. * src/smooth/ftsmooth.c (ft_smooth_get_cbox): s/FT_MEM_ZERO/FT_ZERO/.
* */*: s/FT_MEM_ZERO/FT_ZERO/ where appropriate.Werner Lemberg2016-09-2819-28/+28
|
* [truetype] Trace number of executed opcodes.Werner Lemberg2016-09-271-0/+1
| | | | * src/truetype/ttinterp.c (TT_RunIns): Implement it.
* [truetype] Speed up `TT_Load_Glyph'.Werner Lemberg2016-09-272-30/+17
| | | | | | | | | | | | This avoids additional calls to `tt_face_lookup_table' for the `glyf' table, which can be expensive. * include/freetype/internal/tttypes.h (TT_LoaderRec): Move `glyf_offset' field to ... (TT_FaceRec): ... this structure. * src/truetype/ttgload.c (load_truetype_glyph): Updated. (tt_loader_init): Move initialization of `glyf_offset' to ... * src/truetype/ttpload.c (tt_face_load_loca): .. this function.
* [truetype] Introduce dynamic limits for some bytecode opcodes.Werner Lemberg2016-09-272-0/+62
| | | | | | | | | | | | | | | This speeds up FreeType's handling of malformed fonts. * src/truetype/ttinterp.c (TT_RunIns): Set up limits for the number of twilight points, the total number of negative jumps, and the total number of loops in LOOPCALL opcodes. The values are based on the number of points and entries in the CVT table. (Ins_JMPR): Test negative jump counter. (Ins_LOOPCALL): Test loopcall counter. * src/truetype/ttinterp.h (TT_ExecContext): Updated. * docs/CHANGES: Updated.
* [truetype] Sanitize only last entry of `loca' table.Werner Lemberg2016-09-251-9/+23
| | | | | | | | | | Without this patch, a loca sequence like `0 100000 0 100000 ...', where value 100000 is larger than the `glyf' table size, makes FreeType handle the whole `glyf' table as a single glyph again and again, which is certainly invalid (and can be very slow, too). * src/truetype/ttpload.c (tt_face_get_location): Implement. Improve tracing messages.
* * src/tools/ftfuzzer/ftfuzzer.cc (LLVMFuzzerTestOneInput): Fix typo.Werner Lemberg2016-09-251-1/+1
|
* [autofit] Tracing fixes.Werner Lemberg2016-09-241-3/+10
| | | | | * src/autofit/afmodule.c (af_autofitter_load_glyph): Call dumping functions only if we actually do tracing.
* [smooth] Reduce divisions in the line renderer.Alexei Podtelezhnikov2016-09-221-4/+5
| | | | | | | | We don't need some divisions if a line segments stays within a single row or a single column of pixels. * src/smooth/ftgrays.c (gray_render_line) [FT_LONG64]: Make divisions conditional.
* s/0/NULL/ for function pointers; comments, formatting.Werner Lemberg2016-09-1735-436/+559
|
* * src/smooth/ftgrays.c (gray_sweep): Remove check for empty table.Alexei Podtelezhnikov2016-09-151-3/+0
|
* [smooth] Another tiny speed-up.Alexei Podtelezhnikov2016-09-141-20/+11
| | | | | * src/smooth/ftgrays.c (gray_find_cell): Merge into... (gray_record_cell): ... this function.
* * src/smooth/ftgrays.c (gray_{find,set}_cell): Remove dubious code.Alexei Podtelezhnikov2016-09-111-6/+0
|
* [smooth] Fix valgrind warning and reoptimize.Alexei Podtelezhnikov2016-09-111-12/+9
| | | | | | | | | The algorithm calls `gray_set_cell' at the start of each new contour or when the contours cross the cell boundaries. Double-checking for that is wasteful. * src/smooth/ftgrays.c (gray_set_cell): Remove check for a new cell. (gray_convert_glyph): Remove initialization introduced by 44b172e88.
* [sfnt] Fix previous commit.Werner Lemberg2016-09-103-21/+38
| | | | | | | | | | | | | | | | | | | 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.
* [ftfuzzer] Minor improvements.Werner Lemberg2016-09-091-2/+4
| | | | | | * src/tools/ftfuzzer/ftfuzzer.cc (LLVMFuzzerTestOneInput): Ignore invalid strikes. Use better values for call to `FT_Set_Char_Size'.
* [sfnt] Don't provide (completely) broken strike data.Werner Lemberg2016-09-094-14/+44
| | | | | | | | | | | | | | | | | | | | | | | 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'.
* * src/truetype/ttinterp.c: Include `ttgxvar.h'.Werner Lemberg2016-09-081-0/+3
| | | | This fixes the `multi' build.
* [autofit] Another improvement to Armenian support.Werner Lemberg2016-09-081-1/+1
| | | | | | | Suggested by Hrant H Papazian <hpapazian@gmail.com>. * src/autofit/afscript.h: Use better suited characters to derive default stem widths.
* * src/smooth/ftgrays.c (gray_hline): Microptimize.Alexei Podtelezhnikov2016-09-071-1/+1
|
* [smooth] Operate in absolute bitmap coordinates.Alexei Podtelezhnikov2016-09-061-37/+28
| | | | | | | | Simpler bitmap addressing improves performance by 1.5%. * src/smooth/ftgrays.c (gray_TWorker): Remove count fields. (gray_dump_cells, gray_find_cell, gray_set_cell, gray_hline, gray_sweep, gray_convert_glyph, gray_raster_render): Updated.
* [smooth] Improve contour start (take 2).Alexei Podtelezhnikov2016-09-061-29/+2
| | | | | | | * src/smooth/ftgrays.c (gray_move_to): Call `gray_set_cell' directly instead of... (gray_start_cell): ... this function, which is removed. (gray_convert_glyph): Make initial y-coordinate invalid.
* [type1] MM fonts support exactly zero named instances (#48748).Werner Lemberg2016-09-061-1/+1
| | | | * src/type1/t1load.c (T1_Get_MM_Var): Set `num_namedstyles' to zero.
* [cff] Fix uninitialized memory.Jonathan Kew2016-09-061-0/+2
| | | | | | | | | Problem reported as https://bugzilla.mozilla.org/show_bug.cgi?id=1270288 * src/cff/cf2interp.c (cf2_interpT2CharString): Initialize `storage' array to handle a `get' opcode without a previous `put'.
* * src/smooth/ftgrays.c (gray_move_to, gray_start_cell): Revert.Alexei Podtelezhnikov2016-09-051-1/+28
|
* [smooth] Improve contour start.Alexei Podtelezhnikov2016-09-051-28/+1
| | | | | | * src/smooth/ftgrays.c (gray_move_to): Call `gray_set_cell' directly instead of... (gray_start_cell): ... this function, which is removed.
* [cff] Fix memory initialization.Werner Lemberg2016-09-051-3/+3
| | | | | * src/cff/cf2stack.c (cf2_stack_init): Use `FT_NEW'. The `Q' variants of FreeType's memory allocation macros don't do zeroing.