📜 ⬆️ ⬇️

Crypt fonts

image I don’t need much from monospaced fonts. Adequate Cyrillic support. For programming - no zamylivaniya. The ability to distinguish between 0 (which is zero) and O. The ability to distinguish between I (which i), l (which is L) and | (which or). To work in the console two-paneled - support for pseudographics. However, in the modern world there are not many such fonts. Where do you get them from?

Caution! Under the cut - continuous anachronisms.


This thought gave me no peace for quite some time. A lot of options were tried, and none of them did not suit. Yes, there is Terminus, but it is impossible to look at its implementation of the Cyrillic alphabet without tears, there is IBM Nouveau - it is almost what is needed, but something is wrong for my eyes. Various options for converting decent proportional fonts to monospace acceptable results did not. The idea of ​​comfortable fonts was postponed for a while. But not forever.
')
Today it dawned on me - after all, how well-quality small fonts were drawn in the localization under DOS! And the pseudo-graphics there is beautiful as nowhere else. It remains only to extract them from there, and to adapt to modern realities.

After downloading keyrus.com and another five localizers, I began to experiment. Disassembling the locators to find font shifts seemed like a thankless task. I also refused the thought of writing a quick ripper, since the only thing I remembered was that the zero-character glyph bitmap in 99% VGA fonts is 16 zero bytes, and I was not sure about the results of this tearing out because of a guaranteed pile of garbage on the output.

I had to arm myself with dosbox and acquaintances from the mid-90s utilities. With their help, the desired fonts
were mined without difficulty. Unfortunately, some of those russifiers that could be found were passed through the then-packaged executable files. Spend no time on them.

image


Pulling out the fonts, I reached into Linux to write a converter. As a target format - no longer remember why, BDF was chosen. The converter itself turned out to be completely trivial - even the glyph bitmaps did not have to be modified in any way, so I don’t post its code. The only question that took some time was the search for the conversion table from CP866 to Unicode, which could be quickly inserted into the C code.

The result in BDF - with a few modifications - turned out to be quite acceptable.

image


Both in the terminal and in the GUI editors (for example, Sublime Text 2). Under Linux, moreover, it turned out to be the best option, since I did not find the ability to disable anti-aliasing only for gnome-terminal. Yes, and the absence of setting the line spacing can play a joke with pseudo-graphics - vertical lines will be broken when using ttf.

But ... Damn, I wanted to get these fonts not only under Linux, but also on a poppy, since I have to work simultaneously in two OSs. But poppy - alas and ah - does not support BDF. We start to dig deeper.

Attempts to generate valid ttf with raster glyphs failed. Why - I still do not know, it requires a thoughtful study of the materiel.

In order not to mark time - I started experimenting with vectorization. It was obvious that trying to trace 8x16 size glyphs would result in no acceptable result. It is necessary to scale up. To write the resayzilka - laziness. In the open spaces of the network, what was needed was found - a console utility bdfresize. Collected, checked performance, scaled to 32x64.

image


Got into the fontforge to trace. For tracing used potrace with the parameters "-z white -a -1". I did not select the parameters myself - as was said in the network, “this will split the diagonal pixels and curves”. To say it in Russian so that it sounds adequate, I, unfortunately, find it difficult.

The result of the trace without additional edits turned out to be square-nested, but without artifacts. Exactly what I wanted to get.

image


At this stage, all that remained to be done was to generate a ttf and check on the Mac. In the standard terminal, the terminal with the Midnight Commander, and in the text editor, everything looked no worse than under Linux (with anti-aliasing turned off, of course).

I decided to stop at this - my typewriters were calmed down, and I received satisfaction both from the result and from the quest passed.

I do not post the results of the conversion, since for me the legal aspects in this situation are not clear. I am sure that everyone who has read this far is able to get the same fonts, if there is a desire.

PS: Under the OS, which currently occupies a dominant position on the desktop market, the results were not checked due to the lack of such a possibility.

UPD: Converter, sample bdf and ttf posted on ifolder.ru/28488918

The author is not responsible for the quality of the converter code. Attempts to comb any way was not undertaken.

Source: https://habr.com/ru/post/137544/


All Articles