4 Replies Latest reply on Apr 25, 2015 9:05 PM by BEGINNER_X

# Bullet point Size

Hi All,

Request:

1. Select two characters (any character and bullet)

2.Bullet size want to be 55% height of first character

3. Still now, I write code for to find the 55% height of character

4. Need help, how to apply to change the bullet size as per calculation.

Trying Code:

```var mySel = app.selection[0];
var mySel1 = app.selection[0].characters[0];
var mySel1_CreOutlines = mySel1.createOutlines();
var myGB = mySel1_CreOutlines[0].geometricBounds;
app.activeDocument.undo();

var myGB_Height = myGB[2]- myGB[0]

var _55_Height = (myGB_Height*55)/100;
```

Any help or any other different way much be appreciated.

Regards

Siraj

• ###### 1. Re: Bullet point Size

Hi Siraj,

Do you mean that the bullet size must be adjusted so that its visible height is .55 times the visible height of the 1st character?

That's big! Anyway you could try this:

```// The required ratio
// ---
const REQ_RATIO = .55;

// Boring constants
// ---
const CS_IN = +CoordinateSpaces.innerCoordinates,
IN_BOX = [+BoundingBoxLimits.geometricPathBounds,CS_IN],
TOP_LOC = [[0,0]].concat(IN_BOX),
BOT_LOC = [[0,1]].concat(IN_BOX);

// Assuming two characters are selected
// ---
var sel = app.selection[0],
a = sel.characters.everyItem().createOutlines(false),
h = [], t, k;

// Compute the heights => h[0],h[1]
// ---
while( t=a.pop() )
{
t = t[0];
h.unshift(t.resolve(BOT_LOC,CS_IN)[0][1]-t.resolve(TOP_LOC,CS_IN)[0][1]);
t.remove();
}

// Apply the needed factor to the character scale
// (or you could use pointSize, alternately)
// ---
k = REQ_RATIO*(h[0]/h[1]);
sel.characters[1].verticalScale *= k;
sel.characters[1].horizontalScale *= k;
```

@+

Marc

• ###### 2. Re: Bullet point Size

Hi Marc,

Excellent, Fantastic Stuff you have..

Output is exactly what I want...

But your code is very hard for me.

Because, I need to apply this logic in different areas.

I need this calculation, what I mentioned in the first thread.

var _55_Height = (myGB_Height*55)/100

through script, again I select the Bullet Size, any ideas... Plz help.

• ###### 3. Re: Bullet point Size

Hi Siraj,

Well, in pure math terms, the whole stuff is at line #30 of my code. Let's try to clarify. The most important point, I think, is to understand that it's easier to deal with a ratio than an absolute height—because your condition is expressed in terms of a ratio (55%).

1. We compute both the visible height of the first character—say H0—and the visible height of the bullet—say HB—using the outline trick. Note: H0 is equivalent to myGB_Height in your syntax.

2. Now, let k be the factor by which we'll have to change (i.e. rescale) the bullet height, HB, in order to meet the condition. Your goal can be expressed as follows,

k × HB = ( 55 / 100 ) × H0.

3. Which leads to k = 0.55 × ( H0 / HB ). This is exactly the purpose of line #30 above.

4. Finally you change the scale of the bullet by k, working either on its verticalScale and horizontalScale properties, or on its pointSize. (I think scaling is more relevant here.)

So the transformation scheme is simply: bulletSize → bulletSize × k.

Hope that helps.

@+

Marc

• ###### 4. Re: Bullet point Size

Hi Marc,

Thanks a lotttttt!!!!!

You spend your valuable timing to guide me.

I got output using your way.

Regards

Siraj