Skip to content

Commit ab06799

Browse files
authored
1 parent b8f736e commit ab06799

File tree

2 files changed

+66
-3
lines changed

2 files changed

+66
-3
lines changed

README.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
The [PlantUML Standard Library](http://plantuml.com/stdlib) makes it possible to use popular icons in PlantUML with zero effort.
22

3-
The [plantuml-stdlib](https://github.com/plantuml/plantuml-stdlib) code as based on other projects.
3+
The [plantuml-stdlib](https://github.com/plantuml/plantuml-stdlib) code is based on other projects.
44

5-
As there were changes in some of those repos that were not (yet) in plantuml-stdlib, I decided to open some merge-requests to update things.
5+
As there were changes in some of those repos that were not (yet) in plantuml-stdlib, I decided to open some merge-requests to update things. []()
66

7-
Because I don't like to do thnings manually that could be automated, I spend some time creating two BASH scripts:
7+
Because I don't like to do things manually that could be automated, I spend some time creating two BASH scripts:
88

99
- [`check-sources-for-update.sh`](./check-sources-for-update.sh)
1010
- [`update_sources.sh`](./update_sources.sh)
@@ -44,3 +44,6 @@ It does this based on information from the config file.
4444

4545
The changes in `plantuml-stdlib` can then be seen using `git status`, added using `git add`. comitted with `git commit`, etc.
4646

47+
## Adding a new library
48+
49+
As it might not be clear, I also created [a "simple" tutorial explaining how to add an icon library](./how-to-add-an-icon-library.md).

how-to-add-an-icon-library.md

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# How to add an icon library
2+
3+
The steps to add an icon library are:
4+
5+
1. Generate PlantUML sprite files
6+
2. Put all of the sprites in a repo
7+
3. Open an MR here to get the sprite repo included into stdLib
8+
- Including an `INFO` file
9+
10+
## 1. Generate PlantUML sprite files
11+
12+
Generating`.puml` files from a bunch of SVGs can be done using `plantuml.jar -encodesprite`<sup>1</sup>
13+
14+
It is quite common for icon-sets to either exist out of SVGs or be generated from SVGs, so source SVGs are often already available.
15+
16+
Figuring out which settings to use with `encodesprite` can take some trial-and-error.<sup>2</sup>
17+
18+
I remember looking into https://github.com/tupadr3/font-icon-generator but I can really remember how things work, so for now [YMMV](https://en.wiktionary.org/wiki/your_mileage_may_vary).
19+
20+
## 2. Put all of the sprites in a repo
21+
22+
Once you have a bunch of generated `.puml` files, it is a good idea to create a common/main file that includes all the sprites, to save users the hassle of having to load each sprite individually.<sup>3</sup>
23+
24+
Adding a README explaining things a bit is also a good move.
25+
26+
## 3. Open an MR here to get the sprite repo included into stdLib
27+
28+
To add an icon library to this project (i.e.e the PlantUML stdLib), open a merge request with:<sup>4</sup>
29+
30+
- A folder containing all of your PlantUML sprite files
31+
- An entry to README file
32+
- An `INFO` file
33+
34+
### Including an `INFO` file
35+
36+
The `INFO` file should contain the version (i.e. the git tag or github release) of the icon-set you are adding and the source repo.
37+
38+
For instance:
39+
40+
```
41+
VERSION=1.2.0
42+
SOURCE=https://github.com/path-to/project
43+
```
44+
45+
If the _source_ repo tags newer versions when things change, updating things here can be automated.<sup>5</sup>
46+
47+
In the long run, it _could_ even be possible to add/update icon-sets here without an intermediary repo, but for now, this is how it is done.
48+
49+
## Footnotes
50+
51+
1. To quote [the manual entry on sprites](https://plantuml.com/sprite):
52+
> To encode sprite, you can use the command line like: `java -jar plantuml.jar -encodesprite 16z foo.png` where `foo.png` is the image file you want to use (it will be converted to gray automatically). After `-encodesprite`, you have to specify a format: `4`, `8`, `16`, `4z`, `8z` or `16z`. The number indicates the gray level and the optional `z` is used to enable compression in sprite definition.
53+
54+
2. This [blog post by Hubert Klein Ikkink](https://mrhaki.blogspot.com/2017/10/plantuml-pleasantness-creating-our-own.html) might be of some help
55+
56+
3. Look at existing sprite sets for inspiration
57+
58+
4. A good example of this is [#18](https://github.com/plantuml/plantuml-stdlib/pull/18/files?file-filters%5B%5D=.md&file-filters%5B%5D=No+extension)
59+
60+
5. That is in fact what I have been doing for all MRs opened for this ticket

0 commit comments

Comments
 (0)