I have already presented my typographer in Habré. Since then, it has been somewhat updated: I added docks, a diff of the typed result on the site and a modest web api .
Roughly speaking, this is subjectivity. But if suddenly you have a poppy, then, most likely, you noticed that when typing you have a double hyphen and "simple" quotes are replaced by other characters. The same thing happens in Word and other word processors.
The fact of the matter is that before the general web the texts were made out manually. Probably, the authors of the fonts were very boring and they decided to dilute their sets with a bunch of useless dashes, small letters and any other garbage, which already now can’t fit in any way, but it looks very nice.
Here, in fact, the whole argument: "such a text is nice to read." As a rule, the majority of foreign information resources, like medium.com , pay great attention to ensuring that the text is designed according to all canons.
Typus is a local Python typographer. For a very long time, I used Lebedev's web service, but the delay in the response, which invariably appears in working with a remote api, just killed. So I decided to write my own.
(c)
with special charactersOf course, all this is configured (locally). A more or less complete list with examples is available at the docks .
To better understand what is happening, you can play around with the demo . “Restored” parts will be highlighted (not always perfect).
"I don't feel very much like Pooh today..." said Pooh. "There there," said Piglet. "I'll bring you tea and honey until you do." - AA Milne, Winnie-the-Pooh “I don't feel very much like Pooh today…” said Pooh. “There there,” said Piglet. “I'll bring you tea and honey until you do.” — A. A. Milne, Winnie-the-Pooh
It is worth noting that the result depends in part on the headset you choose. For example, in some there is no short non-breaking space, and in monospace many things lose their meaning.
Well, as api. In fact, I did not know what to call it. But it can be useful:
$ curl --data "text='foo'&lang=ru" https://byashimov.com/typus/api/v1/ { "text": "\u00abfoo\u00bb" }
The source code of the entire site (and api as well) is available on github .
He described in some detail what and how it works, until the heap a lot is covered with the tests. So far only broken English.
Source: https://habr.com/ru/post/320174/
All Articles