Rounding text size to nearest whole number?

I've had to rescale some artwork, but now I'm left with type sizes that are 71.68px tall, 34.51px tall, etc.
Is there a script that'll snap all the text in a document to it's nearest whole number or 0.1 decimal?

// rounds the size of text in all textFrames in your document
var aTFrame = app.activeDocument.textFrames;
for ( i = 0; i < aTFrame.length; i++ )
var fractionSize = aTFrame[i].textRange.characterAttributes.size;
var RoundedSize = Math.round(fractionSize);
aTFrame[i].textRange.characterAttributes.size = RoundedSize;
redraw();
This will do all the text frames. Copy the above, paste it into a text editor or the Adobe ESTK (ExtendScript Tool Kit) and save as a plain text file with a .jsx extension. Place it into Applications/Adobe Illustrator CSX/Presets/en_US/Scripts folder and restart AI. Run it by having a document open in AI and call it from File>Scripts>scriptname.

Similar Messages

  • Rounding off to nearest whole number without condition

    hi,
    i want to round a real number to an integer value,,wihout any conditions like
    10.01 should be 11
    10.1 should be 11 and like that
    is it posible to do it?
    thanks in advance.
    amit

    It doesn't look like you are trying to round to the nearest whole number here. It looks like you are trying to find the smallest integer value that is greater than or equal to the real number. If so, you would want to use the CEIL function (i.e.
      1  SELECT CEIL(10.01)
      2*   FROM dual
    SCOTT @ hp92 Local> /
    CEIL(10.01)
             11Justin
    Distributed Database Consulting, Inc.
    http://www.ddbcinc.com/askDDBC

  • Formula rounding to nearest whole number

    Hello,
    I have created the following formula ( Metrics."# of Leads Resulting in Won Opportunity"*100 /Metrics."# of Leads" ) and displayed the results in percentage but it looks to round to the nearest whole number does anyone know why this might happen. Also i am using 2dp in the results i am hoping to get the actual result rounded to 2dp and not the nearest whole number.

    Hi !
    I think that if you add the ROUND function, this will work... :
    ROUND(Metrics."# of Leads Resulting in Won Opportunity"*100 /Metrics."# of Leads", 2)
    Hope this will help, feel free to ask more !
    Max

  • Rounding up to nearest whole number question

    I have a calculation script that sometimes returns a decimal result. How would I create a script that would round that decimal up to the next whole number? Anyone have any idea's?

    okay, I am not very good with this. That command is new to me. Where would I place that script if I already have a javascript script in the calculate event of that numeric field I am trying to get rounded up?
    I basically have the javascript code in the numeric fields calculate event set to
    this.rawValue = subform1.numericField1.rawValue;
    I tried putting your script on the change event hoping I could use formCalc there but get a error when testing saying Ceil is not defined. Thanks

  • Rounding a percent to a whole number

    Hello,
    I'm still fairly new to performing script calculations and with this particular one seems a bit more complex for me.
    I'm trying to determine the percent difference between 2 numbers and display the percentage as a whole number. Logically my calculation looks like
    (numericField1 - numericField2 / numericField1 * 100)
    (ex. 1000 - 850 / 1000 * 100 = 15%)  
    I need assitance with my calculation and especially rounding the % to a whole number. I would not like any answers displayed like 22.66666%
    The code below is somethig I tried
    event.value = roundNumber( ( this.getField(numericField1).value - this.getField(numericField2t).value  )  / this.getField(numericField1).value , 2 ) + '%';
    function roundNumber(num, dec) {
            var result = Math.round(num*Math.pow(10,dec))/Math.pow(10,dec);
            return result;
    Any advice would be great!

    Actually Adobe makes this really simple for you.  If you use a numeric field to display the result, the display pattern for the field will control how the number is shown.  You can set a percentage pattern:"num{zzzz9.99%}" to control how many digits will be displayed, and how many digits will be significant past the decimal point.  If there are more digits, Adobe will automatically round the number.  In the attached example I used the pattern
    "num{zzzz9%}" to ensure that only a whole number will be displayed.  Adobe will use normal rounding rules: 0-4 rounds down, 5-9 rounds up.
    Additionally, the percentage pattern will automatically multiply the field value by 100, so you don't need to do that in your script.
    For the example attached, I added your calculation as FormCalc script to the Calculate event of the result field.  The script is now simply:
    (NumericField1 - NumericField2) / NumericField1
    Adobe takes care of the rest.

  • I have a calculation in a5 and need the answer rounding up to the next whole number

    I have a calculation in cell a5 and need the answer rounding up to the next whole number

    Hi,
    I am using numbers
    A1 x A2 = A3       A4 is A3 divided by 2.88.  Indeed to round up the answer in A4 to the next whole number
    Eg 4.5 x 3.7 = 16.6 sq meters as an area , divided by 2.88 ( area of 1 board) = 5.78 boards so I need to buy 6 and quote for 6
    Cheers

  • Always round up to nearest whole in APO DP

    Hi
    there is a requirement to always round up data to nearest whole number. number should be always rounded above and not rounded down.
    Example a value of 0.07 should be rounded to 1
    a value of 1.25 should be rounded to 2
    a value of 1.75 should be rounded to 2
    a value of 1.07 should be rounded to 2
    and so on
    Is there a way i can achieve in APO DP by some settings/paramater/config/macro/exit etc etc - i am on SCM 7.0
    Thanks,
    TJ

    Tejinder
    Try using the CEIL() function in a macro.
    Rishi Menon

  • How to return whole number using round function

    hi
    can i get sql query using round function how to return whole number value

    Hi welcome to the forum. if you want whole number value what does it mean
    1. whether you want the whole number greator than or eqaul to that number example for 12.6 you want 12 or 13
    see below example
    1.  SQL> select round(12.5) from dual;
    ROUND(12.5)
             13
    2.  SQL> select round(12.4) from dual;
    ROUND(12.4)
             12
    3.  SQL> select floor(12.5) from dual;
    FLOOR(12.5)
             12
    4. SQL> select floor(12.4) from dual;
    FLOOR(12.4)
             12
    floor will always give you a round value which is a integer or whole number less than or equal to but output of rond will differ if the value is greator than 12.5 it will give 13 but if it is less than 12.5 it will give 12, so depending on your requirement you can choose which function to use. similarly if you always want to get the whole number greator than the number you can use ceil as below
    SQL>  select ceil(12.3) from dual;
    CEIL(12.3)
            13
    SQL>  select ceil(12.8) from dual;
    CEIL(12.8)
            13

  • Rounding to a whole number

    What is the proper syntax for rounding to a whole number.  In my spread sheet I have a function set up to apply a divisor to cost, in this case  = F7 $625 / G7 .65 = $961.54.  I simply want the number to round to the nearest whole dollar amount  $962.00

    Hi ghemmen,
    or you could just do with formatting.
    quinn

  • Rounding of Qty to the nearest whole no in PO

    Hi All,
    We have material whose base unit of measure is say centimetres. and it has purchase unit as metres.
    Our requirment for procurement is generated through MRP run which creates the Purchase requistion and in PR the UOM considered is the base unit of measure  ie centimetres.
    When this Purchase req is converted to Purchase Orders we get qty sometimes in decimals  for ex: if in Pur req the qty is 150 centimetres , in PO it is shown as 1.5 metres.
    Is there a way for rounding of 1.5 to 2.0 metres in PO (means to the nearest whole no) automatically.
    Thanks,
    Vengal

    in MRP view of material master you have two fields to care about rounding. rounding profile and rounding value
    http://help.sap.com/saphelp_46c/helpdata/en/f4/7d28c844af11d182b40000e829fbfe/content.htm

  • Whole number rounding off in bom

    is it possible not to round off whole numbers in the bom component quantity? for example, when i input the number 8.000, the system rounds it off to just 8.

    Hi,
    Please let know your unit of measurement.
    Goto CUNI set the Decimal places and decimal pl.routing = 3 for your unit .
    Now try with decimal places at BOM.
    If your unit is related to whole number like Nos, EA system will give warring message.
    Pradeep

  • Is it possible to use NUMCHARS to display the number of characters in a block of text instead of the whole document? How?

    Is it possible to use NUMCHARS to display the number of characters in a block of text instead of the whole document? How?

    Getting the character count for a paragraph is trivial:
    Sub NumChars1()
    MsgBox Selection.Paragraphs(1).Range.Characters.Count
    End Sub
    Even outputting it to the document is trivial:
    Sub NumChars2()
    With Selection.Paragraphs(1)
      .Range.InsertAfter .Range.Characters.Count
    End With
    End Sub
    The real issue comes when you want to update the document. If the destination paragraph is only ever empty or contains the character count of the previous paragraph, you could use:
    Sub NumChars3()
    With Selection.Paragraphs(1)
      .Next.Range.Text = .Range.Characters.Count & vbCr
    End With
    End Sub
    Cheers
    Paul Edstein
    [MS MVP - Word]

  • How to round numbers to the nearest .25

    I would like to enter a number in one field and have it rounded to the nearest .25 in another column - (whether that's rounding up or down)
    Example:
    Actual Size
    Adjusted Size
    7.21435
    7.25
    Any help would be appreciated.
    Thanks!

    Hi c,
    The ROUND function limits the precision choices to powers of 10, so we need to work within that limitation:
    Multiply by four, round to the nearer whole number, divide by four.
    Formula in column B: =ROUND(A*4,0)/4
    All cells in B are formatted as Number, with decimal places set to 2.
    Regards,
    Barry

  • Can I format a paragraph in illustrator, with multiple text sizes?

    Hi,
    I have a number of paragraphs in illustrator that have the following...
    a title = Arial bold 18 pt.
    body text =Arial reg 14 pt.
    and indents with bullets
    It seems that illustrator only supports one font, size, color, etc. for each Paragraph style. I would like to be able to set the title to Arial bold, 18pt, Blue, and the body text to Arial regular, 14pt, white, with different leadings, within the same style setting. Does anyone know if this can be done?
    Thank you in advance.
    Knewt

    What are you guys talking about? Since when does InDesign support multiple text attributes for a single Paragraph Style? At least in CS3 InDesign's Paragraph Styles have settings for nested Character Styles and drop caps, but you still define one set of text attributes for the Paragraph Style itself.
    In principle it's basically the same in Illustrator. If you want to actually have multiple text treatments in one paragraph, you apply Character Styles to text ranges within the paragraph. Illustrator's implementation of it is pure crap in that inheritance and style redefinition does not work correctly, but the fact remains you certainly can have multiple text treatments in one paragraph, but it is not done with a single Paragraph Style. If using Styles (as you should) it is a matter of nesting Character Styles within paragraphs that have Paragraph Styles applied.
    But I strongly suspect that what Mr. Harley is describing is not really a single paragraph at all. He wants different text sizes, different indents, and bullets. That clearly involves multiple paragraphs.
    Harley, in part of your description of what you want, you seem to be referring to a single textframe object as a "paragraph." A paragraph is a range of text separated by a carriage return. When you define and apply a Paragraph Style, the carriage return defines the range of the Style. When you define and apply a Character Style, the selected range of characters define the range of the Style. You can use multiple Character Styles within a paragraph that has a Paragraph Style applied.
    But you are talking about the need to define several Paragraph Styles to use in one block of text, or "story" (one or several textframe objects). You just need to define three Paragraph Styles:
    Heading: Arial Bold 18 pt.
    Body: Arial Regular 14 pt.
    BodyBullet: Same as Body, but with different indents. Set a tab at the bullet location and at the left indent. (You type your bullet characters; you don't just select "bullets" from a setting.)
    Type all your text, using carriage returns as you would expect. Each carriage return marks the beginning of a new paragraph. (This is as true in Illustrator as it is in InDesign, Word, or anything else.) Click inside a paragraph and apply the appropriate Paragraph Style.
    Now suppose you want to use a convention within your document that emphasizes certain words or phrases by painting them magenta instead of whatever color is defined in the Paragraph Style. Create a Character Style. Name it Emphasis. In that Style, set the character color to magenta. Now swipe across a word in one of your paragraphs and apply the Emphasis Character Style. The whole paragraph still has the Paragraph Style you applied to it. But now the color of a few characters is overridden by the Character Style you have applied to those characters.
    Again, like many things in Illustrator, its implementation of Paragraph Styles and Character Styles is very sloppy compared to other programs. But it is not true that 'InDesign can apply multiple text treatments in a single Paragraph Style, and Illustrator can't.' At least not up to CS3.
    JET

  • Rounding stroke thickness to nearest decimal?

    I have a project where many objects have been scaled up and down during the creation of the artwork. And I'm left with some lines that are .9581 pts and some that are 1.039 pts.
    Just because I'm a neat freak, is there a script that would round the stroke thickness to the nearest .1 decimal? Or whole number? Or user selectable amount of decimals?

    Navarro Parker,
    loop through your path items of selection. This is simple, if only path items in your selection exists:
    // StrokeThicknessRoundingNearestDecimal.jsx
    // required: one or more selected stroked pathItem(s)
    // Rounding stroke thickness to nearest decimal
    // https://forums.adobe.com/message/6764907#6764907
    // regards pixxxelschubser
    var sel = app.activeDocument.selection;
    for (i=0; i < sel.length; i++) {
    if (sel[i].stroked == true) {
        sel[i].strokeWidth = Math.round(sel[i].strokeWidth*10)/10;
    But much more complicated, if there are compound paths or e.g. grouped paths or nested grouped grouped … paths and not possible for strokes which are added in the appearance palette.
    Have fun

Maybe you are looking for

  • Moving avergae price updation in material master for project stock

    Dear All, My query is pertaining to updation of MAP( moving average price) for project specific procurement ( as project stock) for valuated project stock. As  definelty the cost of procurement gets consumed by project .but i want to know does the pr

  • Satellite Pro A120 will not boot up

    Sorry for bad English! My computer will not boot. I want to install a BIOS but connecting it to another computer but I dont know how?

  • ICal will not open (Snow Leopard)

    I have not be able to figure out what is wrong with my iCal. I have been using it since Dec 2009 when I got my iPhone. Now when I try to start it up it quits after 3 seconds. I have tried to remove the plist file, fix the sync, re-installed it from m

  • Illustrator CS3 No Text when opening PDF

    This happens to certain .pdf files when opened in Adobe Illustrator 13.0.x. http://www.cigar3tte.net/images/illustrator_error1.jpg (The scratches are from me, to take out company info) Note that all the fields are blank, but when the file is opened i

  • Can't change password for SMTP outgoing server.

    I changed my password on the server via a different method, now I need to change the password Thunderbird uses to send messages to that new password. No matter what I do, I can't seem to get Thunderbird to ask for the password again, it just keeps us