Hi all,
For a practical session of an OCaml class, we have students program a game using Graphics. We display text and we set the font size with:
set_font "-*-fixed-medium-r-semicondensed--50-*-*-*-*-*-iso8859-1";
because set_font_size
is a no-op (at least on my machine). I did not invent this complex string: I copied it from https://openclassrooms.com/forum/sujet/ocaml-changer-la-taille-du-texte-avec-graphics .
Unfortunately, it looks like this font is not available by default on a student’s ArchLinux machine. Does someone know which package to install on ArchLinux or a better way to set the font size that is more portable?
Thanks!
perry
October 22, 2018, 6:00pm
2
It may be that you just are missing that particular font. (That string is an old-style X11 font specification string. If a font that matches it is missing, it will fail.)
I know, I’m late, but for someone else (e.g. me but 2 hours ago) it could be useful.
I was able to change the font to any element listed in the following files (and none other, even though the font files are there)
cat /usr/share/X11/fonts/100dpi/fonts.alias
cat /usr/share/X11/fonts/75dpi/fonts.alias
a short extract of 100dpi/font.alias
lucidasans-bolditalic-8 -b&h-lucida-bold-i-normal-sans-11-80-100-100-p-69-iso8859-1
lucidasans-bolditalic-10 -b&h-lucida-bold-i-normal-sans-14-100-100-100-p-90-iso8859-1
lucidasans-bolditalic-12 -b&h-lucida-bold-i-normal-sans-17-120-100-100-p-108-iso8859-1
lucidasans-bolditalic-14 -b&h-lucida-bold-i-normal-sans-20-140-100-100-p-127-iso8859-1
lucidasans-bolditalic-18 -b&h-lucida-bold-i-normal-sans-25-180-100-100-p-159-iso8859-1
lucidasans-bolditalic-24 -b&h-lucida-bold-i-normal-sans-34-240-100-100-p-215-iso8859-1
then the following set_font
worked.
set_font "-b&h-lucida-bold-i-normal-sans-14-100-100-100-p-90-iso8859-1";
set_font "-b&h-lucida-bold-i-normal-sans-17-120-100-100-p-108-iso8859-1";
set_font "-b&h-lucida-bold-i-normal-sans-20-140-100-100-p-127-iso8859-1";
set_font "-b&h-lucida-bold-i-normal-sans-25-180-100-100-p-159-iso8859-1";
set_font "-b&h-lucida-bold-i-normal-sans-34-240-100-100-p-215-iso8859-1";
note : to test if a font works, you just need to call set_font
and not actually display a text, which helps when going through a lot of testing
This is related to the following PR on Graphics : Use modern X fonts instead of X core fonts by nchataing · Pull Request #38 · ocaml/graphics · GitHub
NOTE : I’m on Fedora not on Arch’