How to resize a textFrame, when resizing as its parent (a groupitem)?

I am trying to find the smallest textframe within a group and then match that textframe font size to the minimum size allowed for printing. Everything works, except that I can't understand how to resize the textframe when resizing as its parent, the group.

#target illustrator

app.activeDocument = docRef;

gpRef = docRef.groupItems [0];

var gpHeight = gpRef.height;

It's printing allowed minimum font size

var minFntSize = 18;

var garbLay;

var txtFrmCount = gpRef.textFrames.length;

var container = {};

var i;

put each prop textframe and height in json

for (i = 0; i < txtFrmCount; i ++) {}

container ["prop" + i] = {"gpTfHeight':gpRef.textFrames [i] .height / 72, 'gpTarget':gpRef.textFrames [i]"};

}

find the value prop textframe height min. I have the max in it too just in case I need it in the future

var min = infinity;

var max = - infinity;

var x;

for (x in container) {}

If (container [x] ['gpTfHeight'] < min) {}

min = container [x] ["gpTfHeight"];

minTg = container [x] ["gpTarget"];

}

If (container [x] ['gpTfHeight'] > max) {}

Max = container [x] ["gpTfHeight"];

}

}

duplicate textframe, convert in way and get the actual height

var txtFrmDup = minTg.duplicate ();

txtFrmDup.position = [(minTg.position[0]-100), (minTg.position [1] - 100)];

txtFrmDup.name = "garbage."

var tOutline = txtFrmDup.createOutline ();

tOutline.name = "garbage."

var tLogHeight = Math.round (tOutline.height);

garbLay = gpRef.groupItems.getByName ('garbage');

This is the part where I need to convert it into percentage? tgSize is the size of the target and I thought I could get the different from the 2 and then use this amount to resize down...

var tgSize = minFntSize - tLogHeight;

var PERC = Math.round((tgSize/gpRef.height)*100);

$.writeln (minFntSize);

$.writeln (tLogHeight);

$.writeln (tgSize);

$.writeln (perc);

resize gp so that font textframe min size meets minFntSize

if(tLogHeight < minFntSize) {}

gpRef.resize (perc, perc);

$.writeln ('smaller');

garbLay.remove ();

} else if(tLogHeight > minFntSize) {}

gpRef.resize (perc, perc);

$.writeln ('bigger');

garbLay.remove ();

} else if(tLogHeight == minFntSize) {}

$.writeln ('equal');

}

I do not know if I go about it the right way. Hoping a new set of eyes can take a look and see what I'm doing wrong or not done? Thank you!

check this out, I changed it a bit

// scale grouped text Frames to a minimum font size
// http://forums.adobe.com/thread/1323065?tstart=0
// carlos canto

#target illustrator

var docRef = app.activeDocument;
var gpRef = docRef.groupItems[0];

//this is the minimum print font size allowed
var minFntSize = 18;

var txtFrmCount = gpRef.textFrames.length;

// make the first frame the one with the minimum font size
var idx = 0;
var minFrameFontSize = gpRef.textFrames[idx].textRange.characterAttributes.size;

