diff Mac/Python/macglue.c @ 13701:c68003efb796 legacy-trunk

Added PyMac_getscript() which returns the pythonic name of the current script. Not ideal and not complete, but good enough for the time being. Idea and most of the code by Fredrik Lund.
author Jack Jansen <jack.jansen@cwi.nl>
date Mon, 24 Jul 2000 19:50:16 +0000
parents a901c2c0166b
children 2787e93817c6
line wrap: on
line diff
--- a/Mac/Python/macglue.c	Mon Jul 24 19:46:27 2000 +0000
+++ b/Mac/Python/macglue.c	Mon Jul 24 19:50:16 2000 +0000
@@ -181,6 +181,40 @@
 */
 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