{
if (this.render == null || this.render.IsDisposed)
return;
- DW.TextLayout layout = new DW.TextLayout(this.DWFactory, str, this.format, (float)layoutRect.Width, (float)layoutRect.Height);
- switch (align)
- {
- case StringAlignment.Left:
- layout.TextAlignment = DW.TextAlignment.Leading;
- break;
- case StringAlignment.Center:
- layout.TextAlignment = DW.TextAlignment.Center;
- break;
- case StringAlignment.Right:
- layout.TextAlignment = DW.TextAlignment.Trailing;
- break;
- }
+ float dpix, dpiy;
+ this.GetDpi(out dpix,out dpiy);
+ MyTextLayout layout = new MyTextLayout(this.DWFactory, str, this.format, (float)layoutRect.Width, (float)layoutRect.Height,dpix,false);
+ layout.StringAlignment = align;
D2D.SolidColorBrush brush = this.Brushes.Get(this.Foreground);
- this.render.DrawTextLayout(new Vector2((float)x, (float)y), layout, brush);
+ layout.Draw(this.render, (float)x, (float)y, brush);
layout.Dispose();
}
public ITextLayout CreateLaytout(string str, SyntaxInfo[] syntaxCollection, IEnumerable<Marker> MarkerRanges)
{
+ float dpix,dpiy;
+ this.GetDpi(out dpix,out dpiy);
+
bool hasNewLine = str.Length > 0 && str[str.Length - 1] == Document.NewLine;
MyTextLayout newLayout = new MyTextLayout(this.DWFactory,
str,
this.format,
this.ClipRect.Width,
this.ClipRect.Height,
+ dpiy,
hasNewLine && this._ShowLineBreak);
ParseLayout(newLayout, str);
if (syntaxCollection != null)
double _height = double.NaN;
double _width = double.NaN;
int lineBreakIndex = 0;
+ StringAlignment _strAlign;
- internal MyTextLayout(DW.Factory dwFactory,string str,DW.TextFormat format,double width,double height,bool showLineBreak)
+ internal MyTextLayout(DW.Factory dwFactory,string str,DW.TextFormat format,double width,double height,float dip,bool showLineBreak)
{
str = str.Trim(Document.NewLine); //取り除かないとキャレットの動きがおかしくなる
if (showLineBreak)
str,
format,
(float)width,
- (float)height);
+ (float)height,
+ dip,
+ true);
this.Disposed = false;
this.ShowLineBreak = showLineBreak;
}
}
}
+ public StringAlignment StringAlignment
+ {
+ get
+ {
+ return this._strAlign;
+ }
+ set
+ {
+ this._strAlign = value;
+ switch (value)
+ {
+ case StringAlignment.Left:
+ layout.TextAlignment = DW.TextAlignment.Leading;
+ break;
+ case StringAlignment.Center:
+ layout.TextAlignment = DW.TextAlignment.Center;
+ break;
+ case StringAlignment.Right:
+ layout.TextAlignment = DW.TextAlignment.Trailing;
+ break;
+ }
+ }
+ }
+
public void Draw(DW.TextRenderer render, float x, float y)
{
this.layout.Draw(render, x, y);
}
+ public void Draw(D2D.RenderTarget render, float x, float y, D2D.Brush brush)
+ {
+ render.DrawTextLayout(new Vector2((float)x, (float)y), this.layout, brush);
+ }
+
public void Dispose()
{
this.layout.Dispose();