nanDECK Version 1.28

Hello everyone, a new version of nanDECK is available, with bug fixes and these new features:

New MODULEPDF directive

This directive adds an editable field to a (pre-existing) PDF file, this is the syntax:

MODULEPDF = "pdf result", "pdf source", page, pos x, pos y, width, height, "default", horizontal alignment, multiline ON/OFF, transparent ON/OFF

The font parameters (name, size and colors) are read by the last FONT line. Example:

font=arial,12,,#FF0000,#00FF00
modulepdf="result.pdf","source.pdf",1,1,1,10,2
font=times new roman,20,,#00FF00,#FF0000
modulepdf="result.pdf","source.pdf",1,1,5,10,4,"Two",CENTER,ON
font=arial,12,,#FF0000,#00FF00
modulepdf="result.pdf","source.pdf",2,1,10,10,2,"Three",RIGHT,OFF,ON

New PAGETEXT directive

This directive writes a text directly in a page (therefore there is not a range parameter, and a 100% here refers to the whole page, not to the card). The font can be specified with a PAGEFONT directive. The syntax is:

PAGETEXT = pos x, pos y, width, height, flags, text, angle

New PAGEBREAK directive

This directive indicates a sequence whose values ​​are associated with the cards. Every time the corresponding value changes between one card and another, a page break is added to the printout. The syntax is:

PAGEBREAK = "values"

New SEED directive

By default, random numbers are generated randomly, but using this directive the sequence of random numbers will be fixed, different depending on the number used as a parameter. This seed number can be set with this directive, or from Config -> Main. The syntax is:

SEED = seed number

New SEEDRANGE directive

It works the same way as SEED, but has a parameter for the application range. The syntax is:

SEEDRANGE = "range", seed number

New LINKREP directive

This directive is used to replace a string with another when reading data from a LINKed file (you can use muliple LINKSEPs before the LINK line). The syntax is:

LINKREP = "from", "to"

New LINKCSV directive

This directive modifies the encoding of csv files read with a LINK directive. If not used, the default is ANSI encoding. The syntax is:

LINKCSV = encoding

The encoding parameter can be ANSI, UTF7, UTF8, UTF16, or UTF16BE.

New PDFMODULE function

This function works the same way as the MODULEPDF directive.

New FILEREAD function

This function creates a label by reading the content from a text file on disk, this is the syntax:

[name] = FILEREAD(filename)

New INFOFILE function

This function returns information read from the file indicated among the parameters, the syntax is:

[name] = INFOFILE(flag, filename)

The flag can be one of this:

E the function returns 1 for file present, 0 for file not present
W return the width of the image file
H return the height of the image file

New RANGETRANS function

This function shifts the values contained in a range by a certain offset (positive or negative), this is the syntax:

[range] = RANGETRANS("range", offset)

New RANGEREP function

This function replaces empty values (-1) from range1 with other values from range2, … rangeN, this is the syntax:

[range] = RANGEREP("range1", "range2", ..."rangeN")

Added different types, colors, thicknesses, and corners for HTMLBORDER

For type, html color, thickness, and corner rounding parameters in HTMLBORDER you can now specify a sequence of two, three, or four values, that are used for drawing different edges (type, html color, and thickness) or corners (corner rounding). Example:

[text]="Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua."
htmlfont=font_t,arial,8,,#000000,justify,0,0,0,,,0,5%
htmlmargins=font_t,5%,5%,5%,5%,top
htmlborder=font_t,rectangle|dotted,#0000FF|#FF0000,2%|1%,5%,5%,5%,5%
htmlfont=font_c,arial,8,,#000000,justify,0,0,0,,,0,5%
htmlmargins=font_c,5%,5%,5%,5%,center
htmlborder=font_c,rectangle|dashed,#0000FF|#FF0000,2%|1%,5%,5%,5%,5%
htmlfont=font_b,arial,8,,#000000,justify,0,0,0,,,0,5%
htmlmargins=font_b,5%,5%,5%,5%,bottom
htmlborder=font_b,rectangle|double,#0000FF|#FF0000,2%|1%,5%,5%,5%,5%
htmltext=1-{(text)},[text],0,0,100%,100%,#FFFFFF,0,BE,100,font_t
htmltext=1-{(text)},[text],0,0,100%,100%,#FFFFFF,0,BE,100,font_c
htmltext=1-{(text)},[text],0,0,100%,100%,#FFFFFF,0,BE,100,font_b

