Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Reply
Message 1 of 3
aqdam1978
332 Views, 2 Replies

CharMap

Hi everybody,

I want to creat a table with all characters inside a font.

I used "%%" to change a number to it's character.

but "%%" limited to 999 and for numbers bigger than 999 it doesn't work.

also, CHR command limited to 255 and for numbers bigger than 255 it change to (number-255).

so I used "%%" to create this table:

 

[Please change default font in your AutoCAD to ARIAL]

 

(Defun c:charmap ()
(setvar "cmdecho" 0)
(setq cnt 1.0)
(setq r_cnt 0.0)
(setq ts 32)
(setq x 0.0)
(setq y 0.0)
(setq sub_y (- y 0.1))
(command "layer" "m" "textfont" "c" "2" "" "")
(repeat ts
(while (<= (fix cnt) (+ r_cnt ts))
(setq pt (list x y))
(setq sub_pt (list x sub_y))
(command "text" "m" pt "0.05" "0" (strcat "%%" (rtos cnt 2 0)))
(command "text" "m" sub_pt "0.05" "0" (rtos cnt 2 0))
(setq x (+ x 0.2))
(setq cnt (+ cnt 1.0))
)
(setq r_cnt (+ r_cnt ts))
(setq x 0)
(setq y (- y 0.2))
(setq sub_y (- y 0.1))
)
(command "zoom" "e")
(command "zoom" "0.75x")
)

 

I want to know:

1- what can I do for numbers more than 999?

2- How can I know the number of characters inside a font?

3-how can improve my LISP program to have complete characters inside the fonts?

 

Thanks

 

2 REPLIES 2
Message 2 of 3
Moshe-A
in reply to: aqdam1978

Hi,

 

the "%%" prefix 'function' is exist to let you 'see' a character that does not exist in KB

like %%d, %%c , %%p

 

if i understand you? you do not need to use "%%" instead just loop thought the ascii code

as far as i know true type fonts can have at top 2^16 charachters (= 65536)

 

(setq i 32)

(while (< i 65536)

  (setq i (1+ i))

  (princ (strcat "\n" (rtos i 2 0) "=" (chr i)))

)

 

but this does not give you what is really inside the font file. ttf file (also shx) can not be accessed by

autolisp cause they are not ascii files. i have already seen fonts file (especialy shx files) that does

not have all the ascii characters. trying to access them will create '?' or undefined shape xxxx.

 

Moshe

 

 

Message 3 of 3
aqdam1978
in reply to: aqdam1978

Hi,

I did it. It was very complicated!

you can see all 65536 charactes in ARIAL fonts!

Because of limiting in size of uploading file in this forums(1.5MB) I uploaded in another website:

 

https://hotfile.com/dl/187672235/45357e3/CharMap_Arial_Font.7z.html

(size: 2.8MB)

Thanks,

 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost