Roxen.git / server / font_handlers / freetype.pike

version» Context lines:

Roxen.git/server/font_handlers/freetype.pike:56:    if(catch(ttf = Image.FreeType.Face( combine_path(dir+"/",fname) )))    continue;    if(ttf)    {    mapping n = ttf->info();    string f = lower_case(n->family);    if(!new_ttf_font_names_cache[f])    new_ttf_font_names_cache[f] = ([]);    new_ttf_font_names_cache[f][ translate_ttf_style(n->style) ]    = combine_path(dir+"/",fname); +  if (n->ps_name && n->ps_name != f) +  { +  // Insert an alias name based on the ps_name +  // attribute for compatibility with Roxen 4.5 +  // which used an older version of FreeType (2.1.9) +  // where the ps_name was used as family_name. +  string family_alias = lower_case(n->ps_name); +  string style_alias = translate_ttf_style("Regular"); +  if (!new_ttf_font_names_cache[family_alias]) +  new_ttf_font_names_cache[family_alias] = ([]); +  new_ttf_font_names_cache[family_alias][style_alias] +  = combine_path(dir+"/",fname);    }    }    } -  +  }    };    map( roxen->query("font_dirs"), traverse_font_dir );       ttf_font_names_cache = new_ttf_font_names_cache;   }      Thread.Mutex lock = Thread.Mutex();      class FTFont   {    inherit Font;    protected int size;    protected Image.FreeType.Face face; -  protected object encoder; +  protected Charset.Encoder encoder;       array text_extents( string what )    {    Image.Image o = write( what );    return ({ o->xsize(), o->ysize() });    }       int height( )    {    return size;
Roxen.git/server/font_handlers/freetype.pike:298:    catch(face->attach_file( fn2 ));          if(r_file_stat(fn+".properties"))    parse_html(lopen(fn+".properties","r")->read(), ([]),    (["encoding":lambda(string tag, mapping m, string enc) {    encoding = enc;    }]));       if(encoding) -  encoder = Locale.Charset.encoder(encoding, ""); +  encoder = Charset.encoder(encoding, "");    }   }      array available_fonts(int(0..1)|void force_reload)   {   #ifdef THREADS    object key = lock->lock();   #endif    if( !ttf_font_names_cache || force_reload ) build_font_names_cache( );    return indices( ttf_font_names_cache );