DesignCAD 3D Max 2027 box
Now available

DesignCAD 2027

Hatches that follow their boundaries, an on-screen dial to turn your model, and a way to find any command by name, in a clean Windows 11 look.

Font question

Started by j-wetzel, May 21, 2015, 09:34:12 AM

Previous topic - Next topic

0 Members and 0 Guests are viewing this topic.

j-wetzel

I have occasion to underline some text in a drawing, and I understand how to do this using the multiline editor.  I use Times New Roman text for all my drawings, and I want to insert 9 into a drawing.  But a glance at the attached shows that the Times New Roman 9 is quite different from the 9 generated by the multiline editor, even though the font in the multiline editor is set to Times New Roman.  How can I get the font I need?

--Jack

j-wetzel

  Apparently the problem is a consequence of the small scale (0.25) I'm using.  If I use a larger scale, say 1 or 2, the underlined nine has the same shape as the un-underlined one.  And then to get the correct height I have to scale.  Since I have a lot of numerals I need to underline, this is a real nuisance; but I'll persevere.
  Sorry to bother you.
--Jack

DrollTroll

I'm not seeing the difference in shapes that you describe.

Since the MultiLine Text Editor allows each character to have its own font, it occasionally shows the font *after* the current cursor position. If this occurs again, try selecting the ML text, opening the Info Box, and click on "Edit Multiline Text". Select the text in the ML editor, and re-apply the desired font while it's selected.
25 years with DesignCAD

j-wetzel

#3
  Thanks for the suggestion, DT.  Now the numerals appear underlined and with the correct font (Times New Roman), but the spacing between the letters is different (see picture).
  Sorry to be so fussy, but the referees for an articles submitted for publication would notice such an anomaly and want it fixed.  I suppose I could always just enter the numeral and then draw a short line under it by hand, or enter the underlined numerals 0 through 9 separately and then assemble the numerals, e.g., 14 from 1 and 4, by hand.
  Any other suggestions?
--Jack

DrollTroll

Nope, sorry. I guess your best procedure is to draw the text at 1.0 height, then scale it down after it's drawn. If you're drawing a lot of text this way, it might be easier to scale the entire drawing up by 4, draw all the text at 1.0, then scale the entire drawing back down by 0.25
25 years with DesignCAD

prl

Jack, you've forgotten this is a CAD program.  You can draw a line too.  Same thing for mathematical symbols.  If you can't find the mathematical font equivalent, make one in CAD.

j-wetzel

  It seems not to be possible to assemble, for example, 14 from 1 and 4, because the underlined numerals disappear when you try to move them.  All you can see is the bounding box, and so matching them perfectly, side by side, to form a continuous underline isn't possible.  "k" doesn't appear to work in this situation either--maybe it just doesn't work with multiline text?
  So I made a little frame and inserted the underbar by hand.  It proved not to be as difficult as I expected.  Just shows what (little) I know.
  For the sort of work I've been using DC for, it needs a significantly more versatile text editor--which probably means that all of my life I've been using the wrong tool.  But there's no tool like an old tool.
  Thanks again for all your suggestions.
--Jack

samdavo

#7
Again, just playing around with this one,
and assuming one wants to typeset each number individually (arguably pretty inefficient) ...

a) numbers are pretty easy in Times New Roman, because they are standard length (compared to letters which vary,  eg iii  versus mmm).  In the attached jpeg, (text size 20), the length of each digit is 15.08, and the length of 10 digits is 150.8
b) I have randomly chosen the gap for the underline as 3, or 15% of the text size.
c) It is also pretty easy to draw an underline under each number, and then to make a group, (Tool\Group\Group Define)  eg 1 with its underline, then 4 ditto;  then pack them like typeset.   If you go to Point Select Mode the relevant corners become obvious.

Note that I have intentionally screwed up with the 7, just to show that they are typeset.
PS You could do the same with letters, but I imagine it would be easier to underline the final words rather than each letter - or groups of digits for that matter (2 cents).

