Open ThePillenwerfer opened 3 years ago
DOSBox-X could automatically use whatever the host system uses if it linked to and used the fontconfig libraries to enumerate them. That way it's entirely up to the font configuration file everybody else on the same system uses.
The current printer code will read /usr/share/fonts/liberation
in addition to /usr/share/fonts/liberation-<whatever>
. I added /usr/share/fonts/liberation
earlier in the code as an alternative path (not yet mentioned in the Wiki) but it should be changed to /usr/share/fonts/truetype/liberation
instead. (if font paths are more complicated than this then a library like fontconfig may be used instead).
The printer code will also try to read fonts from the FONTS directory, and I am not sure why the fontpath option was commented out in the code. I think this option can be reactivated to allow the user to specify a custom path.
It certainly wouldn't be my choice of printing font, though it could be argued that it has a certain retro dot-matrix appeal, but would be better than nothing.
I think this change would be within my limited capabilities but I don't know how to do Pull Requests nor if such use is permitted by the font's licence.
@ThePillenwerfer Yes, perhaps the TTF font (or unifont_jp-13.0.05.ttf) can be bundled with the DOSBox-X package similar to FREECG98.BMP, and used as the last resort for the purpose of printing etc.
@ThePillenwerfer I think the main problem for bundling this TTF font is its size - the file is certainly not small so it will increase the package size. Instead, I think using the internal TTF font used by the TTF output as the last resort is probably better, as it won’t increase the package size at all. In any case, thanks for the suggestion.
I hadn't checked the size of unifont and agree it's stupidly big. The internal font has the other advantage of looking better too.
@ThePillenwerfer This is now done in #2135.
With the latest code the printing function will use the same TTF font as the current TTF font for the TTF output (if TTF output is active) by default, including support for both SBCS and DBCS (Chinese/Japanese/Korean) languages. This function can be disabled with either ttf.printfont=false
config option or unchecking the "Use current TTF font for printing" menu option ("Video" => "TTF options"), or if you use a non-TTF output. So basically WYSIWYG (What You See Is What You Get) in such case.
There is now also TTF font SarasaGothicFixed.ttf in the repository, which supports CJK characters and I believe it certainly looks better than the Unifont TTF font. It is free and comes originally from https://github.com/be5invis/Sarasa-Gothic. A screenshot:
A screenshot using the SarasaGothicFixed TTF font with the default code page (437):
Just a quick point to those in charge of documentation.
The Wiki currently states that on Linux the recommended fonts are in
/usr/share/fonts/liberation-<whatever>
. However on my Debian system they are all (except the OCR and Script ones) in/usr/share/fonts/truetype/liberation
. Maybe a note could be added saying what distro the instructions refer to and advising people with different ones to check and make appropriate links to them in~/.config/dosbox-x/FONTS
'I make no claims to be a programmer, and certainly don't speak C, but looking at the code of
printer.ccp
it looks as though at one time it could readfont_path
from the.conf
file but it has been commented out. If that could be restored without messing anything up the linebasedir = "/usr/share/fonts/";
could be changed tobasedir = font_path
and the individual fonts changed from the likes offontName = basedir + "liberation-serif/LiberationSerif-Regular.ttf";
tofontName = basedir + LiberationSerif-Regular.ttf";