/
fonts_list.php
60 lines (48 loc) · 1.26 KB
/
fonts_list.php
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
<?php
$dir='fonts';
$dir2='fonts/test';
$fuentes=array();
$fuentes2=array();
#lista de fuentes
// Empty variables to start
$css = '';
if ($handle = opendir($dir)) {
/* This is the correct way to loop over the directory. */
while (false !== ($entry = readdir($handle))) {
#solo si son otf o ttf
if(strpos($entry,".otf") or strpos($entry,".ttf")){
array_push($fuentes, $entry);
}
}
closedir($handle);
}
if ($handle = opendir($dir2)) {
/* This is the correct way to loop over the directory. */
while (false !== ($entry = readdir($handle))) {
#solo si son otf o ttf
if(strpos($entry,".otf") or strpos($entry,".ttf")){
array_push($fuentes2, $entry);
}
}
closedir($handle);
}
foreach($fuentes as $fuente){
$css.="@font-face {
font-family: '".substr($fuente, 0, -4)."';
src: url('fonts/$fuente');
font-weight: normal;
font-style: normal;
}\n";
};
foreach($fuentes2 as $fuente){
$css.="@font-face {
font-family: '".substr($fuente, 0, -4)."';
src: url('fonts/test/$fuente');
font-weight: normal;
font-style: normal;
}\n";
};
// echo '<pre>';
// print_r(array_merge($fuentes, $fuentes2));
// echo '</pre>';
?>