all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Font selection algorithm / how do fonts work / what do you suggest for mono font?
@ 2016-09-25 15:00 Oleksandr Gavenko
  2016-09-25 15:33 ` Eli Zaretskii
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Oleksandr Gavenko @ 2016-09-25 15:00 UTC (permalink / raw)
  To: help-gnu-emacs

Internet full of suggestion about font selection for programmers, I'd like to
mention:

* http://programmingfonts.org/
* http://vim.wikia.com/wiki/The_perfect_programming_font
* https://www.slant.co/topics/67/~programming-fonts
* http://hivelogic.com/articles/top-10-programming-fonts/

Most today recommendations end with vector fonts which is blurry and too bold
to me.

I have lived with ``misc-fixes`` for a long time. It is X/Xorg core fonts:

  http://www.cl.cam.ac.uk/%7Emgk25/ucs-fonts.html
    Unicode fonts and tools for X11 (from author of misc-fixed).
  https://www.x.org/releases/X11R7.7/doc/xorg-docs/fonts/fonts.html
    Core fonts description.

It covers wide range of glyphs. Really large!

It is a bitmap font and usually bitmap fonts have no italic/oblique slant
variations, only bold weight variation.

I'd like to have italic font variation because recently came across difficulty
to distinct between colors if too many colors used.

With help of:

  $ xfontsel

I found that ``terminus`` come with oblique variation. Original author
refused to make oblique font:

  http://terminus-font.sourceforge.net/
    A. No. The quality is significantly lower, and preserving the font width
    requires overlapping characters, which are not handled very well by
    X11/Xft. Anyway, the modern GUIs support automatic slanting; if you are
    not satisfied with it, try mkitalic from FreeBSD or bdfslant from Debian.

but Debian maintainer build oblique variation:

  $ apt-cache show xfonts-terminus-oblique
  Package: xfonts-terminus-oblique (Installed)
  Source: xfonts-terminus
  Maintainer: Anton Zinoviev <zinoviev@debian.org>
  Description-en: Oblique version of the Terminus font
   This package contains oblique versions of the fonts in the package
   xfonts-terminus.  These fonts are automatically generated and at
   present are not supported by the upstream maintainer.  They have much
   lower quality than the original fonts.  Nevertheless they can be
   useful for some programs such as GNU Emacs and XEmacs.

It has low quality but better than nothing.

``adobe-courier`` have oblique slant but it lacks glyphs for many needed
scrips.

================================================================

I work with ASCII, cyrillic, phonetic scripts and occasionally use greek,
symbol scripts.

``misc-fixes`` covers my needs.

``adobe-courier`` have no even cyrillic.

``terminus`` have cyrillic, greek but lack phonetic and symbol.

Because I need italic only for code I try to combine ``terminus`` with
``misc-fixes``:

  http://emacs.stackexchange.com/questions/27312/default-font-has-no-slant-italic-but-i-want-to-show-italic-text/

and even crafted working solution:

  (set-frame-font "-*-terminus-*-*-*--14-*-*-*-c-*-*-*")
  (setq-default line-spacing nil)
  (set-fontset-font nil 'cyrillic "-*-terminus-*-*-*--14-*-*-*-c-*-*-*")
  (set-fontset-font nil 'greek "-*-terminus-*-*-*--14-*-*-*-c-*-*-*")
  (set-fontset-font nil nil "-misc-fixed-*-*-*--13-*-*-*-*-*-*-*")
  (set-fontset-font nil 'phonetic "-misc-fixed-*-*-*--13-*-*-*-*-*-*-*")
  (set-fontset-font nil 'symbol "-misc-fixed-*-*-*--13-*-*-*-*-*-*-*")
  ;; MODIFIER LETTER is not present in terminus, this includes ˌːˈ characters.
  (set-fontset-font nil '(#x02C0 . #x02FF) "-misc-fixed-*-*-*--13-*-*-*-*-*-*-*")

There are also major fond distribution:

  $ apt-get install xfonts-jmk 

  (set-frame-font "-jmk-Neep-*-*-*-*-15-*-*-*-c-*-*-*")

which includes missing glyphs from misc-fixed but lack slant variation.


Are there any other **rich** bitmap fonts available?

================================================================

My current display has 95 DPI.

Do I need to consider switching to TTF font?


I like look of font from GTK menus and believe that is is "DejaVu Sans" but:

  (set-frame-font "DejaVu Sans Mono-10")

a little bolder then "DejaVu Sans".

These fonts are too blurry and bold for me:

  (set-frame-font "Hack-10")
  (set-frame-font "Terminus-12")
  (set-frame-font "Inconsolata-11")
  (set-frame-font "IBM 3270-12")
  (set-frame-font "Space Mono-10")

Is it possible to fix blurriness by fontconfig?


Thin lines in:

  (set-frame-font "Unifont-12")          ; Lack italic
  (set-frame-font "Liberation Mono-11")  ; Lack phonetic script

  (set-frame-font "FreeMono-12")

From what I see two winners for my needs: FreeMono and DejaVu Sans Mono.

================================================================

Is that true that TTF fonts should have separate italic / oblique glyphs or
currect rendering engines able to make them from roman slant?

I see some fonts comes as several files with names
Roman/Italic/Bold/BoldItalic. But other come within single file and gucharmap
show italic version of font. Do that mean that such glyphs compiled into file
or freetype/etc library make them from roman?

================================================================

How can I find font width?

When I played with ``terminus`` / ``misc-fixed`` fonts they have different
width on other values of pxlSz in xfontsel.

For monospaces fonts width should be fixed ))

-- 
http://defun.work/




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

* Re: Font selection algorithm / how do fonts work / what do you suggest for mono font?
  2016-09-25 15:00 Font selection algorithm / how do fonts work / what do you suggest for mono font? Oleksandr Gavenko
@ 2016-09-25 15:33 ` Eli Zaretskii
  2016-09-25 19:04   ` Oleksandr Gavenko
  2016-09-25 16:13 ` Grant Rettke
  2016-09-25 19:00 ` Yuri Khan
  2 siblings, 1 reply; 9+ messages in thread
From: Eli Zaretskii @ 2016-09-25 15:33 UTC (permalink / raw)
  To: help-gnu-emacs

> From: Oleksandr Gavenko <gavenkoa@gmail.com>
> Date: Sun, 25 Sep 2016 18:00:39 +0300
> 
> Internet full of suggestion about font selection for programmers, I'd like to
> mention:

What version of Emacs do you have installed?  I think Emacs 25 should
do a better job by default, so try that first.



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

* Re: Font selection algorithm / how do fonts work / what do you suggest for mono font?
  2016-09-25 15:00 Font selection algorithm / how do fonts work / what do you suggest for mono font? Oleksandr Gavenko
  2016-09-25 15:33 ` Eli Zaretskii
