当前位置: 首页>>代码示例>>C#>>正文


C# IVwGraphics.SetupGraphics方法代码示例

本文整理汇总了C#中IVwGraphics.SetupGraphics方法的典型用法代码示例。如果您正苦于以下问题:C# IVwGraphics.SetupGraphics方法的具体用法?C# IVwGraphics.SetupGraphics怎么用?C# IVwGraphics.SetupGraphics使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IVwGraphics的用法示例。


在下文中一共展示了IVwGraphics.SetupGraphics方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: get_RendererFromChrp

		/// <summary>
		/// Get the renderer for a particular Chrp
		/// </summary>
		public IRenderEngine get_RendererFromChrp(IVwGraphics vg, ref LgCharRenderProps chrp)
		{
			vg.SetupGraphics(ref chrp);
			return get_Renderer(chrp.ws, vg);
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:8,代码来源:PalasoWritingSystemManager.cs

示例2: get_Renderer

		/// <summary>
		/// Get the engine used to render text with the specified properties. At present only
		/// font, bold, and italic properties are significant.
		/// Font name may be '&lt;default serif&gt;' which produces a renderer suitable for the default
		/// serif font.
		/// </summary>
		/// <param name="vg"></param>
		/// <returns></returns>
		public IRenderEngine get_Renderer(IVwGraphics vg)
		{
			lock (m_syncRoot)
			{
				LgCharRenderProps chrp = vg.FontCharProperties;
				string fontName = MarshalEx.UShortToString(chrp.szFaceName);
				Tuple<string, bool, bool> key = Tuple.Create(fontName, chrp.ttvBold == (int) FwTextToggleVal.kttvForceOn,
															 chrp.ttvItalic == (int) FwTextToggleVal.kttvForceOn);
				IRenderEngine renderEngine;
				if (m_renderEngines.TryGetValue(key, out renderEngine))
					return renderEngine;
				Tuple<string, bool, bool> key2 = null;
				string realFontName;
				if (TryGetRealFontName(fontName, out realFontName))
				{
					MarshalEx.StringToUShort(realFontName, chrp.szFaceName);
					vg.SetupGraphics(ref chrp);
					key2 = Tuple.Create(realFontName, key.Item2, key.Item3);
					if (m_renderEngines.TryGetValue(key2, out renderEngine))
					{
						m_renderEngines[key] = renderEngine;
						return renderEngine;
					}
				}
				else
				{
					realFontName = fontName;
				}

				bool graphiteFont = false;
				if (m_isGraphiteEnabled)
				{
					renderEngine = GraphiteEngineClass.Create();

					string fontFeatures = null;
					if (realFontName == DefaultFontName)
						fontFeatures = DefaultFontFeatures;
					renderEngine.InitRenderer(vg, fontFeatures);
					// check if the font is a valid Graphite font
					if (renderEngine.FontIsValid)
					{
						SetupRenderEngine(renderEngine);
						graphiteFont = true;
					}
				}

				if (!graphiteFont)
				{
					if (!MiscUtils.IsUnix)
					{
						if (m_uniscribeEngine == null)
						{
							m_uniscribeEngine = UniscribeEngineClass.Create();
							m_uniscribeEngine.InitRenderer(vg, null);
							SetupRenderEngine(m_uniscribeEngine);
						}
						renderEngine = m_uniscribeEngine;
					}
					else
					{
						// default to the UniscribeEngine unless ROMAN environment variable is set.
						if (Environment.GetEnvironmentVariable("ROMAN") == null)
							renderEngine = UniscribeEngineClass.Create();
						else
							renderEngine = RomRenderEngineClass.Create();
						renderEngine.InitRenderer(vg, null);
						SetupRenderEngine(renderEngine);
					}
				}

				m_renderEngines[key] = renderEngine;
				if (key2 != null)
					m_renderEngines[key2] = renderEngine;
				return renderEngine;
			}
		}
开发者ID:sillsdev,项目名称:FieldWorks,代码行数:84,代码来源:PalasoWritingSystem.cs

示例3: HoldDummyGraphics

			/// --------------------------------------------------------------------------------
			/// <summary>
			/// Initializes a new instance of the <see cref="T:HoldDummyGraphics"/> class.
			/// </summary>
			/// <param name="fontName">Name of the font.</param>
			/// <param name="fBold">if set to <c>true</c> [f bold].</param>
			/// <param name="fItalic">if set to <c>true</c> [f italic].</param>
			/// <param name="ctrl">The parent control</param>
			/// --------------------------------------------------------------------------------
			public HoldDummyGraphics(string fontName, bool fBold, bool fItalic, Control ctrl)
			{
				// Make a VwGraphics and initialize it.
				IVwGraphicsWin32 vwGraphics32 = VwGraphicsWin32Class.Create();
				m_vwGraphics = vwGraphics32;
				m_graphics = ctrl.CreateGraphics();
				m_hdc = m_graphics.GetHdc();
				((IVwGraphicsWin32)m_vwGraphics).Initialize(m_hdc);

				// Select our font into it.
				var chrp = new LgCharRenderProps();
				chrp.szFaceName = new ushort[32];
				for (int ich = 0; ich < fontName.Length; ++ich)
				{
					if (ich < 32)
						chrp.szFaceName[ich] = fontName[ich];
				}
				if (fontName.Length < 32)
					chrp.szFaceName[fontName.Length] = 0;
				else
					chrp.szFaceName[31] = 0;
				chrp.ttvBold = (int)(fBold ? FwTextToggleVal.kttvForceOn
					: FwTextToggleVal.kttvOff);
				chrp.ttvItalic = (int)(fItalic ? FwTextToggleVal.kttvForceOn
					: FwTextToggleVal.kttvOff);
				m_vwGraphics.SetupGraphics(ref chrp);
			}
开发者ID:sillsdev,项目名称:FieldWorks,代码行数:36,代码来源:FontFeaturesButton.cs


注:本文中的IVwGraphics.SetupGraphics方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。