> I personally use something like this :
> 
> [...]
> Pango.Layout layout = printContext.CreatePangoLayout();
> 
> layout.FontDescription = Pango.FontDescription.FromString("Times New
> Roman 10");


I'm not using Gtk Printing.

See sample attached. In the resulting PDF the fontsize is not correct.

Elmar
class PrintTest {

	public static void Main (string[] args) {
		// Create A4 Output
		Cairo.PdfSurface surface=new Cairo.PdfSurface("Test.pdf",mm(210),mm(297));
		Cairo.Context cc=new Cairo.Context(surface);

		Test(cc,20,20,"Arial",8);
		Test(cc,20,30,"Arial",10);
		Test(cc,20,40,"Arial",12);
		Test(cc,20,50,"Times New Roman",8);
		Test(cc,20,60,"Times New Roman",10);
		Test(cc,20,70,"Times New Roman",12);
		
		Test(cc,80,20,"Arial 8",-1);
		Test(cc,80,30,"Arial 10",-1);
		Test(cc,80,40,"Arial 12",-1);
		Test(cc,80,50,"Times New Roman 8",-1);
		Test(cc,80,60,"Times New Roman 10",-1);
		Test(cc,80,70,"Times New Roman 12",-1);

		surface.Finish();
	}

	static void Test(Cairo.Context cc,double xCor,double yCor,string FontName,double FontSize) {
		Pango.Layout layout = Pango.CairoHelper.CreateLayout(cc);
		layout.Alignment = Pango.Alignment.Left;
		layout.Width=-1;
		layout.FontDescription = Pango.FontDescription.FromString(FontName);
		if (FontSize>0)
			layout.FontDescription.Size=(int)(FontSize * Pango.Scale.PangoScale);
		layout.SetText(FontName + " " + FontSize.ToString());
		cc.MoveTo (mm(xCor),mm(yCor));
		Pango.CairoHelper.ShowLayout(cc,layout);
	}
	
	static double mm(double mmWert) {
		return mmWert*72.0/25.4;
	}
		

}
_______________________________________________
Mono-list maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-list

Reply via email to