Roxen.git/server/font_handlers/ttf.pike:1:
// This file is part of Roxen WebServer.
// Copyright © 1996 - 2000, Roxen IS.
#if !constant(Image.FreeType.Face)
#if constant(has_Image_TTF)
#include <config.h>
- constant cvs_version = "$Id: ttf.pike,v 1.12 2001/11/15 10:49:12 anders Exp $";
+ constant cvs_version = "$Id: ttf.pike,v 1.13 2002/02/06 12:32:23 jonasw 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;
static string trimttfname( string n )
Roxen.git/server/font_handlers/ttf.pike:145: Inside #if !constant(Image.FreeType.Face)
object r2 = Image.Image( rr->xsize()+2, rr->ysize() );
object r3 = rr*0.3;
for( int i = 0; i<2; i++ )
for( int j = 0; j<2; j++ )
r2->paste_alpha_color( r3, 255, 255, 255, i, j );
rr = r2->paste_alpha_color( rr, 255,255,255, 1,1 );
}
rr->setcolor( 0,0,0 );
if( fake_italic )
rr = rr->skewx( -(rr->ysize()/3) );
- return rr;
+ return rr->scale(0.5);
}
array text_extents( string what )
{
Image.Image o = write( what );
return ({ o->xsize(), o->ysize() });
}
void create(object r, int s, string fn, int fb, int fi)
{
string encoding;
fake_bold = fb;
fake_italic = fi;
real = r;
size = s;
- real->set_height( (int)(size*32/34.5) ); // aproximate to pixels
+ real->set_height( (int)(size*64/34.5) ); // aproximate to pixels
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, "");