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

Font in docs does not allow box drawing characters to align properly #3917

Open
ollien opened this issue Nov 30, 2024 · 5 comments
Open

Font in docs does not allow box drawing characters to align properly #3917

ollien opened this issue Nov 30, 2024 · 5 comments
Labels
bug Something isn't working

Comments

@ollien
Copy link

ollien commented Nov 30, 2024

The following docs comment does not render with the lines aligned on the docs page

  /// ```text
  /// ┌─────────┬──────────────┐
  /// │         │ Output       │
  /// ├─────────┼──────────────┤
  /// │ Stage 1 │ Wibble       │
  /// │ Stage 2 │ Wobble       │
  /// │ Stage 3 │ WibbleWobble │
  /// └─────────┴──────────────┘
  /// ```

This renders as

image

I think this is an issue with the Ubuntu Mono font used, as if I remove it from the font-family list in my browser, it renders without issue.

@ollien ollien added the bug Something isn't working label Nov 30, 2024
@ollien
Copy link
Author

ollien commented Nov 30, 2024

I was able to work around this by specifying the font manually in my comment

  /// <pre><code style="font-family: monospace;" class="language-plaintext">┌─────────┬──────────────┐
  /// │         │ Output       │
  /// ├─────────┼──────────────┤
  /// │ Stage 1 │ Wibble       │
  /// │ Stage 2 │ Wobble       │
  /// │ Stage 3 │ WibbleWobble │
  /// └─────────┴──────────────┘</code></pre>

@lpil
Copy link
Member

lpil commented Dec 1, 2024

Oh strange! Why does it not align correctly? The font is monospace, right?

@joshi-monster
Copy link
Contributor

joshi-monster commented Dec 1, 2024

Ubuntu Mono would support box drawing characters:
image

(rendered in Firefox on Linux, using Ubuntu Mono downloaded as a zip from Google Fonts).

the @font-face we use in the docs index.css however specifies specific character ranges to split the font into multiple @font-face definitions (for cyrillic, greek, latin.) None of those ranges include the box drawing characters, so the browser falls back to a different font for them (for me this would be Liberation Mono).

@inoas-nbw
Copy link

inoas-nbw commented Dec 2, 2024

It does so to reduce size (the font is shipped for every generate docs), but we could include the ranges

@lpil
Copy link
Member

lpil commented Dec 2, 2024

Do we want to include those? What would the size cost?

We could also use the system monospace font instead of a custom one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants