[APP][3.0+] LectureNotes - custom pattern JavaScript codes

Search This thread

acadoid

Senior Member
Apr 29, 2012
1,563
755
www.acadoid.com
Another example, an adjustable dotted pattern

Code:
width = LN.getWidth();
height = LN.getHeight();
scale = LN.getScale();
LN.setStrokeWidth(0.002 * width);
step = width / 150 + scale * width / 25;
for(y = step / 2; y < height; y += step) {
  for(x = step / 2; x < width; x += step) {
    LN.drawPoint(x, y);
  }
}
 

RETIEF

Senior Member
Sep 28, 2007
315
68
69
Moto G 5G
Moto G Stylus 5G
Thanks

Works well.

Is it possible to create one the horizontal lines and wider spaced lines very light lines at 37.5 degrees. (used for Spencerian caligraphy). Thanks.


Another example, an adjustable dotted pattern

Code:
width = LN.getWidth();
height = LN.getHeight();
scale = LN.getScale();
LN.setStrokeWidth(0.002 * width);
step = width / 150 + scale * width / 25;
for(y = step / 2; y < height; y += step) {
  for(x = step / 2; x < width; x += step) {
    LN.drawPoint(x, y);
  }
}
 

acadoid

Senior Member
Apr 29, 2012
1,563
755
www.acadoid.com
@RETIEF: Try

Code:
width = LN.getWidth();
height = LN.getHeight();
scale = LN.getScale();
LN.drawRuledPattern(scale, false);
LN.setStrokeWidth(0.002 * width);
LN.setAlpha(0.5);
step = width / 150 + scale * width / 25;
offset = 0.608761 * height;
for(x = -offset + step / 2; x < width; x += step) {
  LN.drawLine(x, height, x + offset, 0);
}

Adjust line width, alpha, and line distance as needed (note that sin(37.5) approx. 0.608761).
 
  • Like
Reactions: RETIEF

RETIEF

Senior Member
Sep 28, 2007
315
68
69
Moto G 5G
Moto G Stylus 5G
Thanks again.

This is what I wanted. I made a couple of tweaks, but ended up with perfect Spencerian practice paper.

:good:
@RETIEF: Try

Code:
width = LN.getWidth();
height = LN.getHeight();
scale = LN.getScale();
LN.drawRuledPattern(scale, false);
LN.setStrokeWidth(0.002 * width);
LN.setAlpha(0.5);
step = width / 150 + scale * width / 25;
offset = 0.608761 * height;
for(x = -offset + step / 2; x < width; x += step) {
  LN.drawLine(x, height, x + offset, 0);
}

Adjust line width, alpha, and line distance as needed (note that sin(37.5) approx. 0.608761).
 

junglefish

New member
Dec 20, 2012
4
0
Dot pattern isn't working for me. :-/

Thanks for all the code examples, @acadoid.

Unfortunately, the dot-pattern code doesn't work on my Galaxy Note 10.1. When I copy-paste it (after adding in line breaks) it just doesn't put anything on the page. If I copy-paste without adding line breaks, same issue. I scoured through the code and found no errors. (If this sounds familiar, I'm the same guy who was emailing you about a dot pattern. :)

@RETIEF, can you summarize for me what you did to get it working?

Thanks!



Another example, an adjustable dotted pattern

Code:
width = LN.getWidth();
height = LN.getHeight();
scale = LN.getScale();
LN.setStrokeWidth(0.002 * width);
step = width / 150 + scale * width / 25;
for(y = step / 2; y < height; y += step) {
  for(x = step / 2; x < width; x += step) {
    LN.drawPoint(x, y);
  }
}
 

RETIEF

Senior Member
Sep 28, 2007
315
68
69
Moto G 5G
Moto G Stylus 5G
Spencerian

@junglefish: The posted coded should work fine. I guess that RETIEF did not meant that she/he corrected a mistake but rather adjusted step sizes.

Exactly. I adjust the step size, and line width. I did about a half page of Spencerian writing and it worked well.

The attached PDF is exactly what a practice sheet looks like except it has the characters on it already.

The one here works well and helped me check if I still had my characters at the correct slant and size.
 

RETIEF

Senior Member
Sep 28, 2007
315
68
69
Moto G 5G
Moto G Stylus 5G
What I did

Honestly, I just copy and pasted the code from here into the notebook. It resulted in a page of evenly spaced dots. If that was what was intended, it worked well. If something else was intended, it didn't work. I find this kind of page useful because the dots are unobtrusive but can still be used as guides.

Thanks for all the code examples, @acadoid.

Unfortunately, the dot-pattern code doesn't work on my Galaxy Note 10.1. When I copy-paste it (after adding in line breaks) it just doesn't put anything on the page. If I copy-paste without adding line breaks, same issue. I scoured through the code and found no errors. (If this sounds familiar, I'm the same guy who was emailing you about a dot pattern. :)

@RETIEF, can you summarize for me what you did to get it working?

Thanks!
 

junglefish

New member
Dec 20, 2012
4
0
Dang.

Yes, the evenly spaced grid of dots is what I was hoping for. I find it very valuable on my print notebook, and was hoping for the same on my electric notebook. :)

Dang. I'll mess with it some more and see if I can get it to work. Maybe it's copying the text improperly -- using the wrong browser on Android? I'm somewhat new to the Android experience, and might be doing something wrong.

Thanks for the confirmation, though. And for all the support! :)

