User talk:Moyogo/SVG Maps

From Wikimedia Commons, the free media repository
Jump to navigation Jump to search

some comments about your code

[edit]

I saw your edit on File:Europe.svg#filehistory.

1) I would recommend svgcleaner, or scour, or svgo, or the grafical interface: [1] for

  • Stripping ns2: and ns1: tags
  • Removing CDATA
  • Rounding according to specified accuracy (svgcleaner has four precision-parameters, sour has two precision-parameters, svo (and svgoMG) have one general one precision-parameter)

2) s/<\/tspan><tspan.*?>//gsx might be dangerous (f.e. <text>Na<tspan style="font-size:65%; baseline-shift:sub">2</tspan><tspan style="font-size:65%; baseline-shift:sup">+</tspan></text>), but I don't have a better solution

3) cat South_america_fr.svg |perl -pe 's(Tiepolo-BookItalic)/DejaVu Sans Oblique/g; s/(Benguiat-Book|Sanvito-Roman|Tiepolo-Book)/DejaVu Sans/g; s/Helvetica-BoldOblique/DejaVu Serif BoldOblique/g; s/Helvetica-Oblique/DejaVu Serif Oblique/g; s/Tiepolo-BoldItalic/DejaVu Sans Bold Oblique/g; s/(Tiepolo-Black|Tiepolo-Bold)/DejaVu Sans Bold/g; s/Helvetica/DejaVu Serif/g; s/font-size:([0-9]*)\.[0-9]*px/font-size:\1px/g' > South_america_fr_fonts.svg

3a) I think replacing to 'DejaVu Sans Oblique' or 'DejaVu Serif BoldOblique' might be quite useless due to a bug of the renderer see: Phab:T25643 (still marked as open)

3b) Replacing with DejaVu Sans will lead to problem, because it is one of the longest fonts, see File:MediaWiki_SVG_font_list_sans.svg (`DejaVu Sans` and needs much more space than Helvetica, that will lead to problems, f.e. in files like File:UK_map.svg)

3bI) Font-substitution of Helvetica should be one of the following options:

  • Khmer OS; Khmer OS Battambang; Khmer OS Bokor; Khmer OS Content; Khmer OS Fasthan; Khmer OS Freehand; Khmer OS Metal Chrieng; Khmer OS Muol; Khmer OS System
  • Garuda
  • Loma
  • Nimbus Sans L

please see:

3bII) I would substitute it with different fonts (they look more similar, links of source can be found at the end of each line, compare it with File:MediaWiki_SVG_font_list.svg,ordered alphabetically)

sed -i 's/ font-family=\"Helvetica\"/ font-family=\"Garuda\"/g' $i #looks similar https://commons.wikimedia.org/wiki/File_talk:Meta_SVG_fonts.svg
sed -ri 's/ font-family=\"(Benguiat|BenguiatStd-Book|Benguiat-Book)\"/ font-family=\"Tibetan Machine Uni,Garuda,Liberation Sans,Liberation Serif\"/g' $i #looks similar # http://www.fontpalace.com/font-details/Benguiat+Bold/
sed -ri 's/ font-family=\"(Sanvito|Sanvito-Roman|SanvitoPro-Regular)\"/ font-family=\"Purisa,Garuda,Liberation Sans,Liberation Serif\"/g' $i #looks similar # https://www.myfonts.com/fonts/adobe/sanvito/
sed -ri 's/ font-family=\"(Tiepolo|TiepoloStd-Book|Tiepolo-Black|Tiepolo-Book)\"/ font-family=\"Norasi,Garuda,Liberation Sans,Liberation Serif\"/g' $i #looks similar # https://www.myfonts.com/fonts/itc/tiepolo/

My substitution-List can be found here: https://github.com/JoKalliauer/cleanupSVG/blob/master/fontReplace.sh

4) cat INPUTFILE.svg| perl -pe 's/font-size:([0-9]*)\.[0-9]*px/font-size:\1px/g' > OUTPUTFILE.svg that would round 11.9999 to 11, that's not proper rounding, processing the file in f.e.Inkscape might lead to 10.9999, then running it again would rounds again down to 10 (but it should be 12), I would recommend solutions proposed in 1)

5) change fonts from uncommon ones to common ones like Bitstream or DejaVu ;-)
Helevicia is much more common than those two, and Bitstream is not installed on Commons any more, the list of fonts can be found on meta:SVG_fonts (the up-to-date informaitons can be found on https://noc.wikimedia.org/conf/fc-list

6)CDATA does not disturb anyone, but W3C-errors might lead to wrong proessing/rendering, therefore it would be great if a file get overwritten, that is corrected to a valid file (or more precise to those errors which are kept on purpose)


I just wanted to share my experience with you, I will also profit from your expertise. (Maybe you find 20% which are useful for you, and forget the rest.)

JoKalliauer (talk) 18:06, 20 May 2018 (UTC)[reply]