Double2emspace.py

Here is a script coming out of a discussion on the mailing list. The question was how to search and replace double spaces with single spaces. This led to various suggestions, a simple one being to use the Search/Replace function in Scribus.

Some side comments in the thread were about the propriety of double versus single spaces between sentences. What you can easily find in a web search is that, prior to the invention of typewriters, publishers came up with their own conventions or styles as to dealing with spacing and other typographic features. One convention was to use an em space between sentences. When typewriters came along, presumably in a form of emulation, it was recommended to put two spaces between sentences in a paragraph.

Currently, it has become a much more common practice, especially outside the US, and certainly on the internet to only use single spaces, thus there is some utility of the following script. If you truly wanted to have em spaces between sentences, you might want to add logic that also includes converting single spaces between sentences to em spaces. This is a bit tricky, since then you must begin with the ends of sentences, which would include periods, question marks, exclamation points, and maybe even quotation marks. So a period followed by a space converts the space to em space, then any subsequent space would be deleted.

Here is the script, and after it you can see the outcome after using it.

Discussion
Look at this output from the script applied to some sample text. This is DejaVu Serif Book. It's worth mentioning that a number of fonts do not have an em space, so what you see in Scribus is the small rectangle indicating a missing glyph.



There are four sentences here, so 3 instances of spacing between them. Before Being we see a single space. Before Fifty this is an em space, and finally before At we have a double space, keeping in mind this is a proportional font.

My personal opinion is that an em space is aesthetically much too wide for modern typography, and if anything may interfere with reading a bit – see how that Fifty seems to just hang out there on the end of that line? Comparing the single and double space in this proportional font, while it isn't an obviously unattractive appearance that two spaces have, there does not seem to be any aesthetic benefit of having the extra space, and I don't see that a single space seems to crowd the sentences together.

So, having gone through this exercise, you may prefer to use this script only for changing double spaces to a single. In that case you might just delete or comment out the following lines for the valueDialog, and maybe name the script double2singlespace.py: Like others in this family of text-processing scripts, you can Undo the effects, but you have to click Undo once for each instance that was changed.