Added parameters in HTMLFONT/HTMLIMAGE to add CSS styles

Now you can directly insert CSS elements into the HTMLFONT (17th parameter) and HTMLIMAGE (16th parameter) directives.

Added parameter in LINE/LINERECT to set distance for elements

For LINE/LINERECT patterns it is possible to specify the distance between the elements. Example:

line=1,0,0,100%,20%,#FF0000,3%,O
line=1,0,20%,100%,40%,#FF0000,3%,O,0,0,0,0,0.1
line=1,0,40%,100%,60%,#FF0000,3%,O,0,0,0,0,0.5
line=1,0,60%,100%,80%,#FF0000,3%,O,0,0,0,0,1
line=1,0,80%,100%,100%,#FF0000,3%,O,0,0,0,0,1.5

Added parameter in ICONS to specify a frame list for icons

With ICONS you can now indicate the positions where icons should be drawn by specifying a group of frames. Example:

[frames1]=framehex(10%,10%,80%,80%,10%,N)
[frames2]=frameclock(10%,10%,80%,80%,20%,20%,12)
icon=,A,test121_a.png
icon=,B,test121_b.png
icon=,C,test121_c.png
icons=1,AABBCCABCABC,0,0,100%,100%,10%,10%,0,PN,center,center,100,1,100,100,frames1*
icons=2,AABBCCABCABC,0,0,100%,100%,10%,10%,0,PN,center,center,100,1,100,100,frames2*

Added 1/2 flags in HTMLFONT to add list format

Flag 1 adds the HTML tags for a bulleted list to a list of paragraphs, flag 2 does the same for a numbered list. Example:

[text]="First element<br>Second element<br>Third element<br>Fourth element<br>Fifth element"
htmlfont=font1,arial,12,1,#FF0000
htmlfont=font2,arial,12,2,#0000FF
htmltext=1,[text],0,0,100%,50%,#FFFFFF,0,BE,100,font1
htmltext=1,[text],0,50%,100%,50%,#FFFFFF,0,BE,100,font2

Added F flag to HTMLKEY to apply font only to replaced text
Added parameters in HTMLKEY to replace strings

The syntax of HTMLKEY now is:

HTMLKEY="range", key, "text", htmlfont, flag CRFZD, "replace", "from", "to"

If the F flag is present in addition to the R flag, the font specified in the fourth parameter is applied only to the replaced text.

In the result found with the R flag, the text specified in the “from” parameter is replaced with the text in the “to” parameter; both can also be a sequence of texts.

Added L flag to ICONS to keep icons in a single line

In ICONS, with the W and H parameters the icons are arranged so as to occupy the entire space, normally on multiple lines (e.g. four icons are arranged in a two by two square); with the L flag this arrangement is forced onto one line.

Added X flag to ICONS to use keys with variable length

In ICONS the X flag must be used when the keys defined with the ICON command do not always have the same length (the 14 parameter is not used). Note that in this case there cannot be keys of different lengths that start with the same letter, e.g. A and AB.

Added U flag in PAGE directive to draw edges over guidelines

Normally, the sections of the page indicated by the edge parameters of the PAGE directive are drawn below the guidelines; adding the U flag causes them to be drawn above.

Added LINE, LINEDOT, LINEDASH types of guidelines in BORDER
Added parameter in BORDER for the thickness of guidelines

Three new styles can be used for the guidelines (LINE, LINEDOT, LINEDASH), also for all the guidelines the thickness can be indicated, and for each guideline a different color can be used (when the ninth parameter has a value greater than 0). Example:

page=21,29.7,portrait,hv
border=none,#000000,0,line,#FF0000#0000FF#FF0000,0.2,0.5,0.5,1,0,0,0.05
gap=0.5,0.5
font=arial,64,,#000000,#FFFF00
text=1-9,{§},0,0,100%,100%

Result (detail):

Added parameters in HTMLTEXT to change text width and height

The fourteenth and fifteenth parameters in HTMLTEXT can be used to change the width and height of the text (100 is the default value). Example:

