Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Secnum overflow #111

Open
jengelh opened this issue Mar 20, 2024 · 4 comments
Open

Secnum overflow #111

jengelh opened this issue Mar 20, 2024 · 4 comments

Comments

@jengelh
Copy link

jengelh commented Mar 20, 2024

To solve overflow issues (#98) with the section headers, perform the following logical replacement. For example, in the generated output for https://eel.is/c++draft/format.string.escaped#example-1 , change:

<h1><a class="secnum" style="min-width:50pt">22</a> General utilities library <a class="abbr_ref"
href="https://eel.is/c++draft/#utilities">[utilities]</a></h1>

to

<h1 style="display: table"><a class="secnum" style="min-width:50pt; display: table-cell">22</a> <span style="display: table-cell">General utilities library</span> <a class="abbr_ref" href="https://eel.is/c++draft/#utilities" style="float: none; display: table-cell; vertical-align: bottom; text-align: right;">[utilities]</a></h1>

Where exactly this would need changing in the .rs file I don't know.

@Eelis
Copy link
Owner

Eelis commented Mar 20, 2024

The point made in #98 isn't that a different layout is desired for overflowing headers, the point made is that a narrow font that prevents headers from overflowing as much as possible in the first place is preferred.

@jengelh
Copy link
Author

jengelh commented Mar 20, 2024

I do not think that is realistic. Every time you pick a narrower font to accomodate one user, nature will produce another user with an even narrower window (and one quickly runs out of suitable fonts playing that game).
So you'll have to deal with overflow anyway (and one option would be to set a fixed page width like in PDF and potentially force scroll bars onto the user if they just zoom in enough on the text).

@Eelis
Copy link
Owner

Eelis commented Mar 20, 2024

"So you'll have to deal with overflow anyway" -- The point of using a narrow font isn't to eliminate overflow, it's to reduce the frequency of overflow. Using the Computer Modern font from your PR would significantly increase the frequency of overflow.

"one option would be to set a fixed page width like in PDF" -- As #98 explains, my intention is for cxxdraft-htmlgen to try to accommodate narrow window widths as best as possible without degrading to scrollbars. The idea is to leverage HTML and make optimally accessible pages, rather than make awkward poor quality literal paper-pages-to-web conversions. If people want the latter, they can just open the PDF in their browser.

@jengelh
Copy link
Author

jengelh commented Mar 20, 2024

Computer Modern font from your PR would significantly increase the frequency of overflow

Compared to Noto, perhaps so.

But IMO, the HTML would not generally fare worse than the PDF already does. It the current HTML rendering, paragraph text accomodates a little more characters per line than the PDF does, so that's already a reduction of chance of overflow. On the other hand, I do notice that

uses a lot more padding between secnum and title than the PDF does (fixable).

It will be difficult to find a font (grand-)family that offers both faces and variations of narrowness; most font families excel at 0 or perhaps 1 thing of

  • multiple coherent faces (e.g. CM: Serif, Sans and Mono)
  • or have lots of weights (e.g. Mplus: 100 to 900)
  • or have lots of variations in narrow-ness (e.g. NK57 Monospace: Condensed, Semi-Condensed, Book, Regular, Semi-Expanded, Expanded)

(Noto is exceptional in that it has both the weights and the faces, though cxxdraft does not exercise weights so much that it would matter.)

If it still matters, there's the unpopular opinion: using a totally different fontface for h1..h4 that does not fit with the rest of the document.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants