Graphviz给出了很多字体错误

时间:2011-12-20 22:13:55

标签: fonts javadoc graphviz

我正在使用maven和maven-javadoc-plugin和umlgraph-doclet为我的项目创建javadoc。我朋友的那部分:

<build>
  <plugins>
    <plugin>
      <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-site-plugin</artifactId>
      <inherited>false</inherited>
      <configuration>
        <reportPlugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-javadoc-plugin</artifactId>
            <version>2.8</version>
            <configuration>
              <show>public</show>
              <quiet>true</quiet>

              <doclet>org.umlgraph.doclet.UmlGraphDoc</doclet>
              <docletArtifact>
                <groupId>org.umlgraph</groupId>
                <artifactId>doclet</artifactId>
                <version>5.1</version>
              </docletArtifact>

              <useStandardDocletOptions>true</useStandardDocletOptions>
              <additionalparam>
                -inferrel -inferdep -quiet -hide java.* -hide org.eclipse.* -collpackages java.util.* -postfixpackage
                -nodefontsize 9 -nodefontpackagesize 7 -attributes -types -visibility -operations -constructors
                -enumerations -enumconstants -views
              </additionalparam>
            </configuration>
            <reportSets>
              <reportSet>
                <reports>
                  <report>aggregate</report>
                </reports>
              </reportSet>
            </reportSets>
          </plugin>
        </reportPlugins>
      </configuration>
    </plugin>
  </plugins>
</build>

这些是使用umlgraph doclet生成的.dot文件运行mvn sitedot -Tpng class.dot -o class.cli.png时得到的错误:

[0] Times-Roman => "Times,  REGULAR"
[1] Times-Italic => "Times,  REGULAR ITALIC"
[2] Times-Bold => "Times,  BOLD"
[3] Times-BoldItalic => "Times,  BOLD ITALIC"
[4] AvantGarde-Book => "URW Gothic L,  BOOK"
[5] AvantGarde-BookOblique => "URW Gothic L,  BOOK"
[6] AvantGarde-Demi => "URW Gothic L,  DEMI"
[7] AvantGarde-DemiOblique => "URW Gothic L,  DEMI"
[8] Bookman-Light => "URW Bookman L,  LIGHT"
[9] Bookman-LightItalic => "URW Bookman L,  LIGHT ITALIC"
[10] Bookman-Demi => "URW Bookman L, "
[11] Bookman-DemiItalic => "URW Bookman L,  ITALIC"
[12] Courier => "Courier,  REGULAR"
[13] Courier-Oblique => "Courier,  REGULAR OBLIQUE"
[14] Courier-Bold => "Courier,  BOLD"
[15] Courier-BoldOblique => "Courier,  BOLD OBLIQUE"
[16] Helvetica => "Helvetica,  REGULAR"
[17] Helvetica-Oblique => "Helvetica,  REGULAR OBLIQUE"
[18] Helvetica-Bold => "Helvetica,  BOLD"
[19] Helvetica-BoldOblique => "Helvetica,  BOLD OBLIQUE"
[20] Helvetica-Narrow => "Helvetica,  REGULAR"
[21] Helvetica-Narrow-Oblique => "Helvetica,  REGULAR OBLIQUE"
[22] Helvetica-Narrow-Bold => "Helvetica,  BOLD"
[23] Helvetica-Narrow-BoldOblique => "Helvetica,  BOLD OBLIQUE"
[24] NewCenturySchlbk-Roman => "Century Schoolbook L,  ROMAN"
[25] NewCenturySchlbk-Italic => "Century Schoolbook L,  REGULAR ITALIC"
[26] NewCenturySchlbk-Bold => "Century Schoolbook L,  BOLD"
[27] NewCenturySchlbk-BoldItalic => "Century Schoolbook L,  BOLD ITALIC"
[28] Palatino-Roman => "URW Palladio L,  ROMAN"
[29] Palatino-Italic => "URW Palladio L,  REGULAR ITALIC"
[30] Palatino-Bold => "URW Palladio L,  BOLD"
[31] Palatino-BoldItalic => "URW Palladio L,  BOLD ITALIC"
[32] Symbol => "Impact, "
[33] ZapfChancery-MediumItalic => "URW Chancery L,  ITALIC"
[34] ZapfDingbats => "Dingbats,  REGULAR"

