Fontsize management in Pango.Layout seems to be broken.
The Code below does print using Pango and using Cairo directly, the
fortsizes are obviously different.
Is there any problem in my Code?
Where to file this bug?
class PrintTest {
public static void Main (string[] args) {
Cairo.PdfSurface surface=
new Cairo.PdfSurface("Test.pdf",mm(210),mm(297));
Cairo.Context cc=new Cairo.Context(surface);
Test1(cc,20,20,"Arial",8);
Test1(cc,20,30,"Arial",10);
Test1(cc,20,40,"Arial",12);
Test1(cc,20,50,"Times New Roman",8);
Test1(cc,20,60,"Times New Roman",10);
Test1(cc,20,70,"Times New Roman",12);
Test2(cc,80,20,"Arial",8);
Test2(cc,80,30,"Arial",10);
Test2(cc,80,40,"Arial",12);
Test2(cc,80,50,"Times New Roman",8);
Test2(cc,80,60,"Times New Roman",10);
Test2(cc,80,70,"Times New Roman",12);
surface.Finish();
}
static void Test1(
Cairo.Context cc,
double xCor,
double yCor,
string FontName,
double FontSize
) {
Pango.Layout layout =
Pango.CairoHelper.CreateLayout(cc);
layout.FontDescription =
Pango.FontDescription.FromString(FontName);
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 void Test2(
Cairo.Context cc,
double xCor,
double yCor,
string FontName,
double FontSize
) {
cc.SelectFontFace(
FontName,
Cairo.FontSlant.Normal,
Cairo.FontWeight.Normal);
cc.SetFontSize(FontSize);
cc.MoveTo(mm(xCor),mm(yCor));
cc.TextPath(FontName + " " + FontSize.ToString());
cc.Fill();
}
static double mm(double mmVal) {
return mmVal*72.0/25.4;
}
}
_______________________________________________
Mono-list maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-list