diff options
| author | Kenichi Handa | 2005-04-22 04:03:17 +0000 |
|---|---|---|
| committer | Kenichi Handa | 2005-04-22 04:03:17 +0000 |
| commit | d7301fcf5dc9e6d2e2cfe5f6ff789a533c894b4e (patch) | |
| tree | 6a63ba5b75324733bb92b2e5a6575c817d5e01cb | |
| parent | 75ac46cba56f490974970cee7197088260a7f9bb (diff) | |
| download | emacs-d7301fcf5dc9e6d2e2cfe5f6ff789a533c894b4e.tar.gz emacs-d7301fcf5dc9e6d2e2cfe5f6ff789a533c894b4e.zip | |
Sync with the main trunk.
(mac-centraleurroman, mac-cyrillic): New charsets and coding
systems.
(mac-symbol, mac-dingbats): New charsets.
| -rw-r--r-- | lisp/term/mac-win.el | 205 |
1 files changed, 190 insertions, 15 deletions
diff --git a/lisp/term/mac-win.el b/lisp/term/mac-win.el index b92f051c3d2..1478fff955a 100644 --- a/lisp/term/mac-win.el +++ b/lisp/term/mac-win.el | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | ;;; mac-win.el --- parse switches controlling interface with Mac window system -*-coding: iso-2022-7bit;-*- | 1 | ;;; mac-win.el --- parse switches controlling interface with Mac window system -*-coding: utf-8 |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 1999, 2000, 2002, 2003, 2004, 2005 | 3 | ;; Copyright (C) 1999, 2000, 2002, 2003, 2004, 2005 |
| 4 | ;; Free Software Foundation, Inc. | 4 | ;; Free Software Foundation, Inc. |
| @@ -1187,23 +1187,198 @@ correspoinding TextEncodingBase value." | |||
| 1187 | ;; Exit Emacs with fatal error if this fails. | 1187 | ;; Exit Emacs with fatal error if this fails. |
| 1188 | t)) | 1188 | t)) |
| 1189 | 1189 | ||
| 1190 | (setq frame-creation-function 'x-create-frame-with-faces);; Setup the default fontset. | 1190 | (setq frame-creation-function 'x-create-frame-with-faces) |
| 1191 | |||
| 1192 | (define-charset 'mac-centraleurroman | ||
| 1193 | "Mac Central European Roman" | ||
| 1194 | :short-name "Mac CE" | ||
| 1195 | :ascii-compatible-p t | ||
| 1196 | :code-space [0 255] | ||
| 1197 | :map | ||
| 1198 | (let ((tbl | ||
| 1199 | [?\Ä ?\Ā ?\ā ?\É ?\Ą ?\Ö ?\Ü ?\á ?\ą ?\Č ?\ä ?\č ?\Ć ?\ć ?\é ?\Ź | ||
| 1200 | ?\ź ?\Ď ?\í ?\ď ?\Ē ?\ē ?\Ė ?\ó ?\ė ?\ô ?\ö ?\õ ?\ú ?\Ě ?\ě ?\ü | ||
| 1201 | ?\† ?\° ?\Ę ?\£ ?\§ ?\• ?\¶ ?\ß ?\® ?\© ?\™ ?\ę ?\¨ ?\≠ ?\ģ ?\Į | ||
| 1202 | ?\į ?\Ī ?\≤ ?\≥ ?\ī ?\Ķ ?\∂ ?\∑ ?\ł ?\Ļ ?\ļ ?\Ľ ?\ľ ?\Ĺ ?\ĺ ?\Ņ | ||
| 1203 | ?\ņ ?\Ń ?\¬ ?\√ ?\ń ?\Ň ?\∆ ?\« ?\» ?\… ?\ ?\ň ?\Ő ?\Õ ?\ő ?\Ō | ||
| 1204 | ?\– ?\— ?\“ ?\” ?\‘ ?\’ ?\÷ ?\◊ ?\ō ?\Ŕ ?\ŕ ?\Ř ?\‹ ?\› ?\ř ?\Ŗ | ||
| 1205 | ?\ŗ ?\Š ?\‚ ?\„ ?\š ?\Ś ?\ś ?\Á ?\Ť ?\ť ?\Í ?\Ž ?\ž ?\Ū ?\Ó ?\Ô | ||
| 1206 | ?\ū ?\Ů ?\Ú ?\ů ?\Ű ?\ű ?\Ų ?\ų ?\Ý ?\ý ?\ķ ?\Ż ?\Ł ?\ż ?\Ģ ?\ˇ]) | ||
| 1207 | (map (make-vector 512 nil))) | ||
| 1208 | (or (= (length tbl) 128) | ||
| 1209 | (error "Invalid vector length: %d" (length tbl))) | ||
| 1210 | (dotimes (i 128) | ||
| 1211 | (aset map (* i 2) i) | ||
| 1212 | (aset map (1+ (* i 2)) i)) | ||
| 1213 | (dotimes (i 128) | ||
| 1214 | (aset map (+ 256 (* i 2)) (+ 128 i)) | ||
| 1215 | (aset map (+ 256 (1+ (* i 2))) (aref tbl i))) | ||
| 1216 | map)) | ||
| 1217 | |||
| 1218 | (define-coding-system 'mac-centraleurroman | ||
| 1219 | "Mac Central European Roman Encoding (MIME:x-mac-centraleurroman)." | ||
| 1220 | :coding-type 'charset | ||
| 1221 | :mnemonic ?* | ||
| 1222 | :charset-list '(mac-centraleurroman) | ||
| 1223 | :mime-charset 'x-mac-centraleurroman) | ||
| 1224 | |||
| 1225 | (define-charset 'mac-cyrillic | ||
| 1226 | "Mac Cyrillic" | ||
| 1227 | :short-name "Mac CYRILLIC" | ||
| 1228 | :ascii-compatible-p t | ||
| 1229 | :code-space [0 255] | ||
| 1230 | :map | ||
| 1231 | (let ((tbl | ||
| 1232 | [?\А ?\Б ?\В ?\Г ?\Д ?\Е ?\Ж ?\З ?\И ?\Й ?\К ?\Л ?\М ?\Н ?\О ?\П | ||
| 1233 | ?\Р ?\С ?\Т ?\У ?\Ф ?\Х ?\Ц ?\Ч ?\Ш ?\Щ ?\Ъ ?\Ы ?\Ь ?\Э ?\Ю ?\Я | ||
| 1234 | ?\† ?\° ?\Ґ ?\£ ?\§ ?\• ?\¶ ?\І ?\® ?\© ?\™ ?\Ђ ?\ђ ?\≠ ?\Ѓ ?\ѓ | ||
| 1235 | ?\∞ ?\± ?\≤ ?\≥ ?\і ?\µ ?\ґ ?\Ј ?\Є ?\є ?\Ї ?\ї ?\Љ ?\љ ?\Њ ?\њ | ||
| 1236 | ?\ј ?\Ѕ ?\¬ ?\√ ?\ƒ ?\≈ ?\∆ ?\« ?\» ?\… ?\ ?\Ћ ?\ћ ?\Ќ ?\ќ ?\ѕ | ||
| 1237 | ?\– ?\— ?\“ ?\” ?\‘ ?\’ ?\÷ ?\„ ?\Ў ?\ў ?\Џ ?\џ ?\№ ?\Ё ?\ё ?\я | ||
| 1238 | ?\а ?\б ?\в ?\г ?\д ?\е ?\ж ?\з ?\и ?\й ?\к ?\л ?\м ?\н ?\о ?\п | ||
| 1239 | ?\р ?\с ?\т ?\у ?\ф ?\х ?\ц ?\ч ?\ш ?\щ ?\ъ ?\ы ?\ь ?\э ?\ю ?\€]) | ||
| 1240 | (map (make-vector 512 nil))) | ||
| 1241 | (or (= (length tbl) 128) | ||
| 1242 | (error "Invalid vector length: %d" (length tbl))) | ||
| 1243 | (dotimes (i 128) | ||
| 1244 | (aset map (* i 2) i) | ||
| 1245 | (aset map (1+ (* i 2)) i)) | ||
| 1246 | (dotimes (i 128) | ||
| 1247 | (aset map (+ 256 (* i 2)) (+ 128 i)) | ||
| 1248 | (aset map (+ 256 (1+ (* i 2))) (aref tbl i))) | ||
| 1249 | map)) | ||
| 1250 | |||
| 1251 | (define-coding-system 'mac-cyrillic | ||
| 1252 | "Mac Cyrillic Encoding (MIME:x-mac-cyrillic)." | ||
| 1253 | :coding-type 'charset | ||
| 1254 | :mnemonic ?* | ||
| 1255 | :charset-list '(mac-cyrillic) | ||
| 1256 | :mime-charset 'x-mac-cyrillic) | ||
| 1257 | |||
| 1258 | (define-charset 'mac-symbol | ||
| 1259 | "Mac Symbol" | ||
| 1260 | :short-name "Mac SYMBOL" | ||
| 1261 | :code-space [32 254] | ||
| 1262 | :map | ||
| 1263 | (let ((tbl-32-126 | ||
| 1264 | [?\ ?\! ?\∀ ?\# ?\∃ ?\% ?\& ?\∍ ?\( ?\) ?\∗ ?\+ ?\, ?\− ?\. ?\/ | ||
| 1265 | ?\0 ?\1 ?\2 ?\3 ?\4 ?\5 ?\6 ?\7 ?\8 ?\9 ?\: ?\; ?\< ?\= ?\> ?\? | ||
| 1266 | ?\≅ ?\Α ?\Β ?\Χ ?\Δ ?\Ε ?\Φ ?\Γ ?\Η ?\Ι ?\ϑ ?\Κ ?\Λ ?\Μ ?\Ν ?\Ο | ||
| 1267 | ?\Π ?\Θ ?\Ρ ?\Σ ?\Τ ?\Υ ?\ς ?\Ω ?\Ξ ?\Ψ ?\Ζ ?\[ ?\∴ ?\] ?\⊥ ?\_ | ||
| 1268 | ?\ ?\α ?\β ?\χ ?\δ ?\ε ?\φ ?\γ ?\η ?\ι ?\ϕ ?\κ ?\λ ?\μ ?\ν ?\ο | ||
| 1269 | ?\π ?\θ ?\ρ ?\σ ?\τ ?\υ ?\ϖ ?\ω ?\ξ ?\ψ ?\ζ ?\{ ?\| ?\} ?\∼]) | ||
| 1270 | (map-32-126 (make-vector (* (1+ (- 126 32)) 2) nil)) | ||
| 1271 | (tbl-160-254 | ||
| 1272 | ;; Mapping of the following characters are changed from the | ||
| 1273 | ;; original one: | ||
| 1274 | ;; 0xE2 0x00AE+0xF87F->0x00AE # REGISTERED SIGN, alternate: sans serif | ||
| 1275 | ;; 0xE3 0x00A9+0xF87F->0x00A9 # COPYRIGHT SIGN, alternate: sans serif | ||
| 1276 | ;; 0xE4 0x2122+0xF87F->0x2122 # TRADE MARK SIGN, alternate: sans serif | ||
| 1277 | [?\€ ?\ϒ ?\′ ?\≤ ?\⁄ ?\∞ ?\ƒ ?\♣ ?\♦ ?\♥ ?\♠ ?\↔ ?\← ?\↑ ?\→ ?\↓ | ||
| 1278 | ?\° ?\± ?\″ ?\≥ ?\× ?\∝ ?\∂ ?\• ?\÷ ?\≠ ?\≡ ?\≈ ?\… ?\⏐ ?\⎯ ?\↵ | ||
| 1279 | ?\ℵ ?\ℑ ?\ℜ ?\℘ ?\⊗ ?\⊕ ?\∅ ?\∩ ?\∪ ?\⊃ ?\⊇ ?\⊄ ?\⊂ ?\⊆ ?\∈ ?\∉ | ||
| 1280 | ?\∠ ?\∇ ?\® ?\© ?\™ ?\∏ ?\√ ?\⋅ ?\¬ ?\∧ ?\∨ ?\⇔ ?\⇐ ?\⇑ ?\⇒ ?\⇓ | ||
| 1281 | ?\◊ ?\〈 ?\® ?\© ?\™ ?\∑ ?\⎛ ?\⎜ ?\⎝ ?\⎡ ?\⎢ ?\⎣ ?\⎧ ?\⎨ ?\⎩ ?\⎪ | ||
| 1282 | ?\ ?\〉 ?\∫ ?\⌠ ?\⎮ ?\⌡ ?\⎞ ?\⎟ ?\⎠ ?\⎤ ?\⎥ ?\⎦ ?\⎫ ?\⎬ ?\⎭]) | ||
| 1283 | (map-160-254 (make-vector (* (1+ (- 254 160)) 2) nil))) | ||
| 1284 | (dotimes (i (1+ (- 126 32))) | ||
| 1285 | (aset map-32-126 (* i 2) (+ 32 i)) | ||
| 1286 | (aset map-32-126 (1+ (* i 2)) (aref tbl-32-126 i))) | ||
| 1287 | (dotimes (i (1+ (- 254 160))) | ||
| 1288 | (aset map-160-254 (* i 2) (+ 160 i)) | ||
| 1289 | (aset map-160-254 (1+ (* i 2)) (aref tbl-160-254 i))) | ||
| 1290 | (vconcat map-32-126 map-160-254))) | ||
| 1291 | |||
| 1292 | (define-charset 'mac-dingbats | ||
| 1293 | "Mac Dingbats" | ||
| 1294 | :short-name "Mac Dingbats" | ||
| 1295 | :code-space [32 254] | ||
| 1296 | :map | ||
| 1297 | (let ((tbl-32-126 | ||
| 1298 | [?\ ?\✁ ?\✂ ?\✃ ?\✄ ?\☎ ?\✆ ?\✇ ?\✈ ?\✉ ?\☛ ?\☞ ?\✌ ?\✍ ?\✎ ?\✏ | ||
| 1299 | ?\✐ ?\✑ ?\✒ ?\✓ ?\✔ ?\✕ ?\✖ ?\✗ ?\✘ ?\✙ ?\✚ ?\✛ ?\✜ ?\✝ ?\✞ ?\✟ | ||
| 1300 | ?\✠ ?\✡ ?\✢ ?\✣ ?\✤ ?\✥ ?\✦ ?\✧ ?\★ ?\✩ ?\✪ ?\✫ ?\✬ ?\✭ ?\✮ ?\✯ | ||
| 1301 | ?\✰ ?\✱ ?\✲ ?\✳ ?\✴ ?\✵ ?\✶ ?\✷ ?\✸ ?\✹ ?\✺ ?\✻ ?\✼ ?\✽ ?\✾ ?\✿ | ||
| 1302 | ?\❀ ?\❁ ?\❂ ?\❃ ?\❄ ?\❅ ?\❆ ?\❇ ?\❈ ?\❉ ?\❊ ?\❋ ?\● ?\❍ ?\■ ?\❏ | ||
| 1303 | ?\❐ ?\❑ ?\❒ ?\▲ ?\▼ ?\◆ ?\❖ ?\◗ ?\❘ ?\❙ ?\❚ ?\❛ ?\❜ ?\❝ ?\❞]) | ||
| 1304 | (map-32-126 (make-vector (* (1+ (- 126 32)) 2) nil)) | ||
| 1305 | (tbl-128-141 | ||
| 1306 | [?\❨ ?\❩ ?\❪ ?\❫ ?\❬ ?\❭ ?\❮ ?\❯ ?\❰ ?\❱ ?\❲ ?\❳ ?\❴ ?\❵]) | ||
| 1307 | (map-128-141 (make-vector (* (1+ (- 141 128)) 2) nil)) | ||
| 1308 | (tbl-161-239 | ||
| 1309 | [?\❡ ?\❢ ?\❣ ?\❤ ?\❥ ?\❦ ?\❧ ?\♣ ?\♦ ?\♥ ?\♠ ?\① ?\② ?\③ ?\④ | ||
| 1310 | ?\⑤ ?\⑥ ?\⑦ ?\⑧ ?\⑨ ?\⑩ ?\❶ ?\❷ ?\❸ ?\❹ ?\❺ ?\❻ ?\❼ ?\❽ ?\❾ ?\❿ | ||
| 1311 | ?\➀ ?\➁ ?\➂ ?\➃ ?\➄ ?\➅ ?\➆ ?\➇ ?\➈ ?\➉ ?\➊ ?\➋ ?\➌ ?\➍ ?\➎ ?\➏ | ||
| 1312 | ?\➐ ?\➑ ?\➒ ?\➓ ?\➔ ?\→ ?\↔ ?\↕ ?\➘ ?\➙ ?\➚ ?\➛ ?\➜ ?\➝ ?\➞ ?\➟ | ||
| 1313 | ?\➠ ?\➡ ?\➢ ?\➣ ?\➤ ?\➥ ?\➦ ?\➧ ?\➨ ?\➩ ?\➪ ?\➫ ?\➬ ?\➭ ?\➮ ?\➯]) | ||
| 1314 | (map-161-239 (make-vector (* (1+ (- 239 161)) 2) nil)) | ||
| 1315 | (tbl-241-254 | ||
| 1316 | [?\➱ ?\➲ ?\➳ ?\➴ ?\➵ ?\➶ ?\➷ ?\➸ ?\➹ ?\➺ ?\➻ ?\➼ ?\➽ ?\➾]) | ||
| 1317 | (map-241-254 (make-vector (* (1+ (- 254 241)) 2) nil))) | ||
| 1318 | (dotimes (i (1+ (- 126 32))) | ||
| 1319 | (aset map-32-126 (* i 2) (+ 32 i)) | ||
| 1320 | (aset map-32-126 (1+ (* i 2)) (aref tbl-32-126 i))) | ||
| 1321 | (dotimes (i (1+ (- 141 128))) | ||
| 1322 | (aset map-128-141 (* i 2) (+ 128 i)) | ||
| 1323 | (aset map-128-141 (1+ (* i 2)) (aref tbl-128-141 i))) | ||
| 1324 | (dotimes (i (1+ (- 239 161))) | ||
| 1325 | (aset map-161-239 (* i 2) (+ 161 i)) | ||
| 1326 | (aset map-161-239 (1+ (* i 2)) (aref tbl-161-239 i))) | ||
| 1327 | (dotimes (i (1+ (- 254 241))) | ||
| 1328 | (aset map-241-254 (* i 2) (+ 241 i)) | ||
| 1329 | (aset map-241-254 (1+ (* i 2)) (aref tbl-241-254 i))) | ||
| 1330 | (vconcat map-32-126 map-128-141 map-161-239 map-241-254))) | ||
| 1331 | |||
| 1332 | (setq font-encoding-alist | ||
| 1333 | (append | ||
| 1334 | '(("mac-roman" . mac-roman) | ||
| 1335 | ("mac-centraleurroman" . mac-centraleurroman) | ||
| 1336 | ("mac-cyrillic" . mac-cyrillic) | ||
| 1337 | ("mac-symbol" . mac-symbol) | ||
| 1338 | ("mac-dingbats" . mac-dingbats)) | ||
| 1339 | font-encoding-alist)) | ||
| 1340 | |||
| 1341 | (defun fontset-add-mac-fonts (fontset &optional base-family) | ||
| 1342 | (dolist (elt `((latin . (,(or base-family "Monaco") . "mac-roman")) | ||
| 1343 | (mac-roman . (,base-family . "mac-roman")) | ||
| 1344 | (mac-centraleurroman . (,base-family . "mac-centraleurroman")) | ||
| 1345 | (mac-cyrillic . (,base-family . "mac-cyrillic")) | ||
| 1346 | (mac-symbol . (,base-family . "mac-symbol")) | ||
| 1347 | (mac-dingbats . (,base-family . "mac-dingbats")))) | ||
| 1348 | (set-fontset-font fontset (car elt) (cdr elt)))) | ||
| 1349 | |||
| 1350 | (defun create-fontset-from-mac-roman-font (font &optional resolved-font | ||
| 1351 | fontset-name) | ||
| 1352 | "Create a fontset from a Mac roman font FONT. | ||
| 1353 | |||
| 1354 | Optional 1st arg RESOLVED-FONT is a resolved name of FONT. If | ||
| 1355 | omitted, `x-resolve-font-name' is called to get the resolved name. At | ||
| 1356 | this time, if FONT is not available, error is signaled. | ||
| 1357 | |||
| 1358 | Optional 2nd arg FONTSET-NAME is a string to be used in | ||
| 1359 | `<CHARSET_ENCODING>' fields of a new fontset name. If it is omitted, | ||
| 1360 | an appropriate name is generated automatically. | ||
| 1361 | |||
| 1362 | It returns a name of the created fontset." | ||
| 1363 | (or resolved-font | ||
| 1364 | (setq resolved-font (x-resolve-font-name font))) | ||
| 1365 | (let* ((xlfd-fields (x-decompose-font-name resolved-font)) | ||
| 1366 | (base-family (aref (x-decompose-font-name ascii-font) | ||
| 1367 | xlfd-regexp-family-subnum))) | ||
| 1368 | (if (string= base-family "*") | ||
| 1369 | (setq base-family nil)) | ||
| 1370 | (new-fontset fontset-name (list (cons 'ascii resolved-font))) | ||
| 1371 | (fontset-add-mac-fonts fontset-name base-family))) | ||
| 1372 | |||
| 1373 | ;; Setup the default fontset. | ||
| 1191 | (setup-default-fontset) | 1374 | (setup-default-fontset) |
| 1192 | 1375 | ||
| 1193 | ;; Carbon uses different fonts than commonly found on X, so | ||
| 1194 | ;; we define our own standard fontset here. | ||
| 1195 | (defvar mac-standard-fontset-spec | ||
| 1196 | "-apple-Monaco-normal-r-*-*-12-*-*-*-*-*-fontset-mac" | ||
| 1197 | "String of fontset spec of the standard fontset. | ||
| 1198 | This defines a fontset consisting of the Monaco variations for | ||
| 1199 | European languages which are distributed with Mac OS X. | ||
| 1200 | |||
| 1201 | See the documentation of `create-fontset-from-fontset-spec for the format.") | ||
| 1202 | |||
| 1203 | ;; Create a fontset that uses mac-roman font. With this fontset, | 1376 | ;; Create a fontset that uses mac-roman font. With this fontset, |
| 1204 | ;; characters decoded from mac-roman encoding (ascii, latin-iso8859-1, | 1377 | ;; characters belonging to mac-roman charset (that contains ASCII and |
| 1205 | ;; and mule-unicode-xxxx-yyyy) are displayed by a mac-roman font. | 1378 | ;; more Latin characters) are displayed by a mac-roman font. |
| 1206 | (create-fontset-from-fontset-spec mac-standard-fontset-spec t) | 1379 | (create-fontset-from-mac-roman-font |
| 1380 | "-*-Monaco-*-*-*-*-12-*-*-*-*-*-mac-roman" nil | ||
| 1381 | "-apple-Monaco-normal-r-*-*-12-*-*-*-*-*-fontset-mac") | ||
| 1207 | 1382 | ||
| 1208 | ;; Create fontset specified in X resources "Fontset-N" (N is 0, 1, ...). | 1383 | ;; Create fontset specified in X resources "Fontset-N" (N is 0, 1, ...). |
| 1209 | (create-fontset-from-x-resource) | 1384 | (create-fontset-from-x-resource) |