2b165b | 2001-09-26 | Martin Nilsson | |
|
f41b98 | 2009-05-07 | Martin Stjernholm | |
|
2b165b | 2001-09-26 | Martin Nilsson | |
|
6a7845 | 2000-09-04 | Per Hedbor | | #include <config.h>
|
207885 | 2000-12-11 | Per Hedbor | | #if constant(Image.FreeType.Face)
inherit "freetype";
#else
|
6d8c52 | 2000-09-19 | Per Hedbor | | inherit "ttf";
|
207885 | 2000-12-11 | Per Hedbor | | #endif
|
f41b98 | 2009-05-07 | Martin Stjernholm | | constant cvs_version = "$Id: builtin.pike,v 1.16 2009/05/07 14:15:53 mast Exp $";
|
6a7845 | 2000-09-04 | Per Hedbor | |
constant name = "Builtin fonts";
constant doc = "Fonts included in pike (and roxen)";
inherit FontHandler;
array available_fonts()
{
return ({ "pike builtin", "roxen builtin" });
}
array(mapping) font_information( string fnt )
{
switch( replace(lower_case(fnt)," ","_")-"_" )
{
|
6d8c52 | 2000-09-19 | Per Hedbor | | case "roxenbuiltin":
|
de2152 | 2000-09-27 | Per Hedbor | | #if constant(__rbf) && constant(grbf)
|
6a7845 | 2000-09-04 | Per Hedbor | | return ({
([
|
6d8c52 | 2000-09-19 | Per Hedbor | | "name":"roxen builtin",
"family":"Roxen builtin font",
|
6a7845 | 2000-09-04 | Per Hedbor | | "path":"-",
"style":"normal",
|
6d8c52 | 2000-09-19 | Per Hedbor | | "format":"scalable vector font",
|
6a7845 | 2000-09-04 | Per Hedbor | | ])
});
|
6d8c52 | 2000-09-19 | Per Hedbor | | #endif
case "pikebuiltin":
|
6a7845 | 2000-09-04 | Per Hedbor | | return ({
([
|
6d8c52 | 2000-09-19 | Per Hedbor | | "name":"pike builtin",
"family":"Pike builtin font",
|
6a7845 | 2000-09-04 | Per Hedbor | | "path":"-",
"style":"normal",
|
6d8c52 | 2000-09-19 | Per Hedbor | | "format":"bitmap dump",
|
6a7845 | 2000-09-04 | Per Hedbor | | ])
});
}
}
array has_font( string name, int size )
{
switch( replace(lower_case(name)," ","_")-"_" )
{
case "pikebuiltin":
return ({ "nn" });
|
3f3ccd | 2001-08-21 | Per Hedbor | | case "roxenbuiltin":
return ({ "nn", "bn", "bi" });
|
6a7845 | 2000-09-04 | Per Hedbor | | }
return 0;
}
|
6d8c52 | 2000-09-19 | Per Hedbor | | object roxenbuiltin;
#ifdef THREADS
Thread.Mutex lock = Thread.Mutex();
#endif
|
6a7845 | 2000-09-04 | Per Hedbor | |
Font open( string name, int size, int bold, int italic )
{
switch( replace(lower_case(name)," ","_")-"_" )
{
|
6d8c52 | 2000-09-19 | Per Hedbor | | case "roxenbuiltin":
|
6d837a | 2005-02-25 | Henrik Grubbström (Grubba) | | Configuration conf = roxen->current_configuration->get();
License.Key license_key = conf && conf->getvar("license")->get_key();
if (license_key && license_key->type() == "personal")
return Image.Font();
|
207885 | 2000-12-11 | Per Hedbor | | #if constant(__rbf) && constant(grbf)
|
d2d4bf | 2001-02-01 | Per Hedbor | | #ifdef THREADS
|
34659f | 2000-12-11 | Per Hedbor | | object key = lock->lock();
|
d2d4bf | 2001-02-01 | Per Hedbor | | #endif
|
d094f7 | 2001-09-03 | Per Hedbor | | if( !roxenbuiltin )
if( mixed err = catch(roxenbuiltin = grbf()) )
|
632f51 | 2001-09-03 | Per Hedbor | | #ifdef DEBUG
|
d094f7 | 2001-09-03 | Per Hedbor | | werror("Failed to open builtin font: %s\n",
describe_backtrace( err ) );
|
632f51 | 2001-09-03 | Per Hedbor | | #else
;
#endif
|
b5a1a7 | 2001-08-21 | Per Hedbor | | if( roxenbuiltin )
#if constant(Image.FreeType.Face)
return FTFont( roxenbuiltin, size,"-", bold, italic );
|
207885 | 2000-12-11 | Per Hedbor | | #else
|
b5a1a7 | 2001-08-21 | Per Hedbor | | return TTFWrapper( roxenbuiltin(), size, "-", bold, italic);
|
207885 | 2000-12-11 | Per Hedbor | | #endif
|
6d8c52 | 2000-09-19 | Per Hedbor | | #endif
|
6a7845 | 2000-09-04 | Per Hedbor | | case "pikebuiltin":
return Image.Font();
}
}
|