Part of your problem is a mix of a rather narrow line width coupled with a rather large font. With those settings, you can expect any standard word processor to run into problems properly spacing justified text, simply because there may not be sufficient possibilities to hyphenate - that’s always rather random, but with fewer words on a line, you reduce the chances for hyphenation being possible.
Add that LO, like MS office, is an office suite. They are, or at first were, not intended as a tool for graphic designers to format books, but as tools for writing letters, bills, reports, etc. If people want to use Word or Writer for professional lay-out work, they shouldn’t complain. Professional publishers allow writers to offer their work in docx, and sometimes also in odt format, but they will very likely produce the book with more advanced software.
It seems to me that the issue is brought about because Writer does not perform “kerning across space”. (Cf. ajlittoz’ mention of “shrinking inter-word spacing” in the comments. There may be a different technical term for this. IDK)
In the third line, the capital J of the chosen font has a descender hook, so kerning in .-space-J makes sense (and occurs when you remove the space). The same thing is even more apparent on the fourth line, with .-space-T. On @ajlittoz’ chosen Liberation serif
font, the J hook is on the baseline (no descender), which does not give incentive for kerning with the period character.
Variable spacing between words cannot be sensibly avoided with fully justified layout. It can be graphically improved in a number of ways. E.g.:
- Adjusting the width of individual words (inserting microspaces between each letter)
- Hung punctuation (where characters with little “vertical weight” are allowed to protrude into margin area)
- Kerning across space (kerning is used to remove the appearance of space between certain character pairs,so it could conceivably also work to reduce an apparent “oversize” spacing also where there should be a space).
Those techniques are elements of advanced typography. Apparently, they are not implemented in Writer. I would not expect them to be. Also apparently, “another program” does what you need. In DTP applications the features may be present (haven’t seriously used any DTP app for years, so if I ever knew about where to find settings for this, I will have forgotten now).
You may want to use your “another program”. Otherwise, professional typesetting may be called for. Some things require the human touch.