ठीक है, मैंने इसे इंटरवेब्स और Google के लिए धन्यवाद दिया।
भविष्य में संदर्भ के लिए, यदि किसी को भी यह समस्या है, ठीक है: एक धारा के रूप में अपने एम्बेडेड फ़ॉन्ट प्राप्त करने के बाद, और AddMemoryFont, आप AddFontMemResourceEx कॉल करनी होगी कॉल करने से पहले! (सी # में उपलब्ध नहीं है, तो आप इसे आयात करने के लिए है:
[DllImport("gdi32.dll")]
private static extern IntPtr AddFontMemResourceEx(IntPtr pbFont, uint cbFont, IntPtr pdv, [In] ref uint pcFonts);
और उसके बाद:।
//create an unsafe memory block for the data
System.IntPtr data = Marshal.AllocCoTaskMem((int)fontStream.Length);
//create a buffer to read in to
Byte[] fontData = new Byte[fontStream.Length];
//fetch the font program from the resource
fontStream.Read(fontData, 0, (int)fontStream.Length);
//copy the bytes to the unsafe memory block
Marshal.Copy(fontData, 0, data, (int)fontStream.Length);
// We HAVE to do this to register the font to the system (Weird .NET bug !)
uint cFonts = 0;
AddFontMemResourceEx(data, (uint)fontData.Length, IntPtr.Zero, ref cFonts);
//pass the font to the font collection
mFontCollection.AddMemoryFont(data, (int)fontStream.Length);
//close the resource stream
fontStream.Close();
//free the unsafe memory
Marshal.FreeCoTaskMem(data);
और Presto, आप फ़ॉन्ट उपयोग करने के लिए सक्षम हो जाएगा AddFontMemResourceEx के बिना यह अभ्यस्त काम ।
+1 पता चला है कि, धन्यवाद, नेतृत्व – BillW
पवित्र केकड़ा मैं घंटे धन्यवाद के लिए दीवार के खिलाफ मेरे सिर पीटने दिया !! – Mike
कहां है "fontStream" यहाँ से आ रहा है? –