You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Please make the diagrams with open source tools #1158
I can at least confirm they each imported and rendered, but I didn't do much beyond that. Only issue I saw was that it tries to use the Menlo-Regular and Menlo-Bold fonts, which seem to be Mac-only.
That could be a huge reason.
Think about changing the color of following symble:
Factorization of common attributes is perfectly doable in SVG. But, there are great chances that the extracted SVGs would be "flattened" (i.e. every element embeds all its attributes) and we would loose the ability to change the styling.
@YueLinHo could you provide the output svg so that we can check its structure?
@YueLinHo
As you wrote correctly, the font used is licensed from Apple and not generally available. The font you suggested, "Bitstream Vera Sans Mono," is not suitable for normal typesetting. It is not a proportional font but a monospaced font, which is better suited for texts that should represent a code text. In continuous text, the typeface appears broken because the letter spacing is not harmonious. (See https://www.fontsquirrel.com/fonts/bitstream-vera-sans-mono).
@jnavila
As I don't have a Mac available at the moment, I have to open the progit.sketch file with Lunacy (v4.0.3). Assuming it is displayed correctly, I, as a graphic designer, immediately notice some "don'ts", which considerably reduce the display quality of the images.
On the browser page and in the PDF file, the images appear to me rather blurred. I don't understand how this can happen with a vector drawing program like Sketch. Apparently a serious error may have occurred in the workflow.
The initiator of the issue has suggested to use open source software to create the images. From my point of view Inkscape (https://inkscape.org/) would be suitable for this task, it is available for OSX, Windows and Linux. It is also vector-based and you can create your own symbol library, so that a unified design of the images is possible. A small "HowTo" should be enough to explain the workflow to the various authors.
If you like, I can create a new branch in my fork and give some examples for discussion.
@max123kl the files included in both media are png (the way they were extracted from Sketch), and they were heavily compressed.
Keeping the format in vector shapes would provide better as long as it is suitable for web pages and PDF. SVG is such format.
Inkscape manipulates SVG files, so this would be great. The problem is that up to now, the exports from Sketch were very lousy. Please go ahead with some sample, and if it can be integrated, you could even better provide a full conversion of the images. 👍
It does not make sense to reconstruct existing images by duplicating the work. In addition, the check for content errors must be carried out again afterwards.
I suggest that we first analyze where the error hides in the workflow and then focus on eliminating it.
As I said I don't have a Mac and the Sketch tool as well, so at the moment I can only refer to the output of the Windows Lunacy tool. Therefore I can only refer to the output of the Windows Lunacy program at the moment. In other words, I'm pretty sure – what I see here isn't what Sketch produces.
In Sketch's online manual, the section "File Formats" (https://www.sketch.com/docs/exporting/file-formats/) explains that data export to PNG, but also to SVG and EPS is possible. It would be very helpful if you could save two images ("local" and "branch-and-history") and the symbol part in SVG and EPS formats respectively. I especially hope for a lot from the EPS format, as it is universally used in professional image processing.
You can send the files to my e-mail address or place them in the "diagram-source" folder.
Regardless of what I said before, I immediately noticed when looking at the progit.sketch file that the constructed diagrams on the individual pages are no longer in vector format, but in bitmap format. Images in vector format can be enlarged losslessly, the quality of the bitmap format decreases, which is particularly noticeable in typefaces.
The images of the *.PNG files in the ./Images folder are almost all 800 px wide. The same figure (local.png) in the progit.sketch file has only 335 px, so it has to be enlarged more than twice. This leads to a significant blur. In addition, they were extremely compressed and also indexed (the color space of the images was reduced from 24 bit to 256 colors). Subsequent sharpening is no longer possible.
Vector files can usually be edited afterwards without loss of quality, which also means that the effort to improve the images would be considerably less, if the data were available in vector format without indexing.
Another question about the symbols and the symbol library in the Sketch file:
Should it also be possible to edit the text within the symbol in the future? At the moment I can't do that - but it can also be a faulty Lunacy output.
@jnavila
I have reconstructed some symbols with Inkscape.
I have saved the work in four different file variants (https://github.com/max123kl/progit2-de/tree/Figures/diagram-source)
The file test_oneA.svg and test_oneB.svg contains the graphics in original size, whereas ...A.svg was saved as normal SVG and ...B.svg as "optimized SVG" (reduced color gamut). The files test_oneAx2.svg and test_oneBx2.svg contain the graphics in approx. 2.6x magnification. The size of the ...Bx2 file is larger than that of the ...Ax2 file. I have to check this again. But if the result should be confirmed I see no reason to reduce the color gamut to get a smaller memory size.
What can be clearly seen is that the image quality did not suffer due to the magnification.
You see two columns, on the left side I have stayed as close as possible to the original. In the right column I made some small changes. So I lightened or darkened the text a bit to increase the contrast, which improves the readability. In the first row I placed two small color fields behind the graphics in the middle to simulate the background color on the website and the Sketch program.
At the right graphic I made the filling color a bit darker to increase the contrast.
OK, I've finally been able to load up the source file in the Sketch editor – I had tried a while ago, and it kept crashing on me. Here's what I understand as the desired outcome:
Change the diagram font. I'm thinking Roboto Mono here, but I'm open to suggestions. Would something else be better for ebook download sizes?
Export the diagrams as SVG, and use those in the build path for ebooks.
Keep some kind of method for updating diagram styles en masse. Sketch provides this, but is there a way to export so that "symbols" are usable in something like Inkscape?
I'm interested in the SVG export. If it's flattened, then it's not really useful for future changes, but if they export a structured file (with styles and reused groups) it could be used as our primary source for images.
Note the stroke="#979797" stroke-width="1" properties. I think if those are removed you won't see the outlining you (rightly) disapprove of. Here's a snippet from your linked SVG:
OK, I see, you were talking about the inside code, and I was just looking at the visible image.
For me it is very difficult to analyze code in that way because I actually trust the design app.
I'm not very familiar with analyzing XML code. What I know is that different design programs can generate very different code for the same type of artwork. For example, Inkscape can create 3 different uncompressed and 2 compressed SVG files (see the "save as" dialog in the pull down menu).
The code Sketch writes is similar to the code Inkscape calls "optimized SVG". If you choose this save format, the second step is an additional settings dialog, where you can choose more options. This leads to a different code in each file. I put some files (along with a Readme) in my Figures branch /diagram-source/test for comparison.
I do not believe in filtering the XML-SVG code, unless an absolute specialist who knows both the XML code and the code generator of Sketch/Inkscape does. However, there might be unwanted side effects.
As far as I can see, the 'stroke' attribute is responsible for the outline of an object. For vector based drawings everything is defined by outlines and fills. I imagine it will be extremely difficult to remove or change some strokes through a filter.
Your export is quite interesting, because we can see that the letters are in fact mostly made up of the stroke part ; if I zoom on new 5_A.svg :
The fill part is black and is only appearing at the internal limit of all strokes. If in Inkscape, I remove the stroke, here's what's left:
Whereas when the fill matches the stroke:
@max123kl , contrary to your belief, mechanizing the filtering of XML-SVG is really not a big deal ( the experiments above are easily doable by script). The relevant question is what kind of transformation we want to apply.
@jnavila
Please show me the code (if not from my new 5_A.svg file) of the lowest example (it's not a good idea if "f" and "3" are in touch). I suspect that the outline width stroke-width there has the wrong value.
My new 5_A.svg test file, where I did no editing, is (# at the end of the lines = my comment):
id="master"
stroke="#979797" # is color gray
stroke-width="1" # value has to be analysed
font-family="RobotoMono-Regular, Roboto Mono"
font-size="12"
font-weight="normal" # should be set to "bold"
fill="#000000"> # is color black should be set to "#979797"
<tspan
x="24.9941406"
y="21"
id="tspan900">f30ab</tspan>
</text>
It is very important that stroke="#979797" (means a certain gray) and fill="#000000" (means black) have to have the same value i.e. color here.
That's what I was trying to explain in the picture.
Ben has agreed to switch from "Roboto Mono" to "Source Code Pro". So I uploaded the file new 5_A_f30ab.svg. The only change I made was in field "f30ab", so I could analyze it better. Here's the corresponding code section:
@max123kl Sorry, I hadn't followed your previous conversation about the fonts issue. The later example is only with fill at #979797 so the stroke-width is still 1.
So, to be clear, I should take the exports that @ben did and apply the styling you just advised, right?
If so, I'll do it tonight at home and will push on a dedicated branch for inspection.
It's worth a try.
If it really worked that would save a lot of effort right now.
As I already wrote here, I would like to create a symbol library for Inkscape, and develop a mini HOWTO for it, so that even for less experienced users the switch to Inkscape becomes easier.
For this I need the previous Sketch symbols as SVG file(s) so that I don't have to rebuild everything.
I now believe that you would be able to do this with a filter, but especially with OTF fonts there are so many adjustment screws you can use to optimize the look. It would be impossible for me to say now: use the value x or y or something in between for attribute ABC
Edit:
I forgot to mention:
if the value of the text-align attribute is changed to center, the text block moves to the left (if it was previously set to left).
then the TextBlock and the surrounding rectangle must be centered against each other again.
Each font has its own specific tracking. When changing the font, it is also necessary to re-center it, as in point 2.
I downloaded the symbols.svg file. It is fully editable.
Currently, I'm working on the symbols with the new font to pack them into a library.
I was looking for English tutorials that I could use for the promised Mini HowTo and spotted a small tool to optimize the SVG code. Personally, I'm not that experienced in coding, but maybe it's useful to you. https://github.com/jakearchibald/svgomg
Follow the two links at the beginning of README.md
I just pushed the filtered SVGs to the branch filtered_svg.
It's not so bad, have a look, please.
At first glance, some files have been upset (where the texts have been caught by the rewrite rules for centering text in false positive):
Activity
jnavila commentedon Jan 13, 2019
We know this. If you happen to know somebody who has this application and can export the pictures to SVG for instance, please proceed.
bripmccann commentedon Feb 28, 2019
Searched and found some free alternatives (gratis, unfortunately not open source) which can open Sketch files and export SVGs:
Figma (Windows, macOS, web)
Lunacy (Windows)
Photopea (web)
I can at least confirm they each imported and rendered, but I didn't do much beyond that. Only issue I saw was that it tries to use the Menlo-Regular and Menlo-Bold fonts, which seem to be Mac-only.
YueLinHo commentedon Mar 13, 2019
I tried Figma and Lunacy. They does not fully support Sketch file. For example:


After using Lunacy, I realized the reason why using Sketch file is there are some components are common in use, I mean the Symbols feature .

That could be a huge reason.
=> 

Think about changing the color of following symble:
and figure changes:
And all figures using it will be able to benefit from it.
So, I am not sure it is good to use SVG?
True. And I replace the font with Bitstream Vera Sans Mono. (cf. #605 (comment))
YueLinHo commentedon Mar 13, 2019
Note: Lunacy 3.14
lazarljubenovic commentedon Mar 13, 2019
jnavila commentedon Mar 13, 2019
Factorization of common attributes is perfectly doable in SVG. But, there are great chances that the extracted SVGs would be "flattened" (i.e. every element embeds all its attributes) and we would loose the ability to change the styling.
@YueLinHo could you provide the output svg so that we can check its structure?
YueLinHo commentedon Mar 16, 2019
Nice! ^__^
OK. Will try it later. :-)
max123kl commentedon Aug 3, 2019
@YueLinHo
As you wrote correctly, the font used is licensed from Apple and not generally available. The font you suggested, "Bitstream Vera Sans Mono," is not suitable for normal typesetting. It is not a proportional font but a monospaced font, which is better suited for texts that should represent a code text. In continuous text, the typeface appears broken because the letter spacing is not harmonious. (See https://www.fontsquirrel.com/fonts/bitstream-vera-sans-mono).
If you're looking for a free font that is similar to the one in the Sketchbook file and whose license also allows free commercial use, you'll find some alternatives e.g.: https://www.fontspace.com/vincenzo-vuono/gravity or https://www.fontspace.com/kineticplasma-fonts/falling-sky.
In addition, the Google Fonts are copyright free (See https://fonts.google.com/?category=Sans+Serif).
@jnavila
As I don't have a Mac available at the moment, I have to open the progit.sketch file with Lunacy (v4.0.3). Assuming it is displayed correctly, I, as a graphic designer, immediately notice some "don'ts", which considerably reduce the display quality of the images.
On the browser page and in the PDF file, the images appear to me rather blurred. I don't understand how this can happen with a vector drawing program like Sketch. Apparently a serious error may have occurred in the workflow.
The initiator of the issue has suggested to use open source software to create the images. From my point of view Inkscape (https://inkscape.org/) would be suitable for this task, it is available for OSX, Windows and Linux. It is also vector-based and you can create your own symbol library, so that a unified design of the images is possible. A small "HowTo" should be enough to explain the workflow to the various authors.
If you like, I can create a new branch in my fork and give some examples for discussion.
jnavila commentedon Aug 3, 2019
@max123kl the files included in both media are png (the way they were extracted from Sketch), and they were heavily compressed.
Keeping the format in vector shapes would provide better as long as it is suitable for web pages and PDF. SVG is such format.
Inkscape manipulates SVG files, so this would be great. The problem is that up to now, the exports from Sketch were very lousy. Please go ahead with some sample, and if it can be integrated, you could even better provide a full conversion of the images. 👍
max123kl commentedon Aug 4, 2019
It does not make sense to reconstruct existing images by duplicating the work. In addition, the check for content errors must be carried out again afterwards.
I suggest that we first analyze where the error hides in the workflow and then focus on eliminating it.
As I said I don't have a Mac and the Sketch tool as well, so at the moment I can only refer to the output of the Windows Lunacy tool. Therefore I can only refer to the output of the Windows Lunacy program at the moment. In other words, I'm pretty sure – what I see here isn't what Sketch produces.
In Sketch's online manual, the section "File Formats" (https://www.sketch.com/docs/exporting/file-formats/) explains that data export to PNG, but also to SVG and EPS is possible. It would be very helpful if you could save two images ("local" and "branch-and-history") and the symbol part in SVG and EPS formats respectively. I especially hope for a lot from the EPS format, as it is universally used in professional image processing.
You can send the files to my e-mail address or place them in the "diagram-source" folder.
Regardless of what I said before, I immediately noticed when looking at the progit.sketch file that the constructed diagrams on the individual pages are no longer in vector format, but in bitmap format. Images in vector format can be enlarged losslessly, the quality of the bitmap format decreases, which is particularly noticeable in typefaces.
The images of the *.PNG files in the ./Images folder are almost all 800 px wide. The same figure (local.png) in the progit.sketch file has only 335 px, so it has to be enlarged more than twice. This leads to a significant blur. In addition, they were extremely compressed and also indexed (the color space of the images was reduced from 24 bit to 256 colors). Subsequent sharpening is no longer possible.
Vector files can usually be edited afterwards without loss of quality, which also means that the effort to improve the images would be considerably less, if the data were available in vector format without indexing.
Another question about the symbols and the symbol library in the Sketch file:
Should it also be possible to edit the text within the symbol in the future? At the moment I can't do that - but it can also be a faulty Lunacy output.
max123kl commentedon Aug 4, 2019
@jnavila
I have reconstructed some symbols with Inkscape.
I have saved the work in four different file variants (https://github.com/max123kl/progit2-de/tree/Figures/diagram-source)
The file test_oneA.svg and test_oneB.svg contains the graphics in original size, whereas ...A.svg was saved as normal SVG and ...B.svg as "optimized SVG" (reduced color gamut). The files test_oneAx2.svg and test_oneBx2.svg contain the graphics in approx. 2.6x magnification. The size of the ...Bx2 file is larger than that of the ...Ax2 file. I have to check this again. But if the result should be confirmed I see no reason to reduce the color gamut to get a smaller memory size.
What can be clearly seen is that the image quality did not suffer due to the magnification.
You see two columns, on the left side I have stayed as close as possible to the original. In the right column I made some small changes. So I lightened or darkened the text a bit to increase the contrast, which improves the readability. In the first row I placed two small color fields behind the graphics in the middle to simulate the background color on the website and the Sketch program.
At the right graphic I made the filling color a bit darker to increase the contrast.
ben commentedon Aug 4, 2019
OK, I've finally been able to load up the source file in the Sketch editor – I had tried a while ago, and it kept crashing on me. Here's what I understand as the desired outcome:
Does that sound correct?
ben commentedon Aug 4, 2019
The first part of this will be accomplished in #1285.
jnavila commentedon Aug 4, 2019
I'm interested in the SVG export. If it's flattened, then it's not really useful for future changes, but if they export a structured file (with styles and reused groups) it could be used as our primary source for images.
ben commentedon Aug 4, 2019
#1285 now covers the first two.
13 remaining items
ben commentedon Aug 6, 2019
Sure, here's one of the text nodes from the SVG file I linked to above:
Note the
stroke="#979797" stroke-width="1"properties. I think if those are removed you won't see the outlining you (rightly) disapprove of. Here's a snippet from your linked SVG:Here the outline is coming from the
styleproperty, wherestroke-width:0.4will force an outline.ben commentedon Aug 6, 2019
Oh, and regarding the choice of font for the diagrams: if Roboto Mono is not acceptable, I'm completely happy with Source Code Pro.
jnavila commentedon Aug 6, 2019
If needed, a good sed filtering could tidy the "stroke" properties if needed.
max123kl commentedon Aug 6, 2019
OK, I see, you were talking about the inside code, and I was just looking at the visible image.
For me it is very difficult to analyze code in that way because I actually trust the design app.
I'm not very familiar with analyzing XML code. What I know is that different design programs can generate very different code for the same type of artwork. For example, Inkscape can create 3 different uncompressed and 2 compressed SVG files (see the "save as" dialog in the pull down menu).
The code Sketch writes is similar to the code Inkscape calls "optimized SVG". If you choose this save format, the second step is an additional settings dialog, where you can choose more options. This leads to a different code in each file. I put some files (along with a Readme) in my Figures branch /diagram-source/test for comparison.
I do not believe in filtering the XML-SVG code, unless an absolute specialist who knows both the XML code and the code generator of Sketch/Inkscape does. However, there might be unwanted side effects.
As far as I can see, the 'stroke' attribute is responsible for the outline of an object. For vector based drawings everything is defined by outlines and fills. I imagine it will be extremely difficult to remove or change some strokes through a filter.
jnavila commentedon Aug 7, 2019
Your export is quite interesting, because we can see that the letters are in fact mostly made up of the stroke part ; if I zoom on
new 5_A.svg:The fill part is black and is only appearing at the internal limit of all strokes. If in Inkscape, I remove the stroke, here's what's left:
Whereas when the fill matches the stroke:
@max123kl , contrary to your belief, mechanizing the filtering of XML-SVG is really not a big deal ( the experiments above are easily doable by script). The relevant question is what kind of transformation we want to apply.
max123kl commentedon Aug 7, 2019
@jnavila
Please show me the code (if not from my
new 5_A.svgfile) of the lowest example (it's not a good idea if "f" and "3" are in touch). I suspect that the outline widthstroke-widththere has the wrong value.My
new 5_A.svgtest file, where I did no editing, is (# at the end of the lines = my comment):It is very important that
stroke="#979797"(means a certain gray) andfill="#000000"(means black) have to have the same value i.e. color here.That's what I was trying to explain in the picture.
Ben has agreed to switch from "Roboto Mono" to "Source Code Pro". So I uploaded the file
new 5_A_f30ab.svg. The only change I made was in field "f30ab", so I could analyze it better. Here's the corresponding code section:The different formatting could be due to the fact that the "Source Code Pro" font is in OTF format and its extended options.
The basic values are:
font-family:'Source Code Pro'
font-size:12px
font-weight:900 (equivalent values are Heavy or Black)
fill-opacity:1 (= no transparency)
fill:#979797 (Character color)
stroke:#979797 (Outline color)
stroke-width:0 (no visible Outline)
text-align:center (is helpful if the text needs to be edited later - default value is left)
jnavila commentedon Aug 7, 2019
@max123kl Sorry, I hadn't followed your previous conversation about the fonts issue. The later example is only with fill at
#979797so the stroke-width is still 1.So, to be clear, I should take the exports that @ben did and apply the styling you just advised, right?
If so, I'll do it tonight at home and will push on a dedicated branch for inspection.
max123kl commentedon Aug 7, 2019
It's worth a try.
If it really worked that would save a lot of effort right now.
As I already wrote here, I would like to create a symbol library for Inkscape, and develop a mini HOWTO for it, so that even for less experienced users the switch to Inkscape becomes easier.
For this I need the previous Sketch symbols as SVG file(s) so that I don't have to rebuild everything.
I now believe that you would be able to do this with a filter, but especially with OTF fonts there are so many adjustment screws you can use to optimize the look. It would be impossible for me to say now: use the value x or y or something in between for attribute ABC
Edit:
I forgot to mention:
if the value of the
text-alignattribute is changed tocenter, the text block moves to the left (if it was previously set toleft).then the TextBlock and the surrounding rectangle must be centered against each other again.
Each font has its own specific tracking. When changing the font, it is also necessary to re-center it, as in point 2.
ben commentedon Aug 7, 2019
I exported the symbols page from Sketch in #1287. It's probable they have the same problems as the other exports.
max123kl commentedon Aug 8, 2019
I downloaded the symbols.svg file. It is fully editable.
Currently, I'm working on the symbols with the new font to pack them into a library.
I was looking for English tutorials that I could use for the promised Mini HowTo and spotted a small tool to optimize the SVG code. Personally, I'm not that experienced in coding, but maybe it's useful to you.
https://github.com/jakearchibald/svgomg
Follow the two links at the beginning of README.md
jnavila commentedon Aug 8, 2019
I just pushed the filtered SVGs to the branch filtered_svg.
It's not so bad, have a look, please.
At first glance, some files have been upset (where the texts have been caught by the rewrite rules for centering text in false positive):
ben commentedon Aug 8, 2019
It's a good starting point. Want to spin up a PR so we can move this discussion over there?
jnavila commentedon Aug 8, 2019
Sure: #1288
KZiemian commentedon Aug 27, 2022
Can this issue be close?