Inside the SVG Document List, four fields exist. It's
better to create a struct to hold at one place instead
of 4 variables. Also created `compare_svg_doc' which
will be helpful in writing binary search later.
If `yes' is choosen but SVG library isn't found, exit
with error. If `auto' was choosen but the library wasn't
found, go with `no' NOT `no-default'. `no-default' should
be a separate option.
Added a `no-default' option that compiles SVG support
but keeps no default rendering port. Thus, the client
application must inject its own hooks.
* builds/unix/configure.raw: Changes in the build
system to support `no-default'.
* builds/unix/unix-cc.in: Add `COMPILE_SVG_PORT' var
to ultimately let the `rules.mk' in `svg' folder know
whether to build the port files or not.
* include/freetype/config/ftoption.h: Change the flag
`FT_CONFIG_OPTION_SVG_DEFAULT' to `*_DEFAULT_SVG' as
`sed' and `ftoption_set' has a problem with the older
version.
* src/svg/ftsvg.c: Ditto.
* src/svg/rules.mk: Compile the port only if
`COMPILE_SVG_PORT' is set.
and the image buffer.
State has been moved inside the library structure. A new hook
function has been added to query the size needed for the state
structure and this allocation is performed by FT. Memory alloc.
for the image buffer is also being done by FT so that it can later
free it easily.
* include/freetype/svgrenderer.h: Small doc fixes. Addition of two
new hooks. `SVG_Lib_Get_State_Size' and `SVG_Lib_Get_Buffer_Size'.
* src/base/ftglyph.c (FT_Glyph_To_Bitmap): Small bug fix. Memory
was being initialized before library.
* src/base/ftobjs.c (FT_Set_Svg_Hooks): Adjust the code for new
hook functions.
* src/svg/ftsvg.c: Adjust the code for new hook functions. Perform
all memory allocations needed by the rendering port from FreeType
side.
* src/svg/svgtypes.c: Add the new hooks in the hook structure.
A field `units_per_EM' is added to `FT_SVG_DocumentRec' and
`FT_SvgGlyphRec'. This is needed because the renderer needs this
info to properly scale the SVGs if the viewbox width and height
differ from `face->units_per_EM'. Face object can't be accessed
because of the restrictions put by `FT_Glyph_To_Bitmap' thus this
has to be provided separately just like `metrics'.
* include/freetype/internal/ftobjs.h: Create a new flag named
`FT_GLYPH_OWN_GZIP_SVG' to indicate that `svg_document' in
`slot->other' is GZIP compressed and has to be freed later.
* src/base/ftglyph.c: Minor styling.
* src/base/ftobjs.c: Add code to free memory that was previously
allocated for storing GZIP compressed SVG documents.
* src/sfnt/ttsvg.c: Set the `FT_GLYPH_OWN_GZIP_SVG' flag if the
document is GZIP compressed.
* include/freetype/freetype.h: Add `FT_FACE_FLAG_SVG' to indicate
the presence of an SVG table in the face.
* src/base/ftobjs.c (ft_glyphslot_init): Allocate memory for
`FT_SVG_Document' in `slot->other' if an SVG table exists in the
face.
(ft_glyphslot_clear): Clear `slot->other' only if the font doesn't
have an SVG table.
(ft_glyphslot_done): Free the memory at `slot->other' if the face
has an SVG table.
* src/base/ttsvg.c (tt_face_load_svg): Set `FT_FACE_FLAG_SVG'.
(tt_face_load_svg_doc): Don't allocate the memory.
* src/base/ftobjs.c (FT_Load_Glyph): Use the recrusive call with
`FT_LOAD_NO_SCALE' so that the loaded data is unscaled.
* src/base/ftobjs.c (FT_Render_Glyph_Internal): Change the format
to bitmap once an SVG glyph is successfully rendered.
* src/sfnt/ttsvg.c (tt_face_load_svg_doc): Make sure metrics are
grabbed. Scale `horiAdvance' and `vertAdvance' properly and
convert them to 26.6 format.
This is necessary because the document itself contains no
sizing information. Outline glyphs encapsulate the sizing
information in the outlines by scaling them. That is not
possible here. One could access them from the face object
reference inside a glyph slot, but when the function
`FT_Glyph_To_Bitmap' creates a dummy slot it can not put
a face object reference in it. Thus, it's better to store
the size information here.
* include/freetype/config/ftheader.h: New macro `FT_SVG_RENDERER_H'
for `freetype/svgrenderer.h'.
* include/freetype/svgrenderer.h: New file to store SVG specific
function types, SVG interface and `FT_Set_Svg_Hooks'.
* src/base/ftobjs.c: Adds implementation of `FT_Set_Svg_Hooks'.
* src/svg/ftsvg.c: Creates `svg_renderer_interface'.
* src/svg/svgtypes.c: Moves hook function types to
`FT_SVG_RENDERER_H'. Adds a hook for svg rendering. Temporary.