lib/LaTeXML/Common/Font.pm

filter: Statementstmt 14.8% 55 / 371 Branchbran 0.0% 0 / 278 Conditioncond 0.0% 0 / 170 MC/DCmcdc 0.0% 0 / 101 Subroutinesub 17.6% 9 / 51 Podpod 9.5% 4 / 42 totaltotal 6.7% 68 / 1013 CC 203 SCAR 60.8
CC
203
Cov
7%
merge
1332.0
specialize
930.0
computeBoxesSize
552.0
CRAP 434.9
« lib/LaTeXML/Util/Image.pm ↑ Summary lib/LaTeXML/Util/Pack.pm »
1 # /=====================================================================\ #
2 # | LaTeXML::Common::Font | #
3 # | Representaion of Fonts | #
4 # |=====================================================================| #
5 # | Part of LaTeXML: | #
6 # | Public domain software, produced as part of work done by the | #
7 # | United States Government & not subject to copyright in the US. | #
8 # |---------------------------------------------------------------------| #
9 # | Bruce Miller <bruce.miller@nist.gov> #_# | #
10 # | http://dlmf.nist.gov/LaTeXML/ (o o) | #
11 # \=========================================================ooo==U==ooo=/ #
12 package LaTeXML::Common::Font;
13 4 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
14 4 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
15 4 ▶use LaTeXML::Global;
Subroutine BEGIN: called CC=1 SCAR=0.0
16 4 ▶use LaTeXML::Core::Token;
Subroutine BEGIN: called CC=1 SCAR=0.0
17 4 ▶use LaTeXML::Common::Error;
Subroutine BEGIN: called CC=1 SCAR=0.0
18 4 ▶use LaTeXML::Common::Object;
Subroutine BEGIN: called CC=1 SCAR=0.0
19 4 ▶use LaTeXML::Common::Dimension;
Subroutine BEGIN: called CC=1 SCAR=0.0
20 4 ▶use List::Util qw(min max sum);
Subroutine BEGIN: called CC=1 SCAR=0.0
21 4 ▶use base qw(LaTeXML::Common::Object);
Subroutine BEGIN: called CC=1 SCAR=0.0
22  
23 # Note that this has evolved way beynond just "font",
24 # but covers text properties (or even display properties) in general
25 # including basic font information, color & background color
26 # as well as encoding and language information.
27  
28 # NOTE: This is now in Common that it may evolve to be useful in Post processing...
29  
30 4 my $DEFFAMILY = 'serif'; # [CONSTANT]
31 4 my $DEFSERIES = 'medium'; # [CONSTANT]
32 4 my $DEFSHAPE = 'upright'; # [CONSTANT]
33 4 my $DEFCOLOR = 'black'; # [CONSTANT]
34 4 my $DEFBACKGROUND = 'white'; # [CONSTANT]
35 4 my $DEFOPACITY = '1'; # [CONSTANT]
36 4 my $DEFENCODING = 'OT1'; # [CONSTANT]
37 4 my $DEFLANGUAGE = undef;
38  
39 0 ▶sub DEFSIZE { return $STATE->lookupValue('NOMINAL_FONT_SIZE') || 10; }
Subroutine DEFSIZE: not called CC=2 SCAR=17.9
Pod undocumented
Condition0%0/2
$LaTeXML::Common::Font::STATE->lookupValue('NOMINAL_FONT_SIZE') || 10
l!l
00
MC/DC0%0/1
$LaTeXML::Common::Font::STATE->lookupValue('NOMINAL_FONT_SIZE') || 10
$LaTeXML::Common::Font::STATE->lookupValue('NOMINAL_FONT_SIZE')
Truth table0%0/2
A
A= $LaTeXML::Common::Font::STATE->lookupValue('NOMINAL_FONT_SIZE')
Aresult
11
00
40  
41 4 my $FLAG_FORCE_FAMILY = 0x1;
42 4 my $FLAG_FORCE_SERIES = 0x2;
43 4 my $FLAG_FORCE_SHAPE = 0x4;
44 4 my $FLAG_EMPH = 0x10;
45 #======================================================================
46 # Mappings from various forms of names or component names in TeX
47 # Given a font, we'd like to map it to the "logical" names derived from LaTeX,
48 # (w/ loss of fine grained control).
49 # I'd like to use Karl Berry's font naming scheme
50 # (See http://www.tug.org/fontname/html/)
51 # but it seems to be a one-way mapping, and moreover, doesn't even fit CM fonts!
52 # We'll assume a sloppier version:
53 # family + series + variant + size
54 # NOTE: This probably doesn't really belong in here...
55  
56 4 my %font_family = (
57 cmr => { family => 'serif' }, cmss => { family => 'sansserif' },
58 cmtt => { family => 'typewriter' }, cmvtt => { family => 'typewriter' },
59 cmti => { family => 'typewriter', shape => 'italic' },
60 cmfib => { family => 'serif' }, cmfr => { family => 'serif' },
61 cmdh => { family => 'serif' }, cm => { family => 'serif' },
62 ptm => { family => 'serif' }, ppl => { family => 'serif' },
63 pnc => { family => 'serif' }, pbk => { family => 'serif' },
64 phv => { family => 'sansserif' }, pag => { family => 'serif' },
65 pcr => { family => 'typewriter' }, pzc => { family => 'script' },
66 put => { family => 'serif' }, bch => { family => 'serif' },
67 psy => { family => 'symbol' }, pzd => { family => 'dingbats' },
68 ccr => { family => 'serif' }, ccy => { family => 'symbol' },
69 cmbr => { family => 'sansserif' }, cmtl => { family => 'typewriter' },
70 cmbrs => { family => 'symbol' }, ul9 => { family => 'typewriter' },
71 txr => { family => 'serif' }, txss => { family => 'sansserif' },
72 txtt => { family => 'typewriter' }, txms => { family => 'symbol' },
73 txsya => { family => 'symbol' }, txsyb => { family => 'symbol' },
74 pxr => { family => 'serif' }, pxms => { family => 'symbol' },
75 pxsya => { family => 'symbol' }, pxsyb => { family => 'symbol' },
76 futs => { family => 'serif' },
77 uaq => { family => 'serif' }, ugq => { family => 'sansserif' },
78 eur => { family => 'serif' }, eus => { family => 'script' },
79 euf => { family => 'fraktur' }, euex => { family => 'symbol' },
80 # The following are actually math fonts.
81 ms => { family => 'symbol' },
82 ccm => { family => 'serif', shape => 'italic' },
83 cmm => { family => 'italic', encoding => 'OML' },
84 cmex => { family => 'symbol', encoding => 'OMX' }, # Not really symbol, but...
85 cmsy => { family => 'symbol', encoding => 'OMS' },
86 ccitt => { family => 'typewriter', shape => 'italic' },
87 cmbrm => { family => 'sansserif', shape => 'italic' },
88 futm => { family => 'serif', shape => 'italic' },
89 futmi => { family => 'serif', shape => 'italic' },
90 txmi => { family => 'serif', shape => 'italic' },
91 pxmi => { family => 'serif', shape => 'italic' },
92 bbm => { family => 'blackboard' },
93 bbold => { family => 'blackboard' },
94 bbmss => { family => 'blackboard' },
95 # some ams fonts
96 cmmib => { family => 'italic', series => 'bold' },
97 cmbsy => { family => 'symbol', series => 'bold' },
98 msa => { family => 'symbol', encoding => 'AMSa' },
99 msb => { family => 'symbol', encoding => 'AMSb' },
100 # Are these really the same?
101 msx => { family => 'symbol', encoding => 'AMSa' },
102 msy => { family => 'symbol', encoding => 'AMSb' },
103 );
104  
105 # Maps the "series code" to an abstract font series name
106 4 my %font_series = (
107 '' => { series => 'medium' }, m => { series => 'medium' }, mc => { series => 'medium' },
108 b => { series => 'bold' }, bc => { series => 'bold' }, bx => { series => 'bold' },
109 sb => { series => 'bold' }, sbc => { series => 'bold' }, bm => { series => 'bold' });
110  
111 # Maps the "shape code" to an abstract font shape name.
112 4 my %font_shape = ('' => { shape => 'upright' }, n => { shape => 'upright' }, i => { shape => 'italic' }, it => { shape => 'italic' },
113 sl => { shape => 'slanted' }, sc => { shape => 'smallcaps' }, csc => { shape => 'smallcaps' });
114  
115 # These could be exported...
116 sub lookupFontFamily {
117 0 ▶ my ($familycode) = @_;
Subroutine lookupFontFamily: not called CC=1 SCAR=6.9
Pod undocumented
118 0 return $font_family{ ToString($familycode) }; }
119  
120 sub lookupFontSeries {
121 0 ▶ my ($seriescode) = @_;
Subroutine lookupFontSeries: not called CC=1 SCAR=6.9
Pod undocumented
122 0 return $font_series{ ToString($seriescode) }; }
123  
124 sub lookupFontShape {
125 0 ▶ my ($shapecode) = @_;
Subroutine lookupFontShape: not called CC=1 SCAR=6.9
Pod undocumented
126 0 return $font_shape{ ToString($shapecode) }; }
127  
128 # Symbolic font sizes, relative to the NOMINAL_FONT_SIZE (often 10)
129 # extended logical font sizes, based on nominal document size of 10pts
130 # Possibly should simply use absolute font point sizes, as declared in class...
131 4 my %font_size = (
132 tiny => 0.5, SMALL => 0.7, Small => 0.8, small => 0.9,
133 normal => 1.0, large => 1.2, Large => 1.44, LARGE => 1.728,
134 huge => 2.074, Huge => 2.488,
135 big => 1.2, Big => 1.6, bigg => 2.1, Bigg => 2.6,
136 );
137  
138 sub rationalizeFontSize {
139 0 ▶ my ($size) = @_;
Subroutine rationalizeFontSize: not called CC=3 SCAR=24.8
Pod undocumented
140 0 ▶ return unless defined $size;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $size 0 0 0
141 0 ▶ if (my $symbolic = $font_size{$size}) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $symbolic = $font_size{$size}) 0 0 0
142 0 return $symbolic * DEFSIZE(); }
143 0 return $size; }
144  
145 # convert to percent
146 sub relativeFontSize {
147 0 ▶ my ($newsize, $oldsize) = @_;
Subroutine relativeFontSize: not called CC=1 SCAR=6.9
Pod undocumented
148 0 return int(0.5 + 100 * $newsize / $oldsize) . '%'; }
149  
150 my $FONTREGEXP
151 1225 = '(' . join('|', sort { -($a cmp $b) } keys %font_family) . ')'
152 81 . '(' . join('|', sort { -($a cmp $b) } keys %font_series) . ')'
153 4 . '(' . join('|', sort { -($a cmp $b) } keys %font_shape) . ')'
154 . '(\d*)';
155  
156 sub decodeFontname {
157 0 ▶ my ($name, $at, $scaled) = @_;
Subroutine decodeFontname: not called CC=9 SCAR=45.0
Pod undocumented
158 0 ▶ if ($name =~ /^$FONTREGEXP$/o) {
Branch: 1 branch
BranchTrueFalseTotal
if ($name =~ /^$FONTREGEXP$/o) { } 0 0 0
159 0 my %props;
160 0 my ($fam, $ser, $shp, $size) = ($1, $2, $3, $4);
161 0 ▶ if (my $ffam = lookupFontFamily($fam)) { map { $props{$_} = $$ffam{$_} } keys %$ffam; }
Branch: 1 branch
BranchTrueFalseTotal
if (my $ffam = lookupFontFamily($fam)) 0 0 0
162 0 ▶ if (my $fser = lookupFontSeries($ser)) { map { $props{$_} = $$fser{$_} } keys %$fser; }
Branch: 1 branch
BranchTrueFalseTotal
if (my $fser = lookupFontSeries($ser)) 0 0 0
163 0 ▶ if (my $fsh = lookupFontShape($shp)) { map { $props{$_} = $$fsh{$_} } keys %$fsh; }
Branch: 1 branch
BranchTrueFalseTotal
if (my $fsh = lookupFontShape($shp)) 0 0 0
164 0 ▶ $size = 1 unless $size; # Yes, also if 0, "" (from regexp)
Branch: 1 branch
BranchTrueFalseTotal
unless $size 0 0 0
165 0 ▶ $size = $at if defined $at;
Branch: 1 branch
BranchTrueFalseTotal
if defined $at 0 0 0
166 0 ▶ $size *= $scaled if defined $scaled;
Branch: 1 branch
BranchTrueFalseTotal
if defined $scaled 0 0 0
167 0 $props{size} = $size;
168 # Experimental Hack !?!?!?
169 0 ▶ $props{encoding} = 'OT1' unless defined $props{encoding};
Branch: 1 branch
BranchTrueFalseTotal
unless defined $props{"encoding"} 0 0 0
170 0 return %props; }
171 else {
172 0 return; } }
173  
174 sub lookupTeXFont {
175 0 ▶ my ($fontname, $seriescode, $shapecode) = @_;
Subroutine lookupTeXFont: not called CC=4 SCAR=30.0
Pod undocumented
176 0 my %props;
177 0 ▶ if (my $ffam = lookupFontFamily($fontname)) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $ffam = lookupFontFamily($fontname)) 0 0 0
178 0 map { $props{$_} = $$ffam{$_} } keys %$ffam; }
179 0 ▶ if (my $fser = lookupFontSeries($seriescode)) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $fser = lookupFontSeries($seriescode)) 0 0 0
180 0 map { $props{$_} = $$fser{$_} } keys %$fser; }
181 0 ▶ if (my $fsh = lookupFontShape($shapecode)) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $fsh = lookupFontShape($shapecode)) 0 0 0
182 0 map { $props{$_} = $$fsh{$_} } keys %$fsh; }
183 0 return %props; }
184  
185 #======================================================================
186 # NOTE: Would it make sense to allow compnents to be `inherit' ??
187  
188 # Note: forcefamily, forceseries, forceshape (& forcebold for compatibility)
189 # are only useful for fonts in math; See the specialize method below.
190 sub new {
191 0 ▶ my ($class, %options) = @_;
Subroutine new: not called CC=5 SCAR=34.0
Pod undocumented
192 0 my $family = $options{family};
193 0 my $series = $options{series};
194 0 my $shape = $options{shape};
195 0 my $size = $options{size};
196 0 my $color = $options{color};
197 0 my $bg = $options{background};
198 0 my $opacity = $options{opacity};
199 0 my $encoding = $options{encoding};
200 0 my $language = $options{language};
201 0 my $mathstyle = $options{mathstyle};
202 0 ▶ if ($options{forcebold}) { # for compatibility
Branch: 1 branch
BranchTrueFalseTotal
if ($options{"forcebold"}) 0 0 0
203 0 $series = 'bold'; $options{forceseries} = 1; }
204 my $flags = 0
205 | ($options{forcefamily} ? $FLAG_FORCE_FAMILY : 0)
206 | ($options{forceseries} ? $FLAG_FORCE_SERIES : 0)
207 0 ▶ | ($options{forceshape} ? $FLAG_FORCE_SHAPE : 0);
Branch: 3 branches
BranchTrueFalseTotal
$options{'forcefamily'} ? : 0 0 0
$options{'forceseries'} ? : 0 0 0
$options{'forceshape'} ? : 0 0 0
208 0 return $class->new_internal(
209 $family, $series, $shape, rationalizeFontSize($size),
210 $color, $bg, $opacity,
211 $encoding, $language,
212 $mathstyle, $flags); }
213  
214 sub new_internal {
215 0 ▶ my ($class, @components) = @_;
Subroutine new_internal: not called CC=1 SCAR=6.9
Pod undocumented
216 0 return bless [@components], $class; }
217  
218 sub textDefault {
219 0 ▶ my ($self) = @_;
Subroutine textDefault: not called CC=1 SCAR=6.9
Pod undocumented
220 0 return $self->new_internal($DEFFAMILY, $DEFSERIES, $DEFSHAPE, DEFSIZE(),
221 $DEFCOLOR, $DEFBACKGROUND, $DEFOPACITY, $DEFENCODING, $DEFLANGUAGE, undef, 0); }
222  
223 sub mathDefault {
224 0 ▶ my ($self) = @_;
Subroutine mathDefault: not called CC=1 SCAR=6.9
Pod undocumented
225 0 return $self->new_internal('math', $DEFSERIES, 'italic', DEFSIZE(),
226 $DEFCOLOR, $DEFBACKGROUND, $DEFOPACITY, undef, $DEFLANGUAGE, 'text', 0); }
227  
228 # Accessors
229 # Using an array here is getting ridiculous!
230 0 ▶sub getFamily { my ($self) = @_; return $$self[0]; }
Subroutine getFamily: not called CC=1 SCAR=6.9
Pod undocumented
231 0 ▶sub getSeries { my ($self) = @_; return $$self[1]; }
Subroutine getSeries: not called CC=1 SCAR=6.9
Pod undocumented
232 0 ▶sub getShape { my ($self) = @_; return $$self[2]; }
Subroutine getShape: not called CC=1 SCAR=6.9
Pod undocumented
233 0 ▶sub getSize { my ($self) = @_; return $$self[3]; }
Subroutine getSize: not called CC=1 SCAR=6.9
Pod undocumented
234 0 ▶sub getColor { my ($self) = @_; return $$self[4]; }
Subroutine getColor: not called CC=1 SCAR=6.9
Pod undocumented
235 0 ▶sub getBackground { my ($self) = @_; return $$self[5]; }
Subroutine getBackground: not called CC=1 SCAR=6.9
Pod undocumented
236 0 ▶sub getOpacity { my ($self) = @_; return $$self[6]; }
Subroutine getOpacity: not called CC=1 SCAR=6.9
Pod undocumented
237 0 ▶sub getEncoding { my ($self) = @_; return $$self[7]; }
Subroutine getEncoding: not called CC=1 SCAR=6.9
Pod undocumented
238 0 ▶sub getLanguage { my ($self) = @_; return $$self[8]; }
Subroutine getLanguage: not called CC=1 SCAR=6.9
Pod undocumented
239 0 ▶sub getMathstyle { my ($self) = @_; return $$self[9]; }
Subroutine getMathstyle: not called CC=1 SCAR=6.9
Pod undocumented
240 0 ▶sub getFlags { my ($self) = @_; return $$self[10]; }
Subroutine getFlags: not called CC=1 SCAR=6.9
Pod undocumented
241  
242 sub toString {
243 0 ▶ my ($self) = @_;
Subroutine toString: not called CC=2 SCAR=17.9
Pod documented
244 0 ▶ return "Font[" . join(',', map { (defined $_ ? ToString($_) : '*') } @{$self}) . "]"; }
Branch: 1 branch
BranchTrueFalseTotal
defined $_ ? : 0 0 0
245  
246 # Perhaps it is more useful to list only the non-default components?
247 sub stringify {
248 0 ▶ my ($self) = @_;
Subroutine stringify: not called CC=12 SCAR=50.5
Pod documented
249 0 my ($fam, $ser, $shp, $siz, $col, $bkg, $opa, $enc, $lang, $mstyle, $flags) = @$self;
250 0 ▶ $fam = 'serif' if $fam && ($fam eq 'math');
Branch: 1 branch
BranchTrueFalseTotal
if $fam and $fam eq "math" 0 0 0
Condition0%0/3
$fam and $fam eq "math"
!ll&&!rl&&r
000
MC/DC0%0/2
$fam and $fam eq "math"
$fam $fam eq "math"
Truth table0%0/3
A and B
A= $famB= $fam eq "math"
ABresult
0X0
100
111
251 0 ▶ return 'Font[' . join(',', map { Stringify($_) } grep { $_ }
Branch: 9 branches
BranchTrueFalseTotal
isDiff($fam, $DEFFAMILY) ? : 0 0 0
isDiff($ser, $DEFSERIES) ? : 0 0 0
isDiff($shp, $DEFSHAPE) ? : 0 0 0
isDiff($siz, DEFSIZE()) ? : 0 0 0
isDiff($col, $DEFCOLOR) ? : 0 0 0
isDiff($bkg, $DEFBACKGROUND) ? : 0 0 0
isDiff($opa, $DEFOPACITY) ? : 0 0 0
$mstyle ? : 0 0 0
$flags ? : 0 0 0
252 (isDiff($fam, $DEFFAMILY) ? ($fam) : ()),
253 (isDiff($ser, $DEFSERIES) ? ($ser) : ()),
254 (isDiff($shp, $DEFSHAPE) ? ($shp) : ()),
255 (isDiff($siz, DEFSIZE()) ? ($siz) : ()),
256 (isDiff($col, $DEFCOLOR) ? ($col) : ()),
257 (isDiff($bkg, $DEFBACKGROUND) ? ($bkg) : ()),
258 (isDiff($opa, $DEFOPACITY) ? ($opa) : ()),
259 ($mstyle ? ($mstyle) : ()),
260 ($flags ? ($flags) : ()),
261 )
262 . ']'; }
263  
264 sub equals {
265 0 ▶ my ($self, $other) = @_;
Subroutine equals: not called CC=5 SCAR=34.0
Pod documented
266 return (defined $other) && ((ref $self) eq (ref $other))
267 0 ▶ && (join('|', map { (defined $_ ? $_ : '*') } @$self)
Branch: 1 branch
BranchTrueFalseTotal
defined $_ ? : 0 0 0
268 0 ▶ eq join('|', map { (defined $_ ? $_ : '*') } @$other)); }
Branch: 1 branch
BranchTrueFalseTotal
defined $_ ? : 0 0 0
Condition0%0/6
defined $other && ref $self eq ref $other && join('|', map({defined $_ ? $_ : '*';} @$self)) eq join('|', map({defined $_ ? $_ : '*';} @$other))
!ll&&!rl&&r
000
defined $other and ref $self eq ref $other
!ll&&!rl&&r
000
MC/DC0%0/3
defined $other && ref $self eq ref $other && join('|', map({defined $_ ? $_ : '*';} @$self)) eq join('|', map({defined $_ ? $_ : '*';} @$other))
defined $other ref $self eq ref $other join('|', map({defined $_ ? $_ : '*';} @$self)) eq join('|', map({defined $_ ? $_ : '*';} @$other))
Truth table0%0/4
A and B && C
A= defined $otherB= ref $self eq ref $otherC= join('|', map({defined $_ ? $_ : '*';} @$self)) eq join('|', map({defined $_ ? $_ : '*';} @$other))
ABCresult
0XX0
10X0
1100
1111
269  
270 sub match {
271 0 ▶ my ($self, $other) = @_;
Subroutine match: not called CC=7 SCAR=40.3
Pod undocumented
272 0 ▶ return 1 unless defined $other;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $other 0 0 0
273 0 ▶ return 0 unless (ref $self) eq (ref $other);
Branch: 1 branch
BranchTrueFalseTotal
unless ref $self eq ref $other 0 0 0
274 0 my @comp = @$self;
275 0 my @ocomp = @$other;
276 # If any components are defined in both fonts, they must be equal.
277 0 ▶ while (@comp) {
Branch: 1 branch
BranchTrueFalseTotal
if (@comp) 0 0 0
278 0 my $c = shift @comp;
279 0 my $oc = shift @ocomp;
280 0 ▶ return 0 if (defined $c) && (defined $oc) && ($c ne $oc); }
Branch: 1 branch
BranchTrueFalseTotal
if defined $c and defined $oc and $c ne $oc 0 0 0
Condition0%0/6
defined $c and defined $oc and $c ne $oc
!ll&&!rl&&r
000
defined $c and defined $oc
!ll&&!rl&&r
000
MC/DC0%0/3
defined $c and defined $oc and $c ne $oc
defined $c defined $oc $c ne $oc
Truth table0%0/4
A and B and C
A= defined $cB= defined $ocC= $c ne $oc
ABCresult
0XX0
10X0
1100
1111
281 0 return 1; }
282  
283 sub makeConcrete {
284 0 ▶ my ($self, $concrete) = @_;
Subroutine makeConcrete: not called CC=13 SCAR=52.0
Pod undocumented
285 0 my ($family, $series, $shape, $size, $color, $bg, $opacity, $encoding, $lang, $mstyle, $flags) = @$self;
286 0 my ($ofamily, $oseries, $oshape, $osize, $ocolor, $obg, $oopacity, $oencoding, $olang, $omstyle, $oflags) = @$concrete;
287 0 ▶ return (ref $self)->new_internal(
Branch: 1 branch
BranchTrueFalseTotal
defined $opacity ? : 0 0 0
Condition0%0/31
$family || $ofamily
l!l&&r!l&&!r
000
$series || $oseries
l!l&&r!l&&!r
000
$shape || $oshape
l!l&&r!l&&!r
000
$size || $osize
l!l&&r!l&&!r
000
$color || $ocolor
l!l&&r!l&&!r
000
$bg || $obg
l!l&&r!l&&!r
000
$encoding || $oencoding
l!l&&r!l&&!r
000
$lang || $olang
l!l&&r!l&&!r
000
$mstyle || $omstyle
l!l&&r!l&&!r
000
$flags || 0
l!l
00
$oflags || 0
l!l
00
MC/DC0%0/2
$family || $ofamily
$family $ofamily
MC/DC0%0/2
$series || $oseries
$series $oseries
MC/DC0%0/2
$shape || $oshape
$shape $oshape
MC/DC0%0/2
$size || $osize
$size $osize
MC/DC0%0/2
$color || $ocolor
$color $ocolor
MC/DC0%0/2
$bg || $obg
$bg $obg
MC/DC0%0/2
$encoding || $oencoding
$encoding $oencoding
MC/DC0%0/2
$lang || $olang
$lang $olang
MC/DC0%0/2
$mstyle || $omstyle
$mstyle $omstyle
MC/DC0%0/1
$flags || 0
$flags
MC/DC0%0/1
$oflags || 0
$oflags
Truth table0%0/3
A || B
A= $familyB= $ofamily
ABresult
1X1
011
000
Truth table0%0/3
A || B
A= $seriesB= $oseries
ABresult
1X1
011
000
Truth table0%0/3
A || B
A= $shapeB= $oshape
ABresult
1X1
011
000
Truth table0%0/3
A || B
A= $sizeB= $osize
ABresult
1X1
011
000
Truth table0%0/3
A || B
A= $colorB= $ocolor
ABresult
1X1
011
000
Truth table0%0/3
A || B
A= $bgB= $obg
ABresult
1X1
011
000
Truth table0%0/3
A || B
A= $encodingB= $oencoding
ABresult
1X1
011
000
Truth table0%0/3
A || B
A= $langB= $olang
ABresult
1X1
011
000
Truth table0%0/3
A || B
A= $mstyleB= $omstyle
ABresult
1X1
011
000
Truth table0%0/2
A
A= $flags
Aresult
11
00
Truth table0%0/2
A
A= $oflags
Aresult
11
00
288 $family || $ofamily, $series || $oseries, $shape || $oshape, $size || $osize,
289 $color || $ocolor, $bg || $obg, (defined $opacity ? $opacity : $oopacity),
290 $encoding || $oencoding, $lang || $olang, $mstyle || $omstyle,
291 ($flags || 0) | ($oflags || 0)); }
292  
293 sub isDiff {
294 0 ▶ my ($x, $y) = @_;
Subroutine isDiff: not called CC=3 SCAR=24.8
Pod undocumented
295 0 ▶ return (defined $x) && (!(defined $y) || ($x ne $y)); }
Condition0%0/6
defined $x && (!defined($y) || $x ne $y)
!ll&&!rl&&r
000
not defined $y or $x ne $y
l!l&&r!l&&!r
000
MC/DC0%0/3
defined $x && (!defined($y) || $x ne $y)
defined $x not defined $y $x ne $y
Truth table0%0/4
A && not(B) or C
A= defined $xB= not defined $yC= $x ne $y
ABCresult
0XX0
1000
11X1
1011
296  
297 # This method compares 2 fonts, returning the differences between them.
298 # Noting that the font-related attributes in the schema distill the
299 # font properties into fewer attributes (font,fontsize,color,background,opacity),
300 # the return value encodes both the attribute changes that would be needed to effect
301 # the font change, along with the font properties that differed
302 # Namely, the result is a hash keyed on the attribute name and whose value is a hash
303 # value => "new_attribute_value"
304 # properties => { %fontproperties }
305 # Note in particular 2 interesting keys
306 # element: can specify the element tagname to use for wrapping instead of ltx:text
307 # class: can be used to add a class attribute to the wrapping element
308 sub relativeTo {
309 0 ▶ my ($self, $other) = @_;
Subroutine relativeTo: not called CC=22 SCAR=62.3
Pod undocumented
310 0 my ($fam, $ser, $shp, $siz, $col, $bkg, $opa, $enc, $lang, $mstyle, $flags) = @$self;
311 0 my ($ofam, $oser, $oshp, $osiz, $ocol, $obkg, $oopa, $oenc, $olang, $omstyle, $oflags) = @$other;
312 0 ▶ $fam = 'serif' if $fam && ($fam eq 'math');
Branch: 1 branch
BranchTrueFalseTotal
if $fam and $fam eq "math" 0 0 0
Condition0%0/3
$fam and $fam eq "math"
!ll&&!rl&&r
000
MC/DC0%0/2
$fam and $fam eq "math"
$fam $fam eq "math"
Truth table0%0/3
A and B
A= $famB= $fam eq "math"
ABresult
0X0
100
111
313 0 ▶ $ofam = 'serif' if $ofam && ($ofam eq 'math');
Branch: 1 branch
BranchTrueFalseTotal
if $ofam and $ofam eq "math" 0 0 0
Condition0%0/3
$ofam and $ofam eq "math"
!ll&&!rl&&r
000
MC/DC0%0/2
$ofam and $ofam eq "math"
$ofam $ofam eq "math"
Truth table0%0/3
A and B
A= $ofamB= $ofam eq "math"
ABresult
0X0
100
111
314 ## my $emph = 0;
315 ## $emph ||= $shp && $shp =~ s/^emph-//;
316 ## ## $emph ||= $oshp && $oshp =~ s/^emph-//;
317 ## $oshp && $oshp =~ s/^emph-//;
318 0 ▶ my @diffs = (
Branch: 3 branches
BranchTrueFalseTotal
isDiff($fam, $ofam) ? : 0 0 0
isDiff($ser, $oser) ? : 0 0 0
isDiff($shp, $oshp) ? : 0 0 0
319 (isDiff($fam, $ofam) ? ($fam) : ()),
320 (isDiff($ser, $oser) ? ($ser) : ()),
321 (isDiff($shp, $oshp) ? ($shp) : ()));
322 return (
323 0 ▶ (@diffs ?
Branch: 10 branches
BranchTrueFalseTotal
@diffs ? : 0 0 0
isDiff($fam, $ofam) ? : 0 0 0
isDiff($ser, $oser) ? : 0 0 0
isDiff($shp, $oshp) ? : 0 0 0
isDiff($siz, $osiz) ? : 0 0 0
isDiff($col, $ocol) ? : 0 0 0
isDiff($bkg, $obkg) ? : 0 0 0
isDiff($opa, $oopa) ? : 0 0 0
isDiff($lang, $olang) ? : 0 0 0
!$mstyle && $flags && $flags & $FLAG_EMPH && !($oflags && $oflags & $FLAG_EMPH) ? : 0 0 0
Condition0%0/12
not $mstyle and $flags and $flags & $FLAG_EMPH and not $oflags && $oflags & $FLAG_EMPH
!ll&&!rl&&r
000
not $mstyle and $flags and $flags & $FLAG_EMPH
!ll&&!rl&&r
000
not $mstyle and $flags
!ll&&!rl&&r
000
$oflags && $oflags & $FLAG_EMPH
!ll&&!rl&&r
000
MC/DC0%0/5
not $mstyle and $flags and $flags & $FLAG_EMPH and not $oflags && $oflags & $FLAG_EMPH
not $mstyle $flags $flags & $FLAG_EMPH $oflags $oflags & $FLAG_EMPH
Truth table0%0/6
not(A) and B and C and not(D && E)
A= not $mstyleB= $flagsC= $flags & $FLAG_EMPHD= $oflagsE= $oflags & $FLAG_EMPH
ABCDEresult
0XXXX0
10XXX0
110XX0
111110
1110X1
111101
324 (font => { value => join(' ', @diffs),
325 properties => { (isDiff($fam, $ofam) ? (family => $fam) : ()),
326 (isDiff($ser, $oser) ? (series => $ser) : ()),
327 (isDiff($shp, $oshp) ? (shape => $shp) : ()) } })
328 : ()),
329 (isDiff($siz, $osiz)
330 ### ? (fontsize => { value => $siz, properties => { size => $siz } })
331 ? (fontsize => { value => relativeFontSize($siz, $osiz), properties => { size => $siz } })
332 : ()),
333 (isDiff($col, $ocol)
334 ? (color => { value => $col, properties => { color => $col } })
335 : ()),
336 (isDiff($bkg, $obkg)
337 ? (backgroundcolor => { value => $bkg, properties => { background => $bkg } })
338 : ()),
339 (isDiff($opa, $oopa)
340 ? (opacity => { value => $opa, properties => { opacity => $opa } })
341 : ()),
342 (isDiff($lang, $olang)
343 ? ('xml:lang' => { value => $lang, properties => { language => $lang } })
344 : ()),
345 (!$mstyle && $flags && ($flags & $FLAG_EMPH) && (!$oflags || !($oflags & $FLAG_EMPH))
346 ? (
347 # class => { value => 'ltx_emph' },
348 element => { value => 'ltx:emph' }
349 )
350 : ()),
351 ### Contemplate this: We do NOT want mathstyle showing up (automatically) in the attributes
352 ### So, we presumably want to ignore differences in mathstyle
353 ### They shouldn't (by themselves) affect the display?
354 ### (isDiff($mstyle, $omstyle)
355 ### ? ('mathstyle' => { value => $mstyle, properties => { mathstyle => $mstyle } })
356 ### : ()),
357 ); }
358  
359 sub distance {
360 0 ▶ my ($self, $other) = @_;
Subroutine distance: not called CC=14 SCAR=53.5
Pod undocumented
361 0 my ($fam, $ser, $shp, $siz, $col, $bkg, $opa, $enc, $lang, $mstyle, $flags) = @$self;
362 0 my ($ofam, $oser, $oshp, $osiz, $ocol, $obkg, $oopa, $oenc, $olang, $omstyle, $oflags) = @$other;
363 0 ▶ $fam = 'serif' if $fam && ($fam eq 'math');
Branch: 1 branch
BranchTrueFalseTotal
if $fam and $fam eq "math" 0 0 0
Condition0%0/3
$fam and $fam eq "math"
!ll&&!rl&&r
000
MC/DC0%0/2
$fam and $fam eq "math"
$fam $fam eq "math"
Truth table0%0/3
A and B
A= $famB= $fam eq "math"
ABresult
0X0
100
111
364 0 ▶ $ofam = 'serif' if $ofam && ($ofam eq 'math');
Branch: 1 branch
BranchTrueFalseTotal
if $ofam and $ofam eq "math" 0 0 0
Condition0%0/3
$ofam and $ofam eq "math"
!ll&&!rl&&r
000
MC/DC0%0/2
$ofam and $ofam eq "math"
$ofam $ofam eq "math"
Truth table0%0/3
A and B
A= $ofamB= $ofam eq "math"
ABresult
0X0
100
111
365 return
366 0 ▶ (isDiff($fam, $ofam) ? 1 : 0)
Branch: 9 branches
BranchTrueFalseTotal
isDiff($fam, $ofam) ? : 0 0 0
isDiff($ser, $oser) ? : 0 0 0
isDiff($shp, $oshp) ? : 0 0 0
isDiff($siz, $osiz) ? : 0 0 0
isDiff($col, $ocol) ? : 0 0 0
isDiff($bkg, $obkg) ? : 0 0 0
isDiff($opa, $oopa) ? : 0 0 0
isDiff($lang, $olang) ? : 0 0 0
$flags & $FLAG_EMPH ^ $oflags & $FLAG_EMPH ? : 0 0 0
367 + (isDiff($ser, $oser) ? 1 : 0)
368 + (isDiff($shp, $oshp) ? 1 : 0)
369 + (isDiff($siz, $osiz) ? 1 : 0)
370 + (isDiff($col, $ocol) ? 1 : 0)
371 + (isDiff($bkg, $obkg) ? 1 : 0)
372 + (isDiff($opa, $oopa) ? 1 : 0)
373 ## + (isDiff($enc,$oenc) ? 1 : 0)
374 + (isDiff($lang, $olang) ? 1 : 0)
375 # Let's not consider mathstyle differences here, either.
376 ### + (isDiff($mstyle, $omstyle) ? 1 : 0)
377 + (($flags & $FLAG_EMPH) ^ ($oflags & $FLAG_EMPH) ? 1 : 0)
378 ; }
379  
380 # This matches fonts when both are converted to strings (toString),
381 # such as when they are set as attributes.
382 # This accumulates regular expressions used by match_font
383 # (which, in turn, is used in various XPath searches!)
384 # It is NOT really Daemon safe....
385 # Need to work out how to do this and/or cache it in STATE????
386 4 our %FONT_REGEXP_CACHE = ();
387  
388 sub match_font {
389 0 ▶ my ($font1, $font2) = @_;
Subroutine match_font: not called CC=4 SCAR=30.0
Pod undocumented
390 0 my $regexp = $FONT_REGEXP_CACHE{$font1};
391 0 ▶ if (!$regexp) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($regexp) 0 0 0
392 0 ▶ if ($font1 =~ /^Font\[(.*)\]$/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($font1 =~ /^Font\[(.*)\]$/) 0 0 0
393 0 my @comp = split(',', $1);
394 my $re = '^Font\['
395 0 ▶ . join(',', map { ($_ eq '*' ? "[^,]+" : "\Q$_\E") } @comp)
Branch: 1 branch
BranchTrueFalseTotal
$_ eq '*' ? : 0 0 0
396 . '\]$';
397 0 print STDERR "\nCreating re for \"$font1\" => $re\n";
398 0 $regexp = $FONT_REGEXP_CACHE{$font1} = qr/$re/; } }
399 0 return $font2 =~ /$regexp/; }
400  
401 sub XXXfont_match_xpaths {
402 0 ▶ my ($font) = @_;
Subroutine XXXfont_match_xpaths: not called CC=9 SCAR=45.0
Pod undocumented
403 0 ▶ if ($font =~ /^Font\[(.*)\]$/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($font =~ /^Font\[(.*)\]$/) 0 0 0
404 0 my @comps = split(',', $1);
405 0 my ($frag, @frags) = ();
406 0 ▶ for (my $i = 0 ; $i <= $#comps ; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#comps) 0 0 0
407 0 my $comp = $comps[$i];
408 0 ▶ if ($comp eq '*') {
Branch: 1 branch
BranchTrueFalseTotal
if ($comp eq '*') { } 0 0 0
409 0 ▶ push(@frags, $frag) if $frag;
Branch: 1 branch
BranchTrueFalseTotal
if $frag 0 0 0
410 0 $frag = undef; }
411 else {
412 0 ▶ my $post = ($i == $#comps ? ']' : ',');
Branch: 1 branch
BranchTrueFalseTotal
$i == $#comps ? : 0 0 0
413 0 ▶ if ($frag) {
Branch: 1 branch
BranchTrueFalseTotal
if ($frag) { } 0 0 0
414 0 $frag .= $comp . $post; }
415 else {
416 0 ▶ $frag = ($i == 0 ? 'Font[' : ',') . $comp . $post; } } }
Branch: 1 branch
BranchTrueFalseTotal
$i == 0 ? : 0 0 0
417 0 ▶ push(@frags, $frag) if $frag;
Branch: 1 branch
BranchTrueFalseTotal
if $frag 0 0 0
418 return join(' and ', '@_font',
419 0 map { "contains(\@_font,'$_')" } @frags); } }
420  
421 sub font_match_xpaths {
422 0 ▶ my ($font) = @_;
Subroutine font_match_xpaths: not called CC=5 SCAR=34.0
Pod undocumented
423 0 ▶ if ($font =~ /^Font\[(.*)\]$/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($font =~ /^Font\[(.*)\]$/) 0 0 0
424 0 my ($family, $series, $shape, $size, $color, $bg, $opacity, $encoding, $language,
425 $mstyle, $force) = split(',', $1);
426 # Ignore differences in:
427 # size, background, opacity, encoding, language(?), mathstyle,
428 # force bits assumed NOT relevant, also.
429 # For now, ignore color, too
430 0 my @frags = ();
431 0 ▶ push(@frags, '[' . $family . ',') if ($family ne '*');
Branch: 1 branch
BranchTrueFalseTotal
if $family ne "*" 0 0 0
432 0 ▶ push(@frags, ',' . $series . ',') if ($series ne '*');
Branch: 1 branch
BranchTrueFalseTotal
if $series ne "*" 0 0 0
433 0 ▶ push(@frags, ',' . $shape . ',') if ($shape ne '*');
Branch: 1 branch
BranchTrueFalseTotal
if $shape ne "*" 0 0 0
434 # push(@frags, ',' . $color . ',') if ($color ne '*');
435 return join(' and ', '@_font',
436 0 map { "contains(\@_font,'$_')" } @frags); } }
437  
438 # # Presumably a text font is "sticky", if used in math?
439 # sub isSticky { return 1; }
440  
441 #======================================================================
442 4 our %mathstylesize = (display => 1, text => 1,
443 script => 0.7, scriptscript => 0.5);
444  
445 # NOTE: that we assume the size has already been adjusted for mathstyle, if necessary.
446 sub computeStringSize {
447 0 ▶ my ($self, $string) = @_;
Subroutine computeStringSize: not called CC=4 SCAR=30.0
Pod undocumented
448 0 ▶ my $size = ($self->getSize || DEFSIZE() || 10); ## * $mathstylesize{ $self->getMathstyle || 'text' };
Condition0%0/5
$self->getSize || DEFSIZE() || 10
l!l
00
$self->getSize or DEFSIZE()
l!l&&r!l&&!r
000
MC/DC0%0/2
$self->getSize || DEFSIZE() || 10
$self->getSize DEFSIZE()
Truth table0%0/3
A or B
A= $self->getSizeB= DEFSIZE()
ABresult
1X1
011
000
449 0 ▶ my $l = (defined $string ? length($string) : 0);
Branch: 1 branch
BranchTrueFalseTotal
defined $string ? : 0 0 0
450 0 my $u = $size * 65535;
451 0 return (Dimension(0.75 * $u * $l), Dimension(0.7 * $u), Dimension(0.2 * $u)); }
452  
453 # Get nominal width, height base ?
454 sub getNominalSize {
455 0 ▶ my ($self) = @_;
Subroutine getNominalSize: not called CC=3 SCAR=24.8
Pod undocumented
456 0 ▶ my $size = ($self->getSize || DEFSIZE() || 10); ## * $mathstylesize{ $self->getMathstyle || 'text' };
Condition0%0/5
$self->getSize || DEFSIZE() || 10
l!l
00
$self->getSize or DEFSIZE()
l!l&&r!l&&!r
000
MC/DC0%0/2
$self->getSize || DEFSIZE() || 10
$self->getSize DEFSIZE()
Truth table0%0/3
A or B
A= $self->getSizeB= DEFSIZE()
ABresult
1X1
011
000
457 0 my $u = $size * 65535;
458 0 return (Dimension(0.75 * $u), Dimension(0.7 * $u), Dimension(0.2 * $u)); }
459  
460 # Here's where I avoid trying to emulate Knuth's line-breaking...
461 # Mostly for List & Whatsit: compute the size of a list of boxes.
462 # Options _SHOULD_ include:
463 # width: if given, pretend to simulate line breaking to that width
464 # height,depth : ?
465 # vattach : top, bottom, center, baseline (...?) affects how the height & depth are
466 # allocated when there are multiple lines.
467 # layout : horizontal or vertical !!!
468 # Boxes that arent a Core Box, List, Whatsit or a string are IGNORED
469 #
470 # The big problem with width is to have it propogate down from where
471 # it may have been specified to the actual nested box that will get wrapped!
472 # Try to mask this (temporarily) by unlisting, and (pretending to ) breaking up too wide items
473 #
474 # Another issue; SVG needs (sometimes) real sizes, even if the programmer
475 # set some dimensions to 0 (eg.) We may need to distinguish & store
476 # requested vs real sizes?
477 sub computeBoxesSize {
478 0 ▶ my ($self, $boxes, %options) = @_;
Subroutine computeBoxesSize: not called CC=23 SCAR=63.1
Pod undocumented
479 0 ▶ my $font = (ref $self ? $self : $STATE->lookupValue('font'));
Branch: 1 branch
BranchTrueFalseTotal
ref $self ? : 0 0 0
480 0 my $fillwidth = $options{width};
481 0 ▶ if ((!defined $fillwidth) && ($fillwidth = $STATE->lookupDefinition(T_CS('\textwidth')))) {
Branch: 1 branch
BranchTrueFalseTotal
if (not defined $fillwidth and $fillwidth = $LaTeXML::Common::Font::STATE->lookupDefinition(T_CS("\\textwidth"))) 0 0 0
Condition0%0/3
not defined $fillwidth and $fillwidth = $LaTeXML::Common::Font::STATE->lookupDefinition(T_CS("\\textwidth"))
!ll&&!rl&&r
000
MC/DC0%0/2
not defined $fillwidth and $fillwidth = $LaTeXML::Common::Font::STATE->lookupDefinition(T_CS("\\textwidth"))
not defined $fillwidth $fillwidth = $LaTeXML::Common::Font::STATE->lookupDefinition(T_CS("\\textwidth"))
Truth table0%0/3
not(A) and B
A= not defined $fillwidthB= $fillwidth = $LaTeXML::Common::Font::STATE->lookupDefinition(T_CS("\\textwidth"))
ABresult
0X0
100
111
482 0 $fillwidth = $fillwidth->valueOf; } # get register
483 0 ▶ my $maxwidth = $fillwidth && $fillwidth->valueOf;
Condition0%0/3
$fillwidth && $fillwidth->valueOf
!ll&&!rl&&r
000
MC/DC0%0/2
$fillwidth && $fillwidth->valueOf
$fillwidth $fillwidth->valueOf
Truth table0%0/3
A && B
A= $fillwidthB= $fillwidth->valueOf
ABresult
0X0
100
111
484 0 my @lines = ();
485 0 my ($wd, $ht, $dp) = (0, 0, 0);
486 0 ▶ my $vattach = $options{vattach} || 'baseline';
Condition0%0/2
$options{'vattach'} || 'baseline'
l!l
00
MC/DC0%0/1
$options{'vattach'} || 'baseline'
$options{'vattach'}
Truth table0%0/2
A
A= $options{'vattach'}
Aresult
11
00
487 0 foreach my $box (@$boxes) {
488 0 ▶ next unless defined $box;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $box 0 0 0
489 0 ▶ next if ref $box && !$box->can('getSize'); # Care!! Since we're asking ALL args/compoments
Branch: 1 branch
BranchTrueFalseTotal
if ref $box and not $box->can("getSize") 0 0 0
Condition0%0/3
ref $box and not $box->can("getSize")
!ll&&!rl&&r
000
MC/DC0%0/2
ref $box and not $box->can("getSize")
ref $box not $box->can("getSize")
Truth table0%0/3
A and not(B)
A= ref $boxB= not $box->can("getSize")
ABresult
0X0
100
111
490 0 ▶ my ($w, $h, $d) = (ref $box ? $box->getSize(%options) : $font->computeStringSize($box));
Branch: 1 branch
BranchTrueFalseTotal
ref $box ? : 0 0 0
491 0 ▶ if (ref $w) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $w) { } 0 0 0
492 0 $wd += $w->valueOf; }
493 else {
494 0 Warn('expected', 'Dimension', undef,
495 "Width of " . Stringify($box) . " yeilded a non-dimension: " . Stringify($w)); }
496 0 ▶ if (ref $h) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $h) { } 0 0 0
497 0 $ht = max($ht, $h->valueOf); }
498 else {
499 0 Warn('expected', 'Dimension', undef,
500 "Height of " . Stringify($box) . " yeilded a non-dimension: " . Stringify($h)); }
501 0 ▶ if (ref $d) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $d) { } 0 0 0
502 0 $dp = max($dp, $d->valueOf); }
503 else {
504 0 Warn('expected', 'Dimension', undef,
505 "Depth of " . Stringify($box) . " yeilded a non-dimension: " . Stringify($d)); }
506 0 ▶ if ((($options{layout} || '') eq 'vertical') # EVERY box is a row?
Branch: 2 branches
BranchTrueFalseTotal
if (($options{'layout'} || '') eq 'vertical') { } 0 0 0
elsif (defined $maxwidth and $wd >= $maxwidth) { } 0 0 0
Condition0%0/2
$options{'layout'} || ''
l!l
00
MC/DC0%0/1
$options{'layout'} || ''
$options{'layout'}
Truth table0%0/2
A
A= $options{'layout'}
Aresult
11
00
507 # || $box is a <ltx:break> (or similar)!!!!
508 ) {
509 0 push(@lines, [$wd, $ht, $dp]); $wd = $ht = $dp = 0; }
510 ▶ elsif ((defined $maxwidth) && ($wd >= $maxwidth)) { # or we've reached the requested width
Condition0%0/3
defined $maxwidth and $wd >= $maxwidth
!ll&&!rl&&r
000
MC/DC0%0/2
defined $maxwidth and $wd >= $maxwidth
defined $maxwidth $wd >= $maxwidth
Truth table0%0/3
A and B
A= defined $maxwidthB= $wd >= $maxwidth
ABresult
0X0
100
111
511 # Compounding errors with wild abandon.
512 # If an underlying box is too wide, we'll split it up into multiple rows
513 # [Rather than correctly break it?]
514 # BUT How do we know if it should break at alL!?!?!?!?!
515 ## while ($wd >= $maxwidth) {
516 ## push(@lines, [$maxwidth, $ht, $dp]); $wd = $wd - $maxwidth; }
517 ## $ht = $h->valueOf; $dp = $d->valueOf; # continue with the leftover
518 0 push(@lines, [$wd, $ht, $dp]); $wd = $ht = $dp = 0;
519 }
520 }
521 0 ▶ if ($wd) { # be sure to get last line
Branch: 1 branch
BranchTrueFalseTotal
if ($wd) 0 0 0
522 0 push(@lines, [$wd, $ht, $dp]); }
523 # Deal with multiple lines
524 0 my $nlines = scalar(@lines);
525 0 ▶ if ($nlines == 0) {
Branch: 1 branch
BranchTrueFalseTotal
if ($nlines == 0) { } 0 0 0
526 0 $wd = $ht = $dp = 0; }
527 else {
528 0 $wd = max(map { $$_[0] } @lines);
529 0 $ht = sum(map { $$_[1] } @lines);
530 0 $dp = sum(map { $$_[2] } @lines);
531 0 ▶ if ($vattach eq 'top') { # Top of box is aligned with top(?) of current text
Branch: 3 branches
BranchTrueFalseTotal
if ($vattach eq 'top') { } 0 0 0
elsif ($vattach eq 'bottom') { } 0 0 0
elsif ($vattach eq 'middle') { } 0 0 0
532 0 my ($w, $h, $d) = $font->getNominalSize;
533 0 $h = $h->valueOf;
534 0 $dp = $ht + $dp - $h; $ht = $h; }
535 elsif ($vattach eq 'bottom') { # Bottom of box is aligned with bottom (?) of current text
536 0 $ht = $ht + $dp; $dp = 0; }
537 elsif ($vattach eq 'middle') {
538 0 my ($w, $h, $d) = $font->getNominalSize;
539 0 $h = $h->valueOf;
540 0 my $c = ($ht + $dp) / 2;
541 0 $ht = $c + $h / 2; $dp = $c - $h / 2; }
542 else { # default is baseline (of the 1st line)
543 0 my $h = $lines[0][1];
544 0 $dp = $ht + $dp - $h; $ht = $h; } }
545 #print "BOXES SIZE ".($wd/65536)." x ".($ht/65536)." + ".($dp/65336)." for "
546 # .join(' ',grep {$_} map { Stringify($_) } @$boxes)."\n";
547 0 return (Dimension($wd), Dimension($ht), Dimension($dp)); }
548  
549 sub isSticky {
550 0 ▶ my ($self) = @_;
Subroutine isSticky: not called CC=2 SCAR=17.9
Pod undocumented
551 0 ▶ return $$self[0] && ($$self[0] =~ /^(?:serif|sansserif|typewriter)$/); }
Condition0%0/3
$self->[0] && $self->[0] =~ /^(?:serif|sansserif|typewriter)$/
!ll&&!rl&&r
000
MC/DC0%0/2
$self->[0] && $self->[0] =~ /^(?:serif|sansserif|typewriter)$/
$self->[0] $self->[0] =~ /^(?:serif|sansserif|typewriter)$/
Truth table0%0/3
A && B
A= $self->[0]B= $self->[0] =~ /^(?:serif|sansserif|typewriter)$/
ABresult
0X0
100
111
552  
553 4 our %scriptstylemap = (display => 'script', text => 'script',
554 script => 'scriptscript', scriptscript => 'scriptscript');
555 4 our %fracstylemap = (display => 'text', text => 'script',
556 script => 'scriptscript', scriptscript => 'scriptscript');
557 4 our %stylesize = (display => 10, text => 10,
558 script => 7, scriptscript => 5);
559  
560 # NOTE: In math, NORMALLY, setting any one of
561 # family, series or shape
562 # will, usually, automatically reset the others to thier defaults!
563 # You must arrange this in the calls....
564 sub merge {
565 0 ▶ my ($self, %options) = @_;
Subroutine merge: not called CC=36 SCAR=71.9
Pod undocumented
566 # Evaluate any functional values given.
567 0 foreach my $k (keys %options) {
568 0 ▶ $options{$k} = &{ $options{$k} }() if ref $options{$k} eq 'CODE'; }
Branch: 1 branch
BranchTrueFalseTotal
if ref $options{$k} eq "CODE" 0 0 0
569  
570 0 my $family = $options{family};
571 0 my $series = $options{series};
572 0 my $shape = $options{shape};
573 0 my $size = rationalizeFontSize($options{size});
574 0 my $color = $options{color};
575 0 my $bg = $options{background};
576 0 my $opacity = $options{opacity};
577 0 my $encoding = $options{encoding};
578 0 my $language = $options{language};
579 0 my $mathstyle = $options{mathstyle};
580 0 ▶ if ($options{forcebold}) { # for compatibility
Branch: 1 branch
BranchTrueFalseTotal
if ($options{"forcebold"}) 0 0 0
581 0 $series = 'bold'; $options{forceseries} = 1; }
582 my $flags = 0
583 | ($options{forcefamily} ? $FLAG_FORCE_FAMILY : 0)
584 | ($options{forceseries} ? $FLAG_FORCE_SERIES : 0)
585 0 ▶ | ($options{forceshape} ? $FLAG_FORCE_SHAPE : 0);
Branch: 3 branches
BranchTrueFalseTotal
$options{'forcefamily'} ? : 0 0 0
$options{'forceseries'} ? : 0 0 0
$options{'forceshape'} ? : 0 0 0
586  
587 0 my $oflags = $$self[10];
588 # Fallback to positional invocation:
589 0 ▶ $family = $$self[0] if (!defined $family) || ($oflags & $FLAG_FORCE_FAMILY);
Branch: 1 branch
BranchTrueFalseTotal
if not defined $family or $oflags & $FLAG_FORCE_FAMILY 0 0 0
Condition0%0/3
not defined $family or $oflags & $FLAG_FORCE_FAMILY
l!l&&r!l&&!r
000
MC/DC0%0/2
not defined $family or $oflags & $FLAG_FORCE_FAMILY
not defined $family $oflags & $FLAG_FORCE_FAMILY
Truth table0%0/3
not(A) or B
A= not defined $familyB= $oflags & $FLAG_FORCE_FAMILY
ABresult
1X1
011
000
590 0 ▶ $series = $$self[1] if (!defined $series) || ($oflags & $FLAG_FORCE_SERIES);
Branch: 1 branch
BranchTrueFalseTotal
if not defined $series or $oflags & $FLAG_FORCE_SERIES 0 0 0
Condition0%0/3
not defined $series or $oflags & $FLAG_FORCE_SERIES
l!l&&r!l&&!r
000
MC/DC0%0/2
not defined $series or $oflags & $FLAG_FORCE_SERIES
not defined $series $oflags & $FLAG_FORCE_SERIES
Truth table0%0/3
not(A) or B
A= not defined $seriesB= $oflags & $FLAG_FORCE_SERIES
ABresult
1X1
011
000
591 0 ▶ $shape = $$self[2] if (!defined $shape) || ($oflags & $FLAG_FORCE_SHAPE);
Branch: 1 branch
BranchTrueFalseTotal
if not defined $shape or $oflags & $FLAG_FORCE_SHAPE 0 0 0
Condition0%0/3
not defined $shape or $oflags & $FLAG_FORCE_SHAPE
l!l&&r!l&&!r
000
MC/DC0%0/2
not defined $shape or $oflags & $FLAG_FORCE_SHAPE
not defined $shape $oflags & $FLAG_FORCE_SHAPE
Truth table0%0/3
not(A) or B
A= not defined $shapeB= $oflags & $FLAG_FORCE_SHAPE
ABresult
1X1
011
000
592 0 ▶ $size = $$self[3] if (!defined $size);
Branch: 1 branch
BranchTrueFalseTotal
unless defined $size 0 0 0
593 0 ▶ $color = $$self[4] if (!defined $color);
Branch: 1 branch
BranchTrueFalseTotal
unless defined $color 0 0 0
594 0 ▶ $bg = $$self[5] if (!defined $bg);
Branch: 1 branch
BranchTrueFalseTotal
unless defined $bg 0 0 0
595 0 ▶ $opacity = $$self[6] if (!defined $opacity);
Branch: 1 branch
BranchTrueFalseTotal
unless defined $opacity 0 0 0
596 0 ▶ $encoding = $$self[7] if (!defined $encoding);
Branch: 1 branch
BranchTrueFalseTotal
unless defined $encoding 0 0 0
597 0 ▶ $language = $$self[8] if (!defined $language);
Branch: 1 branch
BranchTrueFalseTotal
unless defined $language 0 0 0
598 0 ▶ $mathstyle = $$self[9] if (!defined $mathstyle);
Branch: 1 branch
BranchTrueFalseTotal
unless defined $mathstyle 0 0 0
599 0 ▶ $flags = ($$self[10] || 0) | $flags;
Condition0%0/2
$self->[10] || 0
l!l
00
MC/DC0%0/1
$self->[10] || 0
$self->[10]
Truth table0%0/2
A
A= $self->[10]
Aresult
11
00
600  
601 0 ▶ if (my $scale = $options{scale}) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $scale = $options{"scale"}) 0 0 0
602 0 $size = $scale * $size; }
603 # Set the mathstyle, and also the size from the mathstyle
604 # But we may need to scale that size against the existing or requested size.
605 0 ▶ my $stylescale = ($$self[3] ? $$self[3] / $stylesize{ $$self[9] || 'display' } : 1);
Branch: 1 branch
BranchTrueFalseTotal
$self->[3] ? : 0 0 0
Condition0%0/2
$self->[9] || 'display'
l!l
00
MC/DC0%0/1
$self->[9] || 'display'
$self->[9]
Truth table0%0/2
A
A= $self->[9]
Aresult
11
00
606 0 ▶ if ($options{size}) { } # Explicitly requested size, use it
Branch: 4 branches
BranchTrueFalseTotal
if ($options{'size'}) { } 0 0 0
elsif ($options{'mathstyle'}) { } 0 0 0
elsif ($options{'scripted'}) { } 0 0 0
elsif ($options{'fraction'}) { } 0 0 0
607 elsif ($options{mathstyle}) { # otherwise set the size from mathstyle
608 0 $size = $stylescale * $stylesize{$mathstyle}; }
609 elsif ($options{scripted}) { # Or adjust both the mathstyle & size for scripts
610 0 ▶ $mathstyle = $scriptstylemap{ $mathstyle || 'display' };
Condition0%0/2
$mathstyle || 'display'
l!l
00
MC/DC0%0/1
$mathstyle || 'display'
$mathstyle
Truth table0%0/2
A
A= $mathstyle
Aresult
11
00
611 0 ▶ $size = $stylescale * $stylesize{ $mathstyle || 'display' }; }
Condition0%0/2
$mathstyle || 'display'
l!l
00
MC/DC0%0/1
$mathstyle || 'display'
$mathstyle
Truth table0%0/2
A
A= $mathstyle
Aresult
11
00
612 elsif ($options{fraction}) { # Or adjust both for fractions
613 0 ▶ $mathstyle = $fracstylemap{ $mathstyle || 'display' };
Condition0%0/2
$mathstyle || 'display'
l!l
00
MC/DC0%0/1
$mathstyle || 'display'
$mathstyle
Truth table0%0/2
A
A= $mathstyle
Aresult
11
00
614 0 ▶ $size = $stylescale * $stylesize{ $mathstyle || 'display' }; }
Condition0%0/2
$mathstyle || 'display'
l!l
00
MC/DC0%0/1
$mathstyle || 'display'
$mathstyle
Truth table0%0/2
A
A= $mathstyle
Aresult
11
00
615  
616 0 ▶ if ($options{emph}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($options{"emph"}) 0 0 0
617 0 ▶ $shape = ($shape eq 'italic' ? 'upright' : 'italic');
Branch: 1 branch
BranchTrueFalseTotal
$shape eq 'italic' ? : 0 0 0
618 0 $flags |= $FLAG_EMPH; }
619 0 ▶ $flags &= ~$FLAG_EMPH if $mathstyle; # Disable emph in math
Branch: 1 branch
BranchTrueFalseTotal
if $mathstyle 0 0 0
620  
621 0 my $newfont = (ref $self)->new_internal($family, $series, $shape, $size,
622 $color, $bg, $opacity,
623 $encoding, $language,
624 $mathstyle, $flags);
625 0 ▶ if (my $specialize = $options{specialize}) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $specialize = $options{"specialize"}) 0 0 0
626 0 $newfont = $newfont->specialize($specialize); }
627 0 return $newfont; }
628  
629 # Instanciate the font for a particular class of symbols.
630 # NOTE: This works in `normal' latex, but probably needs some tunability.
631 # Depending on the fonts being used, the allowable combinations may be different.
632 # Getting the font right is important, since the author probably
633 # thinks of the identity of the symbols according to what they SEE in the printed
634 # document. Even though the markup might seem to indicate something else...
635  
636 # Use Unicode properties to determine font merging.
637 sub specialize {
638 0 ▶ my ($self, $string) = @_;
Subroutine specialize: not called CC=30 SCAR=68.4
Pod documented
639 0 ▶ return $self if !(defined $string) || ref $string; # ?
Branch: 1 branch
BranchTrueFalseTotal
if not defined $string or ref $string 0 0 0
Condition0%0/3
not defined $string or ref $string
l!l&&r!l&&!r
000
MC/DC0%0/2
not defined $string or ref $string
not defined $string ref $string
Truth table0%0/3
not(A) or B
A= not defined $stringB= ref $string
ABresult
1X1
011
000
640 0 my ($family, $series, $shape, $size, $color, $bg, $opacity,
641 $encoding, $language, $mathstyle, $flags) = @$self;
642 0 ▶ my $deffamily = ($flags & $FLAG_FORCE_FAMILY ? $family || $DEFFAMILY : $DEFFAMILY);
Branch: 1 branch
BranchTrueFalseTotal
$flags & $FLAG_FORCE_FAMILY ? : 0 0 0
Condition0%0/3
$family or $DEFFAMILY
l!l&&r!l&&!r
000
MC/DC0%0/2
$family or $DEFFAMILY
$family $DEFFAMILY
Truth table0%0/3
A or B
A= $familyB= $DEFFAMILY
ABresult
1X1
011
000
643 0 ▶ my $defseries = ($flags & $FLAG_FORCE_SERIES ? $series || $DEFSERIES : $DEFSERIES);
Branch: 1 branch
BranchTrueFalseTotal
$flags & $FLAG_FORCE_SERIES ? : 0 0 0
Condition0%0/3
$series or $DEFSERIES
l!l&&r!l&&!r
000
MC/DC0%0/2
$series or $DEFSERIES
$series $DEFSERIES
Truth table0%0/3
A or B
A= $seriesB= $DEFSERIES
ABresult
1X1
011
000
644 0 ▶ my $defshape = ($flags & $FLAG_FORCE_SHAPE ? $shape || $DEFSHAPE : $DEFSHAPE);
Branch: 1 branch
BranchTrueFalseTotal
$flags & $FLAG_FORCE_SHAPE ? : 0 0 0
Condition0%0/3
$shape or $DEFSHAPE
l!l&&r!l&&!r
000
MC/DC0%0/2
$shape or $DEFSHAPE
$shape $DEFSHAPE
Truth table0%0/3
A or B
A= $shapeB= $DEFSHAPE
ABresult
1X1
011
000
645 0 ▶ if (($string =~ /^\p{Latin}$/) && ($string =~ /^\p{L}$/)) { # Latin Letter
Branch: 3 branches
BranchTrueFalseTotal
if ($string =~ /^\p{Latin}$/ and $string =~ /^\p{L}$/) { } 0 0 0
elsif ($string =~ /^\p{Greek}$/) { } 0 0 0
elsif ($string =~ /^\p{N}$/) { } 0 0 0
Condition0%0/3
$string =~ /^\p{Latin}$/ and $string =~ /^\p{L}$/
!ll&&!rl&&r
000
MC/DC0%0/2
$string =~ /^\p{Latin}$/ and $string =~ /^\p{L}$/
$string =~ /^\p{Latin}$/ $string =~ /^\p{L}$/
Truth table0%0/3
A and B
A= $string =~ /^\p{Latin}$/B= $string =~ /^\p{L}$/
ABresult
0X0
100
111
646 0 ▶ $shape = 'italic' if !$shape && !$family; }
Branch: 1 branch
BranchTrueFalseTotal
unless $shape or $family 0 0 0
Condition0%0/3
$shape or $family
l!l&&r!l&&!r
000
MC/DC0%0/2
$shape or $family
$shape $family
Truth table0%0/3
A or B
A= $shapeB= $family
ABresult
1X1
011
000
647 elsif ($string =~ /^\p{Greek}$/) { # Single Greek character?
648 0 ▶ if ($string =~ /^\p{Lu}$/) { # Uppercase
Branch: 1 branch
BranchTrueFalseTotal
if ($string =~ /^\p{Lu}$/) { } 0 0 0
649 0 ▶ if (!$family || ($family eq 'math')) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $family or $family eq "math") 0 0 0
Condition0%0/3
not $family or $family eq "math"
l!l&&r!l&&!r
000
MC/DC0%0/2
not $family or $family eq "math"
not $family $family eq "math"
Truth table0%0/3
not(A) or B
A= not $familyB= $family eq "math"
ABresult
1X1
011
000
650 0 $family = $deffamily;
651 0 ▶ $shape = $defshape if $shape && ($shape ne $DEFSHAPE); } } # if ANY shape, must be default
Branch: 1 branch
BranchTrueFalseTotal
if $shape and $shape ne $DEFSHAPE 0 0 0
Condition0%0/3
$shape and $shape ne $DEFSHAPE
!ll&&!rl&&r
000
MC/DC0%0/2
$shape and $shape ne $DEFSHAPE
$shape $shape ne $DEFSHAPE
Truth table0%0/3
A and B
A= $shapeB= $shape ne $DEFSHAPE
ABresult
0X0
100
111
652 else { # Lowercase
653 0 ▶ $family = $deffamily if !$family || ($family ne $DEFFAMILY);
Branch: 1 branch
BranchTrueFalseTotal
if not $family or $family ne $DEFFAMILY 0 0 0
Condition0%0/3
not $family or $family ne $DEFFAMILY
l!l&&r!l&&!r
000
MC/DC0%0/2
not $family or $family ne $DEFFAMILY
not $family $family ne $DEFFAMILY
Truth table0%0/3
not(A) or B
A= not $familyB= $family ne $DEFFAMILY
ABresult
1X1
011
000
654 0 ▶ $shape = 'italic' if !$shape || !($flags & $FLAG_FORCE_SHAPE); # always ?
Branch: 1 branch
BranchTrueFalseTotal
unless $shape and $flags & $FLAG_FORCE_SHAPE 0 0 0
Condition0%0/3
$shape and $flags & $FLAG_FORCE_SHAPE
!ll&&!rl&&r
000
MC/DC0%0/2
$shape and $flags & $FLAG_FORCE_SHAPE
$shape $flags & $FLAG_FORCE_SHAPE
Truth table0%0/3
A and B
A= $shapeB= $flags & $FLAG_FORCE_SHAPE
ABresult
0X0
100
111
655 0 ▶ if ($series && ($series ne $DEFSERIES)) { $series = $defseries; }
Branch: 1 branch
BranchTrueFalseTotal
if ($series and $series ne $DEFSERIES) 0 0 0
Condition0%0/3
$series and $series ne $DEFSERIES
!ll&&!rl&&r
000
MC/DC0%0/2
$series and $series ne $DEFSERIES
$series $series ne $DEFSERIES
Truth table0%0/3
A and B
A= $seriesB= $series ne $DEFSERIES
ABresult
0X0
100
111
656 } }
657 elsif ($string =~ /^\p{N}$/) { # Digit
658 0 ▶ if (!$family || ($family eq 'math')) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $family or $family eq "math") 0 0 0
Condition0%0/3
not $family or $family eq "math"
l!l&&r!l&&!r
000
MC/DC0%0/2
not $family or $family eq "math"
not $family $family eq "math"
Truth table0%0/3
not(A) or B
A= not $familyB= $family eq "math"
ABresult
1X1
011
000
659 0 $family = $deffamily;
660 0 $shape = $defshape; } } # defaults, always.
661 else { # Other Symbol
662 0 $family = $deffamily;
663 0 $shape = $defshape; # defaults, always.
664 0 ▶ if ($series && ($series ne $DEFSERIES)) { $series = $defseries; } }
Branch: 1 branch
BranchTrueFalseTotal
if ($series and $series ne $DEFSERIES) 0 0 0
Condition0%0/3
$series and $series ne $DEFSERIES
!ll&&!rl&&r
000
MC/DC0%0/2
$series and $series ne $DEFSERIES
$series $series ne $DEFSERIES
Truth table0%0/3
A and B
A= $seriesB= $series ne $DEFSERIES
ABresult
0X0
100
111
665 0 return (ref $self)->new_internal($family, $series, $shape, $size,
666 $color, $bg, $opacity,
667 $encoding, $language, $mathstyle, $flags); }
668  
669 # A special form of merge when copying/moving nodes to a new context,
670 # particularly math which become scripts or such.
671 4 our %mathstylestep = (
672 display => { display => 0, text => 1, script => 2, scriptscript => 3 },
673 text => { display => -1, text => 0, script => 1, scriptscript => 2 },
674 script => { display => -2, text => -1, script => 0, scriptscript => 1 },
675 scriptscript => { display => -3, text => -2, script => -1, scriptscript => 0 });
676 4 our %stepmathstyle = (
677 display => { -3 => 'display', -2 => 'display', -1 => 'display',
678 0 => 'display', 1 => 'text', 2 => 'script', 3 => 'scriptscript' },
679 text => { -3 => 'display', -2 => 'display', -1 => 'display',
680 0 => 'text', 1 => 'script', 2 => 'scriptscript', 3 => 'scriptscript' },
681 script => { -3 => 'display', -2 => 'display', -1 => 'text',
682 0 => 'script', 1 => 'scriptscript', 2 => 'scriptscript', 3 => 'scriptscript' },
683 scriptscript => { -3 => 'display', -2 => 'text', -1 => 'script',
684 0 => 'scriptscript', 1 => 'scriptscript', 2 => 'scriptscript', 3 => 'scriptscript' });
685  
686 sub purestyleChanges {
687 0 ▶ my ($self, $other) = @_;
Subroutine purestyleChanges: not called CC=3 SCAR=24.8
Pod undocumented
688 0 my $mathstyle = $self->getMathstyle;
689 0 my $othermathstyle = $other->getMathstyle;
690 return (
691 scale => $other->getSize / $self->getSize,
692 color => $other->getColor,
693 background => $other->getBackground,
694 opacity => $other->getOpacity, # should multiply or replace?
695 ($mathstyle && $othermathstyle
696 0 ▶ ? (mathstylestep => $mathstylestep{$mathstyle}{$othermathstyle})
Branch: 1 branch
BranchTrueFalseTotal
$mathstyle && $othermathstyle ? : 0 0 0
Condition0%0/3
$mathstyle and $othermathstyle
!ll&&!rl&&r
000
MC/DC0%0/2
$mathstyle and $othermathstyle
$mathstyle $othermathstyle
Truth table0%0/3
A and B
A= $mathstyleB= $othermathstyle
ABresult
0X0
100
111
697 : ()),
698 ); }
699  
700 sub mergePurestyle {
701 0 ▶ my ($self, %stylechanges) = @_;
Subroutine mergePurestyle: not called CC=6 SCAR=37.4
Pod undocumented
702 0 my $new = $self->new_internal(@$self);
703 0 ▶ $$new[3] = $$self[3] * $stylechanges{scale} if $stylechanges{scale};
Branch: 1 branch
BranchTrueFalseTotal
if $stylechanges{"scale"} 0 0 0
704 0 ▶ $$new[4] = $stylechanges{color} if $stylechanges{color};
Branch: 1 branch
BranchTrueFalseTotal
if $stylechanges{"color"} 0 0 0
705 0 ▶ $$new[5] = $stylechanges{background} if $stylechanges{background};
Branch: 1 branch
BranchTrueFalseTotal
if $stylechanges{"background"} 0 0 0
706 0 ▶ $$new[6] = $stylechanges{opacity} if $stylechanges{opacity};
Branch: 1 branch
BranchTrueFalseTotal
if $stylechanges{"opacity"} 0 0 0
707 0 ▶ $$new[9] = $stepmathstyle{ $$self[9] }{ $stylechanges{mathstylestep} } if $stylechanges{mathstylestep};
Branch: 1 branch
BranchTrueFalseTotal
if $stylechanges{"mathstylestep"} 0 0 0
708 0 return new; }
709  
710 #**********************************************************************
711 4 1;
712  
713 __END__
« lib/LaTeXML/Util/Image.pm ↑ Summary lib/LaTeXML/Util/Pack.pm »