unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* set-face-font and custom-set-font, DejaVu, fonts for hebrew
@ 2015-07-24 16:43 Uwe Brauer
  2015-07-24 18:13 ` Eli Zaretskii
  0 siblings, 1 reply; 8+ messages in thread
From: Uwe Brauer @ 2015-07-24 16:43 UTC (permalink / raw)
  To: help-gnu-emacs



Hello

I am using Kubuntu 10.04 and GNU emacs 24.4
I am still used to the (old-fashion) setting of font, I find via
xfontsel, for example

  (set-face-font 'default "-*-courier-bold-r-*-*-20-180-*-*-*-*-*-*")

Now I also have tried out via the menu
Options-->Set Default Font

and I liked especially

Deja Vu Sans Mono, but only for Hebrew, for European language I prefer
courier bold, which I set as above via set-face-font

When I set the Deja Vu font via Options-->Save Options
the following is written into my custom file:

(custom-set-faces
 ;; custom-set-faces was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 '(default ((t (:family "DejaVu Sans Mono" :foundry "unknown" :slant
 normal :weight normal :height 143 :width normal)))))

Now I want to modify a function, I use to turning on Hebrew writing
which also switches the font.

For example I have

(defun my-turn-bidi-paragraph-direction-on () 
  "Just start with  to R2L `bidi-paragraph-direction' set
  and turn the hebrew (qwerty) keyboard on"
   (interactive)
  (setq  bidi-paragraph-direction 'right-to-left)
  (set-face-font 'default "-etl-*-*-*-*-*-*-240-*-*-*-*-ISO8859-8")
  (setq org-mime-bidi-support t)
  (set-input-method "hebrew-phonetic-qwerty" t)
  (message "R2L on and the hebrew qwerty keyboard!"))

However  I want now to replace the «etl» font by the nicer Deja Vu font, but
how? I cannot find the DejaVu font via xfontsel. 
I could of course use the
(custom-set-faces 
 '(default ((t (:family "DejaVu Sans Mono" :foundry "unknown" :slant
 normal :weight normal :height 143 :width normal)))))

But this seems to me a abuse of custom-set-faces?


Thanks

Uwe Brauer 




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

* Re: set-face-font and custom-set-font, DejaVu, fonts for hebrew
  2015-07-24 16:43 set-face-font and custom-set-font, DejaVu, fonts for hebrew Uwe Brauer
@ 2015-07-24 18:13 ` Eli Zaretskii
  2015-08-07  7:43   ` Uwe Brauer
  0 siblings, 1 reply; 8+ messages in thread
From: Eli Zaretskii @ 2015-07-24 18:13 UTC (permalink / raw)
  To: help-gnu-emacs

> From: Uwe Brauer <oub@mat.ucm.es>
> Date: Fri, 24 Jul 2015 16:43:27 +0000
> 
> When I set the Deja Vu font via Options-->Save Options
> the following is written into my custom file:
> 
> (custom-set-faces
>  ;; custom-set-faces was added by Custom.
>  ;; If you edit it by hand, you could mess it up, so be careful.
>  ;; Your init file should contain only one such instance.
>  ;; If there is more than one, they won't work right.
>  '(default ((t (:family "DejaVu Sans Mono" :foundry "unknown" :slant
>  normal :weight normal :height 143 :width normal)))))
> 
> Now I want to modify a function, I use to turning on Hebrew writing
> which also switches the font.
> 
> For example I have
> 
> (defun my-turn-bidi-paragraph-direction-on () 
>   "Just start with  to R2L `bidi-paragraph-direction' set
>   and turn the hebrew (qwerty) keyboard on"
>    (interactive)
>   (setq  bidi-paragraph-direction 'right-to-left)
>   (set-face-font 'default "-etl-*-*-*-*-*-*-240-*-*-*-*-ISO8859-8")
>   (setq org-mime-bidi-support t)
>   (set-input-method "hebrew-phonetic-qwerty" t)
>   (message "R2L on and the hebrew qwerty keyboard!"))
> 
> However  I want now to replace the «etl» font by the nicer Deja Vu font, but
> how? I cannot find the DejaVu font via xfontsel. 

Doesn't the following work for you?

  (set-face-font 'default "DejaVu Sans Mono")

It does for me.

IOW, using the XLFD format for specifying a font is only one of the
several alternatives that Emacs supports.  Another is just to specify
the font name.  See the node "Fonts" in the Emacs manual.

Btw, changing the font of the default face is not the recommended
procedure when all you want is to request that font for a certain
script.  For that, define your fontset-default to use DejaVu Sans Mono
only for the Hebrew script.  There are several examples of how to do
that in the "Modifying Fontsets" node of the Emacs manual.




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

* Re: set-face-font and custom-set-font, DejaVu, fonts for hebrew
  2015-07-24 18:13 ` Eli Zaretskii
@ 2015-08-07  7:43   ` Uwe Brauer
  2015-08-07  8:35     ` Eli Zaretskii
  0 siblings, 1 reply; 8+ messages in thread
From: Uwe Brauer @ 2015-08-07  7:43 UTC (permalink / raw)
  To: help-gnu-emacs

>>>>> "Eli" == Eli Zaretskii <eliz@gnu.org> writes:

>> 
>> However  I want now to replace the «etl» font by the nicer Deja Vu font, but
>> how? I cannot find the DejaVu font via xfontsel. 

> Doesn't the following work for you?

>   (set-face-font 'default "DejaVu Sans Mono")

It does, but the size is too big for my purposes, so I would need to add
the fonts size as an option, but that seems not to be possible with set-face-font

So I just have now

(defun my-turn-bidi-on () 
  "Just turn  R2L on (`bidi-paragraph-direction' is NIL)
and turn the hebrew (qwerty) keyboard on."
  (interactive)
  (setq  bidi-paragraph-direction nil)
  (custom-set-faces 
   '(default ((t (:family "DejaVu Sans Mono" :foundry "unknown" :slant
			  normal :weight normal :height 143 :width normal))))))

