Roxen.git
/
server
/
font_handlers
/
compactimgfile.pike
version
»
Context lines:
10
20
40
80
file
none
3
Roxen.git/server/font_handlers/compactimgfile.pike:1:
+
// This file is part of Roxen WebServer.
+
// Copyright © 2000 - 2009, Roxen IS.
+
#include <config.h> inherit "imagetar"; constant name = "Compact image file font"; constant doc = #"A compact image file. The format is very simple: <pre> 'CIF1' (4 bytes magic) 'fontname' (64 bytes name, \\0 terminated) for each char:
Roxen.git/server/font_handlers/compactimgfile.pike:104:
fname -= "/"; if( fname == "fontname" ) { fd->seek( 4 ); return StringFile( fd->read( 64 )-"\0" ); } // werror("open "+fname+"\n"); int wc; sscanf( fname, "%s.", fname ); if( strlen(fname) > 2 ) sscanf( fname, "0x%x", wc ); else wc=fname[0];
-
int c;
+
if( fname == "fontinfo" ) wc = 0xffffffff; if( offsets[ wc ] ) { fd->seek( offsets[ wc ] ); if( wc <= 0x7fffffff ) // Normal character return StringFile( prefix+fd->read( getint() ) ); return StringFile( fd->read( getint() ) );
Roxen.git/server/font_handlers/compactimgfile.pike:159:
return res; } void update_font_list() { font_list = ([]); void rec_find_in_dir( string dir ) { foreach( get_dir( dir )||({}), string pd ) {
-
if(
file
_
stat
(
dir+pd
)
[
ST_SIZE
]
==
-2
)
//
isdir
-
rec_find_in_dir(
dir+pd+"/"
);
+
string
fpath = combine
_
path
(
dir,
pd
)
;
+
if( Stdio.is_dir( fpath
)
)
+
rec_find_in_dir(
fpath
);
else if( glob( "*.cif", pd ) ) {
-
CIF t = open_tar(
dir+pd
);
+
CIF t = open_tar(
fpath
);
if( Stdio.File f = t->open( "fontname", "r" ) ) { string name = f->read(); if( Stdio.File f = t->open( "fontinfo", "r" ) )
-
font_list[font_name( "<name>"+name+"</name>"+f->read() )] =
dir+pd
;
+
font_list[font_name( "<name>"+name+"</name>"+f->read() )] =
fpath
;
else
-
font_list[font_name( name )] =
dir+pd
;
+
font_list[font_name( name )] =
fpath
;
} else destruct( t ); } } }; foreach(roxen->query("font_dirs"), string dir)
-
rec_find_in_dir( dir );
+
rec_find_in_dir(
roxen_path (
dir
)
);
}