Answered by:
Fonts don't work!

Question
-
I begun working on a simple text editor around an extended richtextbox control, trying to improve the existing example from this page: http://www.codeproject.com/KB/vb/Wor...ick&fr=1#xx0xx, when i realised that the FontDialog doesn't work properly. Most of the fonts don't work. It just slips back into the default textbox font defined in the properties, or to the previous font. This is the code that opens the FontDialog box:
Private Sub SelectFontToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SelectFontToolStripMenuItem.Click
If Not rtbDoc.SelectionFont Is Nothing Then
FontDialog1.Font = rtbDoc.SelectionFont
Else
FontDialog1.Font = Nothing
End If
FontDialog1.ShowApply = True
If FontDialog1.ShowDialog() = Windows.Forms.DialogResult.OK Then
rtbDoc.SelectionFont = FontDialog1.Font
End If
End Sub
Font Broadway for example doesn't work, arial works, arial black works, batang works, bell mt doesn't work. I don't see the pattern.Tuesday, November 11, 2008 7:50 PM
Answers
-
Thanks Matt for pointing me in the right direction. I missed to check if the font works in Wordpad, because I was 100% percent sure that it would be working. I was wrong. These fonts don't work in Wordpad either. So now it's clear. Something is wrong with the fonts themselves. I tried Broadway which is open type font and it doesn't work, but other font Broadway BT works but it's true type font. On the other hand, some open type fonts do work like for example Candara. If these fonts aren't installed, why the heck do they appear in the Font Comboboxes in the first place? And how can they be in the Fonts folder and not installed, but in spite of that appear in the Font Comboboxes? Now I'm at least breathing easier, because I now know that the richtextbox and visual studio installation aren't the culprits. But what is wrong with the fonts then?
- Proposed as answer by konikula Wednesday, November 12, 2008 9:53 PM
- Marked as answer by Xingwei Hu Monday, November 17, 2008 5:40 AM
Wednesday, November 12, 2008 5:55 PM -
I hope you will like it. It is one of three only things I love from Microsoft completely: qBasic, Consolas, DOS ... :) but also only thing which I stayed devoted ... just because 720Kb in DOS does not suffice to my previous plans in qBasic I had to moved to windows ... just because qBasic is stopped, and VB is object, I stoped my qBasic evolution ... and as Consolas fulfilled what I would wish from programming font, I started to believe that VB is REALLY continue of qb ... but still, that funky blue & gray ASCII is doing me sentimental... so that I sometimes do qBasic, and also I have bought dead notebook just for DOS :) ... also BAT files I am missing ... bleagh. sentimental speech ... I simply take consolas as part of dreaming of programming :)
- Marked as answer by Xingwei Hu Monday, November 17, 2008 5:40 AM
Wednesday, November 12, 2008 6:35 PM
All replies
-
What makes you think the problem is with the FontDialog control?
Try putting a label on a form and testing it and see if you get the results expected by using the FontDialog to set the font of the label.
Stephen J WhiteleyTuesday, November 11, 2008 8:41 PMModerator -
The first thing I would do is check your fonts directory and make sure those fonts are installed. Are they true type fonts? Can you use them in Wordpad?Tuesday, November 11, 2008 8:56 PM
-
I did as you said, and it worked with a label. Than the problem must be originating from the extended richtextbox class namely provided by Microsoft according to the author of the article. You can download the project code if you want and try it yourself.Tuesday, November 11, 2008 8:58 PM
-
they are installed. i tried to find the pattern, but i dont see it. some fonts which dont work are true type, and some are open type.Tuesday, November 11, 2008 9:00 PM
-
It will be somehow caused by ExtendedRTB class. I would guess it is based on RichTextBox provided ..., not provided by Microsoft, anyway. You can try to debug it yourself, as codes on CP are open.Wednesday, November 12, 2008 8:43 AM
-
I tried to create the same project with ordinary RichTextbox from the toolbox, but surprise, surprise, same thing. It's not working! Could it be somehow bad installed Visual Studio? Or what else could it be? I compiled the application and started it on another computer, and it's the same. Some fonts are OK, many are not.
Wednesday, November 12, 2008 11:47 AM -
You should check out suggestion of user A10677 of wordpad first.
Regards, Matt
- Proposed as answer by konikula Monday, November 17, 2008 5:28 AM
Wednesday, November 12, 2008 12:03 PM -
What code are you using to test the failure? You should just have a RTB and a button to select a font. If you are using the downloaded code, then there's probably a bug in it that you'll have to solve. Put it this way: post the smallest amount of code which replicates your error.
Stephen J WhiteleyWednesday, November 12, 2008 3:47 PMModerator -
Thanks Matt for pointing me in the right direction. I missed to check if the font works in Wordpad, because I was 100% percent sure that it would be working. I was wrong. These fonts don't work in Wordpad either. So now it's clear. Something is wrong with the fonts themselves. I tried Broadway which is open type font and it doesn't work, but other font Broadway BT works but it's true type font. On the other hand, some open type fonts do work like for example Candara. If these fonts aren't installed, why the heck do they appear in the Font Comboboxes in the first place? And how can they be in the Fonts folder and not installed, but in spite of that appear in the Font Comboboxes? Now I'm at least breathing easier, because I now know that the richtextbox and visual studio installation aren't the culprits. But what is wrong with the fonts then?
- Proposed as answer by konikula Wednesday, November 12, 2008 9:53 PM
- Marked as answer by Xingwei Hu Monday, November 17, 2008 5:40 AM
Wednesday, November 12, 2008 5:55 PM -
As I already replied to Matt, now it's clear that someting is wrong with fonts and not with the extendedrichtextbox, because exactly the same fonts aren't working in wordpad either.Wednesday, November 12, 2008 6:00 PM
-
:) bit offtopic: do you know Consolas? If not just replace your VB Font with it... that's most beautiful font for coding I know (though San Serif is possibly better for HUGS & gVim)Wednesday, November 12, 2008 6:03 PM
-
I missed yesterday to check if the fonts work in wordpad as you suggested. I tried today and they don't work in wordpad either. Then it must the fonts?Wednesday, November 12, 2008 6:03 PM
-
I am sure that it is somehow problem of fonts ... but why, god knows. Possibly they are improperly or incompatibly compiled? Just lookup some font editor and compiler... but here I am really talking about direction of wind in Chicago tomorrow :)Wednesday, November 12, 2008 6:06 PM
-
I'm going to give it a try with Consolas.Wednesday, November 12, 2008 6:12 PM
-
I hope you will like it. It is one of three only things I love from Microsoft completely: qBasic, Consolas, DOS ... :) but also only thing which I stayed devoted ... just because 720Kb in DOS does not suffice to my previous plans in qBasic I had to moved to windows ... just because qBasic is stopped, and VB is object, I stoped my qBasic evolution ... and as Consolas fulfilled what I would wish from programming font, I started to believe that VB is REALLY continue of qb ... but still, that funky blue & gray ASCII is doing me sentimental... so that I sometimes do qBasic, and also I have bought dead notebook just for DOS :) ... also BAT files I am missing ... bleagh. sentimental speech ... I simply take consolas as part of dreaming of programming :)
- Marked as answer by Xingwei Hu Monday, November 17, 2008 5:40 AM
Wednesday, November 12, 2008 6:35 PM -
Thanks mr. Xingwei, I appreciate your interest. Also I take it as usefull/important navigation to my thinking about inline quick basic, so I am going to have a lot of to rethink about it. What remains unclear is problem rising from large vb context help vs quick basic's slim keyword index, and Jynx RD's classes / variables learn discrepancy.
Best regards, Matiei :)[]
This contributor is MSDN testing bot, using BabelFish translator, passive NN "Thread integrator" and Google's VBCContextSearch api to resolve your threads, if you want to improve it, just react to its posts. Your MSDN team :)Wednesday, November 19, 2008 11:23 PM