Which does what I want. 


> Btw, changing the font of the default face is not the recommended
> procedure when all you want is to request that font for a certain
> script.  For that, define your fontset-default to use DejaVu Sans Mono
> only for the Hebrew script.  There are several examples of how to do
> that in the "Modifying Fontsets" node of the Emacs manual.

Right. I am getting used to the DejaVu font, at least for reading and
writing mail, not so much for programming, so I will follow your advice
and look into the manual. Thanks





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

* Re: set-face-font and custom-set-font, DejaVu, fonts for hebrew
  2015-08-07  7:43   ` Uwe Brauer
@ 2015-08-07  8:35     ` Eli Zaretskii
  2015-08-07 16:04       ` Uwe Brauer
       [not found]       ` <mailman.7940.1438963519.904.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 8+ messages in thread
From: Eli Zaretskii @ 2015-08-07  8:35 UTC (permalink / raw)
  To: help-gnu-emacs

> From: Uwe Brauer <oub@mat.ucm.es>
> Date: Fri, 07 Aug 2015 07:43:16 +0000
> 
> >>>>> "Eli" == Eli Zaretskii <eliz@gnu.org> writes:
> 
> >> 
> >> However  I want now to replace the «etl» font by the nicer Deja Vu font, but
> >> how? I cannot find the DejaVu font via xfontsel. 
> 
> > Doesn't the following work for you?
> 
> >   (set-face-font 'default "DejaVu Sans Mono")
> 
> It does, but the size is too big for my purposes, so I would need to add
> the fonts size as an option, but that seems not to be possible with set-face-font

Why not possible?  This should work (it does for me):

  (set-face-font 'default "DejaVu Sans Mono-12")

(assuming 12 is the size you want; if not, use a different size).




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

* Re: set-face-font and custom-set-font, DejaVu, fonts for hebrew
  2015-08-07  8:35     ` Eli Zaretskii
@ 2015-08-07 16:04       ` Uwe Brauer
       [not found]       ` <mailman.7940.1438963519.904.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 8+ messages in thread
From: Uwe Brauer @ 2015-08-07 16:04 UTC (permalink / raw)
  To: help-gnu-emacs

>>>>> "Eli" == Eli Zaretskii <eliz@gnu.org> writes:


   >   (set-face-font 'default "DejaVu Sans Mono-12")

   > (assuming 12 is the size you want; if not, use a different size).

That is indeed much better, however I want it in bold.

It turns out that

(set-face-font 'default "DejaVu Sans Mono-14")

Does the trick, why bold vs non bold depends on the size is beyond me.

Thanks!

Uwe 




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

* Re: set-face-font and custom-set-font, DejaVu, fonts for hebrew
       [not found]       ` <mailman.7940.1438963519.904.help-gnu-emacs@gnu.org>
@ 2015-08-07 16:43         ` Dan Espen
  2015-08-08  8:20           ` Uwe Brauer
       [not found]           ` <mailman.7980.1439022040.904.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 8+ messages in thread
From: Dan Espen @ 2015-08-07 16:43 UTC (permalink / raw)
  To: help-gnu-emacs

Uwe Brauer <oub@mat.ucm.es> writes:

>>>>>> "Eli" == Eli Zaretskii <eliz@gnu.org> writes:
>
>
>    >   (set-face-font 'default "DejaVu Sans Mono-12")
>
>    > (assuming 12 is the size you want; if not, use a different size).
>
> That is indeed much better, however I want it in bold.
>
> It turns out that
>
> (set-face-font 'default "DejaVu Sans Mono-14")
>
> Does the trick, why bold vs non bold depends on the size is beyond me.

It doesn't and that font is not bold.
This is a bold font:

(set-face-font 'default "DejaVu Sans Mono-14:bold")

-- 
Dan Espen


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

* Re: set-face-font and custom-set-font, DejaVu, fonts for hebrew
  2015-08-07 16:43         ` Dan Espen
@ 2015-08-08  8:20           ` Uwe Brauer
       [not found]           ` <mailman.7980.1439022040.904.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 8+ messages in thread
From: Uwe Brauer @ 2015-08-08  8:20 UTC (permalink / raw)
  To: help-gnu-emacs


   > Uwe Brauer <oub@mat.ucm.es> writes:

   > It doesn't and that font is not bold.
   > This is a bold font:

   > (set-face-font 'default "DejaVu Sans Mono-14:bold")

   > (set-face-font 'default "DejaVu Sans Mono-14")

Thanks,


but in my environment (set-face-font 'default "DejaVu Sans Mono-12:bold") gives
the font in 12pt with very thin letters while
(set-face-font 'default "DejaVu Sans Mono-14")
gives a larger font, with thicker letters
and 

(set-face-font 'default "DejaVu Sans Mono-14:bold")
with still thicker letters. That is a bit confusing.

So it boils down to:
what is the equivalent of

(custom-set-faces 
   '(default ((t (:family "DejaVu Sans Mono" :foundry "unknown" :slant
			  normal :weight normal :height 143 :width normal)))))

Using set-face-font?

Thanks

Uwe 




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

* Re: set-face-font and custom-set-font, DejaVu, fonts for hebrew
       [not found]           ` <mailman.7980.1439022040.904.help-gnu-emacs@gnu.org>
@ 2015-08-08 14:18             ` Dan Espen
  0 siblings, 0 replies; 8+ messages in thread
From: Dan Espen @ 2015-08-08 14:18 UTC (permalink / raw)
  To: help-gnu-emacs

Uwe Brauer <oub@mat.ucm.es> writes:

>    > Uwe Brauer <oub@mat.ucm.es> writes:
>
>    > It doesn't and that font is not bold.
>    > This is a bold font:
>
>    > (set-face-font 'default "DejaVu Sans Mono-14:bold")
>
>    > (set-face-font 'default "DejaVu Sans Mono-14")
>
> Thanks,
>
> but in my environment (set-face-font 'default "DejaVu Sans Mono-12:bold") gives
> the font in 12pt with very thin letters while
> (set-face-font 'default "DejaVu Sans Mono-14")
> gives a larger font, with thicker letters
> and 

Font changes are subject to the fonts installed on your machine.
As far as I know, you get what the system considers the closest match.

Whatever the system has for 14 point is going to look bolder (thicker)
than a smaller sized font.

For me, these fonts:

(set-face-font 'default "DejaVu Sans Mono-12:bold")
(set-face-font 'default "DejaVu Sans Mono-12")

are different, but I have to be careful the order I test in.
I think leaving the font weight unspecified leaves the current
setting unchanged, but I tried using :normal without effect.

> (set-face-font 'default "DejaVu Sans Mono-14:bold")
> with still thicker letters. That is a bit confusing.
>
> So it boils down to:
> what is the equivalent of
>
> (custom-set-faces 
>    '(default ((t (:family "DejaVu Sans Mono" :foundry "unknown" :slant
> 			  normal :weight normal :height 143 :width normal)))))
>
> Using set-face-font?

(set-face-font 'default "DejaVu Sans Mono:bold:foundry=unknown:slant=normal:wieght=normal:height=143:width=normal")

But when I test this, things like the height don't seem to do anything...
Okay I did some testing, in a fresh start Emacs, that does change the
font.  You might want to do:

export FC_DEBUG=1  (or 2)
emacs

then change the fonts.
In the starting terminal you get information about the font matching process.


-- 
Dan Espen


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

end of thread, other threads:[~2015-08-08 14:18 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-24 16:43 set-face-font and custom-set-font, DejaVu, fonts for hebrew Uwe Brauer
2015-07-24 18:13 ` Eli Zaretskii
2015-08-07  7:43   ` Uwe Brauer
2015-08-07  8:35     ` Eli Zaretskii
2015-08-07 16:04       ` Uwe Brauer
     [not found]       ` <mailman.7940.1438963519.904.help-gnu-emacs@gnu.org>
2015-08-07 16:43         ` Dan Espen
2015-08-08  8:20           ` Uwe Brauer
     [not found]           ` <mailman.7980.1439022040.904.help-gnu-emacs@gnu.org>
2015-08-08 14:18             ` Dan Espen

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).