help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: emacs with truetype fonts


From: Juhapekka Tolvanen
Subject: Re: emacs with truetype fonts
Date: Mon, 08 Nov 2004 18:36:04 +0200
User-agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (gnu/linux)


Jan Ulrich Hasecke <janulrich.hasecke@web.de> writes:

> I can use gvim with truetype fonts on my debian notebook. Very nice is
> LMTypewriter from the tex lmodern fonts.

I think those lmodern-fonts you see in your gvim are not True Type
-fonts at all. They are Type 1 -fonts.

> Can I use these fonts in emacs too? It looks nicer than courier.

Just use a program called xfontsel and try to find a good font. Don't
define charset. Then click "Select". Now that font-definition is in
buffer of your mouse. Paste that fontdefinition to your ~/.Xresources
-file with middle-button of your mouse. If your mouse has just two
buttons, you can emulate middle-button by pressing both puttons
simultaneously.

Create also these symbolic links:

ln -s ~/.Xresources ~/.Xdefaults
ln -s ~/.Xresources ~/.xresources

After each update of .Xresources run this command to enable those
settings immediately:

xrdb -merge $HOME/.Xresources

Then you need to restart your emacs. Here are my emacs-related
X-resources:

----- Clip here -----
! {{{ emacsen

! Somehow these X-resources do not have efect for first window in my GNU Emacs.
emacs.font: -*-bitstream vera sans mono-medium-r-normal-*-*-100-100-100-m-*-*-*
Emacs.pane.menubar.font: -*-bitstream vera 
sans-medium-r-normal-*-*-100-100-100-*-*-*-*
Emacs*menubar*Font: -*-bitstream vera sans-medium-r-*-*-*-100-100-100-*-*-*-*
Emacs*popup*Font:  -*-bitstream vera sans-medium-r-*-*-*-100-100-100-*-*-*-*

!Emacs*Background:              MidnightBlue
!Emacs*Foreground:              LightSalmon

Emacs*popup*background: gray60
Emacs*popup*foreground: black

emacs*bitmapIcon: on
Emacs*toolBar: 0

!emacs.geometry: 80x25
!Emacs.geometry: 110x55
!Emacs.geometry: 110x55+0+0
Emacs.geometry: 143x53+0+0

! GNU Emacs 21 (these font-settings don't work)
Emacs.Paned.XlwMenu.font: -*-bitstream vera 
sans-medium-r-normal-*-*-100-100-100-*-*-*-*
Emacs.Paned.EmacsFrame.font: -*-bitstream vera sans 
mono-medium-r-normal-*-*-100-100-100-m-*-*-*
Emacs.Paned.XlwMenu.background: gray60
Emacs.Paned.XlwMenu.foreground: black

Emacs.Paned.EmacsFrame.background: MidnightBlue
Emacs.Paned.EmacsFrame.foreground: LightSalmon

Emacs.pane.menubar.horizontalSpacing:   4 
Emacs.pane.menubar.verticalSpacing:     2
Emacs.pane.menubar.Margin: 0

! XEmacs
Emacs.TopLevelEmacsShell.EmacsManager.XlwMenu.font: -*-bitstream vera 
sans-medium-r-normal-*-*-100-100-100-*-*-*-*
Emacs.TopLevelEmacsShell.EmacsManager.EmacsFrame.font: -*-bitstream vera sans 
mono-medium-r-normal-*-*-100-100-100-m-*-*-*
Emacs.TopLevelEmacsShell.EmacsManager.XlwMenu.foreground: black
Emacs.TopLevelEmacsShell.EmacsManager.XlwMenu.background: gray60

Emacs*Xlw''''''Menu*fontSet: -*-bitstream vera 
sans-medium-r-normal-*-*-100-100-100-*-*-*-*
Emacs*Xlw''''''Menu*background: gray60
Emacs*Xlw''''''Menu*foreground: black
Emacs*Xlw''''''Menu*shadowThickness: 1
Emacs.TopLevelEmacsShell.EmacsManager.XlwScrollBar.background: gray60

! }}}
----- Clip here -----

Lines that start with "!" are comments, of course. If setting X-resources
don't work, edit your ~/.emacs and then restart your emacs. Here are my
font-related settings from my ~/.emacs:

----- Clip here -----
;;{{{ Fix for handling of X-resources

;; 
http://www.emacswiki.org/cgi-bin/wiki/ProblemSettingCertainFaceAttributesFromXResources
;;
;; Loading this patch will make face-attributes inherit, underline,
;; overline and strike-through properly be set up from X11 resources.
;; Values `t', `nil' and facenames must be quoted.
;;
;; code by fledermaus

(defun set-face-attribute-from-resource (face attribute resource class frame)
  "Set FACE's ATTRIBUTE from X resource RESOURCE, class CLASS on FRAME.
  Value is the attribute value specified by the resource, or nil
  if not present.  This function displays a message if the resource
  specifies an invalid attribute."
  (let* ((face-name (face-name face))
         (value (internal-face-x-get-resource (concat face-name resource)
                                              class frame)))
    (when value
      (if (and (string-match "^'" value)
               (or (eq attribute :inherit       )
                   (eq attribute :underline     )
                   (eq attribute :overline      )
                   (eq attribute :strike-through)))
        (progn
          (setq value (intern (substring value 1)))
          (condition-case ()
                          (internal-set-lisp-face-attribute
                            face attribute value frame)
                          (error
                            (message "Face %s, frame %s: attribute %s %S from 
XRDB"
                                     face-name frame attribute value))))
        (setq value (downcase value))
        (condition-case ()
                        (internal-set-lisp-face-attribute-from-resource
                          face attribute value frame)
                        (error
                          (message "Face %s, frame %s: bad attribute %s %s from 
X resource"
                                   face-name frame attribute value)))))
    value))

;;}}}

;;{{{ Fonts and colors

(global-font-lock-mode t)
(show-paren-mode t)

;;(setq font-lock-maximum-decoration t
;;        font-lock-maximum-size nil)
;;(setq font-lock-support-mode 'fast-lock-mode ; lazy-lock-mode
;;        fast-lock-cache-directories '("~/.emacs-flc"))

(setq fast-lock-cache-directories '("~/.emacs-flc"))

;; do lazy locking, it's quicker
;;(setq font-lock-support-mode 'lazy-lock-mode)
;; more font-locking, variables for `lazy-lock-mode'
;; wait 10 secs before font-locking stuff
;;(setq lazy-lock-defer-time 10
;; don't font lock as I type
;;lazy-lock-defer-on-the-fly t
;; If I'm not doing stuff, start fontifying
;; the rest of the buffer
;;lazy-lock-stealth-time 30)

;; emacs 21 has jit-lock which is better
(setq font-lock-support-mode 'jit-lock-mode)
(setq jit-lock-stealth-time 16
      jit-lock-defer-contextually t
      jit-lock-stealth-nice 0.5)
(setq-default font-lock-multiline t)

;;}}}
----- Clip here -----

Lines that start with ";" are comments, of course. Before those setting
my ~/.emacs reads file ~/.emacsen-elisp/common.el . It is for those
settings that work under both emacsen, both GNU emacs and XEmacs. Here
are its font-related settings:

----- Clip here -----
;;{{{ Fonts and colors

;; Somehow X-resources do not have effect for first window in my GNU Emacs.

(setq initial-frame-alist
      '(
                (top . 0) (left . 0)
                ;; (width . 80) (height . 72)
                ;; (width . 110) (height . 55
                (width . 143) (height . 53)
                ;; (font . "-*-fixed-medium-r-normal-*-14-*-*-*-*-*-*")
                (font . "-*-bitstream vera sans 
mono-medium-r-normal-*-*-100-100-100-m-*-*-*")
                (set-face-font 'default "-*-bitstream vera sans 
mono-medium-r-normal-*-*-100-100-100-m-*-*-*")
                (set-face-font 'menu "-*-bitstream vera 
sans-medium-r-normal-*-*-100-100-100-*-*-*-*")
                )
      )

(setq default-frame-alist
      '(
                (top . 0) (left . 0)
                ;;(width . 80) (height . 62)
                ;;(width . 110) (height . 55)
                (width . 143) (height . 53)
                ;; (cursor-color . "white")
                (cursor-type . box)
                ;; (foreground-color . "green")
                ;; (background-color . "black")
                ;;(font . "-*-fixed-medium-r-normal-*-14-*-*-*-*-*-*")
                ;;(font . "-*-bitstream vera sans 
mono-medium-r-normal-*-*-100-100-100-m-*-*-*")
                (font . "-*-bitstream vera sans 
mono-medium-r-normal-*-*-100-100-100-m-*-*-*")
                (set-face-font 'default "-*-bitstream vera sans 
mono-medium-r-normal-*-*-100-100-100-m-*-*-*")
                (set-face-font 'menu "-*-bitstream vera 
sans-medium-r-normal-*-*-100-100-100-*-*-*-*")
                )
      )

;;; Syntax highlight for everywhere

(require 'font-lock)

(turn-on-font-lock)
(setq font-lock-maximum-decoration t)

(require 'ctypes)
(ctypes-auto-parse-mode 1)

(require 'gnus-cite)

(add-to-list 'default-frame-alist '(foreground-color . "LightSalmon"))
(add-to-list 'default-frame-alist '(background-color . "MidnightBlue"))
(add-to-list 'default-frame-alist '(cursor-color . "Gold"))

(add-to-list 'initial-frame-alist '(foreground-color . "LightSalmon"))
(add-to-list 'initial-frame-alist '(background-color . "MidnightBlue"))
(add-to-list 'initial-frame-alist '(cursor-color . "Gold"))

;;}}}
----- Clip here -----


-- 
Juhapekka "naula" Tolvanen * * http colon slash slash iki dot fi slash juhtolv
"kummaan paikkaan itsesi karkotit, syyttä syyllisten seuduille. raskaisiin
taloihin pesit, kirkuviin huoneisiin. mitä ne sinulle tekevät siellä? kuka on
raapinut nimesi pois, nimesi, kasvosi, mielesi oivat palvelemaan konetta?" CMX


reply via email to

[Prev in Thread] Current Thread [Next in Thread]