Creating custom bold text style

Creating custom bold text style

Anonymous
Not applicable
2,061 Views
17 Replies
Message 1 of 18

Creating custom bold text style

Anonymous
Not applicable

Hello everyone, 

 

I'm having trouble creating a custom bold text style. My code is: 

 

(entmakex
'(
(0 . "STYLE") 
(5 . "902AA") 
(100 . "AcDbSymbolTableRecord") 
(100 . "AcDbTextStyleTableRecord") 
(2 . "DriverStyle")
(70 . 0) 
(40 . 0.15) 
(41 . 1.0) 
(50 . 0.0) 
(71 . 0) 
(42 . 0.15) 
(3 . "arial.ttf")
(4 . "")
)
)


(entmakex
'( 
(0 . "STYLE") 
(5 . "9033E") 
(100 . "AcDbSymbolTableRecord") 
(100 . "AcDbTextStyleTableRecord") 
(2 . "BaseStyle") 
(70 . 0)
(40 . 0.12) 
(41 . 1.0) 
(50 . 0.0)
(71 . 0) 
(42 . 0.15) 
(3 . "arial.ttf")
(4 . "")
)
)

Even if I put the "arialdb.ttf" font file, it just doesn't recognize it. Is there an alternative syntax I could use?

 

Thanks in advance

0 Likes
2,062 Views
17 Replies
Replies (17)
Message 2 of 18

Kent1Cooper
Consultant
Consultant

Just one thing I notice -- try it without  the  (5 . xxxxx)  entries.

Kent Cooper, AIA
0 Likes
Message 3 of 18

Anonymous
Not applicable

Just did, arialdb.ttf is still not recognized on my end. If I use arial.ttf it just uses the normal Arial, without it being bold, which I need. 

0 Likes
Message 4 of 18

CodeDing
Advisor
Advisor

@Anonymous ,

 

Fonts are weird. You need to use the correct .ttf file...

On Windows they can be found here: c:/Windows/Fonts

Try using this instead:

(3 . "arialbd.ttf")

EDIT: This works for me..

(entmakex (list '(0 . "STYLE") '(100 . "AcDbSymbolTableRecord") '(100 . "AcDbTextStyleTableRecord")
	        (cons 2 "MyStyleName") (cons 3 "arialbd.ttf") '(70 . 0) '(42 . 0) '(4 . "")
	        '(40 . 0);text height
	        '(41 . 1.0);width factor
	        '(50 . 0.0);oblique angle
	        '(71 . 0);text generation "0" normal text
	  );list
);entmake

Best,

~DD

0 Likes
Message 5 of 18

Kent1Cooper
Consultant
Consultant

@Anonymous wrote:

....

Even if I put the "arialdb.ttf" font file, it just doesn't recognize it. Is there an alternative syntax I could use?

....


arialbd.ttf

Kent Cooper, AIA
0 Likes
Message 6 of 18

Anonymous
Not applicable

Yep, I wrote it wrong here, although I write it properly at the .lsp file it doesn't run. 

I also run CodeDing's code to no avail; although I can see the ttf file loaded on the text style customization window, after I open it, the font shows up with a yellow triangle and an exclamation mark.

I also checked my windows font directory and the arialbd.ttf exists, but it is a subfile of the original arial.ttf and not a standalone one. I thought about copying it out of the arial.ttf, straight into the Windows/Font directory but I'd like my module to be portable and not make every user try to modify his own Font directory.

0 Likes
Message 7 of 18

CodeDing
Advisor
Advisor

@Anonymous ,

 

Mine is also a sub-file in the font directory. DO NOT rearrange your fonts. There is no need for that.

Did you copy my code exactly? And try pasting into command line? Can you show us a snip / image of your error?

 

Best,

~DD

0 Likes
Message 8 of 18

Kent1Cooper
Consultant
Consultant

Your original code works for me [Acad2019, Windows7] when I omit the  (5 . xxxxx)  entry and use arialbd.ttf.

 

Just out of curiosity, does it find that font if you use a command-line [hyphen-prefixed] -STYLE command and answer the font prompt with arialbd.ttf?  That also works for me.

Kent Cooper, AIA
0 Likes
Message 9 of 18

Anonymous
Not applicable

Pasting my command line history:

 

Command: -STYLE
Enter name of text style or [?] <Standard>: MyStyle
New style.
Specify font name or font filename (for SHX) <txt>: arialbd.ttf
Font file doesn't exist.

