You are not logged in.
Pages: 1
Hi everyone I was working on customizing my desktop this afternoon and learned quite a bit about fonts.
Not sure if anyone needs this information but I sure enjoyed myself. Please guide me if I made any mistakes. Thanks!.
Here goes...
I started on this because I wanted to use unicode characters for
LemonBoy's bar.
I wanted to display funky symbols without installing a new font,
so I decided to use Dejavu Sans Mono to display them.
I had to get bar to find my font, and that is the gist of this post.
In X, a font is specified in a funny way. Here's an example:
-misc-dejavu sans mono-medium-r-normal--17-120-100-100-m-100-iso10646-1
Most of the time though, we will not need to be so specific, can this will do:
-*-dejavu sans mono-medium-r-normal--17-*-*-*-*-*-iso10646-1
If you're as curious as me you'll probably want to find out what all those
numbers as me, and if you're as stupid too, you'ld probably spend
an entire afternoon finding out.
If you're just interested in the answer jump to the bottom, 'cos I will be
going though steps to find this information yourself.
1) `xlsfonts` is is the server font list displayer for X (`man xlsfonts`)
This is the most crucial thing we need.
Get it from your distribution's package manager, I'm on arch so I just had to
pacman -S xlsfonts
2) skim through
xlsfonts --help
3) try this:
xlsfonts
You should see a bunch of fonts displayed similar to what I showed you above.
4) If you have DejaVu Sans already installed you can probably try this:
xlsfonts -l -fn -misc-dejavu\ sans\
mono-medium-r-normal--17-120-100-100-m-100-iso10646-1
Make sure you type the backslash as well, you have to escape the spaces.
5) If not you, pick a font from the list generated by `xlsfonts`, and do:
xlsfonts -l -fn -the-font-you-picked-some-numbers-blah-blah111
Or if you're lazy to type we can just select the first font in the list:
xlsfonts -l -fn $(xlsfonts | head -1)
6) Now thats not very interesting, a bunch of short cryptic headings,
so lets try this:
xlsfonts -ll -fn $(xlsfonts | head -1)
Note the 2 l's this time.
So this gets much more interesting, lots of information,
not that difficult to understand. Most are self-explanatory, such as
direction, rows, columns. To go more in-depth, try these search terms:
character encoding, character map, fonts in x.
7) Now things become clearer, lets separate the full font name by
hypens, and match them to the properties in the output:
misc | FOUNDRY
dejavu sans mono | FAMILY_NAME
medium | WEIGHT NAME
r | SLANT
normal | SETWIDTH_NAME
| ADD_STYLE_NAME
17 | PIXEL_SIZE
120 | POINT_SIZE
100 | RESOLUTION_X
100 | RESOLUTION_Y
m | SPACING
100 | AVERAGE_WIDTH
iso10646 | CHARSET_REGISTRY
1 | CHARSET_ENCODING
SLANT has to do with the italics, r stands for Roman,
there is also o for Oblique.
Mystery solved! I don't know what every property means,
but I guess you can probably find out if you want to
This worked for `bar`, with the specific full font name.
I also learned that the `PIXEL_SIZE` and `POINT_SIZE` should not
both be set at the same time. For example, looking at the information
above, you can set `PIXEL_SIZE` and `POINT_SIZE` to 17 and 120 respectively,
but 12 and 120 will fail.
I suppose this has something to do with font rasterizing, so setting one
will optimize the other for you. As such I chose to fidget with
`PIXEL_SIZE` and leave `POINT_SIZE` as *.
What I'm using now is this:
-misc-dejavu sans mono-medium-r-normal--11-*-*-*-m-*-iso10646-1
Which ensures that I get the correct font family, weight, encoding,
which I guess are the most important parts, just leave the rest
to the computer!
Notes: `xlsfonts` has a `-lll` flag to, shows you every character in
the font, pretty crazy and useful at the same time!
And guess what I think I'll be back to stlarch so it looks so much better.
Offline
Maybe have a look at xfontsel?
Offline
Maybe have a look at xfontsel?
Wow I didn't know there was such a thing. Thanks!
Offline
A blog on github ?? That was supposed to be a Version Control System.
Last edited by illusionist (2013-01-12 00:13:14)
Never argue with stupid people,They will drag you down to their level and then beat you with experience.--Mark Twain
@github
Offline
xlsfonts works with the wild cards, '*' and '?' – I usually quote the font to avoid backslashes:
$ xlsfonts -fn "*-DejaVu Sans Mono-*" ## Lists all variations of DejaVu Sans Mono
Foundry can be important if there are two or more fonts with the same family name, for example, Courier.
For scalable fonts, Type1, TrueType and OpenType fonts, point size may be easier to fine tune than pixel size. Bitmap fonts have a separate file for each available size, so both pixel size and point size are part of the name of the font. You can scale bitmap fonts, but the glyph images may suffer.
Resolution_x and Resolution_y are again more important for bitmap fonts. The same font name may have variations tuned for ~75 dpi monitors or ~100 dpi monitors. For the scalable fonts, you can set these two fields at '0', zero.
Spacing comes as 'c' for character cell, 'm' for monospace, and 'p' for proportional. There's a slight distinction between character cell and monospace fonts, but for many apps, you can consider them both as "monospaced".
To find all the monospace fonts, you can use these two commands:
$ xlsfonts -fn "*-m-*"
$ xlsfonts -fn "*-c-*"
For fontconfig names, this command should find the monospace fonts:
$ fc-list : family spacing=100 | sort
Offline
A blog on github ?? That was supposed to be a Version Control System.
Anything text can theoretically go on git, and since a blog is public why not host it on GitHub?
Quite a number of people do that AFAIK, especially with programs such as Jekyll "blog-aware static site generator".
point size may be easier to fine tune than pixel size
Thanks for the info!:D
By the way I think I read somewhere that point size is pixel size * 10, is that correct?
Offline
By the way I think I read somewhere that point size is pixel size * 10, is that correct?
Yes, pixel size is given in tenths of a point. Adobe somewhat standardized a computer typeface point as one seventy-secondth of an inch.
If I understand correctly, the point size is what the user is supposed to give to determine the font height. Pixel size is supposed to be the size for which the typeface was designed. These two fields can interact a lot.
I've started a draft for an XLFD wiki article on my user's page, https://wiki.archlinux.org/index.php/User:Thisoldman. It's only a beginning and I don't know when I'll be able to flesh it out more.
Edit: I may be wrong but either pixel size or point size could be specified by a user for scalable fonts (TrueType, OpenType and Type1 fonts). These fonts have no particular pixel size for which they were designed.
Last edited by thisoldman (2013-01-12 17:56:12)
Offline
You should summarize that and put it on the wiki.
Never argue with stupid people,They will drag you down to their level and then beat you with experience.--Mark Twain
@github
Offline
I've been testing.
For xterm, I use Xft for my DJV Sans Mono default font:
xterm.vt100.faceName: DejaVu Sans Mono:style=Book:size=8
The size of a 24 line, 80 column window, sans titlebar, is 564 pixels wide by 316 pixels high.
To duplicate the font height with XLFD I used:
-misc-dejavu sans mono-medium-r-normal--0-80-0-0-m-0-iso10646-1
When I check that font string with xlsfonts, it spits the identical string back to me. If I get the double-long listing with 'xlsfonts -ll', the 'FONT' is shown to be:
-misc-dejavu sans mono-medium-r-normal--11-80-100-100-m-70-iso10646-1
Using either of those above two incantations for a 24L by 80C xterm, the window size becomes 564 by 364. Two pixels per line are added when using XLFD. The added pixels are due to increased leading, or space between the lines. A dollar sign, $, with either the Xft or XLFD rasterization is ten pixels high.
Setting pixel size to 8, XLFD sets the point size to 58, giving a very small xterm window, 404 by 244 pixels. The dollar sign is reduced to seven pixels high. Many glyphs become illegible and some words become unreadable. So for TrueType fonts, it seems best to multiply the point size desired by ten, place that value in the point size field and let the pixel size fall where it may.
If the wildcard or zero notation works for other sizes and other TrueType and OpenType fonts, it makes the XLFD notation for these scalable fonts a little easier to type. This notation works on the command-line for xterm:
-*-dejavu sans mono-medium-r-normal--*-80-*-*-*-*-iso10646-1
Wildcards on DejaVu didn't work when I tried to abbreviate multiple fields, I had to make sure all fourteen fields were present. This is different from what I found using the bitmapped "fixed" font, where multiple fields could be concatenated into a single wild card.
So for TrueType fonts, it seems best to multiply the point size desired by ten, place that value in the point size field and let the pixel size fall where it may.
If I want DV Sans Mono without anti-aliasing, I still find Xft easier:
xterm.vt100.faceName: DejaVu Sans Mono:style=Book:size=8:antialias=false
As a side note, xterm has a scaleHeight resource, the command-line option is '‐sh'. This allows one to adjust the line height by a multiplier ranging from 0.9 to 1.5. Using 0.9, I was able to get the row height difference between XLFD and Xft down to 1 pixel per line; XLFD still showed greater leading than Xft.
Last edited by thisoldman (2013-01-13 15:11:55)
Offline
I've got a major portion of an article on XLFD posted on the wiki. Any help for correcting mistakes, creating clarity and improving language will be appreciated.
Edit: I forgot the link. https://wiki.archlinux.org/index.php/X_ … escription
Last edited by thisoldman (2013-01-16 10:45:00)
Offline
I've got a major portion of an article on XLFD posted on the wiki. Any help for correcting mistakes, creating clarity and improving language will be appreciated.
That's a really good article in my opinion. Maybe it's worth adding a cross reference link to Font Configuration article when you mention the Xft system?
:: Registered Linux User No. 223384
:: github
:: infinality-bundle+fonts: good looking fonts made easy
Offline
Pages: 1