/// <summary> /// テキストオプションと描画先のビットマップを指定して /// 新しい TextRenderer クラスの新しいインスタンスを初期化します。 /// </summary> /// <param name="options">使用されるテキストオプション。</param> /// <param name="bitmapLoader">描画先のビットマップ。</param> /// <exception cref="ArgumentNullException">何れかの引数が null です。</exception> public TextRenderer(TextRendererOptions options, BitmapLoader bitmapLoader) { if (options == null) throw new ArgumentNullException("options"); if (bitmapLoader == null) throw new ArgumentNullException("bitmapLoader"); this.options = options; this.loader = bitmapLoader; }
public void FontGetTest() { const int LineHeight = 10; using (FontLoader fontLoader = new FontLoader(NanoDigiPath)) using (Font font = new Font(fontLoader.Families[0], 10.0f)) using (TextRendererOptions options = new TextRendererOptions(font, LineHeight)) { Assert.IsNotNull(options.Font); Assert.AreEqual(font, options.Font); } }
public void FormatGetExceptionTest() { const int LineHeight = 10; TextRendererOptions options = null; using (FontLoader fontLoader = new FontLoader(NanoDigiPath)) using (Font font = new Font(fontLoader.Families[0], 10.0f)) using (options = new TextRendererOptions(font, LineHeight)) { } if (options == null) Assert.Fail(); else { var format = options.Format; } }
/// <summary> /// このオブジェクトによって使用されているアンマネージリソースを解放し、オプションでマネージリソースも解放します。 /// </summary> /// <param name="disposing"> /// マネージリソースとアンマネージリソースの両方を解放する場合は true。アンマネージリソースだけを解放する場合は false。 /// </param> protected virtual void Dispose(bool disposing) { if (!this.isDisposed) { if (disposing) { if (this.loader != null) this.loader.Dispose(); if (this.options != null) this.options.Dispose(); } this.loader = null; this.options = null; this.isDisposed = true; } }
public void ShadowIndexTest() { const int LineHeight = 10; using (FontLoader fontLoader = new FontLoader(NanoDigiPath)) using (Font font = new Font(fontLoader.Families[0], 10.0f)) using (TextRendererOptions options = new TextRendererOptions(font, LineHeight)) { Assert.AreEqual(0, options.ShadowIndex); options.ShadowIndex = 3; Assert.AreEqual(3, options.ShadowIndex); } }
public void LineHeightSetTest() { const int LineHeight = 10; const int LineHeightModified = 12; using (FontLoader fontLoader = new FontLoader(NanoDigiPath)) using (Font font = new Font(fontLoader.Families[0], 10.0f)) using (TextRendererOptions options = new TextRendererOptions(font, LineHeight)) { options.LineHeight = LineHeightModified; Assert.AreEqual(LineHeightModified, (int)options.LineHeight); } }
public void FormatSetExceptionTest1() { const int LineHeight = 10; using (FontLoader fontLoader = new FontLoader(NanoDigiPath)) using (Font font = new Font(fontLoader.Families[0], 10.0f)) using (TextRendererOptions options = new TextRendererOptions(font, LineHeight)) options.Format = null; }