Results 1 to 8 of 8

Thread: Creating a text style with a bold true type font

  1. #1
    AUGI Addict jpaulsen's Avatar
    Join Date
    2002-04
    Location
    Colorado
    Posts
    2,020
    Login to Give a bone
    0

    Default Creating a text style with a bold true type font

    How can I create a text style using a true type font and set the new style to bold? I can create the style using command but there is no option to set it to bold.
    Code:
     
    (command "-style" "Tahoma Bold" "tahoma" "0.120" "" "" "" "")

  2. #2
    I could stop if I wanted to
    Join Date
    2003-11
    Posts
    277
    Login to Give a bone
    0

    Default Re: Creating a text style with a bold true type font

    try this model
    Code:
    (setq tex "Tahoma Bold")
    (if
      (null (tblsearch "style" tex))
      (command "_style" tex tex "0" "1" "0" "N" "N" "N")
      ) ; if
    Quote Originally Posted by jpaulsen View Post
    How can I create a text style using a true type font and set the new style to bold? I can create the style using command but there is no option to set it to bold.
    Code:
     
    (command "-style" "Tahoma Bold" "tahoma" "0.120" "" "" "" "")

  3. #3
    AUGI Addict jpaulsen's Avatar
    Join Date
    2002-04
    Location
    Colorado
    Posts
    2,020
    Login to Give a bone
    0

    Default Re: Creating a text style with a bold true type font

    That worked but I don't understand why. I have two questions.

    Why does _style open a dialog when I type it at the command line but seems to be command line driven when executed in the lisp routine?

    How does the lisp routine change the style to Bold? If you look at the prompts on the command line (see below) they are the exact same prompts that I get using -style; there is no prompt for bold.

    Command: tex
    _style Enter name of text style or [?] <Standard>: Tahoma Bold
    New style.
    Specify full font name or font filename (TTF or SHX) <txt>: Tahoma Bold Specify
    height of text or [Annotative] <0.0000>: 0 Specify width factor <1.0000>: 1
    Specify obliquing angle <0>: 0 Display text backwards? [Yes/No] <No>: N Display
    text upside-down? [Yes/No] <No>: N
    "Tahoma Bold" is now the current text style.
    Command: N Unknown command "N". Press F1 for help.
    Command: nil

    There was an extra "N" in the code becuse the font I am using cannot be vertical. I removed it after running it.

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

    Default Re: Creating a text style with a bold true type font

    Quote Originally Posted by jpaulsen View Post
    How can I create a text style using a true type font and set the new style to bold? I can create the style using command but there is no option to set it to bold.
    Code:
     
    (command "-style" "Tahoma Bold" "tahoma" "0.120" "" "" "" "")
    You could also do something like this:

    Code:
    
    (entmake
      (list
        (cons 0 "STYLE")
        (cons 100 "AcDbSymbolTableRecord")
        (cons 100 "AcDbTextStyleTableRecord")
        (cons 2 "Tahoma Bold")
        (cons 3 "TahomaBD.ttf")
        (cons 40 0.12)
        (cons 70 0)
      )
    )
    
    R.K. McSwain | CAD Panacea |

  5. #5
    AUGI Addict jpaulsen's Avatar
    Join Date
    2002-04
    Location
    Colorado
    Posts
    2,020
    Login to Give a bone
    0

    Default Re: Creating a text style with a bold true type font

    Thanks for the responses. I finally got back to looking at this (lisp is usually at the bottom of the priority list). I answered one of my own questions.
    Quote Originally Posted by jpaulsen View Post
    How does the lisp routine change the style to Bold? If you look at the prompts on the command line (see below) they are the exact same prompts that I get using -style; there is no prompt for bold.
    When specifying the font I had to specify "Tahoma Bold" not just "Tahoma". So with that change my original code worked.
    Code:
     
    (command "-style" "Tahoma Bold" "tahoma bold" "0.120" "" "" "" "")

  6. #6
    Member
    Join Date
    2008-06
    Posts
    4
    Login to Give a bone
    0

    Default Re: Creating a text style with a bold true type font

    Quote Originally Posted by jpaulsen View Post
    Thanks for the responses. I finally got back to looking at this (lisp is usually at the bottom of the priority list). I answered one of my own questions.

    When specifying the font I had to specify "Tahoma Bold" not just "Tahoma". So with that change my original code worked.
    Code:
     
    (command "-style" "Tahoma Bold" "tahoma bold" "0.120" "" "" "" "")
    This still doesn't answer your original question which I also need an answer to. You're just creating a text style called "Tahoma Bold" and telling it to use the "Tahoma Bold" font. You are not actually toggling the "bold" option for font style. I believe this is a glaring Autodesk omission.

    I can't find a way to programatically access the "font style" options. What's up with this? What if I want to use "Font.ttf" that doesn't have a sister "Font Bold.ttf" like Tahoma does? How on earth am I supposed to tell the "Font.ttf" to use the "bold" font style setting? This setting never appears on the command line. Is there a hidden setting that I can pass through a lisp routine? Has anyone in the entire history of AutoCAD ever tried creating "bold" text styles. There has got to be a way around this, or are we supposed to use the dialog to change that one setting?

  7. #7
    I could stop if I wanted to msretenovic's Avatar
    Join Date
    2002-02
    Location
    Galloway, Oh
    Posts
    305
    Login to Give a bone
    0

    Default Re: Creating a text style with a bold true type font

    Take a look at the SetFont method (vla-SetFont) in the help files. The second input is a flag to set a font to bold. The third is a flag to set a font to italic.

  8. #8
    AUGI Addict jpaulsen's Avatar
    Join Date
    2002-04
    Location
    Colorado
    Posts
    2,020
    Login to Give a bone
    0

    Default Re: Creating a text style with a bold true type font

    Michael's suggestion may help you but the command string above works just fine. There is no font called Tahoma Bold. The command string creates a style with the Tahoma font with bold enabled. It does exactly what I wanted it to do.
    Attached Images Attached Images

Similar Threads

  1. Replies: 2
    Last Post: 2009-07-15, 07:07 PM
  2. True Type Font?
    By tiffany.amorgan in forum AutoCAD General
    Replies: 2
    Last Post: 2008-10-11, 09:30 PM
  3. Converting SHX Font to True Type Font
    By dortega4269 in forum Revit Structure - General
    Replies: 1
    Last Post: 2006-09-01, 05:19 PM
  4. Bold type font does not print out bold
    By msanders.85217 in forum AutoCAD General
    Replies: 6
    Last Post: 2005-07-07, 04:21 PM
  5. Updated to new font - Some text shows as Regular, some as Bold
    By rick.rivera in forum AutoCAD General
    Replies: 1
    Last Post: 2005-06-28, 03:17 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
  •