3/8/2023 0 Comments Microsoft yahei ui fonty![]() ![]() The following is the custom font list for the Unicode Slide Show and BabelMap Online (defined in unicode.js). Now all we have to do is check whether a font has the latn (or 0圆e74616c as a little endian integer) script tag.Custom Font List Custom Font List for Unicode 8.0 Var builder = new StringBuilder(bytes.Length) Var bytes = BitConverter.GetBytes(script) Private static string TagToString(int script) Using (var g = Graphics.FromHwnd(Handle))įoreach (FontFamily family in FontFamily.Families)įoreach (int script in GetScriptTags(context, font))Ĭonsole.Write(" )", TagToString(script), script) Protected override void OnHandleCreated(EventArgs e) Which we could then use once we have a device context from a graphics object: class Form1 : Form ![]() ![]() Private static extern int ScriptFreeCache(IntPtr scriptCache) Private static extern int ScriptGetFontScriptTags(IntPtr hdc, IntPtr scriptCache, IntPtr scriptAnalysis, int maxTags, IntPtr tags, IntPtr tagCount) Private static extern IntPtr SelectObject(IntPtr hdc, IntPtr value) Tags = Marshal.ReadInt32(tagsPointer, 4 * i) If (tagCount > 0 & tagCount <= MaximumTagCount) Int tagCount = Marshal.ReadInt32(tagCountPointer) Int status = ScriptGetFontScriptTags(context, scriptCache, IntPtr.Zero, MaximumTagCount, tagsPointer, tagCountPointer) TagCountPointer = Marshal.AllocHGlobal(4) TagsPointer = Marshal.AllocHGlobal(4 * MaximumTagCount) // one tag is 4 bytes long Marshal.WriteIntPtr(scriptCache, IntPtr.Zero) ScriptCache = Marshal.AllocHGlobal(IntPtr.Size) uniscribe expects a pointer to a SCRIPT_CACHE pointer IntPtr oldFont = SelectObject(context, font.ToHfont()) ![]() Private static int GetScriptTags(IntPtr context, Font font) Using a little P/Invoke we could do: private const int MaximumTagCount = 32 Starting from Windows Vista, Uniscribe (linked from answer to a similar question) and in particular the ScriptGetFontScriptTags function can be used to query information about OpenType fonts. I haven't found a default font for a given script yet but at least a way to figure out whether a font supports a given script. NET framework or Windows in general ( FontFamily.GenericSansSerif maybe?) or at least something that tells me if a font can be used for Latin script? Is there any default font for Latin script in the. I guess I could explicitly use SystemFonts.MessageBoxFont or hard code another font like Microsoft Sans Serif in my control's constructor (but then there are the Microsoft font guidelines). I assume that's because it is using SystemFonts.MessageBoxFont which resolves to Microsoft YaHei UI on that system. However, the standard dialog that is shown by MessageBox.Show() looks okay despite it almost exclusively showing Latin characters. Now, on a Chinese Windows 10 the default font may be something that's optimized for Chinese script and the English text that my control is rendering looks rather weird (like in this question). Control.DefaultFont, which resolves to Microsoft Sans Serif on my German Windows 10 (or whatever is configured as the default system font). The control isn't localized and always displays English text using the Windows Forms default font, i.e. I'm developing a Windows Forms control as a plugin for a larger application. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |