Commit Graph

3 Commits

Author SHA1 Message Date
Moazin Khatti 503977f55c Adds transformation support for OT-SVG glyphs.
* include/freetype/ftglyph.h: Adds `transform' and `delta' fields
to `FT_SvgGlyphRed'.

* include/freetype/otsvg.h: Adds `transform' and `delta' fields to
`FT_SVG_Document'.

* src/base/ftglyph.c: Creates method `ft_svg_glyph_transform' and
modifies existing functions for the new fields.

* src/sfnt/ttsvg.c: (tt_face_load_svg_doc) Set `transform' to unity
and `delta' to zero by default.

* src/svg/ftsvg.c: Adds `ft_svg_transform'.
2019-08-17 23:42:27 +05:00
Moazin Khatti 865bba38d2 [svg] Creates new module for rendering OT-SVG glyphs.
For rendering OT-SVG glyphs, a new renderer module `ot-svg' is
created. The module holds hooks to an external library which are
used for rendering. The hooks can be set via module properties.
Also enabled bitmap presetting of OT-SVG glyphs at loading stage.

* include/freetype/fterrdef.h: Adds two errors, namely,
`Missing_SVG_Hooks' and `Invalid_SVG_Document'.

* include/freetype/internal/ftobjs.h: Adds `svg_renderer_state' to
`FT_LibraryRec' to let external libraries store state.

* include/freetype/internal/fttrace.h: Adds entry for `ot-svg'.

* modules.cfg: Ditto.

* include/freetype/internal/internal.h: Adds
`FT_INTERNAL_SVG_INTERFACE_H' for `svginterface.h'.

* include/freetype/internal/svginterface.h: Internal header file
to contain the interface of `ot-svg' module. Just exposes the
preset function.

* include/freetype/otsvg.h: Adds functypes for the four hooks and
a structure to hold them.

* src/base/ftobjs.c: (ft_glyphslot_preset_bitmap) Enable proper
presetting of OT-SVG glyphs by using `ot-svg' renderer.
(ft_add_renderer) Set `renderer->render' for `ot-svg' module.

* src/svg/ftsvg.h: Declaration for `ot-svg' module.

* src/svg/ftsvg.c: Module definition of `ot-svg' and its functions.

* src/svg/svg.c: Single source file of `ot-svg' module.

* src/svg/svgtypes.c: Defines `SVG_Renderer'.

* src/svg/rules.mk: Compilation rules for `ot-svg' module.

* src/svg/module.mk: Module definition of `ot-svg'.
2019-08-10 19:11:37 +05:00
Moazin Khatti ce64d9cbf1 Adds the functionality to load SVG documents.
SVG document corresponding to a glyphID is fetched and stored
in an `FT_SVG_Document' structure which is referenced in the
glyphslot.

* include/freetype/config/ftheader.h: Adds `FT_OTSVG_H'.

* include/freetype/ftimage.h: Adds `FT_GLYPH_FORMAT_SVG'.

* include/freetype/internal/ftobjs.h: Adds `FT_GLYPH_OWN_GZIP_SVG'.

* include/freetype/internal/sfnt.h: Adds `load_svg_doc' and its
function type `TT_Load_Svg_Doc_Func'.

* include/freetype/otsvg.h: Adds `FT_SVG_Document' and its struct.

* src/base/ftobjs.c: Adds code to allocate and free memory for
`FT_SVG_Document' in `slot->other'.

* src/cff/cffgload.c: Adds code to load SVG glyph if it's present.

* src/truetype/ttgload.c: Ditto.

* src/sfnt/sfdriver.c: Adds `tt_face_load_svg_doc'.

* src/sfnt/ttsvg.h: Ditto.

* src/sfnt/ttsvg.c: Adds implementation of `tt_face_load_svg_doc'
and its helper functions.
2019-08-10 16:11:07 +05:00