Script based on the font size

Trying to figure out if I can implement a conditional script based on the size of the font of a text layer.

For example, if the font is 10 pt then _, 12 pt then _, 14 pt then___.

Is it feasible with scripts?

Thank you

Tim

If you use more than one if else statements, you can do it. You can either have a range with each if statement or a cascade range.

var doc = activeDocument;
var dL = doc.activelayer;
var textSize = dL.textItem.size;

//using range if:

Tags: Photoshop

Similar Questions

  • Basic conditional script based on the number of lines in a text layer?

    Just received help here to write a conditional script by using the font size of a text layer. Thank you all for this.

    The next hurdle is a conditional script using the number of lines in a text layer in the differential. Far as I can tell it not the layer details which specify the number of lines. Just '\r' for a return in the idTxt descriptor. Nothing seems to stand for a soft return as far as I can tell. I'll probably have to be able to count the lines with soft and hard returns.

    Any thoughts?

    I was playing around with this a bit and here is a small script to determine the number of rows. This is based on the self in the head, that I calculated to environ.108 times the size of the font.

    #target photoshop
    app.preferences.rulerUnits = Units.POINTS;
    var doc = activeDocument
    var tL = doc.activeLayer
    var h = tL.bounds[3]-tL.bounds[1]
    var per = ((h/5)-(tL.textItem.size))/tL.textItem.size
    var num = h/(tL.textItem.size *1.108)
    
    alert(Math.round( num))
    
  • How permanently increase the font size in windows applications

    How permanently increase the font size in Windows applications as for example the mail application? The letters are much too small, and my eyesight is perfect! Thank you

    Sign of salvation,

    Welcome to the Microsoft community forum. From the description of the problem, it seems that you want to change the font size for the user interface modern app.

    You can change the modern user interface text size by going to the charms > settings > change the settings of the PC > PC and peripherals > display

    Also see this Microsoft article:

    http://Windows.Microsoft.com/en-us/Windows-8/make-text-screen-larger-smaller/?v=t

    Windows 8.1, you can now set the DPI (Dots per Inch) scale to make text and other items, such as icons, fonts and windows, to more or less important for all display or by display screens.

    Windows 8.1 DPI scale improvements are mainly focused on:

    • Optimization of ergonomics and the readability of displays high-resolution
    • Offering an experience uniform multi-screen systems
    • Give developers optimize app specific scale based on display DPI

    If you are using a resolution of 1366 x 768 display on a shelf, chances are that UI will look good 100% ppp settings. But what about when you connect the tablet to an external high resolution? In Windows 8, you can choose either 100% in order to optimize the user interface on the screen of the tablet or display up to 150% in order to optimize the user interface on the outside. You have to make compromises.

    8.1 Windows takes care of this issue pressing address scaling of IPR by display . By default, Windows 8.1 will choose the optimal DPI scaling value for each display based on the value selected for the global scaling in the control panel.

    You can also view the suggestion provided by Shawn on this thread.

    http://answers.Microsoft.com/en-us/Windows/Forum/windows8_1-ECOMS/how-does-one-increase-the-size-of-the-text-of/58c7f3fe-8686-4422-ad36-8ab75515527f

    I hope this helps. If you need help with Windows, let us know and will be happy to help you.

  • Analysis of a psd for the font size.

    I am currently scanning the PSD files. I use imagick for pixelated layers, but I need to get the font data for layers of fonts from imagick can do I need to do it myself. Right now I'm able to grab text, font family, font color, but not the size of the police.

    There are some ' / FontSize xx.xxx ' in the PSD but usually not of them are suitable:

    • In some PSD files all font sizes caught here are disabled by the same scale factor.
    • In some layers of different PSD files is distinguished by the same scale factor.
    • In some files PSD, all sizes are correct.

    Adobe provides specifications for the PSD file format, but these are outdated and incomplete, they don't even mention the size of the font.

    I tried to use a copy of the same file just change the font size, but does not.

    Is there someone who have already done this or ideas pointing me in the right direction?

    Check out the forum script Photoshop there was some discussion on the scripts of text layers.

    https://forums.Adobe.com/search.jspa?place=%2Fplaces%2F1383833&q=text+layer+content

    https://forums.Adobe.com/search.jspa?place=%2Fplaces%2F1383833&q=text+layer+font

    https://forums.Adobe.com/search.jspa?place=%2Fplaces%2F1383833&q=text%2Clayer%2Cattributes

  • When I add text to an image that starts as a RAW file, I have no problem. When I try to add text to an image that is only a jpg file, the size of the text is extremely low. Even when I change the the font size to 72 pt, it is always small. How can I fix i

    When I add text to an image that starts as a RAW file, I have no problem. When I try to add text to an image that is only a jpg file, the size of the text is extremely low. Even when I change the the font size to 72 pt, it is always small. How can I fix it?

    You set the font size to a size that is suitable for the size of the document.   Size of the document may vary everywhere.   To resolve this problem in action, I solved in scaling the document to a known size then use a font suitable for a document of this size.  When you resize an image using size with resample Images not only checked a single pixel is change everything that is changed is the DPI image resolution setting.  So if you size a picture 8 "wide you choose a font size is good for wide image 8" the Save action.  To work around the problem of changing the size of the printing I wrote a Script to use in such an action.  The script is used twice, there is a backup and restore script.   The first time that the script is used the script records the resolution DPI images in the metadata documents.  The second time that the script is executed, it retrieves the registered PID parameter deletes the record of metadata from images and set the DPI images that had been saved.    If the use of fonts for the document 8 "will be resized to fit the print original size.

    In a script, you can calculate a correct font size to use.  Actions cannot retrieve information or use logic. They need to use the Plug-ing and Script where logic is needed.  When you make using Photoshop UI you use your eyes and brain.

    Package of shares of crafts UPDATE August 10, 2014 added conditional measures Action Palette tips.
    Contains

    Example of
    Download

  • The font size in Photoshop looks totally different in the Web

    Hello

    I have a very strange problem. I'm using Photoshop CS6 now make some modifications to my Web site.

    We use font type Arial size 12 points of the PSD file and also Arial size 12 points in the web. But in the web, the police seem to be much larger than in the psd file.

    When save us the PSD to JPG format in the browser and compare it to the site fonts of the jpg looks well but they look much bigger in the web.

    It seems that we must use 12px in the Web, so it will look even as 12pt to PSD.

    But I am very confused by the present. How is that possible? Or what we're doing wrong?

    Thank you

    The web runs on pixels, not point. According to the font size of the browser by default, the system font sizes and factors 1 million type dynamically rendered in the browser can always different. Even assuming 72 dpi is not exactly true any longer because of the views high resolution and browsers using another logic internally. that and of course the CSS formatting on the web site can substitute some things as well... Complex issue with no easy answers. Generally, you can expect that it will look like the broad more to wait it looks under all conditions. So to get an idea of how make you some texts and don't mix too much with normal text image-based text.

    Mylenium

  • When you create a form to fill out fields of an existing pdf file, how do you define or allow end users set the font size in the fields?

    I managed to create a pdf form using an existing pdf document.  However, the font size is too large to allow the end user to type information in the form region.  Is there a way for 1) globally and/or 2) allow the end user to change the font size if necessary to put all the information in a box without police being so big & set all form fields when generated a lot more small font size?

    If the form field is created with the 'Allow Rich Text Formatting' option, the use can pull up the 'Properties', 'Ctrl' + E tool and change the format of the text such as the police, size, super/u: script, color, etc.

    Change the size of the text in the field of form (rich text formatting allowed)

  • JavaScript to adjust the font size for the form field number of characters?

    I have a form field that asks you 'full name' (first of all, middle, modified). Big, it is displayed in the upper part of the form. Some names are short and long.

    Is there a way of javascript to adjust the font size used in a form field based on the number of characters entered in the field?

    that is, if the name entered is Joe Smith, the font size is 30pt, if it's Alexander Hamilton font size is 20pt?

    Thank you!

    In general, I agree, but the Acrobat help section contains a lot of information. This specific bit of information you will find in this page: https://helpx.adobe.com/acrobat/using/pdf-form-field-properties.html#pdf_form_field_proper links

  • Change the font size of Textfield using buttons

    Hello

    I have some textfields in my form with a static confined area and the default font size is set to 11px. However, some users would like to have a possibility to increase the font size in these areas. I looked for a solution and I understand the there are 2 ways to do this: either by using a button to change the size of police (i.e.) with a drop-down list controls the size of the police. I am wanting to do something like this:

    (1) add 2 buttons on the form to control the font size. Will be a button "+" (to increase the font size) and the other button will be "-" (to decrease the font size).

    (2) I understand that if I am setting a size police fixed increase to, I can add a javascript something like this:

    TextField1.font.size = "12pt"; 
    

    But I don't want to like this because in this case, I can only give limited options. Is it possible to write a javascript script that can identify the font size of the object textfield then adds (or) subtracts 1 point to the font size depending on whether the user clicks on the '+' or '-' symbol? In this way, the user can control and experiment what best suites of font size them. Hope this makes sense... I wonder if anyone has an idea on how I can do this...

    Hello

    You can use code like this on the '+' and '-' buttons

    This code is for the button «+»

    get the font size

    var currentSize = TextField1.font.size;

    get the location of the string "pt".

    var ptPlace = currentSize.indexOf ("pt");

    get the part of the string that is just a number

    var currentSizeInt = currentSize.substr (0, ptPlace);

    analyze this new string as an integer and add 1

    var newSizeInt = parseInt (currentSizeInt, 10) + 1;

    set it as the new font size (adding the "pt" back on)

    TextField1.font.size = currentSizeInt + "pt";

    Obviously for the '-' you just change the line that adds the value 1 to subtract 1

    Hope this helps

    Malcolm

  • Change the font size of the contact form.

    Hello

    I searched in google and various forums to make a contact form, and I finally have it working. (YAY!) HOWEVER,

    There is a problem: I don't know how to change the font size. Help?

    Here's my action script code:

    submit_btn.addEventListener (MouseEvent.CLICK, sendMessage);

    function sendMessage(e:MouseEvent):void {}

    var my_vars:URLVariables = new URLVariables();

    my_vars. SenderName = name_txt.text;

    my_vars.senderEmail = email_txt.text;

    my_vars.senderMsg = message_txt.text;

    var my_url:URLRequest = new URLRequest ("http://mydomain.com/mail.php");

    my_url. Method = URLRequestMethod.POST;

    my_url. Data = my_vars;

    var my_loader:URLLoader = new URLLoader();

    my_loader. DataFormat = pouvez;

    my_loader. Load (my_url);

    name_txt. Text = "";

    email_txt. Text = "";

    message_txt. Text = "Message sent";

    }

    I have to add something to my action script to change the size of the text? If Yes, what? Or change the size of the text by other means? I've been watching online tutorials, forums, and I couldn't find something that helped me.

    Thank you!

    -MP

    you use components.  use:

    var tfor:TextFormat = new TextFormat();

    Tfor.Size = 12;

    name_txt. SetStyle ("textFormat", tfor);

    email_txt. SetStyle ("textFormat", tfor);

    message_txt. SetStyle ("textFormat", tfor);

    submit_btn.addEventListener (MouseEvent.CLICK, sendMessage);

    function sendMessage(e:MouseEvent):void {}

    var my_vars:URLVariables = new URLVariables();

    my_vars. SenderName = name_txt.text;

    my_vars.senderEmail = email_txt.text;

    my_vars.senderMsg = message_txt.text;

    var my_url:URLRequest = new URLRequest ("http://mydomain.com/mail.php");

    my_url. Method = URLRequestMethod.POST;

    my_url. Data = my_vars;

    var my_loader:URLLoader = new URLLoader();

    my_loader. DataFormat = pouvez;

    my_loader. Load (my_url);

    name_txt. Text = "";

    email_txt. Text = "";

    message_txt. Text = "Message sent";

    }

  • change /-the font size of a text field on master pages is not possible? (field prop)

    Hello

    I would like to change the font and the font size of a textfield on a master page.

    I wonder if I did anything wrong, because font options (size, fonts, etc.) are simple grayed out / not available, when I click on my text field.

    Apparently, there is a way to customize the font properties of a textfield (only) on the master page.

    Well, I guess it would work with java script in the event init... but really, why the hell it should not possible just use properties/text properties?

    Please correct me if I'm wrong. I'm doing something wrong, or is it really not possible to customize the police of a text field on master pages?

    Import you the form in the designer?

  • Is it possible to increase the font size on web pages? I can increase the size of the page but then lose the ability to see the entire page.

    I've just updated El Capitan, but the font size on web pages went all teeny weeny.

    I was wondering if we could increase the font size? The page can expand via "zoom in", but then lose the ability to view the web page in the blink of an eye.

    Thanks in advance.

    Yes.  Open the Terminal app and type the following command followed by the Enter key or return:

    : write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2MinimumFontSize - int XX

    (triple click on the line to select it to copy and paste into the Terminal application).

    Change the XX to the font size you want as the minimum font by default.

    Or you can use a css style sheet.  This site describes it and the Terminal method: specify Minimum font size in Safari 10.0, macOS Sierra

  • The font size in Safari 10 cannot be changed

    I'm blind, or y at - it ideas?

    I'll be blind if they don't remedy. Several people in the other thread too unhappy.

    Zoom is not the same as the font size. I need size of 16 points to read.

  • How to set the FONT SIZE on Safari 10?

    I use OS X 10.11.6, and I just downloaded Safari 10.0. He seems to have replaced the 'minimum font size' with a "zoom" feature but there is a big problem: if I as large font size that I prefer, the page runs off the screen; If I do the optimal zoom page, the police is too small! So I have to squint as soon as the text continue to slide backwards to see the entire page. It's annoying and stupid. Is there a way to adjust the size of police ALONE?

    Have the same question. Safari 10.0 is USELESS to me if I can't change the font size. Never thought Apple would make such Microsoft (see IE) thing.

  • I wish increast the font size in the address bar, cession bar and tab headings do not see how

    I would like to increase the font size or make the "BOLD" font, so I can read them better for the address bar in particular, but also for the entries tab, the menu bar and the bookmarks bar. Is this possible?

    Thank you

    I don't think that there is still a setting for this in Firefox. You can, however, install the addon address bar font size bigger your version of Firefox to adjust the size of the font of the address bar.

    Let us know if it works for you.

Maybe you are looking for

  • PORTEGE T3600CT: Flashing power LED

    Hi everyone (forgive me of my English).I have a problem whit my PORTEGE T3600CT (Yes, a bit old... but I like it) when it s connected to the power supply.It looks like overheating of the microprocessor or something else: after a few minutes (5, 15, 3

  • When should I create recovery discs?

  • Accadentaly changed all were leaving primary Partions single

    I need help with my CQ57 Compaq Presario windows 7. I had never used my leave before but I wanted to use a partion so I made a new, but I've already had four were leaving so they all went to primary school were leaving to Partions Simple. Does anyone

  • Add Rectangularbox to the EditField giving unneccessay verical bars?

    Hello I am trying to add rectangluar gray box in the EditField it contains blacktext with code below and it gives a few extra verical between letters bars while moving the arrows inside the text, it is shown in the attachment. Please correct my code

  • Email account keeps asking for username and password

    I use Explorer 10.  A few days ago when I tried to log into my email account, the re-appearing Party kept login screen asking UserId and Password over and over again.  It was working fine a few days ago.  I can access my account using Google Chrome a