home *** CD-ROM | disk | FTP | other *** search
/ Nebula 1 / Nebula One.iso / Utilities / Converters / Convert_PICT / Source / CommentedPSCode / RCS / Text,v < prev   
Encoding:
Text File  |  1995-06-12  |  21.4 KB  |  1,012 lines

  1. head     1.8;
  2. branch   ;
  3. access   ;
  4. symbols  beta10:1.7;
  5. locks    death:1.8;
  6. comment  @# @;
  7.  
  8.  
  9. 1.8
  10. date     93.04.04.23.31.03;  author death;  state Exp;
  11. branches ;
  12. next     1.7;
  13.  
  14. 1.7
  15. date     93.01.09.21.07.38;  author death;  state Exp;
  16. branches ;
  17. next     1.6;
  18.  
  19. 1.6
  20. date     93.01.01.11.51.44;  author death;  state Exp;
  21. branches ;
  22. next     1.5;
  23.  
  24. 1.5
  25. date     92.12.31.15.35.29;  author death;  state Exp;
  26. branches ;
  27. next     1.4;
  28.  
  29. 1.4
  30. date     92.12.05.23.07.51;  author death;  state Exp;
  31. branches ;
  32. next     1.3;
  33.  
  34. 1.3
  35. date     92.12.03.18.02.22;  author death;  state Exp;
  36. branches ;
  37. next     1.2;
  38.  
  39. 1.2
  40. date     92.11.27.19.38.28;  author death;  state Exp;
  41. branches ;
  42. next     1.1;
  43.  
  44. 1.1
  45. date     92.11.08.09.29.09;  author death;  state Exp;
  46. branches ;
  47. next     ;
  48.  
  49.  
  50. desc
  51. @@
  52.  
  53.  
  54. 1.8
  55. log
  56. @Sun Apr  4 23:31:03 PDT 1993
  57. @
  58. text
  59. @%BEGIN Text
  60.  
  61. %
  62. %    The current text drawing position
  63. %
  64. /textY 0 def
  65. /textX 0 def
  66. %
  67. %    Extra width used when printing spaces
  68. %
  69. /extraSpaceWidth 0 def
  70. %
  71. %    Establish default font 
  72. %
  73. /typeSize 12 def
  74. /Chicago findfont
  75. typeSize scalefont
  76. setfont
  77. %
  78. %    the x and y scaling factors
  79. %
  80. /xscale 1 def
  81. /yscale 1 def
  82. %
  83. %    Style flags (true eq use that style)
  84. %
  85. /macBold false def
  86. /macItalic false def
  87. /macUnderline false def
  88. /macOutline false def
  89. /macShadow false def
  90. /macCondense false def
  91. /macExtend false def
  92. %
  93. %    Mode
  94. %
  95. /textMode    /srcCopy    def
  96.  
  97.  
  98.  
  99. %%%%%%%%%%%%%
  100. %    Name:    drawChar
  101. %    Syntax:    string drawChar -
  102. %    About:    Draws specifid string, This should only be called by PICTshow, as it depends on
  103. %            values set up there. 
  104. %%%%%%%%%%%%%
  105. /drawChar
  106. {
  107.     textMatrix setmatrix
  108.     show
  109.     originalMatrix setmatrix
  110. }
  111. def
  112.  
  113. %%%%%%%%%%%%%
  114. %    Name:    pathNonZero
  115. %    Syntax:    - pathNonZero bool
  116. %    About:    returns true if current path has a non-zero height
  117. %%%%%%%%%%%%%
  118. /pathNonZero
  119. {
  120.     pathbbox
  121.     /top exch def
  122.     pop
  123.     /bottom exch def
  124.     pop
  125.     
  126.     top bottom sub  0 eq
  127.         {false}
  128.         {true}
  129.     ifelse
  130. }
  131. def
  132.  
  133. %%%%%%%%%%%%%
  134. %    Name:    PICTshow
  135. %    Syntax:    x y string PICTshow -
  136. %    About:    Draw the specified text at x,y.  theString is drawn one char at a time because
  137. %        this provides better control when drawing the various type styles.
  138. %        The various styles are drawn to emulate on-screen mac drawing.  Thus, italics are
  139. %        obliqued, bold is double-printed (slightly offset).  Condensed and Extended have
  140. %        altered spacing, but characters are not drawn thin or fat.  Etc.  
  141. %    Bugs:
  142. %        Bold outlines and shadows have a doubled left border.
  143. %        Shadowed char extending to *left* will place shadow on neighbor, not behind
  144. %        extend values not well defined on Mac.  I've made good approximations here.
  145. %%%%%%%%%%%%%
  146. /PICTshow
  147. {
  148.     /theString exch def
  149.     /y exch def
  150.     /x exch def
  151.     /extend 0 def        % extra space to widen each char
  152.     /charString 1 string def    % holds char as a string
  153.  
  154.     gsave
  155.         /originalMatrix matrix currentmatrix def
  156.         %
  157.         %    Build a matrix to use when drawing text: make it upside down (-1) so text will
  158.         %    appear rightside up, slant it (.5) if doing 'italic', and scale by the
  159.         %    scaling factors
  160.         %
  161.         /textMatrix
  162.             xscale yscale matrix scale matrix currentmatrix matrix concatmatrix
  163.             macItalic true eq
  164.                 { [1 0 .5 -1 0 0] }
  165.                 { [1 0 0 -1 0 0] }
  166.             ifelse
  167.             matrix concatmatrix
  168.         def
  169.  
  170.         %
  171.         %    Store ammount to extend width of each char by
  172.         %
  173.         macBold true eq
  174.             {/extend  extend 1.5 add def }
  175.         if
  176.         
  177.         macOutline true eq
  178.             { /extend  extend 2 add def }
  179.         if
  180.     
  181.         macExtend true eq
  182.             {/extend  extend 2 add def }
  183.         if
  184.     
  185.         macShadow true eq
  186.             {/extend  extend 2 add def }
  187.         if
  188.     
  189.         macCondense true eq
  190.             {/extend  extend 2 sub def }
  191.         if
  192.         %
  193.         %    For each character in string, draw it...
  194.         %
  195.         foregroundColor    useColor
  196.         theString
  197.         {
  198.             %
  199.             %    Define next char of theString, width of the char, and extra space
  200.             %    to add to this character.
  201.             %
  202.             /theChar exch def
  203.             charString 0 theChar put
  204.             /charWidth charString stringwidth pop def % pop y dimen
  205.             32 theChar eq
  206.                 { /extraSpace extraSpaceWidth def }
  207.                 { /extraSpace 0 def }
  208.             ifelse
  209.             %
  210.             %    Draw a shadow
  211.             %
  212.             macShadow true eq
  213.             {
  214.                 x 2 add y 2 add moveto % move down & right to draw shadow
  215.                 charString drawChar
  216.                 macBold true eq
  217.                 {
  218.                     x 3 add y 2 add moveto
  219.                     charString drawChar
  220.                 }
  221.                 if
  222.             }
  223.             if
  224.             %
  225.             %    Draw other text.  If doing bold, loop twice, incrementing boldStep
  226.             %    second time to produce the double-print of bold.
  227.             %
  228.             /boldstep 0 def
  229.             macBold true eq {2} {1} ifelse    % loop 2ce if bold is on.
  230.             {
  231.                 %
  232.                 %    If doing shadow or outline, draw the text in white with black outline
  233.                 %    unless path has no height (maybe it's a bitmap), draw the char normal
  234.                 %
  235.                 macShadow true eq   macOutline true eq  or
  236.                 {
  237.                     newpath
  238.                     x boldstep add y moveto
  239.                     textMatrix setmatrix
  240.                     charString true charpath
  241.                     originalMatrix setmatrix
  242.                     pathNonZero true eq
  243.                     {
  244.                         1 setgray
  245.                         fill
  246.                         foregroundColor    useColor
  247.                         
  248.                         newpath
  249.                         x boldstep add y moveto
  250.                         textMatrix setmatrix
  251.                         charString false charpath
  252.                         originalMatrix setmatrix
  253.                         0 setlinewidth
  254.                         stroke
  255.                     }
  256.                     {
  257.                         x boldstep add y moveto
  258.                         charString drawChar
  259.                     }
  260.                     ifelse
  261.                 }
  262.                 { 
  263.                     x boldstep add y moveto
  264.                     charString drawChar
  265.                 }
  266.                 ifelse
  267.                 /boldstep boldstep 1 add def
  268.             }
  269.             repeat
  270.             originalMatrix setmatrix
  271.     
  272.             macUnderline true eq
  273.             {
  274.                 x y 1 add moveto
  275.                 x charWidth add extraSpace add extend add y 1 add lineto
  276.                 1 setlinewidth
  277.                 stroke
  278.             }
  279.             if
  280.             %
  281.             %    Increment x for the next character's start
  282.             %
  283.             /x x charWidth add extraSpace extend add add def
  284.         }
  285.         forall
  286.     grestore
  287. }
  288. def
  289.  
  290. %%%%%%%%%%%%%
  291. %    Name:    txFont         [0003]
  292. %    Syntax:    name txFont -
  293. %            num txFont -
  294. %    About:    This sets the type family to draw text in. If param is not a
  295. %            name, the converter could not identify the `font', so this
  296. %            routine must decide what family to use.
  297. %%%%%%%%%%%%%
  298. /txFont
  299. {
  300.     /family exch def
  301.  
  302.     family type /nametype eq
  303.     {
  304.         family findfont
  305.     }
  306.     {
  307.         %
  308.         %    Convert the number to a font name
  309.         %
  310.         family 134 eq
  311.             {/Linguistics findfont}
  312.             {family 149 eq
  313.                 {/NewOrleans findfont}
  314.                 {family 64 eq
  315.                     {/Davids findfont}
  316.                     {/Chicago findfont}   % default font
  317.                 ifelse}
  318.             ifelse}
  319.         ifelse
  320.     }
  321.     ifelse
  322.     
  323.     typeSize scalefont
  324.     setfont
  325. }
  326. def
  327.  
  328. %%%%%%%%%%%%%
  329. %    Name:    txFace         [0004]
  330. %    Syntax:    array txFace -
  331. %    About:    Given an array of names, set several global flags to based on
  332. %            them.  These indicate what text styles to use when drawing text.
  333. %%%%%%%%%%%%%
  334. /txFace
  335. {
  336.     /styleArray exch def
  337.     /macBold false def
  338.     /macItalic false def
  339.     /macUnderline false def
  340.     /macOutline false def
  341.     /macShadow false def
  342.     /macCondense false def
  343.     /macExtend false def
  344.     styleArray
  345.     {
  346.         /style exch def
  347.         style /bold eq {/macBold true def}
  348.         {style /italic eq {/macItalic true def}
  349.         {style /underline eq {/macUnderline true def}
  350.         {style /outline eq {/macOutline true def}
  351.         {style /shadow eq {/macShadow true def}
  352.         {style /condense eq {/macCondense true def}
  353.         {style /extend eq {/macExtend true def}
  354.         {    % Actually, this is an error condition of some sort
  355.         } ifelse
  356.         } ifelse
  357.         } ifelse
  358.         } ifelse
  359.         } ifelse
  360.         } ifelse    
  361.         } ifelse    
  362.     }
  363.     forall
  364. }
  365. def
  366.  
  367. %%%%%%%%%%%%%
  368. %    Name:    txMode         [0005]
  369. %    Syntax:    name txMode -
  370. %    About:    Sets the text drawing mode passed by caller.  This is not used
  371. %            so we just store it.
  372. %            Note: if mode was unknown, we get /badMode-# (# is mode num))
  373. %%%%%%%%%%%%%
  374. /txMode
  375.     { /textMode exch def }
  376. def
  377.  
  378. %%%%%%%%%%%%%
  379. %    Name:    spExtra     [000C]
  380. %    Syntax:    num spExtra  -
  381. %    About:    Changes width of space character in future text drawing
  382. %            operations.
  383. %%%%%%%%%%%%%
  384. /spExtra
  385.     {/extraSpaceWidth exch def }
  386. def
  387.  
  388. %%%%%%%%%%%%%
  389. %    Name:    txSize        [000D]
  390. %    Syntax:    num txSize -
  391. %    About:    Sets the size of subsequent text to the passed number.
  392. %            Do this by scaling relative to the current size.
  393. %%%%%%%%%%%%%
  394. /txSize
  395. {
  396.     /newTypeSize exch def
  397.     currentfont
  398.         newTypeSize typeSize div scalefont
  399.     setfont
  400.     /typeSize newTypeSize def
  401. }
  402. def
  403.  
  404. %%%%%%%%%%%%%
  405. %    Name:    TxRatio        [0010]
  406. %    Syntax:    xscale yscale txRatio -
  407. %    About:    This sets a horozontal and vertical scaling factors for text
  408. %            that is subsequently drawn.
  409. %%%%%%%%%%%%%
  410. /txRatio
  411. {
  412.     /yscale exch def
  413.     /xscale exch def
  414. }
  415. def
  416.  
  417. %%%%%%%%%%%%%
  418. %    Name:    chExtra        [0016]
  419. %    Syntax:    num chExtra -
  420. %    About:    The chExtra opcode probably sets the spacing between characters.
  421. %            I couldn't confirm this, though, so this does nothing.
  422. %%%%%%%%%%%%%
  423. /chExtra
  424.     {pop}
  425. def
  426.  
  427. %%%%%%%%%%%%%
  428. %    Name:    longText        [0028]
  429. %    Syntax:    num num string  longText -
  430. %    About:    Displays the string at coords. Makes coords the new textX,Y
  431. %%%%%%%%%%%%%
  432. /longText
  433. {
  434.     /theString exch def
  435.     /textY exch def
  436.     /textX exch def
  437.     
  438.     textX textY  theString     PICTshow
  439. }
  440. def
  441.  
  442. %%%%%%%%%%%%%
  443. %    Name:    DHText        [0029]
  444. %    Syntax:    num string  DHText -
  445. %    About:    Displays string offset sideways from textX (positive is right)
  446. %%%%%%%%%%%%%
  447. /DHText
  448. {
  449.     /theString exch def
  450.     /deltaX exch def
  451.     
  452.     deltaX textX add textY theString longText
  453. }
  454. def
  455.  
  456. %%%%%%%%%%%%%
  457. %    Name:    DVText        [002A]
  458. %    Syntax:    num string  DVText -
  459. %    About:    Displays string offset down from textY (positive is down)
  460. %%%%%%%%%%%%%
  461. /DVText
  462. {
  463.     /theString exch def
  464.     /deltaY exch def
  465.     textX deltaY textY add theString longText
  466. }
  467. def
  468.  
  469. %%%%%%%%%%%%%
  470. %    Name:    DHDVText        [002B]
  471. %    Syntax:    num num string  DVText -
  472. %    About:    Displays string offset from text X,Y (positive is down & right)
  473. %%%%%%%%%%%%%
  474. /DHDVText
  475. {
  476.     /theString exch def
  477.     /deltaY exch def
  478.     /deltaX exch def
  479.     
  480.     deltaX textX add   deltaY textY add  theString longText
  481. }
  482. def
  483.  
  484. %END Text
  485. @
  486.  
  487.  
  488. 1.7
  489. log
  490. @Sat Jan  9 21:07:38 PST 1993
  491. @
  492. text
  493. @@
  494.  
  495.  
  496. 1.6
  497. log
  498. @Fri Jan  1 11:51:44 PST 1993
  499. @
  500. text
  501. @d4 1
  502. a4 1
  503. %    Define a starting text position
  504. a7 1
  505.  
  506. d9 1
  507. a9 1
  508. %    Define what extra space should be used when drawing text
  509. a11 1
  510.  
  511. d13 1
  512. a13 1
  513. %    Setup the default font. 
  514. a18 1
  515.  
  516. d20 1
  517. a20 1
  518. %    Default scaling values
  519. a23 1
  520.  
  521. d25 1
  522. a25 1
  523. %    By default, all the styles are off at first.
  524. a33 1
  525.  
  526. d40 8
  527. a47 1
  528. /drawlineoftext
  529. d49 2
  530. a50 3
  531.     /theString exch def
  532.     flippedMatrix setmatrix
  533.     extraSpaceWidth 0 32 extend 0 theString awidthshow
  534. d55 22
  535. a76 2
  536. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  537. %    Utility:    PICTshow
  538. d78 5
  539. a82 14
  540. %    Description:
  541. %        This utility draws the specified string at x,y, making use of the
  542. %        various Macintosh text style settings:
  543. %            bold, italic, condensed, extended, underline, outline, shadoe, and plain.
  544. %        Note that it tries to emulate the on-screen style of drawing, rather than the
  545. %        printouts.  So, text is always obliqued in 'italic'.  The bold is accomblished by
  546. %        double printing, rather than using a different type face.  Condense is just squished
  547. %        together (and extended is extended) but the characters are not squished or extended
  548. %        as well.
  549. %        It also properly sets the drawing color before drawing.
  550. %        One slight good thing: If one us making use of a font that doesn't have an outline
  551. %        (say, converted from the mac with my font creator), this will recover semi gradefully
  552. %        and draw outline text as plain roman text, and shadowed text as black with a grey
  553. %        shadow.
  554. d84 4
  555. a87 20
  556. %        Not all things work together, and not all work completely right:
  557. %        • Because of the lazy way I've implemented them (the better way would be to draw
  558. %        them one char at a time, so one would have complete controll always), neither outline
  559. %        or Shadow get slightly extended, as they should, when being drawn.  Likewise, one
  560. %        can not combine these two with certain other styles (bold and outline, for instance).
  561. %        • The exact measures for how much to extend or condense characters for all the
  562. %        styles, much less mixings of styles, is not defined anywhere I could find.  The
  563. %        values I'm using seem reasonably close to my Mac samples.  But, they may not
  564. %        work in combination.  This is just to say: if you are perfectionistic, you may need to
  565. %        tweak these values.
  566. %        • The underlining of any extended or condensed thing is wrong.  This could be
  567. %        fixed by some other algorithm, such as the 'do one character at a time', mentioned
  568. %        above
  569. %        • To determine if this has has an outline available, it builds a charpath, and sees
  570. %        if it has any height.  If so, it assumes there's an outline there.  this does end up
  571. %        involving a call to charpath and pathbbox just to figure this out.  It seems a bit
  572. %        expensive to me.  In fact, much of this routinemight be able to be done more
  573. %        'cheaply'.
  574. %        • Summary: this works adequately.  But, it's nowhere near 'slick' or 'finished'.
  575. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  576. d93 2
  577. a94 1
  578.     /extend 0 def        % stores how much to extend each character
  579. a95 14
  580.     %
  581.     %    Build a flipped matrix so the text will appear rightside up
  582.     %
  583.     /originalMatrix matrix currentmatrix def
  584.     /flippedMatrix matrix currentmatrix def
  585.     %
  586.     %    Take into account text scaling.  I'm not sure this is done right, but hey, since I can't
  587.     %    find any mac things to demonstrate the opcode, I'll just guess..  
  588.     %
  589.     /flippedMatrix 
  590.         xscale yscale flippedMatrix scale
  591.     def
  592.     flippedMatrix 3  flippedMatrix 3 get -1 mul put  % unflip the matrix so text is rightside up
  593.     
  594. d97 1
  595. d99 3
  596. a101 5
  597.         %    Compute an outline of the text, and store whether it generated an outline
  598.         %    with non-zero height.  Note that we tracp for the limitcheck error in case the
  599.         %    string is too long.  Another argument for doing all this kinda thing 1 char at a
  600.         %    time...  (note: this means that if the thing is too long to outline all at once, we
  601.         %    do it as if this were a bitmap.
  602. d103 8
  603. a110 8
  604.         newpath
  605.         x y moveto
  606.         flippedMatrix setmatrix
  607.             /originallimitcheck errordict /limitcheck get def
  608.             errordict /limitcheck {pop pop pop} put
  609.             theString false charpath
  610.             errordict /limitcheck {originallimitcheck} put
  611.         originalMatrix setmatrix
  612. a111 15
  613.         pathbbox
  614.         /ury exch def
  615.         pop
  616.         /lly exch def
  617.         pop
  618.         
  619.         ury lly sub  0 eq
  620.             {/couldOutline false def}
  621.             {/couldOutline true def}
  622.         ifelse
  623.     grestore
  624.     %
  625.     %    Begin work to draw text.
  626.     %
  627.     gsave
  628. d113 1
  629. a113 1
  630.         %    Turn on mac-style italics if needed  (slant everything.  don't do a true italic)
  631. a114 13
  632.         macItalic true eq
  633.         {
  634.             /flippedMatrix 
  635.                 flippedMatrix [1 0 -.5 1 0 0]  matrix concatmatrix
  636.             def
  637.         }
  638.         if
  639.  
  640.         %
  641.         %    Set approximate extended values (note that outline gets one set, but because of
  642.         %    the current implementation algorithm, this value is never used.  =(   )
  643.         %
  644.         
  645. d122 1
  646. a122 1
  647.  
  648. d126 5
  649. a130 1
  650.  
  651. a133 1
  652.  
  653. d135 1
  654. a135 4
  655.         %    Draw a shadow (bold it if necessary)
  656.         %    Draw a grey one if w couldn't outline.  A foreground colored one otherwise.  
  657.         %    Note that we do not extend in the case where we can outline, since the two
  658.         %    presently don't go together.  (it work fine for others, though). 
  659. d137 2
  660. a138 1
  661.         macShadow true eq
  662. d140 10
  663. a149 6
  664.             couldOutline true eq
  665.             { foregroundColor    useColor }
  666.             {
  667.                 .333 setgray
  668.                 /extend  extend 2 add def
  669.             }
  670. d151 4
  671. a154 3
  672.             x 1 add y 1 add moveto        % move down & to the right to draw shadow
  673.             theString drawlineoftext
  674.             macBold true eq
  675. d156 8
  676. a163 2
  677.                 x 2 add y 1 add moveto
  678.                 theString drawlineoftext
  679. a165 19
  680.         }
  681.         if
  682.         %
  683.         %    If (macshadow or macoutline) and couldoutline...  then draw the text in
  684.         %    white, and then draw a black outline around this.  Otherwise, just draw
  685.         %    the text in black.
  686.         %
  687.         macShadow true eq   macOutline true eq  or   couldOutline and
  688.         {
  689.             newpath
  690.             x y moveto
  691.             flippedMatrix setmatrix
  692.                 theString true charpath
  693.             originalMatrix setmatrix
  694.             1 setgray
  695.             fill
  696.             
  697.             newpath
  698.             x y moveto
  699. d167 2
  700. a168 1
  701.             %    set up the colors we need
  702. d170 42
  703. a211 4
  704.             foregroundColor    useColor
  705.             0 setlinewidth
  706.             flippedMatrix setmatrix
  707.                 theString false charpath
  708. d213 9
  709. a221 3
  710.             stroke
  711.         }
  712.         {
  713. d223 1
  714. a223 1
  715.             %    set up the colors we need
  716. d225 1
  717. a225 3
  718.             foregroundColor    useColor
  719.             x y moveto
  720.             theString drawlineoftext
  721. d227 1
  722. a227 21
  723.         ifelse
  724.         
  725.         %
  726.         %    Mac-style 'bold' if proper.  (double the last drawn character.  
  727.         %
  728.         macBold true eq  macShadow false eq and
  729.         {
  730.             x 1 add y moveto
  731.             theString drawlineoftext
  732.         }
  733.         if
  734.  
  735.         macUnderline true eq
  736.         {
  737.             x y 1 add moveto
  738.             theString stringwidth
  739.             pop                        %    get rid of y coord
  740.             x add y 1 add lineto
  741.             stroke
  742.         }
  743.         if
  744. d232 2
  745. a233 4
  746.  
  747. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  748. %    Opcode:    0003
  749. %    Name:    txFont
  750. d236 4
  751. a239 7
  752. %    Description:
  753. %        This is passed information needed to set the current type family.
  754. %        If the parameter is a name, then the PICT->PS converter already identified the
  755. %        mac font name, and has given it to us (this will happen for all the standard Apple
  756. %        fonts).  Otherwise, it writes out the number of the mac font, and it is then our
  757. %        responsibility to recognize it in the 'case' statement here to turn it into a font.
  758. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  759. d243 1
  760. a243 3
  761.     %
  762.     %    determine if we were passed a name or a number, and act accordingly
  763.     %
  764. d250 1
  765. a250 1
  766.         %    Convert the number we were given to a font name
  767. d267 2
  768. a268 1
  769. } def
  770. d270 2
  771. a271 4
  772.  
  773. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  774. %    Opcode:    4
  775. %    Name:    txFace
  776. d273 3
  777. a275 9
  778. %    Description:
  779. %        This takes an array, which contains a series of names.  These names
  780. %        can be: bold, italic, underline, outline, shadow, condense and/or extend.
  781. %        This takes this information and sets things up to draw corresponding
  782. %        later.  We use a procedure here to set flags for each style found
  783. %    Bugs:
  784. %        If we are using a font like Times-Roman, theoretically we should be
  785. %        able to set up and use the outlines for the real bolds, etc...
  786. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  787. d309 2
  788. a310 4
  789.  
  790. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  791. %    Opcode:    5
  792. %    Name:    txMode
  793. d312 4
  794. a315 7
  795. %    Description:
  796. %        This takes the name of a graphics mode, and theoretically would
  797. %        act properly on it.  (the mode would be a src* or notsrc* mode).
  798. %        (we get  /badMode-#  if the mode isn't a standard inside-mac one)
  799. %    Bugs:
  800. %        We don't check for the bad mode here at all..
  801. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  802. d320 6
  803. a325 13
  804.  
  805. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  806. %    Opcode:    C
  807. %    Name:    spExtra
  808. %    Syntax:    num spExtra -
  809. %    Description:
  810. %        This sets the variable extraSpaceWidth to the value it is passed.
  811. %        This will affect future text drawing operations.  Theoretically, this
  812. %        changes the with of the space character in output.  I have been
  813. %        unable to reproduce this on the Mac, however.
  814. %    Bugs:
  815. %        I'm not 100% sure what this really should be doing.
  816. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  817. d330 2
  818. a331 4
  819.  
  820. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  821. %    Opcode:    D
  822. %    Name:    txSize
  823. d333 3
  824. a335 4
  825. %    Description:
  826. %        Changes the point size of the current text.  Takes a parameter which is
  827. %        the number of points to make the text.
  828. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  829. d340 1
  830. a340 1
  831.     newTypeSize  typeSize div scalefont    % must resize relative to the current size
  832. d343 2
  833. a344 1
  834. } def
  835. d346 6
  836. a351 14
  837.  
  838. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  839. %    Opcode:    10
  840. %    Name:    TxRatio
  841. %    Syntax:    xnum ynum xdenom ydenom txRatio -
  842. %    Description:
  843. %        As best I can tell, this sets up a scaling of the text that is drawn afterwards.
  844. %        It has the ratio for the horozontal and the ratio for the vertical axes.
  845. %        However, there is no doc for it that I can find, and I can't make it do
  846. %        anything in any draw programs I have.  Thus, your guess is as good as mine.
  847. %    Bugs:
  848. %        I'm making an assumption both about the order of the incomming
  849. %        data, as well as the overall effects.
  850. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  851. d354 4
  852. a357 7
  853.     /ydenominator exch def
  854.     /xdenominator exch def
  855.     /ynumerator exch def
  856.     /xnumerator exch def
  857.     /xscale  xnumerator xdenominator div def
  858.     /yscale  ynumerator ydenominator div def
  859. } def
  860. d359 2
  861. a360 4
  862.  
  863. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  864. %    Opcode:    0016
  865. %    Name:    chExtra
  866. d362 3
  867. a364 9
  868. %    Description:
  869. %        This corresponds to one of the PICT 2 opcodes.  One would guess that it
  870. %        alters the spacing between individual characters.  One spot in Inside Mac
  871. %        suggests the param is in a special format (all two bytes of it!).  Since I could not
  872. %        test what the Mac does with it, I'm simply consuming the argument
  873. %        and doing nothing here.
  874. %    Bugs:
  875. %        This does nothing.
  876. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  877. d369 2
  878. a370 4
  879.  
  880. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  881. %    Opcode:    0028
  882. %    Name:    longText
  883. d372 2
  884. a373 6
  885. %    Description:
  886. %        Calls PICTshow with the parameters this was passed to get the string drawn.
  887. %        It then stores the text x and y positions based on the values this was passed. 
  888. %        Note that the other three text drawing routines simply map to this.
  889. %    Bugs:
  890. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  891. d377 2
  892. a378 2
  893.     /ypos exch def
  894.     /xpos exch def
  895. d380 3
  896. a382 1
  897.     xpos ypos  theString     PICTshow
  898. d384 2
  899. a385 8
  900.     /textY ypos def
  901.     /textX xpos def
  902. } def
  903.  
  904.  
  905. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  906. %    Opcode:    0029
  907. %    Name:    DHText
  908. d387 2
  909. a388 5
  910. %    Description:
  911. %        This displays the specified text to the right of the stored text
  912. %        position.  A positive deltaX value moves to the right.
  913. %    Bugs:
  914. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  915. d395 2
  916. a396 1
  917. } def
  918. d398 2
  919. a399 4
  920.  
  921. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  922. %    Opcode:    002A
  923. %    Name:    DVText
  924. d401 2
  925. a402 5
  926. %    Description:
  927. %        This displays the specified text below the stored text
  928. %        position.  A positive deltaY value moves to the downward.
  929. %    Bugs:
  930. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  931. d408 2
  932. a409 1
  933. } def
  934. d411 2
  935. a412 4
  936.  
  937. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  938. %    Opcode:    002B
  939. %    Name:    DHDVText
  940. d414 2
  941. a415 5
  942. %    Description:
  943. %        This displays the specified text below and to the right of the stored text
  944. %        position.  Positive deltas move down and right.
  945. %    Bugs:
  946. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  947. d423 2
  948. a424 1
  949. } def
  950. @
  951.  
  952.  
  953. 1.5
  954. log
  955. @Thu Dec 31 15:35:28 PST 1992
  956. @
  957. text
  958. @@
  959.  
  960.  
  961. 1.4
  962. log
  963. @Sat Dec  5 23:07:51 PST 1992
  964. @
  965. text
  966. @d39 4
  967. d44 1
  968. d363 1
  969. a363 1
  970. %        At the moment, this ignores its parameter and does nothing..
  971. d366 1
  972. a366 1
  973.     { pop }
  974. @
  975.  
  976.  
  977. 1.3
  978. log
  979. @Thu Dec  3 18:02:22 PST 1992
  980. @
  981. text
  982. @@
  983.  
  984.  
  985. 1.2
  986. log
  987. @Fri Nov 27 19:38:28 PST 1992
  988. @
  989. text
  990. @@
  991.  
  992.  
  993. 1.1
  994. log
  995. @Sun Nov  8 09:29:09 PST 1992
  996. @
  997. text
  998. @d61 1
  999. d174 1
  1000. a174 1
  1001.         %    Draw a grey one if w couldn't outline.  A black one otherwise.  
  1002. d181 1
  1003. a181 1
  1004.             { 0 setgray}
  1005. d214 4
  1006. a217 1
  1007.             0 setgray
  1008. d225 4
  1009. a228 1
  1010.             0 setgray
  1011. @
  1012.