mirror of
https://github.com/thorvg/thorvg.git
synced 2025-07-13 01:56:03 +00:00
renderer: fixed a wrong fillrule option
Some checks are pending
Android / build_x86_64 (push) Waiting to run
Android / build_aarch64 (push) Waiting to run
iOS / build_x86_64 (push) Waiting to run
iOS / build_arm64 (push) Waiting to run
macOS / build (push) Waiting to run
macOS / compact_test (push) Waiting to run
macOS / unit_test (push) Waiting to run
Ubuntu / build (push) Waiting to run
Ubuntu / compact_test (push) Waiting to run
Ubuntu / unit_test (push) Waiting to run
Windows / build (push) Waiting to run
Windows / compact_test (push) Waiting to run
Windows / unit_test (push) Waiting to run
Some checks are pending
Android / build_x86_64 (push) Waiting to run
Android / build_aarch64 (push) Waiting to run
iOS / build_x86_64 (push) Waiting to run
iOS / build_arm64 (push) Waiting to run
macOS / build (push) Waiting to run
macOS / compact_test (push) Waiting to run
macOS / unit_test (push) Waiting to run
Ubuntu / build (push) Waiting to run
Ubuntu / compact_test (push) Waiting to run
Ubuntu / unit_test (push) Waiting to run
Windows / build (push) Waiting to run
Windows / compact_test (push) Waiting to run
Windows / unit_test (push) Waiting to run
- fixed to use the default option NonZero fillrule. - updated the doc about text font as well
This commit is contained in:
parent
543b705f2e
commit
ac12c8c9a3
5 changed files with 21 additions and 5 deletions
|
@ -41,6 +41,7 @@ struct UserExample : tvgexam::Example
|
|||
//Otherwise, you can immediately unload the font data.
|
||||
//Please check Text::unload() APIs.
|
||||
if (!tvgexam::verify(tvg::Text::load(EXAMPLE_DIR"/font/Arial.ttf"))) return false;
|
||||
if (!tvgexam::verify(tvg::Text::load(EXAMPLE_DIR"/font/NOTO-SANS-KR.ttf"))) return false;
|
||||
if (!tvgexam::verify(tvg::Text::load(EXAMPLE_DIR"/font/NanumGothicCoding.ttf"))) return false;
|
||||
|
||||
//Load from memory
|
||||
|
@ -98,7 +99,7 @@ struct UserExample : tvgexam::Example
|
|||
canvas->push(text6);
|
||||
|
||||
auto text7 = tvg::Text::gen();
|
||||
text7->font("Arial", 15);
|
||||
text7->font("NOTO-SANS-KR", 15);
|
||||
text7->text("Transformed Text - 30'");
|
||||
text7->fill(0, 0, 0);
|
||||
text7->translate(600, 400);
|
||||
|
@ -106,7 +107,7 @@ struct UserExample : tvgexam::Example
|
|||
canvas->push(text7);
|
||||
|
||||
auto text8 = tvg::Text::gen();
|
||||
text8->font("Arial", 15);
|
||||
text8->font("NOTO-SANS-KR", 15);
|
||||
text8->fill(0, 0, 0);
|
||||
text8->text("Transformed Text - 90'");
|
||||
text8->translate(600, 400);
|
||||
|
@ -114,7 +115,7 @@ struct UserExample : tvgexam::Example
|
|||
canvas->push(text8);
|
||||
|
||||
auto text9 = tvg::Text::gen();
|
||||
text9->font("Arial", 15);
|
||||
text9->font("NOTO-SANS-KR", 15);
|
||||
text9->fill(0, 0, 0);
|
||||
text9->text("Transformed Text - 180'");
|
||||
text9->translate(800, 400);
|
||||
|
@ -125,7 +126,7 @@ struct UserExample : tvgexam::Example
|
|||
float x, y, w2, h2;
|
||||
|
||||
auto text10 = tvg::Text::gen();
|
||||
text10->font("Arial", 50);
|
||||
text10->font("NOTO-SANS-KR", 50);
|
||||
text10->text("Linear Text");
|
||||
text10->bounds(&x, &y, &w2, &h2);
|
||||
|
||||
|
|
BIN
examples/resources/font/NOTO-SANS-KR.ttf
Normal file
BIN
examples/resources/font/NOTO-SANS-KR.ttf
Normal file
Binary file not shown.
|
@ -1581,6 +1581,7 @@ 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.
|
||||
|
@ -1589,6 +1590,13 @@ public:
|
|||
*
|
||||
* @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;
|
||||
|
||||
|
|
|
@ -2136,6 +2136,7 @@ TVG_API Tvg_Paint* tvg_text_new(void);
|
|||
*
|
||||
* @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.
|
||||
*
|
||||
|
@ -2145,6 +2146,13 @@ TVG_API Tvg_Paint* tvg_text_new(void);
|
|||
*
|
||||
* @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);
|
||||
|
||||
|
|
|
@ -45,7 +45,6 @@ struct TextImpl : Text
|
|||
TextImpl() : impl(Paint::Impl(this)), shape(Shape::gen())
|
||||
{
|
||||
PAINT(shape)->parent = this;
|
||||
shape->fillRule(FillRule::EvenOdd);
|
||||
}
|
||||
|
||||
~TextImpl()
|
||||
|
|
Loading…
Add table
Reference in a new issue