blockdiag / nwdiag

Apache License 2.0
113 stars 18 forks source link

フォント指定でのPNG出力で出力エラーとなる #1

Open tk0miya opened 6 years ago

tk0miya commented 6 years ago

フォント指定でのPNG出力で出力エラーとなる現象がありましたので報告いたします。 ちなみに、blogにてコメントを頂戴した物です。

==== 状況 ==== redmineのWiki External Filter Plugin経由で実行しました。

==== コード ====

{
   サイトトップ -> ログイン画面 -> 情報一覧画面;
   サイトトップ -> 会員登録入力画面 -> 会員登録確認画面 -> 会員登録完了画面 -> サンキューメール;
   サンキューメール[shape = "mail"];
}

==== 実行コマンド ====

/usr/bin/nwdiag -Tpng  -f /usr/share/fonts/japanese/TrueType/sazanami-gothic.ttf -a -o/dev/stdout /dev/stdin

===== 備考 ===== フォントを指定すると本現象が発生する。 フォント指定をしない場合は本現象は発生しませんでした。

==== バージョン情報 ==== Linux MACHINENAME 2.6.18-238.9.1.el5 #1 SMP Tue Apr 12 18:10:56 EDT 2011 i686 i686 i386 GNU/Linux CentOS release 5.6 (Final)

blockdiag 0.8.1

Python 2.4.3 Name : python Arch : i386 Version : 2.4.3 Release : 44.el5

==== 詳細ログ ====

