mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-08 13:43:43 +00:00
wasm: optimize default font size
Enable default font compression to reduce WASM size. The LZSS algorithm is a simple compression method with advantages in decompression performance. Font data is optimized without external compression dependencies, reducing the embedded font size to 9KB (-40%).
This commit is contained in:
parent
47130ea911
commit
583fb6503c
2 changed files with 47 additions and 3 deletions
File diff suppressed because one or more lines are too long
|
@ -118,7 +118,7 @@ struct TvgEngineMethod
|
||||||
}
|
}
|
||||||
|
|
||||||
void loadFont() {
|
void loadFont() {
|
||||||
Text::load("default", reinterpret_cast<const char*>(DEFAULT_FONT), DEFAULT_FONT_SIZE, "ttf", false);
|
Text::load("default", requestFont(), DEFAULT_FONT_SIZE, "ttf", false);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -130,6 +130,7 @@ struct TvgSwEngine : TvgEngineMethod
|
||||||
{
|
{
|
||||||
std::free(buffer);
|
std::free(buffer);
|
||||||
Initializer::term(tvg::CanvasEngine::Sw);
|
Initializer::term(tvg::CanvasEngine::Sw);
|
||||||
|
retrieveFont();
|
||||||
}
|
}
|
||||||
|
|
||||||
Canvas* init(string&) override
|
Canvas* init(string&) override
|
||||||
|
@ -165,6 +166,7 @@ struct TvgWgEngine : TvgEngineMethod
|
||||||
wgpuSurfaceRelease(surface);
|
wgpuSurfaceRelease(surface);
|
||||||
#endif
|
#endif
|
||||||
Initializer::term(tvg::CanvasEngine::Wg);
|
Initializer::term(tvg::CanvasEngine::Wg);
|
||||||
|
retrieveFont();
|
||||||
}
|
}
|
||||||
|
|
||||||
Canvas* init(string& selector) override
|
Canvas* init(string& selector) override
|
||||||
|
@ -205,6 +207,7 @@ struct TvgGLEngine : TvgEngineMethod
|
||||||
context = 0;
|
context = 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
retrieveFont();
|
||||||
}
|
}
|
||||||
|
|
||||||
Canvas* init(string& selector) override
|
Canvas* init(string& selector) override
|
||||||
|
|
Loading…
Add table
Reference in a new issue