Skip to content

Commit

Permalink
restored a tiny flaw :)
Browse files Browse the repository at this point in the history
  • Loading branch information
fabiantheblind committed Dec 3, 2010
1 parent 813f66e commit 5ac52af
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion TypoGrid/theTypoGrid.jsx
@@ -1 +1 @@
// theTypoGrid.jsx// written by fabiantheblind 4 Bettina Müllers Typografie seminar @ the FHP// http://www.the-moron.net/// works best with monospaced types// run the scriptmain();function main (){// the script theValues.jsx needs to be next to this script#include "theValues.jsx";// this loads an Array of values. The function is in theValues.jsxvar theValues = theValues();// this makes the the doc and stores it in a variablevar theDoc = buildDoc();// get the firat page of the docvar thePage = theDoc.pages.item(0);// get the docs size and define the size of the text framevar w = theDoc.documentPreferences.pageWidth;var h = theDoc.documentPreferences.pageHeight;var theSize = 333;// calculate the position of the text framevar Y1 = (h/2)-(theSize/2);var X1 = (w/2)-(theSize/2);var Y2 = Y1 + theSize;var X2 = X1 + theSize;// this builds the content of the text framevar theContent = buildContent();// create a new textframevar theFrame = thePage.textFrames.add(); // at the calculated position theFrame.geometricBounds = [Y1,X1,Y2,X2]; // add the text to the text frame theFrame.contents = theContent; // get all paragraphs and characters for formattingvar theParagraphs = theFrame.paragraphs.everyItem();var theCharacters = theFrame.characters.everyItem(); // some styling theParagraphs.leading = "44 pt"; theCharacters.pointSize = "79 pt"; theParagraphs.justification = Justification.CENTER_JUSTIFIED; // now apply all values from theValues.jsx to the charactersfor(var k = 0; k < theFrame.characters.length;k++){ var c =theFrame.characters.item(k // could do something like this // c.fillTint = Math.random()*100; // but this is cooler c.fillTint = theValues[k]; }} // done/*// this is if the typo grid is allready there// and you select the the whole text// this is from building. don't need it but nice to have ;)for(var i = 0; i<app.selection[0].characters.length;i++){ var c = app.selection[0].characters[i]; //c.fillTint = Math.random()*100; c.fillTint = theValues[i]; } */ // this builds the content for the textframe function buildContent(){ // make 2 empty Strings var theContent = ""; var theString = ""; // this builds a string for (var i = 0; i < 19; i++){ theString = theString + "o"; } // this adds the new string over and over again with a breakline to make the grid for(var j = 0; j < 20; j++){ theContent = theContent + theString +"\n"; } // gives back the whole String return theContent; } // this builds the basic doc function buildDoc(){ // make a new document with some properties var theDoc = app.documents.add() with (theDoc.documentPreferences) { pageWidth = "1189 mm"; pageHeight = "841 mm"; //BleedBox settings documentBleedBottomOffset = "3mm"; documentBleedTopOffset = "3mm"; documentBleedInsideOrLeftOffset = "3mm"; documentBleedOutsideOrRightOffset = "3mm"; } with (theDoc.viewPreferences) { pageWidth = "1189 mm"; pageHeight = "841 mm"; horizontalMeasurementUnits = MeasurementUnits.MILLIMETERS; verticalMeasurementUnits = MeasurementUnits.MILLIMETERS; rulerOrigin = RulerOrigin.pageOrigin; } // give back the document return theDoc; }
// theTypoGrid.jsx// written by fabiantheblind 4 Bettina Müllers Typografie seminar @ the FHP// http://www.the-moron.net/// works best with monospaced types// run the scriptmain();function main (){// the script theValues.jsx needs to be next to this script#include "theValues.jsx";// this loads an Array of values. The function is in theValues.jsxvar theValues = theValues();// this makes the the doc and stores it in a variablevar theDoc = buildDoc();// get the firat page of the docvar thePage = theDoc.pages.item(0);// get the docs size and define the size of the text framevar w = theDoc.documentPreferences.pageWidth;var h = theDoc.documentPreferences.pageHeight;var theSize = 333;// calculate the position of the text framevar Y1 = (h/2)-(theSize/2);var X1 = (w/2)-(theSize/2);var Y2 = Y1 + theSize;var X2 = X1 + theSize;// this builds the content of the text framevar theContent = buildContent();// create a new textframevar theFrame = thePage.textFrames.add(); // at the calculated position theFrame.geometricBounds = [Y1,X1,Y2,X2]; // add the text to the text frame theFrame.contents = theContent; // get all paragraphs and characters for formattingvar theParagraphs = theFrame.paragraphs.everyItem();var theCharacters = theFrame.characters.everyItem(); // some styling theParagraphs.leading = "44 pt"; theCharacters.pointSize = "79 pt"; theParagraphs.justification = Justification.CENTER_JUSTIFIED; // now apply all values from theValues.jsx to the charactersfor(var k = 0; k < theFrame.characters.length;k++){ var c =theFrame.characters.item(k); // could do something like this // c.fillTint = Math.random()*100; // but this is cooler c.fillTint = theValues[k]; }} // done/*// this is if the typo grid is allready there// and you select the the whole text// this is from building. don't need it but nice to have ;)for(var i = 0; i<app.selection[0].characters.length;i++){ var c = app.selection[0].characters[i]; //c.fillTint = Math.random()*100; c.fillTint = theValues[i]; } */ // this builds the content for the textframe function buildContent(){ // make 2 empty Strings var theContent = ""; var theString = ""; // this builds a string for (var i = 0; i < 19; i++){ theString = theString + "o"; } // this adds the new string over and over again with a breakline to make the grid for(var j = 0; j < 20; j++){ theContent = theContent + theString +"\n"; } // gives back the whole String return theContent; } // this builds the basic doc function buildDoc(){ // make a new document with some properties var theDoc = app.documents.add() with (theDoc.documentPreferences) { pageWidth = "1189 mm"; pageHeight = "841 mm"; //BleedBox settings documentBleedBottomOffset = "3mm"; documentBleedTopOffset = "3mm"; documentBleedInsideOrLeftOffset = "3mm"; documentBleedOutsideOrRightOffset = "3mm"; } with (theDoc.viewPreferences) { pageWidth = "1189 mm"; pageHeight = "841 mm"; horizontalMeasurementUnits = MeasurementUnits.MILLIMETERS; verticalMeasurementUnits = MeasurementUnits.MILLIMETERS; rulerOrigin = RulerOrigin.pageOrigin; } // give back the document return theDoc; }
Expand Down

0 comments on commit 5ac52af

Please sign in to comment.