The devmanual's Makefile currently uses inkscape to convert SVGs into PNGs. This has a few downsides: * inkscape is a huge dependency, * inkscape is slow to perform the conversion, * pulling in imagemagick[svg] doesn't guarantee that "convert" can convert an SVG to a PNG if inkscape is missing (bug 684686). The good news is that imagemagick[svg] already pulls in another SVG-to-PNG conversion program, rsvg-convert, and rsvg-convert doesn't have any of those downsides. The caveat is that inkscape is supposed to be better (somehow, who know) at performing the conversions. However, none of the SVG images in the devmanual are complicated, and rsvg-convert should be able to handle them. If so, we should use rsvg-convert in the Makefile instead of inkscape.
Created attachment 603220 [details, diff] 0001-.svg-specify-DejaVu-Sans-instead-of-generic-sans-ser.patch
Created attachment 603222 [details, diff] 0002-Makefile-use-rsvg-convert-to-generate-PNGs-from-SVGs.patch Here are the implementation patches. Unfortunately someone is going to have to open up these SVGs and look at them. All I've done is expand a few boxes and tweak the spacing to ensure that things still look nice. I'll also upload the "before" and "after" images, five from inkscape and five from rsvg-convert, to show you what I think you should be seeing.
Created attachment 603224 [details] autotools-diagram-inkscape.png
Created attachment 603226 [details] autotools-diagram-rsvg.png
Created attachment 603228 [details] emerge-and-ebuild-diagram-inkscape.png
Created attachment 603230 [details] emerge-and-ebuild-diagram-rsvg.png
Created attachment 603232 [details] functions-diagram-inkscape.png
Created attachment 603234 [details] functions-diagram-rsvg.png
Created attachment 603236 [details] git-to-rsync-diagram-inkscape.png
Created attachment 603238 [details] git-to-rsync-diagram-rsvg.png
Created attachment 603240 [details] mirrors-diagram-inkscape.png
Created attachment 603242 [details] mirrors-diagram-rsvg.png
(In reply to Michael Orlitzky from comment #1) > Created attachment 603220 [details, diff] [details, diff] > 0001-.svg-specify-DejaVu-Sans-instead-of-generic-sans-ser.patch Why not Open Sans, to match the font used by the Tyrian layout? (It is packaged as media-fonts/open-sans.) (In reply to Michael Orlitzky from comment #2) > Created attachment 603222 [details, diff] [details, diff] > 0002-Makefile-use-rsvg-convert-to-generate-PNGs-from-SVGs.patch Maybe add the font to the prereq check, too?
Why does functions-diagram-inkscape.png attached on this bug look different from https://devmanual.gentoo.org/ebuild-writing/functions/diagram.png? Aren't they both generated using inkscape at the moment?
(In reply to Ulrich Müller from comment #13) > > Why not Open Sans, to match the font used by the Tyrian layout? (It is > packaged as media-fonts/open-sans.) I'm happy to do that but I was trying to change as little as possible. > Maybe add the font to the prereq check, too? I'll dig into it, I'm not sure how to do this off the top of my head. (In reply to Göktürk Yüksek from comment #14) > Why does functions-diagram-inkscape.png attached on this bug look different > from https://devmanual.gentoo.org/ebuild-writing/functions/diagram.png? > Aren't they both generated using inkscape at the moment? The commit message explains: The text in most of our diagrams was left to use the generic "sans-serif" font face, which depends on both the local machine and the program used to edit/convert the SVG image. This isn't the best situation, because we want the output PNGs to be predictable. Even that might not be 100% correct. I don't think there's any font specified, and my particular version of inkscape chooses the generic "sans-serif."
Also, why are the files so much larger now? For example, general-concepts/emerge-and-ebuild/diagram.svg has grown from 55 to 271 lines, and general-concepts/autotools/diagram.svg has grown from 102 to 469 lines. Are the new fonts bundled with these images, or what is the reason?
Created attachment 603588 [details, diff] 0001-.svg-specify-Open-Sans-instead-of-generic-sans-serif.patch
Created attachment 603590 [details, diff] 0002-Makefile-add-prereq-check-for-the-Open-Sans-font.patch
Created attachment 603592 [details, diff] 0003-Makefile-use-rsvg-convert-to-generate-PNGs-from-SVGs.patch The new patches use Open Sans instead, with a prereq check in the Makefile. The line/KB size difference is from things like <text style="text-anchor: middle;" x="250" y="170">emerge</text> being changed to <text id="text17" y="170" x="250" style="text-anchor:middle;-inkscape-font-specification:'Open Sans';font-family:'Open Sans';font-weight:normal;font-style:normal;font-stretch:normal;font-variant:normal;">emerge</text> You could probably strip some of that out by hand if you want to be in the business of creating images in emacs.
Created attachment 603594 [details] autotools-diagram-rsvg-osans.png
Created attachment 603596 [details] emerge-and-ebuild-diagram-rsvg-osans.png
Created attachment 603598 [details] functions-diagram-rsvg-osans.png
Created attachment 603600 [details] git-to-rsync-diagram-rsvg-osans.png
Created attachment 603602 [details] mirrors-diagram-rsvg-osans.png And some new reference images, to ensure that you see what I see.
@Infra: Are gnome-base/librsvg and media-fonts/open-sans[X] installed on the machine that builds the devmanual?
(In reply to Ulrich Müller from comment #25) > @Infra: Are gnome-base/librsvg and media-fonts/open-sans[X] installed on the > machine that builds the devmanual? lbrsvg - yes open-sans - no
(In reply to Michael Orlitzky from comment #18) > Created attachment 603590 [details, diff] [details, diff] > 0002-Makefile-add-prereq-check-for-the-Open-Sans-font.patch I don't think that USE=X is needed here. Everything seems to work just fine if I install media-fonts/open-sans[-X]. (In reply to Michael Orlitzky from comment #20) > Created attachment 603594 [details] > autotools-diagram-rsvg-osans.png While at it, would it be much work to remove the obsolete configure.in from the box at the upper left? Otherwise, the images look good, and I see no difference to the ones I generate locally. Thank you!
Created attachment 604354 [details, diff] 0004-general-concepts-autotools-diagram.svg-Delete-obsole.patch (In reply to Ulrich Müller from comment #27) > While at it, would it be much work to remove the obsolete configure.in from > the box at the upper left? To answer my own question, it isn't. :)
Created attachment 604422 [details, diff] 0001-.svg-specify-Open-Sans-instead-of-generic-sans-serif.patch
Created attachment 604424 [details, diff] 0002-Makefile-add-prereq-check-for-the-Open-Sans-font.patch I removed [X] from the prereq check. Also added "Bug:" tags and my signed-off-by.
Created attachment 604426 [details, diff] 0003-Makefile-use-rsvg-convert-to-generate-PNGs-from-SVGs.patch
In the future I think we could still have this fall back to inkscape, but I'm not going to worry about it now. Using inkscape is less reliable because of the imagemagick issue and the user experience is worse (i.e. slower), but there may still be a few people who have inkscape installed (with SVG support) but no librsvg.
(In reply to Michael Orlitzky from comment #29) > Created attachment 604422 [details, diff] [details, diff] > 0001-.svg-specify-Open-Sans-instead-of-generic-sans-serif.patch (In reply to Michael Orlitzky from comment #30) > Created attachment 604424 [details, diff] [details, diff] > 0002-Makefile-add-prereq-check-for-the-Open-Sans-font.patch (In reply to Michael Orlitzky from comment #31) > Created attachment 604426 [details, diff] [details, diff] > 0003-Makefile-use-rsvg-convert-to-generate-PNGs-from-SVGs.patch Wrong patches attached? I don't see any difference from the ones you had attached on 2020-01-17. As a matter of fact, the commit id in the first line is the same.
Created attachment 604610 [details, diff] 0001-.svg-specify-Open-Sans-instead-of-generic-sans-serif.patch
Created attachment 604614 [details, diff] 0001-.svg-specify-Open-Sans-instead-of-generic-sans-serif.patch
Created attachment 604616 [details, diff] 0002-Makefile-add-prereq-check-for-the-Open-Sans-font.patch
Created attachment 604618 [details, diff] 0003-Makefile-use-rsvg-convert-to-generate-PNGs-from-SVGs.patch Thought I was losing my mind for a second. User error.
(In reply to Mikle Kolyada from comment #26) > (In reply to Ulrich Müller from comment #25) > > @Infra: Are gnome-base/librsvg and media-fonts/open-sans[X] installed on the > > machine that builds the devmanual? > > lbrsvg - yes > open-sans - no Could media-fonts/open-sans (USE=X *not* necessary) be installed then?
(In reply to Ulrich Müller from comment #38) > Could media-fonts/open-sans (USE=X *not* necessary) be installed then? Maybe it is cleaner to split this out into its own bug. See bug 706628.
(In reply to Michael Orlitzky from comment #22) > Created attachment 603598 [details] > functions-diagram-rsvg-osans.png In just wanted to push the series, but in a last-minute check I see that src_unpack and src_prepare are in a different font. Sorry for noticing this only now.
(In reply to Ulrich Müller from comment #40) > In just wanted to push the series, but in a last-minute check I see that > src_unpack and src_prepare are in a different font. OK, I've fixed this locally.
The bug has been closed via the following commit(s): https://gitweb.gentoo.org/proj/devmanual.git/commit/?id=6bff1eb8b62b9d07e1cc1098eb617f9302487907 commit 6bff1eb8b62b9d07e1cc1098eb617f9302487907 Author: Michael Orlitzky <mjo@gentoo.org> AuthorDate: 2019-12-10 03:10:18 +0000 Commit: Ulrich Müller <ulm@gentoo.org> CommitDate: 2020-01-27 19:57:02 +0000 Makefile: use rsvg-convert to generate PNGs from SVGs. Our Makefile currently uses inkscape (via imagemagick's "convert" wrapper) to turn SVGs into PNGs. This has a few downsides: * media-gfx/inkscape is a huge dependency, * inkscape is slow to perform the conversion, * installing imagemagick[svg] doesn't ensure that "convert" can convert an SVG to a PNG if inkscape is missing (bug 684686). The good news is that there is another SVG -> PNG conversion tool called rsvg-convert that is installed by gnome-base/librsvg. Compared to inkscape, librsvg is a light dependency and rsvg-convert is lightning-fast. Moreover, installing gnome-base/librsvg guarantees that the latter will exist and can actually perform the conversion. Inkscape is supposedly more powerful, but so far in the devmanual we're only using SVG to put words in boxes. The simpler tool is sufficient for that, and therefore preferable. This commit updates the Makefile to use rsvg-convert. Bug: https://bugs.gentoo.org/684686 Closes: https://bugs.gentoo.org/700904 Signed-off-by: Michael Orlitzky <mjo@gentoo.org> Signed-off-by: Ulrich Müller <ulm@gentoo.org> Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) Additionally, it has been referenced in the following commit(s): https://gitweb.gentoo.org/proj/devmanual.git/commit/?id=a3d4f013e640988d6097d29623aec40bfc89521b commit a3d4f013e640988d6097d29623aec40bfc89521b Author: Michael Orlitzky <mjo@gentoo.org> AuthorDate: 2020-01-17 01:30:28 +0000 Commit: Ulrich Müller <ulm@gentoo.org> CommitDate: 2020-01-27 19:57:01 +0000 Makefile: add prereq check for the Open Sans font. The fc-list command from media-libs/fontconfig can tell us what fonts are available to rsvg-convert, so this commit asks it if any font matching the pattern "Open Sans" is installed. You could make this check a bit more bullet-proof by checking the exact string (to avoid matching e.g. Not Open Sans), but only at the expense of making a simple command more complicated. Bug: https://bugs.gentoo.org/700904 Signed-off-by: Michael Orlitzky <mjo@gentoo.org> Signed-off-by: Ulrich Müller <ulm@gentoo.org> Makefile | 3 +++ 1 file changed, 3 insertions(+) https://gitweb.gentoo.org/proj/devmanual.git/commit/?id=a79753c392d0b2a66402a1f11ef02cf131efe080 commit a79753c392d0b2a66402a1f11ef02cf131efe080 Author: Michael Orlitzky <mjo@gentoo.org> AuthorDate: 2020-01-17 15:37:04 +0000 Commit: Ulrich Müller <ulm@gentoo.org> CommitDate: 2020-01-27 19:56:25 +0000 *.svg: specify Open Sans instead of generic "sans-serif" font. The text in most of our diagrams was left to use the generic "sans-serif" font face, which depends on both the local machine and the program used to edit/convert the SVG image. This isn't the best situation, because we want the output PNGs to be predictable. The Tyrian layout used for devmanual.gentoo.org makes heavy use of the "Open Sans" font, so this commit updates each SVG in the devmanual to use that face for all text elements that were previously "sans-serif". Bug: https://bugs.gentoo.org/700904 Signed-off-by: Michael Orlitzky <mjo@gentoo.org> [Fonts in ebuild-writing/functions/diagram.svg fixed] Signed-off-by: Ulrich Müller <ulm@gentoo.org> ebuild-writing/functions/diagram.svg | 477 ++++++++-------- general-concepts/autotools/diagram.svg | 515 ++++++++++++++---- general-concepts/emerge-and-ebuild/diagram.svg | 294 ++++++++-- general-concepts/git-to-rsync/diagram.svg | 644 +++++++++++++++++----- general-concepts/mirrors/diagram.svg | 717 ++++++++++++------------- 5 files changed, 1727 insertions(+), 920 deletions(-)