I've downloaded several custom fonts. When the user presses a button I want the font of the text in a rich-textbox to change. But the fonts themselves don't change but the font size does. I also don't get any errors.
I've looked at a lot of related questions on this forum and elsewhere but none of them worked. I would like to use custom fonts that the user doesn't have to install. I've also put the fonts in the resources using Resources.resx and set them to public.
This is what I've tried so far:
PrivateFontCollection pfc = new PrivateFontCollection();
pfc.AddFontFile(@"C:\\Users\\MyName\\Documents\\Font\\6937\\HARRYP.ttf");
System.Drawing.Font font = new Font(pfc.Families[0], 12);
richTextBox_Translate.Font = font;
And any permutation of this:
richTextBox_Translate.Font = new Font(@"C:\\Users\\Myname\\Documents\\Font\\6937\\HARRY P", 12);
richTextBox_Translate.Font = new Font(@".\\Resources\\HARRY P", 12);
richTextBox_Translate.Font = new Font("HARRY P", 12);
The font does change when I use a standard font:
richTextBox_Translate.Font = new Font("Comic Sans MS", 12);
I've tried it with several different custom fonts which where made by different people so I don't think it's because of the fonts.
Sorry if this is a stupid or easily solved question but I just can't get it to work.
Update: When I install the font on my PC the font works perfectly. I can then also use it as the default font using the VS properties editor and can assign the font using both the codes above. But when I de-install the font it stops working again. It seems as if VS doesn't recognize the font even when using a direct directory link and just skips over/ignores the font part and just adjusts the size of the normal font.