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

Superscript text font change using script

Participant ,
Oct 01, 2020 Oct 01, 2020

Copy link to clipboard

Copied

Hi Everyone

Is there script to find and change the font of thesuperscript text.

TOPICS
Actions and scripting

Views

946

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 , Oct 03, 2020 Oct 03, 2020

»fontPostScriptName« and »color« seem to be enough. 

// base on code by jazz-y;
// change font of superscript letters;
// 2020, use it at your own risk;
s2t = stringIDToTypeID;

(r = new ActionReference()).putProperty(s2t('property'), p = s2t('numberOfLayers'));
r.putEnumerated(s2t('document'), s2t('ordinal'), s2t('targetEnum'));
var len = executeActionGet(r).getInteger(p);

for (var i = 0; i <= len; i++) {
    (r = new ActionReference()).putProperty(s2t('property'), p = s2t('textKey'));
    r.pu
...

Votes

Translate

Translate
Adobe
Community Expert ,
Oct 02, 2020 Oct 02, 2020

Copy link to clipboard

Copied

As Photoshop is not the primary choice for serious typographical work I doubt it. 

 

Several of the Forum regulars could almost certainly create one fairly easily, though. 

But let me be blunt: Do you just want someone to do your work for you or are you looking for advice? 

 

There was a thread recently that concerned changing type properties via Script; it was about color, but the code might be helpful nonetheless. 

Change a certain color of texts to a new color

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
Participant ,
Oct 02, 2020 Oct 02, 2020

Copy link to clipboard

Copied

I need help for work to change the font of the superscript.

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
Participant ,
Oct 02, 2020 Oct 02, 2020

Copy link to clipboard

Copied

Is this possible to achieve through unicode of superscript from one font to another.

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 ,
Oct 02, 2020 Oct 02, 2020

Copy link to clipboard

Copied

»I need help for work to change the font of the superscript.«

Have you checked out the Script in the thread I linked to? 

Do you have any experience with JavaScript and Photoshop’s AM 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
Guide ,
Oct 02, 2020 Oct 02, 2020

Copy link to clipboard

Copied

The script will indeed be similar to the one referred to by c.pfaffenbichler 

We get a descriptor for the text layer, get an ActionList with a list of styles, loop through all the styles looking for the one in which the 'baseline' key is set to 'superScript'. Then, in this style, change the values ​​of the keys fontName, fontPostScriptName, fontScript, fontStyleName to the required ones (I have never changed the font using a script, so we need to experiment to find out what the minimum set of keys is needed for the font to change correctly - we may have to refer to the list of fonts application to get all the required attributes). After that, collect the descriptor in reverse order and assign it to the text layer.

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 ,
Oct 03, 2020 Oct 03, 2020

Copy link to clipboard

Copied

LATEST

»fontPostScriptName« and »color« seem to be enough. 

// base on code by jazz-y;
// change font of superscript letters;
// 2020, use it at your own risk;
s2t = stringIDToTypeID;

(r = new ActionReference()).putProperty(s2t('property'), p = s2t('numberOfLayers'));
r.putEnumerated(s2t('document'), s2t('ordinal'), s2t('targetEnum'));
var len = executeActionGet(r).getInteger(p);

for (var i = 0; i <= len; i++) {
    (r = new ActionReference()).putProperty(s2t('property'), p = s2t('textKey'));
    r.putIndex(s2t('layer'), i);
    var theCheck = false;
    if (executeActionGet(r).hasKey(p)) {
        var textKey = executeActionGet(r).getObjectValue(p),
            styleList = textKey.getList(s2t('textStyleRange')),
            l = new ActionList(),
            d = new ActionDescriptor(),
            z = false;
        for (var x = 0; x < styleList.count; x++) {
            k = styleList.getObjectValue(x);
            s = k.getObjectValue(s2t('textStyle'));
            theX = s.getEnumerationValue(stringIDToTypeID("baseline"));
            var theNewOne = new ActionDescriptor;
////////////////////////////////////
            if (theX == "2477") {
                var theCheck = true;
                var theStyle = k.getObjectValue(s2t('textStyle'));
                theStyle.putString(s2t('fontPostScriptName'), "Helvetica-Bold");               
                var d = new ActionDescriptor();
                d.putDouble(s2t('red'), s.getObjectValue(s2t('color')).getInteger(s2t('red')));
                d.putDouble(s2t('grain'), s.getObjectValue(s2t('color')).getInteger(s2t('grain')));
                d.putDouble(s2t('blue'), s.getObjectValue(s2t('color')).getInteger(s2t('blue')));
                theStyle.putObject(s2t('color'), s2t('RGBColor'), d);
                k.putObject(s2t('textStyle'), s2t('textStyle'), theStyle)
            } else {
            };
////////////////////////////////////
            l.putObject(s2t('textStyleRange'), k)
        }
        if (theCheck == true) {
            textKey.putList(s2t('textStyleRange'), l)
            var d = new ActionDescriptor();
            (r = new ActionReference()).putIndex(s2t('layer'), i);
            d.putReference(s2t('null'), r);
            d.putObject(s2t('to'), s2t('textLayer'), textKey);
            executeAction(s2t('set'), d, DialogModes.NO);
        }
    }
};

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 ,
Oct 02, 2020 Oct 02, 2020

Copy link to clipboard

Copied

Hi Ragav@july2020 ,

I don't see how this can be done easily.

Ps has a basic find and replace text function, so some serious scripting will be needed.

To add to @c.pfaffenbichler 's links, here some scripting resources from Adobe.

ADOBE PHOTOSHOP SCRIPTING

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