privatefontcollection

How to always get English font name via PrivateFontCollection in C#?

喜你入骨 提交于 2019-12-12 03:03:55
问题 Now I am getting the font name by the following code: PrivateFontCollection fontCollection = new PrivateFontCollection(); fontCollection.AddFontFile("path_to_my_Thai_font"); return fontCollection.Families[0].Name; On a English Win7 system, I get "DFPHeiMedium-UN", but on a Chinese Win7 system, I get "華康中黑體(P)-UN". So, the font name differs in different system languages. My question is how to write my code to make sure that I can always get "DFPHeiMedium-UN" regardless of the system language?

Workaround for the Mono PrivateFontCollection.AddFontFile bug

﹥>﹥吖頭↗ 提交于 2019-12-06 20:52:12
问题 When I call the PrivateFontCollection.AddFontFile method in Mono.net It always returns a standard font-family. This bug has already been reported on several websites, but as far as I know without a way to solve it. The bug itself isn't fixed in the Mono-libraries yet. Is there any workaround for it? EDIT: As a reaction on henchman's answer I will post the code: PrivateFontCollection pfc = new PrivateFontCollection(); pfc.AddFontFile("myFontFamily.ttf"); myFontFamily = pfc.Families[0x00]; Font

Workaround for the Mono PrivateFontCollection.AddFontFile bug

让人想犯罪 __ 提交于 2019-12-05 02:00:23
When I call the PrivateFontCollection.AddFontFile method in Mono.net It always returns a standard font-family. This bug has already been reported on several websites, but as far as I know without a way to solve it. The bug itself isn't fixed in the Mono-libraries yet. Is there any workaround for it? EDIT: As a reaction on henchman's answer I will post the code: PrivateFontCollection pfc = new PrivateFontCollection(); pfc.AddFontFile("myFontFamily.ttf"); myFontFamily = pfc.Families[0x00]; Font myFont = new Font(myFontFamily,14.0f); I know this code will work fine on the Microsoft.Net framework,

How to delete the file of a PrivateFontCollection.AddFontFile?

孤街浪徒 提交于 2019-11-28 10:12:38
We create a large count of fonts for a short use. The fonts are embedded in documents. I want delete the font files if not use anymore. How can we do this? The follow simplified code does not work: PrivateFontCollection pfc = new PrivateFontCollection(); pfc.AddFontFile(fontFile); FontFamily family = pfc.Families[0]; Console.WriteLine(family.GetName(0)); family.Dispose(); pfc.Dispose(); GC.Collect(); GC.WaitForPendingFinalizers(); File.Delete(fontFile); The delete of the file is failing because the file is locked. What can I do else to free the file lock? PS: Before we have use AddMemoryFont.

How to render a font from privatefontcollection memory to editable controls

余生长醉 提交于 2019-11-28 04:51:35
问题 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