1
0
int10h-oldschoolpc-fonts/ratio.txt

93 lines
2.9 KiB
Plaintext

== Introduction ==
In classic IBM PC text mode, the graphics card stretches the font
such that it fills the screen.
A 9x16 font over 80x25 columns is displayed as a 720x400 image.
Assuming a 4:3 monitor as typically was present in the days, this
leads to a pixel aspect ratio of 20:27.
Font size Image size aspect decimal inverse
------------------------------------------------------------
8x8 640x200 5:12 0.42 2.40
8x14 640x350 35:48 0.73 1.37
8x16 640x400 5:6 0.83 1.20
9x16 720x400 20:27 0.74 1.35
To faithfully recreate the same visual look as such a monitor would
show, this aspect ratio needs to be applied when making use of the
font.
== Application support for stretching ==
For cool-retro-term, there is a "Font Width" slider in the settings;
set it to 74%, 83%, or whatever is necessary. (Notice the pattern of
the "decimal" column of our table.)
For xterm, a fontconfig matrix can be specified like so:
xterm -fa "Px437 ATI 9x16:matrix=0.74 0 0 1"
xterm -fa "Px437 ATI 9x16:matrix=1 0 0 1.35"
One can either horizontally compress the glyphs, or vertically
stretch them to get to the result. The compress/stretch action
influences how many characters will be visible in a fullscreen
setting, so the basic font size may need to be adjusted.
xterm -fa "Px437 ATI 9x16:size=32:matrix=0.74 0 0 1"
xterm -fa "Px437 ATI 9x16:size=24:matrix=1 0 0 1.35"
produce an equivalent result.
Extra caveat: When using a matrix, you should also specify the -fd
parameter *and* specify the same matrix inside the -fd font
specification. Otherwise, CJK characters will be rendered in a
different size than the main characters. For a stretching matrix like
1/1.35, not specifying -fd and, as a result, having smaller CJK chars
is not as bad a problem as having bigger truncated CJK chars with a
compressing matrix like 0.74/1.
== Application-independent approach ==
Not all programs support specifying a matrix or a scaling factor.
Under systems using fontconfig (such as Linux distributions),
it is possible to override the stretch for an existing font
like so (~/.config/fontconfig/fonts.conf):
<?xml version='1.0'?>
<!DOCTYPE fontconfig SYSTEM 'fonts.dtd'>
<fontconfig>
<match target="font">
<test qual="any" name="family">
<string>Px437 IBM VGA 9x16</string>
</test>
<edit name="matrix" mode="assign">
<times>
<name>matrix</name>
<matrix>
<double>0.73</double>
<double>0</double>
<double>0</double>
<double>1</double>
</matrix>
</times>
</edit>
</match>
<dir>~/.fonts</dir>
</fontconfig>
== Framework-independent approach ==
The int10h project offers font files that have their aspect
correction applied at the font level. As a result, they won't need
support from fontconfig or applications at all. These font files are
provided in the
int10h-oldschoolpc-fonts-stretched
subpackage in openSUSE.