Why is my program's font changes when opened in another device/computer? Here is a of what the effect is when opened to another device and what it should look like originally. The left side is what it looks like when opened in another device and the right side is what it should be. Any help is very much appreciated. The color changes everytime and is controlled with a timer, if you're wondering.
Asked
Active
Viewed 1,729 times
1
-
Belongs the selected font to a TrueType Fonts? – Leo Chapiro Nov 02 '16 at 12:56
-
@duDE I believe the font that I was using in this program was "Monotype Corsiva". – Keanu Lorenzo Nov 02 '16 at 13:25
-
1Well, this is a less common font and you have installed it on your developer system. Now you are going with your program to another system - the font is missing here. So either you take a common True Type font (better choice) or you install this "Monotype Corsiva" on the target system. – Leo Chapiro Nov 02 '16 at 13:28
-
@duDE I really like this font in that particular program. So my choice is to install the font to the target system. How do I do it? – Keanu Lorenzo Nov 02 '16 at 13:38
-
1Take a look at a link that @Reza Aghael already posted: http://stackoverflow.com/questions/727053/how-do-i-embed-a-font-with-my-c-sharp-application-using-visual-studio-2005 . So you can embed the font into your application. – Leo Chapiro Nov 02 '16 at 13:43
1 Answers
2
If the assigned font doesn't exits on the target system it uses the default font family to render the string.
Also you don't assign Font
to a form explicitly, it uses DefaultFont
which returns SystemFonts.DefaultFont
which depends to system settings and may be different in different systems. If you need to have similar font in all systems, assign a font to Font
propery of your form explicitly.
You can embed the font into your application. Also if your application comes with an installer you can deploy the font on target machine. For example add a font to your project and set its Copy To Output Directory
to Copy Always
, then you can use the font this way:
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Dim fontCollection = New PrivateFontCollection()
fontCollection.AddFontFile(Path.Combine(Application.StartupPath, "MyFont.ttf"))
Dim font = New Font(fontCollection.Families(0), 12)
Me.Font = font
End Sub

Community
- 1
- 1

Reza Aghaei
- 120,393
- 18
- 203
- 398
-
The link you've attached is in C# i guess... And I don't really know C# 100% to translate it to VB. Help – Keanu Lorenzo Nov 02 '16 at 13:26
-
1
-
-
1If the font file in in your resources, the most simple option is to save that resource file in application path at run-time and use it the same way as I used. To see how you can save a resource into your application path, see [this post](http://stackoverflow.com/a/34680615/3110834) for example. – Reza Aghaei Nov 02 '16 at 13:57
-