Is there a supported way to specify fall back fonts?

0 votes
asked Nov 29 in Question / help by roxspring (260 points)

Specifying a specific font name for use in diagrams works great:

DefaultFontName "Proxima Nova Cn CF"

PNG images use the correct font if available, SVG images reference the correct font and render correctly where the client has the correct font available. But our preferred font isn't available everywhere and we'd like to make use of CSS font fallback. We tried the following:

DefaultFontName "Proxima Nova Cn CF", "DejaVu Sans", "SansSerif", sans-serif

This is great and means that SVGs fall back to some more commonly available fonts, but this breaks the PNG export because presumably the render is looking for a single font with that long compound name.

Is there a better way of achieving the result I'm after?

If not then could we have PNG renderer support a fallback list of fonts in DefaultFontName?

Thanks,

Rob

1 Answer

0 votes
answered Dec 1 by plantuml (208,860 points)

It's not possible yet...

However, this is a nice suggestion so with last beta http://beta.plantuml.net/plantuml.jar , you can now have:

@startuml
skinparam DefaultFontName Proxima Nova Cn CF, DejaVu Sans, SansSerif, sans-serif
Alice -> Bob : hello
@enduml

In case you are interested, the patched code is here http://beta.plantuml.net/UFont.java

...