Re[2]: [PHP-GTK-DEV] PangoFontDescription::set_size

From: Date: Mon, 19 Dec 2005 02:37:37 +0000
Subject: Re[2]: [PHP-GTK-DEV] PangoFontDescription::set_size
References: 1 2  Groups: php.gtk.dev 
Request: Send a blank email to php-gtk-dev+get-2129@lists.php.net to get a copy of this message
Hi, Sunday, December 18, 2005, 6:09:52 AM, you wrote: SF> Again, a test scipt would be useful here. I don't know about Andrei, but I SF> haven't even looked at Pango yet, internally or any other way, and it'll SF> probably be post-beta before this gets evaluated now... This time I'll give you the script (stupid newsgroup chopper) <?php if( !class_exists('gtk')) { die('Please load the php-gtk2 module in your php.ini' . "\r\n"); } class PangoDemo extends GtkWindow { protected $d_area; protected $color; function __construct($parent = null) { parent::__construct(); if (@$GLOBALS['framework']) { return; } if ($parent) $this->set_screen($parent->get_screen()); else{ $this->connect_simple('destroy', array('gtk', 'main_quit')); $this->set_default_size(400, 200); } $this->set_title(__CLASS__); $this->set_position(Gtk::WIN_POS_CENTER); $this->set_border_width(8); $this->add($this->__create_box()); $this->show_all(); } function __expose_event($da,$rect,$gc,$layout){ echo "Called\n"; $style = $da->style; //$gc = $style->text_gc[Gtk::STATE_NORMAL]; //var_dump($gc); $window = $da->window; //$gc = $style->text_gc[1]; $style->draw_layout($window,Gtk::STATE_NORMAL,1,5,5,$layout); } function __create_box() { //print_r($this); $da = new GtkDrawingArea(); $style = $da->style; //print_r($style); //da.set_size_request(width, height); $context = $da->get_pango_context(); $fontdescription = new PangoFontDescription("Georgia Bold 30"); //$fontdescription->set_weight(400); //$fontdescription->set_size(24); //$fontdescription->set_family("Script,Ariel"); //$fontdescription->from_string("Ariel Bold 0.4"); //$context->set_font_description($fontdescription); //$font = $context->get_font_description(); $family = $fontdescription->get_size(); echo $family,"\n"; //print_r($font->get_size()."\n"); $layout = new PangoLayout($context); $layout->set_font_description($fontdescription); $text = "<span color=\"blue\">Hello</span> <span color=\"red\">World</span>"; $layout->set_markup($text,strlen($text)); $da->connect('expose_event',array($this,'__expose_event'),$gc,$layout); return $da; } } $GLOBALS['class'] = 'PangoDemo'; $GLOBALS['description'] = 'Pango test'; if (!@$GLOBALS['framework']) { new PangoDemo(); Gtk::main(); } -- regards, Tom

« previous php.gtk.dev (#2129) next »