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

Underscores in Ace Editor are not rendered with Ace default CSS #1061

Closed
davidomarf opened this issue Oct 8, 2019 · 7 comments · Fixed by #1062
Closed

Underscores in Ace Editor are not rendered with Ace default CSS #1061

davidomarf opened this issue Oct 8, 2019 · 7 comments · Fixed by #1062

Comments

@davidomarf
Copy link
Contributor

Hi. I opened an issue in another repository (rust-lang/rust-by-example#1279) thinking it belonged there.

However, I found mdBook, and followed the documentation, which is also implemented with mdBook, and found the same problem:

image

@davidomarf
Copy link
Contributor Author

I zoomed in to a 110% and they're rendered:
image

So I should also add the resolution as reference: 1366 x 768.

Even if they're rendered, I still make the suggestion of the font to be replaced.

@ehuss
Copy link
Contributor

ehuss commented Oct 8, 2019

It sounds like you have a bad font installed? What happens if you uninstall it? Or install one of the other fonts that have higher priority?

It's also helpful if you include which browser, OS, versions, etc. that you have tried.

@davidomarf
Copy link
Contributor Author

Sorry, I didn't wanted to fill this issue with the same content I wrote in the other issue I linked.

I'm copying it directly from there, making some changes to remove irrelevant information.

I just tried to see the same pages in Firefox and found no problem.

The fact that the zoom fixed the problem in Chrome, makes me think that it's also the resolution that is causing problems.


font attribute

This is the default style for Ace blocks:
image

When supressing the font attribute in .ace_editor, the underscore renders properly:
image

WhatFont reports that the font used is monospace:
image

However, when I force monospace to be the chosen font, it works properly:
image

I checked for the installed functions in my OS. This is the result:

$ fc-list | grep -i "Monaco"                                                                                                                               
## nothing

$ fc-list | grep -i "Menlo"          
## nothing

$ fc-list | grep -i "Ubuntu"         
## nothing

$ fc-list | grep -i "Consolas"       
## nothing

$ fc-list | grep -i "source-code-pro"
/usr/share/fonts/adobe-source-code-pro/SourceCodeVariable-Roman.otf: Source Code Variable:style=Light
## ... several more lines

'source-code-pro', monospace

Apparently, that's the problematic combination. If I only leave source-code-pro in the list of fonts to use, it defaults to serif:
image

'Source Code Pro'

If I replace 'source-code-pro' with 'Source Code Pro', it renders properly:

image

Proposed solutions

a. Replace 'source-code-pro' with 'Source Code Pro' with a script (since it's not provided and generated from ace.js script).
b. Add !important to code { font-family } in general.css


If needed or relevant, this is my environment:
OS: Manjaro 18.1.0
Chrome: 77.0.3865.90

@davidomarf
Copy link
Contributor Author

I originally thought you didn't read the linked issue, but reading your comment again, makes me think you did.

Should installing the other higher-priority fonts be considered an appropiate fix? I feel this is a very particular case, that affects Chrome on (at least) 1366 x 768 displays, and when you don't have either of Monaco, Menlo, Ubunto Mono, or Consolas font installed.

Dylan-DPC-zz pushed a commit that referenced this issue Oct 11, 2019
@itsmeolivia
Copy link

itsmeolivia commented Nov 21, 2019

I'm running Chrome Version 78.0.3904.108 (Official Build) (64-bit) on a linux 4.19.67-2rodete2-amd64
OS and I do not see underscores either. I can open a new issue if you prefer. I can see the underscores in the book but I cannot see it in the interactive playground in the rust by example.

@ehuss
Copy link
Contributor

ehuss commented Nov 22, 2019

@itsmeolivia Which version of mdbook are you using? Which linux distribution is that?

@albfan
Copy link

albfan commented Nov 27, 2019

I think this is related ajaxorg/ace#4000 (comment)

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

Successfully merging a pull request may close this issue.

4 participants