ChanServ changed the topic of #picolisp to: PicoLisp language | Channel Log: https://irclog.whitequark.org/picolisp/ | Picolisp latest found at http://www.software-lab.de/down.html | check also http://www.picolisp.com for more information
karswell_ has joined #picolisp
orivej has quit [Ping timeout: 265 seconds]
karswell_ has quit [Read error: Connection reset by peer]
karswell_ has joined #picolisp
gum has joined #picolisp
karswell_ is now known as karswell
gum has quit [Quit: Page closed]
karswell_ has joined #picolisp
karswell has quit [Read error: Connection reset by peer]
karswell_ is now known as karswell
orivej has joined #picolisp
orivej has quit [Ping timeout: 240 seconds]
mtsd has joined #picolisp
mtsd has quit [Quit: Leaving]
karswell has quit [Ping timeout: 256 seconds]
<tankf33der> Regenaxer: here ?
<tankf33der> 14jun18
<tankf33der> src64/io.l
<tankf33der> src64/main.l
<tankf33der> Restore modified timeout, round milliseconds not slept
<tankf33der> src/io.c
<tankf33der> should i test it ?
<Regenaxer> Yes, good idea. Thanks!
<Regenaxer> I did not like omitting it completely
<Regenaxer> And the solution two days ago was also not clean
<Regenaxer> I thought about it once more, and found it is actually a rounding problem
<Regenaxer> The rosettacode task still works, because we have (wait 1) in it, right
<Regenaxer> Without (wait 1) the timing is never safe, the parent may be too busy in any case
<tankf33der> seems working.
<Regenaxer> great
<Regenaxer> pil32 too4
<Regenaxer> too?
<tankf33der> all versions on old and modern kernels works.
<Regenaxer> Cool! Thanks for testing!
<tankf33der> 2 or 3 secs
<Regenaxer> yes, same here
<tankf33der> ok
<Regenaxer> I think this is correct
<Regenaxer> Parent is slowed down due to heavy traffic in IPC
<tankf33der> ok
<tankf33der> openbsd works too, both pils
<Regenaxer> I think now we have an acceptable solution
<tankf33der> yea, issue closed.
<Regenaxer> :)
sriram has joined #picolisp
<sriram> hi..was wondering why the first argument of lisp function is the form e.g in misc/phone.l : lisp(Form, 'setLocation',....
<sriram> and is this the same lisp function defined in the references .. (lisp 'sym ['fun]) -> num
<Regenaxer> Hi sriram!
<Regenaxer> No, in the reference is the C callback function
<Regenaxer> The Form parameter can be 'this.form' in JS
<Regenaxer> or the phone demo
<Regenaxer> 'demoMaps' function
<Regenaxer> or, even, dpp/gui.l !! (you remember ;)
<Regenaxer> (javascript NIL
<Regenaxer> function(pos) {
<Regenaxer> "navigator.geolocation.getCurrentPosition(
<Regenaxer> lisp(null, 'setLocation',
<Regenaxer> pos.coords.latitude * 1000000,
<Regenaxer> ...
<sriram> thanks Regenaxer....I guess the first param must always be a form
<Regenaxer> or null
<sriram> ?
<sriram> oh i see it can be NIL
<Regenaxer> if null, a GET is done
<Regenaxer> otherwise a POST to this form
<Regenaxer> Pil 'This' is the form then
<sriram> i just want to set the text width and height by calling a lisp function..I guess I can just set to NIL then
<sriram> not sure if I can get the form inside renderCanvas
<sriram> (in canvas.js)
<Regenaxer> yes, if you use globals to store the result
<sriram> for the time being i am planning to use globals...proof of concept..although ideally i would like the calling function to create symbols that are passed in csGetTextMetric (in my local canvas.js)
<sriram> so that the symbols and the values are passed to the lisp function
<Regenaxer> yes, you can pass to the funct
<sriram> not sure if all this will work...but fun to try :)
<Regenaxer> see onclick
<Regenaxer> setTime function gets args passed in
<Regenaxer> or setLocation too
<sriram> ok
<Regenaxer> T
<Regenaxer> You have a form only when an event is received
<Regenaxer> like onclick
<sriram> yes setTime and setLocation get args passed in and they set globals to Lat Lon for e.g
<sriram> I want to pass the symbol names too so that my desired symbols will be set
<Regenaxer> Be careful not to create a security hole
<Regenaxer> If symbols are passed from client without check, it can do *anything* on the server
<Regenaxer> eg redefine a critical function
<sriram> oh...yes you are right...if I do
<sriram> (de setLocation(LatSym LonSym Lat Lon) (set LatSym Lat) (set LonSym Lon))...that may be a security hole if someone calls setLocation directly
<Regenaxer> yes
<sriram> maybe a class then..so that only class member variables will be defined
<sriram> at worst...not some arbitrary symbols
<Regenaxer> In the form I use form properties, eg 'time' for the time field
<Regenaxer> otherwise you need globals
<Regenaxer> See in @lib/form.l
<Regenaxer> "lisp(null, 'tzOffs', (new Date()
<Regenaxer> it sets a global
<sriram> (looking for time field in onclick)
<sriram> ah yes : time
<Regenaxer> "Browser Time" (gui 'time '(+Lock +TimeField) 10)
<sriram> (set> (: time) (time H M S)) )
<Regenaxer> yep
<sriram> I think I can do that too
<Regenaxer> :)
<sriram> because this code will always be called in a form?
<Regenaxer> In an event
<Regenaxer> so there is this.form
<sriram> oh but in your case you had a gui element called 'time
<sriram> in my case, there is no such..only the canvas
<sriram> thats why you could do (set> (: time) ....)
<sriram> i suppose i could create hidden elements in the form
<Regenaxer> Not sure, depends on the element
<Regenaxer> eg in lib/gis.js I do lisp(Map.form,
<Regenaxer> cause an OpenLayers Map has a form
<Regenaxer> Not sure about the canvas atm
<Regenaxer> But you have the ID
<sriram> yes i do
<Regenaxer> I think a canvas can live outside a form
<Regenaxer> not sure, I forgot the details
<sriram> (form NIL (<canvas> "$testID" 600 600) )
<Regenaxer> Ah, in gis.js I do Map.form = document.getElementById(id).parentNode;
<Regenaxer> So I simply set the form manually
<sriram> oh good...so that is fine for js side...
<sriram> in renderCanvas (function 38 :) ), I can do the same
<Regenaxer> yes, like in pil you can put any self-made property in JS
<Regenaxer> or do it in the Lisp code with (javascript ...)
<sriram> not following the self-made property part....why do i need that?
<Regenaxer> To keep the form in JS
<sriram> i thought i could do form=document.getElementById(canvas_id).parentNode;
<Regenaxer> as in @lib/gis.js
<sriram> i mean var form = document.getElementById(canvas_id).parentNode;
<Regenaxer> OpenLayer's Map does not have a 'form' property I think
<Regenaxer> yes, exactly
<Regenaxer> not var
<Regenaxer> I store it in the Map directly
<sriram> but in the lisp side when my function is called, can i always do (set (: dummyTextWidth) Width)
<Regenaxer> to support several Maps
<Regenaxer> Map.form = document.getElementById(id).parentNode;
<sriram> to create a dummyTextWidth property of form on the fly?
<Regenaxer> Only if 'This' *is* the form
<Regenaxer> passed with lisp(canvas.form, ...
<sriram> oh i see so when i call through lisp(myForm, ...") lisp takes care of setting This to myForm before calling that function
<Regenaxer> not really
<Regenaxer> lisp() cannot set on the server directly
<Regenaxer> it does post()
<Regenaxer> ie a POST to the Lisp 'form'
<Regenaxer> Confusing indeed!
<sriram> true :)
<sriram> and then subsequently the desired function also gets called
<sriram> hopefully with This set to the form
<sriram> (not confusing really...just have to know the details)
<Regenaxer> The core for this is post() in @lib/form.js
<sriram> (looking)
<Regenaxer> The Pil GUI machinery
<Regenaxer> All Pil forms go via this
<sriram> i see that lisp calls post post(form, false, exe, null);
<Regenaxer> yep
<Regenaxer> if form is null, it does a GET to the function
<sriram> i remember modifying post before for sataps...but not sure now...
<Regenaxer> hmm, I'm also not sure
<sriram> i think that it adds the function and its arguments as url to the post
<sriram> I guess that because the post is on the form, This is automatically set to the form when the function is evaluated as the url in the post
<Regenaxer> 'jsForm' in @lib/form.l is called:
<Regenaxer> FormReq.open("POST", SesId + "!jsForm?"
<Regenaxer> jsForm does (with (postForm)
<Regenaxer> so this sets 'This'
<Regenaxer> postForm find the right form
<Regenaxer> Lisp form here
<sriram> and then the args of the post i.e the function and its arguments are evaluated perhaps
<sriram> ok...so one other question only :)
<Regenaxer> I think no evaluation happens here
<sriram> can i set some random property of the form (set (: RandomPropertyW) Width)
<Regenaxer> How do you mean that?
<Regenaxer> (=: randomProperty Width) ?
<Regenaxer> Why random?
<sriram> yes
<sriram> by random i mean not connected to gui element or anything...
<Regenaxer> Ah
<Regenaxer> yes, always in properties
<Regenaxer> For 'set>' it needs an existing field
<sriram> yes ...I did not want that
<Regenaxer> but a plain property in set on the fly
<Regenaxer> right, width does not need a field
<sriram> so thought (set (: property) w) may work or as you say (:= property w)
<Regenaxer> (set (: property) .. will not work
<sriram> yes because (: property) is not a reference
<Regenaxer> (: property) -> NIL
<Regenaxer> yes
<Regenaxer> gives protected symbol error
<sriram> i forget now what was the way to get the reference :)
<Regenaxer> trying to 'set' NIL
<Regenaxer> (doc ':) ?
<sriram> 1 sec
<sriram> was one of the other : methods
<Regenaxer> =:
<Regenaxer> ah
<Regenaxer> you mean ::
<sriram> yes
<Regenaxer> returns the cell
<sriram> was about to say same :)
<sriram> yes
<Regenaxer> yep
<Regenaxer> then 'set' is fine
<sriram> so (set (:: property) w)
<Regenaxer> correct
<sriram> or (:= property w)
<Regenaxer> yes, same
<sriram> nice...so I have all the pieces I think to try this out
<sriram> will let you know shortly :)
<Regenaxer> cool :)
<sriram> thanks!
<Regenaxer> You are very tough
<Regenaxer> digging into this stuff
<sriram> thanks..:) but yes, I do it because I know when I become proficient...it will be very very worthwhile..but the initial steps are hard
<Regenaxer> T
<sriram> back in a bit after trying it out
<Regenaxer> ok
<sriram> by the way how to get the current form? *Top?
<Regenaxer> If you are in a field, it is (: home)
<Regenaxer> otherwise there is no real "current" form
<Regenaxer> A page may contain several forms
<Regenaxer> *Top is mainly for debugging
<Regenaxer> It is set for the last form created, or the last to reveive a button press (POST)
<sriram> I am in the drawCanvas function...and trying to generate the command lists
<sriram> I only have the canvas Id at that point
<sriram> not the parent form
<sriram> maybe set a global?
<Regenaxer> better not
<Regenaxer> a global will change all the time
alexshendi has joined #picolisp
<Regenaxer> Does document.getElementById(id).parentNode not work?
<sriram> but I am in lisp at that point
<Regenaxer> Sorry, a break
<sriram> i put a TBD at the point i am attempting to retrieve it
<Regenaxer> bbl
<sriram> (np)
<sriram> that pastebin does not work...please try this when you have a chance penyacom.org/p?q=SzhaRks
<Regenaxer> ret
<Regenaxer> You still use (set (:: TextW) W) ?
<Regenaxer> Why not the normal way?
<sriram> you mean := Text W ?
<Regenaxer> yes
<Regenaxer> :: is more for modifying, like (push (:: .. or (inc (:: ..
<sriram> because I find it easier to remember :: than =:. In fact I have to look up the references for whether it is := or =:...so just thought to keep it simple in a way that I can easily write always
<Regenaxer> But it is bigger and slower
<sriram> agreed...I can switch to it
<sriram> were you able to load the url?
<sriram> and see the place where I wrote TBD
<Regenaxer> I have not tried
<sriram> ok..i find this better than pasetbin as I dont need an account
<Regenaxer> a bit busy atm, don't want to start another debug session
<sriram> just paste it in and it gives me a url
<sriram> sure...no problem...we can do whenever convenient
<Regenaxer> (I'm doing project work in parallel)
<Regenaxer> No, I can give you tips :)
<Regenaxer> I have never complete time ;)
<sriram> thats what i wanted only :) I was sure once you saw the usage you would be able to give me direction :)
<Regenaxer> yes, I thought so too
<Regenaxer> Between (csGetTextMetric and (csFillText there is no time
<Regenaxer> cannot work
<sriram> oh? i thought it was blocking?
<Regenaxer> drawTile is executed in one run, right?
<sriram> csTextMetric-> renderCanvas in js -> lisp ->setText?
<Regenaxer> At *some* other time the POST with the sizes may appear
<Regenaxer> it is all asynchronous
<sriram> oh i see
<sriram> hmmm so that wont work
<Regenaxer> That's why I was sceptical
<Regenaxer> to get the text size
<sriram> this way of getting info from client js
<Regenaxer> yes
<Regenaxer> You must do it beforehand, in some other event
<Regenaxer> difficult
<sriram> thats true...maybe i can have two events one to get the sizes
<sriram> and one to actually draw
<Regenaxer> yes, best do do the drawing in the moment you receiv the size
<sriram> but even if i do that..i will need a way to access : TextW at some point
<sriram> assuming it has been set before
<Regenaxer> no need for (: TextW)
<Regenaxer> you can pass the size where you draw
<sriram> ah!!
<Regenaxer> But as I said, this is not trivial
<Regenaxer> You could consider serverSentEvents
<Regenaxer> get asynchronous stream
<Regenaxer> but that's another issue
<Regenaxer> I wanted to write an article about that first
<sriram> oh good timing for me then :)
<Regenaxer> yeah :)
<sriram> i mean to read your article
<sriram> :)
<Regenaxer> Not written yet ;)
<Regenaxer> I don't find the time, it is in my todo list
<beneroth> hi all
<Regenaxer> Hi beneroth
<sriram> sure...np...in any case..it seems a lot of work to just find the size in pixels of text
<sriram> Hi!
<Regenaxer> I knew that, that's why I never considered that
<sriram> ok good..will abandon that part and continue..its critical to putting text in the center of a rectangle but maybe some other time
<Regenaxer> yes, and this can be done more efficiently with CSS, without knowing the size on the server
<Regenaxer> As I said yesterday, otherwise you need a round-trip for every piece of text
<Regenaxer> OK, sorry, I really need to finish some work
<Regenaxer> and I cannot concentrate when discussing here ;)
<beneroth> some work needs more concentration than others :)
<beneroth> good luck Regenaxer :)
<sriram> bye :)...thanks!
<Regenaxer> yeah, I have some trouble
<Regenaxer> Garbage collection on distributed DBs
<beneroth> I'm happy to help with unrelated random comments
<beneroth> uuh
<sriram> :)
<beneroth> I see
<Regenaxer> (will go into 'dbgc' I hope once it works)
<beneroth> nice
<Regenaxer> But now I need it for BTG
<sriram> beneroth the :) was for "unrelated random"
<beneroth> you lock all? or someone communicate the references to each its "master" db?
<Regenaxer> Locking is not the problem
<beneroth> s/someone/somehow
<Regenaxer> An now too, 'dbgc' runs in single-process mode
<beneroth> I'm sleep deprived and a bit fuzzy :D (more than usual)
<Regenaxer> But I lock the other DBs which have references into the current one
<beneroth> ok
<beneroth> yeah, that I meant
<Regenaxer> the issue is to adjust all the offsets
<beneroth> references spanning multiple DBs
<Regenaxer> 'ext' function
<beneroth> hm
<Regenaxer> And I want it generic
<Regenaxer> extending 'dbgc'
<Regenaxer> I know how I want it
<Regenaxer> but the other DBs all refer to each others
<Regenaxer> it is really confusing
<beneroth> so the issue is, you don't have a universal identifier for the symbol, only the symbol in this DB which might be another one (offsetted) in the other db? you plan to track all the offsets to get from one external symbol ID to the one it has in another DB?
<Regenaxer> 40 DBs or so
<Regenaxer> yes
<Regenaxer> Iw works already this way
<beneroth> ha. cool. ok I see
<Regenaxer> Just for dbgc I need it reversed
<beneroth> you must find some simple scalable formula :/
<Regenaxer> The calculations are add and sub
<beneroth> register the offset twice for every direction?
<Regenaxer> I have diagrams here, hard to explain
<beneroth> ok
<beneroth> only explain if you think it helps you
<beneroth> prolly not :P
<beneroth> I will visit you and you can explain me in detail then
<beneroth> don't ask when xD
<beneroth> (ofc you are welcome at my place)
<beneroth> or take a walk while its sunny :)
<Regenaxer> On one machine remotely:
<Regenaxer> {A@16} (+Messe)
<Regenaxer> gel "Messezentrum"
<Regenaxer> turn 2
<Regenaxer> prv {A@14}
<Regenaxer> ort {AC3}
<Regenaxer> bis 737076
<Regenaxer> von 737073
<Regenaxer> nm "GRINDTEC 2018"
<Regenaxer> cu (737165)
<Regenaxer> -> {A@16}
<Regenaxer> which is on the "real" machine:
<Regenaxer> {16} (+Messe)
<Regenaxer> turn 2
<Regenaxer> prv {14}
<Regenaxer> nm "GRINDTEC 2018"
<Regenaxer> gel "Messezentrum"
<Regenaxer> ort {C3}
<Regenaxer> bis 737076
<Regenaxer> von 737073
<Regenaxer> cu (737165)
<Regenaxer> Same object
<beneroth> oh nice
<Regenaxer> {A@16} is with 'ext' offet
<Regenaxer> Works all
<Regenaxer> But in case of dbgc all is reversed
<beneroth> how is the offset/mapping stored?
<Regenaxer> giving negative offsets
<Regenaxer> complicated
<beneroth> ok
<Regenaxer> a set of functions and the '*Ext' global
<beneroth> I don't get enough detail to grasp the specific issue
<Regenaxer> I will teach you all once it is productive :)
<beneroth> maybe you could put some info into data instead of functions, to make it more easily reversible, maybe?
<beneroth> yes, please :)
<Regenaxer> The core always is *Ext for "remote" accesses
<beneroth> for reverse you must now what you are at the other DB, no?
<Regenaxer> The info is all in the data
<beneroth> hm.. maybe you could just ask the other DB, probing it maybe forward first?
<Regenaxer> The functions take an object and calculate which DB, which file, and which block
<Regenaxer> you know, the new 'blk' function
<beneroth> aye
<Regenaxer> It is all transparent once it runs
<beneroth> somewhere information is lost, if the formula is not reversible...
<Regenaxer> The model is this https://7fach.de/pub/offsets.png
<beneroth> I think I saw this before
<Regenaxer> yes
<Regenaxer> All objects are mapped into the external symbol space of all processes
<Regenaxer> not all, but those who need it
<beneroth> yeah
<Regenaxer> Simple arithmetic
<beneroth> different offsets depending on the DB, yes?
<Regenaxer> but confusing because of all the offsets
<Regenaxer> yes
<beneroth> hm
<Regenaxer> {16} in the core can be seen as {A@16} in deA
<Regenaxer> I need to concentrate to get it clear in my head
<beneroth> yeah, but how to get from {A@16} to {16}, that is the question, no?
<Regenaxer> When in core, an object in deA has *negative* offset
<beneroth> T
<Regenaxer> : (ext -16 (blk 17 1 4))
<Regenaxer> -> (NIL ({OOO@35} . +snd) ({OOO@40} . +LF) ({OOO@32} . +Mes) ...
<Regenaxer> OOO means negative
<beneroth> (just FYI: I still don't grokked it consciously)
<Regenaxer> it is 65524 or so
<Regenaxer> Me neither :/
<beneroth> so you need to detect "negative or positive?" to be able to add or subtract
<beneroth> maybe parse that info just like an interpreter?
<beneroth> hm
<Regenaxer> yes, find the objects which refer to *me*, ie between 0 and 16 in the file offsetj
<Regenaxer> no need to parse
<beneroth> maybe requires to runs
<Regenaxer> I have all with 'id'
<Regenaxer> ok, anyway, let me concentrate
<beneroth> I see. *me* in the above statement being a single DB.
<Regenaxer> time is running
<Regenaxer> yes, the one being dbgc'd
<beneroth> ok.
<beneroth> maybe turn the question around: how does the single DB now which are NOT its own symbols? (maybe stupid question, I haven't looked into *Ext much yet)
<Regenaxer> I want a generic way, not only for this BTG model
<beneroth> the single DB know
<beneroth> of course
<Regenaxer> So I must design the arguments to dbgc
<Regenaxer> lists of offsets, pathes to DB files, and Dbs sizes of the other DBs
<Regenaxer> this is the problem
<Regenaxer> I'm fiddling with this all afternoon ;)
<Regenaxer> It is trivial once it is clear I think
<Regenaxer> No worries ;)
<beneroth> I like to let my subconscious do some fiddling, whenever I can afford to let it run at the task for a while
<beneroth> I'm sure you will find it
<Regenaxer> yeah :)
<beneroth> I never forget how sad you were about the ARM fiddling. and then it turned out brilliant :)
<Regenaxer> true, the CPU looked nasty initially
<beneroth> I still have to grow my fiddling skill more. Yours is awesome :)
<Regenaxer> hmm
<beneroth> lot of exercise.
<beneroth> I chill out a bit now and leave you alone with your interesting problem :P
<Regenaxer> thanks! :)
<tankf33der> yea
Regenaxer has left #picolisp [#picolisp]
Regenaxer has joined #picolisp
<Regenaxer> oops
<Regenaxer> sriram: (allowed ...) sets the *whole* allowed structure
<Regenaxer> so previous allows are gone
<Regenaxer> eg "@lib/form.l" sets the ones you are missing
<Regenaxer> you must use 'allow' instead
<Regenaxer> see the example apps
<Regenaxer> (sigh, I give up for today, can't concentrate)
<Regenaxer> (but it seems to get clear that it is easier than I thought)
<sriram> ah ok thanks
<sriram> i did try just (allow showTextMetrics)
<sriram> but that did not help too
alexshendi has quit [Ping timeout: 268 seconds]
<sriram> I mean it did not give any errors...but there was not output from showTextMetric..so debugging whether there was any error in the JS
alexshendi has joined #picolisp
orivej has joined #picolisp
alexshendi has quit [Quit: Yaaic - Yet another Android IRC client - http://www.yaaic.org]
alexshendi has joined #picolisp
<Regenaxer> sriram, no output written to "/tmp/pil.txt" ?
<sriram> no..
<sriram> no errors
<Regenaxer> yes, so it is allowed at least ;)
<sriram> yes :)
<Regenaxer> Is the parentnode really the form?
<Regenaxer> Can you try lisp(null, ?
<Regenaxer> The form is not used anyway
<sriram> ah ok
<sriram> yes i will try
<Regenaxer> I think if the form is not found, nothig happens
<sriram> still empty
<sriram> the tile is displayed...so only the last call to csShowTextMetric
<sriram> maybe I can do an alert on the JS side?
<Regenaxer> What is empty? The whole page?
<sriram> no the page displays fine
<sriram> with the tile
<sriram> its just that expected output from the showMetrics is not present
<Regenaxer> Is the JS code reached?
<Regenaxer> In debug mode, you can insert lisp(null, "console", "Message"); in the JS code
<sriram> i dont see the alert
<Regenaxer> I think we did that in DPP too
<sriram> yes...i didnt remember how..will try that now
<sriram> nice i got the alert and also output on console
<Regenaxer> ah
<sriram> found the problem,
<sriram> textMetrics.height is undefined
<Regenaxer> ok
<sriram> will look at measureText a bit more
<sriram> so good...I think it will be fine
<Regenaxer> cool, congrats :)
<sriram> what i was thinking is that one time
<Regenaxer> fast debugging :)
<sriram> the user can check the width in pixels for any piece of text
<sriram> and then statically use that length even if not computed in run-time code
<sriram> fast debugging thanks to your console output :)
<Regenaxer> using kind of similar texts?
<sriram> any arbitrary text. put that into csShowMetrics "string" find the output on console
<sriram> and that will tell the length for that string
<Regenaxer> I think it should somehow be runtime, at least it depends on the browser
<sriram> usually the string is fixed..as it is in my case
<sriram> yes it is run time...but static in the sense that once
<Regenaxer> ok
<sriram> it is computed for one browser, it can be used unchanged
<sriram> for example i know that with the given font, the letter A has 18 pixels in width
<sriram> using this code
<Regenaxer> I see
<sriram> so I could hard code that to get the letter A in the center of the tile
<sriram> in that sense it is useful to have it in canvas.js and canvas.l
<Regenaxer> hmm, but just centering can be done easier as noted above
<Regenaxer> and also, the user may resize the browser any time
<Regenaxer> or zoom
<sriram> how easier, if dont know the pixels for the text....oh i mean center of the tile, not of the window
<Regenaxer> What is a tile here?
<sriram> centering the rectangle in window as the user resizes browser is something i was wondering
<sriram> a tile is a small rectangle in the middle of which I want to put a letter
<sriram> like a scrabble tile
<Regenaxer> hmm
<Regenaxer> but pdfPage handles this too
<Regenaxer> in svg
<sriram> centering the tile in the browser window or maintaining it in center as window resizes is different story perhaps
<Regenaxer> without knowing the size
<sriram> yes....hmmm....i wonder how...i use x + (w-l)/2 to get position of text, where w is width of rectangle and l is horizontal width of text
<Regenaxer> There is some text markup
<Regenaxer> @lib/tinymce.l
<Regenaxer> iirc
<sriram> you mean it is done via css?
<Regenaxer> no
<Regenaxer> wrong place
<sriram> no it cant be done via css as position of rectangle is variable
<sriram> seems i must delve into svg> after all :)
<Regenaxer> But pdfPage does it
<Regenaxer> all kinds of control over the text
<sriram> ok...yes....thats true...i will look more closely there..
<Regenaxer> I don't find it atm ;)
<sriram> np...but its interesting that it can be done completely on lisp side..
<Regenaxer> I remember that some s-expr is used
<Regenaxer> to represent all kinds of mbrkup
<Regenaxer> placement, color etc
<Regenaxer> fonts, text sizes
<Regenaxer> I think all that comes from tinymce
<Regenaxer> So, yes, it is htmlText
<sriram> yes...maybe it specifies the size in pixels directly given the rectangle
<Regenaxer> takes HTML from TinyMce
<Regenaxer> and builds a structure
<Regenaxer> Called in svg> of +PdfWin
<sriram> (looking)
<sriram> splitHtmlTxt (: txt) splitHtmlTxt
<Regenaxer> yes
<Regenaxer> later it does (apply ps L (: align)) with the elements
<sriram> (setq DY (max DY (+ (/ (: size) 2) (* (: size) (sum length Txt)) ) ) )
<Regenaxer> ie the 'ps' function in svg.l
<Regenaxer> yes, 'ps' processes the tokens like (B # Bold
<Regenaxer> (ps T ... aligns right
<Regenaxer> (ps 0 ... centers !
<Regenaxer> (ps NIL ... is the same as (ps ...) and is left align (default)
<Regenaxer> lib/svg.l is my main vehicle for printing
<Regenaxer> And when printing I also have no way do get the dimensions of the text
<Regenaxer> So I think it is possible to do without
<sriram> but maybe 20pt means that the char is 20 pixels in width
<sriram> because i think thats how the size of text is calculated (* (: size) (sum length Txt))
<Regenaxer> Where did you see 20pt ?
<sriram> i did not see 20 pt
<sriram> but i saw (font (cons (: size) (or (: font) "Courier"))
<sriram> so size would seem to be a number like 20 maybe?
<sriram> I did not see where size gets set
<Regenaxer> (: size) is the size of the window, not the text
<Regenaxer> that we know, we created the rectangles
<Regenaxer> or the font size, which is the vertical size
<sriram> there is also *FontSize
<Regenaxer> Horizontal is difficult, non-monospaced fonts
<Regenaxer> Yes, size in pdfPage is the font size
<Regenaxer> *FontSize, yes, global (dynamically bound) in lib/svg.l
<sriram> when i use 20pt text, the width in pixels is 18, and when i change font to 32, width is 29. and that is only for letter A
<sriram> so in general one can use the font size as the width of a single character perhaps
<Regenaxer> I don't think so. It depends on the font
<Regenaxer> and each char may have a different width
<Regenaxer> which may also depend on neighbor chars
<sriram> ah so 20pt helvetica and 20pt courier may not be same
<Regenaxer> (Ligatures etc.)
<sriram> so really interesting how svg does it
<Regenaxer> right
<sriram> without measuring
<Regenaxer> it does measuring
<Regenaxer> on each lettea
<Regenaxer> letter
<Regenaxer> PostScript does that too, or TeX
<Regenaxer> It is a science of its own
<Regenaxer> typesetting
<sriram> but when rendering to browser, it must use some browser facility similar to measureText?
<sriram> to measure or does it measure virtually
<Regenaxer> HTML does it too
<sriram> yes...the html also has align markup
<Regenaxer> Each character in a font carries its metrics info
<Regenaxer> OK, I stop now :)
<sriram> so maybe thats the key, I simply have to mark the text as contained in the rectangle and do JS command
<Regenaxer> Go to shower
<sriram> to align with rectangle
<sriram> sure....
<sriram> many thanks :) i had lots of questions for your today
<sriram> but good progress for me
<Regenaxer> I think pdfPage does most what is needed
<Regenaxer> good :)
<sriram> yes....svg> is a bit hard to understand
<Regenaxer> W
<Regenaxer> T
<sriram> i prefered the canvas commands
<sriram> as each was individually understandable
<sriram> but talk to you
<sriram> tomorrow
<sriram> late there now
<Regenaxer> Canvas is far less powerful than SVG
<Regenaxer> yeah
<Regenaxer> See you!
<sriram> see you! bye :)
<Regenaxer> afp :)
sriram has quit [Ping timeout: 260 seconds]
orivej has quit [Ping timeout: 245 seconds]
alexshendi has quit [Read error: Connection reset by peer]