Results 1 to 7 of 7

Thread: I want to change the font in my text styles

  1. #1
    100 Club sgroff's Avatar
    Join Date
    2006-07
    Location
    The Group "W" Bench
    Posts
    107
    Login to Give a bone
    0

    Default hmm

    Description:
    I have multiple text styles in a drawing ( i dont know all the names) and i want to change the font for each style to arial.ttf

    How Used:
    I need it to discover all the styles in a drawing then go through and change the font for each style to arial.ttf


    Feature Affinity: text styles

    --thanks a million for any help
    Last edited by sgroff; 2006-09-11 at 06:24 PM.

  2. #2
    Administrator rkmcswain's Avatar
    Join Date
    2004-09
    Location
    Earth
    Posts
    9,805
    Login to Give a bone
    0

    Default Re: I want to change the font in my text styles

    Like this?

    Code:
    Sub foo()
    Dim oTextStyle As AcadTextStyle
    For Each oTextStyle In ThisDrawing.TextStyles
        oTextStyle.fontFile = "c:\windows\fonts\arial.ttf"
    Next oTextStyle
    End Sub
    R.K. McSwain | CAD Panacea |

  3. #3
    100 Club sgroff's Avatar
    Join Date
    2006-07
    Location
    The Group "W" Bench
    Posts
    107
    Login to Give a bone
    0

    Default Re: I want to change the font in my text styles

    Quote Originally Posted by rkmcswain
    Like this?

    Code:
    Sub foo()
    Dim oTextStyle As AcadTextStyle
    For Each oTextStyle In ThisDrawing.TextStyles
        oTextStyle.fontFile = "c:\windows\fonts\arial.ttf"
    Next oTextStyle
    End Sub
    thats excellent. exactly what i needed
    thank you

  4. #4
    100 Club sgroff's Avatar
    Join Date
    2006-07
    Location
    The Group "W" Bench
    Posts
    107
    Login to Give a bone
    0

    Default Re: I want to change the font in my text styles

    thanks again for the help. I just noticed though, the we have a style called Arial Bold, and this program turned off the "Bold" I need to get it back on.. I'm wondering if this program can be modified so that it ignores the Arial Bold textstyle or at least sets the font back to bold.
    Last edited by sgroff; 2006-09-11 at 06:25 PM.

  5. #5
    All AUGI, all the time
    Join Date
    2015-12
    Location
    Central Oregon
    Posts
    591
    Login to Give a bone
    0

    Default Re: I want to change the font in my text styles

    Maybe like so?
    Code:
    For Each oTextStyle In ThisDrawing.TextStyles
        If Not UCase(oTextStyle.FontFile) Like "*ARIALBD.TTF" Then
            oTextStyle.fontFile = "c:\windows\fonts\arial.ttf"
        End If
    Next oTextStyle

  6. #6
    100 Club sgroff's Avatar
    Join Date
    2006-07
    Location
    The Group "W" Bench
    Posts
    107
    Login to Give a bone
    0

    Default Re: I want to change the font in my text styles

    Quote Originally Posted by miff
    Maybe like so?
    Code:
    For Each oTextStyle In ThisDrawing.TextStyles
        If Not UCase(oTextStyle.FontFile) Like "*ARIALBD.TTF" Then
            oTextStyle.fontFile = "c:\windows\fonts\arial.ttf"
        End If
    Next oTextStyle

    thanks, I'll try that..

  7. #7
    100 Club sgroff's Avatar
    Join Date
    2006-07
    Location
    The Group "W" Bench
    Posts
    107
    Login to Give a bone
    0

    Default Re: I want to change the font in my text styles

    heres my final result.. any suggestions or comments are welcome.



    Code:
    Sub Font2Arial()
    Dim oTextStyle As AcadTextStyle
    For Each oTextStyle In ThisDrawing.TextStyles
      oTextStyle.fontFile = "c:\windows\fonts\arial.ttf"
    If UCase(oTextStyle.Name) Like "*ARIAL BOLD" Then
            oTextStyle.fontFile = "c:\windows\fonts\arialbd.ttf"
    End If
    If UCase(oTextStyle.Name) Like "*TIMES" Then
            oTextStyle.fontFile = "c:\windows\fonts\arialbd.ttf"
    End If
    If UCase(oTextStyle.Name) Like "*BOLD" Then
            oTextStyle.fontFile = "c:\windows\fonts\arialbd.ttf"
    End If
     Next oTextStyle
    ThisDrawing.regen acAllViewports
    End Sub
    Last edited by sgroff; 2006-09-14 at 04:08 AM. Reason: [CODE] tags added

Similar Threads

  1. Replies: 4
    Last Post: 2013-01-31, 08:12 AM
  2. Routine to change font assigned to styles
    By jcgrer04 in forum AutoLISP
    Replies: 2
    Last Post: 2011-11-08, 12:29 AM
  3. Global Change all Text Styles to Romans font
    By f.tagle in forum AutoLISP
    Replies: 18
    Last Post: 2009-04-29, 05:04 AM
  4. Replies: 5
    Last Post: 2005-01-04, 07:19 PM

Posting Permissions

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