Also running the code without the 5 clause and also, CodeDing, running exactly your code in my command prompt yields this:

 

zGkmWV.png

 

Of course all executions are on a fresh empty drawing. I wonder if this is local, I'm currently working on my workspace computer, I wonder if it will work in my personal computer at home.

0 Likes
Message 10 of 18

CodeDing
Advisor
Advisor

@Anonymous ,

 

It appears you do not have the Arial Bold font file..

Assuming you're using Windows, this will list all of the available font files you can use:

(vl-directory-files "c:\\windows\\fonts")

Best,

~DD

 

0 Likes
Message 11 of 18

Anonymous
Not applicable

uq9xjn.png

And yet ... here it is. I really don't know what's going on. I'll check at home and return with some more feedback.

0 Likes
Message 12 of 18

CodeDing
Advisor
Advisor

What fonts appear when you run the vl-directory-files code? Is it in the list? 

0 Likes
Message 13 of 18

Kent1Cooper
Consultant
Consultant

@Anonymous wrote:

And yet ... here it is. ....


Try right-clicking on that, choose Properties, and see whether maybe the file's name has gotten altered somehow.

Kent Cooper, AIA
0 Likes
Message 14 of 18

Anonymous
Not applicable

It happens on my home pc too. It's baffling.

 

(vl-directory-files "c:\\windows\\fonts")
("." ".." "8514fix.fon" "8514fixe.fon" "8514fixg.fon" "8514fixr.fon" "8514fixt.fon" "8514oem.fon" "8514oeme.fon" "8514oemg.fon" "8514oemr.fon" "8514oemt.fon" "8514sys.fon" "8514syse.fon" "8514sysg.fon" "8514sysr.fon" "8514syst.fon" "85775.fon" "85855.fon" "85f1255.fon" "85f1256.fon" "85f1257.fon" "85f874.fon" "85s1255.fon" "85s1256.fon" "85s1257.fon" "85s874.fon" "AcadEref.ttf" "AIGDT___.TTF" "AMDT_Symbols.ttf" "AMGDT___.ttf" "app775.fon" "app850.fon" "app852.fon" "app855.fon" "app857.fon" "app866.fon" "app932.fon" "app936.fon" "app949.fon" "app950.fon" "arial.ttf" "arialbd.ttf" 

so arialbd.ttf shows up normally. I don't know what happens. I try calling other fonts and when I call the general font, it's called just fine, but if I try to call e.g. meiryob it shows the screenshot I posted earlier with the yellow triangle. I use @CodeDing code for testing from now on since it's working for you guys.

 

Also @Kent1Cooper all my font subfiles have the proper names, I checked. Meiryob, arialbd e.t.c. 

0 Likes
Message 15 of 18

CodeDing
Advisor
Advisor

@Anonymous ,

 

This baffles me then. I would try the following:

- Full restart of AutoCAD & Computer

- If not working, Contact Support about using their product

- If all else fails, you may need to either Restore Defaults or Uninstall then Reinstall the product.

 

That's the best I can think of at this point..

 

Best,

~DD

0 Likes
Message 16 of 18

Sea-Haven
Mentor
Mentor

To muddy the waters my new Windows 10 laptop does not have Arial Bold but does have Arial Black. Pretty sure my old one did.

 

Arial

 

Arial Black ? if it worked.

 

Oh checked fonts directory does exist but not in CAD choice.

Did the manual thing -style in Briscad may help re bigfont. 

: -STYLE
? to list existing styles/<Text style to create or modify> <Standard>: alan
Font <txt.shx>: arialbd.ttf
font: arialbd.ttf bigfont:  is selected.

 

0 Likes
Message 17 of 18

Anonymous
Not applicable

Just to recap, so I can also keep track of things.

 

Both computers have the proper fonts, with the proper names, installed in the proper directory.

Both computers fail to invoke all subfonts residing in the Windows/Font folder, not just arialbd (meiryob etc.).

Both computers can call all the original fonts (arial, meiryo ....).

Of course all subfonts can be set manually through the text font editor window, I guess if there was a general problem of not being able to access arialbd, I wouldn't be able to set my Arial font to bold through the dropdown menu.

0 Likes
Message 18 of 18

Sea-Haven
Mentor
Mentor

In 2020 it auto set the Bold flag rather than Bigfont. Ie it worked.

 

What version of Autocad and Windows do you have ?

0 Likes