Commit Graph

6669 Commits

Author SHA1 Message Date
Moazin Khatti f40ef225a2 Instead of individual properties. Just use one that
takes pointer to the hooks structure.
2019-07-18 00:05:49 +05:00
Moazin Khatti d94f52b0c6 Use `FT_Property_Set' to set the hooks. One less API function. 2019-07-17 23:31:59 +05:00
Moazin Khatti 02b14b7824 Public interface should remain same whether
`FT_CONFIG_OPTION_SVG' is set or not.
2019-07-17 15:57:02 +05:00
Moazin Khatti def48796f4 Added `FT_CONFIG_OPTION_SVG'. 2019-07-17 12:22:47 +05:00
Moazin Khatti 41a1572f33 Documentation formatting improvement. 2019-07-11 15:52:31 +05:00
Moazin Khatti 6e05128713 Better naming used. 2019-07-11 14:09:43 +05:00
Moazin Khatti e11721ee02 Forgot an `else', fix that. 2019-07-11 14:09:43 +05:00
Moazin Khatti 509ae10ca5 Memory allocation for `state' of renderer should be performed
on the SVG port side not the FT size. Minor doc fixes.
2019-07-11 14:09:43 +05:00
Moazin Khatti 9ff1a33826 Remove unnecessary code from `FT_Render_Glyph_Internal'. 2019-07-11 14:09:43 +05:00
Moazin Khatti 2e9e84193d Let FT handle the memory management for rendering port's state
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.
2019-07-11 14:09:43 +05:00
Moazin Khatti b85698d447 Store the rendering port's state in library.
Before this commit, the state of a rendering port was being
held globally. Now, it'll be stored in library->svg_renderer_state.
2019-07-11 14:09:43 +05:00
Moazin Khatti f9b0bb6b95 Minor fixes. 2019-07-11 14:09:43 +05:00
Moazin Khatti 11f3c827b8 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-07-11 14:09:43 +05:00
Moazin Khatti 5f2dcadbf2 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-07-11 14:09:43 +05:00
Moazin Khatti c9308ac171 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-07-11 14:09:43 +05:00
Moazin Khatti 8f36343498 Minor. Add documentation. 2019-07-11 14:09:43 +05:00
Moazin Khatti f70f02cdd1 * src/sfnt/ttsvg.c (tt_face_load_svg_doc): Minor fix. Don't return
immediately in case of Gzip compressed SVG documents.
2019-07-11 14:09:43 +05:00
Moazin Khatti 72eb3b3a9d 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-07-11 14:09:43 +05:00
Moazin Khatti aec7ec2a62 Enable FreeType memory debugger. 2019-07-11 14:09:43 +05:00
Moazin Khatti 71a8aaa807 [cache] Consider `FT_GLYPH_FORMAT_SVG' a valid format. 2019-07-11 14:09:43 +05:00
Moazin Khatti 4288f4a70a 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-07-11 14:09:43 +05:00
Moazin Khatti 2a9f8aea1f Adds support for SVG glyphs to Glyph Management API. 2019-07-11 14:09:43 +05:00
Moazin Khatti 7e3c438166 Make sure `FT_Set_Svg_Hooks' is exported properly. 2019-07-11 14:09:43 +05:00
Moazin Khatti 1b494f52fb Adds size information to `FT_SVG_DocumentRec'.
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.
2019-07-11 14:09:43 +05:00
Moazin Khatti 204329b18e [ot-svg] Create an SVG Document structure for use in `other' field
of `FT_GlyphSlot'.
2019-07-11 14:09:43 +05:00
Moazin Khatti a4f1da1572 Removes trailing white spaces. 2019-07-11 14:09:43 +05:00
Moazin Khatti e676c86e92 Reverts the changes made in the structure of `TT_GlyphSlot' 2019-07-11 14:09:43 +05:00
Moazin Khatti 5381d51956 [ot-svg] Silly mistake fix.
Instead of an `FT_Library' instance, `FT_Module' is supposed
to be passed.
2019-07-11 14:09:43 +05:00
Moazin Khatti 3560126a3a Minor. Better documentation. Adds TODOs for letter. 2019-07-11 14:09:42 +05:00
Moazin Khatti 8f256de2d8 [ot-svg] Creates hooks mechanism in SVG Renderer.
* 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.
2019-07-11 14:09:42 +05:00
Moazin Khatti 7915e5e102 Barebones of an SVG rendering module and making it part of the build system 2019-07-11 14:09:42 +05:00
Moazin Khatti 1ab8251ff1 Support OT-SVG fonts with CFF outlines 2019-07-11 14:09:42 +05:00
Moazin Khatti 68d1cab0e1 Very crude way to handle SVG data with only TTF outlined OT fonts. Gonna revert soon. 2019-07-11 14:09:42 +05:00
Moazin Khatti 7b9673dd01 Added FT_GLYPH_FORMAT_SVG 2019-07-11 14:09:42 +05:00
Moazin Khatti 3201792dba Created Svg type and the load/free funcs inside sfnt interface 2019-07-11 14:09:42 +05:00
Moazin Khatti f61fa9934f Added the SVG tag 2019-07-11 14:09:42 +05:00
Moazin Khatti 77726abc41 turned on trace mode and added tags file in gitignore 2019-07-11 14:09:42 +05:00
Werner Lemberg 05439f5cc6 [psaux] (2/2) Handle fonts that use SEAC for ligatures (#56580).
The same as previous commit but for the old engine.

* src/psaux/t1decode.c (t1operator_seac): Implement it.
2019-07-04 14:28:04 +02:00
Chris Liddell f2b64583cb [psaux] (1/2) Handle fonts that use SEAC for ligatures (#56580).
As originally intended, a Type 1 SEAC charstring would be used for
an accented glyph (like `acaron' or `uumlaut'), where the advance
width of the SEAC glyph is the same as that of the `base' glyph
(like `a' or `u').  In this case it is not uncommon for the SEAC
glyph to not use an (H)SBW opcode of its own but to rely on the
value from the base glyph.

However, out-of-spec fonts also use SEAC glyphs for ligatures (like
`oe' or `fi'), and in those cases the overall advance width is
greater than that of the `base' glyph.  For this reason we have to
allow that the SEAC glyph can have an (H)SBW value of its own, and
if it has, retain this value, rather than the one from the base
glyph.

* src/psaux/psintrp.c (cf2_interpT2CharString) <cf2_escSEAC>:
Implement it.
2019-07-04 14:26:10 +02:00
Werner Lemberg 8cf046c38d * Version 2.10.1 released.
==========================

Tag sources with `VER-2-10-1'.

* docs/VERSION.TXT: Add entry for version 2.10.1.

* README, Jamfile (RefDoc), src/base/ftver.rc,
builds/windows/vc2010/freetype.vcxproj,
builds/windows/vc2010/index.html,
builds/windows/visualc/freetype.dsp,
builds/windows/visualc/freetype.vcproj,
builds/windows/visualc/index.html,
builds/windows/visualce/freetype.dsp,
builds/windows/visualce/freetype.vcproj,
builds/windows/visualce/index.html,
builds/wince/vc2005-ce/freetype.vcproj,
builds/wince/vc2005-ce/index.html,
builds/wince/vc2008-ce/freetype.vcproj,
builds/wince/vc2008-ce/index.html: s/2.10.0/2.10.1/, s/2100/2101/.

* include/freetype/freetype.h (FREETYPE_PATCH): Set to 1.

* builds/unix/configure.raw (version_info): Set to 23:1:17.
* CMakeLists.txt (VERSION_PATCH): Set to 1.

* include/freetype/fterrors.h (FT_Error_String): Fix C++ compilation.
2019-07-01 15:56:34 +02:00
Alexei Podtelezhnikov 7b1c7585d7 * src/bdf/bdfdrivr.c (bdf_cmap_char_{index,next}): Fix inequality.
Reported by Armin Hasitzka.
2019-06-26 20:18:00 -04:00
Alexei Podtelezhnikov 81445c034a Doc polishing. 2019-06-22 22:54:57 -04:00
Alexei Podtelezhnikov a41e560b21 Minor. 2019-06-19 22:29:55 -04:00
Werner Lemberg 1e20a37f64 docs/CHANGES: Updated. 2019-06-19 16:45:39 +02:00
Werner Lemberg 983a87c6ec * src/tools/apinames.c: Formatting, minor edits. 2019-06-16 16:04:12 +02:00
Werner Lemberg 47ca5cb69d [autofit] Disable hinting if no blue zones are available (#56450).
* src/autofit/afglobal.c (af_face_global_get_metrics): Start again
(with dummy hinter module) if no blue zones are present.

* src/autofit/aflatin.c (af_latin_metrics_init_blues): Change
signature to return error code.
If no blue zones are found, update `glyph_styles' array to hold
AF_STYLE_NONE_DFLT instead of the current style.
(af_latin_metrics_init): Return internal error code if no blue zones
are found.
2019-06-16 15:33:32 +02:00
Werner Lemberg 82e4090431 Towards better VMS support.
More to come.

* builds/vms/LIBS.OPT_IA64, builds/vms/_LINK.OPT_IA64,
builds/vms/vmslib.dat: New files provided by Jouk Jansen
<joukj@hrem.nano.tudelft.nl>.

* builds/vms/ftconfig.h: Update, also from Jouk.
2019-06-16 10:11:46 +02:00
Werner Lemberg 3736b28af9 * src/autofit/aflatin.c (af_latin_metrics_init_widths): Minor. 2019-06-13 13:45:05 +02:00
Werner Lemberg 8acd9800ed Add memory access macro summary. 2019-06-13 11:12:26 +02:00
Alexei Podtelezhnikov e7ac9288ac [smooth] Restore the span buffering for direct mode only.
The buffer size FT_MAX_GRAY_SPANS is set to 10 spans, which should be
enough to cover the entire scanline for simple glyphs in most cases:
each slightly slanted edge needs up to two spans, plus a filling span
in-between.  This is not new, we used to do it before cb4388783c.

* src/smooth/ftgrays.c (gray_TWorker): Add `spans' and `num_spans'.
(gray_hline, gray_sweep): Implement the span buffering.
(gray_raster_render): Use negative `num_spans' to avoid the direct
mode.
2019-06-13 00:17:36 -04:00