Jump to content

Text alignment help


Recommended Posts

Hello, and thanks for reading. I'll try to be concise.


In trying to format text, typical on business cards. Many layouts format with a prefix followed by the number, and include a desired space in between. Here's an example with three spaces between.


T 604.323.2323

C 604.232.3232

F 604.323.2323


Here's my code;

if (Field("Tell") == "")

return "";


return 'T '+Rule("TelFor");


Here are my questions;

- Fusion seems to honour just one space. If I put three ('T '), only one is applied (even in this HTML formatting). How can I apply more, or tabs?


- Characters have different kerning values. Even in my example above, the 604 do not line up, because of these values. How do I align my phone numbers?


- Is there a method to affect tracking for the entire phone number, so they align overall?


I use various cheats, but this has to be a common issue... Perhaps I missed a simple solution somewhere?


Any advice would be much appreciated.





Fusion Mac 9.2.31

Link to comment
Share on other sites

-To get more than one space you need to use a non breaking space character " "

-Instead of trying multiple space, just use a tab character "<t>" and set your tab stops in paragraph settings so they all left align.

- I'm sure there's a way to calculate the width of the text and apply specific tracking with the FusionProTextMeasure function, there''s a couple examples on the boards here.

Link to comment
Share on other sites

Mike, one way you can control the spacing between the identifier and the number is to put each of them in separate columns of a table and then adjust the width of the columns.


This is just some sample code that I think might help you out in this scenario:

var numbers = [
"T: " + Field("Phone"),
"C: " + Field("Cell"),
"F: " + Field("Fax")];

var idWidth = 0.5; // inches
var noWidth = 1.5; // inches

// Filter empty numbers from the array
numbers = numbers.filter(function(m){return m.replace(/[^\d]/g,'');});

// Start a table for the numbers
var myTable = new FPTable;
myTable.AddColumns(idWidth*7200, noWidth*7200);

// Add numbers
for (var i=0; i<numbers.length; i++) {

   var id = numbers[i].replace(/([^\d]*)\d+/g,'$1');
   var no = numbers[i].replace(/[^\d]*(\d+)/g,'$1');

   myTable.Rows[i].SetContents(Trim(id), no);

return myTable.MakeTags();

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...