📜 ⬆️ ⬇️

Local python typographer - typus β

diff


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 .


First of all: what is it and why is it necessary?


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


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.


What does it do



Of course, all this is configured (locally). A more or less complete list with examples is available at the docks .


Demo


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-PoohI 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 

diff


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.


API


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 .


Docks


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.


Plans and in general


  1. It would be necessary to write a plugin for InDesign and Illustrator, which would communicate with the API. The idea is that you can click on to get a completely ready-to-print text in the selected text box. However, I haven’t been working with these packages for a long time, so if I’m willing, I’m waiting for your pull request)
  2. Markdown and reStructuredText support. The last, ideally, would be to screw right in sphinx-doc, because beautiful docks are nice and pleasant.

')

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


All Articles