I am trying to create a custom SHX font from a SHP file using the COMPILE command.
I have specified the base insertion point when I created the SHP file.
When I try to test the SHX font it seems to just place all the letters on top of eachother. (basically all at the same point)
Is there a way to avoid this? I assume I need to have some kind of parameter to specify the distance between each letter? Like a start and end point?
Here you go - I only made the letters A, B and C here.
https://drive.google.com/file/d/1PwyAKP3rP6nLgP_EkEZhn0D91p6hSqpE/view?usp=sharing
(for some reason I can't attach .shp file directly so here is a Gdrive link)
@imuckyu wrote:
.... I assume I need to have some kind of parameter to specify the distance between each letter? Like a start and end point?
You need to finish each character with a 002 pen-up code followed by a displacement [or sometimes more than one, depending on where on the character its definition ends], to move over to where the next character should start.
And if I may say so, those definitions looks quite complex given the simplicity of the characters in your image. The 4 and 3 multiplier/divider codes piled on each other seem convoluted, though I didn't study it all in detail.
Where exactly can I specify the 002 pen-up code?
In the MAKESHP command it only asks for name, resolution and base insertion point.
Or do I need to add that code manually in the .shp code later?
How do I do that/What kind of code would I enter? Where can I read more about this?
Read about the special codes >here<, and look at the parent topic "About Shape descriptions" one up from there, as well as other related topics.
The big difference between font character definitions and shape definitions is the inclusion of the move-over-to-where-the-next-character-starts code at the end of font characters, which shape definitions don't need. That's why using MAKESHP doesn't define the shape correctly for use as a character in a font.
Thanks for the link. I had a look at it.
In general I understand the overall concept (About Shape Descriptions)
*shapenumber,defbytes,shapenamespecbyte1,specbyte2,specbyte3,...,0
For the start/end position part I am still a bit confused. Do you happen to have an example?
So my current approach (below) is not the way to go then, is that correct?
1) Draw Letter
2) MAKESHP command => export as .shp
3) Change the shapenumber etc. manually in a text editor
4) COMPILE command => select previous .shp file => generate .shx file
Or should I use a different command/approach here?
If you're talking about making a font file, you also need to add the step of editing each shape definition to lift the pen and move over to where the next character would start. Here's the definition of the upper-case A in the ROMANS font:
*00041,39,uca
2,14,8,(-9,-21),14,5,8,(9,21),1,8,(-8,-21),2,8,(8,21),1,
8,(8,-21),2,8,(-13,7),1,0A0,2,8,(4,-7),14,6,14,8,(9,-9),0
The 2 is lifting the pen after drawing the last element in the character. The 8,(4,-7) is the move [over 4 units and down 7] to get the pen location to where the next character would start.
In the case of AutoCAD's .shx fonts, they're designed for the possibility of vertically-running text in a Style definition, which is what the 14's are about [14 is the same as 00E -- look at that in the Special-Codes page]. So this is more complex than you probably need -- the stuff after that pen move, with the 14's, is ignored if the Style is not set to run vertically, except for the concluding 0.
Thank you that is very helpful!
One other question - how were you able to read the definition of the A letter from the ROMAN font?
When I open the .shx file in a text editor it shows unreadable text.
I can't find a .shp file that I could open. Or did you convert the .shx file to .shp format? If yes, how?
"We" are talking your harddrive, the command console! [WIN]+[R] Open: CMD
for example if you like to dump a "d:\temp\romans.shx" file:
Sebastian
Can't find what you're looking for? Ask the community or share your knowledge.