forked from Blendman974/faceclaw
Glanceboard has separately configurable font
This commit is contained in:
1 parent
def027943c
commit
4bc3551135
12 files changed
+187
-65
No files matched your search
@@ -1,10 +1,10 @@
|
||||
import { type GrayImage, type UiFont } from "../../../graphics/image";
|
||||
import { truncateText } from "../../../graphics/textwrap";
|
||||
import { getDefaultMediumFont, getDefaultSmallFont } from "../../../graphics/ui-fonts";
|
||||
import { hasCalendarPermission } from "../../../native/calendar-permissions";
|
||||
import { getCalendarReadState, onCalendarChanged, readUpcomingEvents, type CalendarEvent } from "../../../native/calendar";
|
||||
import { lineStep } from "../../../ui/metrics";
|
||||
import { dayHeaderLabel, formatEventTime } from "../../calendar/calendar";
|
||||
import { glanceFont } from "../glance-font";
|
||||
import { type GlanceWidget } from "../widget";
|
||||
|
||||
const PAD = 8;
|
||||
@@ -38,8 +38,8 @@ export class CalendarWidget implements GlanceWidget {
|
||||
}
|
||||
|
||||
paint(image: GrayImage): void {
|
||||
const small = getDefaultSmallFont();
|
||||
const medium = getDefaultMediumFont();
|
||||
const small = glanceFont.small();
|
||||
const medium = glanceFont.medium();
|
||||
const step = lineStep(small);
|
||||
const textWidth = image.width - 2 * PAD;
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import { type GrayImage } from "../../../graphics/image";
|
||||
import { getDefaultMediumFont, getDefaultSmallFont } from "../../../graphics/ui-fonts";
|
||||
import { hasLocationPermission } from "../../../native/location-permissions";
|
||||
import { addCompassListener, COMPASS_CHANGED, setCompassEnabled } from "../../../native/compass";
|
||||
import { isCompassCalibrated, normalizeHeading } from "../../compass/calibration";
|
||||
import { cardinalDirection, createCompassBackground, drawCompassRose, layoutCompassRose, TICK_HEIGHT } from "../../compass/compass-rose";
|
||||
import { getDeclinationAvailability, onDeclinationChanged, refreshDeclination } from "../../compass/declination";
|
||||
import { getNorthReference, resolveHeading } from "../../compass/heading";
|
||||
import { glanceFont } from "../glance-font";
|
||||
import { type GlanceWidget } from "../widget";
|
||||
|
||||
/** Owner token for the refcounted magnetometer, distinct from the Compass app's. */
|
||||
@@ -63,8 +63,8 @@ export class CompassWidget implements GlanceWidget {
|
||||
}
|
||||
|
||||
paint(image: GrayImage): void {
|
||||
const medium = getDefaultMediumFont();
|
||||
const small = getDefaultSmallFont();
|
||||
const medium = glanceFont.medium();
|
||||
const small = glanceFont.small();
|
||||
const { width, height } = image;
|
||||
const heading = this.rawHeading === null ? null : resolveHeading(this.rawHeading).displayDegrees;
|
||||
const headingText = heading === null ? "--°" : `${Math.round(heading)}° ${cardinalDirection(heading)}`;
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { GrayImage } from "../../../graphics/image";
|
||||
import { renderIcon } from "../../../graphics/icons";
|
||||
import { getDefaultMediumFont, getDefaultSmallFont } from "../../../graphics/ui-fonts";
|
||||
import { truncateText } from "../../../graphics/textwrap";
|
||||
import { mediaControllerBridge, type MediaControllerState } from "../../../native/media-controller";
|
||||
import { clamp } from "../../../util/numeric-util";
|
||||
import { glanceFont } from "../glance-font";
|
||||
import { type GlanceWidget } from "../widget";
|
||||
|
||||
const PAD = 8;
|
||||
@@ -75,8 +75,8 @@ export class MusicWidget implements GlanceWidget {
|
||||
}
|
||||
|
||||
paint(image: GrayImage): void {
|
||||
const medium = getDefaultMediumFont();
|
||||
const small = getDefaultSmallFont();
|
||||
const medium = glanceFont.medium();
|
||||
const small = glanceFont.small();
|
||||
const media = mediaControllerBridge.snapshot();
|
||||
this.media = media;
|
||||
if (!media.available || (!media.title && !media.artist)) {
|
||||
@@ -142,7 +142,7 @@ export class MusicWidget implements GlanceWidget {
|
||||
image.drawRect(dx - 1, dy - 1, this.art.width + 2, this.art.height + 2, 60);
|
||||
} else {
|
||||
image.drawRect(ART_X, artY, ART_SIZE, ART_SIZE, 60);
|
||||
const font = getDefaultSmallFont();
|
||||
const font = glanceFont.small();
|
||||
image.drawText(font, ART_X + Math.round((ART_SIZE - font.measureText("no art")) / 2),
|
||||
artY + Math.round((ART_SIZE - font.lineHeight) / 2), "no art", 90);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { GrayImage } from "../../../graphics/image";
|
||||
import { getDefaultLargeFont, getDefaultSmallFont } from "../../../graphics/ui-fonts";
|
||||
import { truncateText } from "../../../graphics/textwrap";
|
||||
import { nightscoutBridge, type NightscoutState } from "../../../native/nightscout-bridge";
|
||||
import { isNightscoutSettingsConfigured, loadNightscoutThresholds } from "../../../ui/dashboard-settings";
|
||||
@@ -13,6 +12,7 @@ import {
|
||||
formatDelta,
|
||||
isNightscoutPointStale,
|
||||
} from "../../nightscout/nightscout";
|
||||
import { glanceFont } from "../glance-font";
|
||||
import { type GlanceWidget } from "../widget";
|
||||
|
||||
const PAD = 8;
|
||||
@@ -48,8 +48,8 @@ export class NightscoutWidget implements GlanceWidget {
|
||||
}
|
||||
|
||||
paint(image: GrayImage): void {
|
||||
const small = getDefaultSmallFont();
|
||||
const large = getDefaultLargeFont();
|
||||
const small = glanceFont.small();
|
||||
const large = glanceFont.large();
|
||||
const state = this.state;
|
||||
const nowMs = Date.now();
|
||||
const step = lineStep(small);
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import { BATTERY_ICON_WIDTH, drawBattery } from "../../../graphics/battery";
|
||||
import { type GrayImage, type UiFont } from "../../../graphics/image";
|
||||
import { getDefaultLargeFont, getDefaultMediumFont, getDefaultSmallFont } from "../../../graphics/ui-fonts";
|
||||
import { onAndroidNotificationPosted, readActiveNotificationIcons } from "../../../native/notification-icons";
|
||||
import { readPhoneBatteryState } from "../../../native/phone-battery";
|
||||
import { formatClockDate, formatClockTime } from "../../../ui/clock-format";
|
||||
@@ -20,6 +19,7 @@ import { truncateText } from "../../../graphics/textwrap";
|
||||
import { timerEngine } from "../../timer/timer-engine";
|
||||
import { formatCountdown, sortTimers, timerDisplayName, timerPhase, timerRemainingMs } from "../../timer/timer-model";
|
||||
import { lineStep } from "../../../ui/metrics";
|
||||
import { glanceFont } from "../glance-font";
|
||||
import { type GlanceWidget } from "../widget";
|
||||
|
||||
const PAD = 8;
|
||||
@@ -97,9 +97,9 @@ export class SystemCardWidget implements GlanceWidget {
|
||||
}
|
||||
|
||||
paint(image: GrayImage): void {
|
||||
const large = getDefaultLargeFont();
|
||||
const medium = getDefaultMediumFont();
|
||||
const small = getDefaultSmallFont();
|
||||
const large = glanceFont.large();
|
||||
const medium = glanceFont.medium();
|
||||
const small = glanceFont.small();
|
||||
const now = new Date();
|
||||
|
||||
// Clock and date down the left; batteries take the right edge.
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import { type GrayImage } from "../../../graphics/image";
|
||||
import { truncateText } from "../../../graphics/textwrap";
|
||||
import { getDefaultSmallFont } from "../../../graphics/ui-fonts";
|
||||
import { lineStep } from "../../../ui/metrics";
|
||||
import { onWorkerStateChanged, readWorkerState } from "../../../ui/shell/worker-state";
|
||||
import {
|
||||
@@ -10,6 +9,7 @@ import {
|
||||
TERMINAL_SESSIONS_STATE_KEY,
|
||||
type TerminalSessionsSnapshot,
|
||||
} from "../../terminal/session-list";
|
||||
import { glanceFont } from "../glance-font";
|
||||
import { type GlanceWidget } from "../widget";
|
||||
|
||||
const PAD = 8;
|
||||
@@ -72,7 +72,7 @@ export class TerminalWidget implements GlanceWidget {
|
||||
}
|
||||
|
||||
paint(image: GrayImage): void {
|
||||
const font = getDefaultSmallFont();
|
||||
const font = glanceFont.small();
|
||||
const step = lineStep(font);
|
||||
const textWidth = image.width - 2 * PAD;
|
||||
const snapshot = this.snapshot;
|
||||
|
||||
Reference in new issue
Block a user