internal void InitForToolkit (Toolkit tk) { if (ToolkitEngine != tk) { // Gather existing font property before switching handler var fname = Family; var size = Size; var style = Style; var weight = Weight; var stretch = Stretch; var oldHandler = ToolkitEngine.FontBackendHandler; ToolkitEngine = tk; handler = tk.FontBackendHandler; if (fname == oldHandler.SystemFont.Family) Backend = handler.WithSettings (handler.SystemFont.Backend, size, style, weight, stretch); else if (fname == oldHandler.SystemMonospaceFont.Family) Backend = handler.WithSettings (handler.SystemMonospaceFont.Backend, size, style, weight, stretch); else if (fname == oldHandler.SystemSansSerifFont.Family) Backend = handler.WithSettings (handler.SystemSansSerifFont.Backend, size, style, weight, stretch); else if (fname == oldHandler.SystemSerifFont.Family) Backend = handler.WithSettings (handler.SystemSerifFont.Backend, size, style, weight, stretch); else { var fb = handler.Create (fname, size, style, weight, stretch); Backend = fb ?? handler.WithSettings(handler.GetSystemDefaultFont (), size, style, weight, stretch); } } }
internal Font (object backend, Toolkit toolkit) { if (toolkit != null) ToolkitEngine = toolkit; handler = ToolkitEngine.FontBackendHandler; if (backend == null) throw new ArgumentNullException ("backend"); Backend = backend; }
internal void InitForToolkit (Toolkit tk) { if (ToolkitEngine != tk) { // Gather existing font property before switching handler var fname = Family; var size = Size; var style = Style; var weight = Weight; var stretch = Stretch; ToolkitEngine = tk; handler = tk.FontBackendHandler; var fb = handler.Create (fname, size, style, weight, stretch); Backend = fb ?? handler.GetSystemDefaultFont (); } }