refactor(client): simplify font definition

This commit is contained in:
Elian Doran 2025-01-03 20:36:59 +02:00
parent 8667c0a686
commit dfc9cdb25a
No known key found for this signature in database

View File

@ -5,7 +5,7 @@ import { FontFamily, OptionMap, OptionNames } from "../../../../../../services/o
interface FontFamilyEntry { interface FontFamilyEntry {
value: FontFamily; value: FontFamily;
label: string; label?: string;
} }
interface FontGroup { interface FontGroup {
@ -26,40 +26,40 @@ const FONT_FAMILIES: FontGroup[] = [
{ {
title: t("fonts.sans-serif-system-fonts"), title: t("fonts.sans-serif-system-fonts"),
items: [ items: [
{ value: "Arial", label: "Arial" }, { value: "Arial" },
{ value: "Verdana", label: "Verdana" }, { value: "Verdana" },
{ value: "Helvetica", label: "Helvetica" }, { value: "Helvetica" },
{ value: "Tahoma", label: "Tahoma" }, { value: "Tahoma" },
{ value: "Trebuchet MS", label: "Trebuchet MS" }, { value: "Trebuchet MS" },
{ value: "Microsoft YaHei", label: "Microsoft YaHei" }, { value: "Microsoft YaHei" },
] ]
}, },
{ {
title: t("fonts.serif-system-fonts"), title: t("fonts.serif-system-fonts"),
items: [ items: [
{ value: "Times New Roman", label: "Times New Roman" }, { value: "Times New Roman" },
{ value: "Georgia", label: "Georgia" }, { value: "Georgia" },
{ value: "Garamond", label: "Garamond" }, { value: "Garamond" },
] ]
}, },
{ {
title: t("fonts.monospace-system-fonts"), title: t("fonts.monospace-system-fonts"),
items: [ items: [
{ value: "Courier New", label: "Courier New" }, { value: "Courier New" },
{ value: "Brush Script MT", label: "Brush Script MT" }, { value: "Brush Script MT" },
{ value: "Impact", label: "Impact" }, { value: "Impact" },
{ value: "American Typewriter", label: "American Typewriter" }, { value: "American Typewriter" },
{ value: "Andalé Mono", label: "Andalé Mono" }, { value: "Andalé Mono" },
{ value: "Lucida Console", label: "Lucida Console" }, { value: "Lucida Console" },
{ value: "Monaco", label: "Monaco" }, { value: "Monaco" },
] ]
}, },
{ {
title: t("fonts.handwriting-system-fonts"), title: t("fonts.handwriting-system-fonts"),
items: [ items: [
{ value: "Bradley Hand", label: "Bradley Hand" }, { value: "Bradley Hand" },
{ value: "Luminari", label: "Luminari" }, { value: "Luminari" },
{ value: "Comic Sans MS", label: "Comic Sans MS" } { value: "Comic Sans MS" }
] ]
} }
]; ];
@ -229,7 +229,7 @@ export default class FontsOptions extends OptionsWidget {
$group.append($("<option>") $group.append($("<option>")
.attr("value", value) .attr("value", value)
.prop("selected", value === currentValue) .prop("selected", value === currentValue)
.text(label)); .text(label ?? value));
} }
$select.append($group); $select.append($group);