This project is read-only.
1

Closed

Font change not available

description

On the main options screen the font dropdown is empty meaning I cannot change the default font for comments.

The checkboxes also do nothing.


If there is at least a workaround for this that would be great.
I tried to find where the settings get saved as I was thinking I could manually change that but I could not manage to find it.

file attachments

Closed Sep 17, 2014 at 7:57 PM by gloder
Issue fixed in version 1.2.

comments

gloder wrote Sep 15, 2014 at 6:17 PM

I am sorry you are having this problem. Currently the settings are saved using a settings file. With an ordinary application a settings.settings file would become part of the configuration file of the application, so changing that file could change the default settings, but with a Visual Studio extension, that doesn't happen, so I am at a loss to know a workaround.

I think the thing to do would be for me to refactor the options pages to use Visual Studio's standard mechanism for saving settings to the registry. I had trouble getting that to works correctly before, so I decided to use a settings file as a workaround, but it seems that has even worse problems.

Now that I have a better understanding of the way the options pages work though I think I can go back to using the standard mechanism, and get that to work. I'll check to see if I can work that out soon, and let you know when it's finished, so you can re-install the new code. If it looks like more than two or three day's work, I'll let you know that too.

gloder wrote Sep 15, 2014 at 6:34 PM

BTW the check boxes on the Comments Settings page are informational only. They are supposed to tell you the characteristics of the selected font. Mainly I wanted display whether a font was fixed or proportionally pitched. The other check boxes were as easy to add, so I included them. As it happens almost all fonts have the same attributes, so you never seen much difference in the check boxes as you scroll through the fonts.

It's curious that the combo box on your screen is empty. The method I used to populate that control shouldn't behave differently from one Windows system to another, as far as I know, but I'll try to ferret that out too.

gloder wrote Sep 17, 2014 at 2:33 AM

I updated new source tonight that saves the Options pages changes to the registry now. I hope those changes will fix whatever was causing some of the issues you have described, but I can't be sure. I'll compile and upload the vsix tomorrow, but I want to test it more before I do that.

I'm still curious why the combo box was populated for you on the Comments Settings page. The only think I can think of is perhaps a problem with the graphics assemblies on your computer. The code uses a Graphics object for part of the processing. There isn't really anything special about it though that would cause the code to break only for some users.

Would you run a test for me with a console application to test this? I would provide the code for it, and you could execute it within the VS debugger. Perhaps we could see why the algorithm broke for you.

mayhem366 wrote Sep 17, 2014 at 8:58 AM

Yeah I am certainly up for running the console app to help out in diagnosing this issue.

I am looking forward to seeing the changes that have been made and appreciate the speed that you have looked into this.

I am very open to help you with whatever you need.

gloder wrote Sep 17, 2014 at 1:01 PM

Please unzip the attached file and compile the included solution. Run it in debug mode, and let me know what you see.

mayhem366 wrote Sep 17, 2014 at 1:33 PM

I get a couple of exceptions.

Here is the complete output:
  1                      Agency FB  True  True  True  True False
System.ArgumentException: Font 'Aharoni' does not support style 'Regular'.
   at System.Drawing.Font.CreateNativeFont()
   at System.Drawing.Font.Initialize(FontFamily family, Single emSize, FontStyle style, GraphicsUnit unit, Byte gdiCharSet, Boolean gdiVerticalFont)
   at System.Drawing.Font..ctor(FontFamily family, Single emSize)
   at GraphicFontTest.Program.CheckIfFixed(Graphics graphics, FontFamily FontFamily) in c:\GraphicFontTest_2014-09-17 06-52-36Z\GraphicFontTest\Program.cs:line 97
   at GraphicFontTest.Program.FontCharacteristics(Graphics graphics, FontFamily fontFamily) in c:\GraphicFontTest_2014-09-17 06-52-36Z\GraphicFontTest\Program.cs:line 73
   at GraphicFontTest.Program.Main(String[] args) in c:\GraphicFontTest_2014-09-17 06-52-36Z\GraphicFontTest\Program.cs:line 35

2 Fonts found.
Verdana default was not found.
An exception was thrown.
System.ArgumentException: Font 'Aharoni' does not support style 'Regular'.
   at System.Drawing.Font.CreateNativeFont()
   at System.Drawing.Font.Initialize(FontFamily family, Single emSize, FontStyle style, GraphicsUnit unit, Byte gdiCharSet, Boolean gdiVerticalFont)
   at System.Drawing.Font..ctor(FontFamily family, Single emSize)
   at GraphicFontTest.Program.CheckIfFixed(Graphics graphics, FontFamily FontFamily) in c:\GraphicFontTest_2014-09-17 06-52-36Z\GraphicFontTest\Program.cs:line 97
   at GraphicFontTest.Program.FontCharacteristics(Graphics graphics, FontFamily fontFamily) in c:\GraphicFontTest_2014-09-17 06-52-36Z\GraphicFontTest\Program.cs:line 73
   at GraphicFontTest.Program.Main(String[] args) in c:\GraphicFontTest_2014-09-17 06-52-36Z\GraphicFontTest\Program.cs:line 35

Press Enter to quit.  

mayhem366 wrote Sep 17, 2014 at 1:43 PM

A slightly modified version of the program that does not quit the reading loop on first exception produces the following output:
284 Fonts found.
Verdana default was found.
Exceptions in fonts:
Aharoni
Andy
Berlin Sans FB Demi
Brush Script MT
Harlow Solid Italic
Magneto
Monotype Corsiva
Palace Script MT
Vivaldi

gloder wrote Sep 17, 2014 at 2:31 PM

I had my doubts, but this actually is good news. I will rework the code to handle these exceptions.

Thanks!

gloder wrote Sep 17, 2014 at 3:07 PM

Please try this once more. I've added logic to catch the exceptions, but it comes with some performance loss. I expect that when exceptions are really thrown, as in your case, the hit will be pretty noticeable.

This runs in a little over 1/2 second on my desktop. On your desktop I would guess the exceptions will draw it out to several seconds.

The root cause of the problem has to do with corrupted registration of the offending fonts. Usually it seems that it can be fixed by re-installing the bad fonts.

If this works without unhandled exceptions, I'll make this change in the source for Remarker and get it uploaded soon.

gloder wrote Sep 17, 2014 at 3:08 PM

The new source is GraphicFontTest_2014-09-17 08-59-57Z.zip.

mayhem366 wrote Sep 17, 2014 at 3:54 PM

No errors that time at all and ran pretty fast on my work laptop; about half a second too. I think most of that time was rendering as well so I don't think the performance hit is too bad at all.

gloder wrote Sep 17, 2014 at 7:57 PM

Thanks. I've just uploaded a new vsix to CodePlex, and I'm am about to upload the new build to the Visual Studio Gallery, so you can install from there if you wish. I was able to fix a number of small issues in this, so it should work well for you.

mayhem366 wrote Sep 18, 2014 at 9:03 AM

I have installed the latest version from the gallery and confirmed this is fixed.
Thanks a lot!