Skip to content

Commit 74a4924

Browse files
committed
feat add fonts and license
1 parent 355b768 commit 74a4924

File tree

9 files changed

+130
-7
lines changed

9 files changed

+130
-7
lines changed

assets/fonts/AllertaStencil.ttf

16.4 KB
Binary file not shown.

assets/fonts/Emilio20.ttf

37 KB
Binary file not shown.

assets/fonts/Emilio20_license

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Downloaded from : https://www.1001fonts.com/emilio-20-font.html
2+
3+
LICENSE: https://creativecommons.org/licenses/by-sa/3.0/
4+
5+
==========================
6+
EMILIO 20
7+
==========================

assets/fonts/Fonts_licence

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
Copyright (c) 2010, Matt McInerney (matt@pixelspread.com),
2+
with Reserved Font Name Allerta.
3+
4+
Copyright (c) 2011, Juan Pablo del Peral (juan@huertatipografica.com.ar),
5+
with Reserved Font Names "Gochi" and "Gochi Hand"
6+
7+
Copyright (c) 2011 by vernon adams (vern@newtypography.co.uk),
8+
with Reserved Font Names "Monoton"
9+
10+
Copyright 2010 The Lobster Project Authors (https://github.com/impallari/The-Lobster-Font), with Reserved Font Name "Lobster".
11+
with Reserved Font Names "Lobster"
12+
13+
14+
This Font Software is licensed under the SIL Open Font License, Version 1.1.
15+
This license is copied below, and is also available with a FAQ at:
16+
https://openfontlicense.org
17+
18+
19+
-----------------------------------------------------------
20+
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
21+
-----------------------------------------------------------
22+
23+
PREAMBLE
24+
The goals of the Open Font License (OFL) are to stimulate worldwide
25+
development of collaborative font projects, to support the font creation
26+
efforts of academic and linguistic communities, and to provide a free and
27+
open framework in which fonts may be shared and improved in partnership
28+
with others.
29+
30+
The OFL allows the licensed fonts to be used, studied, modified and
31+
redistributed freely as long as they are not sold by themselves. The
32+
fonts, including any derivative works, can be bundled, embedded,
33+
redistributed and/or sold with any software provided that any reserved
34+
names are not used by derivative works. The fonts and derivatives,
35+
however, cannot be released under any other type of license. The
36+
requirement for fonts to remain under this license does not apply
37+
to any document created using the fonts or their derivatives.
38+
39+
DEFINITIONS
40+
"Font Software" refers to the set of files released by the Copyright
41+
Holder(s) under this license and clearly marked as such. This may
42+
include source files, build scripts and documentation.
43+
44+
"Reserved Font Name" refers to any names specified as such after the
45+
copyright statement(s).
46+
47+
"Original Version" refers to the collection of Font Software components as
48+
distributed by the Copyright Holder(s).
49+
50+
"Modified Version" refers to any derivative made by adding to, deleting,
51+
or substituting -- in part or in whole -- any of the components of the
52+
Original Version, by changing formats or by porting the Font Software to a
53+
new environment.
54+
55+
"Author" refers to any designer, engineer, programmer, technical
56+
writer or other person who contributed to the Font Software.
57+
58+
PERMISSION & CONDITIONS
59+
Permission is hereby granted, free of charge, to any person obtaining
60+
a copy of the Font Software, to use, study, copy, merge, embed, modify,
61+
redistribute, and sell modified and unmodified copies of the Font
62+
Software, subject to the following conditions:
63+
64+
1) Neither the Font Software nor any of its individual components,
65+
in Original or Modified Versions, may be sold by itself.
66+
67+
2) Original or Modified Versions of the Font Software may be bundled,
68+
redistributed and/or sold with any software, provided that each copy
69+
contains the above copyright notice and this license. These can be
70+
included either as stand-alone text files, human-readable headers or
71+
in the appropriate machine-readable metadata fields within text or
72+
binary files as long as those fields can be easily viewed by the user.
73+
74+
3) No Modified Version of the Font Software may use the Reserved Font
75+
Name(s) unless explicit written permission is granted by the corresponding
76+
Copyright Holder. This restriction only applies to the primary font name as
77+
presented to the users.
78+
79+
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
80+
Software shall not be used to promote, endorse or advertise any
81+
Modified Version, except to acknowledge the contribution(s) of the
82+
Copyright Holder(s) and the Author(s) or with their explicit written
83+
permission.
84+
85+
5) The Font Software, modified or unmodified, in part or in whole,
86+
must be distributed entirely under this license, and must not be
87+
distributed under any other license. The requirement for fonts to
88+
remain under this license does not apply to any document created
89+
using the Font Software.
90+
91+
TERMINATION
92+
This license becomes null and void if any of the above conditions are
93+
not met.
94+
95+
DISCLAIMER
96+
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
97+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
98+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
99+
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
100+
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
101+
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
102+
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
103+
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
104+
OTHER DEALINGS IN THE FONT SOFTWARE.

