Mercurial > hg > orthanc-stone
comparison Applications/StoneWebViewer/Resources/Fonts.txt @ 1660:05b55b89a134
use local copy of open-sans, remove ua-parser
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 19 Nov 2020 10:21:20 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
1659:641d39cc8537 | 1660:05b55b89a134 |
---|---|
1 | |
2 | |
3 Tools for handling TTF and WOFF2 | |
4 ================================ | |
5 | |
6 https://fr.wikipedia.org/wiki/Web_Open_Font_Format_2 | |
7 | |
8 | |
9 Print info about a TTF | |
10 ---------------------- | |
11 | |
12 $ sudo apt-get install fontconfig | |
13 $ fc-query ./2017-11-13-OpenSans-Regular.ttf | |
14 | |
15 => The "lang" and the "capability" are interesting to know the | |
16 supported language. "en" and "otlayout:latn" are a must. | |
17 | |
18 | |
19 Get version of a TTF | |
20 -------------------- | |
21 | |
22 $ fc-query -f '%{fontversion}\n' ./OpenSans/2017-11-13-OpenSans-Regular.ttf | \ | |
23 grep -v 'id' | perl -E 'printf "%.3f\n", <>/65536.0' | |
24 | |
25 => "1.100" indicates version "1.1" | |
26 | |
27 Source: https://stackoverflow.com/a/43614521/881731 | |
28 | |
29 | |
30 Conversion from TTF to WOFF2 | |
31 ---------------------------- | |
32 | |
33 $ sudo apt install woff2 | |
34 $ woff2_compress 2017-11-13-OpenSans-Regular.ttf | |
35 | |
36 Source: https://dev.to/benjaminblack/converting-ttf-fonts-to-woff2-and-woff-3f5b | |
37 | |
38 | |
39 | |
40 OpenSans | |
41 ======== | |
42 | |
43 General information | |
44 ------------------- | |
45 | |
46 Official repository: | |
47 https://github.com/googlefonts/opensans/tree/master/ | |
48 | |
49 License: | |
50 Apache License 2.0 | |
51 | |
52 Google Fonts: | |
53 https://fonts.google.com/specimen/Open+Sans#license | |
54 | |
55 Google CDN: | |
56 https://fonts.googleapis.com/css?family=Open+Sans | |
57 | |
58 Debian package: | |
59 | |
60 $ sudo apt-get install fonts-open-sans | |
61 $ ls -l /usr/share/fonts/truetype/open-sans/ | |
62 | |
63 | |
64 Playing with the CDN | |
65 -------------------- | |
66 | |
67 To fetch the WOFF2 from CDN (selecting WOFF2 instead of TTF is done by | |
68 setting the HTTP Header User-Agent): | |
69 | |
70 $ cd /tmp | |
71 $ curl -H 'User-Agent: AppleWebKit/537 Chrome/85' 'https://fonts.googleapis.com/css?family=Open+Sans' | |
72 => The "latin" section is what we're looking for | |
73 $ wget https://fonts.gstatic.com/s/opensans/v18/mem8YaGs126MiZpBA-UFVZ0b.woff2 | |
74 | |
75 | |
76 To fetch the TTF from CDN: | |
77 | |
78 $ curl 'https://fonts.googleapis.com/css?family=Open+Sans' | |
79 $ wget https://fonts.gstatic.com/s/opensans/v18/mem8YaGs126MiZpBA-UFVZ0e.ttf | |
80 $ woff2_compress mem8YaGs126MiZpBA-UFVZ0e.ttf | |
81 $ diff -s ./mem8YaGs126MiZpBA-UFVZ0e.woff2 ./mem8YaGs126MiZpBA-UFVZ0b.woff2 | |
82 | |
83 => The files are identical | |
84 | |
85 | |
86 As of 2020-11-19, the version of the TTF is "1.101": | |
87 | |
88 $ fc-query -f '%{fontversion}\n' ./mem8YaGs126MiZpBA-UFVZ0e.ttf | \ | |
89 grep -v 'id' | perl -E 'printf "%.3f\n", <>/65536.0' | |
90 | |
91 | |
92 | |
93 Generation of the "./OpenSans" folder | |
94 ------------------------------------- | |
95 | |
96 $ mkdir ./OpenSans | |
97 $ cd ./OpenSans | |
98 $ REVISION=c0d8ce7dd46291a5d429ac537ddcd3617f4dc229 | |
99 $ wget https://github.com/googlefonts/opensans/raw/master/LICENSE.txt | |
100 $ curl https://raw.githubusercontent.com/googlefonts/opensans/${REVISION}/ttfs/OpenSans-Regular.ttf > 2017-11-13-OpenSans-Regular.ttf | |
101 $ woff2_compress 2017-11-13-OpenSans-Regular.ttf | |
102 | |
103 => Note that the version of the TTF font is "2.010" (so more recent | |
104 than the font on Google Fonts CDN) |