Fixing ChangeLog entries.

Some formatting.

* src/truetype/ttgload.c (load_truetype_glyph)
[FT_CONFIG_OPTION_INCREMENTAL]: s/memset/ft_memset/.

* src/autohint/ahhint.c (ah_hint_edges_3): Fix compiler warning.
* src/cff/cffload.c (cff_encoding_load): Remove `memory' variable.
* src/cff/cffcmap.c (cff_cmap_encoding_init): Remove `psnames'
variable.
* src/truetype/ttgload.c (load_truetype_glyph): Remove statement
without effect.
* src/truetype/ttdriver (Get_Char_Index, Get_Next_Char): Removed.
This commit is contained in:
Werner Lemberg 2002-07-26 09:09:10 +00:00
parent 0327329db5
commit 7f74a52a21
28 changed files with 899 additions and 695 deletions

447
ChangeLog
View File

@ -1,190 +1,380 @@
2002-07-26 Werner Lemberg <wl@gnu.org>
* src/truetype/ttgload.c (load_truetype_glyph)
[FT_CONFIG_OPTION_INCREMENTAL]: s/memset/ft_memset/.
* src/autohint/ahhint.c (ah_hint_edges_3): Fix compiler warning.
* src/cff/cffload.c (cff_encoding_load): Remove `memory' variable.
* src/cff/cffcmap.c (cff_cmap_encoding_init): Remove `psnames'
variable.
* src/truetype/ttgload.c (load_truetype_glyph): Remove statement
without effect.
* src/truetype/ttdriver (Get_Char_Index, Get_Next_Char): Removed.
2002-07-24 Graham Asher <graham.asher@btinternet.com>
* src/truetype/ttobjs.c: fix for bug reported by Sven Neumann [sven@gimp.org]
on the FreeType development forum: "If FT_CONFIG_OPTION_INCREMENTAL is undefined
(this is the default), the TrueType loader crashes in line 852 of src/truetype/ttgload.c
when it tries to access face->glyph_locations."
* src/truetype/ttobjs.c: Fix for bug reported by Sven Neumann
[sven@gimp.org] on the FreeType development forum: "If
FT_CONFIG_OPTION_INCREMENTAL is undefined (this is the default), the
TrueType loader crashes in line 852 of src/truetype/ttgload.c when
it tries to access face->glyph_locations."
2002-07-18 Graham Asher <graham.asher@btinternet.com>
* include/freetype/freetype.h:
Added types and structures to support incremental typeface loading.
The FT_Incremental_Interface structure, defined in freetype.h,
is designed to be passed to FT_Open_Face to provide callback
functions to obtain glyph recipes and metrics, for fonts like
those passed from PostScript that do not necessarily provide
all, or any, glyph information, when first opened.
Added types and structures to support incremental typeface loading.
The FT_Incremental_Interface structure, defined in freetype.h, is
designed to be passed to FT_Open_Face to provide callback functions
to obtain glyph recipes and metrics, for fonts like those passed
from PostScript that do not necessarily provide all, or any, glyph
information, when first opened.
* include/freetype/config/ftoption.h
Added a new configuration macro, FT_CONFIG_OPTION_INCREMENTAL,
to enable incremental face loading. By default it is not defined.
* include/freetype/config/ftoption.h (FT_CONFIG_OPTION_INCREMENTAL):
New configuration macro to enable incremental face loading. By
default it is not defined.
* /src/base/ftobjs.c
Added incremental loading capability to FT_Open_Face.
* include/freetype/freetype.h (FT_Basic_Glyph_Metrics,
FT_Get_Glyph_Data_Func, FT_Get_Glyph_Metrics_Func,
FT_Incremental_Interface_Funcs, FT_Incremental_Interface)
[FT_CONFIG_OPTION_INCREMENTAL]: New.
(FT_Open_Args, FT_FaceRec) [FT_CONFIG_OPTION_INCREMENTAL]: New field
`incremental_interface'.
(FT_Open_Flags) [FT_CONFIG_OPTION_INCREMENTAL]: New enum
`ft_open_incremental'.
* /src/truetype/ttgload.c
Added the incremental loading system for the TrueType driver.
* include/freetype/fttypes.h: Include FT_CONFIG_CONFIG_H.
(FT_Data): New structure to represent binary data.
* /src/truetype/ttobjs.c
Added the incremental loading system for the TrueType driver.
* src/base/ftobjs.c (open_face) [FT_CONFIG_OPTION_INCREMENTAL]:
Add parameter for incremental loading.
(FT_Open_Face) [FT_CONFIG_OPTION_INCREMENTAL]: Use incremental
interface.
* /src/cid/cidgload.c
Added the incremental loading system for the CID driver.
* src/truetype/ttgload.c (load_truetype_glyph)
[FT_CONFIG_OPTION_INCREMENTAL]: Added the incremental loading system
for the TrueType driver.
(compute_glyph_metrics): Return FT_Error.
[FT_CONFIG_OPTION_INCREMENTAL]: Check for overriding metrics.
(TT_Load_Glyph) [FT_CONFIG_OPTION_INCREMENTAL]: Don't look for
the glyph table while handling an incremental font.
Get glyph offset.
* /src/sfnt/sfobjs.c
Changes to support incremental Type 42 fonts: assume a font has glyphs if it
has an incremental interface object.
* src/truetype/ttobjs.c (TT_Face_Init)
[FT_CONFIG_OPTION_INCOREMENTAL]: Added the incremental loading
system for the TrueType driver.
* /src/type1/t1gload.c
Added support for incrementally loaded Type 1 faces.
* src/cid/cidgload.c (cid_load_glyph)
[FT_CONFIG_OPTION_INCREMENTAL]: Added the incremental loading system
for the CID driver.
* src/sfnt/sfobjs.c (SFNT_Load_Face) [FT_CONFIG_OPTION_INCREMENTAL]:
Changes to support incremental Type 42 fonts: Assume a font has
glyphs if it has an incremental interface object.
* src/type1/t1gload.c (T1_Parse_Glyph): Renamed to...
(T1_Parse_Glyph_And_Get_Char_String): This.
[FT_CONFIG_OPTION_INCREMENTAL]: Added support for incrementally
loaded Type 1 faces.
(T1_Parse_Glyph): New function.
(T1_Load_Glyph): Updated.
2002-07-17 David Turner <david@freetype.org>
* include/freetype/cache/ftccache.h, src/cache/ftccache.i,
src/cache/ftccache.c: cleaning up the cache sub-system code, linear
hashing is now the default
Cleaning up the cache sub-system code; linear hashing is now the
default.
* include/freetype/config/ftoption.h, include/freetype/internal/tttypes.h,
src/base/ftobjs.c, src/bdf/bdfdrivr.c, src/cff/cffobjs.c,
src/pcf/pcfdrivr.c, src/sfnt/sfobjs.c, src/sfnt/ttcmap0.c,
src/sfnt/ttcmap0.h, src/sfnt/ttload.c, src/type1/t1objs.c,
src/type42/t42objs.c, src/type42/t42objs.h, src/type42/t42drivr.c,
src/winfonts/winfnt.c: code cleanup, FT_CONFIG_OPTION_USE_CMAPS is now
the default
* include/freetype/cache/ftccache.h, src/cache/ftccache.i,
src/cache/ftccache.c [!FTC_CACHE_USE_LINEAR_HASHING]: Removed.
(FTC_CACHE_USE_LINEAR_HASHING: Removed also.
* src/sfnt/ttload.c (TT_Load_SFNT_Header): fixed a recent bug that prevented
OpenType fonts to be recognized by FreeType
FT_CONFIG_OPTION_USE_CMAPS is now the default.
* include/freetype/internal/ftdriver.h (FT_Driver_ClassRec): Remove
`get_char_index' and `get_next_char'.
* include/freetype/config/ftoption.h,
include/freetype/internal/tttypes.h, src/base/ftobjs.c,
src/bdf/bdfdrivr.c, src/cff/cffobjs.c, src/pcf/pcfdrivr.c,
src/pfr/pfrdrivr.c, src/sfnt/sfobjs.c, src/sfnt/ttcmap0.c,
src/sfnt/ttcmap0.h, src/sfnt/ttload.c, src/type1/t1objs.c,
src/type42/t42objs.c, src/winfonts/winfnt.c
[!FT_CONFIG_OPTION_USE_CMAPS]: Removed. The new cmap code is now
the default.
* src/type42/t42objs.c (T42_CMap_CharIndex, T42_CMap_CharNext):
Removed.
* src/type42/t42objs.h: Updated.
* src/cid/cidriver.c (Cid_Get_Char_Index, Cid_Get_Next_Char):
Removed.
(t1_cid_driver_class): Updated.
* src/truetype/ttdriver.c (tt_driver_class): Updated.
* src/type1/t1driver.c (Get_Char_Index, Get_Next_Char): Removed
(t1_driver_class): Updated.
* src/type42/t42drivr.c (t42_driver_class): Updated.
* src/base/ftobjs.c (open_face): Select Unicode cmap by default.
* src/sfnt/ttload.c (TT_Load_SFNT_Header): Fixed a recent bug that
prevented OpenType fonts to be recognized by FreeType.
2002-07-11 David Turner <david@freetype.org>
* src/sfnt/ttload.c, src/sfnt/ttload.h, src/sfnt/ttdriver.c: changing
the SFNT loader to check for SFNT-based font files differently. We now
ignore the range "helper" fields and check the "head" table's magic
number instead.
Changing the SFNT loader to check for SFNT-based font files
differently. We now ignore the range "helper" fields and check the
"head" table's magic number instead.
* src/base/ftobject.c, src/base/fthash.c: updated object sub-system and
dynamic hash table implementation (still experimental, don't use)
* include/freetype/internal/tttypes.h (SFNT_HeaderRec): Add `offset'
field.
* include/freetype/t1tables.h, include/freetype/internal/psaux.h,
src/psaux/psobjs.c, src/type1/t1load.c, src/type1/t1tokens.h:
fixing a bug in the Type 1 loader that prevented valid font bounding
boxes to be loaded from multiple master fonts.
* src/sfnt/ttload.c (sfnt_dir_check): New function.
(TT_Load_SFNT_HeaderRec): Renamed to...
(TT_Load_SFNT_Header): This.
Implement new functionality.
* src/sfnt/ttload.h: Updated.
* src/sfnt/sfdriver.c (sfnt_interface): Updated.
* src/base/ftobject.c, src/base/fthash.c: Updated object sub-system
and dynamic hash table implementation (still experimental, don't
use).
* include/freetype/internal/fthash.h: Updated.
* include/freetype/internal/ftobjs.h (FT_LibraryRec): New member
`meta_class'.
Fixing a bug in the Type 1 loader that prevented valid font bounding
boxes to be loaded from multiple master fonts.
* include/freetype/t1tables.h (PS_BlendRec): Add `bboxes' field.
* include/freetype/internal/psaux.h (T1_FieldType): Add
`T1_FIELD_TYPE_BBOX'.
(T1_FieldLocation): Add `T1_FIELD_LOCATION_BBOX'.
(T1_FIELD_BBOX): New macro.
* src/psaux/psobjs.c (PS_Parser_LoadField): Handle T1_FIELD_TYPE_BBOX.
* src/type1/t1load.c (t1_allocate_blend): Create blend->bboxes.
(T1_Done_Blend): Free blend->bboxes.
(t1_load_keyword): Handle T1_FIELD_LOCATION_BBOX.
(parse_font_bbox): Commented out.
(t1_keywords): Comment out `parse_font_bbox'.
* src/type1/t1tokens.h: Define `FontBBox' field.
2002-07-10 David Turner <david@freetype.org>
* src/cff/cffobjs.c: small fix to select the Unicode charmap by default
when needed
* src/cff/cffobjs.c: Small fix to select the Unicode charmap by
default when needed.
Small fix to allow OpenType fonts to support Adobe charmaps when
needed.
* src/cff/cffobjs.c: small fix to allow OpenType fonts to support Adobe
charmaps when needed.
* src/cff/cffcmap.c, src/cff/cffcmap.h: New files to support
charmaps for CFF fonts.
* src/cff/cffcmap.c, src/cff/cffcmap.h, Jamfile, rules.mk: new files added
to support charmaps for CFF fonts
* src/cff/cff.c, src/cff/Jamfile, src/cff/rules.mk: Updated.
* src/cff/cffload.c, src/cff/cffload.h, src/cff/cffobjs.c,
src/cff/cffobjs.h, src/cff/cffparse.c, src/cffparse.h, src/cff/cffgload.c,
src/cff/cffgload.h: adding support for CFF charmaps, reformatting the
sources, and removing some bugs in the Encoding and Charset loaders
* include/freetype/internal/cfftypes.h (CFF_EncodingRec): Use
fixed-length arrays for `sids' and `codes'. Add `count' member.
(CFF_FontRec): Add `psnames' member.
2002-07-09 Owen Taylor <owen@redhat.com>
* src/cff/cffdrivr.c, src/cff/cffload.c, src/cff/cffload.h,
src/cff/cffobjs.c, src/cff/cffobjs.h, src/cff/cffparse.c,
src/cffparse.h, src/cff/cffgload.c, src/cff/cffgload.h: Adding
support for CFF charmaps, reformatting the sources, and removing
some bugs in the Encoding and Charset loaders.
Many fonts renamed to use lowercase only:
* src/pshinter/pshglob.c: fixed a bug that prevented the hinter from using
correct standard width and height values. resulting in hinting bugs with
certain fonts (e.g. Utopia)
CFF_Builder_Init -> cff_builder_init
CFF_Builder_Done -> cff_builder_done
CFF_Init_Decoder -> cff_decoder_init
CFF_Parse_CharStrings -> cff_decoder_parse_charstrings
CFF_Load_Glyph -> cff_slot_load
CFF_Init_Decoder -> cff_decoder_init
CFF_Prepare_Decoder -> cff_decoder_prepare
CFF_Get_Standard_Encoding -> cff_get_standard_encoding
CFF_Access_Element -> cff_index_access_element
CFF_Forget_Element -> cff_index_forget_element
CFF_Get_Name -> cff_index_get_name
CFF_Get_String -> cff_index_get_sid_string
CFF_Get_FD -> cff_fd_select_get
CFF_Done_Charset -> cff_charset_done
CFF_Load_Charset -> cff_charset_load
CFF_Done_Encoding -> cff_encoding_done
CFF_Load_Encoding -> cff_encoding_load
CFF_Done_SubFont -> cff_subfont_done
CFF_Load_Font -> cff_font_load
CFF_Done_Font -> cff_font_done
CFF_Size_Get_Global_Funcs -> cff_size_get_global_funcs
CFF_Size_Done -> cff_size_done
CFF_Size_Init -> cff_size_init
CFF_Size_Reset -> cff_size_reset
CFF_GlyphSlot_Done -> cff_slot_done
CFF_GlyphSlot_Init -> cff_slot_init
CFF_StrCopy -> cff_strcpy
CFF_Face_Init -> cff_face_init
CFF_Face_Done -> cff_face_done
CFF_Driver_Init -> cff_driver_init
CFF_Driver_Done -> cff_driver_done
CFF_Parser_Init -> cff_parser_init
CFF_Parser_Run -> cff_parser_run
add_point -> cff_builder_add_point
add_point1 -> cff_builder_add_point1
add_contour -> cff_builder_add_contour
close_contour -> cff_builder_close_contour
cff_explicit_index -> cff_index_get_pointers
2002-07-09 Owen Taylor <owen@redhat.com>
* src/pshinter/pshglob.c (psh_globals_new): Fixed a bug that
prevented the hinter from using correct standard width and height
values, resulting in hinting bugs with certain fonts (e.g. Utopia).
2002-07-07 David Turner <david@freetype.org>
* src/base/ftglyph.c (FT_Glyph_To_Bitmap): added code to return succesfully
when the function is called with a bitmap glyph (the previous code simply
returned with an error)
* src/base/ftglyph.c (FT_Glyph_To_Bitmap): Added code to return
successfully when the function is called with a bitmap glyph (the
previous code simply returned with an error).
* docs/DEBUG.TXT: adding debugging support documentation
* docs/DEBUG.TXT: Adding debugging support documentation.
* src/base/ftdebug.c (ft_debug_init), builds/win32/ftdebug.c
(ft_debug_init), builds/amiga/src/ftdebug.c (ft_debug_init): changed the
syntax of the FT2_DEBUG environment variable used to control debugging
output (i.e. logging and error messages). It must now look like:
* src/base/ftdebug.c (ft_debug_init), builds/win32/ftdebug.c
(ft_debug_init), builds/amiga/src/ftdebug.c (ft_debug_init): Changed
the syntax of the FT2_DEBUG environment variable used to control
debugging output (i.e. logging and error messages). It must now
look like:
any:6 memory:4 io:3 or
any:6,memory:4,io:3 or
any:6;memory:4;io:3
any:6 memory:4 io:3 or
any:6,memory:4,io:3 or
any:6;memory:4;io:3
2002-07-07 Owen Taylor <owen@redhat.com>
* src/pshinter/pshglob.h, src/pshinter/pshglob.c: adding support for
blue fuzz
* src/pshinter/pshglob.c (psh_blues_snap_stem): Adding support for
blue fuzz.
* src/pshinter/pshglob.h (PSH_BluesRec): Add `blue_fuzz' field.
* src/type1/t1load.c (T1_Open_Face): Initialize `blue_fuzz'.
* include/freetype/freetype.h, src/base/ftobjs.h,
freetype/internal/ftobjs.h, freetype/internal/psaux.h,
freetype/internal/pshints.h, src/psaux/t1decode.c, src/cff/cffgload.h,
src/cff/cffgload.c, src/pshinter/pshalgo1.h, src/pshinter/pshalgo1.c,
src/pshinter/pshalgo2.h, src/pshinter/pshalgo2.c, src/pshinter/pshalgo3.h,
src/pshinter/pshalgo3.c: Adding support for hinter-specific bit flags,
and the new FT_Set_Hint_Flags high-level API
Adding support for hinter-specific bit flags, and the new
FT_Set_Hint_Flags high-level API.
* include/freetype/freetype.h (FT_Set_Hint_Flags): New function.
(FT_HINT_NO_INTEGER_STEM, FT_HINT_NO_HSTEM_ALIGN,
FT_HINT_NO_VSTEM_ALIGN): New macros.
* include/freetype/internal/ftobjs.h (FT_Face_InternalRec): Add
`hint_flags' member.
* src/base/ftobjs.c (FT_Set_Hint_Flags): New function.
* include/freetype/internal/psaux.h (T1_DecoderRec): Add `hint_flags'
member.
* include/freetype/internal/pshints.h (T1_Hints_ApplyFunc,
T2_Hints_ApplyFunc): Add parameter to pass hint flags.
* src/psaux/t1decode.c (T1_Decoder_Parse_Charstrings,
T1_Decoder_Init): Use decoder->hint_flags.
* src/cff/cffgload.h (CFF_Builder): Add `hint_flags' field.
* src/cff/cffgload.c (CFF_Builder_Init): Set builder->hint_flags.
(CFF_Parse_CharStrings): Updated.
* src/pshinter/pshalgo1.c (ps1_hints_apply): Add parameter to handle
hint flags (unused).
* src/pshinter/pshalgo1.h: Updated.
* src/pshinter/pshalgo2.c (ps2_hints_apply): Add parameter to handle
hint flags (unused).
* src/pshinter/pshalgo2.h: Updated.
* src/pshinter/pshalgo3.c (ps3_hints_apply): Add parameter to handle
hint flags.
* src/pshinter/pshalgo3.h: Updated.
2002-07-04 David Turner <david@freetype.org>
* src/pfr/pfrobjs.c (pfr_slot_load): fixed a small bug that returned
incorrect advances when the outline resolution was different from the
metrics resolution
* src/pfr/pfrobjs.c (pfr_slot_load): Fixed a small bug that returned
incorrect advances when the outline resolution was different from
the metrics resolution.
* src/autohint/ahhint.c: removing compiler warnings
* src/autohint/ahhint.c: Removing compiler warnings.
* src/autohint/ahglyph.c: slight improvements to the serif detection
code. More work is needed though..
* src/autohint/ahglyph.c: s/FT_MEM_SET/FT_ZERO/ where appropriate.
(ah_outline_link_segments): Slight improvements to the serif
detection code. More work is needed though.
2002-07-03 David Turner <david@freetype.org>
* src/autohint/ahglobal.c, src/autohint/ahtypes.h, src/autohint/ahhint.c:
small improvements to the automatic hinter. un-even stem-widths have now
disappeared and everything looks much better, even if there are still
issues with serifed fonts.
Small improvements to the automatic hinter. Uneven stem-widths have
now disappeared and everything looks much better, even if there are
still issues with serifed fonts.
* src/autohint/ahtypes.h (AH_Globals): Added `stds' array.
* src/autohint/ahhint.c (OPTIM_STEM_SNAP): New #define.
(ah_snap_width): Commented out.
(ah_align_linked_edge): Renamed to...
(ah_compute_stem_width): This.
Don't allow uneven stem-widths.
(ah_align_linked_edge): New function.
(ah_align_serifed_edge): Don't strengthen serifs.
(ah_hint_edges_3, ah_hinter_scale_globals): Updated.
2002-07-03 Owen Taylor <owen@redhat.com>
* src/pshinter/pshalgo3.c, src/pshinter/pshalgo3.h, src/pshinter/pshalgo.h,
src/pshinter/pshinter.c: adding new algorithm based on Owen Taylor's recent
work
Adding new algorithm based on Owen Taylor's recent work.
* src/pshinter/pshalgo3.c, src/pshinter/pshalgo3.h: New files.
* src/pshinter/pshalgo.h: Updated.
Use pshalgo3 by default.
* src/pshinter/pshinter.c: Include pshalgo3.c.
* src/pshinter/Jamfile, src/pshinter/rules.mk: Updated.
2002-07-01 Owen Taylor <owen@redhat.com>
* src/pshinter/pshalgo2.c (psh2_glyph_find_strong_points): fix a bug
where, if a glyph has more than hint mask, the second mask gets applied
to points that should have been covered by the first mask.
* src/pshinter/pshalgo2.c (psh2_glyph_find_strong_points): Fix a bug
where, if a glyph has more than hint mask, the second mask gets
applied to points that should have been covered by the first mask.
2002-07-01 Keith Packard <keithp@keithp.com>
* src/sfnt/ttcmap0.c: fixing the cmap 8 and 12 parsing routines
* src/sfnt/ttcmap0.c (tt_cmap8_char_next, tt_cmap12_char_next):
Fixing the cmap 8 and 12 parsing routines.
2002-07-01 David Turner
2002-07-01 David Turner <david@freetype.org>
* include/freetype/ftsynth.h, src/base/ftsynth.c: rewriting the automatic
style synthesis functions, now renamed to FT_GlyphSlot_Oblique and
FT_GlyphSlot_Embolden
* src/base/ftsynth.c: Include FT_TRIGONOMETRY_H.
(FT_Outline_Embolden): Renamed to...
(FT_GlyphSlot_Embolden): This.
Updated to new trigonometric functions.
(FT_Outline_Oblique): Renamed to...
(FT_GlyphSlot_Oblique): This.
(ft_norm): Removed.
* include/freetype/ftsynth.h: Updated.
2002-06-26 David Turner
2002-06-26 David Turner <david@freetype.org>
* include/freetype/internal/ftobject.h: updating the object sub-system
definitions (still experimental)
* include/freetype/internal/ftobject.h: Updating the object
sub-system definitions (still experimental).
* src/base/fthash.c (ft_hash_remove): fixing a small reallocation bug
* src/base/fthash.c (ft_hash_remove): Fixing a small reallocation
bug.
* include/freetype/fttrigon.h, src/base/fttrigon.c: adding
FT_Vector_From_Polar and FT_Angle_Diff to the trigonometric functions
* src/base/fttrigon.c (FT_Vector_From_Polar, FT_Angle_Diff): New
functions.
* include/freetype/fttrigon.h: Updated.
* include/freetype/ftstroker.h, src/base/ftstroker.c, src/base/Jamfile:
adding path stroker component (work in progress)
* src/truetype/ttgload.c (TT_Load_Composite_Glyph),
src/base/ftoutln.c (FT_Vector_Transform): fixed Werner's latest
fix. FT_Vector_Transform wasn't buggy, the TrueType composite loader
was...
Adding path stroker component (work in progress).
* include/freetype/ftstroker.h, src/base/ftstroker.c: New files.
* src/base/Jamfile: Updated.
* include/freetype/config/ftheader.h (FT_STROKER_H): New macro.
* src/truetype/ttgload.c (TT_Load_Composite_Glyph),
src/base/ftoutln.c (FT_Vector_Transform): Fixed Werner's latest fix.
FT_Vector_Transform wasn't buggy, the TrueType composite loader was.
2002-06-24 Werner Lemberg <wl@gnu.org>
* include/freetype/freetype.h (FREETYPE_PATCH): Set to 3.
2002-06-21 David Turner <david@freetype.org>
@ -272,7 +462,7 @@
Updated Win32/VC++ projects to include the new PFR driver.
* builds\win32\visualc\freetype.dsp: Updated.
* builds/win32/visualc/freetype.dsp: Updated.
2002-06-16 Anthony Fok <fok@debian.org>
@ -814,16 +1004,21 @@
function. This will be used in the near future to panic in case of
unexpected exception (which shouldn't happen in theory).
* include/freetype/internal/fthash.h, src/base/fthash.c: Adding a
generic implementation of dynamic hash tables using a linear
algorithm (to get rid of `stalls' during resizes). This will be
used in the future in at least three parts of the library: the cache
* include/freetype/internal/fthash.h, src/base/fthash.c: New files.
This is generic implementation of dynamic hash tables using a linear
algorithm (to get rid of `stalls' during resizes). In the future
this will be used in at least three parts of the library: the cache
sub-system, the object sub-system, and the memory debugger.
* include/freetype/internal/ftcore.h: Added this header file to
group all new definitions related to exception handling and memory
management. It is very likely that this file will disappear or be
renamed in the future.
* src/base/Jamfile: Updated.
* include/freetype/internal/internal.h (FT_INTERNAL_HASH_H,
FT_INTERNAL_OBJECT_H): New macros.
* include/freetype/internal/ftcore.h: New file to group all new
definitions related to exception handling and memory management. It
is very likely that this file will disappear or be renamed in the
future.
* include/freetype/internal/ftobject.h, include/freetype/ftsysmem.h:
Adding comments to better explain the object sub-system as well as

View File

@ -1,164 +1,162 @@
Debugging within the FreeType sources:
======================================
I. Configuration macros:
========================
I. Configuration macros
-----------------------
There are several ways to enable debugging features in a FreeType 2 builds.
This is controled through the definition of special macros located in the
file "ftoptions.h". The macros are:
There are several ways to enable debugging features in a FreeType 2
builds. This is controlled through the definition of special macros
located in the file "ftoptions.h". The macros are:
FT_DEBUG_LEVEL_ERROR ::
FT_DEBUG_LEVEL_ERROR
#define this macro if you want to compile the FT_ERROR macro calls
used to print error messages during program execution. This will not
stop the program, but is very useful to spot invalid fonts during
development and code wordarounds for them.
#define this macro if you want to compile the FT_ERROR macro calls
used to print error messages during program execution. This will
not stop the program, but is very useful to spot invalid fonts
during development and code wordarounds for them.
FT_DEBUG_LEVEL_TRACE
FT_DEBUG_LEVEL_TRACE ::
#define this macro if you want to compile both the FT_ERROR macro
and the FT_TRACE one. This also includes the variants FT_TRACE0,
FT_TRACE1, FT_TRACE2, ..., FT_TRACE6.
#define this macro if you want to compile both the FT_ERROR macro and
the FT_TRACE one. This also includes the variants FT_TRACE0, FT_TRACE1,
FT_TRACE2, ..., FT_TRACE6.
The trace macros are used to send debugging messages when an
appropriate "debug level" is configured at runtime through the
FT2_DEBUG environment variable (more on this later).
The trace macros are used to send debugging messages when an appropriate
"debug level" is configured at runtime through the FT2_DEBUG environment
variable (more on this later)
FT_DEBUG_MEMORY
If this macro is #defined, the FreeType engines is linked with a
small but effective debugging memory manager that tracks all
allocations and frees that are performed within the font engine.
FT_DEBUG_MEMORY ::
when this macro is #defined, the FreeType engines is linked with a small
but effective debugging memory manager that tracks all allocations and
frees that are performed within the font engine.
When the FT2_DEBUG_MEMORY environment variable is defined at runtime, a
call to FT_Done_FreeType will dump memory statistics, including the list of
leaked memory blocks with the source locations where these were allocated.
It's always a very good idea to define this in development builds. This
works with _any_ program linked to FreeType, but requires a big deal of
memory (the debugging memory manager never frees the blocks to the
heap in order to detect double frees).
When the FT2_DEBUG_MEMORY environment variable is defined at
runtime, a call to FT_Done_FreeType will dump memory statistics,
including the list of leaked memory blocks with the source locations
where these were allocated. It's always a very good idea to define
this in development builds. This works with _any_ program linked to
FreeType, but requires a big deal of memory (the debugging memory
manager never frees the blocks to the heap in order to detect double
frees).
When FT2_DEBUG_MEMORY isn't defined at runtime, the debugging memory
manager is ignored, and performance is un-affected.
II. Debugging macros:
=====================
II. Debugging macros
--------------------
Several macros can be used within the FreeType sources to help debugging
its code:
Several macros can be used within the FreeType sources to help debugging
its code:
1. FT_ERROR(( .. ))
1. FT_ERROR(( ... ))
this macro is used to send debug messages that indicate relatively serious
errors (like broken font files), but will not stop the execution of the
running program. Its code is compiled only when either FT_DEBUG_LEVEL_ERROR
or FT_DEBUG_LEVEL_TRACE are defined in "ftoption.h"
This macro is used to send debug messages that indicate relatively
serious errors (like broken font files), but will not stop the
execution of the running program. Its code is compiled only when
either FT_DEBUG_LEVEL_ERROR or FT_DEBUG_LEVEL_TRACE are defined in
"ftoption.h".
Note that you must use with a printf-like signature, but with double
parentheses, like in:
Note that you must use with a printf-like signature, but with double
parentheses, like in:
FT_ERROR(( "your %s is not %s\n", "foo", "bar" ));
FT_ERROR(( "your %s is not %s\n", "foo", "bar" ));
2. FT_ASSERT( condition )
2. FT_ASSERT( condition )
this macro is used to check strong assertions at runtime. If its condition
isn't TRUE, the program will abort with a panic message. Its code is
compiled when either FT_DEBUG_LEVEL_ERROR or FT_DEBUG_LEVEL_TRACE are
defined. You don't need double-parentheses here. For example:
This macro is used to check strong assertions at runtime. If its
condition isn't TRUE, the program will abort with a panic message.
Its code is compiled when either FT_DEBUG_LEVEL_ERROR or
FT_DEBUG_LEVEL_TRACE are defined. You don't need double-parentheses
here. For example:
FT_ASSERT( ptr != NULL );
FT_ASSERT( ptr != NULL );
3. FT_TRACE( level, (message...) )
3. FT_TRACE( level, (message...) )
the FT_TRACE macro is used to send general-purpose debugging messages
during program execution. This macro uses an *implicit* macro named
FT_COMPONENT used to name the current FreeType component being run.
The FT_TRACE macro is used to send general-purpose debugging
messages during program execution. This macro uses an *implicit*
macro named FT_COMPONENT used to name the current FreeType component
being run.
The developer should always define FT_COMPONENT as appropriate, for
example as in:
The developer should always define FT_COMPONENT as appropriate, for
example as in:
#undef FT_COMPONENT
#define FT_COMPONENT trace_io
#undef FT_COMPONENT
#define FT_COMPONENT trace_io
the value of the FT_COMPONENT macro is an enumeration named trace_XXXX
where XXXX is one of the component names defined in the internal file
<freetype/internal/fttrace.h>
The value of the FT_COMPONENT macro is an enumeration named
trace_XXXX where XXXX is one of the component names defined in the
internal file <freetype/internal/fttrace.h>.
Each such component is assigned a "debug level", ranging from 0 to 6
when a program linked with FreeType starts, through the use of the FT2_DEBUG
environment variable, described later.
Each such component is assigned a "debug level", ranging from 0 to 6
when a program linked with FreeType starts, through the use of the
FT2_DEBUG environment variable, described later.
When FT_TRACE is called, its level is compared to the one of the
corresponding component. Messages with trace levels *higher* than the
corresponding component level are filtered and never printed.
When FT_TRACE is called, its level is compared to the one of the
corresponding component. Messages with trace levels *higher* than
the corresponding component level are filtered and never printed.
this means that trace messages with level 0 are always printed, those
with level 2 are only printed when the component level is *at least* 2
This means that trace messages with level 0 are always printed,
those with level 2 are only printed when the component level is *at
least* 2.
The second parameter to FT_TRACE must contain parentheses and correspond
to a print-like call, as in:
The second parameter to FT_TRACE must contain parentheses and
correspond to a print-like call, as in:
FT_TRACE( 2, ( "your %s is not %s\n", "foo", "bar" ) )
FT_TRACE( 2, ( "your %s is not %s\n", "foo", "bar" ) )
The shortcut macros FT_TRACE0, FT_TRACE1, FT_TRACE2_, ... FT_TRACE6 can
be used with constant level indices, and are much cleaner to use, as in
The shortcut macros FT_TRACE0, FT_TRACE1, FT_TRACE2_, ... FT_TRACE6
can be used with constant level indices, and are much cleaner to
use, as in
FT_TRACE2(( "your %s is not %s\n", "foo", "bar" ));
III. Environment variables:
===========================
III. Environment variables
--------------------------
The following environment variables control debugging output and behaviour
of FreeType at runtime:
The following environment variables control debugging output and
behaviour of FreeType at runtime:
FT2_DEBUG
this variable is only used when FreeType is built with FT_DEBUG_LEVEL_TRACE
defined. It contains a list of component level definitions, following this
format:
component1:level1 component2:level2 component3:level3 ...
This variable is only used when FreeType is built with
FT_DEBUG_LEVEL_TRACE defined. It contains a list of component level
definitions, following this format:
component1:level1 component2:level2 component3:level3 ...
where "componentX" is the name of a tracing component, as defined in
"fttrace.h", but without the "trace_" prefix, and "levelX" is the
"fttrace.h", but without the "trace_" prefix, and "levelX" is the
corresponding level to use at runtime.
"any" is a special component name that will be interpreted as
"any/all components". For example, the following definitions
"any" is a special component name that will be interpreted as
"any/all components". For example, the following definitions
set FT2_DEBUG=any:2 memory:5 io:4 (on Windows)
export FT2_DEBUG="any:2 memory:5 io:4" (on Linux)
both stipulate that all components should have level 2, except for the
memory and io components which will be set to trace levels 5 and 4
respectively.
both stipulate that all components should have level 2, except for
the memory and io components which will be set to trace levels 5 and
4 respectively.
FT2_DEBUG_MEMORY
this environment variable, when defined, tells FreeType to use a debugging
memory manager that will track leaked memory blocks as well as other common
errors like double frees. It is also capable of reporting _where_ the
leaked blocks were allocated, which considerably saves time when
debugging new additions to the library.
This code is only compiled when FreeType is built with the FT_DEBUG_MEMORY
macro #defined in "ftoption.h" though, it will be ignored in other builds.
This environment variable, when defined, tells FreeType to use a
debugging memory manager that will track leaked memory blocks as
well as other common errors like double frees. It is also capable
of reporting _where_ the leaked blocks were allocated, which
considerably saves time when debugging new additions to the library.
This code is only compiled when FreeType is built with the
FT_DEBUG_MEMORY macro #defined in "ftoption.h" though, it will be
ignored in other builds.
Voila,
- David Turner
used like printf( format, ... ), but with double quotes. This will
send a message to the standard error descriptor (stderr on most systems)
in certain builds of the library
End of file

View File

@ -207,21 +207,22 @@ FT_BEGIN_HEADER
/* FT_Basic_Glyph_Metrics */
/* */
/* <Description> */
/* A small glyph metrics structure used to return information */
/* for incrementally defined fonts (see FT_Incremental_Interface). */
/* A small glyph metrics structure used to return information for */
/* incrementally defined fonts (see @FT_Incremental_Interface). */
/* */
/* <Fields> */
/* bearing_x :: Left side bearing in font units. */
/* */
/* bearing_y :: Top side bearing in font units. */
/* */
/* advance :: Advance in font units. */
/* advance :: Advance in font units. */
/* */
typedef struct FT_Basic_Glyph_Metrics_
typedef struct FT_Basic_Glyph_Metrics_
{
FT_Long bearing_x;
FT_Long bearing_y;
FT_Long advance;
FT_Long bearing_x;
FT_Long bearing_y;
FT_Long advance;
} FT_Basic_Glyph_Metrics;
#endif /* #ifdef FT_CONFIG_OPTION_INCREMENTAL */
@ -508,6 +509,7 @@ FT_BEGIN_HEADER
#ifdef FT_CONFIG_OPTION_INCREMENTAL
/*************************************************************************/
/* */
@ -515,23 +517,26 @@ FT_BEGIN_HEADER
/* FT_Get_Glyph_Data_Func */
/* */
/* <Description> */
/* A type definition for a function to get glyph data from a */
/* face that supplies glyph data incrementally, after the face */
/* object has been created */
/* A type definition for a function to get glyph data from a face */
/* that supplies glyph data incrementally, after the face object has */
/* been created. */
/* */
/* <Input> */
/* object :: a pointer to the user's data, specified by the 'object' */
/* field in FT_Incremental_Interface */
/* object :: A pointer to the user's data, specified by the `object' */
/* field in @FT_Incremental_Interface. */
/* */
/* index :: the glyph index */
/* index :: The glyph index. */
/* */
/* <Output> */
/* data :: the position and length of the data */
/* data :: The position and length of the data. */
/* */
/* <Return> */
/* a standard error code */
/* FreeType error code. O means success. */
/* */
typedef FT_Error (*FT_Get_Glyph_Data_Func)(void* object,FT_UInt index,FT_Data* data);
typedef FT_Error
(*FT_Get_Glyph_Data_Func)( void* object,
FT_UInt index,
FT_Data* data );
/*************************************************************************/
@ -540,26 +545,30 @@ FT_BEGIN_HEADER
/* FT_Get_Glyph_Metrics_Func */
/* */
/* <Description> */
/* A type definition for a function to get glyph metrics from a */
/* face that supplies glyph metrics incrementally, after the face */
/* object has been created */
/* A type definition for a function to get glyph metrics from a face */
/* that supplies glyph metrics incrementally, after the face object */
/* has been created. */
/* */
/* <Input> */
/* object :: a pointer to the user's data, specified by the 'object' */
/* field in FT_Incremental_Interface */
/* object :: A pointer to the user's data, specified by the */
/* `object' field in @FT_Incremental_Interface. */
/* */
/* index :: the glyph index */
/* index :: The glyph index. */
/* */
/* vertical :: true for vertical layout, false for horizontal layout */
/* vertical :: True for vertical layout, false for horizontal layout. */
/* */
/* <Output> */
/* metrics :: the glyph metrics in font units */
/* metrics :: The glyph metrics in font units. */
/* */
/* <Return> */
/* a standard error code */
/* FreeType error code. O means success. */
/* */
typedef FT_Error (*FT_Get_Glyph_Metrics_Func)(void* object,FT_UInt index,FT_Bool vertical,
FT_Basic_Glyph_Metrics* metrics,FT_Bool* found);
typedef FT_Error
(*FT_Get_Glyph_Metrics_Func)( void* object,
FT_UInt index,
FT_Bool vertical,
FT_Basic_Glyph_Metrics* metrics,
FT_Bool* found );
/*************************************************************************/
@ -569,20 +578,21 @@ FT_BEGIN_HEADER
/* */
/* <Description> */
/* A table of functions for accessing fonts that load data */
/* incrementally. Used in FT_Incremental_Interface */
/* incrementally. Used in @FT_Incremental_Interface. */
/* */
/* <Fields> */
/* get_glyph_data :: The function to get glyph data. Must not be */
/* null. */
/* get_glyph_data :: The function to get glyph data. Must not be */
/* null. */
/* */
/* get_glyph_metrics :: The function to get glyph metrics. May be */
/* get_glyph_metrics :: The function to get glyph metrics. May be */
/* null if the font does not provide */
/* overriding glyph metrics. */
/* */
typedef struct FT_Incremental_Interface_Funcs_
typedef struct FT_Incremental_Interface_Funcs_
{
FT_Get_Glyph_Data_Func get_glyph_data;
FT_Get_Glyph_Metrics_Func get_glyph_metrics;
FT_Get_Glyph_Data_Func get_glyph_data;
FT_Get_Glyph_Metrics_Func get_glyph_metrics;
} FT_Incremental_Interface_Funcs;
@ -592,28 +602,30 @@ FT_BEGIN_HEADER
/* FT_Incremental_Interface */
/* */
/* <Description> */
/* This interface structure is provided to FT_Open_Face to allow */
/* incremental faces to be opened. */
/* This interface structure is provided to @FT_Open_Face to allow */
/* incremental faces to be opened. */
/* */
/* A incremental face supplies no glyph data when it is opened. */
/* Instead the glyph data is supplied using a callback function. */
/* Optionally, metrics that override the metrics in the typeface */
/* data can also be supplied using another callback function. */
/* An incremental face supplies no glyph data when it is opened. */
/* Instead, the glyph data is supplied using a callback function. */
/* Optionally, metrics that override the metrics in the typeface data */
/* can also be supplied using another callback function. */
/* */
/* <Fields> */
/* funcs :: The table of functions */
/* funcs :: The table of functions. */
/* */
/* object :: The pointer passed to the functions. Usually it */
/* points to the object from which glyph and metric */
/* data is obtained. */
/* object :: The pointer passed to the functions. Usually it points */
/* to the object from which glyph and metric data is */
/* obtained. */
/* */
typedef struct FT_Incremental_Interface_
{
const FT_Incremental_Interface_Funcs* funcs;
void* object;
typedef struct FT_Incremental_Interface_
{
const FT_Incremental_Interface_Funcs* funcs;
void* object;
} FT_Incremental_Interface;
#endif /* #ifdef FT_CONFIG_OPTION_INCREMENTAL */
#endif /* FT_CONFIG_OPTION_INCREMENTAL */
/*************************************************************************/
@ -848,7 +860,7 @@ FT_BEGIN_HEADER
FT_Face_Internal internal;
#ifdef FT_CONFIG_OPTION_INCREMENTAL
FT_Incremental_Interface* incremental_interface;
FT_Incremental_Interface* incremental_interface;
#endif
/*@private end */
@ -1578,18 +1590,20 @@ FT_BEGIN_HEADER
/* `flags' field of the @FT_Open_Args structure. */
/* */
/* <Fields> */
/* ft_open_memory :: This is a memory-based stream. */
/* ft_open_memory :: This is a memory-based stream. */
/* */
/* ft_open_stream :: Copy the stream from the `stream' field. */
/* ft_open_stream :: Copy the stream from the `stream' field. */
/* */
/* ft_open_pathname :: Create a new input stream from a C pathname. */
/* ft_open_pathname :: Create a new input stream from a C */
/* path name. */
/* */
/* ft_open_driver :: Use the `driver' field. */
/* ft_open_driver :: Use the `driver' field. */
/* */
/* ft_open_params :: Use the `num_params' & `params' field. */
/* ft_open_params :: Use the `num_params' & `params' field. */
/* */
/* ft_open_incremental :: Use the 'incremental_interface' field. */
/* (Available if FT_CONFIG_OPTION_INCREMENTAL is defined.) */
/* ft_open_incremental :: Use the 'incremental_interface' field. */
/* (Available if @FT_CONFIG_OPTION_INCREMENTAL */
/* is defined.) */
/* */
/* <Note> */
/* The `ft_open_memory', `ft_open_stream', and `ft_open_pathname' */
@ -1603,7 +1617,7 @@ FT_BEGIN_HEADER
ft_open_driver = 8,
ft_open_params = 16
#ifdef FT_CONFIG_OPTION_INCREMENTAL
,ft_open_incremental = 32
,ft_open_incremental = 32
#endif
} FT_Open_Flags;
@ -1666,10 +1680,10 @@ FT_BEGIN_HEADER
/* params :: Extra parameters passed to the font driver when */
/* opening a new face. */
/* */
/* incremental_interface :: If non-null, an interface used to */
/* implement incremental font loading. This field */
/* exists only if FT_CONFIG_OPTION_INCREMENTAL is */
/* defined. */
/* incremental_interface :: */
/* If non-null, an interface used to implement */
/* incremental font loading. This field exists only */
/* if @FT_CONFIG_OPTION_INCREMENTAL is defined. */
/* */
/* <Note> */
/* The stream type is determined by the contents of `flags' which */
@ -1692,21 +1706,21 @@ FT_BEGIN_HEADER
/* otherwise. */
/* */
/* If the `ft_open_incremental' bit is set 'incremental_interface' */
/* will be used, else it is ignored. This feature is available only */
/* if FT_CONFIG_OPTION_INCREMENTAL is defined. */
/* will be used, else it is ignored. This feature is available only */
/* if @FT_CONFIG_OPTION_INCREMENTAL is defined. */
/* */
typedef struct FT_Open_Args_
{
FT_Open_Flags flags;
const FT_Byte* memory_base;
FT_Long memory_size;
FT_String* pathname;
FT_Stream stream;
FT_Module driver;
FT_Int num_params;
FT_Parameter* params;
FT_Open_Flags flags;
const FT_Byte* memory_base;
FT_Long memory_size;
FT_String* pathname;
FT_Stream stream;
FT_Module driver;
FT_Int num_params;
FT_Parameter* params;
#ifdef FT_CONFIG_OPTION_INCREMENTAL
FT_Incremental_Interface* incremental_interface;
FT_Incremental_Interface* incremental_interface;
#endif
} FT_Open_Args;
@ -2934,7 +2948,6 @@ FT_BEGIN_HEADER
FT_Matrix* matrix );
/*@***********************************************************************/
/* */
/* <Function> */
@ -2948,16 +2961,16 @@ FT_BEGIN_HEADER
/* face :: A handle to the source face object. */
/* */
/* <Input> */
/* flags :: A set of bit flags that control the hinting process */
/* see the FT_HINT_XXX constants for details. */
/* flags :: A set of bit flags that control the hinting process. */
/* See the FT_HINT_XXX constants for details. */
/* */
/* <Note> */
/* The interpretation of the flags depends on the hinter module in */
/* use. Not all modules will support all flags */
/* use. Not all modules will support all flags. */
/* */
FT_EXPORT( void )
FT_Set_Hint_Flags( FT_Face face,
FT_ULong hint_flags );
FT_Set_Hint_Flags( FT_Face face,
FT_ULong hint_flags );
/*@***********************************************************************/
@ -2966,10 +2979,11 @@ FT_BEGIN_HEADER
/* FT_HINT_NO_INTEGER_STEM */
/* */
/* <Description> */
/* A bit-field constant, used with FT_Set_Hint_Flags() to to suppress */
/* snapping of stem widths to integer values */
/* A bit-field constant, used with @FT_Set_Hint_Flags to to suppress */
/* snapping of stem widths to integer values. */
/* */
#define FT_HINT_NO_INTEGER_STEM 1
#define FT_HINT_NO_INTEGER_STEM 1
/*@***********************************************************************/
/* */
@ -2977,10 +2991,11 @@ FT_BEGIN_HEADER
/* FT_HINT_NO_HSTEM_ALIGN */
/* */
/* <Description> */
/* A bit-field constant, used with FT_Set_Hint_Flags() to to suppress */
/* A bit-field constant, used with @FT_Set_Hint_Flags to to suppress */
/* alignment of horizontal stems with the pixel grid. */
/* */
#define FT_HINT_NO_HSTEM_ALIGN 2
#define FT_HINT_NO_HSTEM_ALIGN 2
/*@***********************************************************************/
/* */
@ -2988,13 +3003,15 @@ FT_BEGIN_HEADER
/* FT_HINT_NO_VSTEM_ALIGN */
/* */
/* <Description> */
/* A bit-field constant, used with FT_Set_Hint_Flags() to to suppress */
/* alignment of vertical stems with the pixel grid */
/* A bit-field constant, used with @FT_Set_Hint_Flags to to suppress */
/* alignment of vertical stems with the pixel grid. */
/* */
#define FT_HINT_NO_VSTEM_ALIGN 4
#define FT_HINT_NO_VSTEM_ALIGN 4
/* */
FT_END_HEADER
#endif /* __FREETYPE_H__ */

View File

@ -179,15 +179,16 @@ FT_BEGIN_HEADER
/* FT_Angle_Diff */
/* */
/* @description: */
/* Returns the difference between two angles. The result is always */
/* constrained to the ]-PI..PI] interval */
/* Return the difference between two angles. The result is always */
/* constrained to the ]-PI..PI] interval. */
/* */
/* @input: */
/* angle1 :: first angle */
/* angle2 :: second angle */
/* angle1 :: First angle. */
/* */
/* angle2 :: Second angle. */
/* */
/* @return: */
/* contrainted value of 'value2-value1' */
/* Contrainted value of `value2-value1'. */
/* */
FT_EXPORT( FT_Angle )
FT_Angle_Diff( FT_Angle angle1,

View File

@ -360,7 +360,7 @@ FT_BEGIN_HEADER
/*************************************************************************/
/* */
/* <Struct> */
/* FT_Data */
/* FT_Data */
/* */
/* <Description> */
/* Read-only binary data represented as a pointer and a length. */
@ -368,12 +368,13 @@ FT_BEGIN_HEADER
/* <Fields> */
/* pointer :: The data. */
/* */
/* length :: The length of the data in bytes. */
/* length :: The length of the data in bytes. */
/* */
typedef struct FT_Data_
typedef struct FT_Data_
{
const FT_Byte* pointer;
FT_Int length;
const FT_Byte* pointer;
FT_Int length;
} FT_Data;

View File

@ -15,8 +15,8 @@
/* */
/* */
/* IMPORTANT: A description of FreeType's debugging support can be */
/* found in "docs/DEBUG.TXT". Read it if you need to use */
/* or understand this code. */
/* found in "docs/DEBUG.TXT". Read it if you need to use or */
/* understand this code. */
/* */
/***************************************************************************/

View File

@ -292,7 +292,7 @@ FT_BEGIN_HEADER
/* Only used by the convenience functions. */
/* */
/* hint_flags :: Some flags used to change the hinters' */
/* behaviour. Only used for debugging for now */
/* behaviour. Only used for debugging for now. */
/* */
/* postscript_name :: Postscript font name for this face. */
/* */

View File

@ -261,13 +261,13 @@ FT_BEGIN_HEADER
/* been recorded. */
/* */
/* @input: */
/* hints :: A handle to the Type 1 hints recorder. */
/* hints :: A handle to the Type 1 hints recorder. */
/* */
/* outline :: A pointer to the target outline descriptor. */
/* outline :: A pointer to the target outline descriptor. */
/* */
/* globals :: The hinter globals for this font. */
/* globals :: The hinter globals for this font. */
/* */
/* hint_flags :: hinter bit flags */
/* hint_flags :: Hinter bit flags. */
/* */
/* @return: */
/* FreeType error code. 0 means success. */
@ -542,13 +542,13 @@ FT_BEGIN_HEADER
/* method. */
/* */
/* @input: */
/* hints :: A handle to the Type 2 hints recorder. */
/* hints :: A handle to the Type 2 hints recorder. */
/* */
/* outline :: A pointer to the target outline descriptor. */
/* outline :: A pointer to the target outline descriptor. */
/* */
/* globals :: The hinter globals for this font. */
/* globals :: The hinter globals for this font. */
/* */
/* hint_flags :: hinter bit flags */
/* hint_flags :: Hinter bit flags. */
/* */
/* @return: */
/* FreeType error code. 0 means success. */

View File

@ -983,14 +983,14 @@
if ( max > seg2->max_coord )
max = seg2->max_coord;
len = max - min;
len = max - min;
if ( len >= 8 )
{
dist = seg2->pos - seg1->pos;
dist = seg2->pos - seg1->pos;
if ( dist < 0 )
dist = -dist;
score = dist + 3000/len;
score = dist + 3000 / len;
if ( score < best_score )
{
@ -1009,7 +1009,6 @@
best_segment->num_linked++;
}
} /* edges 1 */
/* now, compute the `serif' segments */

View File

@ -98,6 +98,7 @@
FT_Pos dist = width;
FT_Int sign = 0;
if ( dist < 0 )
{
dist = -width;
@ -111,6 +112,7 @@
{
FT_Pos delta = dist - globals->stds[vertical];
if ( delta < 0 )
delta = -delta;
@ -121,27 +123,25 @@
dist = 32;
}
if ( dist < 3 * 64 )
{
if ( dist < 3*64 )
{
delta = (dist & 63);
dist &= -64;
delta = ( dist & 63 );
dist &= -64;
if ( delta < 10 )
dist += delta;
if ( delta < 10 )
dist += delta;
else if ( delta < 32 )
dist += 10;
else if ( delta < 32 )
dist += 10;
else if ( delta < 54 )
dist += 54;
else if ( delta < 54 )
dist += 54;
else
dist += delta;
}
else
dist = (dist+32) & -64;
dist += delta;
}
else
dist = ( dist + 32 ) & -64;
}
#else
if ( vertical )
@ -199,7 +199,8 @@
AH_Edge* stem_edge,
int vertical )
{
FT_Pos dist = stem_edge->opos - base_edge->opos;
FT_Pos dist = stem_edge->opos - base_edge->opos;
stem_edge->pos = base_edge->pos +
ah_compute_stem_width( hinter, vertical, dist );
@ -348,12 +349,12 @@
/* now, align the stem */
/* this should not happen, but it's better to be safe.. */
/* this should not happen, but it's better to be safe. */
if ( edge2->blue_edge || edge2 < edge )
{
#if 0
printf( "strange blue alignement, edge %d to %d\n",
printf( "strange blue alignment, edge %d to %d\n",
edge - edges, edge2 - edges );
#endif
@ -363,7 +364,10 @@
}
{
#if 0
FT_Bool min = 0;
#endif
if ( !anchor )
{
@ -382,17 +386,17 @@
org_pos = anchor->pos + (edge->opos - anchor->opos);
org_len = edge2->opos - edge->opos;
org_center = org_pos + (org_len >> 1);
org_center = org_pos + ( org_len >> 1 );
cur_len = ah_compute_stem_width( hinter, dimension, org_len );
cur_pos1 = ( org_pos + 32 ) & -64;
delta1 = ( cur_pos1 + (cur_len >> 1) - org_center );
delta1 = ( cur_pos1 + ( cur_len >> 1 ) - org_center );
if ( delta1 < 0 )
delta1 = -delta1;
cur_pos2 = (( org_pos + org_len + 32 ) & -64) - cur_len;
delta2 = ( cur_pos2 + (cur_len >> 1) - org_center );
cur_pos2 = ( ( org_pos + org_len + 32 ) & -64 ) - cur_len;
delta2 = ( cur_pos2 + ( cur_len >> 1 ) - org_center );
if ( delta2 < 0 )
delta2 = -delta2;
@ -434,9 +438,7 @@
continue;
if ( edge->serif )
{
ah_align_serif_edge( hinter, edge->serif, edge, dimension );
}
else if ( !anchor )
{
edge->pos = ( edge->opos + 32 ) & -64;

View File

@ -702,7 +702,7 @@
FT_Parameter* params,
#ifdef FT_CONFIG_OPTION_INCREMENTAL
FT_Incremental_Interface* incremental_interface,
FT_Incremental_Interface* incremental_interface,
#endif
FT_Face* aface )
@ -730,7 +730,7 @@
face->memory = memory;
face->stream = stream;
#ifdef FT_CONFIG_OPTION_INCREMENTAL
face->incremental_interface = incremental_interface;
face->incremental_interface = incremental_interface;
#endif
error = clazz->init_face( stream,
@ -746,6 +746,7 @@
FT_Int nn;
FT_CharMap unicmap = NULL, cmap;
for ( nn = 0; nn < face->num_charmaps; nn++ )
{
cmap = face->charmaps[nn];
@ -877,8 +878,9 @@
FT_Parameter* params = 0;
#ifdef FT_CONFIG_OPTION_INCREMENTAL
FT_Incremental_Interface* incremental_interface =
(args->flags & ft_open_incremental) ? args->incremental_interface : 0;
FT_Incremental_Interface* incremental_interface =
( args->flags & ft_open_incremental ) ? args->incremental_interface
: 0;
#endif
if ( args->flags & ft_open_params )
@ -920,8 +922,9 @@
FT_Parameter* params = 0;
#ifdef FT_CONFIG_OPTION_INCREMENTAL
FT_Incremental_Interface* incremental_interface =
(args->flags & ft_open_incremental) ? args->incremental_interface : 0;
FT_Incremental_Interface* incremental_interface =
( args->flags & ft_open_incremental ) ? args->incremental_interface
: 0;
#endif
driver = FT_DRIVER( cur[0] );

View File

@ -41,6 +41,7 @@
FT_Matrix transform;
FT_Outline* outline = &slot->outline;
/* only oblique outline glyphs */
if ( slot->format != ft_glyph_format_outline )
return;
@ -209,6 +210,7 @@
FT_Angle rotate, angle_in, angle_out;
FT_Int c, n, first, orientation;
/* only embolden outline glyph images */
if ( slot->format != ft_glyph_format_outline )
return;

View File

@ -12,10 +12,10 @@
FT_CALLBACK_DEF( FT_Error )
cff_cmap_encoding_init( CFF_CMapStd cmap )
{
TT_Face face = (TT_Face)FT_CMAP_FACE( cmap );
CFF_Font cff = face->extra.data;
CFF_Encoding encoding = &cff->encoding;
PSNames_Service psnames = cff->psnames;
TT_Face face = (TT_Face)FT_CMAP_FACE( cmap );
CFF_Font cff = face->extra.data;
CFF_Encoding encoding = &cff->encoding;
cmap->count = encoding->count;
cmap->gids = encoding->codes;

View File

@ -399,21 +399,21 @@
sizeof( FT_SizeRec ),
sizeof( CFF_GlyphSlotRec ),
(FT_Face_InitFunc) cff_face_init,
(FT_Face_DoneFunc) cff_face_done,
(FT_Size_InitFunc) cff_size_init,
(FT_Size_DoneFunc) cff_size_done,
(FT_Slot_InitFunc) cff_slot_init,
(FT_Slot_DoneFunc) cff_slot_done,
(FT_Face_InitFunc) cff_face_init,
(FT_Face_DoneFunc) cff_face_done,
(FT_Size_InitFunc) cff_size_init,
(FT_Size_DoneFunc) cff_size_done,
(FT_Slot_InitFunc) cff_slot_init,
(FT_Slot_DoneFunc) cff_slot_done,
(FT_Size_ResetPointsFunc) cff_size_reset,
(FT_Size_ResetPixelsFunc) cff_size_reset,
(FT_Size_ResetPointsFunc)cff_size_reset,
(FT_Size_ResetPixelsFunc)cff_size_reset,
(FT_Slot_LoadFunc) Load_Glyph,
(FT_Slot_LoadFunc) Load_Glyph,
(FT_Face_GetKerningFunc) Get_Kerning,
(FT_Face_AttachFunc) 0,
(FT_Face_GetAdvancesFunc) 0,
(FT_Face_GetKerningFunc) Get_Kerning,
(FT_Face_AttachFunc) 0,
(FT_Face_GetAdvancesFunc)0,
};

View File

@ -434,7 +434,7 @@
/* check space for a new on-curve point, then add it */
static FT_Error
cff_builder_cff_builder_add_point1( CFF_Builder* builder,
cff_builder_add_point1( CFF_Builder* builder,
FT_Pos x,
FT_Pos y )
{
@ -492,7 +492,7 @@
builder->path_begun = 1;
error = cff_builder_add_contour( builder );
if ( !error )
error = cff_builder_cff_builder_add_point1( builder, x, y );
error = cff_builder_add_point1( builder, x, y );
}
return error;
@ -627,7 +627,7 @@
/* First load `bchar' in builder */
error = cff_index_access_element( &cff->charstrings_index, bchar_index,
&charstring, &charstring_len );
&charstring, &charstring_len );
if ( !error )
{
error = cff_decoder_parse_charstrings( decoder, charstring, charstring_len );
@ -651,7 +651,7 @@
/* Now load `achar' on top of the base outline. */
error = cff_index_access_element( &cff->charstrings_index, achar_index,
&charstring, &charstring_len );
&charstring, &charstring_len );
if ( !error )
{
error = cff_decoder_parse_charstrings( decoder, charstring, charstring_len );
@ -705,8 +705,8 @@
/* */
FT_LOCAL_DEF( FT_Error )
cff_decoder_parse_charstrings( CFF_Decoder* decoder,
FT_Byte* charstring_base,
FT_Int charstring_len )
FT_Byte* charstring_base,
FT_Int charstring_len )
{
FT_Error error;
CFF_Decoder_Zone* zone;
@ -1175,8 +1175,8 @@
case cff_op_rlineto:
FT_TRACE4(( " rlineto" ));
if ( cff_builder_start_point ( builder, x, y ) ||
check_points( builder, num_args / 2 ) )
if ( cff_builder_start_point ( builder, x, y ) ||
check_points( builder, num_args / 2 ) )
goto Memory_Error;
if ( num_args < 2 || num_args & 1 )
@ -1214,7 +1214,7 @@
else
y += args[0];
if ( cff_builder_cff_builder_add_point1( builder, x, y ) )
if ( cff_builder_add_point1( builder, x, y ) )
goto Memory_Error;
args++;
@ -1231,8 +1231,8 @@
if ( num_args % 6 != 0 )
goto Stack_Underflow;
if ( cff_builder_start_point ( builder, x, y ) ||
check_points( builder, num_args / 2 ) )
if ( cff_builder_start_point ( builder, x, y ) ||
check_points( builder, num_args / 2 ) )
goto Memory_Error;
args = stack;
@ -1385,8 +1385,8 @@
if ( num_args < 8 || ( num_args - 6 ) & 1 )
goto Stack_Underflow;
if ( cff_builder_start_point( builder, x, y ) ||
check_points( builder, num_lines + 3 ) )
if ( cff_builder_start_point( builder, x, y ) ||
check_points( builder, num_lines + 3 ) )
goto Memory_Error;
args = stack;
@ -1425,7 +1425,7 @@
if ( num_args < 8 || ( num_args - 2 ) % 6 )
goto Stack_Underflow;
if ( cff_builder_start_point ( builder, x, y ) ||
if ( cff_builder_start_point ( builder, x, y ) ||
check_points( builder, num_curves*3 + 2 ) )
goto Memory_Error;
@ -1468,7 +1468,7 @@
/* make sure we have enough space for the start point if it */
/* needs to be added.. */
if ( cff_builder_start_point( builder, x, y ) ||
check_points( builder, 6 ) )
check_points( builder, 6 ) )
goto Memory_Error;
/* Record the starting point's y postion for later use */
@ -1519,7 +1519,7 @@
/* adding six more points; 4 control points, 2 on-curve points */
if ( cff_builder_start_point( builder, x, y ) ||
check_points ( builder, 6 ) )
check_points ( builder, 6 ) )
goto Memory_Error;
/* record the starting point's y-position for later use */
@ -1571,7 +1571,7 @@
/* adding six more points; 4 control points, 2 on-curve points */
if ( cff_builder_start_point( builder, x, y ) ||
check_points( builder, 6 ) )
check_points( builder, 6 ) )
goto Memory_Error;
/* record the starting point's x, y postion for later use */
@ -1634,7 +1634,7 @@
FT_TRACE4(( " flex" ));
if ( cff_builder_start_point( builder, x, y ) ||
check_points( builder, 6 ) )
check_points( builder, 6 ) )
goto Memory_Error;
args = stack;
@ -1643,7 +1643,7 @@
x += args[0];
y += args[1];
cff_builder_add_point( builder, x, y,
(FT_Bool)( count == 3 || count == 0 ) );
(FT_Bool)( count == 3 || count == 0 ) );
args += 2;
}
@ -1974,7 +1974,8 @@
if ( zone - decoder->zones >= CFF_MAX_SUBRS_CALLS )
{
FT_ERROR(( "cff_decoder_parse_charstrings: too many nested subrs\n" ));
FT_ERROR(( "cff_decoder_parse_charstrings:"
" too many nested subrs\n" ));
goto Syntax_Error;
}
@ -1987,7 +1988,8 @@
if ( !zone->base )
{
FT_ERROR(( "cff_decoder_parse_charstrings: invoking empty subrs!\n" ));
FT_ERROR(( "cff_decoder_parse_charstrings:"
" invoking empty subrs!\n" ));
goto Syntax_Error;
}
@ -2014,7 +2016,8 @@
if ( zone - decoder->zones >= CFF_MAX_SUBRS_CALLS )
{
FT_ERROR(( "cff_decoder_parse_charstrings: too many nested subrs\n" ));
FT_ERROR(( "cff_decoder_parse_charstrings:"
" too many nested subrs\n" ));
goto Syntax_Error;
}
@ -2027,7 +2030,8 @@
if ( !zone->base )
{
FT_ERROR(( "cff_decoder_parse_charstrings: invoking empty subrs!\n" ));
FT_ERROR(( "cff_decoder_parse_charstrings:"
" invoking empty subrs!\n" ));
goto Syntax_Error;
}
@ -2042,7 +2046,8 @@
if ( decoder->zone <= decoder->zones )
{
FT_ERROR(( "cff_decoder_parse_charstrings: unexpected return\n" ));
FT_ERROR(( "cff_decoder_parse_charstrings:"
" unexpected return\n" ));
goto Syntax_Error;
}
@ -2140,11 +2145,12 @@
/* now get load the unscaled outline */
error = cff_index_access_element( &cff->charstrings_index, glyph_index,
&charstring, &charstring_len );
&charstring, &charstring_len );
if ( !error )
{
cff_decoder_prepare( &decoder, glyph_index );
error = cff_decoder_parse_charstrings( &decoder, charstring, charstring_len );
error = cff_decoder_parse_charstrings( &decoder,
charstring, charstring_len );
cff_index_forget_element( &cff->charstrings_index, &charstring );
}
@ -2225,19 +2231,21 @@
/* now load the unscaled outline */
error = cff_index_access_element( &cff->charstrings_index, glyph_index,
&charstring, &charstring_len );
&charstring, &charstring_len );
if ( !error )
{
CFF_IndexRec csindex = cff->charstrings_index;
cff_decoder_prepare( &decoder, glyph_index );
error = cff_decoder_parse_charstrings( &decoder, charstring, charstring_len );
error = cff_decoder_parse_charstrings( &decoder,
charstring, charstring_len );
cff_index_forget_element( &cff->charstrings_index, &charstring );
/* We set control_data and control_len if charstrings is loaded. */
/* See how charstring loads at cff_index_access_element() in cffload.c. */
/* See how charstring loads at cff_index_access_element() in */
/* cffload.c. */
glyph->root.control_data =
csindex.bytes + csindex.offsets[glyph_index] - 1;

View File

@ -1535,7 +1535,7 @@
case 0:
if ( num_glyphs > 0 )
{
if ( FT_FRAME_ENTER( (num_glyphs-1)*2 ) )
if ( FT_FRAME_ENTER( ( num_glyphs - 1 ) * 2 ) )
goto Exit;
for ( j = 1; j < num_glyphs; j++ )
@ -1699,7 +1699,6 @@
FT_ULong base_offset,
FT_ULong offset )
{
FT_Memory memory = stream->memory;
FT_Error error = 0;
FT_UInt count;
FT_UInt j;
@ -1744,7 +1743,7 @@
FT_READ_BYTE( count ) )
goto Exit;
encoding->count = (count+1);
encoding->count = count + 1;
switch ( encoding->format & 0x7F )
{
@ -1752,10 +1751,11 @@
{
FT_Byte* p;
if ( FT_FRAME_ENTER( count ) )
goto Exit;
p = (FT_Byte*) stream->cursor;
p = (FT_Byte*)stream->cursor;
for ( j = 1; j <= count; j++ )
{
@ -1778,9 +1778,9 @@
case 1:
{
FT_Byte nleft;
FT_UInt i = 1;
FT_UInt k;
FT_Byte nleft;
FT_UInt i = 1;
FT_UInt k;
/* Parse the Format1 ranges. */
@ -1981,8 +1981,8 @@
goto Exit;
error = cff_parser_run( &parser,
(FT_Byte*)stream->cursor,
(FT_Byte*)stream->limit );
(FT_Byte*)stream->cursor,
(FT_Byte*)stream->limit );
FT_FRAME_EXIT();
if ( error )
goto Exit;
@ -2001,7 +2001,7 @@
font->num_local_subrs = font->local_subrs_index.count;
error = cff_index_get_pointers( &font->local_subrs_index,
&font->local_subrs );
&font->local_subrs );
if ( error )
goto Exit;
}
@ -2178,7 +2178,7 @@
font->num_glyphs = font->charstrings_index.count;
error = cff_index_get_pointers( &font->global_subrs_index,
&font->global_subrs ) ;
&font->global_subrs ) ;
if ( error )
goto Exit;

View File

@ -225,7 +225,7 @@
static FT_String*
cff_strcpy( FT_Memory memory,
const FT_String* source )
const FT_String* source )
{
FT_Error error;
FT_String* result = 0;
@ -402,8 +402,8 @@
root->style_name = cff_strcpy( memory, "Regular" ); /* XXXX */
else
root->style_name = cff_index_get_sid_string( &cff->string_index,
dict->weight,
psnames );
dict->weight,
psnames );
/*******************************************************************/
/* */
@ -453,24 +453,25 @@
/* Compute char maps. */
/* */
/* try to synthetize a Unicode charmap if there is none available */
/* already. If an OpenType font contains a Unicode "cmap", we */
/* will use it, wathever be in the CFF part of the file.. */
/* Try to synthetize a Unicode charmap if there is none available */
/* already. If an OpenType font contains a Unicode "cmap", we */
/* will use it, whatever be in the CFF part of the file. */
{
FT_CharMapRec cmaprec;
FT_CharMap cmap;
FT_UInt nn;
CFF_Encoding encoding = &cff->encoding;
for ( nn = 0; nn < (FT_UInt) root->num_charmaps; nn++ )
{
cmap = root->charmaps[nn];
/* Windows Unicode (3,1) ? */
/* Windows Unicode (3,1)? */
if ( cmap->platform_id == 3 && cmap->encoding_id == 1 )
goto Skip_Unicode;
/* Deprecated Unicode platform id ?? */
/* Deprecated Unicode platform id? */
if ( cmap->platform_id == 0 )
goto Skip_Unicode; /* Standard Unicode (deprecated) */
}
@ -494,6 +495,7 @@
{
FT_CMap_Class clazz;
cmaprec.face = root;
cmaprec.platform_id = 7; /* Adobe platform id */

View File

@ -47,54 +47,69 @@
FT_Stream stream = face->root.stream;
FT_Error error = 0;
FT_Byte* charstring = 0;
FT_Memory memory = face->root.memory;
FT_Memory memory = face->root.memory;
FT_UInt glyph_length = 0;
#ifdef FT_CONFIG_OPTION_INCREMENTAL
/* For incremental fonts get the character data using the callback function. */
if (face->root.incremental_interface)
{
FT_Data glyph_data;
error = face->root.incremental_interface->funcs->get_glyph_data(face->root.incremental_interface->object,
glyph_index,&glyph_data);
if (error)
goto Exit;
p = (FT_Byte*)glyph_data.pointer;
fd_select = (FT_UInt)cid_get_offset(&p,(FT_Byte)cid->fd_bytes);
glyph_data.pointer += cid->fd_bytes;
glyph_data.length -= cid->fd_bytes;
glyph_length = glyph_data.length;
if (glyph_length == 0)
#ifdef FT_CONFIG_OPTION_INCREMENTAL
/* For incremental fonts get the character data using */
/* the callback function. */
if ( face->root.incremental_interface )
{
FT_Data glyph_data;
error = face->root.incremental_interface->funcs->get_glyph_data(
face->root.incremental_interface->object,
glyph_index,
&glyph_data );
if ( error )
goto Exit;
if (FT_ALLOC(charstring,glyph_length))
p = (FT_Byte*)glyph_data.pointer;
fd_select = (FT_UInt)cid_get_offset( &p, (FT_Byte)cid->fd_bytes );
glyph_data.pointer += cid->fd_bytes;
glyph_data.length -= cid->fd_bytes;
glyph_length = glyph_data.length;
if ( glyph_length == 0 )
goto Exit;
ft_memcpy(charstring,glyph_data.pointer,glyph_length);
if ( FT_ALLOC( charstring, glyph_length ) )
goto Exit;
ft_memcpy( charstring, glyph_data.pointer, glyph_length );
}
else
else
#endif
/* For ordinary fonts read the CID font dictionary index and charstring offset from the CIDMap. */
/* For ordinary fonts read the CID font dictionary index */
/* and charstring offset from the CIDMap. */
{
FT_UInt entry_len = cid->fd_bytes + cid->gd_bytes;
FT_ULong off1;
FT_UInt entry_len = cid->fd_bytes + cid->gd_bytes;
FT_ULong off1;
if ( FT_STREAM_SEEK( cid->data_offset + cid->cidmap_offset +
glyph_index * entry_len ) ||
FT_FRAME_ENTER( 2 * entry_len ) )
glyph_index * entry_len ) ||
FT_FRAME_ENTER( 2 * entry_len ) )
goto Exit;
p = (FT_Byte*)stream->cursor;
fd_select = (FT_UInt) cid_get_offset( &p, (FT_Byte)cid->fd_bytes );
off1 = (FT_ULong)cid_get_offset( &p, (FT_Byte)cid->gd_bytes );
p += cid->fd_bytes;
p = (FT_Byte*)stream->cursor;
fd_select = (FT_UInt) cid_get_offset( &p, (FT_Byte)cid->fd_bytes );
off1 = (FT_ULong)cid_get_offset( &p, (FT_Byte)cid->gd_bytes );
p += cid->fd_bytes;
glyph_length = cid_get_offset( &p, (FT_Byte)cid->gd_bytes ) - off1;
FT_FRAME_EXIT();
if (glyph_length == 0)
if ( glyph_length == 0 )
goto Exit;
if (FT_ALLOC(charstring,glyph_length))
if ( FT_ALLOC( charstring, glyph_length ) )
goto Exit;
if (FT_STREAM_READ_AT(cid->data_offset + off1,charstring,glyph_length))
if ( FT_STREAM_READ_AT( cid->data_offset + off1,
charstring, glyph_length ) )
goto Exit;
}
@ -102,7 +117,8 @@ else
{
CID_FaceDict dict;
CID_Subrs cid_subrs = face->subrs + fd_select;
FT_Int cs_offset;
FT_Int cs_offset;
/* Set up subrs */
decoder->num_subrs = cid_subrs->num_subrs;
@ -116,7 +132,7 @@ else
decoder->font_offset = dict->font_offset;
decoder->lenIV = dict->private_dict.lenIV;
/* Decode the charstring. */
/* Decode the charstring. */
/* Adjustment for seed bytes. */
cs_offset = ( decoder->lenIV >= 0 ? decoder->lenIV : 0 );
@ -127,27 +143,34 @@ else
error = decoder->funcs.parse_charstrings( decoder,
charstring + cs_offset,
glyph_length - cs_offset );
}
glyph_length - cs_offset );
}
FT_FREE( charstring );
#ifdef FT_CONFIG_OPTION_INCREMENTAL
/* Incremental fonts can optionally override the metrics. */
if (!error && face->root.incremental_interface && face->root.incremental_interface->funcs->get_glyph_metrics)
if ( !error &&
face->root.incremental_interface &&
face->root.incremental_interface->funcs->get_glyph_metrics )
{
FT_Bool found = FALSE;
FT_Basic_Glyph_Metrics metrics;
error = face->root.incremental_interface->funcs->get_glyph_metrics(face->root.incremental_interface->object,
glyph_index,FALSE,&metrics,&found);
if (found)
FT_Bool found = FALSE;
FT_Basic_Glyph_Metrics metrics;
error = face->root.incremental_interface->funcs->get_glyph_metrics(
face->root.incremental_interface->object,
glyph_index, FALSE, &metrics, &found );
if ( found )
{
decoder->builder.left_bearing.x = metrics.bearing_x;
decoder->builder.left_bearing.y = metrics.bearing_y;
decoder->builder.advance.x = metrics.advance;
decoder->builder.advance.y = 0;
decoder->builder.advance.x = metrics.advance;
decoder->builder.advance.y = 0;
}
}
#endif
Exit:

View File

@ -90,23 +90,23 @@
sizeof( CID_SizeRec ),
sizeof( CID_GlyphSlotRec ),
(FT_Face_InitFunc) CID_Face_Init,
(FT_Face_DoneFunc) CID_Face_Done,
(FT_Face_InitFunc) CID_Face_Init,
(FT_Face_DoneFunc) CID_Face_Done,
(FT_Size_InitFunc) CID_Size_Init,
(FT_Size_DoneFunc) CID_Size_Done,
(FT_Slot_InitFunc) CID_GlyphSlot_Init,
(FT_Slot_DoneFunc) CID_GlyphSlot_Done,
(FT_Size_InitFunc) CID_Size_Init,
(FT_Size_DoneFunc) CID_Size_Done,
(FT_Slot_InitFunc) CID_GlyphSlot_Init,
(FT_Slot_DoneFunc) CID_GlyphSlot_Done,
(FT_Size_ResetPointsFunc) CID_Size_Reset,
(FT_Size_ResetPixelsFunc) CID_Size_Reset,
(FT_Size_ResetPointsFunc)CID_Size_Reset,
(FT_Size_ResetPixelsFunc)CID_Size_Reset,
(FT_Slot_LoadFunc) CID_Load_Glyph,
(FT_Slot_LoadFunc) CID_Load_Glyph,
(FT_Face_GetKerningFunc) 0,
(FT_Face_AttachFunc) 0,
(FT_Face_GetKerningFunc) 0,
(FT_Face_AttachFunc) 0,
(FT_Face_GetAdvancesFunc) 0,
(FT_Face_GetAdvancesFunc)0,
};

View File

@ -859,6 +859,7 @@
FT_Byte* old_cur = parser->cursor;
FT_Byte* old_limit = parser->limit;
parser->cursor = token.start;
parser->limit = token.limit;
@ -945,10 +946,11 @@
FT_Fixed temp[4];
FT_BBox* bbox = (FT_BBox*)q;
/* we need the '[' and ']' delimiters */
token.start--;
token.limit++;
(void) t1_tofixedarray( &token.start, token.limit, 4, temp, 0 );
(void)t1_tofixedarray( &token.start, token.limit, 4, temp, 0 );
bbox->xMin = FT_RoundFix( temp[0] );
bbox->yMin = FT_RoundFix( temp[1] );

View File

@ -537,7 +537,7 @@
if ( delta < -blues->blue_fuzz )
break;
if ( stem_top <= zone->org_top + blues->blue_fuzz)
if ( stem_top <= zone->org_top + blues->blue_fuzz )
{
if ( no_shoots || delta <= blues->blue_threshold )
{

View File

@ -433,12 +433,12 @@
/* do we have outlines in there? */
#ifdef FT_CONFIG_OPTION_INCREMENTAL
has_outline = FT_BOOL( face->root.incremental_interface != 0 ||
has_outline = FT_BOOL( face->root.incremental_interface != 0 ||
TT_LookUp_Table( face, TTAG_glyf ) != 0 ||
TT_LookUp_Table( face, TTAG_CFF ) != 0 );
TT_LookUp_Table( face, TTAG_CFF ) != 0 );
#else
has_outline = FT_BOOL( TT_LookUp_Table( face, TTAG_glyf ) != 0 ||
TT_LookUp_Table( face, TTAG_CFF ) != 0 );
TT_LookUp_Table( face, TTAG_CFF ) != 0 );
#endif
is_apple_sbit = 0;

View File

@ -135,33 +135,32 @@
}
/* in theory, we should check the values of `search_range', */
/* `entry_selector' and `range_shift' to detect non-SFNT based files */
/* In theory, we should check the values of `search_range', */
/* `entry_selector', and `range_shift' to detect non-SFNT based files */
/* whose header might also start with 0x100000L (yes, these exist). */
/* */
/* Very unfortunately, many TrueType fonts don't have these fields */
/* set correctly and we must ignore them to support them. An alternative */
/* set correctly and we must ignore them to support them. An alternative */
/* way to check the font file is thus to: */
/* */
/* - check that `num_tables' is valid */
/* - look for a "head" table, check its size, and parse it to */
/* see if its "magic" field is correctly set to */
/* see if its "magic" field is correctly set */
/* */
/* Voila, here comes robust though tolerant font format checking :-) */
/* */
/* When checking directory entries ignore the tables 'glyx' and 'locx' */
/* which are hacked-out versions of 'glyf' and 'loca' in some PostScript */
/* When checking directory entries, ignore the tables `glyx' and `locx' */
/* which are hacked-out versions of `glyf' and `loca' in some PostScript */
/* Type 42 fonts, and will generally be invalid. */
/* */
static FT_Error
sfnt_dir_check( FT_Stream stream,
FT_ULong offset,
FT_UInt num_tables )
static FT_Error
sfnt_dir_check( FT_Stream stream,
FT_ULong offset,
FT_UInt num_tables )
{
FT_Error error;
FT_UInt nn, has_head = 0;
const FT_ULong glyx_tag = FT_MAKE_TAG('g','l','y','x');
const FT_ULong locx_tag = FT_MAKE_TAG('l','o','c','x');
FT_Error error;
FT_UInt nn, has_head = 0;
const FT_ULong glyx_tag = FT_MAKE_TAG('g','l','y','x');
const FT_ULong locx_tag = FT_MAKE_TAG('l','o','c','x');
static const FT_Frame_Field sfnt_dir_entry_fields[] =
{
@ -176,11 +175,13 @@
FT_FRAME_END
};
/* if 'num_tables' is 0, read the table count from the file */
if ( num_tables == 0 )
{
FT_ULong format_tag;
if ( FT_STREAM_SEEK( offset ) ||
FT_READ_ULONG ( format_tag ) ||
FT_READ_USHORT( num_tables ) ||
@ -197,17 +198,19 @@
{
TT_TableRec table;
if ( FT_STREAM_READ_FIELDS( sfnt_dir_entry_fields, &table ) )
goto Bad_Format;
if ( offset + table.Offset + table.Length > stream->size &&
table.Tag != glyx_tag && table.Tag != locx_tag )
table.Tag != glyx_tag && table.Tag != locx_tag )
goto Bad_Format;
if ( table.Tag == TTAG_head )
{
FT_UInt32 magic;
has_head = 1;
if ( table.Length != 0x36 ||
@ -232,6 +235,7 @@
goto Exit;
}
/*************************************************************************/
/* */
/* <Function> */
@ -263,10 +267,10 @@
/* values of `search_range', `entry_selector', and `range_shift'. */
/* */
FT_LOCAL_DEF( FT_Error )
TT_Load_SFNT_Header( TT_Face face,
FT_Stream stream,
FT_Long face_index,
SFNT_Header sfnt )
TT_Load_SFNT_Header( TT_Face face,
FT_Stream stream,
FT_Long face_index,
SFNT_Header sfnt )
{
FT_Error error;
FT_ULong format_tag, offset;

View File

@ -41,15 +41,15 @@ FT_BEGIN_HEADER
FT_LOCAL( FT_Error )
TT_Load_SFNT_Header( TT_Face face,
FT_Stream stream,
FT_Long face_index,
SFNT_Header sfnt );
TT_Load_SFNT_Header( TT_Face face,
FT_Stream stream,
FT_Long face_index,
SFNT_Header sfnt );
FT_LOCAL( FT_Error )
TT_Load_Directory( TT_Face face,
FT_Stream stream,
SFNT_Header sfnt );
TT_Load_Directory( TT_Face face,
FT_Stream stream,
SFNT_Header sfnt );
FT_LOCAL( FT_Error )
TT_Load_Any( TT_Face face,

View File

@ -334,112 +334,6 @@
}
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
/**** ****/
/**** ****/
/**** C H A R A C T E R M A P P I N G S ****/
/**** ****/
/**** ****/
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
/* */
/* <Function> */
/* Get_Char_Index */
/* */
/* <Description> */
/* Uses a charmap to return a given character code's glyph index. */
/* */
/* <Input> */
/* charmap :: A handle to the source charmap object. */
/* charcode :: The character code. */
/* */
/* <Return> */
/* Glyph index. 0 means `undefined character code'. */
/* */
static FT_UInt
Get_Char_Index( TT_CharMap charmap,
FT_Long charcode )
{
FT_Error error;
TT_Face face;
TT_CMapTable cmap;
cmap = &charmap->cmap;
face = (TT_Face)charmap->root.face;
/* Load table if needed */
if ( !cmap->loaded )
{
SFNT_Service sfnt = (SFNT_Service)face->sfnt;
error = sfnt->load_charmap( face, cmap, face->root.stream );
if ( error )
return 0;
cmap->loaded = TRUE;
}
if ( cmap->get_index )
return cmap->get_index( cmap, charcode );
else
return 0;
}
/*************************************************************************/
/* */
/* <Function> */
/* Get_Next_Char */
/* */
/* <Description> */
/* Uses a charmap to return the next encoded char. */
/* */
/* <Input> */
/* charmap :: A handle to the source charmap object. */
/* charcode :: The character code. */
/* */
/* <Return> */
/* Next char code. 0 means `no more encoded characters'. */
/* */
static FT_UInt
Get_Next_Char( TT_CharMap charmap,
FT_Long charcode )
{
FT_Error error;
TT_Face face;
TT_CMapTable cmap;
cmap = &charmap->cmap;
face = (TT_Face)charmap->root.face;
/* Load table if needed */
if ( !cmap->loaded )
{
SFNT_Service sfnt = (SFNT_Service)face->sfnt;
error = sfnt->load_charmap( face, cmap, face->root.stream );
if ( error )
return 0;
cmap->loaded = TRUE;
}
if ( cmap->get_next_char )
return cmap->get_next_char ( cmap, charcode );
else
return 0;
}
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/

View File

@ -756,11 +756,11 @@
FT_Bool opened_frame = 0;
#ifdef FT_CONFIG_OPTION_INCREMENTAL
struct FT_StreamRec_ inc_stream;
struct FT_StreamRec_ inc_stream;
#endif
/* check glyph index */
glyph_index;
if ( glyph_index >= (FT_UInt)face->root.num_glyphs )
{
error = TT_Err_Invalid_Glyph_Index;
@ -784,21 +784,27 @@
FT_UShort advance_width = 0;
#ifdef FT_CONFIG_OPTION_INCREMENTAL
FT_Bool metrics_found = FALSE;
FT_Bool metrics_found = FALSE;
/* If this is an incrementally loaded font see if there are overriding metrics for this glyph. */
if (face->root.incremental_interface && face->root.incremental_interface->funcs->get_glyph_metrics)
/* If this is an incrementally loaded font see if there are */
/* overriding metrics for this glyph. */
if ( face->root.incremental_interface &&
face->root.incremental_interface->funcs->get_glyph_metrics )
{
FT_Basic_Glyph_Metrics m;
error = face->root.incremental_interface->funcs->get_glyph_metrics(face->root.incremental_interface->object,
glyph_index,FALSE,&m,&metrics_found);
if (error)
goto Exit;
left_bearing = (FT_Short)m.bearing_x;
FT_Basic_Glyph_Metrics m;
error = face->root.incremental_interface->funcs->get_glyph_metrics(
face->root.incremental_interface->object,
glyph_index, FALSE, &m, &metrics_found );
if ( error )
goto Exit;
left_bearing = (FT_Short)m.bearing_x;
advance_width = (FT_UShort)m.advance;
}
if (!metrics_found)
if ( !metrics_found )
Get_HMetrics( face, glyph_index,
(FT_Bool)!( loader->load_flags &
FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH ),
@ -806,13 +812,14 @@
&advance_width );
#else
Get_HMetrics( face, glyph_index,
(FT_Bool)!( loader->load_flags &
FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH ),
&left_bearing,
&advance_width );
#endif
#endif /* FT_CONFIG_OPTION_INCREMENTAL */
loader->left_bearing = left_bearing;
loader->advance = advance_width;
@ -825,28 +832,36 @@
}
#ifdef FT_CONFIG_OPTION_INCREMENTAL
/*
Set 'offset' to the start of the glyph program relative to the start of the 'glyf' table,
and 'count' to the length of the glyph program in bytes.
If we are loading glyph data via the incremental interface, set the loader stream to a memory
stream reading the data returned by the interface.
*/
if (face->root.incremental_interface)
/* Set `offset' to the start of the glyph program relative to the */
/* start of the 'glyf' table, and `count' to the length of the */
/* glyph program in bytes. */
/* */
/* If we are loading glyph data via the incremental interface, set */
/* the loader stream to a memory stream reading the data returned */
/* by the interface. */
if ( face->root.incremental_interface )
{
FT_Data data;
error = face->root.incremental_interface->funcs->get_glyph_data(face->root.incremental_interface->object,
glyph_index,&data);
if (error)
error = face->root.incremental_interface->funcs->get_glyph_data(
face->root.incremental_interface->object,
glyph_index, &data );
if ( error )
goto Exit;
offset = 0;
count = data.length;
memset(&inc_stream,0,sizeof(inc_stream));
FT_Stream_OpenMemory(&inc_stream,data.pointer,data.length);
count = data.length;
ft_memset( &inc_stream, 0, sizeof ( inc_stream ) );
FT_Stream_OpenMemory( &inc_stream, data.pointer, data.length );
loader->stream = &inc_stream;
}
else
#endif
#endif /* FT_CONFIG_OPTION_INCREMENTAL */
{
offset = face->glyph_locations[glyph_index];
@ -1335,19 +1350,27 @@
FT_Bool metrics_found = FALSE;
#ifdef FT_CONFIG_OPTION_INCREMENTAL
/* If this is an incrementally loaded font see if there are overriding metrics for this glyph. */
if (face->root.incremental_interface && face->root.incremental_interface->funcs->get_glyph_metrics)
/* If this is an incrementally loaded font see if there are */
/* overriding metrics for this glyph. */
if ( face->root.incremental_interface &&
face->root.incremental_interface->funcs->get_glyph_metrics )
{
FT_Basic_Glyph_Metrics m;
FT_Error error =
face->root.incremental_interface->funcs->get_glyph_metrics(face->root.incremental_interface->object,
glyph_index,TRUE,&m,&metrics_found);
if (error)
FT_Basic_Glyph_Metrics m;
FT_Error error =
face->root.incremental_interface->funcs->get_glyph_metrics(
face->root.incremental_interface->object,
glyph_index, TRUE, &m, &metrics_found );
if ( error )
return error;
top_bearing = (FT_Short)m.bearing_y;
top_bearing = (FT_Short)m.bearing_y;
advance_height = (FT_UShort)m.advance;
}
#endif
#endif /* FT_CONFIG_OPTION_INCREMENTAL */
/* Get the unscaled top bearing and advance height. */
if ( !metrics_found && face->vertical_info &&
@ -1568,18 +1591,22 @@
/* seek to the beginning of the glyph table. For Type 42 fonts */
/* the table might be accessed from a Postscript stream or something */
/* else... */
#ifdef FT_CONFIG_OPTION_INCREMENTAL
/* Don't look for the glyph table if this is an incremental font. */
if (!face->root.incremental_interface)
/* Don't look for the glyph table if this is an incremental font. */
if ( !face->root.incremental_interface )
#endif
{
{
error = face->goto_table( face, TTAG_glyf, stream, 0 );
if ( error )
{
FT_ERROR(( "TT_Load_Glyph: could not access glyph table\n" ));
goto Exit;
}
}
}
FT_MEM_SET( &loader, 0, sizeof ( loader ) );
@ -1628,11 +1655,14 @@
loader.stream = stream;
#ifdef FT_CONFIG_OPTION_INCREMENTAL
if (face->root.incremental_interface)
if ( face->root.incremental_interface )
loader.glyf_offset = 0;
else
else
#endif
loader.glyf_offset = FT_STREAM_POS();
loader.glyf_offset = FT_STREAM_POS();
#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER

View File

@ -198,18 +198,24 @@
if ( face->root.face_flags & FT_FACE_FLAG_SCALABLE )
{
#ifdef FT_CONFIG_OPTION_INCREMENTAL
if ( !face->root.incremental_interface )
error = TT_Load_Locations( face, stream );
if ( !error )
error = TT_Load_CVT ( face, stream ) ||
TT_Load_Programs ( face, stream );
#else
if ( !error )
error = TT_Load_Locations( face, stream ) ||
TT_Load_CVT ( face, stream ) ||
TT_Load_Programs ( face, stream );
#endif
}
/* initialize standard glyph loading routines */

View File

@ -53,50 +53,64 @@
/*************************************************************************/
FT_LOCAL_DEF(FT_Error) T1_Parse_Glyph_And_Get_Char_String( T1_Decoder decoder,
FT_UInt glyph_index,
FT_Data* char_string )
FT_LOCAL_DEF( FT_Error )
T1_Parse_Glyph_And_Get_Char_String( T1_Decoder decoder,
FT_UInt glyph_index,
FT_Data* char_string )
{
T1_Face face = (T1_Face)decoder->builder.face;
T1_Font type1 = &face->type1;
FT_Error error = 0;
T1_Face face = (T1_Face)decoder->builder.face;
T1_Font type1 = &face->type1;
FT_Error error = 0;
decoder->font_matrix = type1->font_matrix;
decoder->font_offset = type1->font_offset;
#ifdef FT_CONFIG_OPTION_INCREMENTAL
/* For incremental fonts get the character data using the callback function. */
if (face->root.incremental_interface)
error = face->root.incremental_interface->funcs->get_glyph_data(face->root.incremental_interface->object,
glyph_index,char_string);
/* For incremental fonts get the character data using the */
/* callback function. */
if ( face->root.incremental_interface )
error = face->root.incremental_interface->funcs->get_glyph_data(
face->root.incremental_interface->object,
glyph_index, char_string );
else
#endif
/* For ordinary fonts get the character data stored in the face record. */
{
char_string->pointer = type1->charstrings[glyph_index];
char_string->length = type1->charstrings_len[glyph_index];
char_string->length = type1->charstrings_len[glyph_index];
}
if (!error)
error = decoder->funcs.parse_charstrings(decoder,(FT_Byte*)char_string->pointer,char_string->length);
if ( !error )
error = decoder->funcs.parse_charstrings(
decoder, (FT_Byte*)char_string->pointer,
char_string->length );
#ifdef FT_CONFIG_OPTION_INCREMENTAL
/* Incremental fonts can optionally override the metrics. */
if (!error && face->root.incremental_interface && face->root.incremental_interface->funcs->get_glyph_metrics)
if ( !error && face->root.incremental_interface &&
face->root.incremental_interface->funcs->get_glyph_metrics )
{
FT_Bool found = FALSE;
FT_Basic_Glyph_Metrics metrics;
error = face->root.incremental_interface->funcs->get_glyph_metrics(face->root.incremental_interface->object,
glyph_index,FALSE,&metrics,&found);
if (found)
FT_Bool found = FALSE;
FT_Basic_Glyph_Metrics metrics;
error = face->root.incremental_interface->funcs->get_glyph_metrics(
face->root.incremental_interface->object,
glyph_index, FALSE, &metrics, &found );
if ( found )
{
decoder->builder.left_bearing.x = metrics.bearing_x;
decoder->builder.left_bearing.y = metrics.bearing_y;
decoder->builder.advance.x = metrics.advance;
decoder->builder.advance.y = 0;
decoder->builder.advance.x = metrics.advance;
decoder->builder.advance.y = 0;
}
}
#endif
return error;
@ -107,8 +121,10 @@ FT_LOCAL_DEF(FT_Error) T1_Parse_Glyph_And_Get_Char_String( T1_Decoder decoder,
T1_Parse_Glyph( T1_Decoder decoder,
FT_UInt glyph_index )
{
FT_Data data;
return T1_Parse_Glyph_And_Get_Char_String(decoder,glyph_index,&data);
FT_Data data;
return T1_Parse_Glyph_And_Get_Char_String( decoder, glyph_index, &data );
}
@ -230,7 +246,8 @@ FT_LOCAL_DEF(FT_Error) T1_Parse_Glyph_And_Get_Char_String( T1_Decoder decoder,
decoder.subrs_len = type1->subrs_len;
/* now load the unscaled outline */
error = T1_Parse_Glyph_And_Get_Char_String( &decoder, glyph_index, &char_string );
error = T1_Parse_Glyph_And_Get_Char_String( &decoder, glyph_index,
&char_string );
if ( error )
goto Exit;