Wednesday, February 17, 2010

pjs text() release 0.1



I am working on the ticket #213 of processing.js(pjs) this three weeks. I separated this ticket into three parts - 2D text, 3D text, dependent functions(previous post "Project plan initialization"). In this release(related to previous post "initialize git & detail of release 0.1"), I have completed the 2D text - text(val), text(val,x,y,w,h).

How it looks like now
this is the test (click to see the example):
By this moment, I have implemented almost everything about 2D text. One thing left is the processing for "\n" inside the text(val,x,y). I want to do this by substring something, but my knowledge doesn't cover that yet.

My Solution - diff(changes in line 469 and 4176)
Basically, only text(val,x,y)(line 4200) actually draw the text, and it will become text(val,x,y,z) in the next release by the way.
Every time the functions such as text(val),text(val,x,y,w,h) are called. They will do anything they need, and finally call text(val,x,y)(line 4200) to draw the text.
This is similar to the original processing source code. It reduces the difficulty for maintaining the code, and reduces the file size.
I am not satisfied with its performance because text(val,x,y,w,h) draws the text letter by letter(line 4274). I will change it as soon as I find out something like substring.


Conclusion
It is only some work for two or three days, but I spent three weeks. Anyway, as I knew nothing about JavaScript and this project three weeks ago, it is not a bad result. However, no matter what, I have to speed up in the next release.
Now I am waiting for the first review. Hope everything goes smoothly.

No comments:

Post a Comment