Adobe 65009333 Scripting Guide - Page 41

Fonts, complete script, see FontCollections

Page 41 highlights

Text and Type Formatting text 41 if(underline == true){ underlineColor = app.colors.item("Black"); underlineGapColor = app.swatches.item("None"); underlineGapOverprint = false; underlineGapTint = 100; underlineOffset = 3; underlineOverprint = false; underlineTint = 100; underlineType = app.strokeStyles.item("Solid"); underlineWeight = .25 } verticalScale = 100; } Fonts The fonts collection of an InCopy application object contains all fonts accessible to InCopy. By contrast, the fonts collection of a document contains only those fonts used in the document. The fonts collection of a document also contains any missing fonts-fonts used in the document that are not accessible to InCopy. The following script shows the difference between application fonts and document fonts (for the complete script, see FontCollections): //Shows the difference between the fonts collection of the application //and the fonts collection of a document. var myApplicationFonts = app.fonts; var myDocument = app.documents.add(); var myStory = myDocument.stories.item(0); var myDocumentFonts = myDocument.fonts; var myFontNames = myApplicationFonts.everyItem().name; var myDocumentFontNames = myDocument.fonts.everyItem().name; var myString = "Document Fonts:\r"; for(var myCounter = 0;myCounter

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88

Text and Type
Formatting text
41
if(underline == true){
underlineColor = app.colors.item("Black");
underlineGapColor = app.swatches.item("None");
underlineGapOverprint = false;
underlineGapTint = 100;
underlineOffset = 3;
underlineOverprint = false;
underlineTint = 100;
underlineType = app.strokeStyles.item("Solid");
underlineWeight = .25
}
verticalScale = 100;
}
Fonts
The fonts collection of an InCopy application object contains all fonts accessible to InCopy. By contrast, the
fonts collection of a document contains only those fonts used in the document. The fonts collection of a
document also contains any missing fonts—fonts used in the document that are not accessible to InCopy.
The following script shows the difference between application fonts and document fonts (for the
complete script, see FontCollections):
//Shows the difference between the fonts collection of the application
//and the fonts collection of a document.
var myApplicationFonts = app.fonts;
var myDocument = app.documents.add();
var myStory = myDocument.stories.item(0);
var myDocumentFonts = myDocument.fonts;
var myFontNames = myApplicationFonts.everyItem().name;
var myDocumentFontNames = myDocument.fonts.everyItem().name;
var myString = "Document Fonts:\r";
for(var myCounter = 0;myCounter<myDocumentFontNames.length; myCounter++){
myString += myDocumentFontNames[myCounter] + "\r";
}
myString += "\rApplication Fonts:\r";
for(var myCounter = 0;myCounter<myFontNames.length; myCounter++){
myString += myFontNames[myCounter] + "\r";
}
myStory.contents = myString;
N
OTE
:
Font names typically are of the form
familyName
<tab>
fontStyle
, where
familyName
is the name
of the font family,
<tab>
is a tab character, and
fontStyle
is the name of the font style. For example:
"Adobe Caslon Pro<tab>Semibold Italic"