drawbot icon indicating copy to clipboard operation
drawbot copied to clipboard

Errors on a text() method when I try to use a specific variable font

Open thundernixon opened this issue 7 years ago • 9 comments

Basics

Drawbot version: 3.116 (3.116)

This issue is probably simplest to share as a dedicated repo: https://github.com/thundernixon/drawbot-varfont-issue

Summary:

I am trying to use a simple Drawbot script to compare a variable font against a static instance of the font. However, when I try to set the fontVariations of the variable font to match the position of the static instance, I get an unexpected error.

I set the font and its parameters, then use the text() method to draw the type. However, I get this an an error:

Traceback (most recent call last):
  File "static_vf_comparison-drawbot-100818.py", line 33, in <module>
  File "drawBot/drawBotDrawingTools.pyc", line 1598, in text
ValueError: NSInvalidArgumentException - -[NSNull renderingMode]: unrecognized selector sent to instance 0x7fff901dcc20

NSInvalidArgumentException is defined by Apple as "Name of an exception that occurs when you pass an invalid argument to a method, such as a nil pointer where a non-nil object is required." However, I only receive this error when I set the font variations of the specified variable font. So, the arguments should be valid, as far as I can tell.

The Drawbot script (in the repo linked to above) also calls in Avenir Next Variable as a comparison (commented out in the script, and chosen because it also has weight and width axes). In Avenir, it works as expected.

Any idea what might be causing this font/script to fail?

thundernixon avatar Oct 09 '18 14:10 thundernixon

I'm suspecting a naming issue with your font, because I'm getting a different error:

*** DrawBot warning: font: 'EncodeSans-CondensedLight' is not installed, back to the fallback font: 'LucidaGrande' ***

Investigating.

justvanrossum avatar Oct 09 '18 15:10 justvanrossum

Not sure yet, but I noticed that the failing font does not have "1,0" (Mac) name table entries, only "3,1" (Win, unicode). That should not cause a problem, but one never knows...

justvanrossum avatar Oct 09 '18 15:10 justvanrossum

@justvanrossum thanks for the suggestion; I'll take a look at that naming! And actually, there are a number of other "fail" problems that come up in a Font Bakery check – I'll clear those up if I experience the issue again.

Weirdly, things now seem to be working with no change made. :| It's unexpected, but I'll look at the naming info if this happens further.

image

thundernixon avatar Oct 09 '18 18:10 thundernixon

Obviously code doesn't return different results without some change in variables, and I realize what changed: my computer rebooted, and so did Drawbot. So, I now get this error when I change the variable font name, but I can get past it by restarting the Drawbot app.

It's probably something wrong in the font, but it seems odd that Drawbot gives different results upon reboot.

thundernixon avatar Oct 09 '18 18:10 thundernixon

Strangely, I'm still having errors, even after quite a bit of debugging on the font.

Here's the current version of the font and the Drawbot script

I'm getting the message @justvanrossum reported, despite adding a full naming table for platformID="1" platEncID="0" (mac). Encode still is showing up, even though the error message says otherwise.

image

This also happens with the installFont() method:

image

thundernixon avatar Dec 06 '18 21:12 thundernixon

Hmm. Now I'm getting a similar but slightly different error, when I try to use the font as a variable font.

It works just fun at wght=400.0,wdth=100.0, but gets an error with any other values.

image

image

thundernixon avatar Dec 06 '18 21:12 thundernixon

what is your OS?

typemytype avatar Dec 06 '18 21:12 typemytype

he @thundernixon what is your os?

typemytype avatar Dec 14 '18 10:12 typemytype

Sorry! Thanks for getting my attention, @typemytype.

My OS is currently macOS Mojave 10.14.

thundernixon avatar Dec 14 '18 15:12 thundernixon