speedata / publisher

speedata Publisher - a professional database Publishing system

Home Page:https://www.speedata.de/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Numbers not allowed in (RGB) attribute name of DefineColor tag

Cicorione opened this issue · comments

Hi @pgundlach

I am worry that a new regression has been introduced.

<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" />
  <DefineColor name="yellowAlpha05" 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 colors.accent;
  </DefineGraphic>
  <Record element="data">
    <PlaceObject>
      <Box height="4" width="4" graphic="roundedcorners" />
    </PlaceObject>

    <PlaceObject row="8" column="3" >
      <Circle
      radiusx="2"
      backgroundcolor="yellowAlpha05"/>
    </PlaceObject>
  </Record>
</Layout>

log

sp --layout=spcolor.xml --dummy --jobname=spcolor
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.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 "/NAG/spcolor.xml"
Warning: [page 1] The color "@accent" has an @ in it, the metapost color will be colors.accent, not colors.@accent
Defining color "@accent" (147)
Defining color "yellowAlpha05" (148)
Loading aux file "/NAG/spcolor-aux.xml"
Page of type "Default Page" created (1)
Number of rows: 28, number of columns = 19
Error: [page 1] Executing rgbcolor colors.yellowAlpha05; colors.yellowAlpha05 := (0.00392157, 0.0027451, 0.000392157);: ! Illegal suffix of declared variable will be flushed.
<to be read again> 
                   5
<*> rgbcolor colors.yellowAlpha05
                                 ; colors.yellowAlpha05 := (0.00392157, 0.00...
Variables in declarations must consist entirely of
names and collective subscripts, e.g., `x[]a'.
Explicit subscripts like `x15a' aren't permitted.
I'm going to discard the junk I found here,
up to the next comma or the end of the declaration.

>> colors.yellowAlpha5
>> (0.0039215700000000001,0.0027450999999999999,0.00039215700000000002)
! Equation cannot be performed (numeric=color).
<to be read again> 
                   ;
<*> ...05 := (0.00392157, 0.0027451, 0.000392157);
                                                  
I'm sorry, but I don't know how to make such things equal.
(See the two expressions just above the error message.)

Error: [page 1] Executing beginfig(1);: 

Error: [page 1] 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 colors.accent;
  : 

Error: [page 1] 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: 108.990153ms
exit status 1

Since I can't control directly the opacity of a frame I decided to trick it with colors this way:

    <DefineColor name="npyellow" model="RGB" r="255" g="255" b="25" alpha="0"/>
    <DefineColor name="npyellow100" model="RGB" r="255" g="178" b="25" alpha="100"/>
    <DefineColor name="npyellow90" model="RGB" r="255" g="178" b="25" alpha="50" />
    <DefineColor name="npyellow80" model="RGB" r="255" g="178" b="25" alpha="10" />

I don't know if this limitation is by design or not, it was my solution to use colors like:color100, color90, color80 ; because based on my knowledge Publish does not offer any tool to change the opacity of the elements on the page, so I thought to trick it with variables like ht

<!-- FEATURES -->

<!-- The variables that control opacity -->
<SetVariable variable="op" select="100" />
<SetVariable variable="special" select="concat($accent,$op)" />

<ForAll select="extra">
	<PlaceObject column="1.3">
		<Frame backgroundcolor="{$special}" framecolor="{$accent}" rulewidth="4pt">
			<Table width="5">
 				<Tr>
					<Td valign="middle" align="center">
						<Paragraph fontfamily="pagenum">
							<Value select="." />
						</Paragraph>
					</Td>
				</Tr>
			</Table>
		</Frame>
 	</PlaceObject>

	<SetVariable variable="op" select="$op - 10" />

</ForAll>

Unfortunately with previous commits the layout compiled but opacity didn't work, with the latest commits where opacity should work I am having issue with name of the colors... 🤷‍♂️

Thank you. Fix will be in the next version of the speedata Publisher (no ETA yet).

Workaround: rename the color (only a-z, A-Z ...)

(Version 4.15.16 is onlinen now)