JF

Honestly, I just copy and pasted the code from here into the notebook. It resulted in a page of evenly spaced dots. If that was what was intended, it worked well. If something else was intended, it didn't work. I find this kind of page useful because the dots are unobtrusive but can still be used as guides.
 

junglefish

New member
Dec 20, 2012
4
0
New paper feature? Thanks!

OH -- maybe the dot-pattern discussion is moot, now. It looks like there's been an update to the app... adding the option of using an IMAGE for the background.

I think this is the perfect solution! I can just make my own dot pattern as an image, and use that. Bim, bam, done. I even fancied it up a bit more by adding a subtle gradient to the edges to make it look like the page of a book.

Thanks @acadoid. You rock! :highfive:

junglefish


@junglefish: The posted coded should work fine. I guess that RETIEF did not meant that she/he corrected a mistake but rather adjusted step sizes.
 

RETIEF

Senior Member
Sep 28, 2007
315
68
69
Moto G 5G
Moto G Stylus 5G
dotted page

Yes, the evenly spaced grid of dots is what I was hoping for. I find it very valuable on my print notebook, and was hoping for the same on my electric notebook. :)

Dang. I'll mess with it some more and see if I can get it to work. Maybe it's copying the text improperly -- using the wrong browser on Android? I'm somewhat new to the Android experience, and might be doing something wrong.

Thanks for the confirmation, though. And for all the support! :)

JF

I found i could not reliably copy from ANY android browser. I use a pc. Make a text file using notebook, and copy that file to the tablet. I open it in a text editor, usually the one in root explorer. Then i select all, copy, hit the home button, open lecture notes, create a notebook, and paste the text. Convoluted, I know, but it works.:cyclops:
 

ratindahat

Senior Member
Nov 11, 2006
164
23
Here is a layout i just made. It is engineering paper, for US letter size. It is for a 1280x1677 resolution. I do not think it will scale well to different resolutions, but here it is if anyone wants it. I'm sure there are some ways to clean it up, but it seems to be working well for me so far.

Code:
width = LN.getWidth(); 
height = LN.getHeight(); 
page = LN.getPage();

pxperin=width/8.5; 
pxperline=pxperin/5; 
lborder=pxperin; rborder=(pxperin*7)+lborder; 
totalgridwidth=pxperin*7;

LN.setColor(.957,.976,.849); 
LN.drawFilledRect(0, 0, width, height);

LN.setColor(.365,.690,.173); 
LN.setStrokeWidth(width/500); 
LN.drawLine(0, pxperin/2, width, pxperin/2); 
LN.drawLine(lborder, 0, lborder, height); 
LN.drawLine(rborder,0,rborder,height); 
LN.drawLine(lborder+(totalgridwidth*.33),0,lborder+(totalgridwidth*.33),pxperin/2); 
LN.drawLine(lborder+(totalgridwidth*.67),0,lborder+(totalgridwidth*.67),pxperin/2);

LN.setStrokeWidth(width/1000); 
LN.setColor(.2,.365,.690,.173); 
for (x = 0; x < 50; x=x+1) 
LN.drawLine(lborder,(pxperin/2)+((x+1)*pxperline) ,rborder,(pxperin/2)+((x+1)*pxperline));

LN.setStrokeWidth(width/500); 
LN.setColor(.3,.365,.690,.173); 
for (x = 0; x <11 ; x=x+1) 
LN.drawLine(lborder,(pxperin/2)+((x+1)*pxperline*5) ,rborder,(pxperin/2)+((x+1)*pxperline*5));

