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

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

No files matched your search

+7 -2
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 };
};