forked from d3ward/toolz
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfontlist.html
283 lines (264 loc) · 17.8 KB
/
fontlist.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Font list</title>
<meta name="description" content="List fonts available in the browser ">
<!-- Google / Search Engine Tags -->
<meta itemprop="name" content="Toolz by d3ward - Home">
<meta itemprop="description" content="List fonts available in the browser ">
<meta itemprop="image" content="https://d3ward.github.io/toolz/src/preview_toolz.png">
<!-- Facebook Meta Tags -->
<meta property="og:url" content="https://d3ward.github.io/toolz/fontlist">
<meta property="og:type" content="website">
<meta property="og:title" content="Toolz by d3ward - Fontlist">
<meta property="og:description" content="List fonts available in the browser ">
<meta property="og:image" content="https://d3ward.github.io/toolz/src/preview_toolz.png">
<!-- Twitter Meta Tags -->
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:title" content="Toolz by d3ward - Fontlist">
<meta name="twitter:description" content="List fonts available in the browser ">
<meta name="twitter:image" content="https://d3ward.github.io/toolz/src/preview_toolz.png">
<link rel="shortcut icon" href="./src/svg/toolz.svg" type="image/svg+xml">
<script async defer src="https://aurora-d3.herokuapp.com/public/aurora.js"
aurora-id="520ce98a53142dd933fe4c0f3abb41a0">
</script>
<link href="src/css/style.css" rel="stylesheet">
<style>
body {
background-color: #baf72c;
background-image: linear-gradient(315deg, #baf72c 0%, #04a72d 74%);
background-size: 400% 100%;
height: auto;
}
[data-theme=dark],
html,
[data-theme=light] {
--primary: var(--green);
}
main {
padding-top: 6rem;
}
#flist {
display: grid;
grid-template-columns: 1fr 1fr;
gap: .5rem;
}
</style>
</head>
<body>
<header class="fixed">
<nav>
<a href="fontlist.html">
<svg viewBox="0 0 512 512" xmlns="http://www.w3.org/2000/svg">
<path fill="currentColor"
d="M216 120h272c13.3 0 24-10.7 24-24s-10.75-24-24-24H216c-13.3 0-24 10.75-24 24s10.7 24 24 24zm272 272H216c-13.3 0-24 10.7-24 24s10.75 24 24 24h272c13.25 0 24-10.75 24-24s-10.7-24-24-24zm0-160H216c-13.3 0-24 10.7-24 24s10.75 24 24 24h272c13.3 0 24-10.7 24-24s-10.7-24-24-24zM191.384 208.425L116.16 29.321c-3.344-7.975-16.469-7.975-19.813 0L21.123 208.425c-2.302 5.472.273 11.776 5.744 14.069a10.73 10.73 0 0014.07-5.745l15.129-36.022h100.388l15.13 36.022c1.71 4.124 5.695 6.587 9.904 6.587 1.386 0 2.799-.266 4.156-.84 5.471-2.295 8.068-8.608 5.74-14.07zM65.115 159.216l41.15-98.373 41.158 98.015H65.115zM153.843 356.303c10.402-10.045 16.92-24.107 16.92-39.687 0-30.523-24.822-55.358-55.358-55.358h-62.5c-5.915 0-10.714 4.8-10.714 10.715v178.571c0 5.938 4.8 10.714 10.714 10.714h76.786c30.536 0 55.357-24.821 55.357-55.357 0-21.83-12.812-40.58-31.205-49.598zM63.62 282.687h51.785c18.71 0 33.929 15.219 33.929 33.929s-15.223 33.928-33.929 33.928H63.62zM129.69 439.83H63.62v-67.857h66.071c18.71 0 33.929 15.218 33.929 33.928 0 18.71-15.224 33.929-33.929 33.929z" />
</svg>
</a>
<ul>
<li>
<a href="https://d3ward.github.io/toolz/">
<svg viewBox="0 0 12.002 12.7" class="_icon" xmlns="http://www.w3.org/2000/svg">
<defs>
<linearGradient id="prefix__a">
<stop offset="0" stop-color="#fc575e" />
<stop offset="1" stop-color="#f7b42c" />
</linearGradient>
</defs>
<g paint-order="stroke markers fill" stroke-width="10.32">
<path d="M8 4.22c.581-.065 3.977.236 3.961.314L5.19 8.361.034 8.214z"
fill-opacity=".831" />
<path
d="M3.579 4.385C1.42 4.27.047 2.012 0 0h3.982c3.437 0 4.025.013 4.24.044 2.282-.027 3.674 2.286 3.74 4.49M7.38 8.204c2.537.053 4.463 2.109 4.622 4.496l-7.9-.016c-1.18-.019-4.052-1.81-4.068-4.47" />
</g>
</svg>
Toolz - Home
</a>
</li>
<li>
<a class="bmc" target="_blank" href="https://www.buymeacoffee.com/dOWS9cU">
<svg role="img" class="_icon" id="bmac-icon" xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 24 24">
<title>Buy Me A Coffee icon</title>
<path
d="M20.216 6.415l-.132-.666c-.119-.598-.388-1.163-1.001-1.379-.197-.069-.42-.098-.57-.241-.152-.143-.196-.366-.231-.572-.065-.378-.125-.756-.192-1.133-.057-.325-.102-.69-.25-.987-.195-.4-.597-.634-.996-.788a5.723 5.723 0 00-.626-.194c-1-.263-2.05-.36-3.077-.416a25.834 25.834 0 00-3.7.062c-.915.083-1.88.184-2.75.5-.318.116-.646.256-.888.501-.297.302-.393.77-.177 1.146.154.267.415.456.692.58.36.162.737.284 1.123.366 1.075.238 2.189.331 3.287.37 1.218.05 2.437.01 3.65-.118.299-.033.598-.073.896-.119.352-.054.578-.513.474-.834-.124-.383-.457-.531-.834-.473-.466.074-.96.108-1.382.146-1.177.08-2.358.082-3.536.006a22.228 22.228 0 01-1.157-.107c-.086-.01-.18-.025-.258-.036-.243-.036-.484-.08-.724-.13-.111-.027-.111-.185 0-.212h.005c.277-.06.557-.108.838-.147h.002c.131-.009.263-.032.394-.048a25.076 25.076 0 013.426-.12c.674.019 1.347.067 2.017.144l.228.031c.267.04.533.088.798.145.392.085.895.113 1.07.542.055.137.08.288.111.431l.319 1.484a.237.237 0 01-.199.284h-.003c-.037.006-.075.01-.112.015a36.704 36.704 0 01-4.743.295 37.059 37.059 0 01-4.699-.304c-.14-.017-.293-.042-.417-.06-.326-.048-.649-.108-.973-.161-.393-.065-.768-.032-1.123.161-.29.16-.527.404-.675.701-.154.316-.199.66-.267 1-.069.34-.176.707-.135 1.056.087.753.613 1.365 1.37 1.502a39.69 39.69 0 0011.343.376.483.483 0 01.535.53l-.071.697-1.018 9.907c-.041.41-.047.832-.125 1.237-.122.637-.553 1.028-1.182 1.171-.577.131-1.165.2-1.756.205-.656.004-1.31-.025-1.966-.022-.699.004-1.556-.06-2.095-.58-.475-.458-.54-1.174-.605-1.793l-.731-7.013-.322-3.094c-.037-.351-.286-.695-.678-.678-.336.015-.718.3-.678.679l.228 2.185.949 9.112c.147 1.344 1.174 2.068 2.446 2.272.742.12 1.503.144 2.257.156.966.016 1.942.053 2.892-.122 1.408-.258 2.465-1.198 2.616-2.657.34-3.332.683-6.663 1.024-9.995l.215-2.087a.484.484 0 01.39-.426c.402-.078.787-.212 1.074-.518.455-.488.546-1.124.385-1.766zm-1.478.772c-.145.137-.363.201-.578.233-2.416.359-4.866.54-7.308.46-1.748-.06-3.477-.254-5.207-.498-.17-.024-.353-.055-.47-.18-.22-.236-.111-.71-.054-.995.052-.26.152-.609.463-.646.484-.057 1.046.148 1.526.22.577.088 1.156.159 1.737.212 2.48.226 5.002.19 7.472-.14.45-.06.899-.13 1.345-.21.399-.072.84-.206 1.08.206.166.281.188.657.162.974a.544.544 0 01-.169.364zm-6.159 3.9c-.862.37-1.84.788-3.109.788a5.884 5.884 0 01-1.569-.217l.877 9.004c.065.78.717 1.38 1.5 1.38 0 0 1.243.065 1.658.065.447 0 1.786-.065 1.786-.065.783 0 1.434-.6 1.499-1.38l.94-9.95a3.996 3.996 0 00-1.322-.238c-.826 0-1.491.284-2.26.613z" />
</svg></a>
<a href="https://github.com/d3ward">
<svg class="_icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
<title>Github</title>
<path
d="M256,32C132.3,32,32,134.9,32,261.7c0,101.5,64.2,187.5,153.2,217.9a17.56,17.56,0,0,0,3.8.4c8.3,0,11.5-6.1,11.5-11.4,0-5.5-.2-19.9-.3-39.1a102.4,102.4,0,0,1-22.6,2.7c-43.1,0-52.9-33.5-52.9-33.5-10.2-26.5-24.9-33.6-24.9-33.6-19.5-13.7-.1-14.1,1.4-14.1h.1c22.5,2,34.3,23.8,34.3,23.8,11.2,19.6,26.2,25.1,39.6,25.1a63,63,0,0,0,25.6-6c2-14.8,7.8-24.9,14.2-30.7-49.7-5.8-102-25.5-102-113.5,0-25.1,8.7-45.6,23-61.6-2.3-5.8-10-29.2,2.2-60.8a18.64,18.64,0,0,1,5-.5c8.1,0,26.4,3.1,56.6,24.1a208.21,208.21,0,0,1,112.2,0c30.2-21,48.5-24.1,56.6-24.1a18.64,18.64,0,0,1,5,.5c12.2,31.6,4.5,55,2.2,60.8,14.3,16.1,23,36.6,23,61.6,0,88.2-52.4,107.6-102.3,113.3,8,7.1,15.2,21.1,15.2,42.5,0,30.7-.3,55.5-.3,63,0,5.4,3.1,11.5,11.4,11.5a19.35,19.35,0,0,0,4-.4C415.9,449.2,480,363.1,480,261.7,480,134.9,379.7,32,256,32Z" />
</svg>
</a>
<div class="nav-item theme-toggle">
<span class="light-icon theme-icon">
<svg class="_icon" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg">
<path d="M17.293 13.293A8 8 0 016.707 2.707a8.001 8.001 0 1010.586 10.586z"></path>
</svg>
</span>
<span class="dark-icon theme-icon">
<svg class="_icon" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd"
d="M10 2a1 1 0 011 1v1a1 1 0 11-2 0V3a1 1 0 011-1zm4 8a4 4 0 11-8 0 4 4 0 018 0zm-.464 4.95l.707.707a1 1 0 001.414-1.414l-.707-.707a1 1 0 00-1.414 1.414zm2.12-10.607a1 1 0 010 1.414l-.706.707a1 1 0 11-1.414-1.414l.707-.707a1 1 0 011.414 0zM17 11a1 1 0 100-2h-1a1 1 0 100 2h1zm-7 4a1 1 0 011 1v1a1 1 0 11-2 0v-1a1 1 0 011-1zM5.05 6.464A1 1 0 106.465 5.05l-.708-.707a1 1 0 00-1.414 1.414l.707.707zm1.414 8.486l-.707.707a1 1 0 01-1.414-1.414l.707-.707a1 1 0 011.414 1.414zM4 11a1 1 0 100-2H3a1 1 0 000 2h1z"
clip-rule="evenodd"></path>
</svg>
</span>
</div>
</li>
</ul>
<button>
<svg aria-hidden="true" version="1.1" viewBox="0 0 24 24">
<line x1="2" y1="4" x2="22" y2="4" id="top" />
<line x1="2" y1="12" x2="22" y2="12" id="middle-down" />
<line x1="2" y1="12" x2="22" y2="12" id="middle-up" />
<line x1="2" y1="20" x2="22" y2="20" id="bottom" />
</svg>
</button>
</nav>
</header>
<main>
<div class="hero ">
<p>Show a list of available fonts in your browser</p>
</div>
<div id="flist" class="_mt-1">
</div>
<footer class="_bg _radius _aos _mt-1">
<div class="cnt ">
<div class="grid">
<div>Icons by <b><a href="https://heroicons.dev/">Heroicons</a> (<a
href="https://github.com/tailwindlabs/heroicons/blob/master/LICENSE"
class="_txt-cl">MIT</a>)</b>
</div>
<div>
Designed by Eduard Ursu(<b><a href="https://d3ward.github.io">d3ward</a></b>) © 2021
</div>
<div>
This website use <b><a href="https://www.useaurora.app/">Aurora - Open Web Analytics</a></b>
</div>
<div>
Licensed under <b><a
href="https://creativecommons.org/licenses/by-nc-sa/4.0/">[NC-SA-4.0]</a></b>
</div>
</div>
</div>
</footer>
</main>
<button class="gt-link hide" id="gt-link">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 12 6">
<path d="M12 6H0l6-6z" /></svg>
</button>
</body>
<script src="./src/js/script.js"></script>
<script>
/**
* JavaScript code to detect available availability of a
* particular font in a browser using JavaScript and CSS.
*
* Author : Lalit Patel
* Website: http://www.lalit.org/lab/javascript-css-font-detect/
* License: Apache Software License 2.0
* http://www.apache.org/licenses/LICENSE-2.0
* Version: 0.15 (21 Sep 2009)
* Changed comparision font to default from sans-default-default,
* as in FF3.0 font of child element didn't fallback
* to parent element if the font is missing.
* Version: 0.2 (04 Mar 2012)
* Comparing font against all the 3 generic font families ie,
* 'monospace', 'sans-serif' and 'sans'. If it doesn't match all 3
* then that font is 100% not available in the system
* Version: 0.3 (24 Mar 2012)
* Replaced sans with serif in the list of baseFonts
*/
/**
* Usage: d = new Detector();
* d.detect('font name');
*/
var Detector = function () {
// a font will be compared against all the three default fonts.
// and if it doesn't match all 3 then that font is not available.
var baseFonts = ['monospace', 'sans-serif', 'serif'];
//we use m or w because these two characters take up the maximum width.
// And we use a LLi so that the same matching fonts can get separated
var testString = "mmmmmmmmmmlli";
//we test using 72px font size, we may use any size. I guess larger the better.
var testSize = '72px';
var h = document.getElementsByTagName("body")[0];
// create a SPAN in the document to get the width of the text we use to test
var s = document.createElement("span");
s.style.fontSize = testSize;
s.innerHTML = testString;
var defaultWidth = {};
var defaultHeight = {};
for (var index in baseFonts) {
//get the default width for the three base fonts
s.style.fontFamily = baseFonts[index];
h.appendChild(s);
defaultWidth[baseFonts[index]] = s.offsetWidth; //width for the default font
defaultHeight[baseFonts[index]] = s.offsetHeight; //height for the defualt font
h.removeChild(s);
}
function detect(font) {
var detected = false;
for (var index in baseFonts) {
s.style.fontFamily = font + ',' + baseFonts[
index]; // name of the font along with the base font for fallback.
h.appendChild(s);
var matched = (s.offsetWidth != defaultWidth[baseFonts[index]] || s.offsetHeight != defaultHeight[
baseFonts[index]]);
h.removeChild(s);
detected = detected || matched;
}
return detected;
}
this.detect = detect;
};
var d = new Detector();
var list = ["Abadi MT Condensed Light", "Albertus Extra Bold", "Albertus Medium", "Antique Olive", "Arial",
"Arial Black", "Arial MT", "Arial Narrow", "Bazooka", "Book Antiqua", "Bookman Old Style", "Boulder",
"Calisto MT", "Calligrapher", "Century Gothic", "Century Schoolbook", "Cezanne", "CG Omega", "CG Times",
"Charlesworth", "Chaucer", "Clarendon Condensed", "Comic Sans MS", "Copperplate Gothic Bold",
"Copperplate Gothic Light", "Cornerstone", "Coronet", "Courier", "Courier New", "Cuckoo", "Dauphin",
"Denmark", "Fransiscan", "Garamond", "Geneva", "Haettenschweiler", "Heather", "Helvetica", "Herald",
"Impact", "Jester", "Letter Gothic", "Lithograph", "Lithograph Light", "Long Island", "Lucida Console",
"Lucida Handwriting", "Lucida Sans", "Lucida Sans Unicode", "Marigold", "Market", "Matisse ITC",
"MS LineDraw", "News GothicMT", "OCR A Extended", "Old Century", "Pegasus", "Pickwick", "Poster",
"Pythagoras", "Sceptre", "Sherwood", "Signboard", "Socket", "Steamer", "Storybook", "Subway", "Tahoma",
"Technical", "Teletype", "Tempus Sans ITC", "Times", "Times New Roman", "Times New Roman PS",
"Trebuchet MS", "Tristan", "Tubular", "Unicorn", "Univers", "Univers Condensed", "Vagabond", "Verdana",
"Westminster Allegro", "Amazone BT", "AmerType Md BT", "Arrus BT", "Aurora Cn BT", "AvantGarde Bk BT",
"AvantGarde Md BT", "BankGothic Md BT", "Benguiat Bk BT", "BernhardFashion BT", "BernhardMod BT", "BinnerD",
"Bremen Bd BT", "CaslonOpnface BT", "Charter Bd BT", "Charter BT", "ChelthmITC Bk BT", "CloisterBlack BT",
"CopperplGoth Bd BT", "English 111 Vivace BT", "EngraversGothic BT", "Exotc350 Bd BT", "Freefrm721 Blk BT",
"FrnkGothITC Bk BT", "Futura Bk BT", "Futura Lt BT", "Futura Md BT", "Futura ZBlk BT", "FuturaBlack BT",
"Galliard BT", "Geometr231 BT", "Geometr231 Hv BT", "Geometr231 Lt BT", "GeoSlab 703 Lt BT",
"GeoSlab 703 XBd BT", "GoudyHandtooled BT", "GoudyOLSt BT", "Humanst521 BT", "Humanst 521 Cn BT",
"Humanst521 Lt BT", "Incised901 Bd BT", "Incised901 BT", "Incised901 Lt BT", "Informal011 BT",
"Kabel Bk BT", "Kabel Ult BT", "Kaufmann Bd BT", "Kaufmann BT", "Korinna BT", "Lydian BT",
"Monotype Corsiva", "NewsGoth BT", "Onyx BT", "OzHandicraft BT", "PosterBodoni BT", "PTBarnum BT",
"Ribbon131 Bd BT", "Serifa BT", "Serifa Th BT", "ShelleyVolante BT", "Souvenir Lt BT", "Staccato222 BT",
"Swis721 BlkEx BT", "Swiss911 XCm BT", "TypoUpright BT", "ZapfEllipt BT", "ZapfHumnst BT",
"ZapfHumnst Dm BT", "Zurich BlkEx BT", "Zurich Ex BT"
]
const ul = document.querySelector("#flist");
list.forEach(element => {
var a = d.detect(element);
if (a) {
var li = document.createElement("div");
li.innerText = element;
li.className = "card";
li.style.fontFamily = element;
ul.appendChild(li);
}
console.log(a);
});
// Call the function when the DOM is loaded
document.addEventListener("DOMContentLoaded", () => {
new navbar();
new themeManager();
new gotop();
new aos();
});
</script>
</html>