Skip to content

Latest commit

 

History

History

dia

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Git Book Diagrams

dia version info

Source files to generate the diagram images in SVG using Dia.


Table of Contents


Folder Contents

System Requirements and Set-Up

To run build.sh you'll need the following dependencies:

Dia Diagram Editor

In order to edit the diagram's sourcefile, or to run the scripts in this folder, you'll need to install Dia Diagram Editor version 0.97.

Dia is a free and open source cross platform tool for editing diagrams.

IMPORTANT! — Dia versions above 0.97 won't work as expected, because the diagrams rely on specific Cairo-SVG features which have changed in later Dia versions (see Issue #12). The problem has to do with zero-width borders, which should not be drawn in the final SVG generated using Cairo-SVG (which is an undocumented native export format).

Tests under Windows revealed that Dia versions >=0.97.1 draw these zero-width borders, whereas Dia 0.97 correctly ignores them. The problem might be related to the Cairo library version employed, not with Dia itself, and it might affect the Windows edition only.

If you're working under Linux or macOS, just check that the final SVG images built using build.sh don't contain a thin black border around them — ideally, rebuilding the diagrams shouldn't result in any changed SVGs files in the repository.

Depending on your OS and Dia's setup, you might also need to add to the system PATH the full path to Dia's executable (i.e. the bin/ subfolder of Dia's installation) so that it will be visible the build.sh script used here.

Obtaining Dia 0.97

The Dia project is currently a bit messy. At the time of this writing, the latest official Dia release according to the official websites is version 0.97.2 (2011-12-18), but Dia version 0.97.3 (2014-09-05) for Linux is already available from the GNOME Git repository, although it's not mentioned in either of Dia's websites:

Adding to the confusion, there are two distinct official Dia websites:

... and two official repositories:

Older versions of Dia can be downloaded from SourceForge, either as source code or as precompiled binaries for Linux, Mac and Windows:

Linux users might build Dia from source via Git, from the GNOME repository:

Dia version 0.97 might not be available for all OSs, some precompiled binaries will be for 0.97-1, 0.97-2, etc., but as long as it's in the 0.97-x range it should be fine.

Anyhow, what's important here is to ensure that the Dia version used doesn't draw the zero-width borders around the diagrams when exporting to Cairo-SVG.

Dia 0.97 for Windows

WIN 10 DOWNLOADER — If you're using Windows 10, you can simply run the following batch script which will download the correct version of Dia and unpack here, into the ./Dia/ subfolder:

The build.sh script will autodetect its presence and use its dia.exe binary, instead of relying on the system PATH. This will prevent conflicts with other versions of Dia that might be present on your system.

The recommended version for Windows is Dia 0.97 (2009-05-14), available from SourceForge:

That's the exact Dia version used to build the diagrams by the project maintainer.

SVGO

In order to install SVGO you'll need to install Node.js on your system.

Windows users can install Node.js via the Node JS Chocolatey package using the Chocolatey GUI, which simplifies keeping Node always up to date.

TODO

  • Translate DIA sources filename to English.
  • Edit source diagrams:
    • Translate text to English? (Issue #1)
      • git-objects.dia » §2.2.2. » Fig.4
      • repository-content.dia » §2.2.5. » Fig.6
      • tags.dia » §3.1.3. » Fig.12
  • Optimize generated SVG images via SVGO.

Diagrams List and Preview Links

The following table provides preview links to the generated SVG files in the ../../../docs_src/images/ destination folder.

DIA source SVG output
branch-model.dia branch-model.svg
central-workflow.dia central-workflow.svg
clone.dia clone.svg
commit-graph-with-refs.dia commit-graph-with-refs.svg
commit-graph.dia commit-graph.svg
commit.dia commit.svg
fetch.dia fetch.svg
ff-after.dia ff-after.svg
ff-before.dia ff-before.svg
git-objects-hierarchy.dia git-objects-hierarchy.svg
git-objects.dia git-objects.svg
github-workflow.dia github-workflow.svg
index.dia index.svg
integration-manager-workflow.dia integration-manager-workflow.svg
merge-base-commit.dia merge-base-commit.svg
patches-via-email.dia patches-via-email.svg
pull-rebase.dia pull-rebase.svg
pull.dia pull.svg
push.dia push.svg
rebase-after.dia rebase-after.svg
rebase-before.dia rebase-before.svg
rebase-onto-after.dia rebase-onto-after.svg
rebase-onto-before.dia rebase-onto-before.svg
relative-refs.dia relative-refs.svg
repository-content.dia repository-content.svg
sha.dia sha.svg
svn-dcommit.dia svn-dcommit.svg
svn-rebase.dia svn-rebase.svg
tags.dia tags.svg

Diagrams Info

The DIA sources in this folder were taken from the bilder_quelldaten/diagramme/ folder of the Git-Buch upstream repository.

Color Palette

The color palette for the diagrams' background colors was redesigned. The original palette contained too many similar (but no identical) colors, so we've reduced the palette entries by adopting a consistent color scheme, free of similar colors redundancy:

diagrams' palette swatches

Each base color (top row) has a lighter tint counterpart (bottom row). Most diagrams use only base colors; lighter colors are mostly used in diagrams representing before/after transitions, to mark previous states.

There's a methodology behind color usage in the original diagrams, which has been preserved in our changes. A close examination of the diagrams is sufficient to grasp the colors-usage criteria.

NOTE — Some of the above colors are not actually used in any diagrams, but we've kept them in the palette for the sake of color scheme completeness and consistency, and in case they might be needed in the future.

Furthermore, the original palette featured some dark colors that didn't meet the WCAG 2 guidelines on contrast and color requirements (see Issue #15), so the entire color scheme was redesigned from scratch, using color harmonies that produced colors similar to the originals, but not as dark, and ensured that they all pass the color contrast accessibility tests via the WebAIM Contrast Checker:

contrast ratios 19:1 14.93:1 10.82:1 10.75:1 14.4:1 12.91:1 15.6:1
base colors #FDF6B2 #FDD1B2 #E9A4DE #A1BBE5 #A9E5A1 #BACFCF #DEDEDE

Diagrams Fonts

The original diagrams relied on using "monospace" font, which is a generic fallback definition which might lead to different OSs picking different default fonts (although "Courier New" would be usually the default choice, unless the user has specified another font). Similarly, the few diagrams which rely on sanserif fonts were using the "sans" font, which is likely to produce different results on different OSs.

Also, we're using the Cairo-SVG output format (natively supported by Dia, but undocumented) which will convert all text to SVG shapes, freeing the final SVG diagrams from any fonts-dependencies.

We've therefore chosen to use the following fonts for the diagrams:

category name version author repo license
monospace Inconsolata v3.001 Raph Levien GitHub SIL Open Font License 1.1
sans serif Open Sans v1.10 Steve Matteson GitHub SIL Open Font License 1.1

You can also download the required TTF fonts files, individually, directly from the fonts repositories on GitHub:

The above linked TTF fonts are the minimum required font styles. Whether you wish to install the full set of font styles variants and combinations is up to you.

NOTE 1 — The San Serif font is indicated as being licensed under Apache 2.0 on Google Fonts, but in its GitHub repository it's released under the SIL Open Font License 1.1, so we take for good the latter.

NOTE 2 — Unfortunately, the Open Sans GitHub repository doesn't provide version tag nor releases, so it's hard to find/provide direct links to specific versions of the font files.

If you need to rebuild some diagrams, ensure that you've installed the fonts from the Google Fonts or GitHub links provided above because some OSs (e.g. Windows) ship with same-named fonts by different authors, which might produce slightly different results. Ideally, you should install the same exact versions indicated above, to ensure identical results; but it makes more sense to simply install the latest version of the fonts and simply update all diagrams, if these result in differing SVGs.

Under Windows OS, you can safely install those fonts even though already present in the system (as natively shipped fonts), because they will be installed in the User fonts directory, taking precedence over the system wide version, without replacing them.

Beware that some of the above fonts are (or will eventually be) available also in the variable fonts format — don't use it! Use instead the standard format where each font variation comes as an individual file, which is the format we've been using to ensure support across all platforms (and Dia, since this project requires an old Dia version which doesn't support variable fonts).

Diagrams Renaming

Some DIA source project files (but not all) have been renamed according to the following table — affecting the generated filenames too.

original renamed to
developer-public.dia integration-manager-workflow.dia
ff-nachher.dia ff-after.dia
ff-vorher.dia ff-before.dia
graph.dia commit-graph.dia
graph-mit-refs.dia commit-graph-with-refs.dia
merge-nachher.dia deleted (unused in original)
objekte.dia git-objects.dia
objekte-zusammenhang.dia git-objects-hierarchy.dia
patches-per-mail.dia patches-via-email.dia
pull_rebase.dia pull-rebase.dia
rebase-nachher.dia rebase-after.dia
rebase-onto-nachher.dia rebase-onto-after.dia
rebase-onto-vorher.dia rebase-onto-before.dia
rebase-vorher.dia rebase-before.dia
svn_dcommit.dia svn-dcommit.dia
svn_rebase.dia svn-rebase.dia
struktur.dia repository-content.dia
zentral.dia central-workflow.dia

Diagrams Tricks and Hacks

In order to make out the most from DIA, and produce good SVG image, we've resorted to some hackish workarounds.

Cairo SVG

When converting to SVG we use the Cairo SVG format (-t cairo-svg), a natively supported (but undocumented) alternative to Dia's default SVG format.

The Cairo SVG turned out to be more reliable than Dia's default SVG converter, for the latter was causing alignment-offset problems when text wrapped across multiple lines (a rather visible problem when dealing with centered-text in mono-spaced fonts).

Furthermore, SVG images generated via Cairo are not font dependent, for all text gets converted to SVG shapes, whereas the default SVG format relies on the specified font being present in the end-users' machine — lacking which it will fallback on some default system font replacement that would make the diagrams look ugly and break the intended proportions.

Font-dependency limits the choice of typefaces to those few safe fonts which are knows to be available on all OSs and devices (Times New Roman, Arial, Courier New, etc.), hence we decided to switch to the Cairo SVG format even though it required us to adopt Dia version 0.97-1, which is still not available on Dia's websites, and available only as pre-release for Windows.

Invisible Boxes to Preserve Padding

Since AsciiDoc doesn't currently support images padding functionality, in order to ensure that the generated SVG images have some even padding around them across all output formats, I've added an invisible box in the bottom layer (i.e. no background drawn, and border line size 0).

The invisible box of each image has been carefully drawn to achieve the desired padding.

Related Diagrams With Same-Width

Some diagrams are part of a a series of images relating to a specific topic, often depicting the status of a Git object at different snapshots evolving in time. In order to preserve consistent proportions between these images, we add a same-width invisible background box (i.e. the one fitting the largest image of the group) to ensure that they will all scale proportionally when using percentages in the AsciiDoc source.

Similar images are gathered according to their group of belonging in the previews section below.

Diagrams Previews

IMPORTANT — for correct diagrams preview, run preview-generator.sh and then open preview.html.

branch-model.svg

branch-model.svg


central-workflow.svg

central-workflow.svg


clone.svg

clone.svg


Images Group: Commit Graphs

The following two images must have a same-width invisible background box to enforce consistent proportions, because they belong to a series of diagrams on the same topic:

commit-graph.svg

commit-graph.svg

commit-graph-with-refs.svg

commit-graph-with-refs.svg


commit.svg

commit.svg


Images Group: ff

The following two images must have a same-width invisible background box to enforce consistent proportions, because they belong to a series of diagrams on the same topic:

ff-before.svg

ff-before.svg

ff-after.svg

ff-after.svg


git-objects-hierarchy.svg

git-objects-hierarchy.svg


Images Group: Git Objects

The following two images must have a same-width invisible background box to enforce consistent proportions, because they are similar diagrams on the same topic, even though they occur far apart.

git-objects.svg

git-objects.svg

tags.svg

tags.svg


github-workflow.svg

github-workflow.svg


index.svg

index.svg


integration-manager-workflow.svg

integration-manager-workflow.svg


merge-base-commit.svg

merge-base-commit.svg


patches-via-email.svg

patches-via-email.svg


Images Group: Git & SVN Operations

The following images must have a same-width invisible background box to enforce consistent proportions, because they belong to a series of similar diagrams on related topics, for both Git and SVN operations.

Git: Fetch, Push and Pull

fetch.svg

fetch.svg

pull.svg

pull.svg

pull-rebase.svg

pull-rebase.svg

push.svg

push.svg

SVN: Commit and Rebase

svn-rebase.svg

svn-rebase.svg

svn-dcommit.svg

svn-dcommit.svg


Images Group: Rebase

The following four images must have a same-width invisible background box to enforce consistent proportions, because they belong to a series of diagrams on the same topic:

rebase-before.svg

rebase-before.svg

rebase-after.svg

rebase-after.svg

rebase-onto-before.svg

rebase-onto-before.svg

rebase-onto-after.svg

rebase-onto-after.svg


relative-refs.svg

relative-refs.svg


repository-content.svg

repository-content.svg


sha.svg

sha.svg


External Links

Dia Diagram Editor

SVG Images

Web Safe Fonts

Resources and articles on which fonts are safe to use based on common OSs' availability (this affects fonts used in SVG images too):