@ 2016-09-25 16:13 ` Grant Rettke
  2016-09-25 16:25   ` Eli Zaretskii
  2016-09-25 19:00 ` Yuri Khan
  2 siblings, 1 reply; 9+ messages in thread
From: Grant Rettke @ 2016-09-25 16:13 UTC (permalink / raw)
  To: Oleksandr Gavenko; +Cc: Emacs Help

On Sun, Sep 25, 2016 at 10:00 AM, Oleksandr Gavenko <gavenkoa@gmail.com> wrote:
> For monospaces fonts width should be fixed ))

Try DejaVu Sans Mono and to get complete symbol coverage set the
fallback font to Symbola via

(set-fontset-font "fontset-default" nil
                  (font-spec :size 20 :name "Symbola"))



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

* Re: Font selection algorithm / how do fonts work / what do you suggest for mono font?
  2016-09-25 16:13 ` Grant Rettke
@ 2016-09-25 16:25   ` Eli Zaretskii
  0 siblings, 0 replies; 9+ messages in thread
From: Eli Zaretskii @ 2016-09-25 16:25 UTC (permalink / raw)
  To: help-gnu-emacs

> From: Grant Rettke <gcr@wisdomandwonder.com>
> Date: Sun, 25 Sep 2016 11:13:43 -0500
> Cc: Emacs Help <help-gnu-emacs@gnu.org>
> 
> (set-fontset-font "fontset-default" nil
>                   (font-spec :size 20 :name "Symbola"))

AFAIU, Emacs 25 already does that, at least partially.



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

* Re: Font selection algorithm / how do fonts work / what do you suggest for mono font?
  2016-09-25 15:00 Font selection algorithm / how do fonts work / what do you suggest for mono font? Oleksandr Gavenko
  2016-09-25 15:33 ` Eli Zaretskii
  2016-09-25 16:13 ` Grant Rettke
@ 2016-09-25 19:00 ` Yuri Khan
  2 siblings, 0 replies; 9+ messages in thread
