Community
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.Dispose()
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")
Else
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)
thx