From b12b1e799be82022ba2155d99785235802a21ccf Mon Sep 17 00:00:00 2001 From: deyan Date: Mon, 23 Dec 2024 21:34:14 +0200 Subject: [PATCH] only adjust black color during box operations --- lib/LaTeXML/Engine/TeX_Box.pool.ltxml | 3 ++- t/graphics/xcolors.pdf | Bin 98412 -> 98483 bytes t/graphics/xcolors.tex | 2 ++ t/graphics/xcolors.xml | 4 +++- 4 files changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/LaTeXML/Engine/TeX_Box.pool.ltxml b/lib/LaTeXML/Engine/TeX_Box.pool.ltxml index 56ae014d9..ff7aa7eba 100644 --- a/lib/LaTeXML/Engine/TeX_Box.pool.ltxml +++ b/lib/LaTeXML/Engine/TeX_Box.pool.ltxml @@ -552,7 +552,8 @@ sub adjustBoxColor_rec { sub adjustBoxColor_internal { my ($color, $box) = @_; if (my $font = $box->getFont) { - $box->setFont($font->merge(color => $color)); } + if (Black->equals($font->getColor)) { + $box->setFont($font->merge(color => $color)); } } return; } DefPrimitive('\box Number', sub { diff --git a/t/graphics/xcolors.pdf b/t/graphics/xcolors.pdf index 6a81f925734760087f9da469dd95c5ea2e289474..87dcd3dc7472d11efb9f2ac164f3f685812bf331 100644 GIT binary patch delta 2652 zcmV-i3ZwPxfCjUH2CyqN12i%+moReyDSvfR%TB{E5WM#*d`u28eykt47HB1egj8}X z9MUGFQ9~oSEmi-Xb!;R^Lk{-FyPlaHFCz_MWI1DTpBJ;cg|H;2xfYrfAB0OujkZK9 zLxohNsK`1gc6FLbDU&zG;ZSz|2a-!FY|^_bq>j7(+{Jj4W|*qe_u>huI8r&!=YNCM zaz@s}^~R+fYcgC8u`-CdTS!YdPzhRiNsMIN&|Hcjh6}vIg-Y(v$5a1_j7BA{*@U2K zUA;ZEU#UdgW5A_`gG6!)!YUKh+#If!V=s_caB2k)#B*MiYy{$0uhu3vk9!%{U`Mn>1V)M z9PrTt&AT%6_-D)sSAfIENd|y{47KnN=3_DY29@p9(uOvAH9)RS9(`OoN5f0Y5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0)(2uVGe}7A7cn(hI zFzlewT{Hx_g+{H>xE>n2JDN_j@1U_gZtMmcxkjUUXx#2-`n|IQ$aevGwGEK&0rI;8 z>UOveoY;laM$<}_?O_SKW9hc0O)REY$5L!0OS&~4)58;Y$J1{t9Yp(CL!DnW}Vmr*j;Q(ZJ?6gY2jE z+3g>o)tCQ%0d7z-LN`V>MMgM8HaR##K|(?_Fhnv#HZ?*4nbiU zh2e9qdA#Q98f%402!##k)e?zBLLwrevk9dYSc1d?baw$(U={r5Yo5H{002J^$WVZQ z4^<$#qAA*n3MC~)PeuwxB-jT4 diff --git a/t/graphics/xcolors.tex b/t/graphics/xcolors.tex index 01d24f069..d669c2703 100644 --- a/t/graphics/xcolors.tex +++ b/t/graphics/xcolors.tex @@ -252,6 +252,8 @@ \section{Boxes} \copy\mybox \setbox\mybox=\hbox{Should be Red!} {\color{red}\copy\mybox} +\setbox\mybox=\hbox{The final word should be \textcolor{green}{green}} +\box\mybox \section{Custom rgb directives} \color{rgb:red,4;green,2;yellow,1} Brown diff --git a/t/graphics/xcolors.xml b/t/graphics/xcolors.xml index 6e32e3cbd..00b8ac56f 100644 --- a/t/graphics/xcolors.xml +++ b/t/graphics/xcolors.xml @@ -645,7 +645,9 @@ A=100*13 = 1300pt;

<tag close=" ">11</tag>Boxes

Should NOT be Red! -Should be Red!

+Should be Red! + +The final word should be green