htmlfont=default,arial,24,,#000000,center
htmlmargins=default,0,0,0,0,center
htmltext=1,"Lorem ipsum",0,0,100%,33%,#FFFFFF,0,BE,100,default
htmltext=1,"Lorem ipsum",0,33%,100%,33%,#FFFFFF,0,BE,100,default,,,150,50
htmltext=1,"Lorem ipsum",0,66%,100%,33%,#FFFFFF,0,BE,100,default,,,50,150

Result:

Added parameter in IMAGEFILTER to draw images with a transparency mask

If a png file is specified in the third parameter of IMAGEFILTER, its transparency layer is applied to all image operations. Example (the mask.png file is transparent at the edges and opaque in the center, in the shape of a rounded rectangle):

htmlfont=default,arial,32,,#FFFFFF,center
htmlmargins=default,0,0,0,0,center
htmltext=1,"Lorem Ipsum",0,0,100%,33%,#0000FF,0,E,100,default
imagefilter=lanczos,solid,"mask.png"
htmltext=1,"Lorem Ipsum",0,33%,100%,33%,#0000FF,0,E,100,default
imagefilter=lanczos,solid,""
htmltext=1,"Lorem Ipsum",0,66%,100%,33%,#0000FF,0,E,100,default

Result:

Note that to return to normal you need to use IMAGEFILTER with an empty parameter

Added I flag in TABLE to draw proportionally the canvas

Normally the canvas is drawn on the entire screen of the virtual table, if the I flag is added instead the proportions between the dimensions are maintained.

Added U/D flags in DECK for specifying if the deck is face up/down

This is used to indicate whether a specific deck should be placed face up or down (the default) on the virtual table.

Added F/B flags in TOKEN to set token in front/back

In the virtual table, tokens created with the TOKEN directive can be placed in front (flag F) or behind (flag B) the cards.

Added 2 flag to HEXGRID for interlaced coordinates
Added 2 flag to FRAMEHEX for interlaced coordinates

Interlaced coordinates, unlike other systems, allow you to always use the same rule to move from one hexagon to another, as you can see in this example:

font=arial,12,,#000000
hexgrid=1,0,0,100%,50%,10%,C.,#000000,empty,0.5%
hexgrid=1,0,50%,100%,50%,10%,2.,#000000,empty,0.5%

Added parameter in CMYK to select the colorspace

the fourth parameter in CMYK allows you to choose one of these colorspaces: AUTO/GRAY/RGB/CMYK/YCBCR/YCBCRK/YCCK (it should be indicated when the image is not displayed correctly).

Added parameter in INDEX function to find other occurrences

The syntax of the INDEX function is now:

[label]=INDEX(substring, string, number)

If the number parameter is 1, the first occurrence of the substring is found, if it is 2, the second, and so on. If it is -1, the first occurrence from left to right, if it is -2, the second, and so on.

Added number option in LINKMULTI directive

In the past, LINKMULTI had to refer to a column in the spreadsheet, now if you want each row to be reproduced multiple times, you can use LINKMULTI=number, where number is 2 to double the rows, 3 to triple them, and so on.

Added parameter in SPECIAL for line division

You can use the character ¶ to write a line of code, which will be split into two (or more) lines at execution. The fourth parameter of the SPECIAL directive allows you to change this special character.

Added * in script parameter to NANDECK directive for concurrent execution

Normally the NANDECK directive waits for the end of execution before continuing with the next line of the script; adding the * character to the parameter indicating the script to be executed will cause this to be executed in parallel, and therefore the next line of the current script will be executed immediately.

Added new rules in DECK directive

MAX1->FRAMRfrm if the item is moved in a frame already occupied, the occupying item is moved in the frame named frm; if you specify more than one frame, is used a random one from the list of frames
DRAW->FRAMEfrm when a card is drawn from a deck, is placed in the frame named frm; if you specify more than one frame, is used the first free from the list of frames
DRAW->FRAMRfrm when a card is drawn from a deck, is placed in the frame named frm; if you specify more than one frame, is used a random one from the list

Added option in Insert Label to perform a conversion using SEQUENCE

Added “Convert to SEQUENCE” option when inserting a label (F8), which allows you to select a label and convert its contents into lines of a SEQUENCE..ENDSEQUENCE structure.

Liked it? Take a second to support Nand on Patreon!
Become a patron at Patreon!

Leave a Reply

Your email address will not be published. Required fields are marked *