How can I create an SHX font file from scratch?

How can I create an SHX font file from scratch?

jamieq
Collaborator Collaborator
11,553 Views
26 Replies
Message 1 of 27

How can I create an SHX font file from scratch?

jamieq
Collaborator
Collaborator

I use an AutoCAD extension that has it's own SHX file which replaces \ with ½, [ with ¼, and ] with ¾. I want to create a new font that is bolder than the default one, but I don't know how to start. I want to pick any good bold font and make the same replacements as the default font. All the posts I read about making SHX files explain how to compile an SHP file. But the help documents about creating an SHP file are, well, not very helpful. I don't understand the format of SHP files. So can anyone help me easily through this process or suggest a program that makes it easier? Thank you. 

0 Likes
Accepted solutions (1)
11,554 Views
26 Replies
Replies (26)
Message 2 of 27

Kent1Cooper
Consultant
Consultant

Fonts with substituted fraction characters like that were helpful back in the days [pretty long ago now] when AutoCAD couldn't stack fractions.  Now that it can, I would discourage you from using such a font, for three reasons:  1) you don't have the use of those replaced characters at all if you should have a reason to want to use them, and  2) anyone to whom you send such a file needs to have that same font, and  3) if you should ever change text-containing objects to a Style that uses a different font, you'd have to remember that you need to carefully go through and proof-read everything, to be sure you don't miss any substituted characters that will now become inscrutable.

 

But if you want to go that route anyway, you probably should make the effort [and yes, it does take some effort] to understand how shapes are defined.  The instructions in the Customization Guide are, shall we say, "challenging," but that's not the same as not being helpful -- they tell you exactly what you need to do, however hard you may need to concentrate to "get it."  Yes, you could  simply pull the definition of the  1/2  character out of the "default" font's .SHP file, and plug it in where the definition of the  \  character is in your bolder one, in place of that character's original definition, but it won't be bolder like everything else in that font.  [If that doesn't bother you, it's a simple matter of substitution.]  If you don't understand how shapes are defined, how are you going to be able to adjust [and in this case no doubt also add to ] the definition of a character like that to make it correspondingly bolder?

Kent Cooper, AIA
Message 3 of 27

j.palmeL29YX
Mentor
Mentor

Can you post this .shx file please. I would like to give it a try.

 

My idea (if you want to try it yourselfe): first decompile this .shx into a .shp file (using dumpshx.exe from the Express tools). Then modify this .shp. Here you must know how to define symbols. This can not be explained in some words. A good instruction can be found in the documentation of ACAD Rel. 12 (from 1992). Maybe you find an instruction anywhere in the current help or at other places in the web. (I didn't search now). Then compile the modified .shp into a new .shx.

 

cadder

Jürgen Palme
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature

0 Likes
Message 4 of 27

jamieq
Collaborator
Collaborator

The reason for substituted characters is for pipe sizes. The particular extension I'm using is HydraCAD, which is for designing fire sprinkler systems. They use \ as ½ in pipe sizes because 2 1/2 isn't as efficient as 2\ and substituting to 2½, as an example. SprinkCAD, another product, does the same thing but uses h instead of \ for ½. 

 

Here's where I am now. I wasble to use the DUMPSHX utility to create an SHP file of the RomanD font. It has a unicode character for ¼ (U+00BC) and ½ (U+00BD), but not ¾. So I can easily use the definition of ¼ and ½ to remap [ (U+005B) and \ (U+005C). Where I'm now stuck is how to draw the ¾ character. I have no clue how the special codes work. For example, ½ is:

*000BD,80,khalf
2,14,8,(-13,-25),14,5,8,(5,10),1,010,0E4,01A,029,01C,021,0CC,2,
8,(-2,-14),1,010,8,(16,29),018,8,(-16,-29),2,8,(12,11),1,014,023,
021,020,02F,02D,01C,02B,8,(-7,-8),2,0A4,1,010,014,023,2,01A,1,
021,020,02F,2,016,1,02D,01C,02B,8,(-7,-8),090,014,088,2,8,(11,2),
14,6,14,0DE,0

What does all that mean? I can't find a simple guide anywhere. I can't even begin to understand how it is drawing the characters, because there are codes such as 02F and 01C in there, which mean nothing to me. Any idea what this all means, and how to use it to draw a ¾?

0 Likes
Message 5 of 27

jamieq
Collaborator
Collaborator

@j.palmeL29YX  That's where I'm at now. I have the SHP file, but I can't make any sense of the code, and nothing I can find is any help. I'll see if I can find the documentation you mentioned. 

0 Likes
Message 6 of 27

j.palmeL29YX
Mentor
Mentor

@jamieq wrote:

I have the SHP file, but I can't make any sense of the code, and nothing I can find is any help. I'll see if I can find the documentation you mentioned. 


 

A german help (complete description, note the included links) I found here. I'm sure you will find the english equivalent.

But, I am with @Kent1Cooper . A really bold shx-font can not be defined.  This is only possible with true type fonts.

 

cadder

Jürgen Palme
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature

0 Likes
Message 7 of 27

jamieq
Collaborator
Collaborator

I've found that help documentation. I even found what explains what the specbyte means. I just still can't make sense of all the vector length and direction codes and such. All I really wanted to do was draw a ¾ symbol for the RomanD.shx font, and then map it to the ] button. But I'm so confused how any of those characters are drawn. 

