Rewrite into encapsulated struct (maintain fontdb)

This commit is contained in:
2023-06-16 23:05:45 -05:00
parent 5eef1517e6
commit f720cb6daa
3 changed files with 28 additions and 20 deletions

View File

@@ -42,7 +42,9 @@ async fn main() {
// basic handler that responds with a static string
async fn root_handler(connect_info: ConnectInfo<SocketAddr>) -> impl IntoResponse {
let raw_image = svg::get();
let renderer = svg::Renderer::new();
let data = include_bytes!("./templates/basic.svg");
let raw_image = renderer.render(data);
if raw_image.is_err() {
return Response::builder()