LN.setStrokeWidth(width/1000); 
LN.setColor(.2,.365,.690,.173); 
for (x = 0; x < 35; x=x+1) 
LN.drawLine(((x+1)*pxperline)+lborder,pxperin/2,((x+1)*pxperline)+lborder ,(pxperin/2)+(pxperin*10));

LN.setStrokeWidth(width/500); 
LN.setColor(.3,.365,.690,.173); 
for (x = 0; x < 7; x=x+1) 
LN.drawLine(((x+1)*pxperline*5)+lborder,pxperin/2,((x+1)*pxperline*5)+lborder , (pxperin/2)+(pxperin*10));

LN.setTextSize(0.02 * width); 
LN.setTextAlign(0); 
LN.drawText("Page " + page, 0.05 * width, 0.97 * height); 
LN.drawText("Page " + page, 0.05 * width, 0.02 * height);
 

Attachments

  • EngTemplateLtr.pdf
    80.2 KB · Views: 849
Last edited:

acadoid

Senior Member
Apr 29, 2012
1,563
755
www.acadoid.com
Here is a pattern for a story board

Code:
width = LN.getWidth();
height = LN.getHeight();
boardsPerRow = (width < height) ? 3 : 4;
marginPerBoardWidth = 0.1;
extraSpacePerRow = 0.15;
boardWidth = width / (boardsPerRow + (boardsPerRow + 1) * marginPerBoardWidth);
margin = boardWidth * marginPerBoardWidth;
stepX = boardWidth + margin;
boardHeight = boardWidth / 16 * 9;
rows = Math.floor(height / (boardHeight * (1 + extraSpacePerRow) + margin));
stepY = boardHeight + (height - boardHeight * rows - margin * 2) / (rows - 1);
LN.setStrokeWidth(0.002 * width);
for(x = margin; x < width; x += stepX) {
  for(y = margin; y < height; y += stepY) {
    LN.drawRect(x, y, x + boardWidth, y + boardHeight);
  }
}

It places 3 (portrait) or 4 (landscape) rectangles of 16:9 aspect ratio per row, with a 10% (0.1) margin and a 15% (0.15) extra margin per row.
 
  • Like
Reactions: RETIEF

junglefish

New member
Dec 20, 2012
4
0
Here is a pattern for a story board

It places 3 (portrait) or 4 (landscape) rectangles of 16:9 aspect ratio per row, with a 10% (0.1) margin and a 15% (0.15) extra margin per row.

Very cool idea! However, I still can't get any code to work, including this. I can't figure out what I'm doing wrong. I saved it into a text file, loaded the file on my tablet, copied and pasted the code from that file into the Custom window, but the notebook doesn't show any pattern, just a blank page.

However, a new facet to the issue is: When I go into the "Notebook overview" for that notebook, the preview of the page DOES have storyboards on it! So something's happening correctly. It's just not getting all the way to the full drawing view.

What do you think could be happening?

JF
 

acadoid

Senior Member
Apr 29, 2012
1,563
755
www.acadoid.com
@junglefish: This is a bit strange, either the JavaScript works or not. For notebook overview (PDF export, etc). the timing constraint is relaxed, so that the JavaScript code has more time. What you can try to do is to build up the code step by step and see where it fails.
 

_yupa_

Member
Dec 12, 2010
31
4
My daughter's practice paper (second year italian elementary school), written with portrait 800x1132 resolution (note 10.1- a4) in mind.

Code:
width = LN.getWidth();
height = LN.getHeight();
page = LN.getPage ();
LN.setStrokeWidth(0.001 * width);
LN.setTextSize(0.02*width);
LN.setTextAlign(0);
LN.drawText("Pag. " + page, 0.5* width, 0.95* height);
mleft = 0.05 * width;
mright = 0.95 * width;
mdiff=mright-mleft;
step = 0.01 * height;
for(y = 0.05 * height; y < 0.9 * height; y += 0.087 * height) {
  LN.drawLine(0, y, width, y);
  LN.drawLine(0, y + 3.2 * step, width, y + 3.2 * step);
  LN.drawLine(0, y + 5.5 * step, width, y + 5.5 * step);
  LN.drawLine(0, y + 8.7 * step, width, y + 8.7 * step);
}
for(x = mleft; x< mright; x += 0.25 * mdiff) {
  LN.drawLine(x, 0, x, height);
}
LN.setColor(1, 0, 1);
LN.drawLine(mleft, 0, mleft, height) ;
LN.drawLine(mright, 0, mright, height) ;
 
  • Like
