feat: multiple fonts fallbacks (#8286)

This commit is contained in:
Marcel Mraz 2024-07-30 10:34:40 +02:00 committed by GitHub
parent d0a380758e
commit 230d0edc44
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 293 additions and 127 deletions

View file

@ -63,15 +63,15 @@ export const FontPickerList = React.memo(
() =>
Array.from(Fonts.registered.entries())
.filter(([_, { metadata }]) => !metadata.serverSide)
.map(([familyId, { metadata, fontFaces }]) => {
const font = {
.map(([familyId, { metadata, fonts }]) => {
const fontDescriptor = {
value: familyId,
icon: metadata.icon,
text: fontFaces[0].fontFace.family,
text: fonts[0].fontFace.family,
};
if (metadata.deprecated) {
Object.assign(font, {
Object.assign(fontDescriptor, {
deprecated: metadata.deprecated,
badge: {
type: DropDownMenuItemBadgeType.RED,
@ -80,7 +80,7 @@ export const FontPickerList = React.memo(
});
}
return font as FontDescriptor;
return fontDescriptor as FontDescriptor;
})
.sort((a, b) =>
a.text.toLowerCase() > b.text.toLowerCase() ? 1 : -1,