Search code examples
htmlmargingraphviznon-ascii-characters

Why do texts with non-ASCII characters have right padding?


If you look at the image below, you will see that if the text has non-ASCII characters it is pushed away from the right margin, and if it has emoji it is pushed closer to the margin. Do you know why is that?

enter image description here

Here is the code

graph {
    node [shape=plain]

A [label=<
<table border="0" cellborder="1" cellspacing="0">
  <tr><td>Text with ASCII characters only</td></tr>
</table>>];

B [label=<
<table border="0" cellborder="1" cellspacing="0">
  <tr><td>Text with non-ASCII charắcters</td></tr>
</table>>];

C [label=<
<table border="0" cellborder="1" cellspacing="0">
  <tr><td>Text with emoji 😂 very funny hahahahaha</td></tr>
</table>>];
}

Solution

  • OP's thread on Graphviz repo guided me in the right direction. This is what I've done to fix the problem:

    • Install expat library (sudo apt install libexpat1-dev)

    • Install pangocairo library (sudo apt install libpango1.0-dev)

    • Compile and install graphviz from source (https://graphviz.org/download/source/):

      ./configure --with-pangocairo
      make
      sudo make install
      

    Now everything works as expected (non-ASCII characters are in the right place), plus pdf output is now available!