0

This question helped me learn how to embed fonts in my VB 2010 application -> How to embed fonts for Use in a Visual Basic Project?

There is no UseCompatibleTextRendering property, however, for a ComboBox or a TextBox.

Is it possible to use an embedded font for a ComboBox or a TextBox?

Community
  • 1
  • 1
BigBobby
  • 423
  • 1
  • 3
  • 17

1 Answers1

1

While I was not able to use Fonts embedded as resources for a ComboBox and a TextBox, I was able to use fonts installed in the same directory as my application.

When I added the fonts (installed in the directory of my application by the installer) using this code, the UseCompatibleTextRendering property did not seem to matter:

    If _pfc Is Nothing Then
        _pfc = New PrivateFontCollection
    End If

    For Each fontfile As String In System.IO.Directory.GetFiles(filepath & "\Fonts", "*.ttf")
        _pfc.AddFontFile(fontfile)
    Next fontfile
BigBobby
  • 423
  • 1
  • 3
  • 17
  • I can confirm this is true (using C#). Have you been able to find a way to make it work with TextBox, RichTextBox, Combobox, Listbox, etc yet ? I have a difficult time believing the only way to use a custom font is to distribute the file (which could break certain font license agreements) – Kraang Prime Oct 14 '15 at 01:29
  • Sadly, I haven't. In my case I was allowed to distribute the fonts, but I can understand how that wouldn't always be the case. I tried the other solutions in this question but couldn't get them to work -> http://stackoverflow.com/questions/15042199/embed-custom-font-fot-text-box-use-in-visual-basic-2010 – BigBobby Oct 15 '15 at 20:04
  • I figured out a solution that works, and will be posting it as an answer to my other question here >> http://stackoverflow.com/questions/33115880/how-to-render-a-font-from-privatefontcollection-memory-to-editable-controls – Kraang Prime Oct 16 '15 at 11:31
  • Here is the working solution to this problem (in C# but easily converted to Visual Basic if you require) . http://stackoverflow.com/a/33171089/3504007 – Kraang Prime Oct 16 '15 at 12:58