mirror of
https://github.com/pretix/pretix.git
synced 2026-09-14 16:24:43 +00:00
Font API: Support for script-specific samples
This commit is contained in:
@@ -639,7 +639,7 @@ class EventSettingsForm(SettingsForm):
|
|||||||
if not event.has_subevents:
|
if not event.has_subevents:
|
||||||
del self.fields['frontpage_subevent_ordering']
|
del self.fields['frontpage_subevent_ordering']
|
||||||
self.fields['primary_font'].choices += [
|
self.fields['primary_font'].choices += [
|
||||||
(a, a) for a in get_fonts()
|
(a, {"title": a, "data": v}) for a, v in get_fonts().items()
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -312,7 +312,7 @@ class OrganizerSettingsForm(SettingsForm):
|
|||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
super().__init__(*args, **kwargs)
|
super().__init__(*args, **kwargs)
|
||||||
self.fields['primary_font'].choices += [
|
self.fields['primary_font'].choices += [
|
||||||
(a, a) for a in get_fonts()
|
(a, {"title": a, "data": v}) for a, v in get_fonts().items()
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,2 +1,2 @@
|
|||||||
{% load i18n %}{% if widget.wrap_label %}<label{% if widget.attrs.id %} for="{{ widget.attrs.id }}"{% endif %} class="preload-font"
|
{% load getitem %}{% load i18n %}{% if widget.wrap_label %}<label{% if widget.attrs.id %} for="{{ widget.attrs.id }}"{% endif %} class="preload-font"
|
||||||
data-family="{{ widget.label }}" data-style="regular">{% endif %}{% include "django/forms/widgets/input.html" %}{% if widget.wrap_label %} <strong>{{ widget.label }}</strong><br>{% trans "The quick brown fox jumps over the lazy dog." context "typography" %}</label>{% endif %}
|
data-family="{{ widget.label.title }}" data-style="regular">{% endif %}{% include "django/forms/widgets/input.html" %}{% if widget.wrap_label %} <strong>{{ widget.label.title }}</strong><br>{% trans "The quick brown fox jumps over the lazy dog." context "typography" %}{% if "sample" in widget.label.data %}<br>{{ widget.label.data.sample }}{% endif %}</label>{% endif %}
|
||||||
|
|||||||
@@ -403,9 +403,12 @@
|
|||||||
<img src="{% static 'pretixpresale/pdf/powered_by_pretix_white.png' %}" id="poweredby-white" class="sr-only">
|
<img src="{% static 'pretixpresale/pdf/powered_by_pretix_white.png' %}" id="poweredby-white" class="sr-only">
|
||||||
{% for family, styles in fonts.items %}
|
{% for family, styles in fonts.items %}
|
||||||
{% for style, formats in styles.items %}
|
{% for style, formats in styles.items %}
|
||||||
|
{% if "sample" not in style %}
|
||||||
<span class="preload-font" data-family="{{ family }}" data-style="{{ style }}">
|
<span class="preload-font" data-family="{{ family }}" data-style="{{ style }}">
|
||||||
giItT1WQy@!-/#
|
giItT1WQy@!-/#
|
||||||
|
{% if "_sample" in styles %}{{ styles.sample }}{% endif %}
|
||||||
</span>
|
</span>
|
||||||
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|||||||
@@ -1,7 +1,20 @@
|
|||||||
{% load static %}
|
{% load static %}
|
||||||
|
@font-face {
|
||||||
|
font-family: 'AND';
|
||||||
|
font-style: normal;
|
||||||
|
font-weight: normal;
|
||||||
|
src: url('{% static "fonts/AND-Regular.ttf" %}') format('truetype');
|
||||||
|
}
|
||||||
|
@font-face {
|
||||||
|
font-family: 'AND';
|
||||||
|
font-style: normal;
|
||||||
|
font-weight: bold;
|
||||||
|
src: url('{% static "fonts/AND-Regular.ttf" %}') format('truetype');
|
||||||
|
}
|
||||||
|
|
||||||
{% for family, styles in fonts.items %}
|
{% for family, styles in fonts.items %}
|
||||||
{% for style, formats in styles.items %}
|
{% for style, formats in styles.items %}
|
||||||
|
{% if "sample" not in style %}
|
||||||
@font-face {
|
@font-face {
|
||||||
font-family: '{{ family }}';
|
font-family: '{{ family }}';
|
||||||
{% if style == "italic" or style == "bolditalic" %}
|
{% if style == "italic" or style == "bolditalic" %}
|
||||||
@@ -19,7 +32,7 @@
|
|||||||
{% if "truetype" in formats %}url('{% static formats.truetype %}') format('truetype'){% endif %};
|
{% if "truetype" in formats %}url('{% static formats.truetype %}') format('truetype'){% endif %};
|
||||||
}
|
}
|
||||||
.preload-font[data-family="{{family}}"][data-style="{{style}}"] {
|
.preload-font[data-family="{{family}}"][data-style="{{style}}"] {
|
||||||
font-family: '{{ family }}';
|
font-family: '{{ family }}', 'AND';
|
||||||
{% if style == "italic" or style == "bolditalic" %}
|
{% if style == "italic" or style == "bolditalic" %}
|
||||||
font-style: italic;
|
font-style: italic;
|
||||||
{% else %}
|
{% else %}
|
||||||
@@ -32,5 +45,6 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|||||||
Binary file not shown.
Reference in New Issue
Block a user