File Coverage

blib/lib/Config/Apple/Profile/Payload/Font.pm
Criterion Covered Total %
statement 30 30 100.0
branch n/a
condition n/a
subroutine 10 10 100.0
pod n/a
total 40 40 100.0


line stmt bran cond sub pod time code
1             # This is the code for Config::Apple::Profile::Payload::Font.
2             # For Copyright, please see the bottom of the file.
3              
4             package Config::Apple::Profile::Payload::Font;
5              
6 2     2   1605 use 5.10.1;
  2         6  
  2         74  
7 2     2   8 use strict;
  2         2  
  2         54  
8 2     2   8 use warnings FATAL => 'all';
  2         2  
  2         63  
9 2     2   8 use base qw(Config::Apple::Profile::Payload::Common);
  2         2  
  2         667  
10              
11             our $VERSION = '0.87.1';
12              
13 2     2   666 use Email::Valid;
  2         84826  
  2         144  
14 2     2   12 use Readonly;
  2         3  
  2         103  
15 2     2   10 use Regexp::Common;
  2         2  
  2         15  
16 2     2   1087 use Config::Apple::Profile::Targets qw(:all);
  2         4  
  2         233  
17 2     2   11 use Config::Apple::Profile::Payload::Common;
  2         3  
  2         42  
18 2     2   7 use Config::Apple::Profile::Payload::Types qw(:all);
  2         4  
  2         493  
19              
20              
21             =encoding utf8
22              
23             =head1 NAME
24              
25             Config::Apple::Profile::Payload::Font - The Font payload type.
26              
27             =head1 SYNOPSIS
28              
29             use Config::Apple::Profile;
30             use Config::Apple::Profile::Payload::Font;
31             use File::Spec;
32            
33             my $font_file_path = '/path/to/font.otf';
34            
35             my $font = new Config::Apple::Profile::Payload::Font;
36             my $payload = $email->payload;
37            
38             open my $font_file, '<', $font_file_path
39             or die "Unable to open font $font_file_path: $!";
40             $payload->{Font} = $font_file;
41              
42             my $profile = new Config::Apple::Profile::Profile;
43             push @{$profile->content}, $font;
44            
45             print $profile->export;
46              
47              
48             =head1 DESCRIPTION
49              
50             This class implements the Font payload, which is used to install new fonts
51             on a device running iOS. This profile is not used by Mac OS X.
52              
53             B No testing is performed of the Font data provided. The author is not
54             aware of any Perl modules that can be used to test opening OpenType (.otf)
55             files, except for C, which does not seem to be working.
56              
57              
58             =head1 PAYLOAD KEYS
59              
60             All of the payload keys defined in L
61             are used by this payload.
62              
63             This payload has the following additional keys:
64              
65             =head2 C
66              
67             I
68              
69             A string. This is the name the user sees at the time the Font is installed.
70             Once installed, the font's embedded PostScript name is what the user will see.
71              
72             =head2 C
73              
74             Data. This is the TrueType (.ttf) or OpenType (.otf) font file.
75              
76             B Font collections (.ttc or .otc) are not supported. Use separate
77             payloads for each font.
78              
79             B Each font installed must have a unique embedded PostScript name. If
80             multiple fonts with the same embedded PostScript name are installed, only one
81             will be displayed to the user; which one is actually used is undefined.
82              
83             =cut
84              
85             Readonly our %payloadKeys => (
86             # Bring in the common keys...
87             %Config::Apple::Profile::Payload::Common::payloadKeys,
88            
89             # ... and define our own!
90             'Name' => {
91             type => $ProfileString,
92             description => 'Font name shown during installation.',
93             optional => 1,
94             targets => {
95             $TargetIOS => '5.0',
96             },
97             },
98             'Font' => {
99             type => $ProfileData,
100             description => 'The TrueType (.ttf) or OpenType (.otf) font file.',
101             targets => {
102             $TargetIOS => '5.0',
103             },
104             },
105            
106             # Finish with basic payload information
107             'PayloadType' => {
108             type => $ProfileString,
109             value => 'com.apple.font',
110             targets => {
111             $TargetIOS => '5.0',
112             },
113             },
114             'PayloadVersion' => {
115             type => $ProfileNumber,
116             value => 1,
117             targets => {
118             $TargetIOS => '5.0',
119             },
120             },
121             ); # End of %payloadKeys
122              
123              
124             =head1 ACKNOWLEDGEMENTS
125              
126             Refer to L for acknowledgements.
127              
128             =head1 AUTHOR
129              
130             A. Karl Kornel, C<< >>
131              
132             =head1 COPYRIGHT AND LICENSE
133              
134             Copyright © 2014 A. Karl Kornel.
135              
136             This program is free software; you can redistribute it and/or modify it
137             under the terms of either: the GNU General Public License as published
138             by the Free Software Foundation; or the Artistic License.
139              
140             See L for more information.
141              
142             =cut
143              
144             1;