Add badge.json from 2023
authorVik Fearing <vik@chouppes.com>
Mon, 2 Sep 2024 15:46:09 +0000 (17:46 +0200)
committerVik Fearing <vik@chouppes.com>
Mon, 2 Sep 2024 15:46:50 +0000 (17:46 +0200)
templates/badge.json [new file with mode: 0644]

diff --git a/templates/badge.json b/templates/badge.json
new file mode 100644 (file)
index 0000000..8585b4e
--- /dev/null
@@ -0,0 +1,69 @@
+{
+   {% set badgewidth = 105 %}
+   {% set badgeheight = 140 %}
+   {% set badgex = 24 %}
+   {% set badgey = 30 %}
+   {% set bleed = 2 %}
+   {% set cutmarklength = 8 %}
+   {% set cutmarkspace = 3 %}
+
+   "forcebreaks": 1,
+   "fontname": "FiraSans",
+   "width": {{ 105 + (bleed * 2) }},
+   "height": 140,
+   "elements": [
+       {################}
+       {### Cutmarks ###}
+       {################}
+
+       {# Upper left horizontal #}
+       {"type": "line", "x": {{ badgex - bleed - cutmarklength - cutmarkspace }}, "y": {{ badgey }}, "x2": {{ badgex - bleed - cutmarkspace }}, "y2": {{ badgey }}},
+       {# Upper left vertical #}
+       {"type": "line", "x": {{ badgex }}, "y": {{ badgey - bleed - cutmarklength - cutmarkspace }}, "x2": {{ badgex }}, "y2": {{ badgey - bleed - cutmarkspace }}},
+
+       {# Upper right horizontal #}
+       {"type": "line", "x": {{ badgex + bleed + badgewidth + cutmarkspace }}, "y": {{ badgey }}, "x2": {{ badgex + bleed + badgewidth + cutmarkspace + cutmarklength }}, "y2": {{ badgey }}},
+       {# Upper right vertical #}
+       {"type": "line", "x": {{ badgex + badgewidth }}, "y": {{ badgey - bleed - cutmarklength - cutmarkspace }}, "x2": {{ badgex + badgewidth }}, "y2": {{ badgey - bleed - cutmarkspace }}},
+
+       {# Lower left horizontal #}
+       {"type": "line", "x": {{ badgex - bleed - cutmarklength - cutmarkspace }}, "y": {{ badgey + badgeheight }}, "x2": {{ badgex - bleed - cutmarkspace }}, "y2": {{ badgey + badgeheight }}},
+       {# Lower left vertical #}
+       {"type": "line", "x": {{ badgex }}, "y": {{ badgey + badgeheight + bleed + cutmarklength + cutmarkspace }}, "x2": {{ badgex }}, "y2": {{ badgey + badgeheight + bleed + cutmarkspace }}},
+
+       {# Lower right horizontal #}
+       {"type": "line", "x": {{ badgex + bleed + badgewidth + cutmarkspace }}, "y": {{ badgey + badgeheight }}, "x2": {{ badgex + bleed + badgewidth + cutmarkspace + cutmarklength }}, "y2": {{ badgey + badgeheight }}},
+       {# Lower right vertical #}
+       {"type": "line", "x": {{ badgex + badgewidth }}, "y": {{ badgey + badgeheight + bleed + cutmarklength + cutmarkspace }}, "x2": {{ badgex + badgewidth }}, "y2": {{ badgey + badgeheight + bleed + cutmarkspace }}},
+
+       {"type": "box", "x": {{ badgex - bleed }}, "y": {{ badgey - bleed }}, "width": {{ badgewidth + (bleed * 2) }}, "height": {{ badgeheight + (bleed * 2) }}, "fill": [255, 255, 255], "stroke": false},
+
+       {########################}
+       {### Background image ###}
+       {########################}
+
+       {"type": "image", "src": "img/badge_background_{% if reg.regtype.regclass.regclass == "Attendee" %}attendee{% elif reg.regtype.regclass.regclass == "Speaker" %}speaker{% else %}staff{% endif %}.png", "x": {{ badgex - bleed }}, "y": {{ badgey - bleed }}, "width": {{ badgewidth + (bleed * 2) }}, "height": {{ badgeheight + (bleed * 2) }}, "mask": "auto"},
+
+       {############}
+       {### Name ###}
+       {############}
+
+       {"type": "paragraph", "fontname": "FiraSans", "text": "{{ reg.firstname|escapejson }} {{ reg.lastname|escapejson }}", "x": {{ badgex + 4 }}, "y": {{ badgey + 107 }}, "width": {{ badgewidth - 8 - 18 }}, "height": 10, "bold": true}
+
+       {###############}
+       {### Company ###}
+       {###############}
+
+       {% if reg.company %}
+       ,{"type": "paragraph", "text": "{{ reg.company|escapejson }}", "x": {{ badgex + 4 }}, "y": {{ badgey + 119 }}, "width": {{ badgewidth - 8 }}, "height": 8, "maxsize": 14}
+       {% endif %}
+
+       {###############}
+       {### QR code ###}
+       {###############}
+
+       {% if reg.id != 0 %}
+       ,{"type": "qrimage", "fill": "red", "x": {{ badgex + 86 }}, "y": {{ badgey + 107 }}, "width": 18, "height": 18, "qrcontent": "{{ reg.fullpublictoken }}"}
+       {% endif %}
+   ]
+}