// Copyright 2016 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
////////////////////////////////////////////////////////////////////////////////
// Produced by stringify.cc on 2007-09-28 09:13 from file i18n/encodings/compact_enc_det/tools/detail_head.ps
  "%!PS-Adobe-2.0\n\n/inch {72 mul} def\n/cshow {dup stringwidth pop -2 div"
  " 0 rmoveto show} def\n\n/lmargin 0.5 inch def\n/rmargin 8.5 inch def\n/t"
  "margin 10.5 inch def\n/bmargin 0.5 inch def\n\n\n% set to N>=0 to track "
  "ranked encoding N\n/track-me -1 def\n/track-me2 -1 def\n\n/columns 2 def"
  "\n\n/lpi 18 def                 % lines per inch\n/lpc lpi 10 mul def   "
  "      % lines per column\n/lpp lpc columns mul def    % lines per page\n"
  "/probw 3.0 inch def         % probability width\n/probr 50 def          "
  "     % probability range\n/widowlines lpi 2 idiv def  % 1/2 inch widow a"
  "t bottom\n/widowlines lpi def         % 1 inch widow at bottom\n\n/lpg l"
  "pi 2 idiv def         % 1/2 inch spacing between groups\n\n/delc 4 inch "
  "def\n/dell -1 inch lpi div def\n\n/next-line 0 def      % 24 lines per i"
  "nch, 240 per column\n\n/Cfont /Courier findfont 6 scalefont def\n/Hfont "
  "/Helvetica findfont 6 scalefont def\nHfont setfont\n\n\n% simple string "
  "hash -- sum the characters\n/strhash {\n  /hstr exch def\n  /h 0 def\n  "
  "0 1 hstr length 1 sub {/i exch def  /h h hstr i get add def} for\n  h\n}"
  " def\n\n% convert pro at 30 per 2x to 0-2.5 inches spanning -50 to 0\n/p"
  "rob2x {\n  30 idiv probr div probw mul neg probw add\n}def\n\n\n/cliptoc"
  "olumn {\n  % ====== MUST MATCH ME ======\n  gsave\n  lmargin tmargin mov"
  "eto\n  next-line lpc idiv delc mul 0 rmoveto\n  -1 18 rmoveto 0 -10.5 in"
  "ch rlineto  delc 2 add 0 rlineto  0 10.5 inch rlineto closepath\n  clip\n"
  "  newpath\n} def\n\n/endcliptocolumn {\n  grestore\n  % ====== MUST MATC"
  "H ME ======\n} def\n\n\n\n/column-box {\n  lmargin tmargin moveto\n  nex"
  "t-line 1 sub lpc idiv delc mul  next-line 1 sub lpc mod 1 add dell mul r"
  "moveto\n  % box\n  gsave -1.5 0 rmoveto 0 detail-count dell mul neg rmov"
  "eto  probw 3 add 0 rlineto 0.25 setlinewidth stroke grestore\n  gsave -1"
  ".5 0 rmoveto 0 detail-count dell mul neg rlineto 0.25 setlinewidth strok"
  "e grestore\n  gsave probw .8 mul 0 rmoveto 0 detail-count dell mul neg r"
  "lineto 0.25 setlinewidth 0.8 setgray stroke grestore\n  gsave probw .6 m"
  "ul 0 rmoveto 0 detail-count dell mul neg rlineto 0.25 setlinewidth 0.8 s"
  "etgray stroke grestore\n  gsave probw .4 mul 0 rmoveto 0 detail-count de"
  "ll mul neg rlineto 0.25 setlinewidth 0.8 setgray stroke grestore\n  gsav"
  "e probw .2 mul 0 rmoveto 0 detail-count dell mul neg rlineto 0.25 setlin"
  "ewidth 0.8 setgray stroke grestore\n  gsave probw 1.5 add 0 rmoveto 0 de"
  "tail-count dell mul neg rlineto 0.25 setlinewidth stroke grestore\n} def"
  "\n\n\n/IncrementLine {\n  /incr exch def\n  /next-line next-line incr ad"
  "d def\n  next-line lpc ge   next-line incr sub lpc lt   and {\n    % We "
  "just went to the top of column 2; redo clip\n    endcliptocolumn     % M"
  "UST match\n    column-box\n    /next-line lpc def\n    cliptocolumn     "
  "   % MUST match\n  } if\n  next-line lpp ge {\n    % We just went to the"
  " top of column 3; start new page column 1\n    endcliptocolumn     % MUS"
  "T match\n    column-box\n    showpage\n    Hfont setfont\n    /next-line"
  " 0 def\n    show-pageno\n    cliptocolumn        % MUST match\n  } if\n}"
  " def\n\n/IncrementLineOutside {\n  /incr exch def\n  /next-line next-lin"
  "e incr add def\n  next-line lpc ge   next-line incr sub lpc lt   and {\n"
  "    % We just went to the top of column 2\n    /next-line lpc def\n  } i"
  "f\n  next-line lpp ge {\n    % We just went to the top of column 3; star"
  "t new page column 1\n    showpage\n    Hfont setfont\n    /next-line 0 d"
  "ef\n    show-pageno\n  } if\n} def\n\n/NextColumn {\n  lpc 1 sub Increme"
  "ntLine\n} def\n\n/NextPage {\n    lpp 1 sub IncrementLine\n} def\n\n% Up"
  "on entry, we are OUTSIDE the clip\n/start-detail {\n  /d-title exch def\n"
  "\n  % align >= 1 inch at bottom of column, and/or start new column\n  lp"
  "c next-line lpc mod sub widowlines lt {\n    % Start at top of a column\n"
  "    next-line lpc ge {\n      % Start new page\n      showpage\n      Hf"
  "ont setfont\n      /next-line 0 def\n      show-pageno\n    } {\n      %"
  " Start new column\n      /next-line lpc def\n    } ifelse\n  } if\n\n  l"
  "margin tmargin moveto\n  next-line lpc idiv delc mul  next-line lpc mod "
  "dell mul rmoveto\n  gsave d-title show grestore\n  0 dell rmoveto\n  1 1"
  " 4 {/j exch def gsave probw j mul 5 div -2 rmoveto 50 j 10 mul sub 20 st"
  "ring cvs cshow grestore} for\n  2 IncrementLineOutside\n  /detail-count "
  "1 def\n  cliptocolumn            % MUST match\n  /d-array [] def\n} def\n"
  "\n/size-detail {\n  /d-names exch def\n  /d-size exch def\n  % zero sums"
  "\n  /sums d-size array def\n  0 1 d-size 1 sub {/i exch def  sums i 0 pu"
  "t} for\n  /old-d-max 0 def\n  /colors d-size array def\n  0 1 d-size 1 s"
  "ub {/i exch def  colors i i 3 mul 17 mod 17 div put} for\n  %0 1 d-size "
  "1 sub {/i exch def  colors i d-names i get strhash 3 mul 17 mod 17 div p"
  "ut} for\n  %0 1 d-size 1 sub {/i exch def  ( ) show colors i get 20 stri"
  "ng cvs show} for\n} def\n\n/count-detail {\n  /detail-total-count exch d"
  "ef\n  % if total-count >= one column, start at top of a column\n  detail"
  "-total-count lpp ge {\n    % Start new page\n    NextPage\n  } {\n    de"
  "tail-total-count lpc ge {\n      % Start new column\n      NextColumn\n "
  "   } if\n  } ifelse\n} def\n\n% highlight next entry with underbar\n/do-"
  "flag {\ngsave\n  setrgbcolor\n  lmargin tmargin moveto\n  next-line lpc "
  "idiv delc mul  next-line lpc mod dell mul rmoveto\n  0 -2 rmoveto\n  pro"
  "bw 0 rlineto\n  0 dell neg rlineto\n  probw neg 0 rlineto\n  closepath\n"
  "  fill\ngrestore\n} def\n\n/do-detail-e {\n  /d-array exch def\n  /d-enc"
  " exch def\n  /d-label exch def\n  /d-max -999999 def\n\n  lmargin tmargi"
  "n moveto\n  next-line lpc idiv delc mul  next-line lpc mod dell mul rmov"
  "eto\n  0.25 setlinewidth\n\n  % show label, using encoding color\n  gsav"
  "e\n    probw 2 add -2 rmoveto\n    detail-count 1 sub 2 mod 0.25 inch mu"
  "l 0 rmoveto\n    % ([) show detail-count 20 string cvs show (] ) show\n "
  "   d-enc 0 lt {\n      0 setgray\n    }{\n      colors d-enc get 1 .8 se"
  "thsbcolor\n    } ifelse\n    d-label show\n  grestore\n  % For -prune- d"
  "raw horizontal line\n  d-label length 8 gt {d-label 4 get (p) 0 get eq d"
  "-label 5 get (r) 0 get eq and {\n    /prune-val d-label cvi def\n    /ne"
  "wx prune-val 30 mul prob2x def\n    gsave newx 6 rmoveto 0 -12 rlineto 1"
  ".5 setlinewidth 0.8 setgray stroke grestore\n    gsave probw 0 add 0 rli"
  "neto 0.25 setlinewidth 0.8 setgray stroke grestore\n  } if } if\n\n  % t"
  "rack max per new row\n  0 1 d-array length 1 sub {\n    /i exch def\n   "
  " /sum sums i get d-array i get add def\n    d-max sum lt {/d-max sum def"
  "} if\n  } for\n\n  % draw line increments\n  0 1 d-array length 1 sub {\n"
  "    /i exch def\n    detail-count 1 gt {\n      /oldx old-d-max sums i g"
  "et sub prob2x def\n    } {\n      /oldx 600 prob2x def\n    } ifelse\n  "
  "  /oldy dell neg def\n    /newx d-max  sums i get d-array i get add  sub"
  " prob2x def\n    /newy 0 def\n    gsave\n    oldx oldy rmoveto\n    newx"
  " oldx sub  newy oldy sub rlineto\n    % if encoding is being tracked, ma"
  "ke bold line\n    i track-me eq\n      {2 setlinewidth}\n      {i track-"
  "me2 eq {1.25 setlinewidth} {0.25 setlinewidth} ifelse}\n      ifelse\n  "
  "  colors i get 1 .8 sethsbcolor stroke\n    grestore\n  } for\n  /detail"
  "-count detail-count 1 add def\n\n  % increment running total in sums, tr"
  "ack max per row\n  0 1 d-array length 1 sub {\n    /i exch def\n    sums"
  " i  sums i get d-array i get add  put\n  } for\n  /old-d-max d-max def\n"
  "\n  1 IncrementLine\n} def\n\n\n/do-detail {\n  /d-array exch def\n  /d-"
  "label exch def\n  d-label -1 d-array do-detail-e\n} def\n\n% Upon exit, "
  "we are outside the clip\n/end-detail {\n  pop\n  endcliptocolumn        "
  " % MUST match\n  column-box\n\n  % text labels\n  0 1 d-array length 1 s"
  "ub {\n    /i exch def\n    gsave\n    /newx old-d-max sums i get sub pro"
  "b2x def\n    newx 0 ge {\n      newx 0 rmoveto\n      currentpoint trans"
  "late\n      colors i get 1 .8 sethsbcolor\n      gsave 0 dell neg  rline"
  "to 0.25 setlinewidth stroke grestore\n      -60 rotate\n      0 -2 movet"
  "o d-names i get show\n    } if\n    grestore\n  } for\n  d-array length "
  "0 gt {\n    lpg IncrementLineOutside\n  } {\n    lpg 4 idiv IncrementLin"
  "eOutside\n  } ifelse\n} def\n\n/do-src {\n/src exch def\n  lmargin tmarg"
  "in moveto\n  next-line lpc idiv delc mul  next-line lpc mod dell mul rmo"
  "veto\n  Cfont setfont\n  src show\n  Hfont setfont\n  1 IncrementLine\n}"
  " def\n\n% Underline trigram in source text\n/do-highlight1 {\n  /hl-colo"
  "r exch def\n  /hl-offset exch def\n  /hl-line exch 1 sub 2 mul def\n  gs"
  "ave\n  lmargin tmargin moveto\n  next-line hl-line sub lpc idiv delc mul"
  "\n  next-line hl-line sub lpc mod dell mul rmoveto\n  % Assume text is 6"
  " chars in and 3.6 pts per char, but 2 chars per offset\n  hl-offset 2 mu"
  "l 6 add 3.6 mul  4 rmoveto\n\n  0 setgray 0.5 setlinewidth\n  hl-color 1"
  " eq {0 0 1 setrgbcolor} if  % Latin1 blue\n  hl-color 2 eq {1 0 1 setrgb"
  "color} if  % Latin2 magenta\n  hl-color 3 eq {1 0.67 0 setrgbcolor} if  "
  "% Latin7 orange\n  18 -2 rlineto stroke\n  grestore\n} def\n\n% Box trig"
  "ram in source text\n/do-highlight2 {\n  /hl-color exch def\n  /hl-offset"
  " exch def\n  /hl-line exch 1 sub 2 mul def\n  gsave\n  lmargin tmargin m"
  "oveto\n  next-line hl-line sub lpc idiv delc mul\n  next-line hl-line su"
  "b lpc mod dell mul rmoveto\n  % Assume text is 6 chars in and 3.6 pts pe"
  "r char, but 2 chars per offset\n  hl-offset 2 mul 6 add 3.6 mul  4 rmove"
  "to\n\n  0 setgray 0.25 setlinewidth\n  hl-color 1 eq {0 0 1 setrgbcolor}"
  " if  % Latin1 blue\n  hl-color 2 eq {1 0 1 setrgbcolor} if  % Latin2 mag"
  "enta\n  hl-color 3 eq {1 0.67 0 setrgbcolor} if  % Latin7 orange\n  -0.5"
  " -0.5 rmoveto\n  22 0 rlineto\n  0 4 rlineto\n  -11 2 rlineto\n  -11 -2 "
  "rlineto\n  closepath\n  stroke\n  grestore\n} def\n\n/show-pageno {\ngsa"
  "ve\nlmargin bmargin moveto 0 -12 rmoveto\n(Page ) show pageno 20 string "
  "cvs show\ngrestore\n/pageno pageno 1 add def\n} def\n\n/pageno 1 def\nsh"
  "ow-pageno\n%=============================\n\n\n"
