Roxen.git
/
server
/
font_handlers
/
imagedir.pike
version
»
Context lines:
10
20
40
80
file
none
3
Roxen.git/server/font_handlers/imagedir.pike:1:
// This file is part of Roxen WebServer. // Copyright © 2000 - 2009, Roxen IS. #include <config.h> #include <stat.h>
-
constant cvs_version = "$Id: imagedir.pike,v 1.
17
2011
/
12
/
28
18
:
29
:
37
mast
Exp $";
+
constant cvs_version = "$Id: imagedir.pike,v 1.
18
2012
/
02
/
08
00
:
56
:
23
jonasw
Exp $";
constant name = "Image directory fonts"; constant doc = ("Handles a directory with images (in almost any format), each " "named after the character they will represent. Characters " "with codes larger than 127 or less than 48 are encoded like " "0xHEX where HEX is the code in hexadecimal. There must be a " "file named 'fontname' in the directory, the first line of " "that file is used as the name of the font"); inherit FontHandler;
Roxen.git/server/font_handlers/imagedir.pike:175:
what=(lower_case( replace(what," ","_") )/"\n")[0]-"\r"; if(sizeof(_meta_data)) meta_data[what]=_meta_data; return what; } void update_font_list() { font_list = ([]); foreach(roxen->query("font_dirs"), string dir) { dir = roxen_path (dir);
-
foreach( (get_dir( dir )||({})), string d )
-
if( Stdio.is_dir(
dir+d
) ) {
-
if( file_stat(
dir+d+
"/fontinfo" ) )
-
font_list[font_name(Stdio.read_bytes(
dir+d+
"/fontinfo"))]=
dir+d+
"/";
-
else if( file_stat(
dir+d+
"/fontname" ) )
-
font_list[font_name(Stdio.read_bytes(
dir+d+
"/fontname"))]=
dir+d+
"/";
+
foreach( (get_dir( dir )||({})), string d )
{
+
string fpath = combine_path(dir, d);
+
if( Stdio.is_dir(
fpath
) ) {
+
if( file_stat(
fpath +
"/fontinfo" ) )
+
font_list[font_name(Stdio.read_bytes(
fpath+
"/fontinfo"))]=
fpath+
"/";
+
else if( file_stat(
fpath+
"/fontname" ) )
+
font_list[font_name(Stdio.read_bytes(
fpath+
"/fontname"))]=
fpath+
"/";
} } }
-
+
}
array available_fonts() { #ifdef THREADS object key = lock->lock(); #endif array res = ({}); if( !font_list ) update_font_list(); return indices( font_list ); }