home *** CD-ROM | disk | FTP | other *** search
/ ProfitPress Mega CDROM2 …eeware (MSDOS)(1992)(Eng) / ProfitPress-MegaCDROM2.B6I / TEXT / UTILITY / PIL50KIT.ZIP / IN.PIL < prev    next >
Encoding:
Text File  |  1992-04-09  |  14.4 KB  |  452 lines

  1. /* In the example which follows two PIL files are shown. One describes pages
  2.    1 and 2, the other describes the display ad placed on page 2. The PIL file 
  3.    for pages 1 and 2 would have been generated by a page layout system, that 
  4.    for the display ad by an ad makeup system.
  5.  
  6.    Additional, content files are needed to fully describe the pages and the
  7.    ad. These files are not included in the example.
  8. */
  9.  
  10.  
  11. /* ---------------------------------------------- */
  12. /* FILE DESCRIBING PAGES 1 & 2: /Pages/1_2/P00001 */
  13. /* ---------------------------------------------- */
  14.  
  15. pil-layout-5.00 "N PAGE 1" {
  16.  
  17. /* The name table associates entity names with the types of the
  18.    entities and their location. The format for each name table entry 
  19.    is "name", "type", "domain", and "value". The name is the way
  20.    by which the entity is identified in a pil-layout; the "type" is
  21.    the data format of the entity, and the domain and value, taken
  22.    together are used to locate the entity where it is stored, e.g.,
  23.    on a file system or database. Thus, the renderable content for the
  24.    headline and photo are defined as "postscript" and "tiff" respectively.
  25.    The editable content for the FIRE story body text is "ascii-text".
  26.  
  27.    The renderable and editable content locations are specified as "lcd-
  28.    filenames". "lcd" stands for "least common denominator". It requires
  29.    that the files are in the same directory as the PIL itself and that
  30.    the names can be represented as DOS filenames. The domain and value of
  31.    "inline" means that the entity appears later in this file. */
  32.  
  33.     name-table {
  34.         "N FIRE HD 1"    postscript    lcd-filename    "R00001"
  35.         "N FIRE PH 1"    tiff            lcd-filename    "R00002"
  36.         "N FIRE BT"        ascii-text    lcd-filename    "E00001"
  37.         "N PAGE 2"        pil-layout    inline            inline
  38.     }
  39.  
  40. /* The canvas is the root of the hierarchy. The subordinates are the
  41.    following objects which appear in imaging order from lowest to
  42.    highest.
  43.  
  44.    "units" specifies how to interpret dimensions, both for
  45.    the current object and for those objects which do not re-specify
  46.    the units of measure. Thus, units of measure are inherited, down
  47.    the tree. In this case units of measure is chosen such that 1 unit
  48.    equals 1/1000th of an inch.
  49.  
  50.    "dimensions" provides the horizontal and vertical width of the
  51.    canvas. This is the physical imaging area for all content rendered
  52.    on the canvas. So, content is clipped to the canvas size. In this
  53.    case an 8.5 by 11 inch page is indicated.
  54.  
  55.    "user-name" is an arbitrary string which is not used for final
  56.    rendering. Its typical use is to provide a name for the canvas
  57.    which is meaningful to a user, and may be used to label an object
  58.    when it is drawn in dummy or outline mode.
  59.  
  60.    In addition to these items, a canvas type, clipper and application
  61.    specific attributes may be specified. These are not used in this
  62.    example. */
  63.  
  64.     canvas {
  65.         dimensions { 8500 11000 }
  66.         units 25400
  67.         user-name "Page 1"
  68.     }
  69.  
  70. /* Objects are used to specify the content which must be rendered
  71.    on the canvas. This object represents the headline of the FIRE
  72.    story.
  73.  
  74.    The origin coordinates specify the position for the object. 
  75.    The origin is specified relative to the coordinate system 
  76.    of the canvas.
  77.  
  78.    The dimensions, along with the origin coordinates, define the 
  79.    bounding rectangle of the area the object's content is rendered 
  80.    into. The content is scaled to fit into this area.
  81.  
  82.    An object can also be rotated, and a clip shape defined. In 
  83.    this example, the default rotation of 0 degrees is taken, 
  84.    and no clip shape is specified.
  85.  
  86.    Note that z-order is implied by the order of the objects; the
  87.    first object is bottommost and the last object is topmost.
  88.  
  89.    Several other attributes can be specified in the body of an object.
  90.    These are an identifier, units, type, rotation, clipper, container,
  91.    graphic, and application specific attributes. Subsequent examples
  92.    indicate the use of these.
  93.  
  94.    The bounding box is defined in the native content space. So,
  95.    for PostScript, electronic points are used. The content is
  96.    scaled to fit within the rectangle defined by the origin
  97.    coordinates and dimensions. The bounding box specifies the 
  98.    portion of the content that is to be drawn into this rectangle.
  99.  
  100.    Bounding-box is optional. If omitted, the renderer will have
  101.    to determine the information from the content itself. For
  102.    example, a tagged content architecture might specify the
  103.    bounding rectangle as one of its tags. One particular case
  104.    is when the content is itself a PIL layout. Here the
  105.    dimensions of the referenced PIL canvas provide the bounding
  106.    box. 
  107.  
  108.    rc-name gives the name for the entity containing the content
  109.    ("rc" stands for "renderable content"). The entity name table 
  110.    associates this name with the physical location. In this case 
  111.    the entity name is "N FIRE HD 1". The name table indicates that 
  112.    the content is contained by a PostScript file, "R00001", in 
  113.    the same directory as the PIL file.
  114.  
  115.    The rc-type indicates the kind of data to be rendered.
  116.    This is a union of "text", "structured-graphics", "lineart",
  117.    and "image". If available, this information can be used by a 
  118.    renderer to make processing decisions. */
  119.  
  120.     object {
  121.         origin { 750 500 }
  122.         dimensions { 7000 1500 }
  123.         user-name "Fire Story Headline"
  124.         bbox { 0 108 252 108 }
  125.         rc-name "N FIRE HD 1"
  126.         rc-type { text }
  127.     }
  128.  
  129. /* This next object describes the photograph for the FIRE story.
  130.    It illustrates the use of some additional PIL constructs. These
  131.    are a clipper and a graphic. */
  132.  
  133.     object {
  134.         origin { 2500 4450 }
  135.         dimensions { 3500 3500 }
  136.         user-name "Fire Story Photo"
  137.  
  138. /* A clipper is used to clip the content of the object.
  139.    Note that it is only the content which is clipped -- in
  140.    particular the object graphic is not clipped. The clipper
  141.    is a shape defined in the object coordinate system. In this
  142.    case a clipper is defined to crop the photograph. */
  143.  
  144.         clipper {
  145.             rectangle { 0 0 3500 3500 }
  146.         }
  147.  
  148. /* The object-graphic can be used to render simple graphics at the
  149.    object level. Examples are rules and boxes. In this case the
  150.    graphic is used to render a trap rule for the photograph. The
  151.    trap rule is a 1-point wide square. */
  152.  
  153.         graphic {
  154.             color-model pantone
  155.             render-op stroke
  156.             render-attributes {
  157.                 stroke-color "192"
  158.                 position outside
  159.                 width 14
  160.                 cap butt-cap
  161.                 join miter-join
  162.                 miter-limit 10
  163.             }
  164.             rectangle { 0 0 3500 3500 }
  165.         }
  166.         bbox { 0 0 350 350 }
  167.         rc-name "N FIRE PH 1"
  168.         rc-type { image }
  169.     }
  170.  
  171. /* The next two objects define the body text columns of the FIRE story.
  172.    These illustrate the use of container shapes and identifiers.
  173.  
  174.    A container shape is used to define a shape for composing content.
  175.    A single, closed shape may be specified. This restriction avoids the
  176.    problem of defining z-order for multiple, overlapping shapes.
  177.  
  178.    Linkage of containers into flow sequences is specified with the
  179.    "text-flow" construct. This construct specifies a series of objects
  180.    which are to be linked into a flow sequence. The objects are
  181.    identified by their id's. */
  182.  
  183.     object {
  184.         id "I FIRE BT 1"
  185.         origin { 750 2600 }
  186.         dimensions { 3400 8400 }
  187.         user-name "Fire Story Body Column 1"
  188.         container {
  189.             polygon {
  190.                 {    0    0 } { 3400    0 }
  191.                 { 3400 2300 } { 1700 2300 }
  192.                 { 1700 5900 } { 3400 5900 }
  193.                 { 3400 8400 } {    0 8400 }
  194.             }
  195.         }
  196.     }
  197.  
  198.     object {
  199.         id "I FIRE BT 2"
  200.         origin { 4350 2600 }
  201.         dimensions { 3400 8400 }
  202.         user-name "Fire Story Body Column 2"
  203.         container {
  204.             polygon {
  205.                 {    0    0 } { 3400    0 }
  206.                 { 3400 8400 } {    0 8400 }
  207.                 {    0 5900 } { 1700 5900 }
  208.                 { 1700 2300 } {    0 2300 }
  209.             }
  210.         }
  211.     }
  212.  
  213. /* This text flow defines the layout and content which forms the
  214.    body of the FIRE story. The layout sequence jumps from PAGE 1 to
  215.    PAGE 2. This is specified by the "to" entry. */
  216.  
  217.     text-flow {
  218.         flow-label "L FIRE BT"
  219.         objects { "I FIRE BT 1" "I FIRE BT 2" }
  220.         to {"N PAGE 2"}
  221.         content { "N FIRE BT" }
  222.     }
  223.  
  224. }
  225.  
  226.  
  227. /* The following layout describes PAGE 2. */
  228.  
  229. pil-layout-5.0 "N PAGE 2" {
  230.  
  231. /* The ad content location is given as a full path name on a Unix file
  232.    system. The ad is going to be created by another system. The generator
  233.    of this PIL file expects that system to put the ad PIL and content
  234.    files in the specified location. The systems have to agree on this
  235.    by some interoperability mechanism. */
  236.  
  237.     name-table {
  238.         "N AD 0175"        pil-layout    unix-filename    "/Ads/0175/P00001"
  239.         "N PAGE 1"        pil-layout    inline            inline
  240.         "N FIRE BT"        ascii-text    lcd-filename    "E00001"
  241.     }
  242.  
  243. /* This canvas illustrates the use of application specific attributes.
  244.    These are intended to be grouped and named according to the application
  245.    which generates them. Each attribute consists of a name and a value. Values
  246.    may be integers, floating point numbers, strings, or lists of these things.
  247.    It is up to individual applications to define their own valid combinations
  248.    of these pairs. */
  249.  
  250.     canvas {
  251.         dimensions { 8500 11000 }
  252.         units 25400
  253.         user-name "Page 1"
  254.         application {
  255.             app-name "ATEX-Widget 2.0"
  256.             uint8 { page-wrap 2 }
  257.             uint32 { page-columns { 3400 3400 } }
  258.             uint32 { page-gutters { 200 } }
  259.         }
  260.         application {
  261.             app-name "ATEX-WotsitPlus"
  262.             string { last-modified "Tue Oct 30 16:51:06 EST 1990" }
  263.         }
  264.     }
  265.  
  266.  
  267. /* This object describes the last column of body text on PAGE 2. A
  268.    container shape is used to define the shape for composing text. */
  269.  
  270.     object {
  271.         id "I FIRE BT 3"
  272.         origin { 750 500 }
  273.         dimensions { 2200 4900 }
  274.         user-name "Fire Story Body Column 3"
  275.         container {
  276.             rectangle { 0 0 2200 4900 }
  277.         }
  278.     }
  279.  
  280. /* The next two objects define the columns of the WIND story. */
  281.  
  282.     object {
  283.         id "I WIND BT 1"
  284.         origin { 5150 500 }
  285.         dimensions { 2200 4900 }
  286.         user-name "Wind Story Body Column 1"
  287.         container {
  288.             rectangle { 0 0 2200 4900 }
  289.         }
  290.     }
  291.  
  292.     object {
  293.         id "I WIND BT 2"
  294.         origin { 7550 500 }
  295.         dimensions { 2200 4900 }
  296.         user-name "Wind Story Body Column 2"
  297.         container {
  298.             rectangle { 0 0 2200 4900 }
  299.         }
  300.     }
  301.  
  302. /* This object defines the display ad. Notice how the generator of the
  303.    PIL specification need only know the destination size and entity
  304.    name in order to write this specification.
  305.  
  306.    By looking in the entity name table we can see that the ad is
  307.    actually described via a pil-layout entity. The actual dimensions
  308.    of the ad will be determined from that entity.
  309.  
  310.    This is an example of one PIL description referencing another. We
  311.    shall see more of how this referencing mechanism works in the PIL
  312.    definition for the display ad itself. */
  313.  
  314.     object {
  315.         origin { 750 5600 }
  316.         dimensions { 7000 4900 }
  317.         user-name "Honest Joe's Used Car Ad"
  318.         rc-name "N AD 0175"
  319.         rc-type {}
  320.     }
  321.  
  322. /* This text flow defines the layout and content which forms the
  323.    body of the FIRE story. The layout sequence jumps from PAGE 1 to
  324.    PAGE 2. This is specified by the "from" entry. The flow name
  325.    allows the text flows on page 1 and page 2 to be matched up. */
  326.  
  327.     text-flow {
  328.         flow-label "L FIRE BT"
  329.         objects { "I FIRE BT 3" }
  330.         from {"N PAGE 1"}
  331.         content { "N FIRE BT" }
  332.     }
  333.  
  334. /* The second text flow defines just the layout for the body of the
  335.    WIND story. In this case no content is provided. The layout is
  336.    contained entirely within PAGE 2 so the flow name is unnecessary
  337.    and there are no to or from entries. */
  338.  
  339.     text-flow {
  340.         objects { "I WIND BT 1" "I WIND BT 2" }
  341.     }
  342.  
  343. }
  344.  
  345.  
  346. /* ---------------------------------------- */
  347. /* FILE DESCRIBING THE AD: /Ads/0175/P00001 */
  348. /* ---------------------------------------- */
  349.  
  350. pil-layout-5.0 "N AD 0175" {
  351.  
  352.     name-table {
  353.         "N TEXT 1"        eps        lcd-filename    "R00001"
  354.         "N TEXT 2"        eps        lcd-filename    "R00002"
  355.         "N IMAGE 1"        tiff    lcd-filename    "R00003"
  356.     }
  357.  
  358. /* The canvas definition for the display ad is much like that for the
  359.    pages. A different size is specified so that the ad is 7 by 4.9
  360.    inches. Note that all content is clipped to these dimensions. */
  361.  
  362.     canvas {
  363.         dimensions { 7000 4900 }
  364.         units 25400
  365.         user-name "Honest Joe's Used Car Ad"
  366.     }
  367.  
  368. /* The bottom-most object describes the car image and the ellipse which
  369.    frames it. */
  370.  
  371.     object {
  372.         id "I IMAGE 1"
  373.         origin { 750 2750 }
  374.         dimensions { 5000 2500 }
  375.         user-name "Car Image"
  376.  
  377. /* The rotation of the content and ellipse is effected by a 30 degree
  378.    counter-clockwise rotation of the object space. */
  379.  
  380.         rot-angle 30
  381.         rot-point { 0 0 }
  382.  
  383. /* The object graphic is used to render the ellipse. Note that this
  384.    ellipse is drawn in object space. Object space has been rotated
  385.    thus the ellipse is also rotated. */
  386.  
  387.         graphic {
  388.             color-model device-cmyk
  389.             render-op stroke
  390.             render-attributes {
  391.                 stroke-color { 0.6 0.2 0 0 }
  392.                 position centered
  393.                 width 14
  394.                 cap butt-cap
  395.                 join miter-join
  396.                 miter-limit 10
  397.             }
  398.             ellipse { -250 -1250 5250 4500 }
  399.         }
  400.         bbox { 0 0 50 250 }
  401.         rc-name "N IMAGE 1"
  402.         rc-type { image }
  403.     }
  404.  
  405. /* The second object describes the rotated logo text. Note
  406.    the use of a rotation point and rotation angle. This results 
  407.    in a 90 degree counter-clockwise rotation of the logo by 
  408.    transforming the object coordinate space. */
  409.  
  410.     object {
  411.         id "I TEXT 2"
  412.         origin { 6000 4500 }
  413.         dimensions { 4000 500 }
  414.         user-name "Joe's Logo"
  415.         rot-angle 90
  416.         rot-point { 0 0 }
  417.         bbox { 0 36 288 36 }
  418.         rc-name "N TEXT 2"
  419.         rc-type { text }
  420.     }
  421.  
  422. /* This object describes the text for "Honest Joe
  423.    presents the 1990 Mazda". This object is similar to the one
  424.    describing the headline for the FIRE story on PAGE 1. */
  425.  
  426.     object {
  427.         id "I TEXT 1"
  428.         origin { 500 500 }
  429.         dimensions { 3000 1500 }
  430.         user-name "1990 Mazda"
  431.         rc-type { text }
  432.         rc-name "N TEXT 1"
  433.         bbox { 0 108 216 108 }
  434.     }
  435.  
  436. /* The group construct can be used to build hierarchic groupings of
  437.    objects and other groups. The objects to be grouped are specified
  438.    by their ids. In order to include a group within another group,
  439.    it is given an id and listed as one of the objects. This example
  440.    groups the two text objects together, and then groups them 
  441.    with the image. Grouping does not affect how objecst are drawn.
  442.    Also, the order in which objects are specified is irrelevant. */
  443.  
  444.     group {
  445.         id "I GROUP 1"
  446.         objects { "I TEXT 1" "I TEXT 2" }
  447.     }
  448.     group {
  449.         objects { "I IMAGE 1" "I GROUP 1" }
  450.     }
  451. }
  452.