Grasshopper

algorithmic modeling for Rhino

How to retrieve/enumerate system fonts in order to bake text with a font face chosen from a list...

Hello everybody!

A few days ago, I have submitted a small couple of VB components intended to display and bake some text to the Rhino document, in planes parallel  to the active Rhino display.
I am currently trying to improve that crappy draft and I am looking forward using a font list in order to choose the one I want to display.

MSDN provides :

http://msdn.microsoft.com/en-us/library/system.windows.media.fonts....

where System.Windows.Media..::.Fonts is described as a good place to start with.

Unfortunately, I cannot find : "System.Windows.Media" namespace under the VB component code "Imports", so it doesn't appear in the auto completion...

Does anyone knows how to add a Windows namespace to my VB component ?

Thanks for your help!

Views: 375

Replies to This Discussion

If you look closely at the top of that page, that namespace is meant as a resource for .Net 4.0 and there doesn't seam to be a 2.0 equivalent. I'm not sure if it was moved to that new namespace, or there's just multiple ways to access it, but you can get to all the installed fonts through the System.Drawing namespace. Here's some quick code that retrieves the names of all the installed fonts on your system.

Dim FontNameList As New List(Of String)
Dim FontFams() As FontFamily = FontFamily.Families

For i As Integer = 0 To FontFams.GetUpperBound(0)
FontNameList.Add(FontFams(i).Name)
Next

A = FontNameList
Very kind of you, Damian.
It's exactly what I need!

Thanks a lot!

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service