samdavo

#8
PS A better idea than typesetting ...  it would / should be dead simple to do a macro that underlines a selected line of text, assuming it is horizontal.
Length of line from left-low corner to right-low corner, displaced down "15% of text size".

PS (Third edit) having tried this, I find it's not as easy as it first appears.
I enclose draft - probably doing something stupid, including simple "draw a simple line" (sheesh). 
- ok this has now been corrected and I get a line under the text.

The extent of the line in x dirn is easy :- from XL to XR, viz :-
XL = sys(196)  ' is X coord of left low corner
XR = sys(198)  ' is X coord of RIGHT low corner

However the height of the text seems to a a factored down version of sys(199) - sys(197), viz :-
TH = (sys(199) - sys(197))/ 1.7264  'text height - at least for Times New Roman, varies with font.

I enclose a (THIRD) draft of a macro called Underline3.d3m  - must have a single line of horizontal 2D text selected - in 2D mode - ideally Times New Roman   - ok, I finally made it work - EXCEPT that I still have to make the underlining the same layer and colour as the text ( later) 

PS Heck, a good fallback - it is so easy to just draw a line joining the bottom corners of the text, and displace this down by 15% text size, using F2 "Parallel by distance"

samdavo

#9
PS In the unlikely event that anyone is following this monologue lol, I finally got it to work, (Eurovision in the background) ... i.e. If the text is green and layer 4, then the underline is the same (even if current layer and colour are something else).  Unfortunately it emerges from the macro in the layer and colour of the text - subtle corrections for another day  - blind man, galloping horse - near enough :)
(edit) sorry still has errors - Seems to change colour and layer for the first text, but then doesn't change for the second and subsequent texts - clearly something to do with allocating "1" in the "GetAttr 1 ...  "  line
- for another day


Quote'UNDERLINE4.d3m -- Underlines horizontal 2D text  15% of text size below the text.
Message "Must have a single line of horizontal 2D text selected - in 2D mode - ideally Times New Roman"
'20150522 samdavo - amateur hour

XL = sys(196)  ' is X coord of left low corner
XR = sys(198)  ' is X coord of RIGHT low corner
TH = (sys(199) - sys(197))/ 1.7264  'text height
GAP = 0.15 * TH
YLINE = SYS(197) + .3632 * TH - GAP
'MESSAGE "XL,XR,TH,GAP,YLINE", XL, XR, TH, GAP, YLINE
'MESSAGE "TH, SYS199, SYS197", TH, SYS(197), SYS(199)
GetAttr 1, etype, eselect, elayer, egroup, ered, egreen, eblue  ' EDIT -
'there is a problem with using 1 again and again - it doesn't overwrite the old value

>Line
{
    <Color [ered], [egreen], [eblue]
    <Linestyle 0, 10, 0
    <Layer [elayer]
    <Pointxyz [XL, YLINE, 0]
    <Pointxyz [XR, YLINE, 0]
    }
'minor disadvantage is that you are left in the layer and colour of the text
REGEN
END

DrollTroll

Sam, the first argument for GetAttr ("1" in your macro) is the index of the entity for which you are getting the attributes. If you use 1, you always get the attributes of the first entity in the drawing.
To work through selected entities, you probably want to use GetSelect i, j  -- this returns the index of the ith selected entity in j. This is of course done in a loop with i being the loop variable.
Then use GetAttr j, etc. to get the attributes of the ith selected entity.

nsel = Sys(80)
For i  = 1 to nsel
  GetSelect i, j
  GetAttr j, etype, esel, elayer, ered, egreen, eblue
  Do stuff based on entity j
next i

Note that your method won't work for 2D text in 3D mode -- as you rotate the view the text will remain "flat" against the view, but the line will rotate.
25 years with DesignCAD

samdavo

Thanks DT,
PS I realise that macro is pretty basic, and only works in 2D and for horizontal text. 

Summary.  I will check out the MultiLine Editor option a bit more thoroughly.
cheers