Copy link to clipboard
Copied
This morning I've posted a new script for download. This one makes dimension marks in InDesign.
Check it out here: https://www.marspremedia.com/software/indesign/dimensions-indesign
All feedback is welcome. Also I've posted a how-to video about it.
Copy link to clipboard
Copied
Hi William,
great idea!
But on first run (even before the dialog) I get an error
(loosly translated something like "The requested property is for this font not available")
Then the dialog shows up, I just hit okay, and then this error:
I guess it could have something to do with the layers, swatches and paragraph styles dropdowns being empty?
Tested on macOS 10.14.6, InDesign 16.1 (german version) with just an empty document an a selected rectangle.
Copy link to clipboard
Copied
Thank you for the response. Your feedback helps me greatly.
I've posted an update version 1.0.1 to my site to download and try. I'll explain what is causing the error below. I highly suspect you have a faulty font installed. Download the update and if it still gives an error, then for sure one of your fonts is whacked. If you would contact me through my website, I can make a test file to send you via email and we can both learn exactly which font is causing the problem.
The line throwing the error is when making the font list. For those interested, the precise line is
fontNames = app.fonts.everyItem().fullName;
For whatever reason, either multiple fonts or a particular font lacks the propery 'fullName.' In my update I've added a few try catch blocks to try other properties if that one fails. I use 'fullName' because it's more human-readable than the property 'name' that has a tab between family and style that ends up stripped out in lists so it's just crammed together. But if fullName fails, I am now trying name.
The second problem that is fixed, is that if making a font list fails, the script should exit. It wasn't. This was a minor oversight on my part. Because fonts is the first list made, when it fails, the rest (swatches, paragraph styles) never are made either. That's why the drop-downs for all are empty. The update won't even display the interface now, since continuing the script only leads to further errors. Once making any one list fails, the script ends after the alert.
@Laubender, I'll reply to your reply separately -- good idea on default font, and I'll explain that fix I made for it in the 1.0.1 update.
Copy link to clipboard
Copied
Your updated version works 🙂
Awesome script!
I really appreciate you provide this for free.
Copy link to clipboard
Copied
Great news. Thank you for testing it. Could you do one last favor, to satisfy my curiosity? Take a screen capture of the Select Font window and post it, like you did before when it was blank? I'm curious what property ended up valid -- how the font names appear is a clue. Thanks again.
Copy link to clipboard
Copied
Hi William,
no issue so far with:
German InDesign 2021 version 16.2.1.100
Windows 10 Pro
Jens, could be that the default font Dimensions is using, Arial, has some issues on your Mac.
Or maybe, that Arial is quite different from my installed Arial that comes with Windows 10.
Hm. William, maybe you could avoid any font issue at startup if you use Minion Pro Regular ?
That's the default font for every installed InDesign since CS5, I think.
Regards,
Uwe Laubender
( ACP )
Copy link to clipboard
Copied
Hi Uwe,
could be... I just noticed that the font list is completly empty, so there's probably an issue here...
Copy link to clipboard
Copied
Default font isn't the cause of the error, but it's a good point, because it could cause other errors. So in the 1.0.1 update I added a test for whether the font exists. If not, I pull the font from the paragraph style [Basic Paragraph]. Which yes, in most cases is Minion Pro, if the user hasn't changed it. But getting from there, rather than hard-coding the name, avoids the potential other error of Minion not installed either. Pretty unlikely, but you know how it goes... never know what another system to use the script looks like. Thank you for the suggetion, it's a good one, and should be handled now.
Copy link to clipboard
Copied
Hi William,
fontNames = app.fonts.everyItem().fullName;
If there are fonts where property fullName is invalid one could do an individual check for every installed font. But this will slow down your script very much. At least when you start up and the available fonts dialog must be populated.
Way out: You could restrict the script showing document.fonts only, fonts that are already used in the document.
Jens could test the following script snippet that should get the number of installed fonts where fullName is not valid.Cannot test it with a system where a font misses fullName, so I don't know if it will show something exceptional.
var appFontsArray = app.fonts.everyItem().getElements();
var appFontsArrayLength = appFontsArray.length;
var fullNameNotAvailable = [];
var alertMessage = "Number of Fonts where fullName is not available:" +"\r";
for( var n=0; n<appFontsArrayLength; n++ )
{
if( !( "fullName" in appFontsArray[n].properties ) )
{
fullNameNotAvailable[ fullNameNotAvailable.length++ ] =
appFontsArray[n];
}
};
alert( alertMessage + fullNameNotAvailable.length );
Regards,
Uwe Laubender
( ACP )
Copy link to clipboard
Copied
Looks like my update worked. Below is the change I made that now works. Only question left is which of the attempted properties was the one that worked. A screen capture of the Select Font window will tell.
// Make list of fonts.
try {
fontNames = app.fonts.everyItem().fullName;
} catch (_) {
// Does not have property fullName
}
if (!fontNames) {
// Try property fullNameNative
try {
fontNames = app.fonts.everyItem().fullNameNative;
} catch (_) {
// Does not have property fullNameNative
}
}
if (!fontNames) {
// Only property left to use: name
// If it doesn't work after this, throw the error.
fontNames = app.fonts.everyItem().name;
}
Copy link to clipboard
Copied
If there is just one problematic font, the list keeps being empty.
Copy link to clipboard
Copied
@Jens Trostso you're saying, if you put back the problem font, then it fails again? Can you zip and send me the font? I'd love to research further, to avoid future script errors. My address is on the script interface window, at the bottom. @Laubender I like your approach of searching for the property, so may do another tweak using that method to weed out the troublesome font, and simply omit from the list. Seems like the best solution. Thank you both, the feedback is marvelous.
Copy link to clipboard
Copied
I've posted another update, version 1.0.2, to my website. Same link. @Jens Trost I got your fonts and both work fine in the original (1.0) version of the script. So it's not these fonts causing the problem. It's something else. Try the new update and see if that works better.
@Laubender I used your idea of testing for the property fullName. If not found, omit the font name from the list. Much better solution. Here is my updated code for anyone interested:
// Make list of fonts.
var fontNames = [];
var fonts = app.fonts.everyItem().getElements();
for (var i = 0; i < fonts.length; i++) {
if ("fullName" in fonts[i]) {
fontNames.push(fonts[i].fullName);
}
}
Copy link to clipboard
Copied
Hi @willcampbell7,
just downloaded it – if I have a problematic font activated ("Caveat Regular") I'm at the beginning again with the error in line 179. If I deactivate it everything runs fine (like with the 1.0.1 verison).
If you can't replicate the error on your side, maybe it's a issue with our FontExplorer-environment... I can give it a try at home later.
if ("fullName" in fonts[i]) {
shouldn't that read
if( ("fullName" in fonts[i].properties) {
Copy link to clipboard
Copied
Just tried it again and the Caveat font works fine. So yeah, I highly suspecct it is funny business your font manager is doing. Ever consider FontBase? The way it works is totally conformant -- moves font files into or out of the User/Library/Fonts folder. That simple. Can't play by the rules any better than that.
About the code: in Abobe JS, when reading an object, either line of code gives the same result. I lean toward the simpler expression when possible.
Copy link to clipboard
Copied
So now I tested it on a different mac (10.13.6) with InDesign 15.1.3 and you're right, in this case the Caveat font is not causing any troubles.
I have an idea why / I noticed something in general:
if there is a font conflict then fullName seems to be null (or was it undefined?)
On my own Mac (with no FontExplorer or anything) I had for whatever reason a conflict with Arial Narrow according to the macOS own "font manager app" and Uwe's little snippet – I resolved that (not sure what the button in the font collection actually did) and then fullName wasn't a problem anymore.
That would explain why you and I on a different computer don't have any problems with the Caveat font.
Copy link to clipboard
Copied
The latest update (1.0.2) now tests each font for the property 'fullName.' If it doesn't exist, the font is skipped. So the result *should* be that any problem fonts simply aren't in the list. That's the hope anyway. It's not likely you want them for dimensions anyway. So you should still see a good sized list of fonts. Just missing the troublesome ones. Is that the behavior you are seeing now (with the update)? Or... ? Let me know. Thanks.
Copy link to clipboard
Copied
Hi @willcampbell7,
I'm afraid not – if I activate a problematic font, I get the error on line 179 (property not available) again.
Copy link to clipboard
Copied
@Jens Trost OK. I've revised the font loading code. An update, version 1.0.3, is posted to my site. Download that and try it. This revision should skip the problem font but still load others. If not, we'll keep banging away at it. Let me know the result. Thanks.
Copy link to clipboard
Copied
NOW we've got it 🙂
Thanks for your patience – and again, thanks for sharing this awesome script 🙂
Btw. you didn't change the version number in the UI Dialog 😉
Copy link to clipboard
Copied
THANK YOU for pointing out the UI version. Going too fast this morning. I probably wouldn't have realized for weeks. It's the little things, and I really appreciate you letting me know. Download again, the script is updated with the correct version on the UI now.
Copy link to clipboard
Copied
I merge my answers here (I'm still not used to this layout of different conversations within a thread ;)).
@Laubender
I ran your snippet a litte bit modified – I got 10 fonts, 9 of which where Helvetica Neue and some free font.
Helvetica is always a problem since there are conflicts between the system version and the FontExplorer-activated version – I just disabled them all and now I've got a 0 with your snippet 😉
@willcampbell7
Copy link to clipboard
Copied
Hi Jens,
interesting results.
How exactly were the fonts installed that you filtered as the ones without property fullName?
Is it the way they were installed? What do you see in Type > Find/Replace fonts… when the font is used in a document with "More Information"? Something special with the value of "Path:" ?
( For example: Installed fonts from the Adobe Fonts cloud service will just show "Aktiviert von Adobe Fonts" and not a font file in the file and folder system. )
Regards,
Uwe Laubender
( ACP )
Copy link to clipboard
Copied
Hi Uwe,
we use FontExplorer as our font management software, so as far as I know the fonts get locally downloaded via the client.
I'm not exactly sure how it's integrated into InDesign since the fonts get not installed in usually used folders (see Screenshot).
FontExplorer uses plugins for font activation but I haven't activated/installed them currently... so not quite sure how this all works.
Copy link to clipboard
Copied
Hi William,
Thank you for sharing your script!
When I run it (on MacOS Big Sur ver. 11.3, InDesign 16.1), I get this error message twice: before the dialog box appears and after I click OK.
Then it continues as expected.
— Kas