[Update] Font Family. Change the way to fetch font family list.

This commit is contained in:
Sakamoto Shiina
2024-10-02 18:26:58 +09:00
parent b1aadc7cda
commit 9f7101e233
4 changed files with 216 additions and 35 deletions

View File

@@ -221,8 +221,13 @@ import { invoke } from "@tauri-apps/api/tauri";
const useAsyncFetchFonts = () => {
const { updateSelectableFontFamilyList } = useStore_SelectableFontFamilyList();
const asyncFetchFonts = async () => {
const fonts = await invoke("get_font_list");
updateSelectableFontFamilyList(arrayToObject(fonts));
try {
let fonts = await invoke("get_font_list");
fonts = fonts.sort((a, b) => a.localeCompare(b, undefined, { sensitivity: "base" }));
updateSelectableFontFamilyList(arrayToObject(fonts));
} catch (error) {
console.error("Error fetching fonts:", error);
}
};
return { asyncFetchFonts };
};