diff options
| author | Steven Tamm | 2004-12-18 16:36:31 +0000 |
|---|---|---|
| committer | Steven Tamm | 2004-12-18 16:36:31 +0000 |
| commit | fbe6152fad0cd271a9bb766f16a70a8fa988d992 (patch) | |
| tree | c45ab5f252570fd6d32b2bba0b2a710af2cb82bb | |
| parent | c138633412ded34ddb448cca51f52cdf7a3edbab (diff) | |
| download | emacs-fbe6152fad0cd271a9bb766f16a70a8fa988d992.tar.gz emacs-fbe6152fad0cd271a9bb766f16a70a8fa988d992.zip | |
* term/mac-win.el (encoding-vector, mac-font-encoder-list)
(ccl-encode-mac-centraleurroman-font): Use centraleurroman
instead of centraleuropean as the name
* macterm.c (endif, x_font_name_to_mac_font_name): Use
maccentraleurroman instead of maccentraleuropean
(mac_c_string_match, mac_do_list_fonts): Speed up font search by
quickly finding a specific font without needing regexps.
| -rw-r--r-- | lisp/ChangeLog | 6 | ||||
| -rw-r--r-- | lisp/term/mac-win.el | 18 | ||||
| -rw-r--r-- | src/ChangeLog | 7 | ||||
| -rw-r--r-- | src/macterm.c | 104 |
4 files changed, 103 insertions, 32 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 33a3d65fe02..40a11a935cf 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,9 @@ | |||
| 1 | 2004-12-18 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> | ||
| 2 | |||
| 3 | * term/mac-win.el (encoding-vector, mac-font-encoder-list) | ||
| 4 | (ccl-encode-mac-centraleurroman-font): Use centraleurroman | ||
| 5 | instead of centraleuropean as the name | ||
| 6 | |||
| 1 | 2004-12-17 Michael Albinus <michael.albinus@gmx.de> | 7 | 2004-12-17 Michael Albinus <michael.albinus@gmx.de> |
| 2 | 8 | ||
| 3 | Sync with Tramp 2.0.46. | 9 | Sync with Tramp 2.0.46. |
diff --git a/lisp/term/mac-win.el b/lisp/term/mac-win.el index 5032135da21..2b5c4d2a994 100644 --- a/lisp/term/mac-win.el +++ b/lisp/term/mac-win.el | |||
| @@ -199,7 +199,7 @@ Switch to a buffer editing the last file dropped." | |||
| 199 | (let | 199 | (let |
| 200 | ((encoding-vector (make-vector 256 nil)) | 200 | ((encoding-vector (make-vector 256 nil)) |
| 201 | (i 0) | 201 | (i 0) |
| 202 | (vec ;; mac-centraleuropean (128..255) -> UCS mapping | 202 | (vec ;; mac-centraleurroman (128..255) -> UCS mapping |
| 203 | [ #x00C4 ;; 128:LATIN CAPITAL LETTER A WITH DIAERESIS | 203 | [ #x00C4 ;; 128:LATIN CAPITAL LETTER A WITH DIAERESIS |
| 204 | #x0100 ;; 129:LATIN CAPITAL LETTER A WITH MACRON | 204 | #x0100 ;; 129:LATIN CAPITAL LETTER A WITH MACRON |
| 205 | #x0101 ;; 130:LATIN SMALL LETTER A WITH MACRON | 205 | #x0101 ;; 130:LATIN SMALL LETTER A WITH MACRON |
| @@ -339,8 +339,8 @@ Switch to a buffer editing the last file dropped." | |||
| 339 | (setq i (1+ i))) | 339 | (setq i (1+ i))) |
| 340 | (setq translation-table | 340 | (setq translation-table |
| 341 | (make-translation-table-from-vector encoding-vector)) | 341 | (make-translation-table-from-vector encoding-vector)) |
| 342 | ;; (define-translation-table 'mac-centraleuropean-decoder translation-table) | 342 | ;; (define-translation-table 'mac-centraleurroman-decoder translation-table) |
| 343 | (define-translation-table 'mac-centraleuropean-encoder | 343 | (define-translation-table 'mac-centraleurroman-encoder |
| 344 | (char-table-extra-slot translation-table 0))) | 344 | (char-table-extra-slot translation-table 0))) |
| 345 | 345 | ||
| 346 | (let | 346 | (let |
| @@ -493,8 +493,8 @@ Switch to a buffer editing the last file dropped." | |||
| 493 | (defvar mac-font-encoder-list | 493 | (defvar mac-font-encoder-list |
| 494 | '(("mac-roman" mac-roman-encoder | 494 | '(("mac-roman" mac-roman-encoder |
| 495 | ccl-encode-mac-roman-font "%s") | 495 | ccl-encode-mac-roman-font "%s") |
| 496 | ("mac-centraleuropean" mac-centraleuropean-encoder | 496 | ("mac-centraleurroman" mac-centraleurroman-encoder |
| 497 | ccl-encode-mac-centraleuropean-font "%s ce") | 497 | ccl-encode-mac-centraleurroman-font "%s ce") |
| 498 | ("mac-cyrillic" mac-cyrillic-encoder | 498 | ("mac-cyrillic" mac-cyrillic-encoder |
| 499 | ccl-encode-mac-cyrillic-font "%s cy"))) | 499 | ccl-encode-mac-cyrillic-font "%s cy"))) |
| 500 | 500 | ||
| @@ -515,15 +515,15 @@ Switch to a buffer editing the last file dropped." | |||
| 515 | (if mac-encoded | 515 | (if mac-encoded |
| 516 | (aset table c mac-encoded)))))))) | 516 | (aset table c mac-encoded)))))))) |
| 517 | 517 | ||
| 518 | (define-ccl-program ccl-encode-mac-centraleuropean-font | 518 | (define-ccl-program ccl-encode-mac-centraleurroman-font |
| 519 | `(0 | 519 | `(0 |
| 520 | (if (r0 != ,(charset-id 'ascii)) | 520 | (if (r0 != ,(charset-id 'ascii)) |
| 521 | (if (r0 <= ?\x8f) | 521 | (if (r0 <= ?\x8f) |
| 522 | (translate-character mac-centraleuropean-encoder r0 r1) | 522 | (translate-character mac-centraleurroman-encoder r0 r1) |
| 523 | ((r1 <<= 7) | 523 | ((r1 <<= 7) |
| 524 | (r1 |= r2) | 524 | (r1 |= r2) |
| 525 | (translate-character mac-centraleuropean-encoder r0 r1))))) | 525 | (translate-character mac-centraleurroman-encoder r0 r1))))) |
| 526 | "CCL program for Mac Central European font") | 526 | "CCL program for Mac Central European Roman font") |
| 527 | 527 | ||
| 528 | (define-ccl-program ccl-encode-mac-cyrillic-font | 528 | (define-ccl-program ccl-encode-mac-cyrillic-font |
| 529 | `(0 | 529 | `(0 |
diff --git a/src/ChangeLog b/src/ChangeLog index 63f0fe42a37..1d4c964a45c 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,10 @@ | |||
| 1 | 2004-12-18 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> | ||
| 2 | |||
| 3 | * macterm.c (endif, x_font_name_to_mac_font_name): Use | ||
| 4 | maccentraleurroman instead of maccentraleuropean | ||
| 5 | (mac_c_string_match, mac_do_list_fonts): Speed up font search by | ||
| 6 | quickly finding a specific font without needing regexps. | ||
| 7 | |||
| 1 | 2004-12-15 Jan Dj,Ad(Brv <jan.h.d@swipnet.se> | 8 | 2004-12-15 Jan Dj,Ad(Brv <jan.h.d@swipnet.se> |
| 2 | 9 | ||
| 3 | * syssignal.h: Declare main_thread. | 10 | * syssignal.h: Declare main_thread. |
diff --git a/src/macterm.c b/src/macterm.c index 4e3b0ae1b65..ca15d3c4965 100644 --- a/src/macterm.c +++ b/src/macterm.c | |||
| @@ -5976,7 +5976,7 @@ mac_to_x_fontname (name, size, style, scriptcode, encoding_base) | |||
| 5976 | strcpy(cs, "mac-cyrillic"); | 5976 | strcpy(cs, "mac-cyrillic"); |
| 5977 | break; | 5977 | break; |
| 5978 | case kTextEncodingMacCentralEurRoman: | 5978 | case kTextEncodingMacCentralEurRoman: |
| 5979 | strcpy(cs, "mac-centraleuropean"); | 5979 | strcpy(cs, "mac-centraleurroman"); |
| 5980 | break; | 5980 | break; |
| 5981 | case kTextEncodingMacSymbol: | 5981 | case kTextEncodingMacSymbol: |
| 5982 | case kTextEncodingMacDingbats: | 5982 | case kTextEncodingMacDingbats: |
| @@ -6034,7 +6034,7 @@ x_font_name_to_mac_font_name (char *xf, char *mf) | |||
| 6034 | coding_system = Qeuc_kr; | 6034 | coding_system = Qeuc_kr; |
| 6035 | else if (strcmp (cs, "mac-roman") == 0 | 6035 | else if (strcmp (cs, "mac-roman") == 0 |
| 6036 | || strcmp (cs, "mac-cyrillic") == 0 | 6036 | || strcmp (cs, "mac-cyrillic") == 0 |
| 6037 | || strcmp (cs, "mac-centraleuropean") == 0 | 6037 | || strcmp (cs, "mac-centraleurroman") == 0 |
| 6038 | || strcmp (cs, "adobe-fontspecific") == 0) | 6038 | || strcmp (cs, "adobe-fontspecific") == 0) |
| 6039 | strcpy (mf, family); | 6039 | strcpy (mf, family); |
| 6040 | else | 6040 | else |
| @@ -6276,6 +6276,28 @@ static int xlfd_scalable_fields[] = | |||
| 6276 | }; | 6276 | }; |
| 6277 | 6277 | ||
| 6278 | static Lisp_Object | 6278 | static Lisp_Object |
| 6279 | mac_c_string_match (regexp, string, nonspecial, exact) | ||
| 6280 | Lisp_Object regexp; | ||
| 6281 | const char *string, *nonspecial; | ||
| 6282 | int exact; | ||
| 6283 | { | ||
| 6284 | if (exact) | ||
| 6285 | { | ||
| 6286 | if (strcmp (string, nonspecial) == 0) | ||
| 6287 | return build_string (string); | ||
| 6288 | } | ||
| 6289 | else if (strstr (string, nonspecial)) | ||
| 6290 | { | ||
| 6291 | Lisp_Object str = build_string (string); | ||
| 6292 | |||
| 6293 | if (fast_string_match (regexp, str) >= 0) | ||
| 6294 | return str; | ||
| 6295 | } | ||
| 6296 | |||
| 6297 | return Qnil; | ||
| 6298 | } | ||
| 6299 | |||
| 6300 | static Lisp_Object | ||
| 6279 | mac_do_list_fonts (pattern, maxnames) | 6301 | mac_do_list_fonts (pattern, maxnames) |
| 6280 | char *pattern; | 6302 | char *pattern; |
| 6281 | int maxnames; | 6303 | int maxnames; |
| @@ -6286,6 +6308,8 @@ mac_do_list_fonts (pattern, maxnames) | |||
| 6286 | char scaled[256]; | 6308 | char scaled[256]; |
| 6287 | char *ptr; | 6309 | char *ptr; |
| 6288 | int scl_val[XLFD_SCL_LAST], *field, *val; | 6310 | int scl_val[XLFD_SCL_LAST], *field, *val; |
| 6311 | char *longest_start, *cur_start, *nonspecial; | ||
| 6312 | int longest_len, cur_len, exact; | ||
| 6289 | 6313 | ||
| 6290 | for (i = 0; i < XLFD_SCL_LAST; i++) | 6314 | for (i = 0; i < XLFD_SCL_LAST; i++) |
| 6291 | scl_val[i] = -1; | 6315 | scl_val[i] = -1; |
| @@ -6343,34 +6367,66 @@ mac_do_list_fonts (pattern, maxnames) | |||
| 6343 | ptr = regex; | 6367 | ptr = regex; |
| 6344 | *ptr++ = '^'; | 6368 | *ptr++ = '^'; |
| 6345 | 6369 | ||
| 6346 | /* Turn pattern into a regexp and do a regexp match. */ | 6370 | longest_start = cur_start = ptr; |
| 6371 | longest_len = cur_len = 0; | ||
| 6372 | exact = 1; | ||
| 6373 | |||
| 6374 | /* Turn pattern into a regexp and do a regexp match. Also find the | ||
| 6375 | longest substring containing no special characters. */ | ||
| 6347 | for (; *pattern; pattern++) | 6376 | for (; *pattern; pattern++) |
| 6348 | { | 6377 | { |
| 6349 | if (*pattern == '?') | 6378 | if (*pattern == '?' || *pattern == '*') |
| 6350 | *ptr++ = '.'; | 6379 | { |
| 6351 | else if (*pattern == '*') | 6380 | if (cur_len > longest_len) |
| 6352 | { | 6381 | { |
| 6353 | *ptr++ = '.'; | 6382 | longest_start = cur_start; |
| 6354 | *ptr++ = '*'; | 6383 | longest_len = cur_len; |
| 6355 | } | 6384 | } |
| 6385 | cur_len = 0; | ||
| 6386 | exact = 0; | ||
| 6387 | |||
| 6388 | if (*pattern == '?') | ||
| 6389 | *ptr++ = '.'; | ||
| 6390 | else /* if (*pattern == '*') */ | ||
| 6391 | { | ||
| 6392 | *ptr++ = '.'; | ||
| 6393 | *ptr++ = '*'; | ||
| 6394 | } | ||
| 6395 | } | ||
| 6356 | else | 6396 | else |
| 6357 | *ptr++ = tolower (*pattern); | 6397 | { |
| 6398 | if (cur_len == 0) | ||
| 6399 | cur_start = ptr; | ||
| 6400 | cur_len++; | ||
| 6401 | |||
| 6402 | *ptr++ = tolower (*pattern); | ||
| 6403 | } | ||
| 6358 | } | 6404 | } |
| 6405 | |||
| 6406 | if (cur_len > longest_len) | ||
| 6407 | { | ||
| 6408 | longest_start = cur_start; | ||
| 6409 | longest_len = cur_len; | ||
| 6410 | } | ||
| 6411 | |||
| 6359 | *ptr = '$'; | 6412 | *ptr = '$'; |
| 6360 | *(ptr + 1) = '\0'; | 6413 | *(ptr + 1) = '\0'; |
| 6361 | 6414 | ||
| 6415 | nonspecial = xmalloc (longest_len + 1); | ||
| 6416 | strncpy (nonspecial, longest_start, longest_len); | ||
| 6417 | nonspecial[longest_len] = '\0'; | ||
| 6418 | |||
| 6362 | pattern_regex = build_string (regex); | 6419 | pattern_regex = build_string (regex); |
| 6363 | 6420 | ||
| 6364 | for (i = 0; i < font_name_count; i++) | 6421 | for (i = 0; i < font_name_count; i++) |
| 6365 | { | 6422 | { |
| 6366 | fontname = build_string (font_name_table[i]); | 6423 | fontname = mac_c_string_match (pattern_regex, font_name_table[i], |
| 6367 | if (fast_string_match (pattern_regex, fontname) >= 0) | 6424 | nonspecial, exact); |
| 6425 | if (!NILP (fontname)) | ||
| 6368 | { | 6426 | { |
| 6369 | font_list = Fcons (fontname, font_list); | 6427 | font_list = Fcons (fontname, font_list); |
| 6370 | 6428 | if (exact || maxnames > 0 && ++n_fonts >= maxnames) | |
| 6371 | n_fonts++; | 6429 | return font_list; |
| 6372 | if (maxnames > 0 && n_fonts >= maxnames) | ||
| 6373 | break; | ||
| 6374 | } | 6430 | } |
| 6375 | else if (scl_val[XLFD_SCL_PIXEL_SIZE] > 0 | 6431 | else if (scl_val[XLFD_SCL_PIXEL_SIZE] > 0 |
| 6376 | && (ptr = strstr (font_name_table[i], "-0-0-75-75-m-0-"))) | 6432 | && (ptr = strstr (font_name_table[i], "-0-0-75-75-m-0-"))) |
| @@ -6384,17 +6440,19 @@ mac_do_list_fonts (pattern, maxnames) | |||
| 6384 | scl_val[XLFD_SCL_POINT_SIZE], | 6440 | scl_val[XLFD_SCL_POINT_SIZE], |
| 6385 | scl_val[XLFD_SCL_AVGWIDTH], | 6441 | scl_val[XLFD_SCL_AVGWIDTH], |
| 6386 | ptr + sizeof ("-0-0-75-75-m-0-") - 1); | 6442 | ptr + sizeof ("-0-0-75-75-m-0-") - 1); |
| 6387 | fontname = build_string (scaled); | 6443 | fontname = mac_c_string_match (pattern_regex, scaled, |
| 6388 | if (fast_string_match (pattern_regex, fontname) >= 0) | 6444 | nonspecial, exact); |
| 6445 | if (!NILP (fontname)) | ||
| 6389 | { | 6446 | { |
| 6390 | font_list = Fcons (fontname, font_list); | 6447 | font_list = Fcons (fontname, font_list); |
| 6391 | 6448 | if (exact || maxnames > 0 && ++n_fonts >= maxnames) | |
| 6392 | n_fonts++; | 6449 | return font_list; |
| 6393 | if (maxnames > 0 && n_fonts >= maxnames) | ||
| 6394 | break; | ||
| 6395 | } | 6450 | } |
| 6396 | } | 6451 | } |
| 6397 | } | 6452 | } |
| 6453 | |||
| 6454 | xfree (nonspecial); | ||
| 6455 | |||
| 6398 | return font_list; | 6456 | return font_list; |
| 6399 | } | 6457 | } |
| 6400 | 6458 | ||