diff options
author | Jack Jansen <jack.jansen@cwi.nl> | 2000-07-24 19:50:16 (GMT) |
---|---|---|
committer | Jack Jansen <jack.jansen@cwi.nl> | 2000-07-24 19:50:16 (GMT) |
commit | 1f9f2f4c490d901c6a5815f7db8cbe6ba4903849 (patch) | |
tree | cbffb695294673e68303546872a9aafa5aae827c /Mac/Python | |
parent | 12d86c8240c1b71d39f8cb2892931cf46af43032 (diff) | |
download | cpython-1f9f2f4c490d901c6a5815f7db8cbe6ba4903849.zip cpython-1f9f2f4c490d901c6a5815f7db8cbe6ba4903849.tar.gz cpython-1f9f2f4c490d901c6a5815f7db8cbe6ba4903849.tar.bz2 |
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.
Diffstat (limited to 'Mac/Python')
-rw-r--r-- | Mac/Python/macglue.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/Mac/Python/macglue.c b/Mac/Python/macglue.c index ad4e82b..8b3d6e1 100644 --- a/Mac/Python/macglue.c +++ b/Mac/Python/macglue.c @@ -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 |