Fwd: Re: label offsets characters





--- Sergei Steshenko <sergstesh yahoo com> wrote:

Date: Sat, 9 Sep 2006 02:28:00 -0700 (PDT)
From: Sergei Steshenko <sergstesh yahoo com>
Subject: Re: label offsets characters
To: Laurent Klinger <laurent alcinoe net>



--- Laurent Klinger <laurent alcinoe net> wrote:

Hi,

  I'm new to gtk-perl, and I'm trying to build an app to help
me learn japanese characters. It works fairly well, except that
all hiranaga characters seem to be offset towards the top,
and consequently, some characters appear "shaved" of a few
pixels on the top. The short script below demonstrates this.
It simply creates a window containing a label, displaying
a single hiragana character, the one for the 'zo' syllable.

At least on my machine, the tiny window displays the zo character,
but it clashes with the window title bar. However, on resizing
the window, the whole character appears. (attachment shows an
example before and after resizing.) By the way, I'm running
Ubuntu (6.06) with the "standard" gtk2-perl (version says
1:1.102-1ubuntu1).

Any idea about why those characters are all offset in this way?

Thanks,

  laurent


-------8<------------------------------------------------
#! /usr/bin/perl -w
use strict;
use Gtk2 -init;
use Glib qw/TRUE FALSE/;

my $zo = '&#12382;';

my $label = Gtk2::Label->new( );
$label->set_markup( markup( $zo ) );

my $window = Gtk2::Window->new ('toplevel');
$window->signal_connect( delete_event => sub { Gtk2->main_quit; });

$window->add($label);
$window->show_all;

Gtk2->main;


sub markup
{
  return( '<span font_desc="Bitstream Vera Serif 32">' . $_[0] .
'</span>');
}

_______________________________________________
gtk-perl-list mailing list
gtk-perl-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-perl-list



Well, Gtk2::Label appears to be derived from Gtk2::Misc; the latter has:

"
METHODS
       (xalign, yalign) = $misc->get_alignment


       $misc->set_alignment ($xalign, $yalign)


           * $xalign (double)
           * $yalign (double)
",

so Gtk2::Label has set_alignment too.

I think that practical range for $xalign, $yalign is 0..1 - 0.5 value means
middle both in the sense of left <-> right, top <-> bottom.

The above is written based on my experience with Gtk2::Frame, so I hope it holds
for Gtk2::Label too.

--Sergei.

Applications From Scratch: http://appsfromscratch.berlios.de/

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 



Applications From Scratch: http://appsfromscratch.berlios.de/

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]