The OpenNET Project / Index page

[ новости /+++ | форум | теги | ]

Каталог документации / Раздел "Perl" / Оглавление документа

Chapter 32. Font Selection

Inheritance Hierarchy

Object
   +--- Widget
         +--- Container
               +--- Notebook
                     +--- FontSelection
         

The FontSelection is a widget that allows the user to choose fonts and font styles. Most programmers don't use the FontSelection directly, but instead use a FontSelectionDialog .

The following function creates a FontSelection:

$font_selection = new Gtk::FontSelection();

To get the font from a FontSelection, call:

$font_selection->get_font();

If you only want the name of the currently selected font, you would call:

$font_selection->get_font_name();

To set the currently selected font, you would call:

$font_selection->set_font_name( $font_name );

Where $font_name is a string with the name of the font to load. This function returns a true value if the font was found, and a false value if one wasn't.

To limit the fonts shown, you can set a filter using:

font_dialog->set_filter( $filter_type,
                         $font_type,
                         $foundries,
                         $weights,
                         $slants,
                         $setwidths,
                         $spacings,
                         $charsets );

Where the options are:

$filter_type

The filter type may be either 'base' or 'user'. A base filter is permanent, but a user filter may be changed by the user.

$font_type

The types of fonts to show. This may be any combination of 'bitmap', 'scalable', 'scalable_bitmap', or 'all'.

$foundries

A list of strings containing the foundry names which will be shown, nor an empty list to show all foundries.

$weights

A list of strings containing the weight names which will be shown, or an empty list to show all weights.

$slants

A list of strings containing the slant names which will be shown, or an empty list to show all slants.

$setwidths

A list of strings containing the setwidth names which will be shown, or an empty list to show all setwidths.

$spacings

A list of strings containing the spacing names which will be shown, or an empty list to show all spacings.

$charsets

A list of strings containing the charset names which will be shown, or an empty list to show all charsets.

FontSelection's have an area where the text can be previewed. The text in this area can be get and set using:

$font_selection->get_preview_text();

$font_selection->set_preview_text( $text );




Партнёры:
PostgresPro
Inferno Solutions
Hosting by Hoster.ru
Хостинг:

Закладки на сайте
Проследить за страницей
Created 1996-2024 by Maxim Chirkov
Добавить, Поддержать, Вебмастеру