/// <summary> /// コンストラクタ /// </summary> /// <param name="device"></param> /// <param name="text">文字列</param> /// <param name="height">フォントサイズ</param> /// <param name="maxwidth">最大幅</param> /// <param name="color">色</param> public TextureString(PPDDevice device, string text, int height, int maxwidth, Color4 color) : base(device) { this.text = text; this.characterHeight = height; this.facename = PPDSetting.Setting.FontName; this.color = color; this.maxwidth = maxwidth; this.scrollable = true; sparechar = new TextureChar(device, '…', 0, 0, this.characterHeight, facename, color); InnerStruct(); }
/// <summary> /// コンストラクタ /// </summary> /// <param name="device"></param> /// <param name="text">テキスト</param> /// <param name="characterHeight">フォントサイズ</param> /// <param name="height">幅</param> /// <param name="width">高さ</param> /// <param name="multiLine">マルチラインか</param> /// <param name="color">色</param> public TextureString(PPDDevice device, string text, int characterHeight, int width, int height, bool multiLine, Color4 color) : base(device) { this.text = text; this.characterHeight = characterHeight; this.facename = PPDSetting.Setting.FontName; this.color = color; size = new Size2F(width, height); this.multiline = multiLine; sparechar = new TextureChar(device, '…', 0, 0, this.characterHeight, facename, color); InnerStruct(); }
private void CreateText() { foreach (TextureChar c in chars) { c.Dispose(); } chars = new TextureChar[text.Length]; width = 0; for (int i = 0; i < chars.Length; i++) { chars[i] = new TextureChar(device, text[i], 0, 0, characterHeight * Math.Max(Scale.X, Scale.Y), facename, color); width += chars[i].Width; } if (scrollable) { MeasureJustWidth(); } }
/// <summary> /// リソースを開放します /// </summary> protected override void DisposeResource() { if (chars != null) { foreach (TextureChar c in chars) { if (c != null) { c.Dispose(); } } chars = null; } if (sparechar != null) { sparechar.Dispose(); sparechar = null; } }