并非该列表中的所有字体都在.dot文件中使用,只有Helvetica在那里使用。我正在使用linux。我可以提供用于测试的.dot文件。 我的另一个观察:当在终端中运行时,并非每次运行都会显示这些错误。平均每第3次运行没有它们。与-v

一起运行时的输出
dot - graphviz version 2.28.0 (20111204.1018)
libdir = "/usr/lib/graphviz"
Activated plugin library: libgvplugin_pango.so.6
Using textlayout: textlayout:cairo
Using render: cairo:cairo
Using device: png:cairo:cairo
Activated plugin library: libgvplugin_dot_layout.so.6
Using layout: dot:dot_layout
The plugin configuration file:
        /usr/lib/graphviz/config6
            was successfully loaded.
    render      :  cairo dot fig gd map ps svg tk vml vrml xdot
    layout      :  circo dot fdp neato nop nop1 nop2 osage patchwork sfdp twopi
    textlayout  :  textlayout
    device      :  bmp canon cmap cmapx cmapx_np dot eps fig gd gd2 gif gv ico imap imap_np ismap jpe jpeg jpg pdf plain plain-ext png ps ps2 svg svgz tif tiff tk vml vmlz vrml wbmp x11 xdot xlib
    loadimage   :  (lib) eps gd gd2 gif jpe jpeg jpg png ps svg
fontname: "Helvetica" resolved to: (ps:pango  Helvetica,  REGULAR) (PangoCairoFcFont) "Arial, Regular" /usr/share/fonts/TTF/Arialtbg.ttf
network simplex:  3 nodes 2 edges maxiter=2147483647 balance=1
network simplex: 3 nodes 2 edges 0 iter 0.00 sec
network simplex:  1 nodes 0 edges maxiter=2147483647 balance=1
network simplex: 1 nodes 0 edges 0 iter 0.00 sec
mincross: pass 0 iter 0 trying 0 cur_cross 0 best_cross 0
mincross: pass 0 iter 0 trying 0 cur_cross 0 best_cross 0
mincross G: 0 crossings, 0.00 secs.
network simplex:  6 nodes 6 edges maxiter=2147483647 balance=2
network simplex: 6 nodes 6 edges 1 iter 0.00 sec
routesplines: 2 edges, 6 boxes 0.00 sec
Using render: cairo:cairo
Using device: png:cairo:cairo
dot: allocating a 1162K cairo image surface (781 x 381 pixels)

有人知道如何修复或压制它们吗?令人烦恼的是,每个站点生成都会产生超过2k行的这些错误。

2 个答案:

答案 0 :(得分:1)

您看到的消息是调试脚手架的一部分。它们不是错误,而只是有关字体映射的信息。仅当使用-v运行Graphviz且值为2或更大时才会打印此选项。相关的内部代码是

if (Verbose > 1)
    printFontMap (gv_fmap, ps_fontnames_sz);

这应该是完全确定的。我需要更多关于如何使用Graphviz来建议更多细节的信息。

答案 1 :(得分:1)

不幸的是因为点命令行选项在UmlGraphDoc.java中是硬编码的,所以没有直接的方法可以改变dot的命令行选项[可以创建一个名为dot的shell脚本,该脚本位于带有所需参数的路径中的实际点之前]

代码段UmlGraphDoc.java

p = Runtime.getRuntime().exec(
  new String[] { "dot", "-Tcmapx", "-o",
  mapFile.getAbsolutePath(), "-Tpng", "-o",
  pngFile.getAbsolutePath(),
  dotFile.getAbsolutePath() });
maven-javadoc-plugin

<quiet>true</quiet>选项不会禁止出现警告和错误

AFAIK只有剩下的方法是

以安静模式运行maven

mvn -q

或者grep maven命令的输出来抑制包含=>

的行
mvn site | grep -v ' => "'