* src/sfnt/ttpost.c (load_post_names): Get the length of
`post' table and pass the limit of `post' table to
load_format_20() and load_format_25().
(load_format_20): Stop the parsing when we reached at the
limit of `post' table. If more glyph names are required,
they are filled by NULL names. See Savannah bug #31040.
Fix for Savannah bug #30059.
* src/cache/ftccmap.c (FTC_CMapCache_Lookup): Replace `16' the
minimum character code passed by a legacy rogue client by...
* include/freetype/config/ftoption.h (FT_MAX_CHARMAP_CACHEABLE):
This. It is undefined when FT_CONFIG_OPTION_OLD_INTERNALS is
undefined (thus the rogue client compatibility is not required).
* src/cff/cffobjs.c (cff_face_init): Abort the automatic
selection or synthesis of Unicode cmap subtable when the charmap
index exceeds FT_MAX_CHARMAP_CACHEABLE.
* src/sfnt/ttcmap.c (tt_face_build_cmaps): Issue error message
when the charmap index exceeds FT_MAX_CHARMAP_CACHEABLE.
* src/base/ftobjs.c (find_unicode_charmap): When Unicode charmap
is found after FT_MAX_CHARMAP_CACHEABLE, ignore it and search
earlier one.
(find_variant_selector_charmap): When UVS charmap is found after
FT_MAX_CHARMAP_CACHEABLE, ignore it and search earlier one.
(FT_Select_Charmap): When a charmap matching with requested
encoding but after FT_MAX_CHARMAP_CACHEABLE, ignore and search
earlier one.
(FT_Set_Charmap): When a charmap matching with requested
charmap but after FT_MAX_CHARMAP_CACHEABLE, ignore and search
earlier one.
(FT_Get_Charmap_Index): When a requested charmap is found
after FT_MAX_CHARMAP_CACHEABLE, return the inverted charmap
index.
* src/base/ftglyph.c (FT_Glyph_To_Bitmap) [FT_CONFIG_OPTION_PIC]:
Declare `library' for FT_BITMAP_GLYPH_CLASS_GET.
* src/base/ftinit.c (ft_destroy_default_module_classes,
ft_create_default_module_classes): Use proper casts (needed for C++
compilation).
* src/sfnt/ttcmap.c (tt_cmap13_class_rec): Use FT_DEFINE_TT_CMAP.
* include/freetype/internal/services/svbdf.h add macros to init
instances of FT_Service_BDFRec.
* include/freetype/internal/services/svgldict.h add macros to init
instances of FT_Service_GlyphDictRec.
* include/freetype/internal/services/svpostnm.h add macros to init
instances of FT_Service_PsFontNameRec.
* include/freetype/internal/services/svsfnt.h add macros to init
instances of FT_Service_SFNT_TableRec.
* include/freetype/internal/services/svttcmap.h add macros to init
instances of FT_Service_TTCMapsRec.
* include/freetype/internal/sfnt.h add macros to init
instances of SFNT_Interface.
* src/sfnt/sfdriver.h declare sfnt_module_class using macros from
ftmodapi.h, when FT_CONFIG_OPTION_PIC is defined create and destroy
functions will be declared.
* src/sfnt/sfdriver.c when FT_CONFIG_OPTION_PIC is defined
the following structs:
sfnt_service_sfnt_table, sfnt_service_glyph_dict, sfnt_service_ps_name
tt_service_get_cmap_info, sfnt_service_bdf, sfnt_interface,
sfnt_module_class, and sfnt_services array
will have functions to init or create and destroy them
instead of being allocated in the global scope.
And macros will be used from sfntpic.h in order to access them
from the pic_container.
* src/sfnt/ttcmap.h add macros to init
instances of TT_CMap_ClassRec.
* src/sfnt/ttcmap.c when FT_CONFIG_OPTION_PIC is defined
the following structs:
tt_cmap0_class_rec, tt_cmap2_class_rec, tt_cmap4_class_rec
tt_cmap6_class_rec, tt_cmap8_class_rec, tt_cmap10_class_rec,
tt_cmap12_class_rec, tt_cmap14_class_rec and tt_cmap_classes array
will have functions to init or create and destroy them
instead of being allocated in the global scope.
And macros will be used from sfntpic.h in order to access them
from the pic_container.
The content of tt_cmap_classes is now described in the
new file 'ttcmapc.h'.
New Files:
* src/sfnt/sfntpic.h declare struct to hold PIC globals for sfnt
driver and macros to access them.
* src/sfnt/sfntpic.c implement functions to allocate, destroy and
initialize PIC globals for sfnt driver.
* src/sfnt/ttcmapc.h describing the content of
tt_cmap_classes allocated in ttcmap.c
* src/sfnt/sfnt.c add new file to build: sfntpic.c.
* src/sfnt/jamfile add new files to FT2_MULTI build: sfntpic.c.
We now simply check for a valid `offset', no longer handling `delta
= 1' specially.
* src/sfnt/ttcmap.c (tt_cmap4_validate): Don't check `delta' for
last segment.
(tt_cmap4_set_range, tt_cmap4_char_map_linear,
tt_cmap4_char_map_binary): Check offset.
This patch fixes the following problems in ttsbit0.c:
. Bitmaps for compound glyphs were never allocated.
. `SBitDecoder' refused to load metrics if some other metrics have
already been loaded. This condition certainly makes no sense for
recursive calls, so I've just disabled it. Another possibility
would be resetting `decoder->metrics_loaded' to false before
loading each composite component. However, we must restore the
original metrics after finishing the recursion; otherwise we can
get a misaligned glyph.
. `tt_sbit_decoder_load_bit_aligned' incorrectly handled `x_pos',
causing some glyph components to be shifted too far to the right
(especially noticeable for small sizes).
Note that support for grayscale bitmaps (not necessarily compound) is
completely broken in ttsbit0.c.
* src/sfnt/tt_sbit_decoder_load_metrics: Always load metrics.
(tt_sbit_decoder_load_bit_aligned): Handle `x_pos' correctly in case
of `h == height'.
(tt_sbit_decoder_load_compound): Reset metrics after loading
components.
Allocate bitmap.
Closes Savannah BUG #25750
* src/sfnt/ttkern.c (tt_face_get_kerning): fix a bug
where a malformed table would be succesfully loaded but
later crash the engine during parsing.
The main cycle in `blit_sbit' makes too many iterations: it actually
needs the count of lines in the source bitmap rather than in the
target image.
* src/sfnt/ttsbit.c (blit_sbit) [FT_CONFIG_OPTION_OLD_INTERNALS]:
Add parameter `source_height' and use it for main loop.
(Load_SBit_Single) [FT_CONFIG_OPTION_OLD_INTERNALS]: Updated.
* src/sfnt/sfobjs.c (sfnt_load_face): Test for bitmap strikes before
setting metrics and bbox values. This ensures that the check for a
font with neither a `glyf' table nor bitmap strikes can be performed
early enough to set metrics and bbox values too.
src/smooth/ftgrays.c, src/base/ftobjc.s, src/sfobjs.c:
s/_Err_Bad_Argument/_Err_Invalid_Argument/. The former is for
errors in the bytecode interpreter only.
extern const FT_Module_Class
(or similar for C++). However, the actual types of the variables
being declared are often different, e.g., FT_Driver_ClassRec or
FT_Renderer_Class. (Some are, indeed, FT_Module_Class.)
This works with most C compilers (since those structs begin with an
FT_Module_Class struct), but technically it's undefined behavior.
To quote the ISO/IEC 9899:TC2 final committee draft, section 6.2.7
paragraph 2:
All declarations that refer to the same object or function shall
have compatible type; otherwise, the behavior is undefined.
(And they are not compatible types.)
Most C compilers don't reject (or even detect!) code which has this
issue, but the GCC LTO development branch compiler does. (It
outputs the types of the objects while generating .o files, along
with a bunch of other information, then compares them when doing the
final link-time code generation pass.)
Patch from Savannah bug #25133.
* src/base/ftinit.c (FT_USE_MODULE): Include variable type.
* builds/amiga/include/freetype/config/ftmodule.h,
include/freetype/config/ftmodule.h, */module.mk: Updated to declare
pass correct types to FT_USE_MODULE.
nor bitmaps can be considered as containing space `glyphs' only.
* src/truetype/ttpload.c (tt_face_load_loca): Handle the case where
a `glyf' table is missing.
* src/truetype/ttgload.c (load_truetype_glyph): Abort if we have no
`glyf' table but a non-zero `loca' entry.
(tt_loader_init): Handle missing `glyf' table.
* src/base/ftobjs.c (FT_Load_Glyph): Undo change 2008-12-05.
* src/sfnt/sfobjs.c (sfnt_load_face): A font with neither outlines
nor bitmaps is scalable.
0x100 instead of 0x10000; the latter value is already occupied by
FT_LOAD_TARGET_LIGHT. Bug reported by James Cloos.
Handle SFNT with neither outlines nor bitmaps. This fixes Savannah
bug #25010.
* src/base/ftobjs.c (FT_Load_Glyph): Reject fonts with neither
outlines nor bitmaps.
* src/sfnt/sfobjs.c (sfnt_load_face): Don't return an error if there
is no table with glyphs.
* src/sfnt/ttload.c (tt_face_lookup_table): Improve debugging
message.
Other minor cosmetics.
code so that memory allocation problems can be distinguished from
missing table entries. Reported by Graham Asher.
(GET_NAME): New macro.
(sfnt_load_face): Use it.
(cff_face_done), src/pfr/pfrobjs.c (pfr_face_done),
src/pcf/pcfdrivr.c (PCF_Face_Done), src/cid/cidobjs.c
(cid_face_done), src/bdf/bdfdrivr. (BDF_Face_Done),
src/sfnt/sfobjs.c (sfnt_face_done): Protect against face == 0.
Reported by Graham Asher.
tt_cmap4_char_map_binary): Handle fonts which treat the last segment
specially. According to the specification, such fonts would be
invalid but acroread accepts them.
support for bit 8 in the `OS/2' table. MS is already using this;
hopefully, this becomes part of OpenType 1.5.
Prepare also support for `name' IDs 21 (WWS_FAMILY) and 22
(WWS_SUBFAMILY).
cmap14-related new APIs to the FT_Object_ActionName scheme.
update the documentation for these APIs
* src/sfnt/ttcmap.c: stronger cmap 14 validation, make the
code a little more consistent with FreeType coding conventions
and modify the cmap14 functions that returned a newly allocated
array to use a persistent vector from the TT_CMap14 object
instead.
Fonts without a cmap must be handled correctly by FreeType (anything
else would be a bug).
* src/psaux/t1decode.c (t1_decoder_parse_charstrings)
[FT_DEBUG_LEVEL_TRACE]: Improve tracing message.
tt_sbit_decoder_load_image): Protect against integer overflows.
* src/pfr/pfrgload.c (pfr_glyph_load_simple): More bounding checks
for `x_control' and `y_control'.
new API FT_Get_Gasp to return entries of the GASP table
corresponding to a given character pixel size.
* src/sfnt/ttload.c: add version check for the GASP table,
in order to be better future-proof
* include/freetype/config/ftheader.h: add definition of
FT_GASP_H, corresponding to <freetype/ftgasp.h>
* src/base/rules.mk, src/base/Jamfile, modules.cfg,
builds/win32/visualc/freetype.dsp,
builds/win32/visualc/freetype.vcproj: Adding src/base/ftgasp.c
to the default build