How can I add a font to be used for a sequence diagram?

+1 vote
asked Jun 11, 2013 in To be sorted by AndrewGHo (200 points)

I am using PlantUML to generate sequence diagrams from text. I would like to know how to add fonts that would be available to reference via skinparam or similar statements. I have searched Google and the PlantUML Sourceforge site and didn't see any obvious answers.

I followed the directions at http://plantuml.sourceforge.net/font.html to see what fonts were currently available, and the set is currently quite small:

Output of listfonts command

I am running on a headless CentOS server, using the .jar file that I downloaded from the website, identified with "java -jar plantuml.jar -version" as: PlantUML version 7969 (Fri Jun 07 21:12:18 UTC 2013)

Ideally there is some directory of TTF or other-format fonts that I could put in the right place, or point PlantUML at, and then reference those fonts from skinparam or similar parameters. Note that I'm only interested in sequence diagrams, so I believe Graphviz and Dot are not involved in this case.

1 Answer

+1 vote
answered Jun 14, 2013 by plantuml (295,800 points)
 
Best answer

Hello,

About fonts, PlantUML lists fonts that are available on your machine, or to be more precise, on your JVM.
So you should search about font install with Java and CentOS.

Here is some pointer that may help you:

http://docs.oracle.com/javase/6/docs/technotes/guides/intl/fontconfig.html
http://www.inductiveautomation.com/forum/viewtopic.php?f=64&t=4295
https://wiki.archlinux.org/index.php/Java_Runtime_Environment_Fonts
http://corfield.org/blog/post.cfm/Installing_Fonts_on_Linux

Once you will have installed your font in your JVM, they will be automagically listed by:
@startuml
listfonts
@enduml


To achieve this, PlantUML uses the result of the following Java API call: GraphicsEnvironment.getLocalGraphicsEnvironment().getAvailableFontFamilyNames()

I don't think that we need to implement a specific mechanism in PlantUML.

Does it help ?

 

commented Jun 17, 2013 by AndrewGHo (200 points)
That is very helpful information, thank you!
...