Reactions: acadoid and RETIEF

Top Liked Posts

  • There are no posts matching your filters.
  • 5
    As I receive numerous questions concerning the custom pattern JavaScript interface of LectureNotes and how to implement specific patterns, I thought that it might be helpful to post my replies here, which should allow to easily copy them. Please feel invited to post additional ones!

    First, a so-called isometric pattern that is quoted at the app's help page (where the code lines are commented)

    Code:
    width = LN.getWidth();
    height = LN.getHeight();
    scale = LN.getScale();
    step = width / 150 + scale * width / 25;
    LN.setStrokeWidth(width / 1000);
    for (x = 0; x < width; x += step)
      LN.drawLine(x, 0, x, height);
    stepX = 2 * step;
    stepY = 1.1547 * step;
    x1 = 0; y1 = step;
    x2 = stepX; y2 = 0;
    while ((x1 < width) && (y2 < height)) {
      LN.drawLine(x1, y1, x2, y2);
      if (y1 < height)
        y1 += stepY;
      else
        x1 += stepX;
      if (x2 < width)
        x2 += stepX;
      else
        y2 += stepY;
    }
    x1 = x2 - stepX; y1 = 0;
    y2 = step;
    while ((x2 > 0) && (y1 < height)) {
      LN.drawLine(x1, y1, x2, y2);
      if (x1 > 0)
        x1 -= stepX;
      else
        y1 += stepY;
      if (y2 < height)
        y2 += stepY;
      else
        x2 -= stepX;
    }

    and a simple additional one that places a page number centered at the page bottom

    Code:
    width = LN.getWidth();
    height = LN.getHeight();
    page = LN.getPage();
    LN.setTextSize(0.02 * width);
    LN.setTextAlign(0);
    LN.drawText("Page " + page, 0.5 * width, 0.95 * height);
    4
    Some more, an eternal calender, one month per page, starting January 2012

    Code:
    year = 2012;
    months = ["January", "February", "March", "April", "May", "June",
      "July", "August", "September", "October", "November", "December"];
    monthdays = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
    weekdays = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
    month = LN.getPage() - 1;
    year += Math.floor(month / 12);
    month2 = month % 12;
    month = month + 1;
    days = monthdays[month2];
    if ((month == 2) && (year % 4 == 0) && ((year % 100 != 0) || (year % 400 == 0)))
      days++;
    if (month <= 2)
      year2 = year - 1;
    else
      year2 = year;
    c = Math.floor(year2 / 100);
    y = year2 % 100;
    m = ((month + 9) % 12) + 1;
    w = (1 + Math.floor(2.6 * m - 0.2) + y +
      Math.floor(y / 4) + Math.floor(c / 4) - 2 * c + 7 * 100) % 7;
    width = LN.getWidth();
    height = LN.getHeight();
    size = Math.min(width, height);
    stepx = width / 8;
    stepy = height / 8;
    LN.setTextSize(0.025 * size);
    for (d = 0; d < 7; d++)
      LN.drawText(weekdays[d], (d + 0.6) * stepx, 1.4 * stepy);
    LN.setTextSize(0.05 * size);
    LN.setTextAlign(-1);
    LN.drawText(months[month2] + " " + year, 7.5 * stepx, 0.25 * stepy + 0.05 * size);
    LN.setTextAlign(1);
    l = 0;
    for (d = 1; d <= days; d++) {
      LN.drawText(d, stepx * (w + 0.6), stepy * (l + 2.4));
      if ((++w == 7) && (d != days)) {
        w = 0;
        l++;
      }
    }
    for (x = 0.5 * stepx; x < width; x += stepx)
      LN.drawLine(x, 1.5 * stepy, x, (l + 2.5) * stepy);
    for (y = 1.5 * stepy; y < (l + 3) * stepy; y += stepy)
      LN.drawLine(0.5 * stepx, y, 7.5 * stepx, y);

    and another simple one, a checkered pattern in which every fifth line is thicker

    Code:
    width = LN.getWidth();
    height = LN.getHeight();
    scale = LN.getScale();
    LN.drawCheckeredPattern(scale, false);
    LN.setStrokeWidth(0.002 * width);
    step = width / 150 + scale * width / 25;
    for(y = step / 2; y < height; y += 5 * step) {
      LN.drawLine(0, y, width, y);
    }
    for(x = step / 2; x < width; x += 5 * step) {
      LN.drawLine(x, 0, x, height);
    }
    4
    page x of y

    The programmer added the funtion LNgetNumberOfPages();
    My custom pattern is checkered and shoes the number of pages (page x of y) at the bottom:

    width = LN.getWidth();
    height = LN.getHeight();
    page = LN.getPage ();
    pages = LN.getNumberOfPages();
    scale = LN.getScale ();
    LN.drawCheckeredPattern (scale, false);
    LN.setColor (1, 1, 1);
    LN.drawFilledRect(width/2-0.07*width, height-0.025*height, width/2+0.07*width, height);
    LN.setColor (0.4, 0.4,0.4);
    LN.setTextSize (0.02 * width);
    LN.setTextAlign (0);
    LN.drawText("Seite " + page + " von " + pages , 0.5*width, 0.99*height);

    Hope you like it as well.
    4
    Week-by-week calendar

    Below is a calendar which shows one week at a time. The width of the paper should be twice the height for this calendar to look right.

    Editable parameters:
    line 1 through 3: Starting date of the calendar
    line 9 through 19: text sizes, margins, size of free space on weekdays, start and end hour of weekdays, a few colors

    I made this for myself, and thought I might as well share it in case someone else can make use of it. I also uploaded a couple of screenshots.

    Thanks for giving us the opportunity of making custom backgrounds!

    Code:
    year = 2012;
    month = 11;
    day = 20;
    
    relativeWeek = LN.getPage()-1;
    width = LN.getWidth();
    height = LN.getHeight();
    
    headertext = height * 0.05;
    headerheight = height * 0.10;
    toplineheight = headerheight + headertext;
    leftmargin = height * 0.1;
    rightmargin = leftmargin;
    noteSpace = height * 0.2;
    startHour = 7;
    endHour = 17;
    defaultColor = [150,150,150];
    headlineColor = [0,0,0];
    weekColors = [[208,0,250],[0,200,240],[92,255,1],[255,255,0],[255,146,1],[255,9,32],[255,25,145]];
    
    monthdays = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
    months = ["January", "February", "March", "April", "May", "June",
    "July", "August", "September", "October", "November", "December"];
    weekdays = ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"];
    if ((year % 4 == 0) && ((year % 100 != 0) || (year % 400 == 0)))
    	monthdays[1] = 29;
    
    /* calculate what date the first monday is */
    year2 = year;
    if (month <= 2)
    	--year2;
    c = Math.floor(year2 / 100);
    y = year2 % 100;
    m = ((month + 9) % 12) + 1;
    firstweekday = (Math.floor(2.6 * m - 0.2) + y + Math.floor(y / 4) + Math.floor(c / 4) - 2 * c + 7 * 100) % 7;
    /* 0 is monday */
    firstmonday = (7 - firstweekday) % 7 + 1;
    
    /* convert day and month so that they represent the monday of the user inputted week */
    if (day < firstmonday) {
    	--month;
    	if (month == 0) {
    		month = 12;
    		--year;
    		monthdays[1] = 28;
    		if ((year % 4 == 0) && ((year % 100 != 0) || (year % 400 == 0)))
    			monthdays[1] = 29;
    	}
    	day = monthdays[month-1] + firstmonday - 7;
    } else {
    	day = firstmonday + 7*Math.floor((day-firstmonday)/7);
    }
    
    /* work out the year, month, day and week of the current sheet */
    day += 7*relativeWeek;
    while (day > monthdays[month-1]) {
    	day -= monthdays[month-1];
    	++month;
    	if (month == 13) {
    		month = 1;
    		++year;
    		monthdays[1] = 28;
    		if ((year % 4 == 0) && ((year % 100 != 0) || (year % 400 == 0)))
    			monthdays[1] = 29;
    	}
    }
    
    /* calculate the week number of user input */
    totalDays = day;
    for (i = 0; i < month-1; ++i)
    	totalDays += monthdays[i];
    week = Math.ceil(totalDays/7);
    
    /* Make colors for each day */
    stepx = (width-leftmargin-rightmargin)/6;
    i = 0;
    for (x = leftmargin; x-leftmargin <= 5.5*stepx; x += stepx) {
    	/* create lines for each half hour */
    	if (x-leftmargin < 4.5*stepx) {
    		y = toplineheight+headertext*1.1;
    		LN.setColor( weekColors[i][0]/255, weekColors[i][1]/255, weekColors[i][2]/255 );
    		LN.drawFilledRect( x, toplineheight, x+stepx, y );
    	} else {
    		y1 = toplineheight+headertext*1.1;
    		y2 = (toplineheight+height)/2+headertext*1.1;
    		LN.setColor( weekColors[i][0]/255, weekColors[i][1]/255, weekColors[i][2]/255 );
    		LN.drawFilledRect( x, toplineheight, x+stepx, y1 );
    		++i;
    		LN.setColor( weekColors[i][0]/255, weekColors[i][1]/255, weekColors[i][2]/255 );
    		LN.drawFilledRect( x, (toplineheight+height)/2, x+stepx, y2 );
    	}
    	LN.setStrokeWidth(4);
    	++i;
    }
    /* Reset color */
    LN.setColor( defaultColor[0]/255, defaultColor[1]/255, defaultColor[2]/255 );
    
    /* Drawing the main lines */
    stepx = (width-leftmargin-rightmargin)/6;
    stepy = (height-toplineheight-headertext*1.01-noteSpace)/(2+endHour-startHour);
    LN.setTextAlign(1);
    LN.setTextSize(stepy*0.9);
    for (x = leftmargin; x-leftmargin < 6.5*stepx; x += stepx) {
    	LN.drawLine(x, toplineheight, x, height);
    	if (x-leftmargin < 5.5*stepx) {
    		/* create lines for each half hour */
    		LN.setStrokeWidth(1);
    		if (x-leftmargin < 4.5*stepx) {
    			i = -2;
    			for (y = toplineheight+headertext*1.1; y < height-noteSpace; y += stepy) {
    				LN.drawLine(x, y, x+stepx, y);
    				if (++i > 0) {
    					LN.drawText(startHour+i-1, x, y-stepy*0.05);
    					LN.drawLine(x+LN.getTextWidth(startHour+i-1), y-stepy/2, x+stepx, y-stepy/2);
    				}
    			}
    		} else {
    			LN.drawLine(x, toplineheight+headertext*1.1, x+stepx, toplineheight+headertext*1.1);
    			LN.drawLine(x, (toplineheight+height)/2+headertext*1.1, x+stepx, (toplineheight+height)/2+headertext*1.1);
    		}
    		LN.setStrokeWidth(4);
    	}
    }
    LN.drawLine(leftmargin, toplineheight, width-rightmargin, toplineheight);
    LN.drawLine(leftmargin+5*stepx, (toplineheight+height)/2, width-rightmargin, (toplineheight+height)/2);
    
    /* Write which week it is */
    LN.setTextSize(headertext);
    LN.setColor( headlineColor[0]/255, headlineColor[1]/255, headlineColor[2]/255 );
    LN.setTextAlign(-1);
    LN.drawText("Week " + week, width-rightmargin, headerheight);
    
    oldMonth = month;
    oldYear = year;
    LN.setTextAlign(0);
    for (i = 0; i < 7; ++i){
    	if (day > monthdays[month-1]) {
    		day -= monthdays[month-1];
    		++month;
    		if (month == 13) {
    			month = 1;
    			++year;
    			monthdays[1] = 28;
    			if ((year % 4 == 0) && ((year % 100 != 0) || (year % 400 == 0)))
    				monthdays[1] = 29;
    		}
    	}
    	if (i < 6) {
    		LN.drawText(day + " " + weekdays[i], leftmargin + stepx * (i + 0.5), toplineheight+headertext );
    	} else {
    		LN.drawText(day + " " + weekdays[i], leftmargin + stepx * (i - 0.5), (toplineheight+height)/2+headertext );
    	} 
    	++day;
    }
    LN.setTextAlign(1);
    if (oldMonth == month)
    	LN.drawText(months[month-1], leftmargin, headerheight );
    else {
    	LN.drawText(months[oldMonth-1] + " / " + months[month-1], leftmargin, headerheight );
    }
    LN.setTextAlign(0);
    if (oldYear == year)
    	LN.drawText(year, leftmargin+(width-leftmargin-rightmargin)/2, headerheight );
    else {
    	LN.drawText(oldYear + " / " + year, leftmargin+(width-leftmargin-rightmargin)/2, headerheight );
    }
    3
    Since v1.16.13, there is an additional JavaScript command LN.setColor(r, g, b) that allows to use colors other then the one chosen in the dialog. This allows now, for instance, a ruled pattern with a red line on the left side

    Code:
    width = LN.getWidth();
    height = LN.getHeight();
    LN.drawRuledPattern(LN.getScale(), false);
    LN.setStrokeWidth(0.002 * width);
    LN.setColor(1, 0, 0);
    LN.drawLine(0.05 * width, 0, 0.05 * width, height);