0 Likes
Message 8 of 27

j.palmeL29YX
Mentor
Mentor

@jamieq wrote:

All I really wanted to do was draw a ¾ symbol for the RomanD.shx font, and then map it to the ] button. 


 

If you can wait ... tomorrow I would try it. (This will be less complicated than explaining the syntax of symbol definitions.)

 

cadder

Jürgen Palme
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature

0 Likes
Message 9 of 27

Kent1Cooper
Consultant
Consultant

@jamieq wrote:

.... I can't even begin to understand how it is drawing the characters, because there are codes such as 02F and 01C in there, which mean nothing to me. Any idea what this all means, and how to use it to draw a ¾?


 

If you haven't yet dug deep enough to find it, >this< tells you what those codes mean.  It's not something that is quickly mastered, but it's possible to understand it with some study.

Kent Cooper, AIA
Message 10 of 27

Kent1Cooper
Consultant
Consultant

@j.palmeL29YX wrote:
.... I am with @Kent1Cooper . A really bold shx-font can not be defined.  This is only possible with true type fonts. ....

 

It can be in .SHP/.SHX fonts, by going to double-line [or more!] character definitions.  I've seen fonts with many more than  double passes, such as this:

BoldSHX.PNG

which come out nice and bold and solidly-filled if the lineweight assigned for plotting is enough to close over the space between the passes.  [That one is actually called  Bold.shx.]  Hence their wanting to plug it into ROMAND, which is a Double-line font [that's what the D in the name stands for].

Kent Cooper, AIA
0 Likes
Message 11 of 27

jamieq
Collaborator
Collaborator

That's what I wanted to do, use the Roman double-line font. I'd read the vector code documentation that you had linked, and I still can't make sense of the code in the SHP file. Too many other things in there like repositioning the vector location or something like that. Anyway, I made it easier on myself for now, and decided to use the Arial Unicode MS font. I used a font editor and basically copied the data from the characters ¼, ½ and ¾ to the definitions of characters [, \ and ]. So it accomplishes what I was looking for, although not with the font I was hoping to use. Hopefully, I will be able to understand how to draw the ¾ with the vector codes. 

0 Likes
Message 12 of 27

j.palmeL29YX
Mentor
Mentor

@Kent1Cooper wrote:

 

It can be in .SHP/.SHX fonts, by going to double-line [or more!] character definitions.  .


Yes, I know. Therefore I wrote "A really bold shx-font can not be defined". If you use a small text heigt all seems to be ok. If you use a large text heigt, you see the multiple lines and not a bold char.

 

cadder

Jürgen Palme
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature

0 Likes
Message 13 of 27

s.borello
Advisor
Advisor

See link below... I believe there is a solution for you as well.

 

https://forums.autodesk.com/t5/autocad-forum/how-make-shx-font-file/m-p/2025100#M419659

 

 

0 Likes
Message 14 of 27

Anonymous
Not applicable

Thanks for the link. I’ve read through it already, but it doesn’t help me. It doesn’t say what to do with the 100 x 100 grid drawn objects. And then it still says I need to learn how the vector codes work, which I already don’t know. It’s just crazy how little helpful documentation there is for this. 

0 Likes
Message 15 of 27

j.palmeL29YX
Mentor
Mentor

Another suggestion:

Draw your 3/4 using lines (and arcs?) as you need it (similar to the other signs in ROMAND). Then create the shp file using the express tool command mkshape.

Now in the roman.shp you can replace the code for 0005D ("]") with your new created code. (And you must correct the numer of signs in the 1st code line).

 

 

 

cadder

Jürgen Palme
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature

0 Likes
Message 16 of 27

j.palmeL29YX
Mentor
Mentor

Attached a (quick and dirty) romand_mod.shx (zipped), where the "] " is substituted by a "3/4".

 

HTH

cadder

Jürgen Palme
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature

0 Likes
Message 17 of 27

jamieq
Collaborator
Collaborator

That works!! I have no idea how exactly you did it, but I appreciate it!! Thank you!!

0 Likes
Message 18 of 27

jamieq
Collaborator
Collaborator

I'm wondering if you could help me just a little bit more. I was able to look at what you did, some other documentation, and I fudged together new shapes into an SHX file. I took the ¼ and ½ symbols from RomanD, exploded the text, scaled them down so they're the same height as the numerals, used the 3 from your ¾ shape, and created a ¾ shape. used MKSHAPE to create them, compiled, and now the issue is that they work, but they appear to have a width of zero. So no matter how many I type, they just appear on top of each other until I type a different character. Do you mind looking at this SHP file and seeing if it makes sense where I went wrong? I've also attached the DWG I made the shapes from. The tan lines are there for insertion points. 

0 Likes
Message 19 of 27

j.palmeL29YX
Mentor
Mentor

@jamieq wrote:

I'm wondering if you could help me just a little bit more.


 

1st.: What I did:

 

- Write a text "3"

- Write a text "4"

- Write a text "/"

- scale the texts smaller (I choosed 70%)

- move the texts so that it look like wanted (I did it freehand, therefore I wrote "quick and dirty". You did it much more accurate)

- explode the texts (txtexp)

- mkshape (get a shp file)

- put this new created code in the complete romand.shp

- compile

It is very similar to what you did.

 

 


@jamieq wrote:

... they work, but they appear to have a width of zero. 


 

If the symbol was written, the virtual pen is located at the basepoint of the current symbol.

At the end of the code you should still add a movement of the "pen" to the next insertion point. Use code 002 (lift the pen) and move the pen some distance xxx to the right (direction "0"). I also didn't it yet in my code example (and din't check if it works well. But I'm sure it should do). You can try out which value xxx returns a suitable result.

(not: If you add some codes you must correct the number of defbytes in the "head line" of the symbol)

 

cadder

 

 

Jürgen Palme
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature

0 Likes
Message 20 of 27

jamieq
Collaborator
Collaborator

If the symbol was written, the virtual pen is located at the basepoint of the current symbol.

At the end of the code you should still add a movement of the "pen" to the next insertion point. Use code 002 (lift the pen) and move the pen some distance xxx to the right (direction "0"). I also didn't it yet in my code example (and din't check if it works well. But I'm sure it should do). You can try out which value xxx returns a suitable result.


Ok, I'll try that. I've been stymied because, while the shape gets created, I have no idea how many units wide it is, but I guess your trial and error idea is better than nothing. I was also trying to figure out how to put in the code 014 to set the start and end points for vertical text, but it seems that's not something I should worry about because this will only be horizontal text. Thanks again for the idea. I'll let you know how it goes. 

0 Likes