<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div dir="auto" style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Jul 13, 2017, at 5:48, Allan Odgaard <<a href="mailto:mailinglist@textmate.org" class="">mailinglist@textmate.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class="">


<meta http-equiv="Content-Type" content="text/xhtml; charset=utf-8" class="">

<div class="">
<div style="font-family:sans-serif" class=""><div style="white-space:normal" class=""><p dir="auto" class="">On 12 Jul 2017, at 17:22, じょいすじょん wrote:</p>

</div>
<div style="white-space:normal" class=""><blockquote style="border-left:2px solid #777; color:#777; margin:0 0 5px; padding-left:5px" class=""><p dir="auto" class="">The defaults keys you provided also do not exist by default on my system.</p>
</blockquote></div>
<div style="white-space:normal" class=""><p dir="auto" class="">Correct, this would only be if the user has explicitly changed the default fixed width font.</p>

</div>
<div style="white-space:normal" class=""><blockquote style="border-left:2px solid #777; color:#777; margin:0 0 5px; padding-left:5px" class=""><p dir="auto" class="">Core Text and AppKit are both kind of vague.<br class="">
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 :(</p>
</blockquote></div>
<div style="white-space:normal" class=""><p dir="auto" class=""><code style="background-color:#F7F7F7; border-radius:3px; margin:0; padding:0 0.4em" bgcolor="#F7F7F7" class="">NSFont</code> has a method to return the default fixed width font, from Python you can use this code to obtain it:</p>

<pre style="background-color:#F7F7F7; border-radius:5px 5px 5px 5px; margin-left:15px; margin-right:15px; max-width:90vw; overflow-x:auto; padding:5px" bgcolor="#F7F7F7" class=""><code style="background-color:#F7F7F7; border-radius:3px; margin:0; padding:0" bgcolor="#F7F7F7" class="">#!/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()))
</code></pre><p dir="auto" class="">On my system it prints:</p>

<pre style="background-color:#F7F7F7; border-radius:5px 5px 5px 5px; margin-left:15px; margin-right:15px; max-width:90vw; overflow-x:auto; padding:5px" bgcolor="#F7F7F7" class=""><code style="background-color:#F7F7F7; border-radius:3px; margin:0; padding:0" bgcolor="#F7F7F7" class="">family: Menlo, name: Menlo-Regular, size: 11.0
</code></pre><p dir="auto" class="">I deliberetly hardcoded the shebang to call <code style="background-color:#F7F7F7; border-radius:3px; margin:0; padding:0 0.4em" bgcolor="#F7F7F7" class="">/usr/bin/python</code> as PyObjC (the Cocoa bridge used here) may not be installed for a custom python on the user’s system.</p>
</div>
</div>
</div>

</div></blockquote></div>Thanks Allan, you basically wrote everything I needed.<div class="">You even reminded me implicitly that passing 0 or 0.0 gives a default size.<br class=""><div class="">Good callout about which Python to use.</div><div class="">Specifically, regarding the PyObjC part, though older, it is more integrated than the non bundled PyObjC in a few subtle ways.</div><div class="">Most people will need to know that.</div><div class="">The bridge is older but is the one built and used by Apple. </div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">What are the best options for displaying the completions?</div><div class="">Some implementations on other editors these days are showing some inline docs snippets along with the completions.</div><div class="">Is that sort of thing feasible under the current TM architecture?</div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""></div></div></div></body></html>