Lines Matching +full:l +full:- +full:max
3 * copyright : (C) 2005 by Pascal Brachet - France *
20 * @author Peter Vasilevsky <tuxoiduser@gmail.com> a.k.a. Tux-oid
38 $this->helper = $helper;
39 $this->text = "&$";
40 $this->nodes = $exp;
41 $this->nodes = $this->parse();
49 if (count($this->nodes) <= 3) {
50 return $this->nodes;
54 for ($i = 0; $i < count($this->nodes); $i++) {
55 if ($this->nodes[$i]->text == '(' || $this->nodes[$i]->text == '{') {
57 } elseif ($this->nodes[$i]->text == ')' || $this->nodes[$i]->text == '}') {
60 $sub = array_slice($this->nodes, $pos + 1, $i - $pos - 1);
61 if ($this->nodes[$i]->text == ')') {
63 new TextExpression("(", $this->helper),
64 new MathExpression($sub, $this->helper),
65 new TextExpression(")", $this->helper)
66 ), $this->helper);
68 $ret[] = new MathExpression($sub, $this->helper);
72 $ret[] = $this->nodes[$i];
75 $ret = $this->handleFunction($ret, 'sqrt', 1);
76 $ret = $this->handleFunction($ret, 'vec', 1);
77 $ret = $this->handleFunction($ret, 'overline', 1);
78 $ret = $this->handleFunction($ret, 'underline', 1);
79 $ret = $this->handleFunction($ret, 'hat', 1);
80 $ret = $this->handleFunction($ret, 'int', 3);
81 $ret = $this->handleFunction($ret, 'doubleint', 3);
82 $ret = $this->handleFunction($ret, 'tripleint', 3);
83 $ret = $this->handleFunction($ret, 'oint', 3);
84 $ret = $this->handleFunction($ret, 'prod', 3);
85 $ret = $this->handleFunction($ret, 'sum', 3);
86 $ret = $this->handleFunction($ret, 'bigcup', 3);
87 $ret = $this->handleFunction($ret, 'bigcap', 3);
88 $ret = $this->handleFunction($ret, 'delim', 3);
89 $ret = $this->handleFunction($ret, 'lim', 2);
90 $ret = $this->handleFunction($ret, 'root', 2);
91 $ret = $this->handleFunction($ret, 'matrix', 3);
92 $ret = $this->handleFunction($ret, 'tabular', 3);
94 $ret = $this->handleOperation($ret, '^');
95 $ret = $this->handleOperation($ret, 'over');
96 $ret = $this->handleOperation($ret, '_');
97 $ret = $this->handleOperation($ret, 'under');
98 $ret = $this->handleOperation($ret, '*');
99 $ret = $this->handleOperation($ret, '/');
100 $ret = $this->handleOperation($ret, '+');
101 $ret = $this->handleOperation($ret, '-');
120 if (!$change && $i < count($nodes) - 2 && $nodes[$i + 1]->text == $operation) {
121 … $ret[] = new MathExpression(array($nodes[$i], $nodes[$i + 1], $nodes[$i + 2]), $this->helper);
147 if ($i < count($nodes) - $argumentsCount && $nodes[$i]->text == $function) {
152 $ret[] = new MathExpression($a, $this->helper);
168 switch (count($this->nodes)) {
170 $this->nodes[0]->draw($size);
171 $this->image = $this->nodes[0]->image;
172 $this->verticalBased = $this->nodes[0]->verticalBased;
175 switch ($this->nodes[0]->text) {
177 $this->drawSqrt($size);
180 $this->drawVector($size);
183 $this->drawOverLine($size);
186 $this->drawUnderline($size);
189 $this->drawHat($size);
192 $this->drawExpression($size);
197 if ($this->nodes[0]->text == "lim") {
198 $this->drawLimit($size);
199 } elseif ($this->nodes[0]->text == "root") {
200 $this->drawRoot($size);
202 switch ($this->nodes[1]->text) {
204 $this->drawFraction($size);
207 $this->drawExponent($size);
210 $this->drawTop($size);
213 $this->drawIndex($size);
216 $this->draw_bottom($size);
219 $this->drawExpression($size);
225 switch ($this->nodes[0]->text) {
227 $this->drawLargestOperator($size, '_integrale');
230 $this->drawLargestOperator($size, '_dintegrale');
233 $this->drawLargestOperator($size, '_tintegrale');
236 $this->drawLargestOperator($size, '_ointegrale');
239 $this->drawLargestOperator($size, '_somme');
242 $this->drawLargestOperator($size, '_produit');
245 $this->drawLargestOperator($size, '_intersection');
248 $this->drawLargestOperator($size, '_reunion');
251 $this->drawDelimiter($size);
254 $this->drawMatrix($size);
257 $this->drawTable($size);
260 $this->drawExpression($size);
265 $this->drawExpression($size);
281 for ($i = 0; $i < count($this->nodes); $i++) {
282 if ($this->nodes[$i]->text != '(' && $this->nodes[$i]->text != ')') {
283 $this->nodes[$i]->draw($size);
284 $img[$i] = $this->nodes[$i]->image;
285 $base[$i] = $this->nodes[$i]->verticalBased;
286 $top = max($base[$i], $top);
287 $bottom = max(imagesy($img[$i]) - $base[$i], $bottom);
291 $paro = $this->helper->parenthesis(max($top, $bottom) * 2, "(");
292 $parf = $this->helper->parenthesis(max($top, $bottom) * 2, ")");
293 for ($i = 0; $i < count($this->nodes); $i++) {
295 if ($this->nodes[$i]->text == "(") {
300 $top = max(imagesy($img[$i]) / 2, $top);
302 $bottom = max(imagesy($img[$i]) - $base[$i], $bottom);
303 $height = max(imagesy($img[$i]), $height);
307 $this->verticalBased = $top;
308 $result = imagecreate(max($width, 1), max($height, 1));
309 $white = $this->helper->getBackColor($result);
310 imagefilledrectangle($result, 0, 0, $width - 1, $height - 1, $white);
314 … imagecopy($result, $img[$i], $pos, $top - $base[$i], 0, 0, imagesx($img[$i]), imagesy($img[$i]));
318 $this->image = $result;
326 $this->nodes[0]->draw($size * 0.9);
327 $img1 = $this->nodes[0]->image;
328 $this->nodes[2]->draw($size * 0.9);
329 $img2 = $this->nodes[2]->image;
334 $width = max($width1, $width2);
336 $result = imagecreate(max($width + 5, 1), max($height, 1));
337 $black = $this->helper->getFontColor($result);
338 $white = $this->helper->getBackColor($result);
339 $this->verticalBased = $height1 + 2;
340 imagefilledrectangle($result, 0, 0, $width + 4, $height - 1, $white);
341 imagecopy($result, $img1, ($width - $width1) / 2, 0, 0, 0, $width1, $height1);
342 imageline($result, 0, $this->verticalBased, $width, $this->verticalBased, $black);
343 imagecopy($result, $img2, ($width - $width2) / 2, $height1 + 4, 0, 0, $width2, $height2);
344 $this->image = $result;
352 $this->nodes[0]->draw($size);
353 $img1 = $this->nodes[0]->image;
354 $base1 = $this->nodes[0]->verticalBased;
355 $this->nodes[2]->draw($size * 0.8);
356 $img2 = $this->nodes[2]->image;
364 $this->verticalBased = $height2 / 2 + $base1;
365 $result = imagecreate(max($width, 1), max($height, 1));
366 $white = $this->helper->getBackColor($result);
367 imagefilledrectangle($result, 0, 0, $width - 1, $height - 1, $white);
372 $this->verticalBased = $height2 - $base1 + $height1 / 2;
373 $result = imagecreate(max($width, 1), max($height, 1));
374 $white = $this->helper->getBackColor($result);
375 imagefilledrectangle($result, 0, 0, $width - 1, $height - 1, $white);
376 imagecopy($result, $img1, 0, ceil($height2 - $height1 / 2), 0, 0, $width1, $height1);
379 $this->image = $result;
387 $this->nodes[0]->draw($size);
388 $img1 = $this->nodes[0]->image;
389 $base1 = $this->nodes[0]->verticalBased;
390 $this->nodes[2]->draw($size * 0.8);
391 $img2 = $this->nodes[2]->image;
399 $this->verticalBased = $base1;
400 $result = imagecreate(max($width, 1), max($height, 1));
401 $white = $this->helper->getBackColor($result);
402 imagefilledrectangle($result, 0, 0, $width - 1, $height - 1, $white);
404 … imagecopy($result, $img2, $width1, ceil($height1 - $height2 / 2), 0, 0, $width2, $height2);
407 $this->verticalBased = $base1;
408 $result = imagecreate(max($width, 1), max($height, 1));
409 $white = $this->helper->getBackColor($result);
410 imagefilledrectangle($result, 0, 0, $width - 1, $height - 1, $white);
414 $this->image = $result;
422 $this->nodes[1]->draw($size);
423 $imgExp = $this->nodes[1]->image;
424 $baseExp = $this->nodes[1]->verticalBased;
428 $imgrac = $this->helper->displaySymbol("_racine", $heightExp + 2);
433 $height = max($heightExp, $heightrac);
434 $result = imagecreate(max($width, 1), max($height, 1));
435 $black = $this->helper->getFontColor($result);
436 $white = $this->helper->getBackColor($result);
437 imagefilledrectangle($result, 0, 0, $width - 1, $height - 1, $white);
439 imagecopy($result, $imgExp, $widthrac, $height - $heightExp, 0, 0, $widthExp, $heightExp);
441 imageline($result, $widthrac - 2, 2, $widthrac + $widthExp + 2, 2, $black);
442 $this->verticalBased = $height - $heightExp + $baseExp;
443 $this->image = $result;
451 $this->nodes[1]->draw($size * 0.6);
452 $imgRoot = $this->nodes[1]->image;
456 $this->nodes[2]->draw($size);
457 $imgExp = $this->nodes[2]->image;
458 $baseExp = $this->nodes[2]->verticalBased;
462 $imgRac = $this->helper->displaySymbol("_racine", $heightExp + 2);
467 $height = max($heightExp, $heightRac);
468 $result = imagecreate(max($width, 1), max($height, 1));
469 $black = $this->helper->getFontColor($result);
470 $white = $this->helper->getBackColor($result);
471 imagefilledrectangle($result, 0, 0, $width - 1, $height - 1, $white);
473 imagecopy($result, $imgExp, $widthRac, $height - $heightExp, 0, 0, $widthExp, $heightExp);
475 imageline($result, $widthRac - 2, 2, $widthRac + $widthExp + 2, 2, $black);
477 $this->verticalBased = $height - $heightExp + $baseExp;
478 $this->image = $result;
487 $this->nodes[1]->draw($size * 0.8);
488 $img1 = $this->nodes[1]->image;
489 $this->nodes[2]->draw($size * 0.8);
490 $img2 = $this->nodes[2]->image;
491 $this->nodes[3]->draw($size);
492 $imgExp = $this->nodes[3]->image;
493 $baseExp = $this->nodes[3]->verticalBased;
501 …$imgSymbol = $this->helper->displaySymbol($character, $baseExp * 1.8); //max($baseExp,$heightExp-$…
507 $widthLeft = max($widthSymbol, $width1, $width2);
508 $imgLeft = imagecreate(max($widthLeft, 1), max($heightLeft, 1));
509 $white = $this->helper->getBackColor($imgLeft);
510 imagefilledrectangle($imgLeft, 0, 0, $widthLeft - 1, $heightLeft - 1, $white);
511 …imagecopy($imgLeft, $imgSymbol, ($widthLeft - $widthSymbol) / 2, $height2, 0, 0, $widthSymbol, $he…
512 imagecopy($imgLeft, $img2, ($widthLeft - $width2) / 2, 0, 0, 0, $width2, $height2);
513 …imagecopy($imgLeft, $img1, ($widthLeft - $width1) / 2, $height2 + $heightSymbol, 0, 0, $width1, $h…
514 $imgFin = $this->helper->alignment2($imgLeft, $baseSymbol + $height2, $imgExp, $baseExp);
515 $this->image = $imgFin;
516 $this->verticalBased = max($baseSymbol + $height2, $baseExp + $height2);
524 $this->nodes[2]->draw($size * 0.8);
525 $imgSup = $this->nodes[2]->image;
526 $this->nodes[0]->draw($size);
527 $imgExp = $this->nodes[0]->image;
528 $baseExp = $this->nodes[0]->verticalBased;
537 $width = max($widthSup, $widthExp) + ceil($size / 8);
538 $imgFin = imagecreate(max($width, 1), max($height, 1));
539 $white = $this->helper->getBackColor($imgFin);
540 imagefilledrectangle($imgFin, 0, 0, $width - 1, $height - 1, $white);
541 imagecopy($imgFin, $imgSup, ($width - $widthSup) / 2, 0, 0, 0, $widthSup, $heightSup);
542 … imagecopy($imgFin, $imgExp, ($width - $widthExp) / 2, $heightSup, 0, 0, $widthExp, $heightExp);
543 $this->image = $imgFin;
544 $this->verticalBased = $baseExp + $heightSup;
552 $this->nodes[2]->draw($size * 0.8);
553 $imgInf = $this->nodes[2]->image;
554 $this->nodes[0]->draw($size);
555 $imgExp = $this->nodes[0]->image;
556 $baseExp = $this->nodes[0]->verticalBased;
565 $width = max($widthInf, $widthExp) + ceil($size / 8);
566 $imgFin = imagecreate(max($width, 1), max($height, 1));
567 $white = $this->helper->getBackColor($imgFin);
568 imagefilledrectangle($imgFin, 0, 0, $width - 1, $height - 1, $white);
569 imagecopy($imgFin, $imgExp, ($width - $widthExp) / 2, 0, 0, 0, $widthExp, $heightExp);
570 … imagecopy($imgFin, $imgInf, ($width - $widthInf) / 2, $heightExp, 0, 0, $widthInf, $heightInf);
571 $this->image = $imgFin;
572 $this->verticalBased = $baseExp;
581 $nbLine = $this->nodes[1]->nodes[0]->text;
582 $nbColumn = $this->nodes[2]->nodes[0]->text;
602 if ($i < count($this->nodes[3]->nodes)) {
603 $this->nodes[3]->nodes[$i]->draw($size * 0.9);
604 $img[$i] = $this->nodes[3]->nodes[$i]->image;
605 $base[$i] = $this->nodes[3]->nodes[$i]->verticalBased;
606 $topLine[$line] = max($base[$i], $topLine[$line]);
609 $heightLine[$line] = max($heightLine[$line], $height[$i]);
610 $widthColumn[$col] = max($widthColumn[$col], $width[$i]);
624 $heightFin -= $padding;
625 $widthFin -= $padding;
626 $imgFin = imagecreate(max($widthFin, 1), max($heightFin, 1));
627 $white = $this->helper->getBackColor($imgFin);
628 imagefilledrectangle($imgFin, 0, 0, $widthFin - 1, $heightFin - 1, $white);
630 $h = $padding / 2 - 1;
632 $l = $padding / 2 - 1;
634 if ($i < count($this->nodes[3]->nodes)) {
638 $l + ceil($widthColumn[$col] - $width[$i]) / 2,
639 $h + $topLine[$line] - $base[$i],
645 … //ImageRectangle($imgFin,$l,$h,$l+$widthColumn[$col],$h+$heightLine[$line],$black);
647 $l += $widthColumn[$col] + $padding;
652 //ImageRectangle($imgFin,0,0,$widthFin-1,$heightFin-1,$black);
653 $this->image = $imgFin;
654 $this->verticalBased = imagesy($imgFin) / 2;
663 $typeLine = $this->nodes[1]->nodes[0]->text;
664 $typeColumn = $this->nodes[2]->nodes[0]->text;
665 $nbLine = strlen($typeLine) - 1;
666 $nbColumn = strlen($typeColumn) - 1;
686 if ($i < count($this->nodes[3]->nodes)) {
687 $this->nodes[3]->nodes[$i]->draw($size * 0.9);
688 $img[$i] = $this->nodes[3]->nodes[$i]->image;
689 $base[$i] = $this->nodes[3]->nodes[$i]->verticalBased;
690 $topLine[$line] = max($base[$i], $topLine[$line]);
693 $heightLine[$line] = max($heightLine[$line], $height[$i]);
694 $widthColumn[$col] = max($widthColumn[$col], $width[$i]);
708 $imgFin = imagecreate(max($widthFin, 1), max($heightFin, 1));
709 $black = $this->helper->getFontColor($imgFin);
710 $white = $this->helper->getBackColor($imgFin);
711 imagefilledrectangle($imgFin, 0, 0, $widthFin - 1, $heightFin - 1, $white);
713 $h = $padding / 2 - 1;
715 imageline($imgFin, 0, 0, $widthFin - 1, 0, $black);
718 $l = $padding / 2 - 1;
720 … imageline($imgFin, 0, $h - $padding / 2, 0, $h + $heightLine[$line] + $padding / 2, $black);
723 if ($i < count($this->nodes[3]->nodes)) {
727 $l + ceil($widthColumn[$col] - $width[$i]) / 2,
728 $h + $topLine[$line] - $base[$i],
737 $l + $widthColumn[$col] + $padding / 2,
738 $h - $padding / 2,
739 $l + $widthColumn[$col] + $padding / 2,
745 $l += $widthColumn[$col] + $padding;
753 $widthFin - 1,
760 $this->image = $imgFin;
761 $this->verticalBased = imagesy($imgFin) / 2;
770 $this->nodes[1]->draw($size);
771 $imgExp = $this->nodes[1]->image;
772 $baseExp = $this->nodes[1]->verticalBased;
776 $imgSup = $this->helper->displaySymbol("right", 16);
782 $imgFin = imagecreate(max($width, 1), max($height, 1));
783 $black = $this->helper->getFontColor($imgFin);
784 $white = $this->helper->getBackColor($imgFin);
785 imagefilledrectangle($imgFin, 0, 0, $width - 1, $height - 1, $white);
786 imagecopy($imgFin, $imgSup, $width - 6, 0, $widthSup - 6, 0, $widthSup, $heightSup);
788 imageline($imgFin, 0, 6, $width - 4, 6, $black);
789 … imagecopy($imgFin, $imgExp, ($width - $widthExp) / 2, $heightSup, 0, 0, $widthExp, $heightExp);
790 $this->image = $imgFin;
791 $this->verticalBased = $baseExp + $heightSup;
800 $this->nodes[1]->draw($size);
801 $imgExp = $this->nodes[1]->image;
802 $baseExp = $this->nodes[1]->verticalBased;
808 $imgFin = imagecreate(max($width, 1), max($height, 1));
809 $black = $this->helper->getFontColor($imgFin);
810 $white = $this->helper->getBackColor($imgFin);
811 imagefilledrectangle($imgFin, 0, 0, $width - 1, $height - 1, $white);
815 $this->image = $imgFin;
816 $this->verticalBased = $baseExp + 2;
825 $this->nodes[1]->draw($size);
826 $imgExp = $this->nodes[1]->image;
827 $baseExp = $this->nodes[1]->verticalBased;
833 $imgFin = imagecreate(max($width, 1), max($height, 1));
834 $black = $this->helper->getFontColor($imgFin);
835 $white = $this->helper->getBackColor($imgFin);
836 imagefilledrectangle($imgFin, 0, 0, $width - 1, $height - 1, $white);
840 $this->image = $imgFin;
841 $this->verticalBased = $baseExp;
849 $imgSup = $this->helper->displaySymbol("_hat", $size);
851 $this->nodes[1]->draw($size);
852 $imgExp = $this->nodes[1]->image;
853 $baseExp = $this->nodes[1]->verticalBased;
862 $width = max($widthSup, $widthExp) + ceil($size / 8);
863 $imgFin = imagecreate(max($width, 1), max($height, 1));
864 $white = $this->helper->getBackColor($imgFin);
865 imagefilledrectangle($imgFin, 0, 0, $width - 1, $height - 1, $white);
866 imagecopy($imgFin, $imgSup, ($width - $widthSup) / 2, 0, 0, 0, $widthSup, $heightSup);
867 … imagecopy($imgFin, $imgExp, ($width - $widthExp) / 2, $heightSup, 0, 0, $widthExp, $heightExp);
868 $this->image = $imgFin;
869 $this->verticalBased = $baseExp + $heightSup;
877 $imgLim = $this->helper->displayMath("_lim", $size);
882 $this->nodes[1]->draw($size * 0.8);
883 $imgInf = $this->nodes[1]->image;
887 $this->nodes[2]->draw($size);
888 $imgExp = $this->nodes[2]->image;
889 $baseExp = $this->nodes[2]->verticalBased;
892 $width = max($widthInf, $widthLim) + ceil($size / 8);
893 $imgFin = imagecreate(max($width, 1), max($height, 1));
894 $white = $this->helper->getBackColor($imgFin);
895 imagefilledrectangle($imgFin, 0, 0, $width - 1, $height - 1, $white);
896 imagecopy($imgFin, $imgLim, ($width - $widthLim) / 2, 0, 0, 0, $widthLim, $heightLim);
897 … imagecopy($imgFin, $imgInf, ($width - $widthInf) / 2, $heightLim, 0, 0, $widthInf, $heightInf);
899 $this->image = $this->helper->alignment2($imgFin, $baseLim, $imgExp, $baseExp);
900 $this->verticalBased = max($baseLim, $baseExp);
908 $this->nodes[2]->draw($size);
909 $imgExp = $this->nodes[2]->image;
910 $baseExp = $this->nodes[2]->verticalBased;
912 if ($this->nodes[1]->text == "&$") {
913 $leftImg = $this->helper->parenthesis($heightExp, $this->nodes[1]->nodes[0]->text);
915 $leftImg = $this->helper->parenthesis($heightExp, $this->nodes[1]->text);
918 if ($this->nodes[3]->text == "&$") {
919 if(isset($this->nodes[3]->nodes[0])) {
920 $rightImg = $this->helper->parenthesis($heightExp, $this->nodes[3]->nodes[0]->text);
922 $rightImg = $this->helper->parenthesis($heightExp, '');
925 $rightImg = $this->helper->parenthesis($heightExp, $this->nodes[3]->text);
928 …$this->image = $this->helper->alignment3($leftImg, $leftBase, $imgExp, $baseExp, $rightImg, $right…
929 $this->verticalBased = max($leftBase, $baseExp, $rightBase);