summaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)AuthorFilesLines
2011-01-09[cache] Fit FTC_GNode_Compare() to FTC_Node_CompareFunc.suzuki toshiya2-3/+5
* src/cache/ftcglyph.h (FTC_GNode_Compare): Add the 3rd argument `FTC_Cache cache' to fit FTC_Node_CompareFunc prototype. * src/cache/ftcglyph.c (FTC_GNode_Compare): Ditto. Anyway, `cache' is not used by its child ftc_gnode_compare().
2011-01-09[cache] Deduplicate the code to get the top node by a hash.suzuki toshiya2-28/+36
There are several duplicated codes getting the top node from a cache by a given hash, like: idx = hash & cache->mask; if ( idx < cache->p ) idx = hash & ( cache->mask * 2 + 1 ); pnode = cache->buckets + idx; To deduplicate them, a cpp-macro to do same work FTC_NODE__TOP_FOR_HASH( cache, hash ) is introduced. For non-inlined config, non-ftc_get_top_node_for_hash() is also introduced. * src/cache/ftccache.h (FTC_NODE__TOP_FOR_HASH): Declare and implement inlined version. (FTC_CACHE_LOOKUP_CMP): Use FTC_NODE__TOP_FOR_HASH(). * src/cache/ftccache.c (ftc_get_top_node_for_hash): Non- inlined version. (ftc_node_hash_unlink): Use FTC_NODE__TOP_FOR_HASH(). (ftc_node_hash_link): Ditto. (FTC_Cache_Lookup): Ditto.
2011-01-09[cache] inline-specific functions are conditionalized.suzuki toshiya4-0/+14
* src/cache/ftcglyph.c (FTC_GNode_Compare): Conditionalized for inlined config. This function is a thin wrapper of ftc_gnode_compare() for inlined FTC_CACHE_LOOKUP_CMP() (see `nodecmp' argument). Under non-inlined config, ftc_gnode_compare() is invoked by FTC_Cache_Lookup(), via FTC_Cache->clazz.node_compare(). * src/cache/ftcglyph.h (FTC_GNode_Compare): Ditto. * src/cache/ftcsbits.c (FTC_SNode_Compare): Ditto, for ftc_snode_compare(). * src/cache/ftcsbits.h (FTC_SNode_Compare): Ditto.
2011-01-09[cache] Correct a type mismatch under non-inlined config.suzuki toshiya1-1/+1
* src/cache/ftcglyph.h (FTC_GCACHE_LOOKUP_CMP): FTC_GCache_Lookup() takes the node via a pointer `FTC_Node*', differently from cpp-macro FTC_CACHE_LOOKUP_CMP().
2011-01-03*/rules.mk: Handle `*pic.c' files.Werner Lemberg8-28/+36
2011-01-03Formatting.Werner Lemberg3-45/+72
2010-12-31* src/cff/cfftypes.h (CFF_MAX_CID_FONTS): Increase to 64.Werner Lemberg1-2/+3
Problem reported by Tom Bishop <wenlin@wenlin.com>.
2010-12-31Improve bzip2 support.Werner Lemberg1-22/+4
* include/freetype/ftmoderr.h: Add bzip2. * docs/INSTALL.ANY, docs/CHANGES: Updated. * src/pcf/README: Updated. * include/freetype/internal/pcftypes.h: Obsolete, removed.
2010-12-31Add bzip2 compression support to handle *.pcf.bz2 files.Joel Klinghed5-15/+627
* builds/unix/configure.raw: Test for libbz2 library. * devel/ftoption.h, include/freetype/config/ftoption.h (FT_CONFIG_OPTION_USE_BZIP2): Define. * include/freetype/config/ftheader.h (FT_BZIP2_H): Define. * include/freetype/ftbzip2.h: New file. * src/bzip2/*: New files. * src/pcf/pcf.h: s/gzip_/comp_/. * src/pcf/pcfdrvr.c: Include FT_BZIP2_H. s/gzip_/comp_/. (PCF_Face_Init): Handle bzip2 compressed files. * docs/formats.txt, modules.cfg: Updated.
2010-12-25Apply Savannah patch #7422.Harsha1-1/+6
If we encouter a space in a string then the sbit buffer is NULL, height and width are 0s. So the check in ftc_snode_compare will always pass for spaces (comparision with 255). Here the comments above the condition are proper but the implementation is not. When we create an snode I think it is the proper way to initialize the width to 255 and then put a check for being equal to 255 in snode compare function. * src/cache/ftcsbits.c (FTC_SNode_New): Initialize sbit widths with value 255. (ftc_snode_compare): Fix condition.
2010-12-13Fix parameter handling of `FT_Set_Renderer'.Werner Lemberg1-0/+1
Reported by Kirill Tishin <siege@bk.ru>. * src/base/ftobjs.c (FT_Set_Renderer): Increment `parameters'.
2010-12-09[cff] Allow `hlineto' and `vlineto' without arguments.Werner Lemberg1-1/+6
We simply ignore such instructions. This is invalid, but it doesn't harm; and indeed, there exist such subsetted fonts in PDFs. Reported by Albert Astals Cid <aacid@kde.org>. * src/cff/cffgload.c (cff_decoder_parse_charstrings) [cff_op_hlineto]: Ignore instruction if there aren't any arguments on the stack.
2010-11-28[ftsmooth]: Minor code simplification.Алексей Подтележников1-1/+7
* src/smooth/ftgrays (gray_render_cubic): Do only one comparison instead of two.
2010-11-26[truetype] Better multi-threading support.Johnson Y. Yan1-0/+6
* src/truetype/ttinterp.c (TT_Load_Context): Reset glyph zone references.
2010-11-23* src/psaux/t1decode.c (t1_decoder_parse_charstring): ExpandJohn Tytgat1-36/+39
start_point, check_points, add_point, add_point1, close_contour macros. Remove add_contour macro. Return error code from t1_builder_start_point and t1_builder_check_points when there was one (instead of returning 0).
2010-11-22Some formatting and improvements of comments.Werner Lemberg1-21/+46
2010-11-23[truetype] Identify the tricky fonts by cvt/fpgm/prep checksums.suzuki toshiya1-6/+155
Some Latin TrueType fonts are still expected to be unhinted. Fix Savannah bug #31645. * src/truetype/ttobjs.c (tt_check_trickyness): Divided to... (tt_check_trickyness_family): this checking family name, and (tt_check_trickyness_sfnt_ids): this checking cvt/fpgm/prep. (tt_get_sfnt_checksum): Function to retrieve the sfnt checksum for specified subtable even if cleared by lazy PDF generators. (tt_synth_sfnt_checksum): Function to calculate the checksum.
2010-11-18[truetype] Fix `loca' handling for inconsistent number of glyphs.Werner Lemberg1-2/+8
Reported by Johnson Y. Yan <yinsen_yan@foxitsoftware.com>. * src/truetype/ttpload.c (tt_face_load_loca): While sanitizing, handle case where `loca' is the last table in the font.
2010-11-18[sfnt] Ignore all errors while loading `OS/2' table.Werner Lemberg1-3/+1
Suggested by Johnson Y. Yan <yinsen_yan@foxitsoftware.com>. * src/sfnt/sfobjs.c (sfnt_load_face): Do it.
2010-11-18[type1] Fix matrix normalization.Johnson Y. Yan1-1/+1
* src/type1/t1load.c (parse_font_matrix): Handle sign of scaling factor.
2010-11-18[type1]: Improve guard against malformed data.Werner Lemberg1-4/+10
Based on a patch submitted by Johnson Y. Yan <yinsen_yan@foxitsoftware.com> * src/type1/t1load.c (read_binary_data): Check `size'.
2010-11-17[sfnt] While tracing, output table checksums also.Werner Lemberg1-2/+7
* src/sfnt/ttload.c (tt_face_load_font_dir): Do it.
2010-11-04[UVS] Fix find_variant_selector_charmap(), Savannah bug #31545.suzuki toshiya1-0/+2
Since 2010-07-04, find_variant_selector_charmap() returns the first cmap subtable always under rogue-compatible configuration, it causes NULL pointer dereference and make UVS-related functions crashed. * src/base/ftobjs.c (Fix find_variant_selector_charmap): Returns UVS cmap correctly.
2010-11-04[UVS] Remove non-essential pointer checking in previous commit.suzuki toshiya1-20/+0
2010-11-04[UVS] Stabilizes UVS supporting functions against non-UVS fonts.suzuki toshiya1-0/+20
UVS supporting functions assume the variation handler functions are valid. When a font without cmap format 14 is given, these function pointers are left as NULL, so calling these functions causes NULL pointer dereference. * src/base/ftobjs.c (FT_Face_GetCharVariantIndex): Check the pointer FT_CMap_Class->char_var_index before calling it. (FT_Face_GetCharVariantIsDefault): Check the pointer FT_CMap_Class->char_var_default before calling it. (FT_Face_GetVariantSelectors): Check the pointer FT_CMap_Class->variant_list before calling it. (FT_Face_GetVariantsOfChar): Check the pointer FT_CMap_Class->charvariant_list before calling it. (FT_Face_GetCharsOfVariant): Check the pointer FT_CMap_Class->variantchar_list before calling it.
2010-11-02[ftsmooth] Improve rendering.Alexei Podtelezhnikov1-20/+15
* src/smooth/ftsmooth.c (gray_render_conic): Since version 2.4.3, cubic deviations have been estimated _after_ UPSCALE, whereas conic ones have been evaluated _before_ UPSCALE, which produces inferior rendering results. Fix this. Partially undo change from 2010-10-15 by using ONE_PIXEL/4; this has been tested with demo images sent to the mailing list. See http://lists.gnu.org/archive/html/freetype-devel/2010-10/msg00055.html and later mails in this thread.
2010-10-28[ftraster] Minor fixes.Werner Lemberg1-3/+0
Reported by Tom Bishop <wenlin@wenlin.com>. * src/raster/ftraster.c (ULong): Remove unused typedef. (TWorker): Remove unused variable `precision_mask'.
2010-10-28[ftraster] Fix rendering.Werner Lemberg1-3/+3
Problem reported by Tom Bishop <wenlin@wenlin.com>; see thread starting with http://lists.gnu.org/archive/html/freetype/2010-10/msg00049.html * src/raster/ftraster.c (Line_Up): Replace FMulDiv with SMulDiv since the involved multiplication exceeds 32 bits.
2010-10-25Revert a change of `_idx' type in FTC_CACHE_LOOKUP_CMP().suzuki toshiya1-1/+1
* src/cache/ftccache.h (FTC_CACHE_LOOKUP_CMP): Revert the type of `_idx' from FT_PtrDist (by previous change) to original FT_UFast, to match with FT_CacheRec.
2010-10-25[cache] Change the hash types to FT_PtrDist.suzuki toshiya7-17/+20
On LLP64 platforms (e.g. Win64), FT_ULong (32-bit) variables are inappropriate to calculate hash values from the memory address (64-bit). The hash variables are extended from FT_ULong to FT_PtrDist and new hashing macro functions are introduced. The hash values on 16-bit memory platforms are changed, but ILP32 and LP64 are not changed. The hash value in the cache subsystem is not reverted to the memory address, so using signed type FT_PtrDist is safe. * src/cache/ftccache.h (_FTC_FACE_ID_HASH): New hash function to replace FTC_FACE_ID_HASH() for portability. * src/cache/ftcmanag.h (FTC_SCALER_HASH): Replace FTC_FACE_ID_HASH() by _FTC_FACE_ID_HASH(). * src/cache/ftccmap.c (FTC_CMAP_HASH): Ditto. * src/cache/ftccache.h (FTC_NodeRec): The type of the member `hash' is changed from FT_UInt32 to FT_PtrDist. * src/cache/ftccache.h (FTC_Cache_Lookup): The type of the argument `hash' is changed from FT_UInt32 to FT_PtrDist. (FTC_Cache_NewNode): Ditto. * src/cache/ftccache.c (ftc_cache_add): Ditto. (FTC_Cache_Lookup): Ditto. (FTC_Cache_NewNode): Ditto. * src/cache/ftcglyph.h (FTC_GCache_Lookup): Ditto. * src/cache/ftcglyph.c (FTC_GCache_Lookup): Ditto. * src/cache/ftcbasic.c (FTC_ImageCache_Lookup): The type of the internal variable `hash' is changed to FT_PtrDist from FT_UInt32. (FTC_ImageCache_LookupScaler): Ditto. (FTC_SBitCache_Lookup): Ditto. (FTC_SBitCache_LookupScaler): Ditto. * src/cache/ftccmap.c (FTC_CMapCache_Lookup): Ditto. * src/cache/ftccache.h (FTC_CACHE_LOOKUP_CMP): Ditto. Also the type of the internal variable `_idx' is changed to FT_PtrDist from FT_UInt32 for better pointer calculation.
2010-10-25Change the type of FT_MEM_VAL() from FT_ULong to FT_PtrDist.suzuki toshiya1-3/+3
On LLP64 platforms (e.g. Win64), unsigned long (32-bit) cannot cover the memory address (64-bit). FT_MEM_VAL() is used for hashing only and not dereferred, so using signed type FT_PtrDist is safe. * src/base/ftdbgmem.c (FT_MEM_VAL): Change the type of the return value from FT_ULong to FT_PtrDist. (ft_mem_table_resize): The type of hash is changed to FT_PtrDist. (ft_mem_table_get_nodep): Ditto.
2010-10-25Replace "%lx" for memory address by "%p", LLP64 platforms.suzuki toshiya2-6/+5
On LLP64 platforms (e.g. Win64), long (32-bit) cannot cover the memory address (64-bit). Also the casts from the pointer type to long int should be removed to preserve the address correctly. * src/raster/ftraster.c (New_Profile): Replace "%lx" by "%p". (End_Profile) Ditto. * src/truetype/ttinterp.c (Init_Context): Ditto.
2010-10-15Fix thinko in spline flattening.Werner Lemberg1-8/+3
FT_MAX_CURVE_DEVIATION is dependent on the value of ONE_PIXEL. * src/smooth/ftgrays.c (FT_MAX_CURVE_DEVIATION): Remove it and replace it everywhere with ONE_PIXEL/8.
2010-10-13[raccess] Skip unrequired resource access rules by Darwin VFS.suzuki toshiya1-0/+15
When a resource fork access rule by Darwin VFS could open the resource fork but no font is found in it, the rest of rules by Darwin VFS are skipped. It reduces the warnings of the deprecated resource fork access method by recent Darwin kernel. Fix MacPorts ticket #18859: http://trac.macports.org/ticket/18859 * src/base/ftobjs.c (load_face_in_embedded_rfork): When FT_Stream_New() returns FT_Err_Cannot_Open_Stream, it means that the file is possible to be fopen()-ed but zero-sized. Also there is a case that the resource fork is not zero-sized, but no supported font exists in it. If a rule by Darwin VFS falls into such cases, there is no need to try other Darwin VFS rules anymore. Such cases are marked by vfs_rfork_has_no_font. If it is TRUE, the Darwin VFS rules are skipped.
2010-10-13[raccess] Grouping resource access rules based on Darwin VFS.suzuki toshiya2-15/+76
MacOS X/Darwin kernel supports a few tricky methods to access a resource fork via ANSI C or POSIX interface. Current resource fork accessor tries all possible methods to support all kernels. But if a method could open a resource fork but no font is found, there is no need to try other methods older than tested method. To determine whether the rule index is for Darwin VFS, a local function ftrfork.c::raccess_rule_by_darwin_vfs() is introduced. To use this function in ftobjs.c etc but it should be inlined, it is exposed by ftbase.h. * src/base/ftrfork.c (FT_RFork_Rule): New enum type to identify the rules to access the resource fork. (raccess_guess_rec): New structure to bind the rule function and rule enum type. (FT_Raccess_Guess): The list of the rule functions is replaced by (raccess_guess_table): This. This is exposed to be used by other intra module functions. (raccess_rule_by_darwin_vfs): A function to return a boolean if the rule specified by the rule index is based on Darwin VFS.
2010-10-13Prevent to open a FT_Stream for zero-sized file on non-Unix.suzuki toshiya1-3/+14
builds/unix/ftsystem.c prevents to open an useless stream from zero-sized file and returns FT_Err_Cannot_Open_Stream, but the stream drivers for ANSI C, Amiga and VMS return useless streams. For cross-platform consistency, all stream drivers should act same. * src/base/ftsystem.c (FT_Stream_Open): If the size of the opened file is zero, FT_Err_Cannot_Open_Stream is returned. * builds/amiga/src/base/ftsystem.c (FT_Stream_Open): Ditto. * src/vms/ftsystem.c (FT_Stream_Open): Ditto.
2010-10-12Fix Savannah bug #31310.Werner Lemberg1-3/+3
* src/truetype/ttgxvar.c (ft_var_readpackedpoints): Protect against invalid `runcnt' values.
2010-10-08Fix Savannah bug #31275.Chris Liddell1-0/+1
* src/sfnt/ttpost.c: Include FT_INTERNAL_DEBUG_H.
2010-10-08Typo.Ed1-1/+1
2010-10-06[truetype] Improve error handling of `SHZ' bytecode instruction.Werner Lemberg1-0/+9
Problem reported by Chris Evans <scarybeasts@gmail.com>. * src/truetype/ttinterp.c (Ins_SHZ): Check `last_point'.
2010-10-02Fix Savannah bug #31088 (sort of).Werner Lemberg1-2/+2
* src/sfnt/ttload.c (tt_face_load_maxp): Always allocate at least 64 function entries.
2010-10-02[smooth] Fix splitting of cubics for negative values.Werner Lemberg1-1/+1
Reported by Róbert Márki <gsmiko@gmail.com>; see http://lists.gnu.org/archive/html/freetype/2010-09/msg00019.html. * src/smooth/ftgrays.c (gray_render_cubic): Fix thinko.
2010-10-01Fix Savannah bug #31040.suzuki toshiya1-35/+0
* src/truetype/ttinterp.c (free_buffer_in_size): Remove. (TT_RunIns): Updated.
2010-09-20[sfnt] Make error message filling NULL names less verbose.suzuki toshiya1-6/+14
* src/sfnt/ttpost.c (load_format_20): Showing 1 summary message when we fill `post' names by NULL, instead of per-entry message.
2010-09-20[smooth] Fix and improve spline flattening.Graham Asher1-147/+122
This fixes the flattening of cubic, S-shaped curves and speeds up the handling of both the conic and cubic arcs. See the discussions on the freetype-devel mailing list in late August and September 2010 for details. * src/smooth/ftgrays.c (FT_MAX_CURVE_DEVIATION): New macro. (TWorker): Remove `conic_level' and `cubic_level' elements. (gray_render_conic): Simplify algorithm. (gray_render_cubic): New algorithm; details are given in the code comments. (gray_convert_glyph): Remove heuristics.
2010-09-19Minor fixes.Werner Lemberg2-25/+28
* src/cff/cffload.c (cff_charset_compute_cids): `charset->sids[i]' is `FT_UShort'. (cff_index_access_element): Don't use additions in comparison. * src/sfnt/ttpost.c (load_format_20): Make `post_limit' of type `FT_Long'. Don't use additions in comparison. Improve tracing messages. (load_format_25, load_post_names): Make `post_limit' of type `FT_Long'.
2010-09-20[cff] Truncate the element length at the end of the stream.suzuki toshiya1-0/+11
See Savannah bug #30975. * src/cff/cffload.c (cff_index_access_element): `off2', the offset to the next element is truncated at the end of the stream to prevent invalid I/O. As `off1', the offset to the requested element has been checked by FT_STREAM_SEEK(), `off2' should be checked similarly.
2010-09-20[cff] Ignore CID > 0xFFFFU.suzuki toshiya1-1/+8
See Savannah bug #30975. * src/cff/cffload.c (cff_charset_compute_cids): Ignore CID if greater than 0xFFFFU. CFF font spec does not mention about maximum CID in the font, but PostScript and PDF spec define that maximum CID is 0xFFFFU.
2010-09-20[cff] Make trace message in cff_charset_load() verbose.suzuki toshiya1-1/+2
See Savannah bug #30975. * src/cff/cffload.c (cff_charset_load): Report the original `nleft' and truncated `nleft'.
2010-09-20[cff] Correct `max_cid' from CID array length to max CID.suzuki toshiya2-4/+3
See Savannah bug #30975. * src/cff/cffload.c (cff_charset_compute_cids): Don't increment max_cid after detecting max CID. The array CFF_Charset->cids is allocated by max_cid + 1. (cff_charset_cid_to_gindex): Permit CID is less than or equal to CFF_Charset->max_cid. * src/cff/cffobjs.c (cff_face_init): FT_Face->num_glyphs is calculated as CFF_Charset->max_cid + 1.