To enable glyph-to-character mapping, it is necessary
to include information in GlyphMetrics indicating which
indices of the original text each glyph corresponds to.
Since characters encoded with multiple utf8 bytes still
result in a single glyph, both the starting index in the
utf8 string and the byte length must be stored. This allows
accurate mapping between glyphs and their original text
representation.
Introduced the GlyphMetrics struct and the API:
Result metrics(GlyphMetrics** metrics, uint32_t* size)
This allows retrieving glyph metrics for a given Text object.
The font and utf8 content must be set beforehand using
the font() and text() apis.
Memory for the metrics array is allocated internally by the API.
It is the user's responsibility to free it by calling the same API
with a valid metrics pointer and a nullptr passed as size.
@Issue: https://github.com/thorvg/thorvg/issues/3397
If stop is declared immediately after Gradient is closed, the stop is registered in latestGradient.
Change latestGradient to a Stack and add a stop only to the last added gradient.
When that gradient is closed, no more stops should be registered for that gradient.
And gradients do not allow nested declarations, so only the earliest declared Gradient is valid.
The time remapping logic had an issue where animations with zero value "tm"(Time Remap) were not being processed correctly.
This was happening because the previous implementation only applied time remapping when the value was non-zero. (A zero-value Time Remap should be applied, but is ignored)
The fix changes the default time remap value to `-1.0` (since frame values cannot be negative) and applies time remapping when the value is 0.0 or greater. This ensures that zero value time remapping is properly processed.
The first margin value shifts the starting point where the text
begins along the path. Now cases where firstMargin < 0 are handled,
for both closed and open paths.
Added drawing exceptions when target is not properly ready.
Now, Canvas::update() Canvas::draw() will return InsufficientCondition
if the target has not been set beforehand.
The "s" key does not have to appear at the beginning
of the position block. Previously, such cases would
result in a parsing error — now they are handled correctly.
no any 3rd-party libs, such as glfw or glad did not used
support windows, linux, macos and emsdk
only the actually used set of functions are loaded
Co-Authored-By: Sergii Liebodkin <sergii@lottiefiles.com>
Co-Authored-BY: Hermet Park <hermet@lottiefiles.com>
issue: https://github.com/thorvg/thorvg/issues/2453
- prioritize valid (positive) cases first
- continue parsing even when encountering parsing errors
Co-Authored-By: Mira Grudzinska <mira@lottiefiles.com>
revert the alpha skip condition introduced in
commit 2990e72b23.
color values with alpha = 0 must be transformed to 0
to ensure correct intermediate composition results.
SDL + software engine doesn't need the vsync?
Observed the rendering performance is noticeably unstable on Intel Arc chipsets
with certain window sizes (ie 800x800) when VSync is enabled on software-rendered windows.
This might be a workaround, or it could be an issue with the driver or SDL.
Either way, the SDL + software engine doesn't need VSync.
- C-style strings provide consistent binary interface for FFI
- Reduces potential issues where standard library is limited (e.g., WebAssembly, embedded systems)
The incorrect line join used for OffsetPath was caused
by changes to the StrokeJoin enum values in commit
34d731fa94. During those
changes, the line join value for OffsetPath was mistakenly
not updated.
Clipping for the <use> node when a <symbol> was used,
was being overridden when 'overflowVisible' was 'true'
(the default value), which caused the 'clip-path' applied
to the <use> node to have no visible effect.
The clipping for the <use> node (without <symbol> node) was
transformed in an incorrect order, resulting in a visually
incorrect results.
@Issue: https://github.com/thorvg/thorvg/issues/3392
Simplified parameters and ensured proper backend engine
initialization by using reference checking through canvas
instances.
C++ API Modification:
- Result Initializer::init(uint32_t threads, CanvasEngine engine)
-> Result Initializer::init(uint32_t threads)
- Result Initializer::term(CanvasEngine engine)
-> Result Initializer::term()
C API Modification:
- Tvg_Result tvg_engine_init(Tvg_Engine engine_method, unsigned threads)
-> Tvg_Result tvg_engine_init(unsigned threads);
- Tvg_Result tvg_engine_term(Tvg_Engine engine_method)
-> Tvg_Result tvg_engine_term()
issue: https://github.com/thorvg/thorvg/issues/3116
The following is a redesign that extends the class internally.
The main goal is to preserve the characteristics of the pImpl idiom
for data encapsulation, while simultaneously reducing the memory
allocation overhead typically associated with pImpl.
The stragegy is here:
Rather than alloc the impl memory inside of the thorvg engine,
impl extends the API classes in order to consolidate the memory.
size has been decreased by -4kb with optimization=s
issue: https://github.com/thorvg/thorvg/issues/3214