// see if the other frames have smaller font size than the first
for(i = 1; i < txtFrmCount; i++) {
    var itext = gpRef.textFrames[i];
    var fontSize = itext.textRange.characterAttributes.size;
    if (fontSize 
         

Tags: Illustrator

Similar Questions

  • How to resize the height of a GroupItem.

    app.executeMenuCommand ('selectall');

    app.executeMenuCommand ('group');

    var finishedLayout = app.activeDocument.selection

    finishedLayout.height = NewHeight

    finishedLayout.height = NewHeight gives a good nominal figure in the data browser

    but on the page (Illustrator CS6) and inside the GroupItem data it has not changed.

    Clearly the methods I've tried so far are bad - including

    finishedLayout.GroupItem.height = NewHeight that gives an error.

    Please someone told me the correct syntax to use:

    Sorry - as I said before, I'm new on this point and documentation

    is not exactly full of illustrations and useful tips, although this forum is,

    and thank you in anticipation of your response.

    .. .or

    app.executeMenuCommand ('selectall');

    app.executeMenuCommand ('group');

    var finishedLayout = app.activeDocument.selection [0]; under the direction

    finishedLayout.height = NewHeight

  • How do a film attached to slide with its parent company / not move independently.

    Hi there, I was hoping that someone can help me.

    I would like to fix a clip to a removable clip (with A3). I introduced a clip using startDrag() - all fine work. But I would like to be able to dynamically place a clip on the inside so that it drags too. I got it partly working - you can drag the original clip around and clip attached (using aadChild) moves too. But if I take the clip attached instead of the original item moves independently.

    Is it possible to get a clip inside the adjustable clip and fixed in place and does not move when you try to drag it.

    See you soon

    View the code that you use to assign the activity slide as well as the addition of the child to the object that has the activity of drag are entrusted to him.  Looks like you might be assigned the startDrag the event.target instead the event.currentTarget.

  • How to resize photos for export in the new photo software?

    When exporting photos to use for electronic mail, in iphotos, it was very simple resize (reduce quality or size). How I do in the new photo software?

    You should be able to use the Help Viewer in the Photos app for information

    How to resize or rotate an image. I haven't used an Apple photo app that much

    but know the preview application can resize or rotate an image, change the dimensions,

    do rotate/return the images, rotate/return several images, reduce the size of image file + change file type.

    • Preview (Yosemite): resize or rotate an image

    If Apple's Photo application should be these kinds of tools and the Help Viewer

    in the menu bar in the Photos is a place to enter 'resize or rotate an image' or research.

    Good luck & happy computing!

  • How to resize a 3D object after beeing merge with others

    Hello

    I would like to know how to resize a 3D after the merger with another 3d object object.

    I know not how to do this before merging, but Photoshop can import 3d as 3DS for example objects and

    After the merger of some appears very low compare to others...

    After the merger, it seems that it is only possible to resize the object piece by piece.

    When I resize before the merger, it makes no difference after the merger...

    Thanks for helping me

    You can resize the objects after the combination by adjusting the individual meshes

    on 3d objects more.

    http://help.Adobe.com/en_US/Photoshop/CS/using/WS31576EB8-5348-4a1e-A4E7-7D122A56F41F.html

    http://help.Adobe.com/en_US/Photoshop/CS/using/WS73EB2D8A-AAE0-4928-9BB6-357D63B1C855.html

    MTSTUNER

  • DON'T KNOW: How to resize a clip created during execution

    I don't know how to resize a clip created when running...



    Thank you. This works. I used _xscale and _yscale.

    var listener: Object = new Object();
    my_mcl. AddListener (Listener);
    listener.onLoadComplete = function() {}
    my_mc._xscale = 25;
    my_mc._yscale = 25;

    };

  • I downloaded a game on the internet, and now my screen does not match my screen. I have two large black areas on each side of my screen. How to resize my screen to fit the screen of my computer? (and yes I tried the button expand) :))

    I have two large black areas on each side of my screen. How to resize my screen to fit the screen of my computer? (and yes I tried the button expand) :))

    Hello val2000, welcome.

    These games is managed inside of Internet Explorer? If this isn't the case, then I suggest contacting the manufacturer of your computer for the latest pgrahics drivers. If installation of those who does not resolve the problem, then try to change your resolution to one of the following values (depending on the size of your screen):

    1024 x 768
    1280 x 800 (wide, common form for laptops)
    1280 x 1024
    1680 x 1050 (widescreen)

    To change your resolution:

    1. click on START
    2. click on "Control Panel."
    3. double click on "display".
    4. click on the tab "settings".
    5. change the resolution on your cursor tab and then click on 'Apply' at the bottom right

    Let us know what happens

    Thank you! Ryan Thieman
    Microsoft Answers Support Engineer
    Visit our Microsoft answers feedback Forum and let us know what you think.

  • How? Resize photos in the Gallery Windows without email?

    Hi all
    I need to know how to resize a photo in the Gallery Windows 1-4 (2). I want to keep this version of Windows. I don't want to send this picture. Rather, I need to resize the photo, save to my computer for later posting in a forum, I belong.
    The only option I see for resizing is in email. Ideas?
    Tina

    Hi all
    I need to know how to resize a photo in the Gallery Windows 1-4 (2). I want to keep this version of Windows. I don't want to send this picture. Rather, I need to resize the photo, save to my computer for later posting in a forum, I belong.
    The only option I see for resizing is in email. Ideas?
    Tina

    ==================================
    Maybe this article will be useful:

    Resizing Photos in Windows Live Photo Gallery

    If this is not the solution you ae looking for...
    the following free resizer might be worth a try:

    VSO Image Resizer
    http://www.VSO-Software.fr/products/image_resizer/

    VSO Image Resizer: tutorial
    How to resize my images and photos?
    http://www.VSO-Software.fr/products/image_resizer/how-to-compress-photos/how-to-resize-images-Guide.php

    John Inzer - MS - MVP - digital media experience

  • How to resize windows (vertical cracking)

    I do the "Text the Page Web Style" tutorial in Dreamweaver. He tells me: I styles.css showing in split view. Resize the code window so that all text in web design is to the left of the image of Saturn.              I see not the first a graph of Saturn, and how I resize the windows so that they are side by side?

    Thank you

    [edited by moderator subject line]

    Have you downloaded the example of the tutorial page files? It features the image of Saturn.

    To get the code side by side with the web page, select split vertically in the menu display of DW. You resize the windows by dragging the border between them.

  • How to resize a vector to insert in a template?

    Hello

    How you resize a vector to insert in a template? My vector image is too big for the place where I have to put in the template.

    Thank you for helping me.

    Annemarie

    There are many ways to resize your vector image. Once the image is selected, you can:

    (1) click and drag the scale tool (while holding down the SHIFT key to constrain the proportions)

    (2) click and drag on one of the handles of the framework encompassing (while holding down the SHIFT key to constrain the proportions)

    (3) type a new height or width in the range of transformation (ensuring that the proportion lock icon is selected)

    (4) a percentage scale determined with object > transform > scale

  • How to resize the print size of an item within my PDF to multiple pages? For example a receipt or another image that can scan in bigger or smaller than my 8.5 x 11 Bill?

    How to resize the print size of an item within my PDF to multiple pages? For example a receipt or another image that can scan in bigger or smaller than my 8.5 x 11 Bill?

    Hello

    In the print dialog box, you would get options to resize your document.

    Try them and see if that helps.

    Once you choose the print option, it would give options to change the size of the page you need.

    Please check and see if it suits you or not.

    Concerning

    Sukrit diallo

  • How to resize a pdf file

    Hello everyone

    I need resized my paper poster in A4 format. It is a file that I don't need to print but to send.

    Thank you

    Hi Barbara,

    This might help: https://acrobatusers.com/tutorials/how-to-resize-pages-in-a-pdf-file

    Kind regards

    Rahul

  • additional horizontal space in code view no matter how I resize the window

    on dreamweaver OSX10.10.2 CC 2014.11 I can still scroll horizontally on two characters in code view, no matter how I resize the window

    Hello Greg,.

    The screenshots, has explained the issue!

    It is present in previous versions of DW as well & only happens for PHP files. Nevertheless, I logged a bug for this.

    As a solution for the moment, you can simply activate and deactivate the option of film word in horizontal mode Code to get rid of the scroll bar.

    Thank you

    Delphine

  • How to resize a photo for which fills right up to the whole composition window?

    How to resize a photo for which fills right up to the whole composition window?

    Twirl in the transformation of the layer properties and resize it to the top. You can consider using the scale detail Preserving effect if the difference in size is important. Otherwise, its largest size in Photoshop.

    If you don't know how to scale a layer, you should really start here: starting After Effects

  • How to resize the width of the region

    Hi all

    I use apex 4.2.2 database oracle 11g R2, IE 9.

    I created a region on the HOME tab to the navigation menu.
    but its width is covering the width of the entire page.
    How could resize the width of the navigation region?

    Thank you very much.

    Hi Maahjoor,

    Change the region and

    In the Region attributes set style = ' width: 300px; " instead of 300, you can put all desired widths.

    hope this helps you.

    Kind regards
    Jitendra

Maybe you are looking for