assets/fonts/GochiHand.ttf

35.1 KB
Binary file not shown.

assets/fonts/Lobster 1.4.otf

-36.8 KB
Binary file not shown.

assets/fonts/Lobster.ttf

387 KB
Binary file not shown.

assets/fonts/Monoton.ttf

48.7 KB
Binary file not shown.

pretty_gpx/common/drawing/utils/fonts.py

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,16 @@
1010
from pretty_gpx.common.utils.paths import FONTS_DIR
1111

1212

13+
def get_font_format(font_path: str) -> str:
14+
"""Get font's type."""
15+
if font_path.lower().endswith('.otf'):
16+
return 'opentype'
17+
elif font_path.lower().endswith('.ttf'):
18+
return 'truetype'
19+
else:
20+
raise ValueError("Unsupported font format. Please provide a .otf or .ttf file.")
21+
22+
1323
def get_css_header(font: FontProperties) -> str | None:
1424
"""Get the CSS header when using a custom font (using a local file)."""
1525
font_path = font.get_file()
@@ -18,7 +28,7 @@ def get_css_header(font: FontProperties) -> str | None:
1828
header = f'''
1929
@font-face {{
2030
font-family: '{font.get_name()}';
21-
src: url('/fonts/{font_path}') format('opentype');
31+
src: url('/fonts/{font_path}') format('{get_font_format(font_path)}');
2232
}}
2333
'''
2434
return textwrap.dedent(header)
@@ -29,11 +39,13 @@ def get_css_header(font: FontProperties) -> str | None:
2939
class FontEnum(Enum):
3040
"""Font Enum."""
3141
ANNOTATION = FontProperties(weight="bold")
32-
TITLE = (FontProperties(family="Lobster 1.4.otf", fname=os.path.join(FONTS_DIR, "Lobster 1.4.otf")),
33-
FontProperties(family="Arial"),
42+
TITLE = (FontProperties(family="Lobster", fname=os.path.join(FONTS_DIR, "Lobster.ttf")),
3443
FontProperties(family="Verdana"),
35-
FontProperties(family="Times New Roman"),
36-
FontProperties(family="Georgia"),
37-
FontProperties(family="Comic Sans MS"))
38-
STATS = FontProperties(family="Lobster 1.4.otf", fname=os.path.join(FONTS_DIR, "Lobster 1.4.otf"))
44+
FontProperties(family="Comic Sans MS"),
45+
FontProperties(family="Monoton", fname=os.path.join(FONTS_DIR, "Monoton.ttf")),
46+
FontProperties(family="GochiHand", fname=os.path.join(FONTS_DIR, "GochiHand.ttf")),
47+
FontProperties(family="Emilio20", fname=os.path.join(FONTS_DIR, "Emilio20.ttf")),
48+
FontProperties(family="AllertaStencil", fname=os.path.join(FONTS_DIR, "AllertaStencil.ttf"))
49+
)
50+
STATS = FontProperties(family="Lobster", fname=os.path.join(FONTS_DIR, "Lobster.ttf"))
3951

0 commit comments

Comments
 (0)