2014 TextItem.size bug

Discussion of actual or possible Photoshop Scripting Bugs, Anomalies and Documentation Errors

Moderators: xbytor, DavideBarranca, Paul MR


2014 TextItem.size bug

Postby xbytor » Thu Oct 09, 2014 12:06 am

Text is contained in a TextItem object. One of it's it's attributes is 'size' for the font size.

You can set it like this:
textItem.size = UnitValue(50, "px");
textItem.size = UnitValue(15, "pt");

The problem in the current rev is that regardless of what you set the font size to, it will always stay 12 px. So, if your rez is 72 ppi, the font size is 12 pts. If your rez is 300 ppi, your font size will be 2.83 pts.

My fix was to use low-level ActionManager code from the ScriptingListener plugin. The one problem is that setting the size will bash the font, contents, and several other attributes so you need to set the size immediately after creating the layer.

My fix has been added to xtools and can be found here:
http://ps-scripts.cvs.sourceforge.net/v ... BugFix.jsx


2014 TextItem.size bug

Postby xbytor » Sat Oct 11, 2014 12:19 am

I've posted a new improved version of this fix that doesn't stop on other non-size properties thanks to Rune L-H on the Adobe PS/JS forum.


User avatar
Posts: 11
Joined: Mon Oct 03, 2016 4:56 am

Re: 2014 TextItem.size bug

Postby Dormeur74 » Mon Oct 03, 2016 4:07 pm

I never met any problem with font sizes. To avoid resolution difficulties, I think that the best way is to work in points (and restore the user's preference after process, of course). But the most important (I think), is to know and use in your scripts the Postscript name of the font you want to apply. As my English is (hummm !), I am not sure that my words are so easy to understand. The key words are "Points" and "Postcript names".
An empty brain is the devil's shop.

User avatar
Posts: 29
Joined: Thu Jan 01, 1970 12:00 am

Re: 2014 TextItem.size bug

Postby txuku » Tue Oct 04, 2016 10:05 am


Je me souviens de ton post sur le forum Adobe

J ai rencontre aussi la solution deLoic Algon

Et j ai utilise le script de xbytor en 2014 pour un photographe ayant CC avec succes .

Je ne sais pas si ce manque pour l objet textItem.size est toujours actuel............

Je mets a nouveau la fonction de xbytor - qui n est ^plus accessible - comme je l avais copiee :

I remember your [url = https: //forums.adobe.com/thread/1828989] post on the Adobe forum [/ url]
I ve also found the solution [url = https: //forums.adobe.com/thread/1632348] Loic Algon [/ url]
And I've used the script xbytor in 2014 for a photographer who successfully CC.
I do not know if this lack for textItem.size object is always present ............
I put a new function xbytor - which ^ n is more accessible - as I had COPIED:

Code: Select all

//changeTextSize(newSize) par xbytor
//    var changeTextSize = function(newSize) 
function changeTextSize(newSize)
        var idsetd = charIDToTypeID( "setd" ); 
            var desc23 = new ActionDescriptor(); 
            var idnull = charIDToTypeID( "null" ); 
                var ref6 = new ActionReference(); 
                var idPrpr = charIDToTypeID( "Prpr" ); 
                var idTxtS = charIDToTypeID( "TxtS" ); 
                ref6.putProperty( idPrpr, idTxtS ); 
                var idTxLr = charIDToTypeID( "TxLr" ); 
                var idOrdn = charIDToTypeID( "Ordn" ); 
                var idTrgt = charIDToTypeID( "Trgt" ); 
                ref6.putEnumerated( idTxLr, idOrdn, idTrgt ); 
            desc23.putReference( idnull, ref6 ); 
            var idT = charIDToTypeID( "T   " ); 
                var desc24 = new ActionDescriptor(); 
                var idtextOverrideFeatureName = stringIDToTypeID( "textOverrideFeatureName" ); 
                desc24.putInteger( idtextOverrideFeatureName, 808465458 ); 
                var idtypeStyleOperationType = stringIDToTypeID( "typeStyleOperationType" ); 
                desc24.putInteger( idtypeStyleOperationType, 3 ); 
                var idSz = charIDToTypeID( "Sz  " ); 
                var idPxl = charIDToTypeID( "#Pxl" ); 
                desc24.putUnitDouble( idSz, idPxl, newSize ); 
            var idTxtS = charIDToTypeID( "TxtS" ); 
            desc23.putObject( idT, idTxtS, desc24 ); 
        executeAction( idsetd, desc23, DialogModes.NO );
       // alert( newSize );

R : je retire si.............................

I withdraw if .............................

Return to “Photoshop Scripting Bugs and Anomalies”

Who is online

Users browsing this forum: No registered users and 1 guest