PDA

View Full Version : How to get the current text height?


boesiii
2006-11-06, 06:48 PM
I thought the variable textsize had the current text height, but it is just if the text style has a height of 0.

.T.
2006-11-06, 07:01 PM
This may help:

(cdr (assoc 40 (tblsearch "style" (getvar "textstyle"))))

Returns the height of the current text style.

Opie
2006-11-06, 07:03 PM
This may help:

(cdr (assoc 40 (tblsearch "style" (getvar "textstyle"))))

Returns the height of the current text style.
Should you check to see if it is 0? If it is 0 then Group Code 42 will show the last used height.

.T.
2006-11-06, 07:11 PM
Should you check to see if it is 0? If it is 0 then Group Code 42 will show the last used height.

OK.
(if (zerop (cdr (assoc 40 (tblsearch "style" (getvar "textstyle")))))
(cdr (assoc 42 (tblsearch "style" (getvar "textstyle"))))
(cdr (assoc 40 (tblsearch "style" (getvar "textstyle"))))
)

PS: Where is your light bulb coming from? Antarctica on the slow boat?

rkmcswain
2006-11-06, 07:29 PM
Dare I suggest.....


(if (zerop (cdr (assoc 40 (setq tmp (tblsearch "style" (getvar "textstyle"))))))
(cdr (assoc 42 tmp))
(cdr (assoc 40 tmp))
)


:beer:

.T.
2006-11-06, 07:48 PM
I need all of the help I can get, RK. :) Thanks for the suggestion.

Opie
2006-11-06, 08:01 PM
Where is your light bulb coming from? Antarctica on the slow boat?
Yeah, that's it. ;)

rkmcswain
2006-11-06, 08:01 PM
I need all of the help I can get, RK. :) Thanks for the suggestion.

I was thinking after I posted that....

If you simply ran the code by itself, then yours would be better since there are no global variables. However, if you wrapped this up in a defun, then you could make "tmp" local and it would run a tad faster... (like maybe 1 nanosecond) ;-)

Opie
2006-11-06, 08:04 PM
I was thinking after I posted that....

If you simply ran the code by itself, then yours would be better since there are no global variables. However, if you wrapped this up in a defun, then you could make "tmp" local and it would run a tad faster... (like maybe 1 nanosecond) ;-)
Now that's noticable. :p