← Back to context

Comment by npalli

6 months ago

This is a Bjarne issue. For personal reasons he uses proportional fonts in his code blocks (in his texts) instead of monospaced and the code snippets always look bad. I guess he is stuck in his ways, just have to work around this ugly look.

Looking at how aesthetically charming the C++ syntax is, I wouldn't expect anything less than Comic Sans code blocks

> This is a Bjarne issue.

I have come to find this category of error to be distressingly large.

  • Bjarne has nothing to do with the HTML/CSS pages of the ACM site, which select for displaying the code the default monospace font that is configured in the browser of the user.

    If a proportional font is used for rendering, the most likely cause is that the user has not configured the default monospace font in the settings of the browser.

This is not a Bjarne issue.

The font is selected by the HTML/CSS of the ACM site, not by Bjarne.

There may be a bug in the CSS of the ACM site, but I think that it is more likely that anyone who does not see correctly formatted code on that page has forgotten to open the settings of their browsers and select appropriate default fonts for "serif", "sans serif" and "monospace".

As installed, most browsers very seldom have appropriate default fonts, you normally must choose them yourself.

In this case, whoever does not see a monospace font, which is mandatory for rendering the code on that page, because the indentation is done with spaces, which become too narrow if rendered with a proportional font, must have that proportional font set in their browser as a default monospace font, so they should correct this.

No, the formatting was definitely botched. It should look much better than it does even in a proportional font.

  • Agreed. I wouldn't mind if, say, end of line comments weren't perfectly aligned. There's zero indentation so things like

         for (string line; getline(is,line); )
      s.insert(line);
    

    are hard to visually parse.

    • This must depend on some settings of the browser and perhaps also on the locally installed typefaces.

      On my Firefox on Linux, this HTML page is not rendered with any custom typefaces, but it uses those specified by me as defaults for serif/sans serif/monospace.

      The C++ code is rendered in my browser with my default, i.e. with JetBrains Mono and there is nothing weird.

      The code quoted by you is indented as expected, not as in your posting.

      On my computer, I have mostly typefaces that I have bought myself and which are seldom encountered in most computers. I do not have any of the typefaces that are typically specified in CSS rules, i.e. none of the typefaces that can be found in default installations of Windows, Linux or MacOS.

      So perhaps there is a bug in their CSS at the definition of "wp-block-code", which on other computers selects a bad typeface that is proportional, so that the narrow spaces make the indentation disappear. (Their wp-block-code says "font-family:inherit" and I have not searched further to see from where the wrong font-family may be inherited.)

      Here, perhaps because that bad typeface cannot be found, the browser uses my default monospace font and the code is displayed fine.

      Or else, perhaps you have not set in your browser a proper default for monospace fonts and it just takes Arial or other such inappropriate system font even for monospace.

      1 reply →