adambard/learnxinyminutes-docs

80 characters won't fit sometimes one line in the html output

Opened this issue · 2 comments

instead of using 1em, if you use 0.99em as the font-size, that change will make the lines fit in.
for example, in the Erlang page.

% followed by a pattern (in parentheses), and the body consists of a sequence of

will have the last word "of" in a new line.

This needs to be tested to determine the current situation.

@eksperimental @divayprakash This likely depends on the web browser's setup. Though my observations below relate to Firefox in an instance of Linux Debian 12/bookworm, I speculate there equally is an option to adjust other web browsers, too.

The underlying potential pitfall is the selected font and its width of characters which may vary (proportional fonts), or not (non-proportional fonts). After all, a selection of e.g., Courier 12 pt over Courier 14 pt only relates to corpus size/x-height of the glyphs, however does not account for potentially different width (e.g., Courier 12 pt vs DejaVu Sans Mono 12). Both (and other) parameters contribute to the ease of reading.

According to Change the fonts and colors websites use, it is possible to pick different fonts for regular text, and about snippets of code in monospace. In Firefox' GUI, select Settings -> General -> Language and Appearance -> Fonts -> Advanced for this widget:

setup

An adjustment of the parameters affects the display right after closing the above widget. To illustrate the result for a section about Fortran (at present, the code block stays within the 80 character/line limit), below an example with Bitstream Vera Sans Mono, 12 pt (provided by the OS here):

example_01

or with Inconsolata, 12 pt (source):

example_02

While this could close this thread of 5+ years, maybe it is worth an additional line in the documentation of the project or/and the landing page (https://learnxinyminutes.com/). What do you think?