document.write('
Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. $regexColor = New-Object Text.RegularExpressions.Regex -ArgumentList "([\\d\\.]+\\s){3}C"
  2. $regexEmptyShape = New-Object Text.RegularExpressions.Regex -ArgumentList "([\\d\\.]+\\s){2}(\\w+)E"
  3. $script:newColor = $false
  4.  
  5. function f($l)
  6. {
  7.     # マイナス記号の修正
  8.     $l = ($l -replace "\\(-([\\d\\.]+)\\)","(ア`$1)")
  9.     # /CircE は都合が悪いので CircleE に変更
  10.     $l = ($l -replace "CircE","CircleE")
  11.     # 色の更新があるかどうか
  12.     $m = $regexColor.Match($l)
  13.     if ($m.Success)
  14.     {
  15.         $script:color = $m.Captures[0].Value
  16.         $script:newColor = $true
  17.     }
  18.     # 空の図形があれば先に塗潰し図形を描画するように変更
  19.     $m = $regexEmptyShape.Match($l)
  20.     if ($m.Success)
  21.     {
  22.         $b = New-Object Text.StringBuilder
  23.         if ($script:newColor)
  24.         {
  25.             "closepath stroke"
  26.             $script:newColor = $false
  27.         }
  28.         "1 1 1 C"
  29.         $m.Groups[1].Captures[0].Value + $m.Groups[1].Captures[1].Value + $m.Groups[2].Captures[0].Value + "F"
  30.         $script:color
  31.         $m.Captures[0].Value
  32.         return
  33.     }
  34.  
  35.     return $l
  36. }
  37.  
  38. $tmp = "out.eps.tmp"
  39. $eps = "out.eps"
  40.  
  41. Get-Content $eps | %{ f($_) } | Set-Content $tmp -Encoding Default
  42. Move-Item $tmp $eps -Force
');