Sublime Forum

Menlo Font Bug In Phantoms

#1

When using phantoms there’s an issue with the characters “fl” combining into one monospace character width, causing the font to not appear as completely monospace. I think this is related to ligatures based on some other git issues:

Patching Menlo adds ligatures it shouldn’t
Patched Menlo and Meslo erratic behaviour whenever “f” is followed by an “i” or “l”


I’m testing with the following snippet on Mac Build 3176:

import sublime
import sublime_plugin

class ExampleCommand(sublime_plugin.TextCommand):
  def run(self, edit):

    window = sublime.active_window()
    view = window.new_file()
    
    view.insert(edit, 0, "asdflasd")
    html = '<div>asdflasd</div>'

    view.add_phantom("list", view.sel()[0], html, sublime.LAYOUT_BLOCK)

This is possibly a minor bug but the plugin I’m writing is dependent on the font being monospace so would really appreciate a fix for this.

0 Likes

#2

I would recommend that you create an issue at https://github.com/SublimeTextIssues/Core/issues for this (if you haven’t already) so it can be tracked. :slight_smile:

0 Likes

#3

For editor text, we only pass runs of symbols (and letters followed by combining characters) through to the text shaping engine, every other character is shaped individually. For HTML we pass through the entire string that is to be displayed. It would appear that unfortunately Menlo will translate two letters into a single monospace glyph.

0 Likes

#4

Hm… so it’s not worth creating an issue on github? Since it’s just an issue with the version of Menlo that ships with the Mac OS?

0 Likes

#5

No, I think we’ll need to come up with a solution to this. Most likely we’ll have to have phantoms pass a flag so text shaping happens the same as with the editor buffer.

3 Likes