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

Readability: lower the code font size #3873

Open
PrecureKamiyu opened this issue Apr 28, 2024 · 4 comments
Open

Readability: lower the code font size #3873

PrecureKamiyu opened this issue Apr 28, 2024 · 4 comments

Comments

@PrecureKamiyu
Copy link

PrecureKamiyu commented Apr 28, 2024

In my case, the code font always looks bigger than normal font. That is very annoying, actually. And in principle, code font should be smaller than normal text.

Is it possible for users to change the code font size separately? Or just make the code font size smaller in general?

This is how it looks on original website:

image

And this is omnivore web view:

image
@jacksonh
Copy link
Contributor

I just checked and it uses the same size as the readable text, it does use a different monospaced font though. Is it the inline text that looks bigger to you or the code block below? I can't tell any difference

@PrecureKamiyu
Copy link
Author

I just checked and it uses the same size as the readable text, it does use a different monospaced font though. Is it the inline text that looks bigger to you or the code block below? I can't tell any difference

@jacksonh In the view of omnivore, there are more characters in a single line for normal text font, compared to the original website (it displays 3 more words, to be exact), but as for the monospaced font, it even needs a line break to display a line of code snippet, while no line break is needed for original website to display one line of code (the getaddrinfo code line).

It looks that monospaced text font and normal font have different font size.

@quinncomendant
Copy link
Contributor

I just came here to suggest the same change. With code, I think it's safer to err on the side of being too small, so more code fits on the screen.

Here's what I see on my iPhone. The monospace font-size appears larger in relation to the proportional font. The padding for inline elements could be reduced too, because that contributes to the visual weight of the code.

IMG_8936

@quinncomendant
Copy link
Contributor

It just occurred to me that this issue is more complicated than just finding the “correct” font sizes. The visual size of typefaces vary, so some combination of monospace + proportional fonts will have a different scale relationship. For example, the current monospace font size might look fine next to text displayed in the Lexend font, but looks disproportional next to Source Serif or Crimson Text.

Perhaps the solution is to hardcode a list of relative font sizes to use for the monospace type depending on which Reader Font is selected, for example:

func getMonospaceFontSize(for readerFont: String) -> String {
    let fontSizes: [String: String] = [
        "Lexend": "100%",
        "Source Serif": "80%",
        "Crimson Text": "80%"
        // Et cetera…
    ]
    
    return fontSizes[readerFont] ?? "90%"
}

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

3 participants