diff options
| author | Geoff Voelker | 1998-11-04 23:23:57 +0000 |
|---|---|---|
| committer | Geoff Voelker | 1998-11-04 23:23:57 +0000 |
| commit | 4664455c17f5a67c3a9638add7dfe2182a339717 (patch) | |
| tree | 4c7b70cc67a99d47017ed3f638645831e5f8d92d | |
| parent | 709822e81357375f7184b719e949fbc63cbb5def (diff) | |
| download | emacs-4664455c17f5a67c3a9638add7dfe2182a339717.tar.gz emacs-4664455c17f5a67c3a9638add7dfe2182a339717.zip | |
(x-get-selection-value): Alias to
x-cut-buffer-or-selection-value.
(w32-standard-fontset-spec): New variable.
(w32-create-initial-fontsets, mouse-set-font): Check whether
new-fontset is available.
(w32-use-w32-font-dialog): Enable use of set-variable.
| -rw-r--r-- | lisp/term/w32-win.el | 179 |
1 files changed, 101 insertions, 78 deletions
diff --git a/lisp/term/w32-win.el b/lisp/term/w32-win.el index df0bdf1c40d..2e00d8eb686 100644 --- a/lisp/term/w32-win.el +++ b/lisp/term/w32-win.el | |||
| @@ -579,6 +579,9 @@ This is in addition to the primary selection.") | |||
| 579 | (t | 579 | (t |
| 580 | (setq x-last-selected-text text)))))) | 580 | (setq x-last-selected-text text)))))) |
| 581 | 581 | ||
| 582 | (defalias 'x-cut-buffer-or-selection-value 'x-get-selection-value) | ||
| 583 | |||
| 584 | |||
| 582 | ;;; Do the actual Windows setup here; the above code just defines | 585 | ;;; Do the actual Windows setup here; the above code just defines |
| 583 | ;;; functions and variables that we use now. | 586 | ;;; functions and variables that we use now. |
| 584 | 587 | ||
| @@ -614,6 +617,101 @@ This is in addition to the primary selection.") | |||
| 614 | ;; This has ,? to match both on Sunos and on Solaris. | 617 | ;; This has ,? to match both on Sunos and on Solaris. |
| 615 | (menu-bar-enable-clipboard) | 618 | (menu-bar-enable-clipboard) |
| 616 | 619 | ||
| 620 | ;; W32 systems have different fonts than commonly found on X, so | ||
| 621 | ;; we define our own standard fontset here. | ||
| 622 | (defvar w32-standard-fontset-spec | ||
| 623 | "-*-Courier New-normal-r-*-*-13-*-*-*-c-*-fontset-standard, | ||
| 624 | latin-iso8859-2:-*-Courier New CE-normal-r-*-*-13-*-*-*-c-*-iso8859-2, | ||
| 625 | latin-iso8859-3:-*-Courier New Tur-normal-r-*-*-13-*-*-*-c-*-iso8859-3, | ||
| 626 | latin-iso8859-4:-*-Courier New Baltic-normal-r-*-*-13-*-*-*-c-*-iso8859-4, | ||
| 627 | cyrillic-iso8859-5:-*-Courier New Cyr-normal-r-*-*-13-*-*-*-c-*-iso8859-5, | ||
| 628 | greek-iso8859-7:-*-Courier New Greek-normal-r-*-*-13-*-*-*-c-*-iso8859-7" | ||
| 629 | "String of fontset spec of the standard fontset. This defines a | ||
| 630 | fontset consisting of the Courier New variations for European | ||
| 631 | languages which are distributed with Windows as \"Multilanguage Support\". | ||
| 632 | |||
| 633 | See the documentation of `create-fontset-from-fontset-spec for the format.") | ||
| 634 | |||
| 635 | (if (fboundp 'new-fontset) | ||
| 636 | (progn | ||
| 637 | (defun w32-create-initial-fontsets () | ||
| 638 | "Create fontset-startup, fontset-standard and any fontsets | ||
| 639 | specified in X resources." | ||
| 640 | ;; Create the standard fontset. | ||
| 641 | (create-fontset-from-fontset-spec w32-standard-fontset-spec t) | ||
| 642 | |||
| 643 | ;; Create fontset specified in X resources "Fontset-N" (N is 0, 1,...). | ||
| 644 | (create-fontset-from-x-resource) | ||
| 645 | |||
| 646 | ;; Try to create a fontset from a font specification which comes | ||
| 647 | ;; from initial-frame-alist, default-frame-alist, or X resource. | ||
| 648 | ;; A font specification in command line argument (i.e. -fn XXXX) | ||
| 649 | ;; should be already in default-frame-alist as a `font' | ||
| 650 | ;; parameter. However, any font specifications in site-start | ||
| 651 | ;; library, user's init file (.emacs), and default.el are not | ||
| 652 | ;; yet handled here. | ||
| 653 | |||
| 654 | (let ((font (or (cdr (assq 'font initial-frame-alist)) | ||
| 655 | (cdr (assq 'font default-frame-alist)) | ||
| 656 | (x-get-resource "font" "Font"))) | ||
| 657 | xlfd-fields resolved-name) | ||
| 658 | (if (and font | ||
| 659 | (not (query-fontset font)) | ||
| 660 | (setq resolved-name (x-resolve-font-name font)) | ||
| 661 | (setq xlfd-fields (x-decompose-font-name font))) | ||
| 662 | (if (string= "fontset" | ||
| 663 | (aref xlfd-fields xlfd-regexp-registry-subnum)) | ||
| 664 | (new-fontset font | ||
| 665 | (x-complement-fontset-spec xlfd-fields nil)) | ||
| 666 | ;; Create a fontset from FONT. The fontset name is | ||
| 667 | ;; generated from FONT. Create style variants of the | ||
| 668 | ;; fontset too. Font names in the variants are | ||
| 669 | ;; generated automatially unless X resources | ||
| 670 | ;; XXX.attribyteFont explicitly specify them. | ||
| 671 | (let ((styles (mapcar 'car x-style-funcs-alist)) | ||
| 672 | (faces '(bold italic bold-italic)) | ||
| 673 | face face-font fontset fontset-spec) | ||
| 674 | (while faces | ||
| 675 | (setq face (car faces)) | ||
| 676 | (setq face-font (x-get-resource (concat (symbol-name face) | ||
| 677 | ".attributeFont") | ||
| 678 | "Face.AttributeFont")) | ||
| 679 | (if face-font | ||
| 680 | (setq styles (cons (cons face face-font) | ||
| 681 | (delq face styles)))) | ||
| 682 | (setq faces (cdr faces))) | ||
| 683 | (aset xlfd-fields xlfd-regexp-foundry-subnum nil) | ||
| 684 | (aset xlfd-fields xlfd-regexp-family-subnum nil) | ||
| 685 | (aset xlfd-fields xlfd-regexp-registry-subnum "fontset") | ||
| 686 | (aset xlfd-fields xlfd-regexp-encoding-subnum "startup") | ||
| 687 | ;; The fontset name should have concrete values in | ||
| 688 | ;; weight and slant field. | ||
| 689 | (let ((weight (aref xlfd-fields xlfd-regexp-weight-subnum)) | ||
| 690 | (slant (aref xlfd-fields xlfd-regexp-slant-subnum)) | ||
| 691 | xlfd-temp) | ||
| 692 | (if (or (not weight) (string-match "[*?]*" weight)) | ||
| 693 | (progn | ||
| 694 | (setq xlfd-temp | ||
| 695 | (x-decompose-font-name resolved-name)) | ||
| 696 | (aset xlfd-fields xlfd-regexp-weight-subnum | ||
| 697 | (aref xlfd-temp xlfd-regexp-weight-subnum)))) | ||
| 698 | (if (or (not slant) (string-match "[*?]*" slant)) | ||
| 699 | (progn | ||
| 700 | (or xlfd-temp | ||
| 701 | (setq xlfd-temp | ||
| 702 | (x-decompose-font-name resolved-name))) | ||
| 703 | (aset xlfd-fields xlfd-regexp-slant-subnum | ||
| 704 | (aref xlfd-temp xlfd-regexp-slant-subnum))))) | ||
| 705 | (setq fontset (x-compose-font-name xlfd-fields)) | ||
| 706 | (create-fontset-from-fontset-spec | ||
| 707 | (concat fontset ", ascii:" font) styles) | ||
| 708 | ))))) | ||
| 709 | ;; This cannot be run yet, as creating fontsets requires a | ||
| 710 | ;; Window to be initialised so the fonts can be listed. | ||
| 711 | ;; Add it to a hook so it gets run later. | ||
| 712 | (add-hook 'before-init-hook 'w32-create-initial-fontsets) | ||
| 713 | )) | ||
| 714 | |||
| 617 | ;; Apply a geometry resource to the initial frame. Put it at the end | 715 | ;; Apply a geometry resource to the initial frame. Put it at the end |
| 618 | ;; of the alist, so that anything specified on the command line takes | 716 | ;; of the alist, so that anything specified on the command line takes |
| 619 | ;; precedence. | 717 | ;; precedence. |
| @@ -702,7 +800,7 @@ This is in addition to the primary selection.") | |||
| 702 | 800 | ||
| 703 | ;; Redefine the font selection to use the standard W32 dialog | 801 | ;; Redefine the font selection to use the standard W32 dialog |
| 704 | (defvar w32-use-w32-font-dialog t | 802 | (defvar w32-use-w32-font-dialog t |
| 705 | "Use the standard font dialog if 't' - otherwise pop up a menu of | 803 | "*Use the standard font dialog if 't' - otherwise pop up a menu of |
| 706 | some standard fonts like X does - including fontsets") | 804 | some standard fonts like X does - including fontsets") |
| 707 | 805 | ||
| 708 | (defvar w32-fixed-font-alist | 806 | (defvar w32-fixed-font-alist |
| @@ -790,7 +888,8 @@ Courier. These fonts are used in the font menu if the variable | |||
| 790 | (x-popup-menu | 888 | (x-popup-menu |
| 791 | last-nonmenu-event | 889 | last-nonmenu-event |
| 792 | ;; Append list of fontsets currently defined. | 890 | ;; Append list of fontsets currently defined. |
| 793 | (append w32-fixed-font-alist (list (generate-fontset-menu)))))) | 891 | (if (fboundp 'new-fontset) |
| 892 | (append w32-fixed-font-alist (list (generate-fontset-menu))))))) | ||
| 794 | (if fonts | 893 | (if fonts |
| 795 | (let (font) | 894 | (let (font) |
| 796 | (while fonts | 895 | (while fonts |
| @@ -805,79 +904,3 @@ Courier. These fonts are used in the font menu if the variable | |||
| 805 | (error "Font not found"))))) | 904 | (error "Font not found"))))) |
| 806 | 905 | ||
| 807 | ;;; w32-win.el ends here | 906 | ;;; w32-win.el ends here |
| 808 | ;;; The code in w32-init-fontsets requires a w32 frame to have been created, | ||
| 809 | ;;; which is not the case when this file is loaded during startup. | ||
| 810 | (add-hook 'before-init-hook 'w32-init-fontsets) | ||
| 811 | |||
| 812 | (defun w32-init-fontsets () | ||
| 813 | "Initialize standard fontsets for w32." | ||
| 814 | (if (fboundp 'new-fontset) | ||
| 815 | (progn | ||
| 816 | ;; Create the standard fontset. | ||
| 817 | (create-fontset-from-fontset-spec standard-fontset-spec t) | ||
| 818 | |||
| 819 | ;; Create fontset specified in X resources "Fontset-N" (N is 0, 1, ...). | ||
| 820 | (create-fontset-from-x-resource) | ||
| 821 | |||
| 822 | ;; Try to create a fontset from a font specification which comes | ||
| 823 | ;; from initial-frame-alist, default-frame-alist, or X resource. | ||
| 824 | ;; A font specification in command line argument (i.e. -fn XXXX) | ||
| 825 | ;; should be already in default-frame-alist as a `font' | ||
| 826 | ;; parameter. However, any font specifications in site-start | ||
| 827 | ;; library, user's init file (.emacs), and default.el are not | ||
| 828 | ;; yet handled here. | ||
| 829 | |||
| 830 | (let ((font (or (cdr (assq 'font initial-frame-alist)) | ||
| 831 | (cdr (assq 'font default-frame-alist)) | ||
| 832 | (x-get-resource "font" "Font"))) | ||
| 833 | xlfd-fields resolved-name) | ||
| 834 | (if (and font | ||
| 835 | (not (query-fontset font)) | ||
| 836 | (setq resolved-name (x-resolve-font-name font)) | ||
| 837 | (setq xlfd-fields (x-decompose-font-name font))) | ||
| 838 | (if (string= "fontset" | ||
| 839 | (aref xlfd-fields xlfd-regexp-registry-subnum)) | ||
| 840 | (new-fontset font (x-complement-fontset-spec xlfd-fields nil)) | ||
| 841 | ;; Create a fontset from FONT. The fontset name is | ||
| 842 | ;; generated from FONT. Create style variants of the | ||
| 843 | ;; fontset too. Font names in the variants are | ||
| 844 | ;; generated automatially unless X resources | ||
| 845 | ;; XXX.attribyteFont explicitly specify them. | ||
| 846 | (let ((styles (mapcar 'car x-style-funcs-alist)) | ||
| 847 | (faces '(bold italic bold-italic)) | ||
| 848 | face face-font fontset fontset-spec) | ||
| 849 | (while faces | ||
| 850 | (setq face (car faces)) | ||
| 851 | (setq face-font (x-get-resource (concat (symbol-name face) | ||
| 852 | ".attributeFont") | ||
| 853 | "Face.AttributeFont")) | ||
| 854 | (if face-font | ||
| 855 | (setq styles (cons (cons face face-font) | ||
| 856 | (delq face styles)))) | ||
| 857 | (setq faces (cdr faces))) | ||
| 858 | (aset xlfd-fields xlfd-regexp-foundry-subnum nil) | ||
| 859 | (aset xlfd-fields xlfd-regexp-family-subnum nil) | ||
| 860 | (aset xlfd-fields xlfd-regexp-registry-subnum "fontset") | ||
| 861 | (aset xlfd-fields xlfd-regexp-encoding-subnum "startup") | ||
| 862 | ;; The fontset name should have concrete values in | ||
| 863 | ;; weight and slant field. | ||
| 864 | (let ((weight (aref xlfd-fields xlfd-regexp-weight-subnum)) | ||
| 865 | (slant (aref xlfd-fields xlfd-regexp-slant-subnum)) | ||
| 866 | xlfd-temp) | ||
| 867 | (if (or (not weight) (string-match "[*?]*" weight)) | ||
| 868 | (progn | ||
| 869 | (setq xlfd-temp (x-decompose-font-name resolved-name)) | ||
| 870 | (aset xlfd-fields xlfd-regexp-weight-subnum | ||
| 871 | (aref xlfd-temp xlfd-regexp-weight-subnum)))) | ||
| 872 | (if (or (not slant) (string-match "[*?]*" slant)) | ||
| 873 | (progn | ||
| 874 | (or xlfd-temp | ||
| 875 | (setq xlfd-temp | ||
| 876 | (x-decompose-font-name resolved-name))) | ||
| 877 | (aset xlfd-fields xlfd-regexp-slant-subnum | ||
| 878 | (aref xlfd-temp xlfd-regexp-slant-subnum))))) | ||
| 879 | (setq fontset (x-compose-font-name xlfd-fields)) | ||
| 880 | (create-fontset-from-fontset-spec | ||
| 881 | (concat fontset ", ascii:" font) styles) | ||
| 882 | ))))))) | ||
| 883 | |||