unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* emacs with truetype fonts
@ 2004-11-08 15:50 Jan Ulrich Hasecke
  2004-11-08 16:36 ` Juhapekka Tolvanen
  0 siblings, 1 reply; 4+ messages in thread
From: Jan Ulrich Hasecke @ 2004-11-08 15:50 UTC (permalink / raw)


Hi,

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

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

TIA
juh

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: emacs with truetype fonts
  2004-11-08 15:50 emacs with truetype fonts Jan Ulrich Hasecke
@ 2004-11-08 16:36 ` Juhapekka Tolvanen
  2004-11-09  8:25   ` Jan Ulrich Hasecke
  0 siblings, 1 reply; 4+ messages in thread
From: Juhapekka Tolvanen @ 2004-11-08 16:36 UTC (permalink / raw)




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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: emacs with truetype fonts
  2004-11-08 16:36 ` Juhapekka Tolvanen
@ 2004-11-09  8:25   ` Jan Ulrich Hasecke
  2004-11-09 10:18     ` Daniel Pittman
  0 siblings, 1 reply; 4+ messages in thread
From: Jan Ulrich Hasecke @ 2004-11-09  8:25 UTC (permalink / raw)


Hi Juhpekka!

Wonderful howto! Thank you very much. 

I tried it out with several fonts but they all look less good than in gvim.
Maybe there is no antialias support in my emacs. 

You're right lmodern are Type 1 fonts.

juh

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: emacs with truetype fonts
  2004-11-09  8:25   ` Jan Ulrich Hasecke
@ 2004-11-09 10:18     ` Daniel Pittman
  0 siblings, 0 replies; 4+ messages in thread
From: Daniel Pittman @ 2004-11-09 10:18 UTC (permalink / raw)


On 9 Nov 2004, Jan Ulrich Hasecke wrote:
> I tried it out with several fonts but they all look less good than in gvim.
> Maybe there is no antialias support in my emacs. 

'gvim', as I recall, uses the GTK text widgets.  These, under the hood,
use xft for anti-aliased text rendering these days, for both TTF and
Type1 fonts.

Emacs, since it uses a display engine of its own, does not support the
same font location technology, and does not support anti-aliased text.

All it needs is for someone to write the code to implement that, though.

    Daniel

-- 
<@jwz> The human genome is about 3 gigabases long, which boils down to 
750 megabytes. Depressingly enough, this is only 2.8 Mozilla browsers.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2004-11-09 10:18 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-11-08 15:50 emacs with truetype fonts Jan Ulrich Hasecke
2004-11-08 16:36 ` Juhapekka Tolvanen
2004-11-09  8:25   ` Jan Ulrich Hasecke
2004-11-09 10:18     ` Daniel Pittman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).