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

Several fonts at the same time for different elements of the code #23707

Open
danielmunoz opened this issue Mar 30, 2017 · 20 comments
Open

Several fonts at the same time for different elements of the code #23707

danielmunoz opened this issue Mar 30, 2017 · 20 comments
Labels
editor-core Editor basic functionality feature-request Request for new features or functionality
Milestone

Comments

@danielmunoz
Copy link

Please create a way to give themes and/or users the possibility of using several fonts at the same time. Please check this article that describes how this is possible to achieve on the Atom editor.

https://medium.com/@peterpme/operator-mono-fira-code-the-best-of-both-worlds-191be512fd5e

In this example, this allows the user the define one font for certain elements in the code, while using another fonts as the main one for the rest of the code.

If Operator Mono and Fira Code spent a lot of time together and had a baby, you’d get something that looks like this.

@OneOfOne
Copy link

Nice feature request but dear god that's ugly...

@alexdima alexdima added feature-request Request for new features or functionality editor-core Editor basic functionality labels Mar 31, 2017
@alexdima alexdima added this to the Backlog milestone Mar 31, 2017
@alexdima alexdima removed their assignment Mar 31, 2017
@bcherny
Copy link

bcherny commented Jul 4, 2017

Another use case: It's much easier to author Markdown files if the main text uses a Serif font, but that means fenced code blocks also show up in Serif. The ability to have text in Serif and code blocks in Monospace would make authoring Markdown a really nice experience.

@ariesshrimp
Copy link

this is the thing that i miss most from using Atom. with access to the editor stylesheet i could target operator symbols with fira to get ligatures, and have everything else in operator.

@thundernixon
Copy link

Just adding that I too would love to use this for editing markdown, or for using a specific variation of a font for certain keywords (e.g. Operator Italic for words like "const" while I use something else for general code). I would just use Atom, but I like VS Code too much to switch.

@jcklpe
Copy link

jcklpe commented Jun 14, 2018

I would like official support for this. Though I've seen people get a hack around it. Not quite sure how to do it though. Trying to figure that out. They're using custom CSS extension though.

@ghost
Copy link

ghost commented Jun 24, 2018

Also related: #30925

Would love for this to be supported. Having to rely on extension hacks really sucks.

@jcklpe
Copy link

jcklpe commented Jun 24, 2018

@nealot check out the ligaturizer github repo. It's a python script that allows you to add fira code ligatures to any font you want.

Also 8 figured out how to do the custom css thing and it's not hard but all the tutorials on it are way too focused on aping a specific function of a pricy coding font instead of actually giving you just the basic gist. Also really misses the scope of all the things possible with the ability to change fonts. I've got 4 different fonts being used for different aspects of different languages. It's dope!

@TheSETJ
Copy link

TheSETJ commented Sep 6, 2018

It will be nice if we have this feature, especially with current tokenColorCustomizations setting, if we could specify font family too, it'll be great.

@jcklpe
Copy link

jcklpe commented Sep 6, 2018

I'll soon be writing an article on my website talking about my vscode set up and how I implemented multiple font families using the extension hack. Maybe this gives an example of how it can be used in a way that's not super clashy (though I still have some kinks to iron out too)

I'm using a Input Sans (a proportional programming font) for code, Fira Code with Nerd powerline additions (a mono font with ligatures) for the terminal, Aller (a clean paragraph proportional font) for single line comments, and Fira Code for block commenting (second picture, it's to make sure ASCII titles stay properly aligned)

image

image

It would be A LOT EASIER if we could just edit elements of the program using stable class names like in Atom, though I understand that Vscode names it's elements programmatically. Still! would be nice.

@TheSETJ
Copy link

TheSETJ commented Sep 7, 2018

The problem with class names using Custom CSS and JS Loader and extension hacks is that classes are based on styles (it's normal because it's about style sheets) and if various elements on a theme have the same style (for example operators and keywords in my theme are the same color and font style), they have the same class. If you want them to be different you should use tokenColorCustomizations to make a difference between them so they get different classes. It would be easier to do other customization on the look of an element using tokenColorCustomizations.

@jcklpe
Copy link

jcklpe commented Sep 7, 2018 via email

@TheSETJ
Copy link

TheSETJ commented Sep 7, 2018

I confirm that. The behaviour as far as I've seen is as follows: Whenever you change your theme many of the classes regenerate and if you add a rule to the tokenColorCustomization, a new mtkX class is generated (which X is a number). If you have styles for mtkY classes which Y > X, you should find those Ys again and modify your CSS, for classes which Y < X, they stay the same.

@TheSETJ
Copy link

TheSETJ commented Sep 27, 2018

I want to know, can we expect this feature in any future version? I see that this issue is added in backlog, but @alexandrudima removed their assignment and this issue is assigned to no one now.

@jcklpe
Copy link

jcklpe commented Sep 28, 2018

Yes, I would also be interested in hearing. I'm also having an issue with my custom font in comments as can be seen in this issue here: #59587

Here's the thing to me. Maybe the hypothetical MS dev who sees this message doesn't PERSONALLY want to be able to tweak their theme to use different fonts in different contexts.... but there's a lot of people who do, and they're going to do it whether you think it's "proper" or not. So it's better to support that behavior with an official token than for them to using these hacky temporary solutions etc.

@mikemaccana
Copy link

mikemaccana commented Jun 24, 2019

A few common use cases:

  • Emphasizing interesting / unusual / large structures. Eg, a function assignment is more complex than a string assignment.
  • Having code in a monospace font, but prose (like comments) in a regular font
  • Focusing on code rather than comments (or vice versa) by controlling font weight
  • Making constants 'pop' (more than just regular uppercase does)

@borekb
Copy link

borekb commented Oct 23, 2019

For Markdown, Caret does this beautifully:

Light:

Screenshot 2019-10-23 at 08 55 28

Dark:

Screenshot 2019-10-23 at 08 56 26

I wish this was possible in VSCode.

@jcklpe
Copy link

jcklpe commented Oct 23, 2019

@borekb it kind of is with a hack using CSS injection as I mentioned. If you'd like to see how I did it, I have a post [here]

Warning the extension I originally made does not actually work in solving this problem because I packaged the extension wrong (or something... not sure... I used MS's azure based extension build tool and the documentation for it seems outdated so maybe that's just broken).

I'm going to do a proper rebuild of the project soon but for now, the blog post and the code in the git-repo for the project should give you a basic idea of how this issue can be solved.

@dziku86
Copy link

dziku86 commented Jan 27, 2021

@jcklpe Hi, could you re-post this post on your blog?

@jcklpe
Copy link

jcklpe commented Jan 29, 2021

@dziku86 Yeah sorry about that. The code for the project has a copy of that post in it's readme: https://github.com/jcklpe/vscode-enzo

@dziku86
Copy link

dziku86 commented Jan 29, 2021

@dziku86 Yeah sorry about that. The code for the project has a copy of that post in it's readme: https://github.com/jcklpe/vscode-enzo

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
editor-core Editor basic functionality feature-request Request for new features or functionality
Projects
None yet
Development

No branches or pull requests