Repository navigation
Expand file tree
/
Copy pathtext_block.jsx
More file actions
56 lines (42 loc) · 1.77 KB
/
Copy pathtext_block.jsx
File metadata and controls
56 lines (42 loc) · 1.77 KB
1
//@includepath "~/Documents/;%USERPROFILE%Documents";//@include "basiljs/basil.js";function draw() { //b.clear(b.doc()); // clear the current document //General b.units(b.PT); b.colorMode(b.CMYK); //Modes b.rectMode(b.CORNER); b.ellipseMode(b.CENTER); //Text b.textFont("JST Robomotive", "Regular"); b.textTracking(0); b.textSize(15); b.textLeading(22.5); b.textAlign(Justification.CENTER_ALIGN, VerticalJustification.TOP_ALIGN); //show date in console, because we can b.println( b.nf(b.day()) + "." + b.month() + "." + b.year() + ", " + b.hour() + ":" + b.nf(b.minute()) + " Uhr" ); //Only testet so far with the font JST Robomotive, only in one format and with a text with rather average line width //Start Script var mySelection = b.selection(); var myLines = b.lines(mySelection); var myCharacters = b.characters(mySelection); var selBounds = b.bounds(mySelection); b.typo( mySelection, 'appliedFont', "JST Robomotive" ); b.typo( mySelection, 'pointSize', 10 ); //Make all lines same width var linesWidth = []; for (var i = 0; i < myLines.length; i++) { linesWidth[i] = b.bounds(myLines[i]).width; var resizePT = 8.5 * selBounds.width * 0.99 / linesWidth[i] - 0.9; //This is where the magic happens: the variable "resizePT" is individually calculated for every line from the width of this very line and the width of the selected textframe. The first (multiplied) and last (subtracted) value are necessary for the finetuning. Change them by 0.1 to 1.0 to see how they influence the relationship between lines that are short/medium/long. b.typo( myLines[i], 'pointSize', resizePT ); b.typo( myLines[i], 'leading', resizePT * 0.9 ); }};b.go();