-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Provide fallback font cascade for sketch style #186
Comments
Good point! We'll need to decide on the exact order of the font stack, but in the past, I've seen this being used for Comic-style fonts:
|
Hi, @startuml
listfont aeiou
@enduml Found fonts see below. @languitar: which font was your solution? @Potherca: I cannot see a set of useful fonts. Which fonts should be used? Additional I think this font selection is not working at all. I entered a plantuml forum entry. I see only one solution; we use a pattern like @startuml
''''''''''''''''' select custom font before C4.puml is loaded
!$FONT_NAME_SKETCH = "Courier"
''''''''''''''''' include (with missing extension)
!include https://raw.githubusercontent.com/kirchsth/C4-PlantUML/extended/C4_Container.puml
' missing extension which has to be added to C4.puml
!ifndef $FONT_NAME_SKETCH
!$FONT_NAME_SKETCH = "Comic Sans MS"
!endif
!procedure LAYOUT_AS_SKETCH()
skinparam backgroundColor #EEEBDC
skinparam handwritten true
skinparam defaultFontName $FONT_NAME_SKETCH
center footer <font color=red>Warning:</font> Created for discussion, needs to be validated
!endprocedure
''''''''''''''''' diagram itself
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 BR Helmut |
I think the main use-case for this would not be standard plantuml server but a local or custom setup. Besides starting with a I think exposing the font as a variable is a good idea, which we can combine with setting a more extensive font stack. |
You are right, local I have >100 fonts. |
I'm inclined to move forward with the suggested changes regardless of the font-stack issue in PlantUML, as that will most likely be resolved eventually. Playing around with the stack might even lead to the discovery of the root cause of things n ot working? |
Hi @languitar, @Potherca I try to support configurable sketch styles (incl. fonts) with a new call
But I found following problems: Best regards the complete sample @startuml
!include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4_Container.puml
!global $SKETCH_BG_COLOR = "#EEEBDC"
!global $SKETCH_FONT_COLOR = ""
!global $SKETCH_WARNING_COLOR = "red"
!global $SKETCH_FONT_NAME = "Comic Sans MS"
!global $SKETCH_FOOTER_WARNING = "Warning:"
!global $SKETCH_FOOTER_TEXT = "Created for discussion, needs to be validated"
!unquoted procedure SET_SKETCH_STYLE($bgColor="_dont_change_", $fontColor="_dont_change_", $warningColor="_dont_change_", $fontName="_dont_change_", $footerWarning="_dont_change_", $footerText="_dont_change_")
!if $bgColor != "_dont_change_"
!global $SKETCH_BG_COLOR = $bgColor
!endif
!if $fontColor != "_dont_change_"
!global $SKETCH_FONT_COLOR = $fontColor
!endif
!if $warningColor != "_dont_change_"
!global $SKETCH_WARNING_COLOR = $warningColor
!endif
!if $fontName != "_dont_change_"
!global $SKETCH_FONT_NAME = $fontName
!endif
!if $footerWarning != "_dont_change_"
!global $SKETCH_FOOTER_WARNING = $footerWarning
!endif
!if $footerText != "_dont_change_"
!global $SKETCH_FOOTER_TEXT = $footerText
!endif
!endprocedure
!procedure LAYOUT_AS_SKETCH()
skinparam handwritten true
!if $SKETCH_BG_COLOR > ""
skinparam backgroundColor $SKETCH_BG_COLOR
!endif
!if $SKETCH_FONT_COLOR > ""
skinparam defaultFontColor $SKETCH_FONT_COLOR
!endif
!if $SKETCH_FONT_NAMES > ""
skinparam defaultFontName $SKETCH_FONT_NAME
!endif
!if $SKETCH_FOOTER_WARNING > "" || $SKETCH_FOOTER_TEXT > ""
!$line = "footer <font color=" + $SKETCH_WARNING_COLOR + ">"+ $SKETCH_FOOTER_WARNING + "</font> " + $SKETCH_FOOTER_TEXT
$line
!endif
!endprocedure
' SET_SKETCH_STYLE($bgColor="lightblue", $fontColor="gray", $warningColor="white", $fontName="A not existing, cursive, Comic Neue, Comic Sans MS, Comic Sans, Chalkboard SE, Comic Neue, cursive, sans-serif", $footerWarning = "Sketch", $footerText = "Created for discussion")
SET_SKETCH_STYLE($bgColor="lightblue", $warningColor="darkred", $footerWarning="Sketch", $footerText="Created for discussion")
' Open problem: DefaultFontColor changes ALL font colors (not only the undefined) removed $fontColor="gray"
' (I hope I get a fix for it)
' SET_SKETCH_STYLE($fontColor="gray")
' Open problem: (multiple) fonts not working, the correct one has to be known and png(?) output is required
' png: font found on server side (svg: a different font found on client side)
SET_SKETCH_STYLE($fontName="jlm_cmmi10")
' png font on server side
' SET_SKETCH_STYLE($fontName="VL Gothic")
' both are not working at all
' SET_SKETCH_STYLE($fontName="Not existing, jlm_cmmi10, VL Gothic, 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 |
Problem a) changed font color changes all font colors (is a new bug in PlantUML, I expect a fast bugfix) Updated: fixed in PlantUML |
Problem c) it could be that we get a bugfix |
@languitar, @Potherca: A first version can be tested via my extended branch What do you mean? @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 SVG with fallback fonts MS Gothic,Comic Sans MS,Comic Sans,Chalkboard SE,Comic Neue,cursive,sans-serif |
…CH_STYLE() (2 - border and arrow color changed too)
…CH_STYLE() (3 - cleanup)
…CH_STYLE() (4 - build)
#186 LAYOUT_AS_SKETCH() styles can be set via SET_SKETCH_STYLE()
The current skinparam for the sketch style uses Comic Sans as the only font. This font is proprietary and might not exist on some systems. Moreover, it lacks a few important characters. With font fallback support now available in plantuml (https://forum.plantuml.net/10498/is-there-a-supported-way-to-specify-fall-back-fonts), it would be nice if there was a larger cascade of appropriate fonts.
The text was updated successfully, but these errors were encountered: