Generate registration code for custom fonts imported in .60 files

This removes the need to manually register fonts. This is initially
applied to the printer demo, but the other demos and removal of the
public manual registration API will come in follow-up commits.
This commit is contained in:
Simon Hausmann 2021-04-13 16:44:18 +02:00
parent c301cc22b5
commit f7ce1ba8b4
13 changed files with 138 additions and 30 deletions

View file

@ -22,12 +22,6 @@ struct InkLevelModel : sixtyfps::Model<InkLevel>
int main()
{
if (auto error = sixtyfps::register_font_from_path(FONTS_DIR "/NotoSans-Regular.ttf")) {
fprintf(stderr, "Error registering Noto Sans Regular font: %s\n", error->data());
}
if (auto error = sixtyfps::register_font_from_path(FONTS_DIR "/NotoSans-Bold.ttf")) {
fprintf(stderr, "Error registering Noto Sans Bold font: %s\n", error->data());
}
auto printer_demo = MainWindow::create();
printer_demo->set_ink_levels(std::make_shared<InkLevelModel>());
printer_demo->on_quit([] { std::exit(0); });