From: Yuri Khan @ 2016-09-25 19:00 UTC (permalink / raw)
  To: Oleksandr Gavenko; +Cc: help-gnu-emacs@gnu.org

On Sun, Sep 25, 2016 at 10:00 PM, Oleksandr Gavenko <gavenkoa@gmail.com> wrote:

> Internet full of suggestion about font selection for programmers […]
>
> Most today recommendations end with vector fonts which is blurry and too bold
> to me.
>
> My current display has 95 DPI.

At 95 DPI, basically, you have a choice: either some amount of
blurriness, or some amount of corrupting the intended letter shape.
The knob is called hinting. Choose aggressive (“full”) hinting,
strokes are pulled to integer pixel coordinates, you get crisp ugly
letters. Choose slight hinting, letter shape is preserved as much as
practical, but some strokes will be at fractional coordinates and thus
blurry.

On a typical landscape-oriented monitor, vertical strokes can benefit
from subpixel hinting, although some call the result “rainbow soap”.

Both problems (blurriness and letter misshaping) pretty much disappear
at 2x pixel density or around 192 DPI. (However a new one appears —
you start to hate bitmap graphics, as it is either too blurry or too
small.)



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

* Re: Font selection algorithm / how do fonts work / what do you suggest for mono font?
  2016-09-25 15:33 ` Eli Zaretskii
@ 2016-09-25 19:04   ` Oleksandr Gavenko
  2016-09-26  2:36     ` Eli Zaretskii
  0 siblings, 1 reply; 9+ messages in thread
From: Oleksandr Gavenko @ 2016-09-25 19:04 UTC (permalink / raw)
  To: help-gnu-emacs

On 2016-09-25, Eli Zaretskii wrote:

> What version of Emacs do you have installed?  I think Emacs 25 should
> do a better job by default, so try that first.

I am at latest available for Debian - 24.5.1

================================================================

From https://www.gnu.org/software/emacs/news/NEWS.25.1

  ** New functions return extended information about fonts and faces.

  ...

  *** Frames now do not necessarily preserve the number of columns or lines
  they display when setting default font, menu bar, fringe width, or
  scroll bars.  In particular, maximized and fullscreen frames are
  conceptually never resized if such settings change.  For fullheight and
  ...

I don't see much changes in font selection algorithm.

Actually I have a problem, as I wrote ``terminus`` font missed some glyphs and
I expect that:

  (set-fontset-font nil nil "-misc-fixed-*-*-*--13-*-*-*-*-*-*-*")

was as fallback. But it has no effect. Fix with range resolve issue:

  ;; MODIFIER LETTER is not present in terminus, this includes ˌːˈ characters.
  (set-fontset-font nil '(#x02C0 . #x02FF) "-misc-fixed-*-*-*--13-*-*-*-*-*-*-*")

Do I need file bug or I am wrong with (set-fontset-font nil nil ...)?

-- 
http://defun.work/




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

* Re: Font selection algorithm / how do fonts work / what do you suggest for mono font?
  2016-09-25 19:04   ` Oleksandr Gavenko
