Commit Graph

29 Commits

Author SHA1 Message Date
Moazin Khatti b84ae3420a Minor doc and styling improvements. 2019-08-26 01:17:15 +05:00
Moazin Khatti 4d24f52ead [sfnt,svg] Fix includes to allow a `multi' build. 2019-08-26 01:17:15 +05:00
Moazin Khatti 3f6f939378 Adds transform support for OT-SVG glyphs. 2019-08-26 01:17:14 +05:00
Moazin Khatti 22d7c8578f Minor name change.
`svgrender.h' -> `otsvg.h'
`FT_SVG_RENDER_H' -> `FT_OTSVG_H'
Since `svgrender.h' contains just the hooks and the SVG document
structure it's probably just better to name it something general
like `otsvg.h'.
2019-08-26 01:17:14 +05:00
Moazin Khatti 5f5a56a0cc Minor. Fixes a silly mistake. 2019-08-26 01:17:14 +05:00
Moazin Khatti b122db0953 Fix TODOs. 2019-08-26 01:17:14 +05:00
Moazin Khatti 168a8f8fe0 Makes some helper functions `static'. 2019-08-26 01:17:14 +05:00
Moazin Khatti 74f80fba49 No need to call `FT_Load_Glyph' with `XX_NO_SCALE'.
We no longer need TTF/CFF outlines for SVG rendering.
2019-08-26 01:17:14 +05:00
Moazin Khatti 398801e2c0 Revert "Performs basic checks to see if SVG data is valid or not."
This reverts commit e5dc1b65cdc7ea357118fddbdb4b00afc403f81c.
These aren't necessary.
2019-08-26 01:17:14 +05:00
Moazin Khatti 0e8e132bd7 Performs basic checks to see if SVG data is valid or not. 2019-08-26 01:17:14 +05:00
Moazin Khatti d7f6f8b16d Tracing implemented for OT-SVG code. 2019-08-26 01:17:14 +05:00
Moazin Khatti 2cef19641a Remove the TODO since I have implemented binary search. 2019-08-26 01:17:14 +05:00
Moazin Khatti faa495befc Remove the unused variable. 2019-08-26 01:17:14 +05:00
Moazin Khatti ba9e6f9d41 Implement binary search for SVG Document Lookup. 2019-08-26 01:17:14 +05:00
Moazin Khatti 6962986cf3 Created `Svg_doc' private struct.
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.
2019-08-26 01:17:14 +05:00
Moazin Khatti 3b62e9dc9d Added `FT_CONFIG_OPTION_SVG'. 2019-08-26 01:17:07 +05:00
Moazin Khatti c6a6859ad9 Better naming used. 2019-08-17 20:36:05 +05:00
Moazin Khatti e028be97b8 Minor fixes. 2019-08-17 20:36:05 +05:00
Moazin Khatti d8202166c0 Add `start_glyph_id' and `end_glyph_id'.
These two fields are added to `FT_SvgGlyphRec' and
`FT_SVG_DocumentRec'. This is to allow the rendering port to create
a caching mechanism.
2019-08-17 20:36:05 +05:00
Moazin Khatti e48cf716f8 Add a `units_per_EM' field.
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'.
2019-08-17 20:36:05 +05:00
Moazin Khatti 7275d6562f Do proper memory freeing to prevent leaks.
* 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.
2019-08-17 20:36:05 +05:00
Moazin Khatti 1073e4cf5c * src/sfnt/ttsvg.c (tt_face_load_svg_doc): Minor fix. Don't return
immediately in case of Gzip compressed SVG documents.
2019-08-17 20:36:05 +05:00
Moazin Khatti 6a39dd0b16 Properly free memory of SVG document referenced in `slot->other'.
* 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.
2019-08-17 20:36:05 +05:00
Moazin Khatti d1a0615f00 Minor changes.
* 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.
2019-08-17 20:36:05 +05:00
Moazin Khatti 0bf6444911 [ot-svg] Create an SVG Document structure for use in `other' field
of `FT_GlyphSlot'.
2019-08-17 20:36:05 +05:00
Moazin Khatti 877736d057 Removes trailing white spaces. 2019-08-17 20:36:05 +05:00
Moazin Khatti 9a55001454 Minor. Better documentation. Adds TODOs for letter. 2019-08-17 20:36:05 +05:00
Moazin Khatti b9734fd870 Very crude way to handle SVG data with only TTF outlined OT fonts. Gonna revert soon. 2019-08-17 20:36:05 +05:00
Moazin Khatti 9b7c3d1df9 Created Svg type and the load/free funcs inside sfnt interface 2019-08-17 20:36:05 +05:00