Jump to content

Center Text in Vector Image with DCL and Adjust Font Size


Recommended Posts

Posted

I'm trying to add a larger text to my DCL, and for that, I created a custom function that generates a vector_image:

 

(defun _dialogtext (key str)
    (set_tile key str)
    (start_image key)
    (vector_image 0 (1- (dimy_tile key)) (dimx_tile key) (1- (dimy_tile key)) -15)
    (end_image)
)

In AutoCAD, when using width = 50.5, the result is perfect. However, in BricsCAD, the text appears smaller and is not fully displayed, as shown below:

image.png.e7e61e8cad4886961cd7a9b9bf958179.png

 

BricsCAD:

image.png.381bff0e9f019e7557ce6a77f79b1560.png

 

When I increase the length, the text is no longer centered and part of it sticks out. My question is: how can I center this text in this context? Also, is it possible to increase the font size to make the text larger?

image.png.7c477f18840b9626995afc900663d2c5.png

 

(defun c:demo ()
  
  (defun _dialogtext ( key str )
    (set_tile key str)
    (start_image key)
    (vector_image 0 (1- (dimy_tile key)) (dimx_tile key) (1- (dimy_tile key)) -15)
    (end_image)
  )
  
  (setq dcl_id (load_dialog "demo.dcl"))
  (if (not (new_dialog "demo" dcl_id))
    (progn
      (alert "Erro")
      ; (exit)
    )
  )
  (_dialogtext "active_text_1" "Create ideas, innovate, and transform your future!")
  (setq value (start_dialog))
  (if (eq value 1)
    (prompt "OK!")
  )  
)

 

demo : dialog
{
    label = "Demo";
    : column
    {
        // width = 90;
        spacer;
        : image
        {
            key = "active_text_1";
            fixed_width = true;
            fixed_height = true;
            alignment = centered;
            height = 1.3;
            width = 60.5;
            aspect_ratio = 1.2;         
            color = 1;            
        }
        spacer;
        ok_cancel;
    }
}

 

Posted (edited)

have done something somewhere sometime : 

Maybe you can adapt it for your purposes. 

 

for the font , think this is system setting : https://stackoverflow.com/questions/73750384/does-a-dcl-fonts-reference-exist

 

BricsCad I don't have but maybe attribute 'typeface' could work : https://developer.bricsys.com/bricscad/help/en_US/V9/DevRef/source/IDR_DCL_B39.htm

Edited by rlx

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...