Valued Mentor
411 Posts
28 Kudos
Registered: ‎01-27-2010
Post 1 of 1

how to Create a System..... from Autodesk.AutoCAD....FontDescriptor

139 Views, 0 Replies
03-09-2012 05:24 AM

Sujet :

how to Create a System.drawing.font from  Autodesk.AutoCAD.GraphicsInterface.FontDescriptor



hi i can get a pathname of font from a FontDialog.

i put this information  :


Dim fontDialog1 As New System.Windows.Forms.FontDialog
With fontDialog1
If IsNothing(StyleEncours) = False Then
'remplissage dialog avant display
.Font = New System.Drawing.Font(StyleEncours.Font, 10)
End If

If fontDialog1.ShowDialog() <> System.Windows.Forms.DialogResult.Cancel Then
'création dun style acad tmp pour récup du path de la font
Dim str As TextStyleTableRecord = New TextStyleTableRecord()
str.Name = "ee"
str.Font = New Autodesk.AutoCAD.GraphicsInterface.FontDescriptor(.Font.Name, .Font.Bold, .Font.Italic, Nothing, Nothing)

Dim Path As String = str.FileName
str = Nothing
If Path = "" Then
MsgBox("Désolé cette font n'est pas reconnu par Autocad" & vbCrLf & _
"Font inutilisable, veuillez en choissir une autre", _
MsgBoxStyle.Information, "Information utilisateur")

 this partial code use "StyleEncours" for populate befo show the fontdialog.

"StyleEncours" contain the path of the font. ie : "c:\windows\fonts\arialb.ttf"


so if this var is not nothing i need to populate the font dialog with a font of windows but i can retrieve the correct name of the font.


this part not working :

.Font = New System.Drawing.Font(StyleEncours.Font, 10)

i thing i need to retrieve the name of font  for do this :

.Font = New System.Drawing.Font("ArialB", 10)



Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Are you interested in helping shape the future of the Autodesk Community? To participate in this brief usability study, please click here. Your time and input is greatly appreciated!