This was broken since version 2.3.0.
* src/raster/ftraster.c (count_table): Use pre-2.3.0 values (which
were then computed dynamically).
(Vertical_Gray_Sweep_Step): Updated.
(ft_black_render): Initialize `worker->gray_lines' (problem found by
valgrind).
(FT_RASTER_OPTION_ANTI_ALIASING, DEBUG_RASTER): Dont' #undef, just
comment out.
Normally, the SCANMODE instruction (if present) to set the drop-out
mode in a TrueType font is located in the `prep' table only and thus
valid for all glyphs. However, there are fonts like `pala.ttf'
which additionally contain this instruction in the hinting code of
some glyphs (but not all). As a result it can happen that a
composite glyph needs multiple drop-out modes for its subglyphs
since the rendering state gets reset for each subglyph.
FreeType collects the hinted outlines from all subglyphs, then it
sends the data to the rasterizer. It also sends the drop-out mode
-- after hinting has been applied -- and here is the error: It sends
the drop-out mode of the last subglyph only; drop-out modes of all
other subglyphs are lost.
This patch fixes the problem; it adds a second, alternative
mechanism to pass the drop-out mode: For each contour, the
rasterizer now checks the first `tags' array element. If bit 2 is
set, bits 5-7 contain the contour's drop-out mode, overriding the
global drop-out mode.
* include/freetype/ftimage.h (FT_CURVE_TAG_HAS_SCANMODE): New macro.
* src/truetype/ttgload.c (TT_Hint_Glyph): Store drop-out mode in
`tags[0]'.
* src/raster/ftraster.c (Flow_Up, Overshoot_Top, Overshoot_Bottom):
Use bits 3-5 instead of 0-2.
(New_Profile): Set the drop-out mode in the profile's `flags' field.
(Decompose_Curve): Check `tags[0]' and set `dropOutControl' if
necessary.
(Vertical_Sweep_Drop, Horizontal_Sweep_Drop,
Horizontal_Gray_Sweep_Drop, Draw_Sweep): Use the profile's drop-out
mode.
Two new constraints are introduced to better identify a `stub' -- a
concept which is only vaguely described in the OpenType
specification. The old code was too rigorous and suppressed more
pixel than it should.
. The intersection of the two profiles with the scanline is less
than a half pixel. Code related to this was already present in
the sources but has been commented out.
. The endpoint of the original contour forming a profile has a
distance (`overshoot') less than half a pixel to the scanline.
Note that the two additional conditions fix almost all differences
to the Windows rasterizer, but some problematic cases remain.
* src/raster/ftraster.c (Overshoot_Top, Overshoot_Bottom): New
macros for the `flags' field in the `TProfile' structure.
(IS_BOTTOM_OVERSHOOT, IS_TOP_OVERSHOOT): New macros.
(New_Profile, End_Profile): Pass overshoot flag as an argument and
set it accordingly.
Update callers.
(Vertical_Sweep_Drop, Horizontal_Sweep_Drop): Implement the two new
constraints.
* src/raster/ftraster.c (Set_High_Precision): Add two more bits to
the precision. This corrects rendering of some small glyphs, for
example, glyph `xi' in verdana.ttf at 13 ppem. Testing with ftbench
on my GNU/Linux box I don't see a performance degradation.
Suggested by Alexei Podtelezhnikov <apodtele@gmail.com>.
* src/raster/ftraster.c (Vertical_Sweep_Drop, Horizontal_Sweep_Drop,
Horizontal_Gray_Sweep_Drop): Do it.
* src/raster/ftraster.c (TFlow): Replace enumeration with...
(Flow_Up): This macro.
(TProfile): Replace `flow' member with `flags' bit field.
Update all affected code.
Problem reported by Krzysztof Kotlenga <pocek@users.sf.net>.
* src/raster/raster.c (Vertical_Sweep_Drop, Horizontal_Sweep_Drop,
Horizontal_Gray_Sweep_Drop): For smart drop-out mode, if
intersections are equally distant relative to next pixel center,
select the left pixel, not the right one.
* src/raster/ftrend1.h declare ft_raster1_renderer_class
and ft_raster5_renderer_class
using macros from ftrender.h,
when FT_CONFIG_OPTION_PIC is defined create and destroy
functions will be declared.
* src/smooth/ftrend1.c when FT_CONFIG_OPTION_PIC is defined
ft_raster1_renderer_class and ft_raster5_renderer_class structs
will have functions to init or create and destroy them
instead of being allocated in the global scope.
Macros will be used from rastpic.h in order to access
ft_standard_raster from the pic_container (allocated in ftraster.c).
In ft_raster1_render when PIC is enabled, the last letter of
module_name is used to verfy the renderer class rather than the
class pointer.
* src/raster/ftraster.c when FT_CONFIG_OPTION_PIC is defined
ft_standard_raster struct will have function to init it
instead of being allocated in the global scope.
New Files:
* src/raster/rastpic.h declare struct to hold PIC globals for raster
renderer and macros to access them.
* src/raster/rastpic.c implement functions to allocate, destroy and
initialize PIC globals for raster renderer.
* src/raster/raster.c add new file to build: rastpic.c.
* src/raster/jamfile add new files to FT2_MULTI build: rastpic.c.
Horizontal_Gray_Sweep_Drop): Test for intersections which
degenerate to a single point can be ignored; this has been confirmed
by Greg Hitchcock from Microsoft. (This was commented out code.)
* src/raster/ftraster.c (Render_Glyph, Render_Gray_Glyph,
Draw_Sweep): No-dropout mode is value 2, not value 0.
(Draw_Sweep): Really skip dropout handling for no-dropout mode.
Pass dropout rules from the TT bytecode interpreter to the
rasterizer; temporarily this is enabled only if
`USE_SCAN_CONVERSION_RULES' is defined.
* include/freetype/ftimage.h (FT_OUTLINE_SMART_DROPOUTS,
FT_OUTLINE_EXCLUDE_STUBS): New flags for for FT_Outline.
* src/raster/ftraster.c (Vertical_Sweep_Drop, Horizontal_Sweep_Drop,
Horizontal_Gray_Sweep_Drop): Use same mode numbers as given in the
OpenType specification.
Fix mode 4 computation.
(Render_Glyph, Render_Gray_Glyph): Handle new outline flags.
* src/truetype/ttgload.c (TT_Load_Glyph)
[USE_SCAN_CONVERSION_RULES]: Convert scan conversion mode to
FT_OUTLINE_XXX flags.
* src/truetype/ttinterp.c (Ins_SCANCTRL): Enable ppem check.
compiled as stand-alone.
* src/raster/ftraster.c: Add comment how to compile as stand-alone.
s/FT_CONFIG_OPTION_STATIC_RASTER/FT_STATIC_RASTER/.
s/TT_STATIC_RASTER/FT_STATIC_RASTER/.
[_STANDALONE_]: Include ftimage.h and ftmisc.h.
(FT_TRACE1, FT_TRACE6, ft_memset, FT_MEM_ZERO): Define
conditionally.
(Render_Glyph, Render_Gray_Glyph): Return Raster_Err_None (or
Raster_Err_Unsupported).
(ft_black_new) [_STANDALONE_]: Fix type of `the_raster'.
(ft_black_init, ft_black_reset, ft_black_set_mode, ft_black_render):
Use `ras', not `raster'.
(ft_black_done): Use FT_UNUSED_RASTER.
(Horizontal_Sweep_Init, Horizontal_Sweep_Step,
Horizontal_Gray_Sweep_Span): Use FT_UNUSED_RASTER.
* docs/CHANGES: Updated.
Exclude debug info for `Release' versions to reduce library size.
* src/base/ftobjs.c (FT_Open_Face): Make it work as documented, this
is, ignore `aface' completely if face_index < 0. Reported by David
Osborn <spam@habitualhiatus.com>.
* include/freetype/ftimage.h (FT_Outline_MoveToFunc,
FT_Outline_LineTo_Func, FT_Outline_ConicToFunc,
FT_Outline_CubicToFunc), src/smooth/ftgrays.c (gray_render_conic,
gray_render_cubic, gray_move_to, gray_line_to, gray_conic_to,
gray_cubic_to, gray_render_span, gray_sweep): Decorate parameters
with `const' where appropriate.
src/autofit/afloader.c, src/autohint/ahhint.c:
moved the definition of 'lsb_delta' and 'rsb_delta' from FT_GlyphMetrics
to FT_GlyphSlotRec. The old location did BREAK BINARY COMPATIBILITY
of the library !!
* src/sfnt/sfobjs.c: removing compiler warning
include/freetype/internal/ftobjs.h,
include/freetype/internal/psaux.h, src/cid/cidgload.c,
src/psaux/psobjs.c, src/psaux/t1decode.c, src/psaux/psobjs.h,
src/pshinter/pshrec.c, src/pshinter/pshalgo.c,
src/psnames/psmodule.c, src/raster/ftraster.c, src/sfnt/sfobjs.c,
src/smooth/ftgrays.c, src/smooth/ftsmooth.c, src/truetype/ttobjs.c,
src/truetype/ttdriver.c, src/truetype/ttgload.c, src/type1/t1afm.c,
src/type1/t1gload.c, src/type1/t1gload.h, src/type1/t1load.c,
src/type1/t1objs.c, src/type42/t42parse.c, src/type42/t42parse.h:
Many casts and slight argument type changes to make it work with
a 16bit compiler.
* include/freetype/config/ftoption.h [FT_CONFIG_OPTION_MAC_FONTS]:
New macro.
* src/base/ftobjs.c: Use it to control mac font support on non-mac
platforms.
Implement partial support of Mac fonts on non-Mac platforms.
* src/base/ftobjs.c (memory_stream_close, new_memory_stream,
open_face_from_buffer, Mac_Read_POST_Resource,
Mac_Read_sfnt_Resource, IsMacResource, IsMacBinary, load_mac_face)
[!FT_MACINTOSH]: New functions.
(FT_Open_Face) [!FT_MACINTOSH]: Use load_mac_face.
* src/base/ftobjs.c (FT_Load_Glyph): Scale linear advance width only
if FT_FACE_FLAG_SCALABLE is set (otherwise we have a division by
zero since FNT and friends don't define `face->units_per_EM').
tt_face_get_ps_name): Replace switch statement with if clauses to
make it more portable.
* src/cff/cffobjs.c (cff_face_init): Ditto.
* include/freetype/ftmodule.h (FT_Module_Class): Use `FT_Long' for
`module_size'.
* include/freetype/ftrender.h (FT_Glyph_Class_): Use `FT_Long' for
`glyph_size'.
* src/base/ftobjs.c (FT_Render_Glyph): Change second parameter to
`FT_Render_Mode'.
(FT_Render_Glyph_Internal): Change third parameter to
`FT_Render_Mode'.
* src/base/ftglyph.c (FT_Glyph_To_Bitmap): Change second parameter
to `FT_Render_Mode'.
* src/raster/ftrend1.c (ft_raster1_render): Change third parameter
to `FT_Render_Mode'.
* src/smooth/ftsmooth.c (ft_smooth_render, ft_smooth_render_lcd,
ft_smooth_render_lcd_v): Ditto.
(ft_smooth_render_generic): Change third and fifth parameter to
`FT_Render_Mode'.
* include/freetype/freetype.h, include/freetype/internal/ftobjs.h,
include/freetype/ftglyph.h: Updated.
* src/cff/cffdrivr.c (Load_Glyph), src/pcf/pcfdriver.c
(PCF_Glyph_Load), src/pfr/pfrobjs.c (pfr_slot_load),
src/winfonts/winfnt.c (FNT_Load_Glyph), src/t42/t42objs.c
(T42_GlyphSlot_Load), src/bdf/bdfdrivr.c (BDF_Glyph_Load): Change
fourth parameter to `FT_Int32'.
* src/pfr/pfrobjs.c (pfr_face_init): Add two missing parameters
and declare them as unused.
* src/cid/cidparse.h (CID_Parser): Use FT_Long for `postscript_len'.
* src/psnames/psnames.h (PS_Unicode_Value_Func): Change return
value to FT_UInt32.
* src/psnames/psmodule.c (ps_unicode_value, ps_build_unicode_table):
Updated accordingly.
* src/cff/cffdrivr.c (Get_Kerning): Use FT_Long for `middle'.
(cff_get_glyph_name): Use cast for result of ft_strlen.
* src/cff/cffparse.c (cff_parse_real): User cast for assigning
`exp'.
* src/cff/cffload.c (cff_index_get_pointers): Use FT_ULong for
some local variables.
(cff_charset_load, cff_encoding_load): Use casts to FT_UInt for some
switch statements.
(cff_font_load): Use cast in call to CFF_Load_FD_Select.
* src/cff/cffobjs.c (cff_size_init): Use more casts.
(cff_face_init): Use FT_Int32 for `flags'.
* src/cff/cffgload.c (cff_operator_seac): Use cast for assigning
`adx' and `ady'.
(cff_decoder_parse_charstrings): Use FT_ULong for third parameter.
Use more casts.
* src/cff/cffcmap.c (cff_cmap_unicode_init): Use cast for `count'.
* src/cid/cidload.c (cid_read_subrs): Use FT_ULong for `len'.
* src/cid/cidgload.c (cid_load_glyph): Add missing cast for
`cid_get_offset'.
* src/psaux/t1decode.c (t1_decoder_parse_charstrings) <18>: Use
cast for `num_points'.
(t1_decoder_init): Use cast for assigning `decoder->num_glyphs'.
* src/base/ftdebug.c (ft_debug_init): Use FT_Int.
* include/freetype/internal/ftdriver.h (FT_Slot_LoadFunc): Use
`FT_Int32' for fourth parameter.
* src/base/ftobjs.c (open_face): Use cast for calling
clazz->init_face.
* src/raster/ftraster.c (Set_High_Precision): Use `1' instead of
`1L'.
(Finalize_Profile_Table, Line_Up, ft_black_init): Use casts.
* src/raster/ftrend1.c (ft_raster1_render): Ditto.
* src/sfnt/sfnt_dir_check: Compare `magic' with unsigned long
constant.
* builds/amiga/include/freetype/config/ftmodule.h: Updated.
want to list them all here. The operations performed were all logical
transformations of the sources:
- trying to convert all enums and constants to CAPITALIZED_STYLE, with
#define definitions like
#define my_old_constants MY_NEW_CONSTANT
- big, big update of the documentation comments
* include/freetype/freetype.h, src/base/ftobjs.c, src/smooth/ftsmooth.c,
include/freetype/ftimage.h: adding support for LCD-optimized rendering
though the new constants/enums:
FT_RENDER_MODE_LCD, FT_RENDER_MODE_LCD_V
FT_PIXEL_MODE_LCD, FT_PIXEL_MODE_LCD_V
this is still work in progress, don't expect everything to work correctly
though most of the features have been implemented.
* adding new FT_LOAD_XXX flags, used to specify both hinting and rendering
targets:
FT_LOAD_TARGET_NORMAL :: anti-aliased hinting & rendering
FT_LOAD_TARGET_MONO :: monochrome bitmaps
FT_LOAD_TARGET_LCD :: horizontal RGB/BGR decimated hinting & rendering
FT_LOAD_TARGET_LCD_V :: vertical RGB/BGR decimated hinting & rendering
note that FT_LOAD_TARGET_NORMAL is 0, which means that the default
behaviour of the font engine is _unchanged_.
(file_spec_from_path) [TARGET_API_MAC_CARBON]: Added support for
OS X.
(is_dfont) [TARGET_API_MAC_CARBON]: Define only for OS X.
Handle `nameLen' <= 6 also.
(parse_fond): Remove unused variable `name_table'.
Use functionality of old p2c_str directly.
Add safety checks.
(read_lwfn): Initialize `size_p'.
Check for size_p == NULL.
(new_memory_stream, open_face_from_buffer): Updated to FreeType 2.1.
(FT_New_Face_From_LWFN): Remove unused variable `memory'.
Remove some dead code.
(FT_New_Face_From_SFNT): Remove unused variable `stream'.
(FT_New_Face_From_dfont) [TARGET_API_MAC_CARBON]: Define only for
OS X.
(FT_New_Face_From_FOND): Remove unused variable `error'.
(ResourceForkSize): New function.
(FT_New_Face): Use it.
Handle empty resource forks.
Conditionalize some code for OS X.
Add code to call normal loader as a fallback.
Some more variable renames to avoid troubles on the Mac.
* src/raster/ftraster.c:
s/Unknown|Ascending|Descending|Flat/\1_State/.
* src/smooth/ftgrays.c: s/TScan/TCoord/.
Other changes for the Mac.
* include/freetype/config/ftconfig.h: Define FT_MACINTOSH for
Mac platforms.
* src/base/ftobjs.c: s/macintosh/FT_MACINTOSH/.
* src/raster/ftrend1.c (ft_raster1_render): Make `pitch' always
an even number.
warn about the GNU Make requirement at compile time..
* include/freetype/config/ftstdlib.h,
include/freetype/config/ftconfig.h,
include/freetype/config/ftheader.h,
include/freetype/internal/ftmemory.h,
include/freetype/internal/ftobjs.h,
src/autohint/ahoptim.c,
src/base/ftdbgmem.c, src/base/ftdebug.c,
src/base/ftmac.c, src/base/ftobjs.c,
src/base/ftsystem.c,
src/cache/ftcimage.c, src/cache/ftcsbits.c,
src/cff/cffdriver.c, src/cff/cffload.c, src/cff/cffobjs.c,
src/cid/cidload.c, src/cid/cidparse.c, src/cid/cidriver.c,
src/pcf/pcfdriver.c, src/pcf/pcfread.c,
src/psaux/t1cmap.c, src/psaux/t1decode.c,
src/pshinter/pshalgo1.c, src/pshinter/pshalgo2.c,
src/pshinter/pshrec.c,
src/psnames/psmodule.c,
src/raster/ftraster.c,
src/sfnt/sfdriver.c, src/sfnt/ttload.c, src/sfnt/ttpost.c,
src/smooth/ftgrays.c,
src/type1/t1afm.c, src/type1/t1driver.c, src/type1/t1gload.c,
src/type1/t1load.c, src/type1/t1objs.c, src/type1/t1parse.c:
added the new configuration file "ftstdlib.h" used to define
aliases for all ISO C library functions used by the engine
(e.g. strlen, qsort, setjmp, etc...)
this eases the porting of FreeType 2 to exotic environments like
XFree86 modules/extensions..
also removed many #include <string.h>, #include <stdlib.h>, etc...
from the engine's sources where they're not needed..
changed the names of memory macros. Examples:
MEM_Set => FT_MEM_SET
MEM_Copy => FT_MEM_COPY
MEM_Move => FT_MEM_MOVE
ALLOC => FT_ALLOC
FREE => FT_FREE
REALLOC = >FT_REALLOC
FT_NEW was introduced to allocate a new object from a _typed_
pointer..
note that ALLOC_ARRAY and REALLOC_ARRAY have been replaced
by FT_NEW_ARRAY and FT_RENEW_ARRAY which take _typed_ pointer
arguments.
This results in _lots_ of sources being changed, but makes the
code more generic and less error-prone..
(some platforms don't provide this ANSI function !!)
some changes to "ftsystem.c" implementations in order to use
the new memory debugger on Unix, VMS and Amiga too !!