Brian M. Ames
and 1 contributors

NAME

Rinchi::CIGIPP::SymbolTextDefinition - Perl extension for the Common Image Generator Interface - Symbol Text Definition data packet. data packet. =head1 SYNOPSIS

  use Rinchi::CIGIPP::SymbolTextDefinition;
  my $sym_text = Rinchi::CIGIPP::SymbolTextDefinition->new();

  $packet_type = $sym_text->packet_type();
  $packet_size = $sym_text->packet_size(243);
  $symbol_ident = $sym_text->symbol_ident(29183);
  $orientation = $sym_text->orientation(Rinchi::CIGIPP->LeftToRight);
  $alignment = $sym_text->alignment(Rinchi::CIGIPP->TopCenter);
  $font_ident = $sym_text->font_ident(Rinchi::CIGIPP->IGDefault);
  $font_size = $sym_text->font_size(83.754);
  $text = $sym_text->text("Hello World!");

DESCRIPTION

The Symbol Text Definition packet is used to define a string of text, as well as its alignment, orientation, font, and size.

Each text symbol is identified by a Symbol ID value that is unique from all other symbols (text or otherwise). Every symbol must be created independently with its own unique Symbol ID, even if two or more symbols are visually identical. Once a Symbol Text Definition packet describing a text symbol is sent to the IG, the definition of that symbol will not change. If any Symbol Text Definition, Symbol Circle Definition, Symbol Line Definition, or Symbol Clone packet specifying the same Symbol ID is then received, the existing symbol will be destroyed along with any children and a new symbol will be created using the new definition packet.

The Font ID attribute uniquely identifies a specific font and is defined by the IG. A font is a unique combination of typeface, style (such as italic), and weight (such as bold). Therefore, any special attribute of the font such as bold or italics shall be identified using a separate Font ID. Table 37 defines several default font styles; however, the exact typeface is IG-dependent. All other font assignments are IG-defined.

Font size is defined as the vertical space that a font occupies. This includes the cap height as well as the heights of any ascenders, descenders, accent marks, and vertical padding.

The text string is composed of multiple UTF-8 character data. The text must be terminated by NULL, or zero (0). If the terminating byte is not the last byte before an eight-byte boundary, then the remainder of the packet must be padded with zeroes up to the next eight-byte boundary. Zero-length text strings must be terminated with four bytes containing NULL to maintain eight-byte alignment. The maximum text length is dependent upon the sizes of the individual UTF-8 character data and, therefore, to a large extent, the language being used.

The Packet Size attribute must contain the number of bytes up to and including the Font Size attribute (a total of 12 bytes) and the total number of bytes within the text, including the terminating NULL and any padding. This value must be an even multiple of eight (8). For example, if the string "Hello World!" were sent to the IG, the packet size would be 12 + 24, or 32 bytes.

When the IG creates a new symbol, that symbol is always hidden by default. The symbol is not made visible until the Host sends a Symbol Control packet or Short Symbol Control packet with the Symbol State attribute set to Visible (1).

EXPORT

None by default.

#==============================================================================

new $sym_text = Rinchi::CIGIPP::SymbolTextDefinition->new()

Constructor for Rinchi::SymbolTextDefinition.

sub packet_type()
 $value = $sym_text->packet_type();

Data Packet Identifier.

This attribute identifies this data packet as the Symbol Text Definition packet. The value of this attribute must be 30.

sub packet_size([$newValue])
 $value = $sym_text->packet_size($newValue);

Data Packet Size.

This attribute indicates the number of bytes in this data packet. The value of this attribute must be an even multiple of 8 ranging from 16 to 248.

sub symbol_ident([$newValue])
 $value = $sym_text->symbol_ident($newValue);

Symbol ID.

This attribute specifies the identifier of the symbol that is being defined.

This identifier must be unique among all existing symbols. If a symbol with the specified identifier already exists, then that symbol and any children will be destroyed and a new symbol created.

sub orientation([$newValue])
 $value = $sym_text->orientation($newValue);

Orientation.

This attribute specifies the orientation of the text.

    LeftToRight   0
    TopToBottom   1
    RightToLeft   2
    BottomToTop   3
sub alignment([$newValue])
 $value = $sym_text->alignment($newValue);

Alignment.

This attribute specifies the position of the symbol's reference point in relation to the text. If the text has multiple lines, this attribute also determines whether the text is left-, center-, or right-justified.

    TopLeft        0
    TopCenter      1
    TopRight       2
    CenterLeft     3
    Center         4
    CenterRight    5
    BottomLeft     6
    BottomCenter   7
    BottomRight    8
sub font_ident([$newValue])
 $value = $sym_text->font_ident($newValue);

Font ID.

This attribute specifies the font to be used for this text symbol.

This document defines a set of default proportional (variable-width) and monospace (constant-width) font styles for interoperability; however, the exact typefaces used will be IG-dependent.

Font IDs 17 through 255 are entirely IG-defined.

    IGDefault                         0
    ProportionalSansSerif             1
    ProportionalSanSerifBold          2
    ProportionalSansSerifItalic       3
    ProportionalSansSerifBoldItalic   4
    ProportionalSerif                 5
    ProportionalSerifBold             6
    ProportionalSerifItalic           7
    ProportionalSerifBoldItalic       8
    MonospaceSansSerif                9
    MonospaceSansSerifBold            10
    MonospaceSansSerifItalic          11
    MonospaceSansSerifBoldItalic      12
    MonospaceSerif                    13
    MonospaceSerifBold                14
    MonospaceSerifItalic              15
    MonospaceSerifBoldItalic          16
sub font_size([$newValue])
 $value = $sym_text->font_size($newValue);

Font Size.

This attribute specifies the font size in terms of the vertical units defined by the symbol surface's 2D coordinate system (see CIGI ICD Section 3.4.5.1).

sub text([$newValue])
 $value = $sym_text->text($newValue);

Text.

These 8-bit data are used to store the UTF-8 code points in the string.

Note: The maximum length of the string, including a terminating NULL, is 236 bytes. The pack method will add terminating and padding NULLs as needed.

sub pack()
 $value = $sym_text->pack();

Returns the packed data packet.

sub unpack()
 $value = $sym_text->unpack();

Unpacks the packed data packet.

sub byte_swap()
 $obj_name->byte_swap();

Byte swaps the packed data packet.

SEE ALSO

Refer the the Common Image Generator Interface ICD which may be had at this URL: http://cigi.sourceforge.net/specification.php

AUTHOR

Brian M. Ames, <bmames@apk.net>

COPYRIGHT AND LICENSE

Copyright (C) 2009 by Brian M. Ames

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.6 or, at your option, any later version of Perl 5 you may have available.

2 POD Errors

The following errors were encountered while parsing the POD:

Around line 109:

'=item' outside of any '=over'

Around line 473:

You forgot a '=back' before '=head1'