Sublime Forum

Some issue about sublime for linux's ruler

#1

Sublime text on my debian seems to work in a odd way
The ruler I prefer to set 80 to work with python and when I configured it in my linux computer,I found that it was ‘a little bit’ shorter
And I typed to test,it’s 33 characters by selecting ruler:80
And it’s 1/2.42 shorter than one on windows
So I have to manually set it with 190 in my user setting
Is that a bug?Or my environment is wrong?
Help me,please!!!

0 Likes

#2

Issues where the ruler size doesn’t match the number of characters you expect are usually related to using a non-proportional font (i.e. a font in which all characters are not all the same size). Sublime uses character positions to calculate where the ruler should display, and it assumes that all characters will be the same width.

So for example, if you create a file with the lines:

II
XX

Do both lines appear the same length as they do above, or does the first line appear shorter? If it appears shorter, you’re using a proportionally spaced font.

0 Likes

#3

Thank for answering
But I never change the setting after installed and ,you mean it is caused by variable-width character encoding?(like utf-8)
As you see,I just use English character to code and whichever setting doesn’t match both of my codes and comments
rule:80 positoned at 33 columes of codes and 61 of comments
rule:190 at 80 of codes and 168 of comments
How does it happen and what should I do to fix it
Thank you for your help

0 Likes

#4

Maybe it’s a syntax-specific override?

0 Likes

#5

No, it has nothing to do with the encoding you use, it has to do with the Font that you use (i.e. the setting of font_face). There are default fonts that are used per platform, and you can also customize that setting yourself. And as @rwols mentioned you can also have it set differently per file type.

If the font that you have set is proportional instead of fixed width, or if the font is missing causing a different font to be used in its place, then you’d see issues like this.

You could check the Sublime Console to see if it has any messages about required fonts not being seen, or check with other types of files (for example plain text versus python files) to see if the ruler position seems to not match.

Did you do the test I outlined above where you put two capital I’s on one line and two X’s on the second and verify that they both appear to be the same width?

0 Likes

#6

The default font used on linux is “Monospace”. If there is no such font it can easily fall back onto proportional fonts.

0 Likes

#7


Thanks for reply! and sorry for late to reply,I am so busy yesterday
I’ve understood what you mean,
it’s probably caused by font setting
I test ii xx ,they seems to be same width,and I try to test it with syntax of plain text
it worked not well too(ruler:190 positoned at 80 columns)
I checked console and there is nothing
What should I do the next step ?
Thanks!

0 Likes

#8

The gnome-tweaks tool has an option for specifying the monospace font. What font do you have set there?

0 Likes

#9

Mine is Fira. font

0 Likes

#10

Can you run fc-match Monospace on the command line?

0 Likes

#11

Yes,and it displays this

0 Likes

#12

Looks to me like your font config hasn’t got Monospace configured, instead resolving to a fallback non-monospace font. Unfortunately there’s nothing to fix on the Sublime Text side to help here; you can either configure a monospace font or specify the "font_face" setting in ST.

0 Likes

#13

Sure,thanks for helping!

0 Likes