]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Added PyMac_getscript() which returns the pythonic name of the current script. Not...
authorJack Jansen <jack.jansen@cwi.nl>
Mon, 24 Jul 2000 19:50:16 +0000 (19:50 +0000)
committerJack Jansen <jack.jansen@cwi.nl>
Mon, 24 Jul 2000 19:50:16 +0000 (19:50 +0000)
Mac/Python/macglue.c

index ad4e82bdbec73035e0604a743bce215602f7c4e8..8b3d6e139c6c2655b0d6805a6888776a00cd1cff 100644 (file)
@@ -181,6 +181,40 @@ static PyObject *python_event_handler;
 */
 int PyMac_AppearanceCompliant;
 
+/*
+** Find out what the current script is.
+** Donated by Fredrik Lund.
+*/
+char *PyMac_getscript()
+{
+   int font, script, lang;
+    font = 0;
+    font = GetSysFont();
+    script = FontToScript(font);
+    switch (script) {
+    case smRoman:
+        lang = GetScriptVariable(script, smScriptLang);
+        if (lang == langIcelandic)
+            return "mac-iceland";
+        else if (lang == langTurkish)
+            return "mac-turkish";
+        else if (lang == langGreek)
+            return "mac-greek";
+        else
+            return "mac-roman";
+        break;
+    case smJapanese:
+        return "mac-japan";
+    case smGreek:
+        return "mac-greek";
+    case smCyrillic:
+        return "mac-cyrillic";
+    default:
+        return "mac-roman"; /* better than nothing */
+    }
+}
+
+
 #ifdef USE_GUSI1
 /*
 ** GUSI (1.6.0 and earlier, at the least) do not set the MacOS idea of