Exemplo n.º 1
0
		public static void Draw(Painter painterSink, ITextMetrics metrics)
		{
			Contract.Requires(painterSink != null);
			Contract.Requires(metrics != null);

			Draw(painterSink, metrics, metrics.Paragraph.Text);
		}
Exemplo n.º 2
0
		public static void Draw(Painter painterSink, ITextMetrics metrics, IndexedRange range)
		{
			Contract.Requires(painterSink != null);
			Contract.Requires(metrics != null);

			for(int i = range.StartIndex; i <= range.LastIndex; ++i)
			{
				if(metrics.IsClusterStart(i))
				{
					if(metrics.IsVisible(i))
					{
						Rectangle region = metrics.Regions[i];

						Point baseline = new Point(
							region.Left + metrics.BaselineOffset.Width, region.Top + metrics.BaselineOffset.Height);

						if(metrics.IsRightToLeft(i))
						{
							baseline = new Point(region.Right + metrics.BaselineOffset.Width, baseline.Y);
						}

						painterSink.SaveState();

						painterSink.Translate(baseline.X, baseline.Y);

						Outline outline = metrics.Outlines[i];

						painterSink.Scale(outline.EmSize, outline.EmSize);

						if (outline.NormalizedOutline != null)
						{
							painterSink.Fill(outline.NormalizedOutline);
						}

						painterSink.RestoreState();
					}
				}
			}
		}