Skip to content

How to handle proportional fonts? #13

Description

@tobia

I like this plugin. Yes, it's not a proper implementation of elastic tabstops, because ST does not allow one yet, but it has the added benefit of being able to open the files in any fixed-width editor and see them properly aligned.

One things that bugs me though, is that I use ST with a proportional font and the alignment comes and goes. Example:

example of elastic tabstops with proportional fonts

This obviously happens because some letters are wider than a space, so they overflow the tab stop and jump to the next one.

I'd like to develop a patch for this myself, but I'm unsure how to do it. Does ST have an API that returns the screen position (in pixels) of a certain character position (in rows and cols)? Do I have to compute the string widths myself, using some Python package that can parse the current font?

Even if I was able to determine the string widths, what's the best way to align them? If I add more spaces, I lose the automatic alignment in fixed-width editors.

Any idea?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions