Skip to content

Commit d4ac49c

Browse files
authored
flagada:0.1.0 (typst#1855)
1 parent fd76600 commit d4ac49c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+25913
-0
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2025 Samuel Renault
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
# Flagada
2+
3+
A typst package to display **country flags** in your Typst documents. This first version is extremely simple, as the only two arguments is the country and the height of the flag to display in the document.
4+
5+
## Loading the package
6+
7+
```typst
8+
#import "@preview/flagada:0.1.0" : *
9+
```
10+
11+
## Calling a flag
12+
13+
You need to know the ISO 3166-1 code of the country (string of 2 characters) to display.
14+
15+
Either call the flag as with the long call version `flag-zz()` or short call `flag("ZZ")`, `zz` or `"ZZ"` being the ISO 3166-1 code.
16+
17+
Please note that long call version, like `flag-zz()`, must use _lowercase_ of the ISO 3166-1 code. Short version can use both _lowercase_ or _uppercase_ of the ISO 3166-1
18+
19+
### Example
20+
21+
```typst
22+
Hello people coming from #flag-fr(), #flag-eu(), #flag("DE") and more
23+
```
24+
25+
![Hello people coming from France, Europe, Germany and more](doc/example_1.png)
26+
27+
## Modifying the height
28+
29+
By default the flag height is `0.65em`, which is usually the default text size.
30+
31+
To modify the height, include the `height` parameter in your call.
32+
33+
Either call the flag as `flag-zz(height:6em)` or `flag("ZZ",height:6em)`, `zz` or `"ZZ"` being the ISO 3166-1 code.
34+
35+
### Example for height
36+
37+
```typst
38+
Hello people coming from #flag-be(height: 1em), #flag-fr(height: 2em), #flag-eu(height:3em), #flag("DE",height: 2em), #flag("LU",height: 1em) and more
39+
```
40+
41+
![Hello people coming from Belgium, France, Europe, Germany, Luxembourg and more](doc/example_2.png)
42+
43+
## Comments
44+
45+
### Coat of arms
46+
47+
Some flags include coat of arms or other specific components. As ususally these components are hard to build in Typst, a SVG version from wikimedia is used. The coat of arms for countries are in directory `coat of arms/`
48+
49+
#### Example of coat of arms
50+
51+
![Hello people coming from Europe, Spain, Portugal and more](doc/example_3.png)
52+
53+
In this example, coats of arms are used for Spanish and Portuguese flags (but not for European flag as stars can be constructed or displayed from an unicode like `U+2605`)
54+
55+
### Width not updatable
56+
57+
For the moment, the official format defined by each country has been used to build their flag (e.g. 1:2 fro GB, 2:3 for FR, 10:19 for US ...). No possibility to modify the width has been considered. As a consequence, when you display two or more flags close to each other at the same height, their width might not be equal for each flag.
58+
59+
### Flags covered so far
60+
61+
Flags for the following ISO 3166-1 codes are available in the initial version (0.1.0):
62+
63+
AD AE AG AL AM AO AR AT AU AZ BA BB BD BE BF BG BH BI BJ BN BO BR BS BT BW BY BZ
64+
CA CD CF CG CH CI CL CM CN CO CR CU CV CY CZ DE DJ DK DO DZ EC EE EG ER ES ET EU FI
65+
FR GA GB GE GH GM GN GQ GR GT GW GY HN HR HT HU ID IE IL IN IQ IR IS IT JM JO JP KE
66+
KH KM KP KR KW LA LB LI LK LR LS LT LU LV LY MA MC MD ME MG MK ML MM MN MR MT
67+
MU MV MW MX MY MZ NA NE NG NI NL NO NP NZ OM PA PE PH PK PL PS PT PY QA RO RS RU
68+
SA SC SD SE SG SI SK SL SM SN SO SR SS ST SY SZ TG TL TN TR TW TZ UA UG US UY VA VE VN YE ZA ZM ZW
69+
70+
For these flags, comments are welcome
71+
72+
![A list of flags](doc/example_4.png)
73+
74+
### Flags not yet covered so far
75+
76+
The flags for remaining ISO 3166-1 codes have not been developped and might be developped for the next version
77+
78+
AF AI AQ AS AW AX BL BM BQ BV CC CK CW CX DM EH FJ FK FM FO GD GF GG GI GL GP GS
79+
GU HK HM IM IO JE KG KI KN KY KZ LC MF MH MO MP MQ MS NC NF NR NU PF PG PM PN
80+
PR PW RE RW SB SH SJ SV SX TC TD TF TH TJ TK TM TO TT TV UM UZ VC VG VI VU WF WS
81+
YT

packages/preview/flagada/0.1.0/coat of arms/AD.svg

Lines changed: 1 addition & 0 deletions
Loading
Lines changed: 6 additions & 0 deletions
Loading

0 commit comments

Comments
 (0)