Set charts font to Roboto (#24097)

This commit is contained in:
Petar Petrov 2025-02-06 13:16:35 +02:00 committed by Bram Kragten
parent dcb04067b8
commit a30e501031
2 changed files with 2 additions and 1 deletions

View File

@ -328,6 +328,7 @@ export class HaChartBase extends LitElement {
backgroundColor: "transparent", backgroundColor: "transparent",
textStyle: { textStyle: {
color: style.getPropertyValue("--primary-text-color"), color: style.getPropertyValue("--primary-text-color"),
fontFamily: "Roboto, Noto, sans-serif",
}, },
title: { title: {
textStyle: { textStyle: {

View File

@ -10,7 +10,7 @@ let textMeasureCanvas: HTMLCanvasElement | undefined;
export function measureTextWidth( export function measureTextWidth(
text: string, text: string,
fontSize: number, fontSize: number,
fontFamily = "sans-serif" fontFamily = "Roboto, Noto, sans-serif"
): number { ): number {
if (!textMeasureCanvas) { if (!textMeasureCanvas) {
textMeasureCanvas = document.createElement("canvas"); textMeasureCanvas = document.createElement("canvas");