Sublime Forum

What's the font used by SublimeText?

#1

I’m confused… I’m on windows7 and I’ve set font_face to “consolas”, I’ve checked the consolas font with some font viewer and I can see this ttf file won’t include emojis, hiragana, katakana glyphs. But If I paste these characters on a Sublime view they’ll be displayed properly, so… what’s going on here? Is it the consolas font used at all?

Example:

Could you please explain how this works internally? I guess it’s not using the available ttf files from the system?

I don’t get it… :confused:

Actually, if I paste the same content on notepad I’ll get the japanese characters also rendered ok… but the emojis will be replaced with the “replacement” characters, using “Consolas Regular” there, ie:

showcase

0 Likes

#2

Did you check the sublime console to see if it is using the font you think it is?

0 Likes

#3

@OdatNurd I’ve checked right now and this is what I’ve got:

>>> view.settings().get("font_face")
'Consolas'

Any explanation to what’s going on here?

0 Likes

#4

Actually I meant a message more like the one outlined below, which would appear somewhere in the console at the point where font face was set (e.g. if you set the font face and restart Sublime, it will be near the top of the console with the startup messges):

>>> view.settings().set("font_face", "Consolas")
font face "Consolas" could not be found, defaulting to "Monospace"
>>> view.settings().get("font_face")
'Consolas'

That is, the setting will report what you told it to use but that’s not a guarantee that’s actually the font being used. This Linux box doesn’t have that font installed, so it uses some other font instead. In my case there is a definite visual jump when the setting changes because my default font is not Monospace, which leads you to believe the setting is doing what you want when it’s not.

In any case I doubt that’s what’s happening here since your own test points out that even NotePad seems to display those characters correctly. On the other hand if you try the same thing with WordPad you’ll notice that no matter what you try to set the font to, it will use a different font for the katakana text (at least on Windows 10).

What you’re probably running into is the below; Sublime uses DirectWrite for it’s font rendering and DirectWrite doesn’t support font fallback, so Sublime chooses it’s own fallback font to be able to render such characters, and it seems it just chooses the first font that has the characters that it needs.

In which case the ultimate answer to your question is that we don’t know and it doesn’t seem to be exposed anywhere.

1 Like

#5

@OdatNurd I’ve read your nice answer a while ago but I hadn’t validated in case some of the devs want to jump into… in any case, thank you very much (as usual), I think it makes more sense now :wink:

0 Likes