all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Changing the default font on the fly
       [not found] <mailman.169.1340467234.20353.help-gnu-emacs@gnu.org>
@ 2012-06-23 21:18 ` Eddie
  2012-06-23 21:25   ` Drew Adams
  2012-06-23 23:17   ` Bill White
  0 siblings, 2 replies; 5+ messages in thread
From: Eddie @ 2012-06-23 21:18 UTC (permalink / raw)
  To: help-gnu-emacs

The default font in my Emacs 23.3 (various Linux installations) is
DejaVu Sans Mono Book 11. That's perfect for the calendar and my phone
book, etc. if I want to do some longer writing in a more readable
font, I can use the menu and go Options | Set Default Font | nibble
through the various choices.

But I'd rather not use the menu. I would like to get a hunk of code
that is the functional equivalent to Options | Set Default Font | Droid
Sans Regular 12. 

I don't know how to accomplish this on my own (I'm primarily a writer
and editor, and I've never demonstrated any talent for programming),
nor have I found any examples online that I could modify for my own
uses. 

And from there I would like to assign that hunk of code to a keystroke
series. I've assigned some macros to keystrokes, so I think I can do
that part.

Any suggestions would be gratefully appreciated.



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

* RE: Changing the default font on the fly
  2012-06-23 21:18 ` Changing the default font on the fly Eddie
@ 2012-06-23 21:25   ` Drew Adams
  2012-06-23 22:50     ` Eddie
  2012-06-23 23:17   ` Bill White
  1 sibling, 1 reply; 5+ messages in thread
From: Drew Adams @ 2012-06-23 21:25 UTC (permalink / raw)
  To: 'Eddie', help-gnu-emacs

> I can use the menu and go Options | Set Default Font | nibble
> through the various choices. But I'd rather not use the menu.
> I would like to get a hunk of code that is the functional
> equivalent to Options | Set Default Font | Droid Sans Regular 12. 
> 
> I don't know how to accomplish this on my own (I'm primarily a writer
> and editor, and I've never demonstrated any talent for programming),
> nor have I found any examples online that I could modify for my own
> uses. 
> 
> And from there I would like to assign that hunk of code to a keystroke
> series. I've assigned some macros to keystrokes, so I think I can do
> that part.
> 
> Any suggestions would be gratefully appreciated.

http://emacswiki.org/emacs/SetFonts




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

* Re: Changing the default font on the fly
  2012-06-23 21:25   ` Drew Adams
@ 2012-06-23 22:50     ` Eddie
  2012-06-24  0:11       ` Thien-Thi Nguyen
  0 siblings, 1 reply; 5+ messages in thread
From: Eddie @ 2012-06-23 22:50 UTC (permalink / raw)
  To: help-gnu-emacs

On Sat, 23 Jun 2012 14:25:00 -0700
"Drew Adams" <drew.adams@oracle.com> wrote:

> > I can use the menu and go Options | Set Default Font | nibble
> > through the various choices. But I'd rather not use the menu.
> > I would like to get a hunk of code that is the functional
> > equivalent to Options | Set Default Font | Droid Sans Regular 12. 
> > 
> > I don't know how to accomplish this on my own (I'm primarily a
> > writer and editor, and I've never demonstrated any talent for
> > programming), nor have I found any examples online that I could
> > modify for my own uses. 
> > 
> > And from there I would like to assign that hunk of code to a
> > keystroke series. I've assigned some macros to keystrokes, so I
> > think I can do that part.
> > 
> > Any suggestions would be gratefully appreciated.
> 
> http://emacswiki.org/emacs/SetFonts
> 

Thanks, I did see that page. And I had learned ways to set, say,

