User Tools

Site Tools


svg_files

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
svg_files [2018/08/13 12:33]
arusso
svg_files [2021/12/14 14:13] (current)
arusso
Line 1: Line 1:
-===== SVG Files =====+**NOTE: This page has been replaced by https://authors.ietf.org/diagrams**
  
-Files are located in an RPC-managed space: https://www.rfc-editor.org/materials/format/svg/+===== SVG Samples and Notes from Experience =====
  
-Tools used to generate the SVG files:+The schema in use for SVG in RFCs is [[https://svn.ietf.org/svn/tools/xml2rfc/trunk/cli/xml2rfc/data/SVG-1.2-RFC.rnc|SVG-1.2-RFC.rnc]]. Please see the [[https://www.rfc-editor.org/materials/FAQ-xml2rfcv3.html#name-how-do-i-generate-svg-that-|FAQ]] for more information. 
 + 
 +====Examples==== 
 +  * [[https://www.rfc-editor.org/rfc/rfc9115.html#figure-1|RFC 9115]] (Figures 1, 11 - 14) 
 +  * [[https://www.rfc-editor.org/rfc/rfc9100.html#figure-1|RFC 9100]] (Figure 1) 
 +  * [[https://www.rfc-editor.org/rfc/rfc9043.html#figure-4|RFC 9043]] (Figures 4 - 17, 22, 23, 29, 30) 
 +  * [[https://www.rfc-editor.org/rfc/rfc8899.html#figure-1|RFC 8899]] (Figures 1 - 5) 
 +  * [[https://www.rfc-editor.org/rfc/rfc8989.html#figure-1|RFC 8989]] (Figures 1 - 4)   
 +  * Additional samples are here: https://www.rfc-editor.org/materials/format/svg/ 
 + 
 +====Tools that can be used to generate an SVG file==== 
 +  * [[https://wiki.gnome.org/Apps/Dia|Dia]] -- Recommended so that text strings within the diagram are searchable and selectable. 
 +  * [[https://github.com/blampe/goat|GoAT: Go ASCII Tool]] 
 +    * Note: There's an issue with text strings within the diagram not being searchable or selectable.  
 +    * Here's [[https://mailarchive.ietf.org/arch/msg/rfc-interest/4wlkqfxZIFFPnvhHsmVwxthv_fE/2/|tune-goat-output.xslt]], a script from Julian Reschke for post-processing the SVG to mitigate the issue.
   * [[https://www.lucidchart.com/|LucidChart]]   * [[https://www.lucidchart.com/|LucidChart]]
   * [[https://www.omnigroup.com/omnigraffle|OmniGraffle]]   * [[https://www.omnigroup.com/omnigraffle|OmniGraffle]]
   * [[https://www.graphviz.org/|Graphviz]]   * [[https://www.graphviz.org/|Graphviz]]
   * [[https://boxy-svg.com/|Boxy SVG Editor]]   * [[https://boxy-svg.com/|Boxy SVG Editor]]
-  * [[https://inkscape.org/en/|Inkscape]]+  * [[https://inkscape.org/en/|Inkscape]] (and there's a PowerPoint -> Inkscape workflow detailed below)
  
 ==== Creating SVG diagrams: Some notes from experience ==== ==== Creating SVG diagrams: Some notes from experience ====
-=== from Nevil Brownlee, 18 July 2018 === 
  
-The version of SVG that will be allowed in RFCs is described in [[https://www.rfc-editor.org/info/rfc7996|RFC 7996]], "SVG Drawings for RFCs: SVG 1.2 RFC" Its formal syntax will be updated in 7996-bis (see [[https://github.com/rfc-format/draft-iab-svg-rfc-bis|the GitHub repository]]). +=== from Nevil Brownlee (July 2018) === 
 + 
 +The version of SVG that will be allowed in RFCs is described in [[https://www.rfc-editor.org/info/rfc7996|RFC 7996]], "SVG Drawings for RFCs: SVG 1.2 RFC". Its formal syntax will be updated in 7996-bis (see [[https://github.com/rfc-format/draft-iab-svg-rfc-bis|the GitHub repository]]).  
  
 As one of the tools for using SVG 1.2 RFC, we have produced [[https://pypi.org/project/svgcheck/|svgcheck]], a Python program that will read SVG files, check whether they conform to SVG 1.2 RFC, and delete from them anything that doesn't conform. When you've made an SVG diagram, you should run it through svgcheck, and take a careful look at the resulting new SVG diagram to see that no features that you need have been deleted. As one of the tools for using SVG 1.2 RFC, we have produced [[https://pypi.org/project/svgcheck/|svgcheck]], a Python program that will read SVG files, check whether they conform to SVG 1.2 RFC, and delete from them anything that doesn't conform. When you've made an SVG diagram, you should run it through svgcheck, and take a careful look at the resulting new SVG diagram to see that no features that you need have been deleted.
Line 47: Line 62:
  
 If you're familiar with Adobe Illustrator, it can also be used.  It can save files as SVG-t (i.e. SVG Tiny), which - I assume - means that drawings saved in SVG-t don't use arrowheads. If you're familiar with Adobe Illustrator, it can also be used.  It can save files as SVG-t (i.e. SVG Tiny), which - I assume - means that drawings saved in SVG-t don't use arrowheads.
 +
 +-------
 + 
 +=== from Don Fedyk (April 2021) ===
 +
 +If you have black and white diagrams in PowerPoint these can be copied and pasted into Inkscape. You can resize and position on Inkscape's default page or you can create a drawing size and adjust. Then you can save as a plain svg. PowerPoint can save natively into SVG as well but that SVG is very detailed.
 +
 +The plain SVG will have:
 +<code>
 +  width="210mm"
 +  height="279mm"
 +  viewBox="0 0 210 279" 
 +</code>
 +
 +(or whatever your starting size was)
 + 
 +It is easier to make Inkscape drawing size close to the dimensions you want before saving. For a 1/2 page drawing a full page may be used and the height can be adjusted, but sometimes the conversion will complain and the height/width have to be removed. See positioning tips.)  
 +
 +Editing the basic svg:
 +
 +You will need to remove clipPath and metadata (it will probably look something like this):
 +<code>
 + <defs
 +    id="defs2">
 +   <clipPath
 +      id="clip0">
 +     <rect
 +        x="52"
 +        y="349"
 +        width="2159"
 +        height="889"
 +        id="rect10" />
 +   </clipPath>
 + </defs>
 + <metadata
 +    id="metadata5">
 +   <rdf:RDF>
 +     <cc:Work
 +        rdf:about="">
 +       <dc:format>image/svg+xml</dc:format>
 +       <dc:type
 +          rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
 +       <dc:title></dc:title>
 +     </cc:Work>
 +   </rdf:RDF>
 + </metadata>  
 +</code>
 +
 +The basic svg  has some identifiers that must be removed:
 +<code>
 +font-weight
 +font-family
 +style="stroke-width:0.0911541"<...
 +</code>
 +
 +The font-related ones can usually be deleted by deleting the whole line. The style one is part of a tspan tag and you must only remove the text. These VIM command line commands do it properly:
 +
 +<code>
 +:1,$s/style="stroke.*"// 
 +:g/font-weight/  
 +:g/font-family/d
 +</code>
 +
 +At this point you can test the SVG either by including and running it in xml2rfc or using the SVG tester but xml2rfc catches more issues so I skip the tester. Rendering:\\ 
 +''xml2rfc --pdf your_v3_xml_draft.xml''
 +
 +Another issue is with <tspans>. It seems text is expanded to text and tspan tags. 
 +Sometimes the physical text is between ''<text>like this</text>''\\ 
 +and sometimes it is between ''<text><tspan>like</tspan><tspan>this</tspan></text>''\\ which is fine but with hyphenated text there are two issues. 
 +It might put the text between the tspan and text tags:\\ 
 +''<text><tspan>fouled</tspan>-</tspan>up</text>''\\
 +And you need to correct it by either moving the text or deleting the tags. 
 +The xml2rfc --pdf will complain about this. Simply moving the text inside the tspan tags works.\\ 
 +''<text><tspan>fouled</tspan>-up</tspan></text>''\\
 +Usually there are coordinates within the text and tspan tags - you want to keep those. Another issue is the coordinates of the text can cause the characters to overwrite in different tspans.\\ 
 +''<text><tspan>fouled-up</tspan></text> will print better than <text><tspan>fouled</tspan>-up</tspan></text>.''
 +
 +Positioning: 
 +The ViewBox has x-min y-min
 +<code>
 +x="0" y="0" width="100%" height="100%"/
 +</code>
 +
 +For a half page drawing from the original: 
 +<code>
 +  width="210mm"
 +  height="279mm"
 +  viewBox="0 0 210 279" 
 +           x y  w%   h%
 +</code>
 +
 +The height controls the whitespace; if your drawing is 1/2 page you can usually reduce by 1/2 and it will only take 1/2 a page. Inch-based dimensions were harder to work with, and width and height had to be removed, but with mm dimensions  the height could be reduced more before it complained. The x y controls move the origin; positive values for y move the origin down and the drawing upwards.
 +
 +Adjusted for 1/2 page it might look like this: 
 +
 +<code>
 +  width="210mm"
 +  height="110mm"
 +  viewBox="0 15 210 110"  
 +</code>
 +
 +Note that the x dimension is unchanged; also, in my experience, the scaling is far from linear. A slightly large diagram needed these values but the difference from 50 to 30 on the veiwBox height was hardly noticeable. 
 +
 +<code>
 +  width="210mm"
 +  height="135mm"
 +  viewBox="0 52 210 30"
 +</code>
 +
 +The scaling is constant whether the drawing is at the top or following other drawings. Two pictures easily fit with captions on a page using this.  
svg_files.1534188820.txt.gz · Last modified: 2018/08/13 12:33 by arusso