Team LiB   Previous Section   Next Section
FontSync Extension

Syntax

(* 'tell app "FontSync"' targets the FontSync control panel. Make sure to 

specify "FontSync  Extension" if you are using the extension's commands 

not the control panel's. They are different applications! *)

tell app "FontSync Extension"

   set theProfile to (new file with prompt "Save the profile as: "¬

   default name "FontSync profile")

end tell

Dictionary commands

create font profile alias

This command creates a FontSync profile of the computer's active fonts and stores it in the file represented by the alias parameter. You can use the new file scripting addition (which returns an alias type) to prompt the user to create a new file for the profile. This example creates a FontSync profile in the alias represented by the theProfile variable:

create font profile (new file with prompt¬

"Pick the FontSync profile file location"¬

default name "FontSync profile" )

with creator class

This property specifies the four-character creator type for the FontSync profile file. The default type is "'fns'." If you try to set this property to other creator types such as "R*ch," then you will raise a script error.

version integer

As of FontSync 1.0, you cannot use this parameter without raising an error.

get reference to object

Use this command to get some FontSync Extension data such as:

tell app "FontSync Extension" to get version

match against alias

Use this command to match the font information in one computer system with another computer's font sets. The alias parameter must point to a Fontsync profile file. An example of match against is:

tell application "FontSync Extension" to match against

(alias¬ "Macintosh HD:Desktop Folder:font profile")

The "font profile" file could have been created with the create font profile command. match against then returns a list of match result objects, which are record types that report any problems with certain fonts. The match results look like this:

{class:match result, problem reported:mismatch, name:"Arial Narrow", font:2000, style:3}

See the match result class.

using fonts from alias

When you use match against withoutthe using fonts from parameter, then the command compares the computer system's active fonts against the specified FontSync profile. If you want to compare two FontSync profile files, then use code such as the following:

tell application "FontSync Extension" to match against (alias

¬ "Macintosh HD:Desktop Folder:font profile") using fonts from

¬ (alias "Macintosh HD:Desktop Folder:FontSync profile")

This code phrase compares the two files "font profile" and "FontSync profile" and returns any mismatch information. This is an optional parameter.

with match options match options

You can use a different set of match options than those specified in the FontSync control panel by specifying a match options object with the with match options labeled parameter. An example is:

tell application "FontSync Extension" 

   set matchOpts to¬

   {class:match options, on options:{font names, font types, 

   glyphs, encodings, QuickDraw metrics, ATSUI metrics, kerning,

   WorldScript layout, missing data mismatches}, off options: 

   {advanced layout, print encoding}} 

   match against¬

   (alias "Macintosh HD:Desktop Folder:applescriptcode_Appen.txt")¬

   with match options matchOpts

end tell

See the match options class.

quit

This command quits the FontSync Extension application.

run

If it is not already open, this command runs the Fontsync Extension application. In other words, it will be added to the list of running applications on your computer, even though it is a faceless background application. It does not have a graphical appearance on the computer, such as windows and menus, for interacting with the user (FontSync Extension can be controlled with AppleScript, however).

set

Use this command to set some FontSync Extension data, as in:

tell app "FontSync Extension" to set quit delay to

30

This application's quit delay is 60 by default. See the application class' quit delay property.

Dictionary classes

application

This class represents the FontSync Extension program. It is the target of the tell statement in the code:

tell app "FontSync Extension" to set quit delay to 30

name international text

This name property evaluates to the value "FontSync Extension."

version version

version returns a string for the program's version number, which on Mac OS 9.0.4 is "1.0."

quit delay the constants immediate/default/never or an integer

Fontsync Extension is a faceless background application that opens, hopefully does its job, and then quits after a default of 60 seconds. You can change this delay time to suit your purpose, such as to never, so that Fontsync Extension stays open until it is sent a quit Apple event, or to a number of seconds, such as 30.

match options

This class is a record type that looks like {class:match options, on options:{font names, font types, glyphs, encodings, QuickDraw metrics, ATSUI metrics, kerning, WorldScript layout, missing data mismatches}, off options:{advanced layout, print encoding}}. A record is one or more name/value pairs separated by commas and enclosed by curly braces ({}). In this case, some of the values are lists, such as all of the font characteristics that are "on" and therefore will be matched for each font in a profile or computer system, such as:

on options:{font names, font types, glyphs, encodings, QuickDraw

metrics, ATSUI metrics, kerning, WorldScript layout, missing data

mismatches})

A match options object is used with the with match options labeled parameter for the match against command. An example is:

tell application "FontSync Extension" 

   set matchOpts to¬

   {class:match options, on options:{font names, font types, 

   glyphs, encodings, QuickDraw metrics, ATSUI metrics, kerning,

   WorldScript layout, missing data mismatches}, off options: 

   {advanced layout, print encoding}} 

   match against¬

   (alias "Macintosh HD:Desktop Folder:applescriptcode_Appen.txt")¬

   with match options matchOpts

end tell

on options list of constants (read-only)

This on options property is a list of one or more of the following:

advanced layout
Kerning
ATSUI metrics
missing data mismatches
encodings
print encoding
font names
QuickDraw metrics
font types
WorldScript layout
glyphs

off options list of constants (read-only)

This off options property is a list of one or more of the following:

advanced layout
Kerning
ATSUI metrics
missing data mismatches
encodings
print encoding
font names
QuickDraw metrics
font types
WorldScript layout
glyphs

match result

This object is returned from the match against command, which matches a system's font sets to a FontSync profile or matches two FontSync profiles. match result is a record type that looks like {class:match result, problem reported:mismatch, name:"Arial Narrow", font:2000, style:3}. In this case, a FontSync match reported a problem with the "Arial Narrow" font. A record is one or more name/value pairs separated by commas and enclosed by curly braces ({}). Chapter 3 describes the record type.

problem reported mismatch or noRef (read-only)

This property evaluates to the constants mismatch or noRef.

name international text

This property returns the font name, such as "Arial."

ID integer

This ID number represents the font family of the problem font; if the font does not belong to a font family, this value may be -1.

style integer

This property is a number such as 3 or -1 if the property does not apply to the font.

Examples

(*

This script can be found in startup disk:Apple Extras:Font Extras

*)

on run

   if OKToProceed(  ) then

      set theProfile to new file with prompt "Save the profile as: "¬

      default name "FontSync profile"

      try

         -- This can take a while...

         tell application "FontSync Extension" to create font profile¬ 

         theProfile

         display dialog "Created FontSync profile named \"" & name of¬ 

         (info for theProfile) & "\"" with icon note buttons {"OK"}¬

         default button 1

         on error err

         display dialog "Encountered an error (" & err & ") while¬

         creating \"" & name of (info for theProfile) & "\"" with icon¬

         stop buttons {"OK"} default button 1

      end try

   end if

end run



on OKToProceed(  )

   set theButton to button returned of (display dialog "This can take a¬

   long time if you have many fonts. Do you wish to proceed?" with icon¬

   caution giving up after 30)

   return (theButton = "OK")

end OKToProceed



    Team LiB   Previous Section   Next Section