This is a continuation of Loading a font from resources into PrivateFontCollection results in corruption
The answer supplied here is sufficient for controls that have the UseCompatibleTextRendering
method available, however it does not appear to be available for other common controls which text is the primary focus such as :
- ListView
- TextBox
- RichTextBox
- ComboBox
- ... and many more...
I have attempted the information from here which is basically toying with the Application.SetCompatibleTextRenderingDefault
line in Program.cs
(no one clarified where this setting is by default so I am documenting it here). I have also played around with Telerik, DevExpress, and Infragistics text controls, all except Telerik do not have the ability for compatible text rendering built in. Teleriks control has the method, however it has zero effect including failure to set forecolor to what is stored in the property (a different animal, just noting the glitchiness of the Telerik radTextBox control).
It seems no matter how I slice it, any control that is actually useful with text will not render the text properly displaying the square characters as depicted in the original post noted above.
In summary :
- The font is loading from a resource into memory into PrivateFontCollection
- The application does not crash
The same font is being used on labels successfully (UseCompatibleTextRendering works on them) - on the same form, in the same project.
The controls that are affected by this (new ?) problem are strictly any control that one can potentially 'type' in such as TextEdit, ListView, RichText, Combo, etc
When speaking of toggling, and toying or playing with -- what this means is that I have attempted all possible combinations of said controls and/or code that I have been supplied with. For example:
Application.SetCompatibleTextRenderingDefault
has only 3 possible combinations in itself.(true)
(false)
or completely omitted. After having completed those 3 combinations, I then proceeded (basic troubleshooting here but I find it necessary to explain to cover all bases) to add a Telerik control, then try all combinations in the Telerik control, in conjunction with all combinations of theApplication.SetCompatibleTextRenderingDefault
command. The number of tests is exponential being the number of possible combinations of rendering possibilities multiplied by the number of controls attempted multiplied by the number of possibilities for rendering control each of those controls have, and so on.