[TxMt] Re: tm_query --setting fontName

じょいすじょん dangerwillrobinsondanger at gmail.com
Thu Jul 13 08:04:39 UTC 2017


> On Jul 13, 2017, at 5:48, Allan Odgaard <mailinglist at textmate.org> wrote:
> 
> On 12 Jul 2017, at 17:22, じょいすじょん wrote:
> 
> The defaults keys you provided also do not exist by default on my system.
> 
> Correct, this would only be if the user has explicitly changed the default fixed width font.
> 
> Core Text and AppKit are both kind of vague.
> The solution there seems to be to start with a font and apply the fixed width trait to get a descriptor for a font that comes close to matching somehow (who knows how? personal taste?) or present a UI and let a user select something. Still does not give a default does it? How loopy these APIs can be :(
> 
> NSFont has a method to return the default fixed width font, from Python you can use this code to obtain it:
> 
> #!/usr/bin/python
> import objc
> from AppKit import NSFont
> 
> font = NSFont.userFixedPitchFontOfSize_(0)
> print("family: %s, name: %s, size: %.1f" % (font.familyName(), font.fontName(), font.pointSize()))
> On my system it prints:
> 
> family: Menlo, name: Menlo-Regular, size: 11.0
> I deliberetly hardcoded the shebang to call /usr/bin/python as PyObjC (the Cocoa bridge used here) may not be installed for a custom python on the user’s system.
> 
Thanks Allan, you basically wrote everything I needed.
You even reminded me implicitly that passing 0 or 0.0 gives a default size.
Good callout about which Python to use.
Specifically, regarding the PyObjC part, though older, it is more integrated than the non bundled PyObjC in a few subtle ways.
Most people will need to know that.
The bridge is older but is the one built and used by Apple. 


What are the best options for displaying the completions?
Some implementations on other editors these days are showing some inline docs snippets along with the completions.
Is that sort of thing feasible under the current TM architecture?




-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macromates.com/textmate/attachments/20170713/77a7a18b/attachment-0001.html>


More information about the textmate mailing list