Is there a way to tell the number of characters in a font?
I'm trying to build a macro that shows each character in a selected font
but not all fonts have the same number of characters.
Currently I'm using 0 to 400 but some fonts have lots of blanks before
reaching 400 and some go past 400. Any help would be appreciated.
Thanks,
Dave
Klaus Linke - 19 Oct 2006 21:40 GMT
Hi Dave,
Maybe there's a way using the Windows API for fonts...
But with Word VBA, I don't think there is a good solution.
IIRC, in Word2000, I found a trick: If you select a character that isn't in
the current font and open the "Insert > Symbol" dialog, you'll notice that
the top left character, the blank (ASCII 32), is selected. You can get that
info by displaying the dialog for a moment, and fetching it --
Dialogs(wdDialogInsertSymbol).CharNum
In Word 2003, I can't get that to work: The dialog will return the real code
even if the character does not exist in the font.
Maybe you could just insert all 64000+ Unicode characters (without
supplementary planes) quickly with
Dim strFont As String
For i = 1 To &HFFFF&
strFont = strFont & ChrW(i)
Next i
Selection.InsertAfter strFont
... and then delete the junk by hand?
Regards,
Klaus
> Is there a way to tell the number of characters in a font?
>
[quoted text clipped - 14 lines]
> ----= East and West-Coast Server Farms - Total Privacy via Encryption
> =----
Jezebel - 19 Oct 2006 23:44 GMT
You should look at www.unicode.org. In theory, a font can now have
*literally* millions of characters. None yet does, but there are quite a few
that get into the thousands. Do a Google for 'font file format' and
similar -- there are several freeware utilities around that read the nuts
and bolts of font files.
> Is there a way to tell the number of characters in a font?
>
[quoted text clipped - 14 lines]
> ----= East and West-Coast Server Farms - Total Privacy via Encryption
> =----