• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Get Fi, tsume, kerning information using script?

Explorer ,
Jul 31, 2024 Jul 31, 2024

Copy link to clipboard

Copied

Hello every one~

I have a question...

Is it possible to access or get information from these items via script? I tried to find out but the results say it is not possible.

 

Shyobinurarea_0-1722481669582.png

 

TOPICS
Actions and scripting , Windows

Views

364

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Jul 31, 2024 Jul 31, 2024

This may help get you started. 

 

// type layer properties;
// based on code by michael l hale;
// 2024, use it at your own risk;
if (app.documents.length > 0) {
var ref = new ActionReference();
ref.putProperty(stringIDToTypeID("property"), stringIDToTypeID('textKey'));
ref.putEnumerated( charIDToTypeID("Lyr "), charIDToTypeID("Ordn"), charIDToTypeID("Trgt") ); 
var layerDesc = executeActionGet(ref);
var textDesc = layerDesc.getObjectValue(stringIDToTypeID('textKey'));
checkDesc2 (textDesc, true
...

Votes

Translate

Translate
Adobe
Community Expert ,
Jul 31, 2024 Jul 31, 2024

Copy link to clipboard

Copied

That needs AM code, maybe the sources you referred to concerned DOM code. 

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jul 31, 2024 Jul 31, 2024

Copy link to clipboard

Copied

Sorry, but what is AM code? I'm using extend script to get them.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 31, 2024 Jul 31, 2024

Copy link to clipboard

Copied

Action Manager code, like the one created by ScriptingListener.plugin

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 31, 2024 Jul 31, 2024

Copy link to clipboard

Copied

This may help get you started. 

 

// type layer properties;
// based on code by michael l hale;
// 2024, use it at your own risk;
if (app.documents.length > 0) {
var ref = new ActionReference();
ref.putProperty(stringIDToTypeID("property"), stringIDToTypeID('textKey'));
ref.putEnumerated( charIDToTypeID("Lyr "), charIDToTypeID("Ordn"), charIDToTypeID("Trgt") ); 
var layerDesc = executeActionGet(ref);
var textDesc = layerDesc.getObjectValue(stringIDToTypeID('textKey'));
checkDesc2 (textDesc, true);
// check kerning list;
var theCollection = new Array;
var kerningList = textDesc.getList(stringIDToTypeID('kerningRange'));
for (var o = 0; o < kerningList.count; o++) {
    var thisList = checkDesc2(kerningList.getObjectValue(o), false);
    theCollection.push(thisList);
    };
alert ("kerning ranges\n"+theCollection.join("\n"))
// check ligature;
var theResults = new Array;
var aList = textDesc.getList(stringIDToTypeID('textStyleRange'));
for (var o = 0; o < aList.count; o++) {
    var thisList = checkDesc2(aList.getObjectValue(o), false);
    var ligature = aList.getObjectValue(o).getObjectValue(stringIDToTypeID('textStyle')).getBoolean(stringIDToTypeID('ligature'));
    theResults.push(thisList+"ligature "+ligature+"\n");
    };
alert ("results\n"+theResults.join("\n"))
};
//////
////// based on code by michael l hale //////
function checkDesc2 (theDesc, theAlert) {
var c = theDesc.count;
var str = '';
for(var i=0;i<c;i++){ //enumerate descriptor's keys
	str = str + 'Key '+i+' = '+typeIDToStringID(theDesc.getKey(i))+': '+theDesc.getType(theDesc.getKey(i))+'\n'+getValues (theDesc, i)+'\n';
	};
if (theAlert == true) {alert("desc\n\n"+str);
return};
return str
};
////// check //////
function getValues (theDesc, theNumber) {
switch (theDesc.getType(theDesc.getKey(theNumber))) {
case DescValueType.ALIASTYPE:
return theDesc.getPath(theDesc.getKey(theNumber));
break;
case DescValueType.BOOLEANTYPE:
return theDesc.getBoolean(theDesc.getKey(theNumber));
break;
case DescValueType.CLASSTYPE:
return theDesc.getClass(theDesc.getKey(theNumber));
break;
case DescValueType.DOUBLETYPE:
return theDesc.getDouble(theDesc.getKey(theNumber));
break;
case DescValueType.ENUMERATEDTYPE:
return (typeIDToStringID(theDesc.getEnumerationValue(theDesc.getKey(theNumber)))+"_"+typeIDToStringID(theDesc.getEnumerationType(theDesc.getKey(theNumber))));
break;
case DescValueType.INTEGERTYPE:
return theDesc.getInteger(theDesc.getKey(theNumber));
break;
case DescValueType.LISTTYPE:
return theDesc.getList(theDesc.getKey(theNumber));
break;
case DescValueType.OBJECTTYPE:
return (theDesc.getObjectValue(theDesc.getKey(theNumber))+"_"+typeIDToStringID(theDesc.getObjectType(theDesc.getKey(theNumber))));
break;
case DescValueType.RAWTYPE:
return theDesc.getReference(theDesc.getData(theNumber));
break;
case DescValueType.REFERENCETYPE:
return theDesc.getReference(theDesc.getKey(theNumber));
break;
case DescValueType.STRINGTYPE:
return theDesc.getString(theDesc.getKey(theNumber));
break;
case DescValueType.UNITDOUBLE:
return (theDesc.getUnitDoubleValue(theDesc.getKey(theNumber))+"_"+typeIDToStringID(theDesc.getUnitDoubleType(theDesc.getKey(theNumber))));
break;
default: 
break;
};
};

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jul 31, 2024 Jul 31, 2024

Copy link to clipboard

Copied

Thank you, i'll try it.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 01, 2024 Aug 01, 2024

Copy link to clipboard

Copied

The second alert the Script provides would give a list of the kerning of the active Layer; but you should be able to adapt the Script to access other properties. 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Aug 01, 2024 Aug 01, 2024

Copy link to clipboard

Copied

Got it, thank you!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 01, 2024 Aug 01, 2024

Copy link to clipboard

Copied

I updated the code to include an alert about the ligature-setting (the »fi«-icon). 

In this example I checked ligature and then unchecked if for three words in the Type Layer. 

Screenshot 2024-08-01 at 11.17.47.png

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Aug 01, 2024 Aug 01, 2024

Copy link to clipboard

Copied

Thanks for the help, I will continue researching from here (and will come back if I still haven't reached my goal xD)

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 01, 2024 Aug 01, 2024

Copy link to clipboard

Copied

LATEST

I don’t know what the »tsume«-setting does, I suspect I don’t use fonts that utilize that option. 

 

Good luck! 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines