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

crate name is too small #131589

Closed
Sherlock-Holo opened this issue Oct 12, 2024 · 2 comments · Fixed by #131906
Closed

crate name is too small #131589

Sherlock-Holo opened this issue Oct 12, 2024 · 2 comments · Fixed by #131906
Labels
A-rustdoc-ui Area: Rustdoc UI (generated HTML) T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. T-rustdoc-frontend Relevant to the rustdoc-frontend team, which will review and decide on the web UI/UX output.

Comments

@Sherlock-Holo
Copy link

Sherlock-Holo commented Oct 12, 2024

for example:

when read https://docs.rs/futures/latest/futures/

Image

the crate name size is big, as the crate name, this size is ok to hint people "the crate name is XXX"

however, when enter a module sub page, the crate name become too small

https://docs.rs/futures/latest/futures/future/index.html

Image

it is too small, even make me wonder if my browser is broken to render the website, so I change to firefox, but nothing changed

also we can see the up spacing is shorter than the lower spacing, tha't so strange

Image

and the source up spacing is short, but the lower spacing is too long, even three times the length

Image

@GuillaumeGomez GuillaumeGomez transferred this issue from rust-lang/docs.rs Oct 12, 2024
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Oct 12, 2024
@GuillaumeGomez
Copy link
Member

cc @rust-lang/rustdoc-frontend

@GuillaumeGomez GuillaumeGomez added T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. A-rustdoc-ui Area: Rustdoc UI (generated HTML) T-rustdoc-frontend Relevant to the rustdoc-frontend team, which will review and decide on the web UI/UX output. and removed needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Oct 12, 2024
@notriddle
Copy link
Contributor

notriddle commented Oct 12, 2024

We should probably increase the margin at the bottom of the search box, but the rest of it is determined by font metrics, and looks fine with different text.

Image

all red lines in the screenshot are exactly the same height

The problem is that, though the word source is always the same and we can manually adjust it, the breadcrumbs list is variable-sized, so making it look right in one case will make it look wrong in others (notice that the word "future" has no g, j, q, p, or y in it).

@bors bors closed this as completed in 9655858 Oct 24, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Oct 24, 2024
Rollup merge of rust-lang#131906 - notriddle:notriddle/spacing, r=GuillaumeGomez

rustdoc: adjust spacing and typography in header

Fixes rust-lang#131589

Preview: https://notriddle.com/rustdoc-html-demo-12/spacing/std/index.html

| Before | After |
|--|--|
| ![image](https://github.com/user-attachments/assets/b5c5132d-1e5e-402e-ba19-1dea9e70ea6f) | ![image](https://github.com/user-attachments/assets/72570b93-bb16-4553-9da7-fc4f29b98873)
| ![image](https://github.com/user-attachments/assets/264983f0-5aec-4120-8a03-f62e52d4360d) | ![image](https://github.com/user-attachments/assets/b6925945-95e6-4858-8e91-4cfd90c164f0)
| ![image](https://github.com/user-attachments/assets/df96bfe7-195d-4aaf-97f1-a45ade34cab2) | ![image](https://github.com/user-attachments/assets/c6fe2d57-bd8a-42aa-b3cf-4f635809b9b4)
| ![image](https://github.com/user-attachments/assets/7519faa5-d6b2-41ba-9d95-6000d1dd89d1) | ![image](https://github.com/user-attachments/assets/7233c2d6-82d9-4820-bb63-dc4776a34601)

First of all, we put 4px additional margin below the search box, and 4px margin below the header to balance it out.

The bigger problem we have to solve is making the lines look logically spaced. This is troublesome, because Fira Sans (the typeface we use here) wants to look good on average, and to avoid breaking, with text that uses [ascenders and descenders](https://www.w3.org/TR/css-inline-3/images/text-edge.png). If the text we're putting in happens to not have any, things look weird (strictly speaking, there’s hand-tuning here, because the Copy Path button messes with stuff, but the overall point is that there is no true, one perfect layout).

In order to play nicely with the font, I've tweaked the text to use that space. The word "Source" for the link is now capitalized, and the Since version number now uses oldstyle nums with descenders.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-rustdoc-ui Area: Rustdoc UI (generated HTML) T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. T-rustdoc-frontend Relevant to the rustdoc-frontend team, which will review and decide on the web UI/UX output.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants