| 1 |
# SPDX-License-Identifier: Artistic-1.0-Perl |
| 2 |
# Copyright (C) 2011 Simon Cozens |
| 3 |
package Text::Gr2::FeatureRef; |
| 4 |
|
| 5 |
=head1 NAME |
| 6 |
|
| 7 |
Text::Gr2::FeatureRef - References to font features |
| 8 |
|
| 9 |
=head1 METHODS |
| 10 |
|
| 11 |
=head2 values |
| 12 |
|
| 13 |
Returns all possible values for this feature |
| 14 |
|
| 15 |
=head2 id |
| 16 |
|
| 17 |
Returns the tag name of the features |
| 18 |
|
| 19 |
=cut |
| 20 |
|
| 21 |
sub values { |
| 22 |
my $self = shift; |
| 23 |
map { $self->value($_) } (0..$self->n_values - 1); |
| 24 |
} |
| 25 |
|
| 26 |
sub id { Text::Gr2::_decode(shift->_id) } |
| 27 |
|
| 28 |
=head2 label |
| 29 |
|
| 30 |
$lab = $self->label(Gr2->str_to_tag($language), $encoding) |
| 31 |
|
| 32 |
Returns an explanatory string for this font feature, in the given |
| 33 |
language and encoding format. Typically you want the label to be |
| 34 |
returned in UTF-8, which is encoding format 1. |
| 35 |
|
| 36 |
=head2 value_label |
| 37 |
|
| 38 |
Returns an explanatory string for a given value of this font feature. |
| 39 |
|
| 40 |
$lab = $self->value_label($setting_no, |
| 41 |
Gr2->str_to_tag($language), $encoding) |
| 42 |
|
| 43 |
Please note that this takes an integer setting number, not a FeatureVal |
| 44 |
object. |
| 45 |
|
| 46 |
Reading the C<print_features> subroutine of F<examples/gr2fonttest.pl> |
| 47 |
will make this all bit more clear. |
| 48 |
|
| 49 |
=head1 INTERNAL METHODS |
| 50 |
|
| 51 |
=head2 value |
| 52 |
|
| 53 |
Returns a given value by index. |
| 54 |
|
| 55 |
=head2 n_values |
| 56 |
|
| 57 |
Returns the number of feature values. |
| 58 |
|
| 59 |
=head2 feature_value |
| 60 |
|
| 61 |
Returns the current value of this feature. |
| 62 |
|
| 63 |
=head2 set_feature_value |
| 64 |
|
| 65 |
Sets the valuse of this feature. |
| 66 |
|
| 67 |
=cut |
| 68 |
|
| 69 |
|
| 70 |
|
| 71 |
1; |