I would like to have a font with all characters the same width.
For example, a W
is wider than an i
in most fonts ...Is there any font that has all characters equally wide?
The type style you're looking for is monospace. Wikipedia explains it well.
A monospaced font, also called a fixed-pitch, fixed-width, or non-proportional font, is a font whose letters and characters each occupy the same amount of horizontal space. [...]
Examples of monospaced fonts include Courier, Courier New, Lucida Console, Monaco, and Consolas. [...]
These days, just about every computer has one or both of these fonts:
Fonts have 2 characteristics that will affect character spacing: width and kerning. Kerning determines when two adjacent characters can overlap. For instance, when you write AT, the leftmost part of the T bar may actually be positioned LEFT of the lowest part of the right branch of the A. Although fixed width fonts may allow kerning, it is rarely the case.
Anyway, if you want to choose a fixed-width font, you can use the following text
and look at the appearance using various fonts. If the first 2 lines have the same length, then it is fixed width. If the last 2 lines have the same length, then there is no kerning. I.e., you want all 4 lines to have the same length.
In Microsoft Word 2007 on Windows, the following fonts seem to be fixed-length, no kerning:
xlsfonts
supplies information about fonts when the X Windows System is in use (commonly on Linux or similar systems; almost never on MSWindows). Its -l
and -m
options display several font metrics, including minimum character width and maximum character width. Using shell commands, one can compare those widths to detect fixed-width fonts. For example, xlsfonts -lm '*fang*'
gives
DIR MIN MAX EXIST DFLT PROP ASC DESC NAME
--> * 33 *119 some 8481 25 10 1 -isas-fangsong ti-medium-r-normal--0-0-72-72-c-0-gb2312.1980-0
min(l,r,w,a,d) = (0,12,12,11,2)
max(l,r,w,a,d) = (0,12,12,11,2)
--> * 33 *119 some 8481 21 14 2 -isas-fangsong ti-medium-r-normal--16-160-72-72-c-160-gb2312.1980-0
min(l,r,w,a,d) = ( 0, 0,16, 0,-13)
max(l,r,w,a,d) = (12,16,16,14, 2)
For both those fonts, the min w equals the max w value – 12, 12 for one, 16, 16 for the other – indicating both are fixed-width fonts. (Note, xlsfonts
source code includes similar checks.)
From a recent post of mine on usenet, here is a Python program checkFixed.py
that automates the comparison. It reads xlsfonts-style data lines from stdin
, compares w values, and prints results on stdout
when min w equals max w. (Of course similar programs could be written in awk
, perl
, etc.)
#!/usr/bin/env python
# jiw - 2016
# This program reads `xlsfonts -lm`-style lines from stdin, and tests
# for cases where the w elements of min and max tuples are the same
from sys import stdout
while True:
try:
r = raw_input()
if r[0] == '-': # Font-lines start with -->
m1 = int((raw_input().split(','))[6])
m2 = int((raw_input().split(','))[6])
if m1==m2:
print r
stdout.flush()
except:
break
For example, xlsfonts -ml | ./checkFixed.py | head -3
on my system printed out
--> 0 255 some 0 29 14 5 -bitstream-courier 10 pitch-bold-i-normal--0-0-0-0-m-0-adobe-standard
--> 0 255 some 0 29 15 5 -bitstream-courier 10 pitch-bold-i-normal--0-0-0-0-m-0-ascii-0
--> * 0 *255 some 0 29 15 5 -bitstream-courier 10 pitch-bold-i-normal--0-0-0-0-m-0-iso10646-1
In another example, xlsfonts -ml '*fixed*' | ./checkFixed.py | head -3
printed out
--> * 33 *116 some 8481 25 11 1 -jis-fixed-medium-r-normal--0-0-75-75-c-0-jisx0208.1983-0
--> * 33 *116 some 8481 21 14 2 -jis-fixed-medium-r-normal--16-150-75-75-c-160-jisx0208.1983-0
--> * 33 *116 some 8481 21 14 2 -jis-fixed-medium-r-normal--16-150-75-75-c-160-jisx0208.1983-0
'font-family'
you get a big long list of monospaced fonts:Droid Sans Mono',Consolas,Menlo,Monaco,Lucida Console,Liberation Mono,DejaVu Sans Mono,Bitstream Vera Sans Mono,Courier New,monospace,serif