Exemplo n.º 1
0
		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);
				}
			}
		}
Exemplo n.º 2
0
Arquivo: Font.cs Projeto: m13253/xwt
		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 ();
			}
		}