@ 2016-09-26  2:36     ` Eli Zaretskii
  2016-09-26 21:07       ` Oleksandr Gavenko
  0 siblings, 1 reply; 9+ messages in thread
From: Eli Zaretskii @ 2016-09-26  2:36 UTC (permalink / raw)
  To: help-gnu-emacs

> From: Oleksandr Gavenko <gavenkoa@gmail.com>
> Date: Sun, 25 Sep 2016 22:04:14 +0300
> 
> On 2016-09-25, Eli Zaretskii wrote:
> 
> I don't see much changes in font selection algorithm.

The algorithm didn't change, but we changed the default fontset to
better cover various ranges that were not covered well before.

> Actually I have a problem, as I wrote ``terminus`` font missed some glyphs and
> I expect that:
> 
>   (set-fontset-font nil nil "-misc-fixed-*-*-*--13-*-*-*-*-*-*-*")
> 
> was as fallback. But it has no effect. Fix with range resolve issue:
> 
>   ;; MODIFIER LETTER is not present in terminus, this includes ˌːˈ characters.
>   (set-fontset-font nil '(#x02C0 . #x02FF) "-misc-fixed-*-*-*--13-*-*-*-*-*-*-*")
> 
> Do I need file bug or I am wrong with (set-fontset-font nil nil ...)?

On my system these characters display well by default.  If the problem
is that these characters are displayed, but you don't like the font
Emacs selects, I think that's something you should customize 9as you
did), and not a bug you should report.



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

* Re: Font selection algorithm / how do fonts work / what do you suggest for mono font?
  2016-09-26  2:36     ` Eli Zaretskii
@ 2016-09-26 21:07       ` Oleksandr Gavenko
  2016-09-27 14:52         ` Eli Zaretskii
  0 siblings, 1 reply; 9+ messages in thread
From: Oleksandr Gavenko @ 2016-09-26 21:07 UTC (permalink / raw)
  To: help-gnu-emacs

On 2016-09-26, Eli Zaretskii wrote:

>> Actually I have a problem, as I wrote ``terminus`` font missed some glyphs and
>> I expect that:
>> 
>>   (set-fontset-font nil nil "-misc-fixed-*-*-*--13-*-*-*-*-*-*-*")
>> 
>> was as fallback. But it has no effect. Fix with range resolve issue:
>> 
>>   ;; MODIFIER LETTER is not present in terminus, this includes ˌːˈ characters.
>>   (set-fontset-font nil '(#x02C0 . #x02FF) "-misc-fixed-*-*-*--13-*-*-*-*-*-*-*")
>> 
>> Do I need file bug or I am wrong with (set-fontset-font nil nil ...)?
>
> On my system these characters display well by default.  If the problem
> is that these characters are displayed, but you don't like the font
> Emacs selects, I think that's something you should customize 9as you
> did), and not a bug you should report.

I was confused with:

  (set-fontset-font NAME TARGET FONT-SPEC &optional FRAME ADD)

  TARGET may be nil.  In that case, use FONT-SPEC for any characters for
  that no FONT-SPEC is specified.

With "emacs -Q" and:

  (set-frame-font "-*-terminus-medium-r-*--14-*-*-*-c-*-*-*")
  (describe-fontset "default-fontset")

for symbol:

  ː
  code point in charset: 0x02D0

I got at least such ranges that contain 0x02D0:

  ¼ .. Ѐ (#xBC .. #x400)
      -*-*-*-*-*-*-*-*-*-*-*-*-microsoft-cp1251
      [-xos4-terminus-medium-r-normal--14-140-72-72-c-80-microsoft-cp1251]

  ː (#x2D0)
      -*-*-*-*-*-*-*-*-*-*-*-*-iso8859-1
      [-xos4-Terminus-normal-normal-normal-*-14-*-*-*-c-80-iso10646-1]
      -*-*-*-*-*-*-*-*-*-*-*-*-iso8859-2
      [-xos4-Terminus-normal-normal-normal-*-14-*-*-*-c-80-iso10646-1]
      -*-*-*-*-*-*-*-*-*-*-*-*-iso8859-3
      [-xos4-Terminus-normal-normal-normal-*-14-*-*-*-c-80-iso10646-1]
      -*-*-*-*-*-*-*-*-*-*-*-*-iso8859-4
      [-xos4-Terminus-normal-normal-normal-*-14-*-*-*-c-80-iso10646-1]
      -*-*-*-*-*-*-*-*-*-*-*-*-iso8859-9
      [-xos4-Terminus-normal-normal-normal-*-14-*-*-*-c-80-iso10646-1]
      -*-*-*-*-*-*-*-*-*-*-*-*-iso8859-10
      [-xos4-Terminus-normal-normal-normal-*-14-*-*-*-c-80-iso10646-1]
      -*-*-*-*-*-*-*-*-*-*-*-*-iso8859-13
      [-xos4-Terminus-normal-normal-normal-*-14-*-*-*-c-80-iso10646-1]
      -*-*-*-*-*-*-*-*-*-*-*-*-iso8859-14
      [-xos4-Terminus-normal-normal-normal-*-14-*-*-*-c-80-iso10646-1]
      -*-*-*-*-*-*-*-*-*-*-*-*-iso8859-15
      [-xos4-Terminus-normal-normal-normal-*-14-*-*-*-c-80-iso10646-1]
      -*-*-*-*-*-*-*-*-*-*-*-*-iso8859-16
      [-xos4-Terminus-normal-normal-normal-*-14-*-*-*-c-80-iso10646-1]
      -*-*-*-*-*-*-*-*-*-*-*-*-viscii1.1-1
      [-unknown-Gentium-normal-normal-normal-*-14-*-*-*-*-0-iso10646-1]
      -*-*-*-*-*-*-*-*-*-*-*-*-iso10646-1
      -*-*-*-*-*-*-*-*-*-*-*-*-ksc5601.1987-0

C-u C-x = shown that "Gentium" font is used for displaying character.

Is that mean that for "ː" character font is defined and so

  (set-fontset-font nil **nil** FONT-SPEC &optional FRAME ADD)

isn't taken in account (when TARGET == nil)?

-- 
http://defun.work/




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

* Re: Font selection algorithm / how do fonts work / what do you suggest for mono font?
  2016-09-26 21:07       ` Oleksandr Gavenko