(set-frame-font
    "-unknown-Droid Sans
Mono-normal-normal-normal-*-*-*-*-*-m-0-iso10646-1")

as a default by sticking it in my .emacs. But as it turns out, I cannot
figure out how to assign those same 2 lines of text to a keystroke
combination, or to assign, say,

(set-frame-font
    "-unknown-Carmina Md
BT-normal-normal-normal-*-*-*-*-*-*-0-iso10646-1")

to another keystroke combo. I don't know how to turn these lines of text
into either a command or a function or an elisp file or a macro or
something that I can assign to a keystroke, the way I did with this
line that turns typopunct mode on & off.

(global-set-key "\C-x\M-t" 'typopunct-mode)

I think one difference is that "set-frame-font" requires a response,
whereas "typopunct-mode" is either on or off.

Did I mention that I am no programmer? :)

I could go on utilizing the menu to change typefaces, but I'd rather
not if I can avoid it. 



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

* Re: Changing the default font on the fly
  2012-06-23 21:18 ` Changing the default font on the fly Eddie
  2012-06-23 21:25   ` Drew Adams
@ 2012-06-23 23:17   ` Bill White
  1 sibling, 0 replies; 5+ messages in thread
From: Bill White @ 2012-06-23 23:17 UTC (permalink / raw)
  To: help-gnu-emacs

On Sat Jun 23 2012 at 16:18, Eddie <penguinismo@almostconnecticut.net> wrote:

> I would like to get a hunk of code that is the functional equivalent
> to Options | Set Default Font | Droid Sans Regular 12.

I do this:

,----[ ~/.emacs ]
| (set-default-font "-unknown-DejaVu Sans Mono-normal-normal-normal-*-14-*-*-*-m-0-iso10646-1")
`----

To get that long crazy string that describes the font, I tried lots of
fonts via Set Default Font til I found one I liked, then put the cursor
on one of its characters and typed C-u C-x = to get this information
(the string you need is after "xft:" and does not include the mysterious
stuff in parens on that line):

,----
|              position: 853 of 1002 (85%), restriction: <0-144>, column: 1003
|             character: o (displayed as o) (codepoint 111, #o157, #x6f)
|     preferred charset: ascii (ASCII (ISO646 IRV))
| code point in charset: 0x6F
|                syntax: w 	which means: word
|              category: .:Base, L:Left-to-right (strong), a:ASCII, l:Latin, r:Roman
|           buffer code: #x6F
|             file code: #x6F (encoded by coding system utf-8-emacs-unix)
|               display: by this font (glyph code)
|     xft:-unknown-DejaVu Sans Mono-normal-normal-normal-*-14-*-*-*-m-0-iso10646-1 (#x52)
| 
| Character code properties: customize what to show
|   name: LATIN SMALL LETTER O
|   general-category: Ll (Letter, Lowercase)
|   canonical-combining-class: 0 (Spacing, split, enclosing, reordrant, and Tibetan subjoined)
|   bidi-class: L (Left-to-Right)
|   decomposition: (111) ('o')
|   mirrored: N
|   uppercase: 79 (O)
|   titlecase: 79 (O)
| 
| There are text properties here:
|   fontified            t
| 
| [back]
`----

Cheers -

bw
-- 
Bill White . billw@wolfram.com
"No ma'am, we're musicians."




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

* Re: Changing the default font on the fly
  2012-06-23 22:50     ` Eddie
@ 2012-06-24  0:11       ` Thien-Thi Nguyen
  0 siblings, 0 replies; 5+ messages in thread
From: Thien-Thi Nguyen @ 2012-06-24  0:11 UTC (permalink / raw)
  To: Eddie; +Cc: help-gnu-emacs

() Eddie <penguinismo@almostconnecticut.net>
() Sat, 23 Jun 2012 18:50:09 -0400

   (set-frame-font
       "-unknown-Droid Sans
   Mono-normal-normal-normal-*-*-*-*-*-m-0-iso10646-1")

   and

   (set-frame-font
       "-unknown-Carmina Md
   BT-normal-normal-normal-*-*-*-*-*-*-0-iso10646-1")

These are expressions.  You can make them commands (one of which
you already know: ‘typopunct-mode’) by placing a:

 ;; -*- emacs-lisp -*-
 (defun COMMAND-NAME () DOCSTRING (interactive) EXPRESSION)

in ~/.emacs (or rather, two of them).  For example:

 (defun use-droid-font ()
   "Set the frame font to Droid Sans Mono."
   (interactive)
   (set-frame-font "-unknown-Droid Sans Mono-normal-normal-normal-*-*-*-*-*-m-0-iso10646-1"))

 (defun use-carmina-font ()
   "Set the frame font to Carmina Md BT."
   (interactive)
   (set-frame-font "-unknown-Carmina Md BT-normal-normal-normal-*-*-*-*-*-*-0-iso10646-1"))

Lastly, make keybindings to taste and you are done, and can demonstrably
call yourself a programmer.  Welcome, a world of bug creation awaits!



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

end of thread, other threads:[~2012-06-24  0:11 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <mailman.169.1340467234.20353.help-gnu-emacs@gnu.org>
2012-06-23 21:18 ` Changing the default font on the fly Eddie
2012-06-23 21:25   ` Drew Adams
2012-06-23 22:50     ` Eddie
2012-06-24  0:11       ` Thien-Thi Nguyen
2012-06-23 23:17   ` Bill White

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.