I've seen pieces of this around the forum, but thought a reproducible summary might be helpful. Text with (an svg) font size specified in px units does show up at the right size (or at all) using export ¦ as Image ¦ SVG. It appears that the export software does not understand the units, and ends up exporting with a font-size of "0". Simply removing the units from the font-size in the style attribute works around the problem, but a more general solution would be to fix the export logic. Fritzing itself handles the text correctly in the views.
Fedora 24
x86_64
Version 0.9.2 (b8d2d5970658f0bed09c661c9
Have not upgraded to 0.9.3, since trying to stay with what is provided in the Fedora repos.
grep -c -E "font-size:[0-9]+?(\.[0-9]*)?px" /usr/share/fritzing/parts/svg/core/*/*.svg | grep ":[1-9]" | wc
107 files found, although the icon files probably do not matter. They are never exported.
grep -c -E "font-size:[0-9]+?(\.[0-9]*)?[a-z]" /usr/share/fritzing/parts/svg/core/*/*.svg | grep ":[1-9]" | wc
108 files found, although the icon files probably don´t matter. They are never exported.
Simple (hopefully) reproducible example. In an empty sketch:
- find and place a TLP621
- Fit the breadboard view to the window
- File ¦ Export ¦ as Image ¦ SVG ¦ test_bb.svg
Outside of Fritzing, view the original and exported image files - …/fritzing/parts/svg/core/breadboard/Optocoupler_TLP621_breadboard.svg
- test_bb.svg
The "TLP" and "621" text is visible in the original, but not in the export.
Use a text editor to look at the 2 files. - In Optocoupler_TLP621_breadboard.svg, the text elements for TLP and 621 are wrapped in groups with style attributes. Both start with "font-size:4.44444418px".
In test_bb.svg, the matching text elements are also wrapped inside group elements, but now the style does not have a font-size entry, and there is new font-size attribute set to "0". Changing that "0" to either "4.44444418px" or "4.44444418" gets the text to show up, although the size is wrong.
Exit everything without saving.
- Change font-size:4.44444418px to font-size:4.44444418 in Optocoupler_TLP621_breadboard.svg.
- Repeat the find, place, fit, export, view.
- The text is visible in both the original and export.
- Viewing the export file in a text editor shows that the font-size has still been removed from the style attribute, but now the font-size attribute is set to "3.2".
As a guess, the parsing code for the svg export is attempting to convert the whole "4.44444418px" string to a number, which fails and gives 0. It is not expecting or looking for units.