Problem to center text
Something's bugging me regarding text and multiline, I cannot find it's centre and can't therefore not easily center it between 2 boundarys.
I can make a line beneath my text and snap to the middle of that, but surely There must be an easier way?
Only thing I can snap to is the insertion point, so if I change this to bottom centre it also works, but when I change back the formation the text moves back.
Any suggestions, please?
Comments
-
Here's what I use to change justification without having the text move. Be aware that the forum software strips formatting from the code.
[code]
(defun c:jl ()
(ee_rejust acAlignmentLeft)
(princ)
)(defun c:jc ()
(ee_rejust acAlignmentCenter)
(princ)
)(defun c:jr ()
(ee_rejust acAlignmentRight)
(princ)
)(defun c:jm ()
(ee_rejust acAlignmentMiddle)
(princ)
)(defun c:jtl ()
(ee_rejust acAlignmentTopLeft)
(princ)
)(defun c:jtc ()
(ee_rejust acAlignmentTopCenter)
(princ)
)(defun c:jtr ()
(ee_rejust acAlignmentTopRight)
(princ)
)(defun c:jml ()
(ee_rejust acAlignmentMiddleLeft)
(princ)
)(defun c:jmc ()
(ee_rejust acAlignmentMiddleCenter)
(princ)
)(defun c:jmr ()
(ee_rejust acAlignmentMiddleRight)
(princ)
)(defun c:jbl ()
(ee_rejust acAlignmentBottomLeft)
(princ)
)(defun c:jbc ()
(ee_rejust acAlignmentBottomCenter)
(princ)
)(defun c:jbr ()
(ee_rejust acAlignmentBottomRight)
(princ)
)(defun ee_rejust (new / error ename_list oc om os selset)
(defun error ( msg )
(setvar "cmdecho" 0)
(while (< 0 (getvar "cmdactive")) (command))
(setq selset nil) ; free selection set
(if (not (member msg '("Function cancelled" "quit / exit abort")))
(princ (strcat "\nError: " msg))
)
(setvar "cmdecho" 1)
(ee_end)
(princ)
)(ee_start)
(setq oc (getvar "cmdecho"))
(setvar "cmdecho" 0)
(setq om (getvar "orthomode"))
(setvar "orthomode" 0)
(setq os (getvar "osmode"))
(setvar "osmode" 0)
(setq selset (ssprompt '((0 . "TEXT")) "\nSelect text to justify: "))
(if selset ; if any text objects selected
(progn
(setq ename_list (vle-selectionset->list selset))
(foreach memb ename_list
(enco_set_alignment memb new)
)
)
)
(setvar "osmode" os)
(setvar "orthomode" om)
(if (> (sslength selset) 1)
(print (strcat "Changed " (itoa (sslength selset)) " text entries."))
(print "Changed 1 text entry.")
)
(setvar "cmdecho" oc)
(ee_end)
(princ)
)0 -
Robin, I'm not sure what you're trying to do, but:
If you change a multiline text's justification from top center to top left (using the Properties palette), it only moves very slightly.
Simple text entities move a lot when changed from center to left justification, but if you convert a simple text to a multiline, then give it center justification, then center it, and then explode it, it doesn't move at all, and it becomes a left-justified simple text again.
You can fit a left-justified multiline text into a centered space by drawing lines on the defpoints layer that define that centered space, then dragging the left grip to the left line and then the right grip to the right line (see attached screen shot).
0 -
Thank you for answering!
Shoemaker, your script might come in handy, still I'm certain there must be an easier way.
I guess I'm not making my purpose very clear, I will try to explain it again.
If i draw two vertical lines I would like to place a text right in the middle of the lines.
For other objects I could use the Snap to between two points function but the problem with text is that I cant find its centerpoint or midpoint.
I could draw a line beneath the text and use its midpoint to find the text's midpoint, still I'm certain that there must be an easier way to do this..0 -
@Robin_E said:
Only thing I can snap to is the insertion point, so if I change this to bottom centre it also works, but when I change back the formation the text moves back.Why do you want to change back? Why not leave it center-justified? Then if you edit the text later, it'll stay centered between the two vertical lines.
0 -
Yes!
Ok this solves the problem, text is now centered as opposed to before but I think it looks kinda nice that way.
Thank you all!0 -
@H Martin Shoemaker BTW you should consider showing code using Markdown block or in-line preformatted text via
`
to avoid loss of characters like*
:(defun c:jl () (ee_rejust acAlignmentLeft) (princ) ) (defun c:jc () (ee_rejust acAlignmentCenter) (princ) ) (defun c:jr () (ee_rejust acAlignmentRight) (princ) ) (defun c:jm () (ee_rejust acAlignmentMiddle) (princ) ) (defun c:jtl () (ee_rejust acAlignmentTopLeft) (princ) ) (defun c:jtc () (ee_rejust acAlignmentTopCenter) (princ) ) (defun c:jtr () (ee_rejust acAlignmentTopRight) (princ) ) (defun c:jml () (ee_rejust acAlignmentMiddleLeft) (princ) ) (defun c:jmc () (ee_rejust acAlignmentMiddleCenter) (princ) ) (defun c:jmr () (ee_rejust acAlignmentMiddleRight) (princ) ) (defun c:jbl () (ee_rejust acAlignmentBottomLeft) (princ) ) (defun c:jbc () (ee_rejust acAlignmentBottomCenter) (princ) ) (defun c:jbr () (ee_rejust acAlignmentBottomRight) (princ) ) (defun ee_rejust (new / *error* ename_list oc om os selset) (defun *error* ( msg ) (setvar "cmdecho" 0) (while (< 0 (getvar "cmdactive")) (command)) (setq selset nil) ; free selection set (if (not (member msg '("Function cancelled" "quit / exit abort"))) (princ (strcat "\nError: " msg)) ) (setvar "cmdecho" 1) (ee_end) (princ) ) (ee_start) (setq oc (getvar "cmdecho")) (setvar "cmdecho" 0) (setq om (getvar "orthomode")) (setvar "orthomode" 0) (setq os (getvar "osmode")) (setvar "osmode" 0) (setq selset (ssprompt '((0 . "TEXT")) "\nSelect text to justify: ")) (if selset ; if any text objects selected (progn (setq ename_list (vle-selectionset->list selset)) (foreach memb ename_list (enco_set_alignment memb new) ) ) ) (setvar "osmode" os) (setvar "orthomode" om) (if ((sslength selset) 1) (print (strcat "Changed " (itoa (sslength selset)) " text entries.")) (print "Changed 1 text entry.") ) (setvar "cmdecho" oc) (ee_end) (princ) )
Try hitting Quote to see how I enclosed your code with
```lisp
to also get coloring!0 -
I wish there were some way to post just what you want, and somehow prevent Markdown from trying to change it. Even the code format does not work for VBA. I forget the specific characters that trigger the problem, but I've had VBA code that would not post successfully.
-Joe
0 -
@sfretwell said:
Try hitting Quote to see how I enclosed your code with```lisp
to also get coloring!Sadly the syntax highlighting is not correct for the Lisp language.
0