DOT(graphviz)中标签的下划线部分

Underline part of label in DOT (graphviz)

我想用 DOT 创建我的 class 图,因此我需要在静态方法下划线。

目前我的来源是:

digraph G {                                                                
    fontname = "Bitstream Vera Sans"                                       
    fontsize = 8                                                           

    node [                                                                 
        fontname = "Bitstream Vera Sans"                                   
        fontsize = 10                                                      
        shape = "record"                                                   
    ]                                                                      

    edge [                                                                 
        fontname = "Bitstream Vera Sans"                                   
        fontsize = 10                                                      
    ]                                                                      

    subgraph packagemodel {                                                

        Class [                                                            
            label = "{Classname|\l\                                        
                + attribute|\l\                                            
                + staticfunction}"                                         
        ]                                                                  
    }                                                                      
}

但我没有找到如何使标签的一部分带有下划线。你知道可以做吗?

提前致谢!

更新:

我现在改成:

digraph G {                                                                
    fontname = "Bitstream Vera Sans"                                       
    fontsize = 8                                                           

    node [                                                                 
        fontname = "Bitstream Vera Sans"                                   
        fontsize = 10                                                      
        shape = "record"                                                   
    ]                                                                      

    edge [                                                                 
        fontname = "Bitstream Vera Sans"                                   
        fontsize = 10                                                      
    ]                                                                      

    subgraph packagemodel {                                                

        Class [
            label =
            <<table border="0" cellspacing="0" cellborder="1">             
            <tr>                                                       
                <td>Sudoku3DFactory</td>                               
            </tr>                                                      
            <tr>                                                       
                <td>attribute</td>                                              
            </tr>                                                      
            <tr>                                                       
                <td><u>+ staticfunction</u></td>  
            </tr>                                                      
            </table>>
        ]
    }
}

但仍然没有下划线。

您需要从 shape = record 更改为 shape = plain。在某些系统上,此形状不可用,例如在我的系统上,这有帮助:

digraph G {                                                                
    fontname = "Bitstream Vera Sans"                                       
    fontsize = 8                                                           

    node [                                                                 
        fontname = "Bitstream Vera Sans"                                   
        fontsize = 10                                                      
        shape = none width=0 height=0 margin=0   // this _is_ plain                               
    ]                                                                      

    edge [                                                                 
        fontname = "Bitstream Vera Sans"                                   
        fontsize = 10                                                      
    ]                                                                      

    subgraph packagemodel {                                                

        Class [
            label =
            <<table border="0" cellspacing="0" cellborder="1">             
            <tr>                                                       
                <td>Sudoku3DFactory</td>                               
            </tr>                                                      
            <tr>                                                       
                <td>attribute</td>                                              
            </tr>                                                      
            <tr>                                                       
                <td><u>+ staticfunction</u></td>  
            </tr>                                                      
            </table>>
        ]
    }
}

这会产生

包括下划线。