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

Serif Font when previewing code syntax #11

Open
5 of 6 tasks
0xCLARITY opened this issue Oct 16, 2019 · 6 comments
Open
5 of 6 tasks

Serif Font when previewing code syntax #11

0xCLARITY opened this issue Oct 16, 2019 · 6 comments
Labels
bug Something isn't working

Comments

@0xCLARITY
Copy link

Problem description

Please describe the issue concisely in here. In case of an error: Walk us through the steps you took to get there. What happened? What did you expect to happen?

Previously, code syntax used to be in a monospaced font when creating/editing a card. It now appears to be in Times New Roman or some other serif font.

Perhaps I'm missing the font used for previewing the code syntax on my computer now? This wasn't a problem previously, but something must have changed with my setup recently.

weird-font

Checklist

Please replace the space inside the brackets with an x if the following items apply:

  • I've restarted Anki to see if it helps
  • I've verified that I use the latest version of the add-on by redownloading it from AnkiWeb
  • I've verified that I use the latest version of Anki by checking at https://apps.ankiweb.net#download
  • I've tried to disable other add-ons to see if there are any interactions present
  • My issue disappears when I hold shift while starting Anki. (It does not)
  • I've checked if anyone else reported this problem before by looking through the issue reports. I also checked to see if there is a section about known issues in the add-on description, documentation, or README.

Information about your Anki set-up

Please fill out the section corresponding with your Anki version:

If you are using Anki 2.1

Please open Anki, go to Help → About, click on "Copy Debug Info", and paste the result between the backticks below (if the button does not appear you are using an older version of Anki 2.1 and will need to update first):

Anki 2.1.15 (442df9d6) Python 3.6.7 Qt 5.12.1 PyQt 5.11.3
Platform: Mac 10.15
Flags: frz=True ao=True sv=1

Add-ons:

Search and Replace Tags (disabled)
Deck Stats (disabled)
Syntax Highlighting for Code
Night Mode (disabled)
More Overview Stats (disabled)
Progress Graphs and Stats for Learned and Matured Cards (disabled)
Frozen Fields (disabled)
True Retention (disabled)
If you are using Anki 2.0

Please open Anki, go to Help → About, find the two lines starting with Version: and Qt, and copy-paste them between the backticks below:


Please fill in details about your operating system (Windows/macOS/Linux, which version):

  • OS: macOS
  • version: 10.15

Please open Anki, go to Tools → Add-ons, take a screenshot of your installed add-ons, and paste it below:

Anki-addons

Error message (if any)

If you've received an error message, please copy and paste it between the backticks below:

@0xCLARITY 0xCLARITY added the bug Something isn't working label Oct 16, 2019
@0xCLARITY
Copy link
Author

Update:

This does not happen on my 2016 Macbook Pro running Mojave (OS X 10.14.6).

Same deck, (mostly) same extensions. Code Highlighting has the expected monospaced font.

I wonder if this is a bug with OS X 10.15?

@0xCLARITY
Copy link
Author

This looks like the same bug as: glutanimate/mini-format-pack#9

@gcohara
Copy link

gcohara commented Nov 13, 2019

I'm having a similar issue, and am also on Catalina.
It's this font during reviews as well.

@Octemull
Copy link

Octemull commented Mar 18, 2020

This looks like the same bug as: glutanimate/mini-format-pack#9

Same problem with mini-format-pack installed, on Catalina.

@Octemull
Copy link

Octemull commented Apr 12, 2020

This looks like the same bug as: glutanimate/mini-format-pack#9

Same problem with mini-format-pack installed, on Catalina.

I found a temporary solution.

Go to Tools → Add-ons → chosse "synatax highlighting for code" → View Files

Open main.py, then modify the highlight_code function.

# Actual code highlighting
def highlight_code(ed):
    [...]
    pretty_code = process_html(pretty_code) # line 415

    # Add the following line after line 415 (change font type to Menlo)
    pretty_code = pretty_code.replace("style=\"","style=\"font-family: Menlo;")
    [...]

I change the font type to Menlo. You can also change it to other types you like.

Be sure to include the font type in the Styling (shared between cards) part of your card templates. It should be something like this.

.card {
  font-family : Menlo, "PT Mono", Monaco, helvetica, arial, sans-serif; 
  ...
}

@rober-m
Copy link

rober-m commented May 22, 2020

Same problem when I upgraded to MacOS 10.15.4 from 10.14.x
(During both editing and reviews)

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