Skip to content

Conversation

@kirchsth
Copy link
Member

@kirchsth kirchsth commented Mar 6, 2022

Implementation of #186

LAYOUT_AS_SKETCH() styles and the footer text can be changed with SET_SKETCH_STYLE():

  • SET_SKETCH_STYLE(?bgColor, ?fontColor, ?warningColor, ?fontName, ?footerWarning, ?footerText):
    Enables the modification of differnt sketch styles and footer.

The possible font name(s) depend on the output format (e.g. PNG uses fonts which are installed on the server and SVG fonts have to be installed on the client).
Additional is it possible to define comma separated fall back fonts (if the diagrams are exported as SVG. Atm
PNG does not support fallback fonts based on a PlantUML bug, but this could be fixed in one of the following versions)

@startuml LAYOUT_AS_SKETCH Sample
!include https://raw.githubusercontent.com/kirchsth/C4-PlantUML/extended/C4_Container.puml

SET_SKETCH_STYLE($bgColor="lightblue", $fontColor="darkblue", $warningColor="darkred", $footerWarning="Sketch", $footerText="Created for discussion")

' PNG with font jlm_cmmi10 (typically another font is used)
' SET_SKETCH_STYLE($fontName="jlm_cmmi10")

' SVG with fallback fonts MS Gothic,Comic Sans MS, Comic Sans, Chalkboard SE, Comic Neue, cursive, sans-serif (typically without "MS Gothic")
SET_SKETCH_STYLE($fontName="MS Gothic,Comic Sans MS,Comic Sans,Chalkboard SE,Comic Neue,cursive,sans-serif")

LAYOUT_AS_SKETCH()

Person(admin, "Administrator")
System_Boundary(c1, 'Sample') {
    Container(web_app, "Web Application", "C#, ASP.NET Core 2.1 MVC", "Allows users to compare multiple Twitter timelines")
}
System(twitter, "Twitter")

Rel(admin, web_app, "Uses", "HTTPS")
Rel(web_app, twitter, "Gets tweets from", "HTTPS")
@enduml

PNG with font jlm_cmmi10

LAYOUT_AS_SKETCH with custom style png Sample

SVG with fallback fonts MS Gothic,Comic Sans MS,Comic Sans,Chalkboard SE,Comic Neue,cursive,sans-serif

LAYOUT_AS_SKETCH with custom style svg Sample

It can be tested with my extended branch

BR Helmut

PS.: PlantUml version 2022.2.beta## has a bug that already defined skinparams cannot be changed anymore. This is fixed in the (yesterday) released 2022.2. With this and (also older) relesed versions the color of the arrows/boundaries/text is changed via the $fontColore too

@kirchsth kirchsth requested a review from Potherca March 6, 2022 13:06
@kirchsth kirchsth added this to the v2.5.0 milestone Mar 6, 2022
@kirchsth kirchsth linked an issue Mar 6, 2022 that may be closed by this pull request
@kirchsth kirchsth merged commit 06118d9 into plantuml-stdlib:master Mar 6, 2022
@kirchsth kirchsth deleted the feature/186_set_sketch_style branch March 6, 2022 16:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Provide fallback font cascade for sketch style

2 participants