{"action":"created","issue":{"url":"https://api.github.com/repos/doraTeX/TeX2img/issues/68","labels_url":"https://api.github.com/repos/doraTeX/TeX2img/issues/68/labels{/name}","comments_url":"https://api.github.com/repos/doraTeX/TeX2img/issues/68/comments","events_url":"https://api.github.com/repos/doraTeX/TeX2img/issues/68/events","html_url":"https://github.com/doraTeX/TeX2img/issues/68","id":120538571,"number":68,"title":"ベクター画像のパス変形（EMF の破線描画サポート）","user":{"login":"aminophen","id":9957466,"avatar_url":"https://avatars.githubusercontent.com/u/9957466?v=3","gravatar_id":"","url":"https://api.github.com/users/aminophen","html_url":"https://github.com/aminophen","followers_url":"https://api.github.com/users/aminophen/followers","following_url":"https://api.github.com/users/aminophen/following{/other_user}","gists_url":"https://api.github.com/users/aminophen/gists{/gist_id}","starred_url":"https://api.github.com/users/aminophen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aminophen/subscriptions","organizations_url":"https://api.github.com/users/aminophen/orgs","repos_url":"https://api.github.com/users/aminophen/repos","events_url":"https://api.github.com/users/aminophen/events{/privacy}","received_events_url":"https://api.github.com/users/aminophen/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/doraTeX/TeX2img/labels/done","name":"done","color":"bfdadc"},{"url":"https://api.github.com/repos/doraTeX/TeX2img/labels/enhancement","name":"enhancement","color":"84b6eb"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":31,"created_at":"2015-12-05T07:41:37Z","updated_at":"2015-12-07T05:52:32Z","closed_at":null,"body":"#57 で話題に出た「[破線の見た目が EMF でおかしい](https://github.com/doraTeX/TeX2img/issues/57#issuecomment-154707698)」という問題の解決策を考案しました（[調査レポート](http://d.hatena.ne.jp/acetaminophen/20151205/1449294353)）。Ghostscript 独自に拡張された PostScript operator のひとつである `.dashpath` を使います。\r\n\r\n以下の2行のコードを PS / EPS ファイルの冒頭に加え、出来上がった PS / EPS を gs の eps(2)write または pdfwrite デバイスに通します：\r\n\r\n~~~~ postscript\r\n/oldsetdash /setdash load def\r\n/setdash {oldsetdash .dashpath [] 0 oldsetdash} def\r\n~~~~\r\n\r\n追記 (2015-12-06) より強力な方法を見つけました（[出典](https://github.com/doraTeX/TeX2img/issues/68#issuecomment-162291126)）。上記の2行ではなく、下記の2行を PS / EPS ファイルの冒頭に加えます：\r\n\r\n~~~~ postscript\r\n/oldstroke /stroke load def\r\n/stroke {.dashpath [] 0 setdash oldstroke} def\r\n~~~~\r\n\r\nすると、元のファイルにあった“空でない破線配列 (dash array) を適用した一本の線分を描画する命令”は、新しいファイルでは“空の破線配列を適用したバラバラの線分を描画する命令”に置き換わります。こうすると、EMF 変換しても破線の見た目が保たれるのではないかと期待しています。\r\n\r\nWindows 版はだいぶ状況が改善して EMF でも破線が綺麗に出てくる場合が増えたようですが、Mac 版は特に破線が苦手だったと思います。上の方法を使って、EMF 出力の場合だけ\r\n\r\n- Windows 版： PDF →[eps(2)write]→ EPS →[BB編集と破線再定義]→[pdfwrite]→ PDF → EMF\r\n- Mac 版： PDF →[eps(2)write]→ EPS →[BB編集と破線再定義]→[eps(2)write]→ EPS → EMF\r\n\r\nのようにすればうまくいくかもしれません。ただし、任意の PS / EPS ファイルで上記の再定義法が適用できるかは未確認です。"},"comment":{"url":"https://api.github.com/repos/doraTeX/TeX2img/issues/comments/162417808","html_url":"https://github.com/doraTeX/TeX2img/issues/68#issuecomment-162417808","issue_url":"https://api.github.com/repos/doraTeX/TeX2img/issues/68","id":162417808,"user":{"login":"doraTeX","id":6186180,"avatar_url":"https://avatars.githubusercontent.com/u/6186180?v=3","gravatar_id":"","url":"https://api.github.com/users/doraTeX","html_url":"https://github.com/doraTeX","followers_url":"https://api.github.com/users/doraTeX/followers","following_url":"https://api.github.com/users/doraTeX/following{/other_user}","gists_url":"https://api.github.com/users/doraTeX/gists{/gist_id}","starred_url":"https://api.github.com/users/doraTeX/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/doraTeX/subscriptions","organizations_url":"https://api.github.com/users/doraTeX/orgs","repos_url":"https://api.github.com/users/doraTeX/repos","events_url":"https://api.github.com/users/doraTeX/events{/privacy}","received_events_url":"https://api.github.com/users/doraTeX/received_events","type":"User","site_admin":false},"created_at":"2015-12-07T05:52:32Z","updated_at":"2015-12-07T05:52:32Z","body":"epstopdf を呼んでいるのは，一旦PDFにしてから pdftops にかけることで，後半の経路をgs 9.15 以上と 9.14 以下で共有するためでした。"}}