<div class="flash error">Error executing the <strong>blockdiag</strong> macro (Error applying external filter: stdout is <!--?xml version='1.0' encoding='UTF-8'?-->

<svg xmlns:inkspace="http://www.inkscape.org/namespaces/inkscape" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 216 ">
    <defs id="defs_block">
        <filter id="filter_blur" x="-0.07875" y="-0.252" width="1.1575" height="1.504" inkspace:collect="always">
            <feGaussianBlur inkspace:collect="always" id="feGaussianBlur3780" stdDeviation="4.2"/>
        </filter>
    </defs>
    <title>blockdiag</title>
    <rect fill="rgb(0,0,0)" stroke-width="1" x="67" y="54" stroke="rgb(0,0,0)" width="128" height="40" style="filter:url(#filter_blur);opacity:0.7;fill-opacity:1"/>
    <rect fill="rgb(0,0,0)" stroke-width="1" x="259" y="54" stroke="rgb(0,0,0)" width="128" height="40" style="filter:url(#filter_blur);opacity:0.7;fill-opacity:1"/>
    <rect fill="rgb(0,0,0)" stroke-width="1" x="259" y="134" stroke="rgb(0,0,0)" width="128" height="40" style="filter:url(#filter_blur);opacity:0.7;fill-opacity:1"/>
    <rect fill="rgb(0,0,0)" stroke-width="1" x="451" y="54" stroke="rgb(0,0,0)" width="128" height="40" style="filter:url(#filter_blur);opacity:0.7;fill-opacity:1"/>
    <rect fill="rgb(0,0,0)" stroke-width="1" x="451" y="134" stroke="rgb(0,0,0)" width="128" height="40" style="filter:url(#filter_blur);opacity:0.7;fill-opacity:1"/>
    <rect fill="rgb(0,0,0)" stroke-width="1" x="643" y="134" stroke="rgb(0,0,0)" width="128" height="40" style="filter:url(#filter_blur);opacity:0.7;fill-opacity:1"/>
    <rect fill="rgb(0,0,0)" stroke-width="1" x="835" y="134" stroke="rgb(0,0,0)" width="128" height="40" style="filter:url(#filter_blur);opacity:0.7;fill-opacity:1"/>
    <rect fill="rgb(255,255,255)" stroke-width="1" x="64" y="48" stroke="rgb(0,0,0)" width="128" height="40" style="None"/>
    <text fill="rgb(0,0,0)" font-size="11" x="104" y="74">サイトトップ</text>
    <rect fill="rgb(255,255,255)" stroke-width="1" x="256" y="48" stroke="rgb(0,0,0)" width="128" height="40" style="None"/>
    <text fill="rgb(0,0,0)" font-size="11" x="284" y="74">ログイン画面</text>
    <rect fill="rgb(255,255,255)" stroke-width="1" x="256" y="128" stroke="rgb(0,0,0)" width="128" height="40" style="None"/>
    <text fill="rgb(0,0,0)" font-size="11" x="275" y="154">会員登録入力画面</text>
    <rect fill="rgb(255,255,255)" stroke-width="1" x="448" y="48" stroke="rgb(0,0,0)" width="128" height="40" style="None"/>
    <text fill="rgb(0,0,0)" font-size="11" x="476" y="74">情報一覧画面</text>
    <rect fill="rgb(255,255,255)" stroke-width="1" x="448" y="128" stroke="rgb(0,0,0)" width="128" height="40" style="None"/>
    <text fill="rgb(0,0,0)" font-size="11" x="461" y="154">会員登録確認画面</text>
    <rect fill="rgb(255,255,255)" stroke-width="1" x="640" y="128" stroke="rgb(0,0,0)" width="128" height="40" style="None"/>
    <text fill="rgb(0,0,0)" font-size="11" x="656" y="154">会員登録完了画面</text>
    <rect fill="rgb(255,255,255)" stroke-width="1" x="832" y="128" stroke="rgb(0,0,0)" width="128" height="40" style="None"/>
    <path fill="none" d="M 832 128 L 896 144 L 960 128" stroke="rgb(0,0,0)"/>
    <text fill="rgb(0,0,0)" font-size="11" x="848" y="162">サンキューメール</text>
    <path fill="none" d="M 192 68 L 224 68 L 224 148 L 256 148" stroke="rgb(0,0,0)"/>
    <polygon fill="rgb(0,0,0)" stroke="rgb(0,0,0)" points="256, 148  248, 144  248, 152  256, 148  " style="None"/>
    <path fill="none" d="M 192 68 L 256 68" stroke="rgb(0,0,0)"/>
    <polygon fill="rgb(0,0,0)" stroke="rgb(0,0,0)" points="256, 68  248, 64  248, 72  256, 68  " style="None"/>
    <path fill="none" d="M 384 68 L 448 68" stroke="rgb(0,0,0)"/>
    <polygon fill="rgb(0,0,0)" stroke="rgb(0,0,0)" points="448, 68  440, 64  440, 72  448, 68  " style="None"/>
    <path fill="none" d="M 384 148 L 448 148" stroke="rgb(0,0,0)"/>
    <polygon fill="rgb(0,0,0)" stroke="rgb(0,0,0)" points="448, 148  440, 144  440, 152  448, 148  " style="None"/>
    <path fill="none" d="M 576 148 L 640 148" stroke="rgb(0,0,0)"/>
    <polygon fill="rgb(0,0,0)" stroke="rgb(0,0,0)" points="640, 148  632, 144  632, 152  640, 148  " style="None"/>
    <path fill="none" d="M 768 148 L 832 148" stroke="rgb(0,0,0)"/>
    <polygon fill="rgb(0,0,0)" stroke="rgb(0,0,0)" points="832, 148  824, 144  824, 152  832, 148  " style="None"/>
</svg>
, stderr is Traceback (most recent call last):
  File "/usr/bin/blockdiag", line 7, in ?
    sys.exit(
  File "/usr/lib/python2.4/site-packages/blockdiag-0.8.1-py2.4.egg/blockdiag/command.py", line 150, in main
    draw.draw()
  File "/usr/lib/python2.4/site-packages/blockdiag-0.8.1-py2.4.egg/blockdiag/DiagramDraw.py", line 122, in draw
    self.node(node, **kwargs)
  File "/usr/lib/python2.4/site-packages/blockdiag-0.8.1-py2.4.egg/blockdiag/DiagramDraw.py", line 257, in node
    font=self.font, badgeFill=self.badgeFill)
  File "/usr/lib/python2.4/site-packages/blockdiag-0.8.1-py2.4.egg/blockdiag/noderenderer/__init__.py", line 68, in render
    self.render_label(drawer, **kwargs)
  File "/usr/lib/python2.4/site-packages/blockdiag-0.8.1-py2.4.egg/blockdiag/noderenderer/__init__.py", line 82, in render_label
    lineSpacing=self.metrix.lineSpacing)
  File "/usr/lib/python2.4/site-packages/blockdiag-0.8.1-py2.4.egg/blockdiag/ImageDrawEx.py", line 263, in textarea
    lines = TextFolder(box, string, scale=self.scale_ratio, **kwargs)
  File "/usr/lib/python2.4/site-packages/blockdiag-0.8.1-py2.4.egg/blockdiag/utils/PILTextFolder.py", line 36, in __init__
    TextFolder.__init__(self, box, string, **kwargs)
  File "/usr/lib/python2.4/site-packages/blockdiag-0.8.1-py2.4.egg/blockdiag/utils/TextFolder.py", line 102, in __init__
    self._result = self._lines()
  File "/usr/lib/python2.4/site-packages/blockdiag-0.8.1-py2.4.egg/blockdiag/utils/TextFolder.py", line 255, in _lines
    if metrics[0] &lt;= size[0]:
TypeError: unsubscriptable object)

以上、ご確認のほどよろしくお願い申し上げます。


tk0miya commented 6 years ago

From Radek Marik on 2014-04-02 08:02:40+00:00

The issue should be treated more general. The current implementation seems to follow a kind of 'stack-based' assignments of method calls and returns. I have not found any way how to specify what instance activation a given method call should be linked to. GraphViz uses a notion of ports. What about to extend the syntax in similar way, i.e. to enable a use of activity labels extending instance labels? For example: { A -> C:0; B -> C:1; A <-- C:0; B <-- C:1; } For example, this would enable to diagram a number of threads under one instance (like HTTP pipelining, etc in my case :-)).