@ 2016-09-27 14:52         ` Eli Zaretskii
  0 siblings, 0 replies; 9+ messages in thread
From: Eli Zaretskii @ 2016-09-27 14:52 UTC (permalink / raw)
  To: help-gnu-emacs

> From: Oleksandr Gavenko <gavenkoa@gmail.com>
> Date: Tue, 27 Sep 2016 00:07:58 +0300
> 
> C-u C-x = shown that "Gentium" font is used for displaying character.
> 
> Is that mean that for "ː" character font is defined and so
> 
>   (set-fontset-font nil **nil** FONT-SPEC &optional FRAME ADD)
> 
> isn't taken in account (when TARGET == nil)?

I'm not sure I understand the question, sorry.

In general, Emacs will use the first font defined for the character
that supports it.  If all the fonts were defined the same, the order
of their look up is not under your control.  So you will be better off
defining specific regions of characters for specific fonts.  Leave the
catch-all definitions for Emacs.



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

end of thread, other threads:[~2016-09-27 14:52 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-09-25 15:00 Font selection algorithm / how do fonts work / what do you suggest for mono font? Oleksandr Gavenko
2016-09-25 15:33 ` Eli Zaretskii
2016-09-25 19:04   ` Oleksandr Gavenko
2016-09-26  2:36     ` Eli Zaretskii
2016-09-26 21:07       ` Oleksandr Gavenko
2016-09-27 14:52         ` Eli Zaretskii
2016-09-25 16:13 ` Grant Rettke
2016-09-25 16:25   ` Eli Zaretskii
2016-09-25 19:00 ` Yuri Khan

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.