You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

detail_head_string.inc 11KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. // Copyright 2016 Google Inc.
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. //
  15. ////////////////////////////////////////////////////////////////////////////////
  16. // Produced by stringify.cc on 2007-09-28 09:13 from file i18n/encodings/compact_enc_det/tools/detail_head.ps
  17. "%!PS-Adobe-2.0\n\n/inch {72 mul} def\n/cshow {dup stringwidth pop -2 div"
  18. " 0 rmoveto show} def\n\n/lmargin 0.5 inch def\n/rmargin 8.5 inch def\n/t"
  19. "margin 10.5 inch def\n/bmargin 0.5 inch def\n\n\n% set to N>=0 to track "
  20. "ranked encoding N\n/track-me -1 def\n/track-me2 -1 def\n\n/columns 2 def"
  21. "\n\n/lpi 18 def % lines per inch\n/lpc lpi 10 mul def "
  22. " % lines per column\n/lpp lpc columns mul def % lines per page\n"
  23. "/probw 3.0 inch def % probability width\n/probr 50 def "
  24. " % probability range\n/widowlines lpi 2 idiv def % 1/2 inch widow a"
  25. "t bottom\n/widowlines lpi def % 1 inch widow at bottom\n\n/lpg l"
  26. "pi 2 idiv def % 1/2 inch spacing between groups\n\n/delc 4 inch "
  27. "def\n/dell -1 inch lpi div def\n\n/next-line 0 def % 24 lines per i"
  28. "nch, 240 per column\n\n/Cfont /Courier findfont 6 scalefont def\n/Hfont "
  29. "/Helvetica findfont 6 scalefont def\nHfont setfont\n\n\n% simple string "
  30. "hash -- sum the characters\n/strhash {\n /hstr exch def\n /h 0 def\n "
  31. "0 1 hstr length 1 sub {/i exch def /h h hstr i get add def} for\n h\n}"
  32. " def\n\n% convert pro at 30 per 2x to 0-2.5 inches spanning -50 to 0\n/p"
  33. "rob2x {\n 30 idiv probr div probw mul neg probw add\n}def\n\n\n/cliptoc"
  34. "olumn {\n % ====== MUST MATCH ME ======\n gsave\n lmargin tmargin mov"
  35. "eto\n next-line lpc idiv delc mul 0 rmoveto\n -1 18 rmoveto 0 -10.5 in"
  36. "ch rlineto delc 2 add 0 rlineto 0 10.5 inch rlineto closepath\n clip\n"
  37. " newpath\n} def\n\n/endcliptocolumn {\n grestore\n % ====== MUST MATC"
  38. "H ME ======\n} def\n\n\n\n/column-box {\n lmargin tmargin moveto\n nex"
  39. "t-line 1 sub lpc idiv delc mul next-line 1 sub lpc mod 1 add dell mul r"
  40. "moveto\n % box\n gsave -1.5 0 rmoveto 0 detail-count dell mul neg rmov"
  41. "eto probw 3 add 0 rlineto 0.25 setlinewidth stroke grestore\n gsave -1"
  42. ".5 0 rmoveto 0 detail-count dell mul neg rlineto 0.25 setlinewidth strok"
  43. "e grestore\n gsave probw .8 mul 0 rmoveto 0 detail-count dell mul neg r"
  44. "lineto 0.25 setlinewidth 0.8 setgray stroke grestore\n gsave probw .6 m"
  45. "ul 0 rmoveto 0 detail-count dell mul neg rlineto 0.25 setlinewidth 0.8 s"
  46. "etgray stroke grestore\n gsave probw .4 mul 0 rmoveto 0 detail-count de"
  47. "ll mul neg rlineto 0.25 setlinewidth 0.8 setgray stroke grestore\n gsav"
  48. "e probw .2 mul 0 rmoveto 0 detail-count dell mul neg rlineto 0.25 setlin"
  49. "ewidth 0.8 setgray stroke grestore\n gsave probw 1.5 add 0 rmoveto 0 de"
  50. "tail-count dell mul neg rlineto 0.25 setlinewidth stroke grestore\n} def"
  51. "\n\n\n/IncrementLine {\n /incr exch def\n /next-line next-line incr ad"
  52. "d def\n next-line lpc ge next-line incr sub lpc lt and {\n % We "
  53. "just went to the top of column 2; redo clip\n endcliptocolumn % M"
  54. "UST match\n column-box\n /next-line lpc def\n cliptocolumn "
  55. " % MUST match\n } if\n next-line lpp ge {\n % We just went to the"
  56. " top of column 3; start new page column 1\n endcliptocolumn % MUS"
  57. "T match\n column-box\n showpage\n Hfont setfont\n /next-line"
  58. " 0 def\n show-pageno\n cliptocolumn % MUST match\n } if\n}"
  59. " def\n\n/IncrementLineOutside {\n /incr exch def\n /next-line next-lin"
  60. "e incr add def\n next-line lpc ge next-line incr sub lpc lt and {\n"
  61. " % We just went to the top of column 2\n /next-line lpc def\n } i"
  62. "f\n next-line lpp ge {\n % We just went to the top of column 3; star"
  63. "t new page column 1\n showpage\n Hfont setfont\n /next-line 0 d"
  64. "ef\n show-pageno\n } if\n} def\n\n/NextColumn {\n lpc 1 sub Increme"
  65. "ntLine\n} def\n\n/NextPage {\n lpp 1 sub IncrementLine\n} def\n\n% Up"
  66. "on entry, we are OUTSIDE the clip\n/start-detail {\n /d-title exch def\n"
  67. "\n % align >= 1 inch at bottom of column, and/or start new column\n lp"
  68. "c next-line lpc mod sub widowlines lt {\n % Start at top of a column\n"
  69. " next-line lpc ge {\n % Start new page\n showpage\n Hf"
  70. "ont setfont\n /next-line 0 def\n show-pageno\n } {\n %"
  71. " Start new column\n /next-line lpc def\n } ifelse\n } if\n\n l"
  72. "margin tmargin moveto\n next-line lpc idiv delc mul next-line lpc mod "
  73. "dell mul rmoveto\n gsave d-title show grestore\n 0 dell rmoveto\n 1 1"
  74. " 4 {/j exch def gsave probw j mul 5 div -2 rmoveto 50 j 10 mul sub 20 st"
  75. "ring cvs cshow grestore} for\n 2 IncrementLineOutside\n /detail-count "
  76. "1 def\n cliptocolumn % MUST match\n /d-array [] def\n} def\n"
  77. "\n/size-detail {\n /d-names exch def\n /d-size exch def\n % zero sums"
  78. "\n /sums d-size array def\n 0 1 d-size 1 sub {/i exch def sums i 0 pu"
  79. "t} for\n /old-d-max 0 def\n /colors d-size array def\n 0 1 d-size 1 s"
  80. "ub {/i exch def colors i i 3 mul 17 mod 17 div put} for\n %0 1 d-size "
  81. "1 sub {/i exch def colors i d-names i get strhash 3 mul 17 mod 17 div p"
  82. "ut} for\n %0 1 d-size 1 sub {/i exch def ( ) show colors i get 20 stri"
  83. "ng cvs show} for\n} def\n\n/count-detail {\n /detail-total-count exch d"
  84. "ef\n % if total-count >= one column, start at top of a column\n detail"
  85. "-total-count lpp ge {\n % Start new page\n NextPage\n } {\n de"
  86. "tail-total-count lpc ge {\n % Start new column\n NextColumn\n "
  87. " } if\n } ifelse\n} def\n\n% highlight next entry with underbar\n/do-"
  88. "flag {\ngsave\n setrgbcolor\n lmargin tmargin moveto\n next-line lpc "
  89. "idiv delc mul next-line lpc mod dell mul rmoveto\n 0 -2 rmoveto\n pro"
  90. "bw 0 rlineto\n 0 dell neg rlineto\n probw neg 0 rlineto\n closepath\n"
  91. " fill\ngrestore\n} def\n\n/do-detail-e {\n /d-array exch def\n /d-enc"
  92. " exch def\n /d-label exch def\n /d-max -999999 def\n\n lmargin tmargi"
  93. "n moveto\n next-line lpc idiv delc mul next-line lpc mod dell mul rmov"
  94. "eto\n 0.25 setlinewidth\n\n % show label, using encoding color\n gsav"
  95. "e\n probw 2 add -2 rmoveto\n detail-count 1 sub 2 mod 0.25 inch mu"
  96. "l 0 rmoveto\n % ([) show detail-count 20 string cvs show (] ) show\n "
  97. " d-enc 0 lt {\n 0 setgray\n }{\n colors d-enc get 1 .8 se"
  98. "thsbcolor\n } ifelse\n d-label show\n grestore\n % For -prune- d"
  99. "raw horizontal line\n d-label length 8 gt {d-label 4 get (p) 0 get eq d"
  100. "-label 5 get (r) 0 get eq and {\n /prune-val d-label cvi def\n /ne"
  101. "wx prune-val 30 mul prob2x def\n gsave newx 6 rmoveto 0 -12 rlineto 1"
  102. ".5 setlinewidth 0.8 setgray stroke grestore\n gsave probw 0 add 0 rli"
  103. "neto 0.25 setlinewidth 0.8 setgray stroke grestore\n } if } if\n\n % t"
  104. "rack max per new row\n 0 1 d-array length 1 sub {\n /i exch def\n "
  105. " /sum sums i get d-array i get add def\n d-max sum lt {/d-max sum def"
  106. "} if\n } for\n\n % draw line increments\n 0 1 d-array length 1 sub {\n"
  107. " /i exch def\n detail-count 1 gt {\n /oldx old-d-max sums i g"
  108. "et sub prob2x def\n } {\n /oldx 600 prob2x def\n } ifelse\n "
  109. " /oldy dell neg def\n /newx d-max sums i get d-array i get add sub"
  110. " prob2x def\n /newy 0 def\n gsave\n oldx oldy rmoveto\n newx"
  111. " oldx sub newy oldy sub rlineto\n % if encoding is being tracked, ma"
  112. "ke bold line\n i track-me eq\n {2 setlinewidth}\n {i track-"
  113. "me2 eq {1.25 setlinewidth} {0.25 setlinewidth} ifelse}\n ifelse\n "
  114. " colors i get 1 .8 sethsbcolor stroke\n grestore\n } for\n /detail"
  115. "-count detail-count 1 add def\n\n % increment running total in sums, tr"
  116. "ack max per row\n 0 1 d-array length 1 sub {\n /i exch def\n sums"
  117. " i sums i get d-array i get add put\n } for\n /old-d-max d-max def\n"
  118. "\n 1 IncrementLine\n} def\n\n\n/do-detail {\n /d-array exch def\n /d-"
  119. "label exch def\n d-label -1 d-array do-detail-e\n} def\n\n% Upon exit, "
  120. "we are outside the clip\n/end-detail {\n pop\n endcliptocolumn "
  121. " % MUST match\n column-box\n\n % text labels\n 0 1 d-array length 1 s"
  122. "ub {\n /i exch def\n gsave\n /newx old-d-max sums i get sub pro"
  123. "b2x def\n newx 0 ge {\n newx 0 rmoveto\n currentpoint trans"
  124. "late\n colors i get 1 .8 sethsbcolor\n gsave 0 dell neg rline"
  125. "to 0.25 setlinewidth stroke grestore\n -60 rotate\n 0 -2 movet"
  126. "o d-names i get show\n } if\n grestore\n } for\n d-array length "
  127. "0 gt {\n lpg IncrementLineOutside\n } {\n lpg 4 idiv IncrementLin"
  128. "eOutside\n } ifelse\n} def\n\n/do-src {\n/src exch def\n lmargin tmarg"
  129. "in moveto\n next-line lpc idiv delc mul next-line lpc mod dell mul rmo"
  130. "veto\n Cfont setfont\n src show\n Hfont setfont\n 1 IncrementLine\n}"
  131. " def\n\n% Underline trigram in source text\n/do-highlight1 {\n /hl-colo"
  132. "r exch def\n /hl-offset exch def\n /hl-line exch 1 sub 2 mul def\n gs"
  133. "ave\n lmargin tmargin moveto\n next-line hl-line sub lpc idiv delc mul"
  134. "\n next-line hl-line sub lpc mod dell mul rmoveto\n % Assume text is 6"
  135. " chars in and 3.6 pts per char, but 2 chars per offset\n hl-offset 2 mu"
  136. "l 6 add 3.6 mul 4 rmoveto\n\n 0 setgray 0.5 setlinewidth\n hl-color 1"
  137. " eq {0 0 1 setrgbcolor} if % Latin1 blue\n hl-color 2 eq {1 0 1 setrgb"
  138. "color} if % Latin2 magenta\n hl-color 3 eq {1 0.67 0 setrgbcolor} if "
  139. "% Latin7 orange\n 18 -2 rlineto stroke\n grestore\n} def\n\n% Box trig"
  140. "ram in source text\n/do-highlight2 {\n /hl-color exch def\n /hl-offset"
  141. " exch def\n /hl-line exch 1 sub 2 mul def\n gsave\n lmargin tmargin m"
  142. "oveto\n next-line hl-line sub lpc idiv delc mul\n next-line hl-line su"
  143. "b lpc mod dell mul rmoveto\n % Assume text is 6 chars in and 3.6 pts pe"
  144. "r char, but 2 chars per offset\n hl-offset 2 mul 6 add 3.6 mul 4 rmove"
  145. "to\n\n 0 setgray 0.25 setlinewidth\n hl-color 1 eq {0 0 1 setrgbcolor}"
  146. " if % Latin1 blue\n hl-color 2 eq {1 0 1 setrgbcolor} if % Latin2 mag"
  147. "enta\n hl-color 3 eq {1 0.67 0 setrgbcolor} if % Latin7 orange\n -0.5"
  148. " -0.5 rmoveto\n 22 0 rlineto\n 0 4 rlineto\n -11 2 rlineto\n -11 -2 "
  149. "rlineto\n closepath\n stroke\n grestore\n} def\n\n/show-pageno {\ngsa"
  150. "ve\nlmargin bmargin moveto 0 -12 rmoveto\n(Page ) show pageno 20 string "
  151. "cvs show\ngrestore\n/pageno pageno 1 add def\n} def\n\n/pageno 1 def\nsh"
  152. "ow-pageno\n%=============================\n\n\n"