public static void InitTextRenderer(Tao.Platform.Windows.SimpleOpenGlControl openGlCtrl) { openGlControl = openGlCtrl; try { int Errors = 0; // CREATE FONT sysfont = new FTFont("FreeSans.ttf", out Errors); // INITIALISE FONT AS A PER_CHARACTER TEXTURE MAPPED FONT sysfont.ftRenderToTexture(12, 196); // SET the sample font to align CENTERED sysfont.FT_ALIGN = FTFontAlign.FT_ALIGN_LEFT; sIsTextRendererInitialized = true; } catch (Exception) { sIsTextRendererInitialized = false; } }
private void FTFont_SelectionChanged(object sender, SelectionChangedEventArgs e) { string fontData = ""; switch (FTFont.SelectedIndex) { case 0: fontData = "仿宋"; break; case 1: fontData = "黑体"; break; case 2: fontData = "楷体"; break; case 3: fontData = "宋体"; break; case 4: fontData = "新宋体"; break; case 5: fontData = "微软雅黑"; break; } if (内容.Document.Selection.Length != 0) { 内容.Document.Selection.Text = "[font=" + fontData + "]" + 内容.Document.Selection.Text + "[/font]"; } else { 内容.Document.Selection.SetText(Windows.UI.Text.TextSetOptions.None, "[font=" + fontData + "] [/font]"); } FTFont.ClearValue(ListView.SelectedIndexProperty); }