mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-08 13:43:43 +00:00
examples: added a default font for flawless test
This commit is contained in:
parent
75c9028c19
commit
8e1cd7b4c6
4 changed files with 12 additions and 3 deletions
|
@ -32,6 +32,9 @@ struct UserExample : tvgexam::Example
|
||||||
|
|
||||||
bool content(tvg::Canvas* canvas, uint32_t w, uint32_t h) override
|
bool content(tvg::Canvas* canvas, uint32_t w, uint32_t h) override
|
||||||
{
|
{
|
||||||
|
//The default font for fallback in case
|
||||||
|
tvg::Text::load(EXAMPLE_DIR"/font/Arial.ttf");
|
||||||
|
|
||||||
//Animation Controller
|
//Animation Controller
|
||||||
animation = unique_ptr<tvg::Animation>(tvg::Animation::gen());
|
animation = unique_ptr<tvg::Animation>(tvg::Animation::gen());
|
||||||
auto picture = animation->picture();
|
auto picture = animation->picture();
|
||||||
|
|
|
@ -93,6 +93,9 @@ struct UserExample : tvgexam::Example
|
||||||
{
|
{
|
||||||
if (!canvas) return false;
|
if (!canvas) return false;
|
||||||
|
|
||||||
|
//The default font for fallback in case
|
||||||
|
tvg::Text::load(EXAMPLE_DIR"/font/Arial.ttf");
|
||||||
|
|
||||||
//Background
|
//Background
|
||||||
auto shape = tvg::Shape::gen();
|
auto shape = tvg::Shape::gen();
|
||||||
shape->appendRect(0, 0, w, h);
|
shape->appendRect(0, 0, w, h);
|
||||||
|
|
|
@ -32,6 +32,9 @@ struct UserExample : tvgexam::Example
|
||||||
{
|
{
|
||||||
if (!canvas) return false;
|
if (!canvas) return false;
|
||||||
|
|
||||||
|
//default font for fallback in case
|
||||||
|
tvg::Text::load(EXAMPLE_DIR"/font/Arial.ttf");
|
||||||
|
|
||||||
//Background
|
//Background
|
||||||
auto bg = tvg::Shape::gen();
|
auto bg = tvg::Shape::gen();
|
||||||
bg->appendRect(0, 0, w, h); //x, y, w, h
|
bg->appendRect(0, 0, w, h); //x, y, w, h
|
||||||
|
|
|
@ -77,6 +77,9 @@ struct UserExample : tvgexam::Example
|
||||||
{
|
{
|
||||||
if (!canvas) return false;
|
if (!canvas) return false;
|
||||||
|
|
||||||
|
//The default font for fallback in case
|
||||||
|
tvg::Text::load(EXAMPLE_DIR"/font/Arial.ttf");
|
||||||
|
|
||||||
//Background
|
//Background
|
||||||
auto shape = tvg::Shape::gen();
|
auto shape = tvg::Shape::gen();
|
||||||
shape->appendRect(0, 0, w, h);
|
shape->appendRect(0, 0, w, h);
|
||||||
|
@ -84,9 +87,6 @@ struct UserExample : tvgexam::Example
|
||||||
|
|
||||||
canvas->push(shape);
|
canvas->push(shape);
|
||||||
|
|
||||||
//Default font
|
|
||||||
if (!tvgexam::verify(tvg::Text::load(EXAMPLE_DIR"/font/Arial.ttf"))) return false;
|
|
||||||
|
|
||||||
this->w = w;
|
this->w = w;
|
||||||
this->h = h;
|
this->h = h;
|
||||||
this->size = w / NUM_PER_ROW;
|
this->size = w / NUM_PER_ROW;
|
||||||
|
|
Loading…
Add table
Reference in a new issue