Closed Cicorione closed 10 months ago
Opacity is not working on other element like frames or circles as well.
<Layout xmlns="urn:speedata.de:2009/publisher/en"
xmlns:sd="urn:speedata:2009/publisher/functions/en">
<!-- <DefineColor name="@accent" model="spotcolor" colorname="Pantone 116 C"/> -->
<!-- <DefineColor name="@accent" model="rgb" r="100" g="70" b="10" alpha="90" /> -->
<DefineColor name="@accent" model="RGB" r="255" g="178.5" b="25.5" alpha="5" />
<DefineGraphic name="roundedcorners"> save corner; corner := 10; filldraw (0, box.height -
corner ){down} .. {down}(0,corner) .. (corner,0) -- (box.width - corner,0) ..
{up}(box.width, corner) -- (box.width, box.height - corner) .. {left}(box.width - corner,
box.height) -- (corner,box.height){left} .. cycle withcolor spcolor("@accent");
</DefineGraphic>
<Record element="data">
<PlaceObject>
<Box height="4" width="4" graphic="roundedcorners" />
</PlaceObject>
<PlaceObject row="8" column="3" >
<Circle
radiusx="2"
backgroundcolor="@accent"/>
</PlaceObject>
</Record>
</Layout>
Unless I did not understand how opacity works on Publisher... :man_shrugging:
There is more than one bug in the implementation. I need to fix them before I can write a solution.
I've fixed a few bugs in version 4.15.15; your layout works with that version. (Now available)
colors.accent
(you don't use this color directly, spcolor("@accent")
is still correct.Thank you as always for the valuable bug reports!
Hi @pgundlach FYI as for this version:
commit 97d8199bd09188c723664c0ce9981756af64aa9d (HEAD -> develop, origin/develop, origin/HEAD)
Author: Patrick Gundlach <gundlach@speedata.de>
Date: Sun Nov 26 12:59:26 2023 +0100
Version 4.15.15
colors.accent
does not apply any color and spcolor("@accent")
causes Publisher to stop.
Thanks
<Layout xmlns="urn:speedata.de:2009/publisher/en"
xmlns:sd="urn:speedata:2009/publisher/functions/en">
<DefineColor name="@accent" model="spotcolor" colorname="Pantone 116 C" />
<DefineGraphic name="r"> fill box withcolor spcolor("@accent"); </DefineGraphic>
<Record element="data">
<PlaceObject>
<Box height="5" width="1" graphic="r" />
</PlaceObject>
</Record>
</Layout>
does not work? Could you post the log if it doesn't?
I'll fix the other issue.
Hi Patric,
your layout work here with the symbol @
:
<DefineColor name="@accent" model="spotcolor" colorname="Pantone 116 C" />
Instead in this way:
<DefineColor name="npyellow" model="cmyk" c="0" m="30" y="90" k="0" />
And assign it as attribute from data:
<section secname="HDMI" accent="npyellow" xmlns:xi="http://www.w3.org/2001/XInclude">
And recall it as variable:
<SetVariable variable="accent" select="@accent" />
with my graphic (actually your)
<DefineGraphic name="accentroundedcorners"> save corner; corner := 10; filldraw (0, box.height -
corner ){down} .. {down}(0,corner) .. (corner,0) -- (box.width - corner,0) ..
{up}(box.width, corner) -- (box.width, box.height - corner) .. {left}(box.width - corner,
box.height) -- (corner,box.height){left} .. cycle withcolor spcolor("@accent"); </DefineGraphic>
For some reason fails:
~/git/publisher/bin/./sp --layout=layout_028sp.xml --data=main_data.xml --jobname=spcolor3
Run speedata publisher 4.15.15 (Pro)
Loading file sdini.lua ... done
Load file: "publisher.lua" ...
Load file: "commands.lua" ...
Load file: "fonts.lua" ...
Load file: "fontloader.lua" ...
Load file: "fontloader.lua" ... done
Load file: "fonts.lua" ... done
Load file: "tabular.lua" ...
Load file: "tabular.lua" ... done
Load file: "par.lua" ...
Load file: "par.lua" ... done
Load file: "commands.lua" ... done
Load file: "grid.lua" ...
Load file: "grid.lua" ... done
Load file: "box.lua" ...
Load file: "box.lua" ... done
Load file: "layout_functions.lua" ...
Load file: "layout_functions.lua" ... done
Load file: "publisher.lua" ... done
Start processing
Running LuaTeX version 1.15.0 on linux
Loading hyphenation patterns "hyph-en-gb.pat.txt".
Language id: 0
Preload font "texgyreheros-regular.otf" at 10pt (id: 1)
Preload font "texgyreheros-regular.otf" at 8pt (id: 2)
Preload font "texgyreheros-bold.otf" at 10pt (id: 3)
Preload font "texgyreheros-bold.otf" at 8pt (id: 4)
Preload font "texgyreheros-italic.otf" at 10pt (id: 5)
Preload font "texgyreheros-italic.otf" at 8pt (id: 6)
Preload font "texgyreheros-bolditalic.otf" at 10pt (id: 7)
Preload font "texgyreheros-bolditalic.otf" at 8pt (id: 8)
DefineFontfamily "text" size 10pt/12pt id: 1
Loading layout instructions "/mnt/usb/NAG/layout_028sp.xml"
Load Fontfile "Serpentine-Medium.otf"
Load Fontfile "Serpentine-Bold.otf"
Load Fontfile "Serpentine-BoldOblique.otf"
Load Fontfile "Oswald-Light.ttf"
Load Fontfile "Oswald-Bold.ttf"
Preload font "Oswald-Light.ttf" at 8pt (id: 9)
Preload font "Oswald-Light.ttf" at 6.4pt (id: 10)
Preload font "Oswald-Bold.ttf" at 8pt (id: 11)
Preload font "Oswald-Bold.ttf" at 6.4pt (id: 12)
DefineFontfamily "bullet" size 8pt/10pt id: 2
Preload font "Oswald-Light.ttf" at 14pt (id: 13)
Preload font "Oswald-Light.ttf" at 11pt (id: 14)
Preload font "Oswald-Bold.ttf" at 14pt (id: 15)
Preload font "Oswald-Bold.ttf" at 11pt (id: 16)
DefineFontfamily "title" size 14pt/16pt id: 3
Preload font "Serpentine-BoldOblique.otf" at 14pt (id: 17)
Preload font "Serpentine-BoldOblique.otf" at 11pt (id: 18)
DefineFontfamily "new" size 14pt/12pt id: 4
Preload font "Oswald-Bold.ttf" at 10pt (id: 19)
DefineFontfamily "subtitle" size 10pt/12pt id: 5
Preload font "Serpentine-Medium.otf" at 15pt (id: 20)
Preload font "Serpentine-Medium.otf" at 12pt (id: 21)
Preload font "Serpentine-Bold.otf" at 15pt (id: 22)
Preload font "Serpentine-Bold.otf" at 12pt (id: 23)
DefineFontfamily "headerfooter" size 15pt/17pt id: 6
Preload font "Serpentine-Bold.otf" at 10pt (id: 24)
Preload font "Serpentine-Bold.otf" at 8pt (id: 25)
DefineFontfamily "pagenum" size 10pt/12pt id: 7
DefineFontfamily "opensecname" size 15pt/17pt id: 8
Preload font "Serpentine-Bold.otf" at 30pt (id: 26)
Preload font "Serpentine-Bold.otf" at 24pt (id: 27)
DefineFontfamily "opensecnamebig" size 30pt/17pt id: 9
Preload font "Serpentine-Medium.otf" at 18pt (id: 28)
Preload font "Serpentine-Medium.otf" at 14pt (id: 29)
Preload font "Serpentine-Bold.otf" at 18pt (id: 30)
Preload font "Serpentine-Bold.otf" at 14pt (id: 31)
DefineFontfamily "feature" size 18pt/20pt id: 10
Defining color "npgray" (147)
Defining color "darknpgray" (148)
Defining color "npyellow" (149)
Loading data file "/mnt/usb/NAG/main_data.xml"
Selecting node: "section", mode="", pos=1
Page of type "sectionstart" created (1)
Number of rows: 25, number of columns = 17
Searching for image "sec/02/image/open-hdmi-sec.jpg"
Warning: [page 1] Object protrudes into the right margin
Warning: [page 1] Object protrudes below the last line of the page
Warning: [page 1] Conflict in grid
Searching for image "assets/nag-logo-1.pdf"
Create font metrics for "Serpentine-Bold.otf" at 30pt (id: 26) mode=harfbuzz
Create font metrics for "Serpentine-Bold.otf" at 15pt (id: 22) mode=harfbuzz
Warning: [page 1] Textblock: no objects found!
Selecting node: "subsection", mode="", pos=1
> Shipout page 1
Page of type "left" created (2)
Number of rows: 3, number of columns = 1
mplib warning: error in script: /git/publisher/src/lua/publisher.lua:882: bad argument #1 to 'setmetatable' (table expected, got nil)
Error: [page 2] Executing save corner; corner := 10; filldraw (0, box.height -
corner ){down} .. {down}(0,corner) .. (corner,0) -- (box.width - corner,0) ..
{up}(box.width, corner) -- (box.width, box.height - corner) .. {left}(box.width - corner,
box.height) -- (corner,box.height){left} .. cycle withcolor spcolor("@accent"); :
! An expression can't begin with `;'.
<inserted text>
0
<to be read again>
;
<*> ...eft} .. cycle withcolor spcolor("@accent");
I'm afraid I need some sort of value in order to continue,
so I've tentatively inserted `0'. You may want to
delete this zero and insert something else;
see Chapter 27 of The METAFONTbook for an example.
Error: [page 2] Executing endfig;: [1]
! error: (node lib): lua <node> expected, not an object with type nil
! ==> Fatal error occurred, no output PDF file produced!Total run time: 858.435383ms
exit status 1
Sorry... 🤷♂️
This works as intended. There is no color @accent
.
Next version will allow this:
<Layout xmlns="urn:speedata.de:2009/publisher/en"
xmlns:sd="urn:speedata:2009/publisher/functions/en">
<DefineColor name="npyellow" model="cmyk" c="0" m="30" y="90" k="0" />
<SetVariable variable="accent" select="'npyellow'" type="mp:string" />
<DefineGraphic name="r"> fill box withcolor spcolor( accent ); </DefineGraphic>
<Record element="data">
<PlaceObject>
<Box height="5" width="1" graphic="r" />
</PlaceObject>
</Record>
</Layout>
Hi Patrick,
I am not sure I am doing this properly...
sp --version
Version: 4.15.16 (Pro)
However with data this way:
<section secname="Sec01" accent="'npyellow'" xmlns:xi="http://www.w3.org/2001/XInclude">
[...]
</section>
The color declared at the beginning of the file
<DefineColor name="npyellow" model="RGB" r="255" g="178" b="25" alpha="100"/>
And the metapost graphic that should read the variable value from the data:
<DefineGraphic name="accentroundedcorners"> save corner; corner := 10; filldraw (0, box.height -
corner ){down} .. {down}(0,corner) .. (corner,0) -- (box.width - corner,0) ..
{up}(box.width, corner) -- (box.width, box.height - corner) .. {left}(box.width - corner,
box.height) -- (corner,box.height){left} .. cycle withcolor spcolor( accent );
</DefineGraphic>
And recalling it with:
<SetVariable variable="accent" select="@accent" type="mp:string" />
Does not compile:
umber of rows: 3, number of columns = 1
Call "PlaceObject" from layout
Call "Box" from layout
Git/publisher/src/lua/publisher/metapost.lua:226: bad argument #5 to 'format' (value has no literal form)
stack traceback:
[C]: in function 'string.format'
Git/publisher/src/lua/publisher/metapost.lua:226: in function 'publisher.metapost.newbox'
Git/publisher/src/lua/publisher/metapost.lua:718: in function 'publisher.metapost.prepareboxgraphic'
Git/publisher/src/lua/publisher/metapost.lua:757: in function 'publisher.metapost.boxgraphic'
Git/publisher/src/lua/publisher/commands.lua:399: in function 'publisher.commands.box'
Git/publisher/src/lua/publisher.lua:769: in function 'publisher.dispatch'
Git/publisher/src/lua/publisher/commands.lua:3127: in function 'publisher.commands.place_object'
Git/publisher/src/lua/publisher.lua:769: in function 'publisher.dispatch'
Git/publisher/src/lua/publisher.lua:2518: in function 'publisher.initialize_page'
Git/publisher/src/lua/publisher.lua:2565: in function 'publisher.setup_page'
...
Git/publisher/src/lua/publisher.lua:769: in function 'publisher.dispatch'
Git/publisher/src/lua/publisher/commands.lua:3402: in function 'publisher.commands.process_node'
Git/publisher/src/lua/publisher.lua:769: in function 'publisher.dispatch'
Git/publisher/src/lua/publisher/commands.lua:3402: in function 'publisher.commands.process_node'
Git/publisher/src/lua/publisher.lua:769: in function 'publisher.dispatch'
Git/publisher/src/lua/publisher.lua:1510: in function 'publisher.initialize_luatex_and_generate_pdf'
Git/publisher/src/lua/publisher.lua:1001: in function 'publisher.dothings'
Git/publisher/src/lua/publisher/spinit.lua:401: in function 'main_loop'
Git/publisher/src/lua/publisher/spinit.lua:410: in main chunk
[C]: in function 'require'
[\directlua]:1: in main chunk.
l.5 \directlua{require("publisher.spinit")}
The lua interpreter ran into a problem, so the
remainder of this lua chunk will be ignored.
Output written on layout28sp.pdf (1 page, 6468296 bytes).
Thanks!
Without testing: you should leave out the quotes with
<section secname="Sec01" accent="'npyellow'" xmlns:xi="http://www.w3.org/2001/XInclude">
so
<section secname="Sec01" accent="npyellow" xmlns:xi="http://www.w3.org/2001/XInclude">
should work.
Hi @pgundlach
even without ' '
it does not work.
I get the same errors:
Call "Box" from layout
/Git/publisher/src/lua/publisher/metapost.lua:226: bad argument #5 to 'format' (value has no literal form)
stack traceback:
[C]: in function 'string.format'
/Git/publisher/src/lua/publisher/metapost.lua:226: in function 'publisher.metapost.newbox'
/Git/publisher/src/lua/publisher/metapost.lua:718: in function 'publisher.metapost.prepareboxgraphic'
/Git/publisher/src/lua/publisher/metapost.lua:757: in function 'publisher.metapost.boxgraphic'
/Git/publisher/src/lua/publisher/commands.lua:399: in function 'publisher.commands.box'
/Git/publisher/src/lua/publisher.lua:769: in function 'publisher.dispatch'
/Git/publisher/src/lua/publisher/commands.lua:3127: in function 'publisher.commands.place_object'
/Git/publisher/src/lua/publisher.lua:769: in function 'publisher.dispatch'
/Git/publisher/src/lua/publisher.lua:2518: in function 'publisher.initialize_page'
/Git/publisher/src/lua/publisher.lua:2565: in function 'publisher.setup_page'
...
/Git/publisher/src/lua/publisher.lua:769: in function 'publisher.dispatch'
/Git/publisher/src/lua/publisher/commands.lua:3402: in function 'publisher.commands.process_node'
/Git/publisher/src/lua/publisher.lua:769: in function 'publisher.dispatch'
/Git/publisher/src/lua/publisher/commands.lua:3402: in function 'publisher.commands.process_node'
/Git/publisher/src/lua/publisher.lua:769: in function 'publisher.dispatch'
/Git/publisher/src/lua/publisher.lua:1510: in function 'publisher.initialize_luatex_and_generate_pdf'
/Git/publisher/src/lua/publisher.lua:1001: in function 'publisher.dothings'
/Git/publisher/src/lua/publisher/spinit.lua:401: in function 'main_loop'
/Git/publisher/src/lua/publisher/spinit.lua:410: in main chunk
[C]: in function 'require'
[\directlua]:1: in main chunk.
l.5 \directlua{require("publisher.spinit")}
(see the transcript file for additional information)
Output written on layout28sp.pdf (1 page, 6468296 bytes).
Transcript written on layout28sp.log.
Total run time: 580.694951ms
exit status 1
:man_shrugging:
Hi @pgundlach
I believe something is not quite working well.
A step back before. Since I don't find any method to change dynamically I am trying to use a barba trick
The trick is naming a color like "mycolor" + something
; initially I used numbers but:
Warning: [page 1] The color "test10" has characters in it that confuse
the metapost interpreter, therefore I have renamed the color
for metapost to colors.test
Defining color "test10" (152)
Therefore I changed numbers for letters and I made a test to see if the correct string is created:
<Layout xmlns="urn:speedata.de:2009/publisher/en"
xmlns:sd="urn:speedata:2009/publisher/functions/en">
<DefineColor name="test" model="RGB" r="0" g="255" b="0" alpha="10" />
<DefineColor name="testA" model="RGB" r="255" g="178" b="32" alpha="100" />
<DefineColor name="testAA" model="RGB" r="255" g="178" b="32" alpha="80" />
<DefineColor name="testAAA" model="RGB" r="255" g="178" b="32" alpha="60" />
<DefineColor name="testAAAA" model="RGB" r="255" g="178" b="32" alpha="40" />
<!-- example to show that MP doesn't like colors with number -->
<DefineColor name="test10" model="RGB" r="255" g="32" b="32" alpha="10" />
<!-- Regular Color -->
<DefineGraphic name="r"> fill box withcolor colors.test; </DefineGraphic>
<!-- SPColor -->
<DefineGraphic name="s"> fill box withcolor spcolor(special); </DefineGraphic>
<Record element="data">
<SetVariable variable="op" select="'A'" />
<SetVariable variable="special" select="concat('test',$op)" />
<Loop select="4">
<PlaceObject>
<Box height="4" width="4" graphic="r" />
</PlaceObject>
<NextRow rows="2"/>
<SetVariable variable="op" select="concat($op,'A')" />
<SetVariable variable="special" select="concat('test',$op)" />
<Message select="$op" />
<Message select="$special" />
</Loop>
</Record>
</Layout>
And as a matter of fact:
sp --layout=opacity.xml --dummy --jobname=opacity
Run speedata publisher 4.15.16 (Pro)
Loading file sdini.lua ... done
Load file: "publisher.lua" ...
Load file: "commands.lua" ...
Load file: "fonts.lua" ...
Load file: "fontloader.lua" ...
Load file: "fontloader.lua" ... done
Load file: "fonts.lua" ... done
Load file: "tabular.lua" ...
Load file: "tabular.lua" ... done
Load file: "par.lua" ...
Load file: "par.lua" ... done
Load file: "commands.lua" ... done
Load file: "grid.lua" ...
Load file: "grid.lua" ... done
Load file: "box.lua" ...
Load file: "box.lua" ... done
Load file: "layout_functions.lua" ...
Load file: "layout_functions.lua" ... done
Load file: "publisher.lua" ... done
Start processing
Running LuaTeX version 1.16.0 on freebsd
Loading hyphenation patterns "hyph-en-gb.pat.txt".
Language id: 0
Preload font "texgyreheros-regular.otf" at 10pt (id: 1)
Preload font "texgyreheros-regular.otf" at 8pt (id: 2)
Preload font "texgyreheros-bold.otf" at 10pt (id: 3)
Preload font "texgyreheros-bold.otf" at 8pt (id: 4)
Preload font "texgyreheros-italic.otf" at 10pt (id: 5)
Preload font "texgyreheros-italic.otf" at 8pt (id: 6)
Preload font "texgyreheros-bolditalic.otf" at 10pt (id: 7)
Preload font "texgyreheros-bolditalic.otf" at 8pt (id: 8)
DefineFontfamily "text" size 10pt/12pt id: 1
Loading layout instructions "/media/Samsung_Flash_Drive_FIT_0363920010005443_s1/NAG/opacity.xml"
Defining color "test" (147)
Defining color "testA" (148)
Defining color "testAA" (149)
Defining color "testAAA" (150)
Defining color "testAAAA" (151)
Warning: [page 1] The color "test10" has characters in it that confuse
the metapost interpreter, therefore I have renamed the color
for metapost to colors.test
Defining color "test10" (152)
Loading aux file "/media/Samsung_Flash_Drive_FIT_0363920010005443_s1/NAG/opacity-aux.xml"
Page of type "Default Page" created (1)
Number of rows: 28, number of columns = 19
PlaceObject: Box at (1,1) wd/ht: 4/4 in "_page" (p. 1)
Message: "AA"
Message: "testAA"
PlaceObject: Box at (1,6) wd/ht: 4/4 in "_page" (p. 1)
Message: "AAA"
Message: "testAAA"
PlaceObject: Box at (1,11) wd/ht: 4/4 in "_page" (p. 1)
Message: "AAAA"
Message: "testAAAA"
PlaceObject: Box at (1,16) wd/ht: 4/4 in "_page" (p. 1)
Message: "AAAAA"
Message: "testAAAAA"
> Shipout page 1
Stop processing data
0 errors occurred
Duration: 0.023585 seconds
Output written on opacity.pdf (1 page, 1115 bytes).
Transcript written on opacity.log.
Total run time: 122.107715ms
zagor@dbsd /m/S/NAG> sp --layout=opacity.xml --dummy --jobname=opacity
Run speedata publisher 4.15.16 (Pro)
Loading file sdini.lua ... done
Load file: "publisher.lua" ...
Load file: "commands.lua" ...
Load file: "fonts.lua" ...
Load file: "fontloader.lua" ...
Load file: "fontloader.lua" ... done
Load file: "fonts.lua" ... done
Load file: "tabular.lua" ...
Load file: "tabular.lua" ... done
Load file: "par.lua" ...
Load file: "par.lua" ... done
Load file: "commands.lua" ... done
Load file: "grid.lua" ...
Load file: "grid.lua" ... done
Load file: "box.lua" ...
Load file: "box.lua" ... done
Load file: "layout_functions.lua" ...
Load file: "layout_functions.lua" ... done
Load file: "publisher.lua" ... done
Start processing
Running LuaTeX version 1.16.0 on freebsd
Loading hyphenation patterns "hyph-en-gb.pat.txt".
Language id: 0
Preload font "texgyreheros-regular.otf" at 10pt (id: 1)
Preload font "texgyreheros-regular.otf" at 8pt (id: 2)
Preload font "texgyreheros-bold.otf" at 10pt (id: 3)
Preload font "texgyreheros-bold.otf" at 8pt (id: 4)
Preload font "texgyreheros-italic.otf" at 10pt (id: 5)
Preload font "texgyreheros-italic.otf" at 8pt (id: 6)
Preload font "texgyreheros-bolditalic.otf" at 10pt (id: 7)
Preload font "texgyreheros-bolditalic.otf" at 8pt (id: 8)
DefineFontfamily "text" size 10pt/12pt id: 1
Loading layout instructions "/media/Samsung_Flash_Drive_FIT_0363920010005443_s1/NAG/opacity.xml"
Defining color "test" (147)
Defining color "testA" (148)
Defining color "testAA" (149)
Defining color "testAAA" (150)
Defining color "testAAAA" (151)
Warning: [page 1] The color "test10" has characters in it that confuse
the metapost interpreter, therefore I have renamed the color
for metapost to colors.test
Defining color "test10" (152)
Loading aux file "/media/Samsung_Flash_Drive_FIT_0363920010005443_s1/NAG/opacity-aux.xml"
Page of type "Default Page" created (1)
Number of rows: 28, number of columns = 19
PlaceObject: Box at (1,1) wd/ht: 4/4 in "_page" (p. 1)
Message: "AA"
Message: "testAA"
PlaceObject: Box at (1,6) wd/ht: 4/4 in "_page" (p. 1)
Message: "AAA"
Message: "testAAA"
PlaceObject: Box at (1,11) wd/ht: 4/4 in "_page" (p. 1)
Message: "AAAA"
Message: "testAAAA"
PlaceObject: Box at (1,16) wd/ht: 4/4 in "_page" (p. 1)
Message: "AAAAA"
Message: "testAAAAA"
> Shipout page 1
Stop processing data
0 errors occurred
Duration: 0.023240 seconds
Output written on opacity.pdf (1 page, 1115 bytes).
Transcript written on opacity.log.
Total run time: 122.693231ms
Unfortunately something is going wrong: opacity.pdf
Color is red when should be green, opacity is not applied. However I moved forward the same with the tests.
In the second test few changes were made:
<SetVariable variable="special" select="concat('test',$op)"
for
<SetVariable variable="special" select="concat('test',$op)" type="mp:string"/>
<Box height="4" width="4" graphic="r" />
for
<Box height="4" width="4" graphic="s" />
<Layout xmlns="urn:speedata.de:2009/publisher/en"
xmlns:sd="urn:speedata:2009/publisher/functions/en">
<DefineColor name="testA" model="RGB" r="255" g="178" b="32" alpha="100" />
<DefineColor name="testAA" model="RGB" r="255" g="178" b="32" alpha="80" />
<DefineColor name="testAAA" model="RGB" r="255" g="178" b="32" alpha="60" />
<DefineColor name="testAAAA" model="RGB" r="255" g="178" b="32" alpha="40" />
<!-- example to show that MP doesn't like colors with number -->
<DefineColor name="test10" model="RGB" r="255" g="32" b="32" alpha="10" />
<!-- Regular Color -->
<DefineGraphic name="r"> fill box withcolor colors.test; </DefineGraphic>
<!-- SPColor -->
<DefineGraphic name="s"> fill box withcolor spcolor(special); </DefineGraphic>
<Record element="data">
<SetVariable variable="op" select="'A'" />
<SetVariable variable="special" select="concat('test',$op)" type="mp:string"/>
<Loop select="4">
<PlaceObject>
<Box height="4" width="4" graphic="s" />
</PlaceObject>
<NextRow rows="2"/>
<SetVariable variable="op" select="concat($op,'A')" />
<SetVariable variable="special" select="concat('test',$op)" type="mp:string"/>
<Message select="$op" />
<Message select="$special" />
</Loop>
</Record>
</Layout>
Although the Publisher complains:
sp --layout=opacity2.xml --dummy --jobname=opacity2
Run speedata publisher 4.15.16 (Pro)
Loading file sdini.lua ... done
Load file: "publisher.lua" ...
Load file: "commands.lua" ...
Load file: "fonts.lua" ...
Load file: "fontloader.lua" ...
Load file: "fontloader.lua" ... done
Load file: "fonts.lua" ... done
Load file: "tabular.lua" ...
Load file: "tabular.lua" ... done
Load file: "par.lua" ...
Load file: "par.lua" ... done
Load file: "commands.lua" ... done
Load file: "grid.lua" ...
Load file: "grid.lua" ... done
Load file: "box.lua" ...
Load file: "box.lua" ... done
Load file: "layout_functions.lua" ...
Load file: "layout_functions.lua" ... done
Load file: "publisher.lua" ... done
Start processing
Running LuaTeX version 1.16.0 on freebsd
Loading hyphenation patterns "hyph-en-gb.pat.txt".
Language id: 0
Preload font "texgyreheros-regular.otf" at 10pt (id: 1)
Preload font "texgyreheros-regular.otf" at 8pt (id: 2)
Preload font "texgyreheros-bold.otf" at 10pt (id: 3)
Preload font "texgyreheros-bold.otf" at 8pt (id: 4)
Preload font "texgyreheros-italic.otf" at 10pt (id: 5)
Preload font "texgyreheros-italic.otf" at 8pt (id: 6)
Preload font "texgyreheros-bolditalic.otf" at 10pt (id: 7)
Preload font "texgyreheros-bolditalic.otf" at 8pt (id: 8)
DefineFontfamily "text" size 10pt/12pt id: 1
Loading layout instructions "/media/Samsung_Flash_Drive_FIT_0363920010005443_s1/NAG/opacity2.xml"
Defining color "test" (147)
Defining color "testA" (148)
Defining color "testAA" (149)
Defining color "testAAA" (150)
Defining color "testAAAA" (151)
Warning: [page 1] The color "test10" has characters in it that confuse
the metapost interpreter, therefore I have renamed the color
for metapost to colors.test
Defining color "test10" (152)
Loading aux file "/media/Samsung_Flash_Drive_FIT_0363920010005443_s1/NAG/opacity2-aux.xml"
Page of type "Default Page" created (1)
Number of rows: 28, number of columns = 19
PlaceObject: Box at (1,1) wd/ht: 4/4 in "_page" (p. 1)
Message: "AA"
Error: [page 1] Variable "special" undefined
Message: "nil"
PlaceObject: Box at (1,6) wd/ht: 4/4 in "_page" (p. 1)
Message: "AAA"
Error: [page 1] Variable "special" undefined
Message: "nil"
PlaceObject: Box at (1,11) wd/ht: 4/4 in "_page" (p. 1)
Message: "AAAA"
Error: [page 1] Variable "special" undefined
Message: "nil"
PlaceObject: Box at (1,16) wd/ht: 4/4 in "_page" (p. 1)
Message: "AAAAA"
Error: [page 1] Variable "special" undefined
Message: "nil"
> Shipout page 1
Stop processing data
4 errors occurred
Duration: 0.023395 seconds
Output written on opacity2.pdf (1 page, 1160 bytes).
Transcript written on opacity2.log.
Total run time: 121.723419ms
However colors and opacity were applied properly, so the barba-trick this time worked... :man_shrugging:
The publisher complains because the variable 'special' is only defined for metapost.
The publisher complains because the variable 'special' is only defined for metapost.
Gotcha!
Did you read this? https://github.com/speedata/publisher/issues/542#issuecomment-1842104739
Color came out red instead of green, and opacity wasn't applied at all.
Color is red when should be green, opacity is not applied. However I moved forward the same with the tests.
I think it works as intended. You select graphics "r"
which uses a fixed color colors.test
which has been previously defined with
<DefineColor name="test10" model="RGB" r="255" g="32" b="32" alpha="10" />
alpha gets ignored in fixed colors (I need to document that). And the color test10 looks red to me.
I repeated the test, and perhaps it was another pebcak of mine... 😓
Hi @pgundlach
I don't know if this is a regression but
rgb
model is not working whileRGB
does; then I am not sure if opacity set onDefineColor
is supposed to be read by a Metapost graphic, but it is not.Not sure if this is useful by any means:
layout
log
Thank you! 🙏