How can I use fonts othern than TrueType and OpenType fonts in Windows Forms

The font boxes in all control properties do not show any of installed non TT or OT fonts in the system, in addition I cannot figure out how to programmatically create a System.Drawing.Font instance representing such a font. I need to do this in a System.Windows.RichTextBox control, the interesting things is that I can copy and paste text from word in the desired font and it would show correctly in the Rtf property of the control. I would really appreciate any help on this.

Thanks,

Karim



Answer this question

How can I use fonts othern than TrueType and OpenType fonts in Windows Forms

  • eshashishekhar

    Thank you very much for your reply. It is not too difficult to change the underline RTF. I really don't care about how the font displays in the RTB because I will later export it Quark Express for publishing (hence the use of some fonts that are only available as device fonts - Stone PhoneticIPA in this case-). But since the only way to write RTF in .NET is to use an RTB it would have been nice to do it through the RTB, instead I will have to write my own abstraction on top of the RTB in order to solve this and other limitations such as subscript and superscript that are not understood by .NET
  • Ledeni_Plamen

    The RTB supports sub/superscript. Use the SelectionCharOffset property.


  • qkhader

    Yes, GDI+ does not support non-scalable fonts. This is a built-in design constraint due to GDI+'s resolution independent design. RTB is however an ancient control, designed back in the days when device fonts where still alive and well. You can get it to display a device font with the "right" incantations of RTF. Since the SelectionFont property uses the GDI+ font type, you can't do it easily other than trying to come up with the obtuse RTF...


  • How can I use fonts othern than TrueType and OpenType fonts in Windows Forms