From c2d9382761510d0a16d66a2c48b1c9cfba2cde56 Mon Sep 17 00:00:00 2001 From: Cameron Clough Date: Tue, 20 May 2025 22:56:53 +0100 Subject: [PATCH] hardcode a font path..? --- selfdrive/ui/installer/installer.cc | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/selfdrive/ui/installer/installer.cc b/selfdrive/ui/installer/installer.cc index f7cd11685a..bbda7ba4e6 100644 --- a/selfdrive/ui/installer/installer.cc +++ b/selfdrive/ui/installer/installer.cc @@ -32,6 +32,9 @@ const std::string CACHE_PATH = "/data/openpilot.cache"; extern const uint8_t str_continue[] asm("_binary_selfdrive_ui_installer_continue_openpilot_sh_start"); extern const uint8_t str_continue_end[] asm("_binary_selfdrive_ui_installer_continue_openpilot_sh_end"); +const char* FONT_PATH = "/usr/share/fonts/Inter-Regular.woff2"; +Font font; + void run(const char* cmd) { int err = std::system(cmd); assert(err == 0); @@ -40,13 +43,13 @@ void run(const char* cmd) { void renderProgress(int progress) { BeginDrawing(); ClearBackground(BLACK); - DrawText("Installing...", 150, 290, 90, WHITE); + DrawTextEx(font, "Installing...", (Vector2){150, 290}, 90, 0, WHITE); Rectangle bar = {150, 500, (float)GetScreenWidth() - 300, 72}; DrawRectangleRec(bar, (Color){41, 41, 41, 255}); progress = std::clamp(progress, 0, 100); bar.width *= progress / 100.0f; DrawRectangleRec(bar, (Color){70, 91, 234, 255}); - DrawText((std::to_string(progress) + "%").c_str(), 150, 600, 70, WHITE); + DrawTextEx(font, (std::to_string(progress) + "%").c_str(), (Vector2){150, 600}, 70, 0, WHITE); EndDrawing(); } @@ -172,9 +175,11 @@ void cloneFinished(int exitCode) { int main(int argc, char *argv[]) { InitWindow(2160, 1080, "Installer"); + font = LoadFontEx(FONT_PATH, 120, NULL, 0); renderProgress(0); int result = doInstall(); cloneFinished(result); CloseWindow(); + UnloadFont(font); return 0; }