From: Joachim K. <ko...@ma...> - 2019-09-22 06:10:22
|
Hi Bernard, thanks for looking into this. It is not worth spending more time on it. The offsets I found empirically work very well, so I'll just leave it at that. I will soon (well, at some point) commit a revision of the winZoom stuff. Cheers, Joachim. On 13/09/2019 15:51, Bernard Desgraupes wrote: > Hi Joachim, > > I’ve been looking at this and my guess is that the horizontal offset you need to add is due to the line numbers margin. Unfortunately this margin does not have a fixed width: that depends on the number of lines. If there are less than 10 lines, the margin is large enough to display 1-digit numbers, if it is between 10 and 99 it is large enough to display 2-digits numbers, etc. > This certainly complicates your calculations… > If necessary I could let the core provide the information about the line margin width (via getWinInfo). > > Now vertically, as I said before I think the offset is the title bar’s height (possibly augmented by the toolbar’s height). > > What do you think ? > > Bernard > >> Le 6 sept. 2019 à 21:56, Joachim Kock <ko...@ma...> a écrit : >> >> Hi Bernard, >> >> I am revising the windowZoom package. >> >> When I wrote it many years ago for AlphaX, >> I had to use some ad hoc home-made font- >> metrics tables valid only for Monaco :-( >> In AlphaCocoa, this looks childish, as we now have >> getWinInfo charWidth and getWinInfo lineHeight :-) >> Really cool -- it simplifies a lot. >> >> My question is about two offsets that seem >> required. I have determined them empirically: >> 12 horizontally and 63 vertically. So that >> the final calculation of window dimensions to >> hold $rowNum lines of $colNum chars (at a given >> font) is: >> >> # Calculate new geometry >> set x [getWinInfo charWidth] >> set y [getWinInfo lineHeight] >> set newWidth [expr {$x * $colNum + 12}] >> set newHeight [expr {$y * $rowNum + 63}] >> >> However, I cannot figure out how to explain >> these offsets. For example, the difference betweem >> getGeometry and getCeometry -c gives a vertical >> difference of 22 (and no horizontal difference). >> I have tried with line numbers turned off, but >> it does not seem to make any difference. >> >> Do you know how to determine these offsets in >> a more formal way, and what they depend on? >> >> Thanks! -- and no hurry. >> >> Cheers, >> Joachim. >> >> >> >> _______________________________________________ >> AlphaCocoa-devel mailing list >> Alp...@li... >> https://lists.sourceforge.net/lists/listinfo/alphacocoa-devel > |