Page 1 of 2 12 LastLast
Results 1 to 15 of 25
  1. #1
    New Lounger
    Join Date
    Jun 2001
    Location
    Oregon, USA
    Posts
    19
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Listing fonts in document (2003)

    I am sure this has been asked before, but I can't find it! I am going to send out my doc to a service bureau and I would like a listing of all fonts that I have used. There are several text boxes. How can I find out what fonts I have used? There have been times I just wanted to know for editing on my laptop, so I could put the fonts on the other computer.

  2. #2
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Listing fonts in document (2003)

    Would it be cheating to print it to PDF and then check Acrobat's fonts dialog? (Yes, I guess do, but it seems faster than anything else I can think of.)

  3. #3
    Gold Lounger Rebel's Avatar
    Join Date
    Jul 2001
    Location
    Canada
    Posts
    3,024
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Listing fonts in document (2003)

    Sherrie,
    Would the option to "Embed True Type fonts" work in this situation? Then, you wouldn't have to know in detail what fonts you used and you wouldn't have to install these fonts on the other computer (Tools>Options>Save Tab).
    John
    A Child's Mind, Once Stretched by Imagination...
    Never Regains Its Original Dimensions

  4. #4
    New Lounger
    Join Date
    Jun 2001
    Location
    Oregon, USA
    Posts
    19
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Listing fonts in document (2003)

    I tried to use that SuperDoc.Dot, but I have Office 2003 and it didn't work. What would I need to do to make it work in this ver?

  5. #5
    Super Moderator
    Join Date
    Jan 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    3,852
    Thanks
    4
    Thanked 259 Times in 239 Posts

    Re: Listing fonts in document (2003)

    <P ID="edit" class=small>(Edited by Andrew Lockton on 05-Apr-04 10:40. Fixing the typos and dialog name)</P>Word 97 used to come with a template called Macros8.dot which had a magical little macro/dialog called SuperDocStatistics. This dialog included a list of the fonts included in the document along with a GoTo button to take you there. The next version of Word dropped this macro and the dialog but you can get it all working in the later versions if you play around with it.

    If you can get your hands on an original Word 97 CD, you should be able to find the correct template and hence the code to display the fonts used in your document. The macro works by getting a complete list of system fonts and then doing a find for each one in the document. If it finds something in the file, then it is listed as used and then searches on the next font etc etc.
    Andrew Lockton, Chrysalis Design, Melbourne Australia

  6. #6
    Super Moderator
    Join Date
    Jan 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    3,852
    Thanks
    4
    Thanked 259 Times in 239 Posts

    Re: Listing fonts in document (2003)

    Sherrie

    The relevant piece of the code (hacked to make it run standalone) is shown below. This works on my Word 2002 machine and I would expect that it will still work in Word 2003. This may not be the case especially if the old Wordbasic command to sort the array is not available in Word 2003. That line is cosmetic only so you could remove it if it fails.
    <pre>Sub ShowMeTheFonts()
    Dim NumSysFonts As Integer, i As Integer
    Dim CurFontNum As Integer, strMessage As String
    Dim NumFontsFound As Integer
    Dim aFonts() As String, aFontsPS() As String
    Dim strFont As Variant

    NumSysFonts = Application.FontNames.Count
    CurFontNum = 0
    NumFontsFound = 0
    ReDim aFonts(NumSysFonts - 1)
    For Each strFont In FontNames
    CurFontNum = CurFontNum + 1
    Selection.HomeKey Unit:=wdStory
    With Selection.Find
    .Forward = True
    .ClearFormatting
    .Font.Name = strFont
    .Wrap = wdFindContinue
    .Execute FindText:=""
    If .Found Then
    NumFontsFound = NumFontsFound + 1
    aFonts(NumFontsFound - 1) = strFont
    End If
    End With
    Next strFont
    ReDim aFontsPS(NumFontsFound - 1, 1)
    For i = 0 To NumFontsFound - 1
    Selection.HomeKey Unit:=wdStory
    With Selection.Find
    .Forward = True
    .ClearFormatting
    .Font.Name = aFonts(i)
    .Wrap = wdFindContinue
    .Execute FindText:=""
    End With
    aFontsPS(i, 0) = aFonts(i)
    aFontsPS(i, 1) = Selection.Information(wdActiveEndPageNumber)
    Next i
    ReDim aFonts(0) 'free up mem
    WordBasic.SortArray aFontsPS()
    strMessage = "Fonts Found at..." & vbCr & vbCr
    For i = 0 To NumFontsFound - 1
    strMessage = strMessage & aFontsPS(i, 0) & " on page " & aFontsPS(i, 1) & vbCr
    Next i
    MsgBox strMessage, vbOKOnly, "Fonts Used in Document"
    End Sub</pre>

    Let me know if this does the job for you.
    Andrew Lockton, Chrysalis Design, Melbourne Australia

  7. #7
    Bronze Lounger
    Join Date
    Nov 2001
    Location
    Arlington, Virginia, USA
    Posts
    1,394
    Thanks
    0
    Thanked 3 Times in 3 Posts

    Re: Listing fonts in document (2003)

    If interested here is another example of code to enumerate fonts in active document. This is similar to previous example posted only the sub loops thru each StoryRange in active doc to find fonts (you mention text boxes, which are a different "StoryType" than main body of doc):

    Public Sub EnumerateFonts()
    On Error GoTo Err_Handler

    Dim rng As Range
    Dim intStoryCount As Integer
    Dim intIndex() As Integer
    Dim i As Integer
    Dim lngFontCount As Long
    Dim sFontList() As String
    Dim n As Long
    Dim lngFound As Long
    Dim strMsg As String

    Application.ScreenUpdating = False

    ' Determine what StoryRanges exist in active doc:
    intStoryCount = ActiveDocument.StoryRanges.Count
    ReDim intIndex(1 To intStoryCount)
    For Each rng In ActiveDocument.StoryRanges
    i = i + 1
    intIndex(i) = rng.StoryType
    Next rng

    ' Count system fonts:
    lngFontCount = Application.FontNames.Count
    ReDim sFontList(1 To 2, 1 To lngFontCount)

    For n = 1 To lngFontCount
    For i = 1 To intStoryCount
    Set rng = ActiveDocument.StoryRanges(intIndex(i))
    With rng.Find
    .ClearFormatting
    .Text = ""
    .Forward = True
    .Wrap = wdFindContinue
    .Font.Name = Application.FontNames(n)
    .Execute
    End With

    If rng.Find.Found = True Then
    ' Save font name, exit inner loop - _
    no need to test other StoryRanges:
    lngFound = lngFound + 1
    sFontList(1, lngFound) = Application.FontNames(n)
    sFontList(2, lngFound) = GetStoryType(rng.StoryType)
    Set rng = Nothing
    Exit For
    End If
    Next i
    Next n

    ' Print results:
    Debug.Print "Document Name: " & ActiveDocument.Name
    Debug.Print "Location: " & ActiveDocument.Path
    Debug.Print "Font List:"

    ReDim Preserve sFontList(1 To 2, 1 To lngFound)
    For n = 1 To lngFound
    Debug.Print n & " " & sFontList(1, n) & " (" & sFontList(2, n) & ")"
    Next n

    Erase sFontList
    Erase intIndex
    Exit_Sub:
    Application.ScreenUpdating = True
    Set rng = Nothing
    Exit Sub
    Err_Handler:
    strMsg = "Error No " & Err.Number & ": " & Err.Description
    Beep
    MsgBox strMsg, vbExclamation, "ENUMERATE FONTS ERROR MSG"
    Resume Exit_Sub
    End Sub

    Function that looks up StoryType based on Range/Selection StoryType property:

    Public Function GetStoryType(ByRef intStoryType As Integer) As String
    ' based on WdStoryType Enum:
    Select Case intStoryType
    Case 1: GetStoryType = "Main Text"
    Case 2: GetStoryType = "Footnotes"
    Case 3: GetStoryType = "Endnotes"
    Case 4: GetStoryType = "Comments"
    Case 5: GetStoryType = "Text Frame"
    Case 6: GetStoryType = "Even Pages Header"
    Case 7: GetStoryType = "Primary Header"
    Case 8: GetStoryType = "Even Pages Footer"
    Case 9: GetStoryType = "Primary Footer"
    Case 10: GetStoryType = "First Page Header"
    Case 11: GetStoryType = "First Page Footer"
    End Select
    End Function

    Sample output:

    Document Name: Fonts.doc
    Location: C:Access
    Font List:
    1 Times New Roman (Main Text)
    2 Arial (Main Text)
    3 Courier New (Main Text)
    4 Wingdings (Main Text)
    5 Tahoma (Primary Footer)
    6 Comic Sans MS (Main Text)
    7 Impact (Primary Header)
    8 MS Outlook (Text Frame)
    9 Century Gothic (Main Text)

    Note that some fonts listed were not found in main body of the document, but in header, footer, or textbox, each of which is a different "StoryType". If there are more than a one or two StoryTypes in active doc sub may take several seconds to loop thru all of them.

    HTH

  8. #8
    New Lounger
    Join Date
    Jun 2001
    Location
    Oregon, USA
    Posts
    19
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Listing fonts in document (2003)

    Andrew, thanks so much for the macro. I had to take out the line you mentioned to make it work. It doesn't look like it searches the text boxes for fonts. Is there a way to have it do that?

  9. #9
    5 Star Lounger
    Join Date
    May 2001
    Location
    Stuttgart, Baden-W, Germany
    Posts
    931
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Listing fonts in document (2003)

    For a quick and dirty method to find the fonts used, you can open the document with the file type filter set to "Recover text from any file (*.*)".

    You'll see the fonts used listed somewhere, probably close to the bottom. I don't know how reliable this is... The list seems to contain some fonts that aren't actually used (at least not any longer).
    Take care to close the file without saving it! IIRC, in Word2000 the file type setting also is sticky, so you'll have to change it back the next time you open a document.

    <img src=/S/cheers.gif border=0 alt=cheers width=30 height=16> Klaus

  10. #10
    2 Star Lounger
    Join Date
    Jan 2004
    Location
    Mount Prospect, Illinois
    Posts
    142
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Listing fonts in document (2003)

    I hate to be a spoilsport on this topic (especially several months later), but I'm concerned about docs that come from a machine other than my own, and might have *their* fonts somewhere in the doc. Since this routine starts by getting the list of the fonts on *my* system, it can't know about any xenofonts, which are most likely to be the troublemakers.

    Unfortunately, I can't think of any method other than examining every character that can detect this.

    For that matter, select some text, press ctrl-shift-F and type "Mumblemumble"
    You'll now have text in a font called "Mumblemumble" and the macro does not detect it at all.

  11. #11
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Listing fonts in document (2003)

    We recently had a thread on detecting the Chinese language characters in a document that, although not directly relevant, offered a variety of methods to speed up the process of examining all the characters in a document. (The method I suggested is not relevant at all to the styles problem.)

  12. #12
    2 Star Lounger
    Join Date
    Jan 2004
    Location
    Mount Prospect, Illinois
    Posts
    142
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Listing fonts in document (2003)

    Thanks -- that did help. First off, if you do need to scan every char, you can make some major performance gains by doing "For Each pgh in activedocument.storyrange(x)" and checking pgh.range.font.name. If it's blank, you've got more than one font. If it isn't, add it to your collected list of fonts.

    In the PDF world, the list of fonts would be stored in a "resources" object in the doc. Too bad MS doesn't expose something like that -- it's probably somewhere in the internals.

  13. #13
    3 Star Lounger
    Join Date
    Apr 2004
    Location
    Boston, Massachusetts, USA
    Posts
    389
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Listing fonts in document (2003)

    Here's how to do it by scanning each character. It's a hack and a half, and it's s-l-o-w, but it'll catch fonts that aren't installed. This is by no means optimal, but may be a good starting point, and it checks text boxes:
    <pre>Sub ReportFonts()
    Dim char As Range
    Dim stry As Range
    Dim fname As String
    Dim v As Variant
    Dim l As Long
    Dim bExists As Boolean
    Dim vFonts() As Variant
    ReDim vFonts(1)
    For Each stry In ActiveDocument.StoryRanges
    For Each char In stry.Characters
    bExists = False
    fname = char.Font.Name
    For Each v In vFonts
    If v = fname Then
    bExists = True
    End If
    Next v
    If bExists = False Then
    l = UBound(vFonts)
    l = l + 1
    ReDim Preserve vFonts(l)
    vFonts(l) = fname
    End If
    bExists = False
    Next char
    Next stry

    MsgBox "Fonts used in this doucment are: " & vbCr & Join(vFonts, vbCr)
    End Sub
    </pre>


    In Word 2003, you can also just save as XML; all the fonts are listed in the XML, even if they're not installed on the system. A relatively simple XSLT stylesheet could report the font's used.

    HTH! <img src=/S/2cents.gif border=0 alt=2cents width=15 height=15>

  14. #14
    Super Moderator
    Join Date
    Jan 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    3,852
    Thanks
    4
    Thanked 259 Times in 239 Posts

    Re: Listing fonts in document (2003)

    Good point. Perhaps the earlier macros could be modified to first of all highlight all the text and then do searches for each typeface loaded and remove the highlights. Once that is completed, any highlighted text would be in a non-system typeface and another search on highlighted text would reveal the outstanding typefaces.
    Andrew Lockton, Chrysalis Design, Melbourne Australia

  15. #15
    2 Star Lounger
    Join Date
    Jan 2004
    Location
    Mount Prospect, Illinois
    Posts
    142
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Listing fonts in document (2003)

    That's a very interesting idea. I'll bounce it off the clients I have. The only objections I can see is that it modifies the doc in the process, and that existing highlighting would be lost. Probably if I just make sure the doc is saved at start, and re-load upon completion, it'll be good enough.

    Then again, the highlighting might be exactly what the clients want for ID'ing doc problems!

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •