renderer: fixed a wrong fillrule option

- fixed to use the default option NonZero fillrule.
- updated the doc about text font as well
This commit is contained in:
Hermet Park 2025-07-09 18:59:43 +09:00 committed by Mira Grudzinska
parent cacd7d442a
commit 8c3e40472c
3 changed files with 25 additions and 10 deletions

View file

@ -1493,13 +1493,22 @@ public:
* It sets the font name, size and optionally the style.
*
* @param[in] name The name of the font. This should correspond to a font available in the canvas.
* If set to @c nullptr, ThorVG will attempt to select a fallback font available on the system.
* @param[in] size The size of the font in points. This determines how large the text will appear.
* @param[in] style The style of the font. It can be used to set the font to 'italic'.
* If not specified, the default style is used. Only 'italic' style is supported currently.
*
* @retval Result::InsufficientCondition when the specified @p name cannot be found.
*
* @note Experimental API
* @note If the @p name is not specified, ThorVG will select any available font candidate.
* @since 1.0
*
* @code
* // Tip for fallback support to use any available font.
* if (text->font("Arial", 24) != tvg::Result::Success) {
* text->font(nullptr, 24);
* }
* @endcode
*/
Result font(const char* name, float size, const char* style = nullptr) noexcept;

View file

@ -2179,16 +2179,25 @@ TVG_API Tvg_Paint* tvg_text_new(void);
* This function allows you to define the font characteristics used for text rendering.
* It sets the font name, size and optionally the style.
*
* \param[in] paint A Tvg_Paint pointer to the text object.
* \param[in] name The name of the font. This should correspond to a font available in the canvas.
* \param[in] size The size of the font in points.
* \param[in] style The style of the font. If empty, the default style is used. Currently only 'italic' style is supported.
* @param[in] paint A Tvg_Paint pointer to the text object.
* @param[in] name The name of the font. This should correspond to a font available in the canvas.
* If set to @c nullptr, ThorVG will attempt to select a fallback font available on the system.
* @param[in] size The size of the font in points.
* @param[in] style The style of the font. If empty, the default style is used. Currently only 'italic' style is supported.
*
* \return Tvg_Result enumeration.
* \retval TVG_RESULT_INVALID_ARGUMENT A \c nullptr passed as the \p paint argument.
* \retval TVG_RESULT_INSUFFICIENT_CONDITION The specified \p name cannot be found.
*
* \note Experimental API
* @note If the @p name is not specified, ThorVG will select any available font candidate.
* @since 1.0
*
* @code
* // Fallback example: Try a specific font, then fallback to any available one.
* if (tvg_text_set_font(text, "Arial", 24, nullptr) != TVG_RESULT_SUCCESS) {
* tvg_text_set_font(text, nullptr, 24, nullptr);
* }
* @endcode
*/
TVG_API Tvg_Result tvg_text_set_font(Tvg_Paint* paint, const char* name, float size, const char* style);

View file

@ -40,10 +40,7 @@ struct Text::Impl
bool italic = false;
bool changed = false;
Impl(Text* p) : paint(p), shape(Shape::gen().release())
{
shape->fill(FillRule::EvenOdd);
}
Impl(Text* p) : paint(p), shape(Shape::gen().release()) {}
~Impl()
{