From cb1b56f5a0eddbf77446f415f2beda57c8305f85 Mon Sep 17 00:00:00 2001
From: polwex <polwex@sortug.com>
Date: Sun, 23 Nov 2025 01:12:53 +0700
Subject: wut

---
 packages/prosody-ui/src/fonts/useLangFont.tsx | 44 +++++++++++++++++++++++++++
 1 file changed, 44 insertions(+)
 create mode 100644 packages/prosody-ui/src/fonts/useLangFont.tsx

(limited to 'packages/prosody-ui/src/fonts/useLangFont.tsx')

diff --git a/packages/prosody-ui/src/fonts/useLangFont.tsx b/packages/prosody-ui/src/fonts/useLangFont.tsx
new file mode 100644
index 0000000..36fa603
--- /dev/null
+++ b/packages/prosody-ui/src/fonts/useLangFont.tsx
@@ -0,0 +1,44 @@
+import React, { useEffect, useState, type ReactNode } from "react";
+import fontIcon from "../assets/icons/font.svg";
+import { getScriptPredictor } from "glotscript";
+
+function useLangFont({ text }: { text: string }) {
+  useEffect(() => {
+    const predictor = getScriptPredictor();
+    const res = predictor(text);
+    console.log("script predicted", res);
+    setScript(res[0]);
+  }, [text]);
+  const [script, setScript] = useState<string | null>(null);
+  const [fontIdx, setFont] = useState(0);
+  const fontCount = 6;
+  function changeFont() {
+    if (fontIdx === fontCount) setFont(0);
+    else setFont((prev) => prev + 1);
+  }
+  // if (script === "Hani") return {}
+}
+// function FontChanger({
+//   lang,
+//   children,
+// }: {
+//   lang: string;
+//   children: ReactNode;
+// }) {
+//   useEffect(() => {}, []);
+//   const [script, setScript] = useState("Latn");
+//   const [fontIdx, setFont] = useState(0);
+//   const fontCount = 6;
+//   function changeFont() {
+//     if (fontIdx === fontCount) setFont(0);
+//     else setFont((prev) => prev + 1);
+//   }
+//   return (
+//     <div className="font-changer" lang={script}>
+//       <img className="font-icon cp" onClick={changeFont} src={fontIcon} />
+//       {children}
+//     </div>
+//   );
+// }
+
+export default useLangFont;
-- 
cgit v1.2.3

