lib/LaTeXML/Core/Box.pm

filter: Statementstmt 15.5% 20 / 129 Branchbran 0.0% 0 / 52 Conditioncond 0.0% 0 / 93 MC/DCmcdc 0.0% 0 / 53 Subroutinesub 16.2% 6 / 37 Podpod 38.7% 12 / 31 totaltotal 9.6% 38 / 395 CC 59 SCAR 36.2
CC
59
Cov
7%
getSize
110.0
Box
72.0
computeSize
72.0
CRAP 37.4
« lib/LaTeXML/Post/OpenMath.pm ↑ Summary lib/LaTeXML/Core/Definition/Primitive.pm »
1 # /=====================================================================\ #
2 # | LaTeXML::Core::Box | #
3 # | Digested objects produced in the Stomach | #
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::Core::Box;
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::Common::Object;
Subroutine BEGIN: called CC=1 SCAR=0.0
17 4 ▶use base qw(LaTeXML::Common::Object);
Subroutine BEGIN: called CC=1 SCAR=0.0
18 4 ▶use base qw(Exporter);
Subroutine BEGIN: called CC=1 SCAR=0.0
19 4 our @EXPORT = (
20 qw( &Box ),
21 );
22  
23 #======================================================================
24 # Exported constructors
25  
26 sub Box {
27 0 ▶ my ($string, $font, $locator, $tokens, %properties) = @_;
Subroutine Box: not called CC=8 SCAR=42.8
Pod documented
28 0 ▶ $font = $STATE->lookupValue('font') unless defined $font;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $font 0 0 0
29 0 ▶ $locator = $STATE->getStomach->getGullet->getLocator unless defined $locator;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $locator 0 0 0
30 0 ▶ $tokens = LaTeXML::Core::Token::T_OTHER($string) if $string && !defined $tokens;
Branch: 1 branch
BranchTrueFalseTotal
if $string and not defined $tokens 0 0 0
Condition0%0/3
$string and not defined $tokens
!ll&&!rl&&r
000
MC/DC0%0/2
$string and not defined $tokens
$string not defined $tokens
Truth table0%0/3
A and not(B)
A= $stringB= not defined $tokens
ABresult
0X0
100
111
31 0 my $state = $STATE;
32 0 ▶ if ($state->lookupValue('IN_MATH')) {
Branch: 1 branch
BranchTrueFalseTotal
if ($state->lookupValue('IN_MATH')) { } 0 0 0
33 0 ▶ my $attr = (defined $string) && $state->lookupValue('math_token_attributes_' . $string);
Condition0%0/3
defined $string && $state->lookupValue('math_token_attributes_' . $string)
!ll&&!rl&&r
000
MC/DC0%0/2
defined $string && $state->lookupValue('math_token_attributes_' . $string)
defined $string $state->lookupValue('math_token_attributes_' . $string)
Truth table0%0/3
A && B
A= defined $stringB= $state->lookupValue('math_token_attributes_' . $string)
ABresult
0X0
100
111
34 0 ▶ return LaTeXML::Core::Box->new($string, $font->specialize($string), $locator, $tokens,
Branch: 1 branch
BranchTrueFalseTotal
$attr ? : 0 0 0
35 mode => 'math', ($attr ? %$attr : ()), %properties); }
36 else {
37 0 return LaTeXML::Core::Box->new($string, $font, $locator, $tokens, %properties); } }
38  
39 #======================================================================
40 # Box Object
41  
42 sub new {
43 0 ▶ my ($class, $string, $font, $locator, $tokens, %properties) = @_;
Subroutine new: not called CC=1 SCAR=6.9
Pod undocumented
44 0 return bless { string => $string,
45 tokens => $tokens,
46 properties => { font => $font, locator => $locator, %properties }
47 }, $class; }
48  
49 # Accessors
50 sub isaBox {
51 0 ▶ return 1; }
Subroutine isaBox: not called CC=1 SCAR=6.9
Pod documented
52  
53 sub getString {
54 0 ▶ my ($self) = @_;
Subroutine getString: not called CC=1 SCAR=6.9
Pod documented
55 0 return $$self{string}; } # Return the string contents of the box
56  
57 sub getFont {
58 0 ▶ my ($self) = @_;
Subroutine getFont: not called CC=1 SCAR=6.9
Pod documented
59 0 return $$self{properties}{font}; } # and if undef ????
60  
61 sub setFont {
62 0 ▶ my ($self, $font) = @_;
Subroutine setFont: not called CC=1 SCAR=6.9
Pod undocumented
63 0 $$self{properties}{font} = $font;
64 0 return; }
65  
66 sub isMath {
67 0 ▶ my ($self) = @_;
Subroutine isMath: not called CC=2 SCAR=17.9
Pod documented
68 0 ▶ return ($$self{properties}{mode} || 'text') eq 'math'; }
Condition0%0/2
$self->{'properties'}{'mode'} || 'text'
l!l
00
MC/DC0%0/1
$self->{'properties'}{'mode'} || 'text'
$self->{'properties'}{'mode'}
Truth table0%0/2
A
A= $self->{'properties'}{'mode'}
Aresult
11
00
69  
70 sub getLocator {
71 0 ▶ my ($self) = @_;
Subroutine getLocator: not called CC=1 SCAR=6.9
Pod documented
72 0 return $$self{properties}{locator}; }
73  
74 sub getSource {
75 0 ▶ my ($self) = @_;
Subroutine getSource: not called CC=1 SCAR=6.9
Pod undocumented
76 0 return $$self{properties}{locator}; }
77  
78 # So a Box can stand in for a List
79 sub unlist {
80 0 ▶ my ($self) = @_;
Subroutine unlist: not called CC=1 SCAR=6.9
Pod documented
81 0 return ($self); } # Return list of the boxes
82  
83 sub getBody {
84 0 ▶ my ($self) = @_;
Subroutine getBody: not called CC=1 SCAR=6.9
Pod undocumented
85 0 return $self; }
86  
87 sub revert {
88 0 ▶ my ($self) = @_;
Subroutine revert: not called CC=2 SCAR=17.9
Pod documented
89 0 ▶ return ($$self{tokens} ? $$self{tokens}->unlist : ()); }
Branch: 1 branch
BranchTrueFalseTotal
$self->{'tokens'} ? : 0 0 0
90  
91 sub toString {
92 0 ▶ my ($self) = @_;
Subroutine toString: not called CC=2 SCAR=17.9
Pod documented
93 0 ▶ return $$self{string} // ''; }
Condition0%0/2
$self->{"string"} // ""
l!l
00
MC/DC0%0/1
$self->{"string"} // ""
$self->{"string"}
Truth table0%0/2
A
A= $self->{"string"}
Aresult
11
00
94  
95 # Methods for overloaded operators
96 sub stringify {
97 0 ▶ my ($self) = @_;
Subroutine stringify: not called CC=6 SCAR=37.4
Pod documented
98 0 my $type = ref $self;
99 0 $type =~ s/^LaTeXML::Core:://;
100 0 ▶ my $font = (defined $$self{properties}{font}) && $$self{properties}{font}->stringify; # show font, too, if interesting
Condition0%0/3
defined $self->{'properties'}{'font'} && $self->{'properties'}{'font'}->stringify
!ll&&!rl&&r
000
MC/DC0%0/2
defined $self->{'properties'}{'font'} && $self->{'properties'}{'font'}->stringify
defined $self->{'properties'}{'font'} $self->{'properties'}{'font'}->stringify
Truth table0%0/3
A && B
A= defined $self->{'properties'}{'font'}B= $self->{'properties'}{'font'}->stringify
ABresult
0X0
100
111
101 return $type . '['
102 . (defined $$self{string} ? $$self{string}
103 0 ▶ : (defined $$self{tokens} ? '[' . ToString($$self{tokens}) . ']' : ''))
Branch: 3 branches
BranchTrueFalseTotal
defined $self->{'string'} ? : 0 0 0
defined $self->{'tokens'} ? : 0 0 0
$font && $font ne 'Font[]' ? : 0 0 0
Condition0%0/3
$font and $font ne "Font[]"
!ll&&!rl&&r
000
MC/DC0%0/2
$font and $font ne "Font[]"
$font $font ne "Font[]"
Truth table0%0/3
A and B
A= $fontB= $font ne "Font[]"
ABresult
0X0
100
111
104 . ($font && ($font ne 'Font[]') ? ' ' . $font : '')
105 . ']'; }
106  
107 # Should this compare fonts too?
108 sub equals {
109 0 ▶ my ($a, $b) = @_;
Subroutine equals: not called CC=4 SCAR=30.0
Pod documented
110 0 ▶ return (defined $b) && ((ref $a) eq (ref $b)) && ($$a{string} eq $$b{string}) && ($$a{properties}{font}->equals($$b{properties}{font})); }
Condition0%0/9
defined $b && ref $a eq ref $b && $a->{'string'} eq $b->{'string'} && $a->{'properties'}{'font'}->equals($b->{'properties'}{'font'})
!ll&&!rl&&r
000
defined $b and ref $a eq ref $b and $a->{"string"} eq $b->{"string"}
!ll&&!rl&&r
000
defined $b and ref $a eq ref $b
!ll&&!rl&&r
000
MC/DC0%0/4
defined $b && ref $a eq ref $b && $a->{'string'} eq $b->{'string'} && $a->{'properties'}{'font'}->equals($b->{'properties'}{'font'})
defined $b ref $a eq ref $b $a->{"string"} eq $b->{"string"} $a->{'properties'}{'font'}->equals($b->{'properties'}{'font'})
Truth table0%0/5
A and B and C && D
A= defined $bB= ref $a eq ref $bC= $a->{"string"} eq $b->{"string"}D= $a->{'properties'}{'font'}->equals($b->{'properties'}{'font'})
ABCDresult
0XXX0
10XX0
110X0
11100
11111
111  
112 sub beAbsorbed {
113 0 ▶ my ($self, $document) = @_;
Subroutine beAbsorbed: not called CC=5 SCAR=34.0
Pod documented
114 0 my $string = $$self{string};
115 0 ▶ my $mode = $$self{properties}{mode} || 'text';
Condition0%0/2
$self->{'properties'}{'mode'} || 'text'
l!l
00
MC/DC0%0/1
$self->{'properties'}{'mode'} || 'text'
$self->{'properties'}{'mode'}
Truth table0%0/2
A
A= $self->{'properties'}{'mode'}
Aresult
11
00
116 return ((defined $string) && ($string ne '')
117 ? ($mode eq 'math'
118 0 ? $document->insertMathToken($string, %{ $$self{properties} })
119 0 ▶ : $document->openText($string, $$self{properties}{font}))
Branch: 2 branches
BranchTrueFalseTotal
defined $string && $string ne '' ? : 0 0 0
$mode eq 'math' ? : 0 0 0
Condition0%0/3
defined $string and $string ne ""
!ll&&!rl&&r
000
MC/DC0%0/2
defined $string and $string ne ""
defined $string $string ne ""
Truth table0%0/3
A and B
A= defined $stringB= $string ne ""
ABresult
0X0
100
111
120 : undef); }
121  
122 sub getProperty {
123 0 ▶ my ($self, $key) = @_;
Subroutine getProperty: not called CC=4 SCAR=30.0
Pod undocumented
124 0 ▶ if ($key eq 'isSpace') {
Branch: 1 branch
BranchTrueFalseTotal
if ($key eq 'isSpace') { } 0 0 0
125 0 ▶ return $$self{properties}{$key} if defined $$self{properties}{$key};
Branch: 1 branch
BranchTrueFalseTotal
if defined $self->{"properties"}{$key} 0 0 0
126 0 my $tex = LaTeXML::Core::Token::UnTeX($$self{tokens}); # !
127 0 ▶ return (defined $tex) && ($tex =~ /^\s*$/); } # Check the TeX code, not (just) the string!
Condition0%0/3
defined $tex && $tex =~ /^\s*$/
!ll&&!rl&&r
000
MC/DC0%0/2
defined $tex && $tex =~ /^\s*$/
defined $tex $tex =~ /^\s*$/
Truth table0%0/3
A && B
A= defined $texB= $tex =~ /^\s*$/
ABresult
0X0
100
111
128 else {
129 0 return $$self{properties}{$key}; } }
130  
131 sub getProperties {
132 0 ▶ my ($self) = @_;
Subroutine getProperties: not called CC=1 SCAR=6.9
Pod undocumented
133 0 return %{ $$self{properties} }; }
134  
135 sub getPropertiesRef {
136 0 ▶ my ($self) = @_;
Subroutine getPropertiesRef: not called CC=1 SCAR=6.9
Pod undocumented
137 0 return $$self{properties}; }
138  
139 sub setProperty {
140 0 ▶ my ($self, $key, $value) = @_;
Subroutine setProperty: not called CC=1 SCAR=6.9
Pod undocumented
141 0 $$self{properties}{$key} = $value;
142 0 return; }
143  
144 sub setProperties {
145 0 ▶ my ($self, %props) = @_;
Subroutine setProperties: not called CC=3 SCAR=24.8
Pod undocumented
146 0 ▶ while (my ($key, $value) = each %props) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = each %props) 0 0 0
147 0 ▶ $$self{properties}{$key} = $value if defined $value; }
Branch: 1 branch
BranchTrueFalseTotal
if defined $value 0 0 0
148 0 return; }
149  
150 # For the dimensions of boxes, we'll store the (lazily) computed size as:
151 # cwidth, cheight, cdepth
152 # and the explicitly requested/assigned size as
153 # width, height, depth.
154 # Generally speaking, an XML element should only get width, height, depth
155 # attributes when they were explicitly set.
156 # However, when requesting the size of a box, you'd get either (w/ explicit size overriding)
157 sub getWidth {
158 0 ▶ my ($self, %options) = @_;
Subroutine getWidth: not called CC=4 SCAR=30.0
Pod undocumented
159 0 my $props = $self->getPropertiesRef;
160 0 ▶ $self->computeSize(%options) unless (defined $$props{width}) or (defined $$props{cwidth});
Branch: 1 branch
BranchTrueFalseTotal
unless defined $props->{"width"} or defined $props->{"cwidth"} 0 0 0
Condition0%0/3
defined $props->{"width"} or defined $props->{"cwidth"}
l!l&&r!l&&!r
000
MC/DC0%0/2
defined $props->{"width"} or defined $props->{"cwidth"}
defined $props->{"width"} defined $props->{"cwidth"}
Truth table0%0/3
A or B
A= defined $props->{"width"}B= defined $props->{"cwidth"}
ABresult
1X1
011
000
161 0 ▶ return $$props{width} || $$props{cwidth}; }
Condition0%0/3
$props->{'width'} || $props->{'cwidth'}
l!l&&r!l&&!r
000
MC/DC0%0/2
$props->{'width'} || $props->{'cwidth'}
$props->{'width'} $props->{'cwidth'}
Truth table0%0/3
A || B
A= $props->{'width'}B= $props->{'cwidth'}
ABresult
1X1
011
000
162  
163 sub getHeight {
164 0 ▶ my ($self, %options) = @_;
Subroutine getHeight: not called CC=4 SCAR=30.0
Pod undocumented
165 0 my $props = $self->getPropertiesRef;
166 0 ▶ $self->computeSize(%options) unless (defined $$props{height}) or (defined $$props{cheight});
Branch: 1 branch
BranchTrueFalseTotal
unless defined $props->{"height"} or defined $props->{"cheight"} 0 0 0
Condition0%0/3
defined $props->{"height"} or defined $props->{"cheight"}
l!l&&r!l&&!r
000
MC/DC0%0/2
defined $props->{"height"} or defined $props->{"cheight"}
defined $props->{"height"} defined $props->{"cheight"}
Truth table0%0/3
A or B
A= defined $props->{"height"}B= defined $props->{"cheight"}
ABresult
1X1
011
000
167 0 ▶ return $$props{height} || $$props{cheight}; }
Condition0%0/3
$props->{'height'} || $props->{'cheight'}
l!l&&r!l&&!r
000
MC/DC0%0/2
$props->{'height'} || $props->{'cheight'}
$props->{'height'} $props->{'cheight'}
Truth table0%0/3
A || B
A= $props->{'height'}B= $props->{'cheight'}
ABresult
1X1
011
000
168  
169 sub getDepth {
170 0 ▶ my ($self, %options) = @_;
Subroutine getDepth: not called CC=4 SCAR=30.0
Pod undocumented
171 0 my $props = $self->getPropertiesRef;
172 0 ▶ $self->computeSize(%options) unless (defined $$props{depth}) or (defined $$props{cdepth});
Branch: 1 branch
BranchTrueFalseTotal
unless defined $props->{"depth"} or defined $props->{"cdepth"} 0 0 0
Condition0%0/3
defined $props->{"depth"} or defined $props->{"cdepth"}
l!l&&r!l&&!r
000
MC/DC0%0/2
defined $props->{"depth"} or defined $props->{"cdepth"}
defined $props->{"depth"} defined $props->{"cdepth"}
Truth table0%0/3
A or B
A= defined $props->{"depth"}B= defined $props->{"cdepth"}
ABresult
1X1
011
000
173 0 ▶ return $$props{depth} || $$props{cdepth}; }
Condition0%0/3
$props->{'depth'} || $props->{'cdepth'}
l!l&&r!l&&!r
000
MC/DC0%0/2
$props->{'depth'} || $props->{'cdepth'}
$props->{'depth'} $props->{'cdepth'}
Truth table0%0/3
A || B
A= $props->{'depth'}B= $props->{'cdepth'}
ABresult
1X1
011
000
174  
175 sub getTotalHeight {
176 0 ▶ my ($self, %options) = @_;
Subroutine getTotalHeight: not called CC=7 SCAR=40.3
Pod undocumented
177 0 my $props = $self->getPropertiesRef;
178 $self->computeSize(%options)
179 unless ((defined $$props{height}) or (defined $$props{cheight}))
180 0 ▶ && ((defined $$props{depth}) or (defined $$props{cdepth}));
Branch: 1 branch
BranchTrueFalseTotal
unless defined $props->{"height"} || defined $props->{"cheight"} and defined $props->{"depth"} || defined $props->{"cdepth"} 0 0 0
Condition0%0/9
defined $props->{"height"} || defined $props->{"cheight"} and defined $props->{"depth"} || defined $props->{"cdepth"}
!ll&&!rl&&r
000
defined $props->{"height"} or defined $props->{"cheight"}
l!l&&r!l&&!r
000
defined $props->{"depth"} or defined $props->{"cdepth"}
l!l&&r!l&&!r
000
MC/DC0%0/4
defined $props->{"height"} || defined $props->{"cheight"} and defined $props->{"depth"} || defined $props->{"cdepth"}
defined $props->{"height"} defined $props->{"cheight"} defined $props->{"depth"} defined $props->{"cdepth"}
Truth table0%0/7
A or B and C or D
A= defined $props->{"height"}B= defined $props->{"cheight"}C= defined $props->{"depth"}D= defined $props->{"cdepth"}
ABCDresult
00XX0
1X000
01000
1X1X1
1X011
011X1
01011
181 0 ▶ my $h = $$props{height} || $$props{cheight};
Condition0%0/3
$props->{'height'} || $props->{'cheight'}
l!l&&r!l&&!r
000
MC/DC0%0/2
$props->{'height'} || $props->{'cheight'}
$props->{'height'} $props->{'cheight'}
Truth table0%0/3
A || B
A= $props->{'height'}B= $props->{'cheight'}
ABresult
1X1
011
000
182 0 ▶ my $d = $$props{depth} || $$props{cdepth};
Condition0%0/3
$props->{'depth'} || $props->{'cdepth'}
l!l&&r!l&&!r
000
MC/DC0%0/2
$props->{'depth'} || $props->{'cdepth'}
$props->{'depth'} $props->{'cdepth'}
Truth table0%0/3
A || B
A= $props->{'depth'}B= $props->{'cdepth'}
ABresult
1X1
011
000
183 0 return $h->add($d); }
184  
185 sub setWidth {
186 0 ▶ my ($self, $width) = @_;
Subroutine setWidth: not called CC=1 SCAR=6.9
Pod undocumented
187 0 my $props = $self->getPropertiesRef;
188 0 $$props{width} = $width;
189 0 return; }
190  
191 sub setHeight {
192 0 ▶ my ($self, $height) = @_;
Subroutine setHeight: not called CC=1 SCAR=6.9
Pod undocumented
193 0 my $props = $self->getPropertiesRef;
194 0 $$props{height} = $height;
195 0 return; }
196  
197 sub setDepth {
198 0 ▶ my ($self, $depth) = @_;
Subroutine setDepth: not called CC=1 SCAR=6.9
Pod undocumented
199 0 my $props = $self->getPropertiesRef;
200 0 $$props{depth} = $depth;
201 0 return; }
202  
203 sub getSize {
204 0 ▶ my ($self, %options) = @_;
Subroutine getSize: not called CC=10 SCAR=47.0
Pod undocumented
205 0 my $props = $self->getPropertiesRef;
206 $self->computeSize(%options)
207 unless ((defined $$props{width}) or (defined $$props{cwidth}))
208 && ((defined $$props{height}) or (defined $$props{cheight}))
209 0 ▶ && ((defined $$props{depth}) or (defined $$props{cdepth}));
Branch: 1 branch
BranchTrueFalseTotal
unless defined $props->{"width"} || defined $props->{"cwidth"} and defined $props->{"height"} || defined $props->{"cheight"} and defined $props->{"depth"} || defined $props->{"cdepth"} 0 0 0
Condition0%0/15
defined $props->{"width"} || defined $props->{"cwidth"} and defined $props->{"height"} || defined $props->{"cheight"} and defined $props->{"depth"} || defined $props->{"cdepth"}
!ll&&!rl&&r
000
defined $props->{"width"} || defined $props->{"cwidth"} and defined $props->{"height"} || defined $props->{"cheight"}
!ll&&!rl&&r
000
defined $props->{"width"} or defined $props->{"cwidth"}
l!l&&r!l&&!r
000
defined $props->{"height"} or defined $props->{"cheight"}
l!l&&r!l&&!r
000
defined $props->{"depth"} or defined $props->{"cdepth"}
l!l&&r!l&&!r
000
MC/DC0%0/6
defined $props->{"width"} || defined $props->{"cwidth"} and defined $props->{"height"} || defined $props->{"cheight"} and defined $props->{"depth"} || defined $props->{"cdepth"}
defined $props->{"width"} defined $props->{"cwidth"} defined $props->{"height"} defined $props->{"cheight"} defined $props->{"depth"} defined $props->{"cdepth"}
Truth table0%0/15
A or B and C or D and E or F
A= defined $props->{"width"}B= defined $props->{"cwidth"}C= defined $props->{"height"}D= defined $props->{"cheight"}E= defined $props->{"depth"}F= defined $props->{"cdepth"}
ABCDEFresult
00XXXX0
1X00XX0
0100XX0
1X1X000
1X01000
011X000
0101000
1X1X1X1
1X1X011
1X011X1
1X01011
011X1X1
011X011
01011X1
0101011
210  
211 return ($$props{width} || $$props{cwidth},
212 $$props{height} || $$props{cheight},
213 0 ▶ $$props{depth} || $$props{cdepth}); }
Condition0%0/9
$props->{'width'} || $props->{'cwidth'}
l!l&&r!l&&!r
000
$props->{'height'} || $props->{'cheight'}
l!l&&r!l&&!r
000
$props->{'depth'} || $props->{'cdepth'}
l!l&&r!l&&!r
000
MC/DC0%0/2
$props->{'width'} || $props->{'cwidth'}
$props->{'width'} $props->{'cwidth'}
MC/DC0%0/2
$props->{'height'} || $props->{'cheight'}
$props->{'height'} $props->{'cheight'}
MC/DC0%0/2
$props->{'depth'} || $props->{'cdepth'}
$props->{'depth'} $props->{'cdepth'}
Truth table0%0/3
A || B
A= $props->{'width'}B= $props->{'cwidth'}
ABresult
1X1
011
000
Truth table0%0/3
A || B
A= $props->{'height'}B= $props->{'cheight'}
ABresult
1X1
011
000
Truth table0%0/3
A || B
A= $props->{'depth'}B= $props->{'cdepth'}
ABresult
1X1
011
000
214  
215 # for debugging....
216 sub showSize {
217 0 ▶ my ($self) = @_;
Subroutine showSize: not called CC=1 SCAR=6.9
Pod undocumented
218 0 return '[' . ToString($self->getWidth) . ' x ' . ToString($self->getHeight) . ' + ' . ToString($self->getDepth) . ']'; }
219  
220 #omg
221 # Fake computing the dimensions of strings (typically single chars).
222 # Eventually, this needs to link into real font data
223 sub computeSize {
224 0 ▶ my ($self, %options) = @_;
Subroutine computeSize: not called CC=8 SCAR=42.8
Pod undocumented
225 0 my $props = $self->getPropertiesRef;
226 0 ▶ $options{width} = $$props{width} if $$props{width};
Branch: 1 branch
BranchTrueFalseTotal
if $props->{"width"} 0 0 0
227 0 ▶ $options{height} = $$props{height} if $$props{height};
Branch: 1 branch
BranchTrueFalseTotal
if $props->{"height"} 0 0 0
228 0 ▶ $options{depth} = $$props{depth} if $$props{depth};
Branch: 1 branch
BranchTrueFalseTotal
if $props->{"depth"} 0 0 0
229 my ($w, $h, $d) = ($$props{font}
230 0 ▶ || LaTeXML::Common::Font->textDefault)->computeStringSize($$self{string}, %options);
Condition0%0/3
$props->{'font'} || 'LaTeXML::Common::Font'->textDefault
l!l&&r!l&&!r
000
MC/DC0%0/2
$props->{'font'} || 'LaTeXML::Common::Font'->textDefault
$props->{'font'} 'LaTeXML::Common::Font'->textDefault
Truth table0%0/3
A || B
A= $props->{'font'}B= 'LaTeXML::Common::Font'->textDefault
ABresult
1X1
011
000
231 0 ▶ $$props{cwidth} = $w unless defined $$props{width};
Branch: 1 branch
BranchTrueFalseTotal
unless defined $props->{"width"} 0 0 0
232 0 ▶ $$props{cheight} = $h unless defined $$props{height};
Branch: 1 branch
BranchTrueFalseTotal
unless defined $props->{"height"} 0 0 0
233 0 ▶ $$props{cdepth} = $d unless defined $$props{depth};
Branch: 1 branch
BranchTrueFalseTotal
unless defined $props->{"depth"} 0 0 0
234 0 return; }
235  
236 #**********************************************************************
237 # What about Kern, Glue, Penalty ...
238  
239 #======================================================================
240 4 1;
241  
242 __END__
« lib/LaTeXML/Post/OpenMath.pm ↑ Summary lib/LaTeXML/Core/Definition/Primitive.pm »