Roxen.git / server / font_handlers / ttf.pike

version» Context lines:

Roxen.git/server/font_handlers/ttf.pike:1:   // This file is part of Roxen WebServer.   // Copyright © 1996 - 2004, Roxen IS.      #if !constant(Image.FreeType.Face)   #if constant(has_Image_TTF)   #include <config.h> - constant cvs_version = "$Id: ttf.pike,v 1.17 2004/06/30 16:58:49 mast Exp $"; + constant cvs_version = "$Id: ttf.pike,v 1.18 2008/08/15 12:33:54 mast Exp $";      constant name = "TTF fonts";   constant doc = "True Type font loader. Uses freetype to render text.";   constant scalable = 1;      inherit FontHandler;    - static mapping ttf_font_names_cache; + protected mapping ttf_font_names_cache;    - static string trimttfname( string n ) + protected string trimttfname( string n )   {    n = lower_case(replace( n, "\t", " " ));    return ((n/" ")*"")-"'";   }    - static string translate_ttf_style( string style ) + protected string translate_ttf_style( string style )   {    // Check for weight. Default is "n" for normal/regular/roman.    style = lower_case((style - "-") - " ");    string weight = "n";    if (has_value(style, "bold"))    weight = "b";    else if (has_value(style, "black"))    weight = "B";    else if (has_value(style, "light"))    weight = "l";
Roxen.git/server/font_handlers/ttf.pike:35: Inside #if !constant(Image.FreeType.Face)
   // Check for slant. Default is "n" for regular.    string slant = "n";    if (has_value(style, "italic") ||    has_value(style, "oblique"))    slant = "i";       // Combine to full style    return weight + slant;   }    - static void build_font_names_cache( ) + protected void build_font_names_cache( )   {    mapping ttf_done = ([ ]);    mapping new_ttf_font_names_cache=([]);    void traverse_font_dir( string dir )    {    foreach(r_get_dir( dir )||({}), string fname)    {    string path=combine_path(dir+"/",fname);    if(!ttf_done[path]++)    {
Roxen.git/server/font_handlers/ttf.pike:80: Inside #if !constant(Image.FreeType.Face)
   map( roxen->query("font_dirs"), traverse_font_dir );       ttf_font_names_cache = new_ttf_font_names_cache;   }            class TTFWrapper   {    inherit Font; -  static int size, rsize; -  static object real; -  static object encoder; -  static function(string ...:Image.image) real_write; -  static int fake_bold, fake_italic; +  protected int size, rsize; +  protected object real; +  protected object encoder; +  protected function(string ...:Image.image) real_write; +  protected int fake_bold, fake_italic;       int height( )    {    return rsize ? rsize : (rsize = text_extents("W")[1] );    }    -  static string _sprintf() +  protected string _sprintf()    {    return sprintf( "TTF(%O,%d)", real, size );    }    -  static Image.image write_encoded(string ... what) +  protected Image.image write_encoded(string ... what)    {    return real->write(@(encoder?    Array.map(what, lambda(string s) {    return encoder->clear()->    feed(s)->drain();    }):what));    }       // FIXME: Handle x_spacing    Image.Image write( string ... what )