sublimehq / sublime_text

Issue tracker for Sublime Text
https://www.sublimetext.com
803 stars 39 forks source link

Proportional Fonts and Formatting #279

Open willthong opened 10 years ago

willthong commented 10 years ago

Proportional fonts do not allow for basic formatting options like Bold or Italic where they would show up in the theme for a monospace font. This is especially problematic for prose-writing in Markdown (for instance) because we want to be able to have the advantages of proportional fonts (easiness of reading) whilst still being able to have Markdown's syntax-highlighting.

OS: All Version: ST3

FichteFoll commented 10 years ago

Does this apply to all proportional fonts or just specific ones you tried? Can you name examples?

willthong commented 10 years ago

Proportional font faces I've tried:

Monospace fonts it works for:

FichteFoll commented 10 years ago

Can confirm with all your fonts and a few more,

andipower commented 10 years ago

Same here. Font Lucida Console can't be displayed italic and bold either OS: Windows 7 Version: ST3

dpmccabe commented 9 years ago

This is broken even if you use a proportional-width programming font. I just started using the Input font family in Sublime (Input Sans Narrow, to be specific) and can't apply any font styles.

What is the motivation behind this restriction? I can't imagine it's a technical limitation. Can the status of this issue be elevated?

eugenesvk commented 8 years ago

I've recently discovered Input as well and wanted to use the proportional version (Input Serif or Input Sans) instead of the current monospaced font I'm using. However, to my surprise, ST wouldn't allow any italics or bold styles.

Since @willthong mentions "in the theme for a monospace font" is there something I can tweak in the theme to make it think the proportional font I'm using is mono? But anyway would really love for this bug in my favorite text editor to be resolved.

OS X 10.11.3 ST3 build 3103

reagle commented 7 years ago

I just saw this discussion. Sounds like it will not be fixed.

FichteFoll commented 7 years ago

@reagle, I'm positive this is not the page you wanted to reference.

reagle commented 7 years ago

Sorry, here's the correct link and I corrected it above https://forum.sublimetext.com/t/proportional-fonts-lose-italic-bold-syntax-highlighting/10245/10

wbond commented 7 years ago

Marking this as an enhancement request, since we are purposefully not enabling italic and bold when a font is not monospace.

mcclowes commented 6 years ago

Why are you purposefully not enabling italic and bold? This would be very useful for me

wbond commented 6 years ago

The current implementation was written the way it was because enabling proportional bold and italics that are not the same width as the normal font can cause cause reflow. That is, the bold and italic characters are different widths. Since formatting is dynamic when typing code (a syntax definition pattern can result in a character being typed changing the style of a word a couple or words back. If that word changes to bold, the increased width can cause the word your cursor is on to wrap to the next line. This is feels odd when typing.

eugenesvk commented 6 years ago

@wbond 1) not weird at all, that's exactly what I expect to happen- just like I expect a reflow when I increase width by typing more letters :) 2) that's a trivial price to pay for the awesomeness of being able to use such fonts 3) Also, you could instead temporary increase the wrap width limit to avoid this weirdness (e.g. bold text would reflow after a delay / after you leave the line / after you stop editing or something)

mcclowes commented 6 years ago

@wbond I do understand your concern but I agree with @eugenesvk, and I think that given that the change is directly caused by a user action it is surely not very confusing. Perhaps this could at least be an option?

wbond commented 6 years ago

I looked into this recently and wanted to add some more info. Differing widths between the normal, bold and italic versions of a glyph does not cause reflow, but instead causes cursor positions and glyph positioning to be all incorrect.

The current implementation doesn't do per-style glyph layout. Instead, layout is stored per glyph, so it isn't a case of just turning this on. Instead, the glyph layout algorithm/drawing will need to be rewritten to allow this to be possible.

mmerline commented 6 years ago

I'm just chiming in that I would be interested in complete styling support for proportional typefaces. I would prefer to use a proportional typeface for writing syntaxes (Markdown, Taskpaper) and Fira Code for everything else, both with ligatures.

tonsky commented 3 years ago

I was trying to turn Sublime Text into prose editor recently, inspired by iA Writer.

The only thing I wasn’t able to reproduce was Duospace font. It’s almost a monospaced font with only w and m taking 1.5× width. The rationale is here https://ia.net/topics/in-search-of-the-perfect-writing-font.

I found it a great option for writing, but as I enable it, I lose the ability to see bold/italics, which occur in markdown a lot :(

Quesion: iA Writer Duo S has consistent char widths between Regular-Bold-Italic. Can we have an (maybe hidden) option to enable non-monospaced font styles, at least if I can guarantee the bold/italic/regular has the same width?

The fonts are available for free here https://github.com/iaolo/iA-Fonts/tree/master/iA%20Writer%20Duo/Static

Screenshot 2021-02-21 at 18 33 48 Screenshot 2021-02-21 at 18 33 26 Screenshot 2021-02-21 at 18 30 21
bitsper2nd commented 3 years ago

Came here to vote after reading your guide.

YBPN commented 3 years ago

The current implementation doesn't do per-style glyph layout. Instead, layout is stored per glyph, so it isn't a case of just turning this on. Instead, the glyph layout algorithm/drawing will need to be rewritten to allow this to be possible.

Would be wonderful if this were implemented. I use sublime text mostly for prose, with my own custom syntax. Bold/italic for proportional fonts would be a nice bonus, despite text reflow surprises. Perhaps a hidden setting? Although I'm sure sublime prose writers are a minority.

pedromagician commented 2 years ago

Came here to vote after reading your super guide.