Swap Panel Font depending on database value?

Question. I have a field that allows the user to switch the font used for the Panel. How would I go about switching the panel's font used depending on that value from the database? Obviously, I couldn't do it inside a Service Provider for the panel because the current company instance couldn't be resolved by that time, so I decided to use a Listener.
 public function handle(TenantSet $event): void
{
    /** @var Company $company */
    $company = $event->getTenant();
    $paginationPageOptions = RecordsPerPage::caseValues();
    $defaultPaginationPageOption = $company->defaults->records_per_page->value ?? RecordsPerPage::DEFAULT;
    $defaultSort = $company->defaults->table_sort_direction->value ?? TableSortDirection::DEFAULT;
    $defaultPrimaryColor = $company->defaults->primary_color ?? PrimaryColor::from(PrimaryColor::DEFAULT);
    $defaultFont = $company->defaults->font->value ?? Font::DEFAULT;

    Table::configureUsing(static function (Table $table) use ($paginationPageOptions, $defaultSort, $defaultPaginationPageOption): void {
        $table
            ->paginationPageOptions($paginationPageOptions)
            ->defaultSort(column: 'id', direction: $defaultSort)
            ->defaultPaginationPageOption($defaultPaginationPageOption);
    }, isImportant: true);

    $defaultColor = FilamentColor::register([
        'primary' => $defaultPrimaryColor->getColor(),
    ]);

    FilamentColor::swap($defaultColor);
}


This works for everything else such as the Panel color, etc... But I couldn't find a way to register or switch the Panels font. Could anyone help me?
Was this page helpful?