Set Text Height

AutoCAD ActiveX

 
Set Text Height
 
 
 

Text height determines the size in drawing units of the letters in the font you are using. The value usually represents the size of the uppercase letters, with the exception of TrueType fonts.

For TrueType fonts, the value specified for text height might not represent the height of uppercase letters. The height specified represents the height of a capital letter plus an accent area reserved for accent marks and other marks used in non-English languages. The relative portion of areas assigned to capital letters and accent characters is determined by the font designer at the time the font is designed, and, consequently, will vary from font to font.

In addition to the height of a capital letter and the ascent area that make up the height specified by the user, TrueType fonts have a descent area for portions of characters that extend below the text insertion line. Examples of such characters are y, j, p, g, and q.

You specify the text height using the Height property. This property accepts positive numbers only.

Change the height of a Text object

This example creates a line of text and then changes the height of the text.

Sub Ch4_ChangeTextHeight()
    Dim textObj As AcadText
    Dim textString As String
    Dim insertionPoint(0 To 2) As Double
    Dim height As Double
      
    ' Define the text object
    textString = "Hello, World."
    insertionPoint(0) = 3
    insertionPoint(1) = 3
    insertionPoint(2) = 0
    height = 0.5
      
    ' Create the text object in model space
    Set textObj = ThisDrawing.ModelSpace. _
 AddText(textString, insertionPoint, height)
      
    ' Change the value of the Height to 1
    textObj.height = 1
    textObj.Update
End Sub