From: Xah Lee <xahlee@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: getting unicode chars to show on Windows
Date: Sat, 29 Aug 2009 09:22:54 -0700 (PDT) [thread overview]
Message-ID: <a67d283b-5590-4f9d-99b4-52864bdae490@u16g2000pru.googlegroups.com> (raw)
In-Reply-To: mailman.5608.1251505221.2239.help-gnu-emacs@gnu.org
On Aug 28, 5:20 pm, "Drew Adams" <drew.ad...@oracle.com> wrote:
> > How do i set a font for the current frame?
>
> M-x icicle-font S-TAB
>
> Choose any available font, using completion. Use `M-SPC', if you want to match
> different font parts separately (taking the intersection).
>
> > What i want is a toggle-font code so that i can press a key and have
> > the font set to either a monospaced or variable-spaced one, and just
> > for the current frame. More specifically: what's the elisp function
> > that makes the current frame use Courier New? (i'll also need to
> > know the full string or whatever that emacs uses for what Windows
> > calls the Courier New font.)
>
> (set-frame-parameter nil 'font "-*-Courier
> New-normal-r-*-*-14-112-96-96-c-*-iso8859-1")
>
> or whatever font you want.
>
> M-: (frame-parameters) is your friend.
Thanks Drew & Florian.
Spent another 1 hour on this, didn't want to go further at this moment
but wanted to report some findings and reply.
finally was able to get something useful:
(defun cycle-font ()
"Change font in current frame, cycling thru a predefined set of
fonts."
(interactive)
(if (not (eq last-command this-command))
(progn
(set-frame-parameter nil 'font "-*-Courier New-normal-r-*-
*-14-112-96-96-c-*-iso8859-1")
(put this-command 'state "2"))
(cond
((string= (get this-command 'state) "1")
(set-frame-parameter nil 'font "-*-Courier New-normal-r-*-
*-13-112-96-96-c-*-iso8859-1") (put this-command 'state "2"))
((string= (get this-command 'state) "2" )
(set-frame-parameter nil 'font "-outline-Lucida Sans Unicode-
normal-normal-normal-sans-13-*-*-*-p-*-iso8859-1") (put this-command
'state "3"))
((string= (get this-command 'state) "3")
(set-frame-parameter nil 'font "-outline-Code2000-normal-normal-
normal-*-13-*-*-*-p-*-iso8859-1") (put this-command 'state "1"))
)
)
)
(global-set-key (kbd "<C-f9>") 'cycle-font)
This is for Windows Vista machine. Press a button it'll cycle among 3
fonts. Mostly for the purpose of switching between mono-width courier
and variable-width lucida.
The Code2000 is there just for the occation of viewing some unicode.
Code2000 is so bad that it renders ascii dash/hyphen as invisible if
the font size is not huge.
Code2000 is not part of Windows Vista. You have to downloaded it, i
wouldn't recommend it, just that i happened to already did and that
seems to be the font containing the most unicode
the elisp dealing is also painful, or, much less than ideal. Here's a
outline of my problem.
So, Drew showed me this
(set-frame-parameter nil 'font "-*-Courier New-normal-r-*-
*-14-112-96-96-c-*-iso8859-1")
which is great. So, i wanted Lucida. So, logically, i replaced the
courier name to lucida like this:
(set-frame-parameter nil 'font "-*-Lucida Sans Unicode-normal-r-*-
*-14-112-96-96-c-*-iso8859-1")
but emacs spits out error. I didn't know what those 112, 96, 96 are,
so i figured i replace them with asterisk. Tried a few variations, no
go. After a while, i found this works:
(set-frame-parameter nil 'font "Lucida Sans Unicode")
(set-frame-parameter nil 'font "courier new")
(set-frame-parameter nil 'font "Fixedsys")
(set-frame-parameter nil 'font "FixedsysTTF")
but i do need to set size because the size spec is not equivalent
among fonts. e.g. One font at size 14 will be too large/small for
another font at 14.
So i need something like.:
(set-frame-parameter nil 'font "Lucida Sans Unicode" 'size 12)
after looking up some inline doc or elisp doc in few min, i can't find
out what's the available parms for set-frame-parameter. But i did find
this function:
(frame-parameters)
which gives out all the params/value pairs in a frame. So, after a
while finding no easier way, i went thru the rather tedious process of
using the menu to set a font, then run the frame-parameters and get
the value of the font. So, i get the right font string spec for the
fonts i want. e.g.
"-*-Courier New-normal-r-*-*-13-112-96-96-c-*-iso8859-1"
"-outline-Lucida Sans Unicode-normal-normal-normal-sans-13-*-*-*-p-*-
iso8859-1"
"-outline-Code2000-normal-normal-normal-*-15-*-*-*-p-*-iso8859-1"
"-raster-Fixedsys-normal-normal-normal-mono-15-*-*-*-c-*-iso8859-1"
"-outline-FixedsysTTF-semi-bold-normal-normal-mono-16-*-*-*-c-*-
iso8859-1"
btw, in my haphazard notes i found font-spec, e.g..
(font-spec :family "Unicode Symbols" :size 24)
which turns out not useful here.
now i got cycle-font, next job when i have time would be setting
monospaced font whenever dired is opened or calendar (recently someone
asked for that, which prob means lots others have the same
question)... and also the job of getting all unicode to show...
---------------
ok a question. Is there a doc that list all the params of set-frame-
parameter?
i've not attempted to read the elisp doc for the frame section or font/
faces section in some cover-to-cover manner... well eventually i'll
have to do that.
the cycle-font command above can be improved too... not happy with the
state cycle code... hackish.
Xah
∑ http://xahlee.org/
☄
next prev parent reply other threads:[~2009-08-29 16:22 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-08-25 6:20 getting unicode chars to show on Windows Xah Lee
2009-08-25 17:16 ` B. T. Raven
2009-08-25 18:31 ` Eli Zaretskii
2009-08-26 5:48 ` AW: " Christian.Strobl
2009-08-26 5:50 ` Christian.Strobl
[not found] ` <mailman.5342.1251225106.2239.help-gnu-emacs@gnu.org>
2009-08-25 22:38 ` B. T. Raven
2009-08-25 22:42 ` B. T. Raven
2009-08-26 3:21 ` Eli Zaretskii
[not found] ` <mailman.5389.1251256888.2239.help-gnu-emacs@gnu.org>
2009-08-26 11:35 ` Xah Lee
2009-08-26 22:09 ` Jason Rumney
2009-08-27 18:36 ` Xah Lee
2009-08-28 10:40 ` Florian Beck
[not found] ` <mailman.5571.1251456046.2239.help-gnu-emacs@gnu.org>
2009-08-28 14:00 ` Xah Lee
2009-08-28 23:40 ` Florian Beck
2009-08-29 0:20 ` Drew Adams
[not found] ` <mailman.5608.1251505221.2239.help-gnu-emacs@gnu.org>
2009-08-29 16:22 ` Xah Lee [this message]
2009-08-30 17:38 ` Jason Rumney
2009-08-31 15:23 ` Drew Adams
2009-08-27 3:22 ` Eli Zaretskii
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=a67d283b-5590-4f9d-99b4-52864bdae490@u16g2000pru.googlegroups.com \
--to=xahlee@gmail.com \
--cc=help-gnu-emacs@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).