I have created a font object from an embedded resource. This font will not be located or installed on the user machine.
If you set the control.Font property of the UltraTextEditor, the control will display the correct font until the user clicks into the control and activates the editor. The editor is controlled by the appearance object on the control, but this doesn't allow me to set the font data using the Font object. How can this be done please?
Regards,
Tim
Hello,
Thank you for your feedback.
We appreciate your collaboration and i think that this forum thread will be very helpful for other customers, whose have the same issue.
Please do not hesitate to contact us if you have any further questions on this matter.
Hristo,
I agree that this is not an Infragistics issue, but relates to the PrivateFontCollection class. I would like to take this opportunity to thank you for your input into this issue and hope that this thread become useful to others out there. I plan to investigate this issue further when I get some more free time, and promise to post my finding back to this forum should I find a solution.
For the time being, you’ve provided an adequate work-around to this issue, so thanks again.
I have set AlwaysInEditMode property of UltraTextEditor to true, in order to have same text rendering of the control in both modes. I also have tried to load the font with AddMemoryFont and this does not works (neither for UltraTextEditor, neither for standart MS TextBox), so I have researched why this happening and I have paid attention of the "Remarks" section of PrivateFontCollection.AddMemoryFont Method:
http://msdn.microsoft.com/en-us/library/system.drawing.text.privatefontcollection.addmemoryfont.aspx
So I have tried to set SetCompatibleTextRendaringDefault of the application:
http://msdn.microsoft.com/en-us/library/system.windows.forms.application.setcompatibletextrenderingdefault.aspx
which should fix the issue and UltraTextEditor and standard MS TextBox should render correctly, but it didn’t solve the issue. So if I am not missing something, it seems to me that this issue is related with PrivateFontCollection and this is not related to Infragistics.
Please let me know if you have any further questions.
Hello Hristo,
I’m actually using the PrivateFontCollection to hold a list of my resource based fonts. Interestingly, you’re adding in the fonts using the AddFontFile which works without issue, even when the control is in EnterEditMode. I’ve been adding the fonts using the AddMemoryFont which doesn’t seem to work as expected. For example I can’t even get the controls in your example to display any font from the PrivateFontCollection when they have been added using the AddMemoryFont, even though they’ve been loaded correctly.
I’ve included two examples below of how I’ve been adding the fonts, neither or which work in your example and I can’t figure out why?
or using the following ....
Hello ,
You could add your Font file to the installation location of your application and to use PrivateFontCollection in order to create a font in runtime and to use it for UltraTextEditor. More about PrivateFontCollection you could find on the following link:
http://msdn.microsoft.com/en-us/library/system.drawing.text.privatefontcollection.aspx
I have created a small sample in order to demonstrate this approach.