> On Tue, 2011-07-19 at 15:40 +0200, Benoît Minisini wrote: > > > Benoit, > > > > > > Paint.scale work good if there is not text ..; but if there is ... > > > then text font size is increased by the scale too > > > > This is normal. This it the goal of that matrix: everything is scaled. I > > added a remark about that on the "How to print" wiki page. > > > > Regards, > > At "How to print" page says: > > Consequently, if a 10 points font is a good size for drawing text on the > screen, it may be too big for the paper: as the printer resolution is > far greater than the screen resolution, you usually print things > smaller. > > We know that Desktop.Resolution uses 12 points Font, for example > Also we know Printer.Resolution, so X points Font should be on printer. > > I made an example > --------- > ' Gambas class file > > Public Sub Button1_Click() > > If Not Printer1.Configure() Then > Printer1.Count = 1 > Printer1.FullPage = True > Printer1.Print > Endif > > End > > Public Sub Printer1_Draw() > > Dim X As Float > Dim Y As Float > Dim W As Float > Dim H As Float > Dim hFactor As Float > Dim wFactor As Float > > hFactor = Paint.Height / Printer1.PaperHeight > wFactor = Paint.Width / Printer1.PaperWidth > > Paint.Scale(wFactor, hFactor) > > 'Set brush > Paint.Brush = Paint.Color(Color.RGB(255, 0, 0, 0)) > Paint.LineWidth = 0.45 > > 'Set origin 0,0 > X = 0 > Y = 0 > > 'Set width, height of printing area > W = Printer1.PaperWidth - Paint.LineWidth > H = Printer1.PaperHeight - Paint.LineWidth > > 'Draw printing area with red rectangle > Paint.Rectangle(X, Y, W, H) > Paint.Stroke > > 'Draw font > Paint.MoveTo(10, 10 + Paint.TextExtents("toto").Height) > Paint.Font.Name = "Times New Roman" > Paint.Font.Size = 12 * (Desktop.Resolution / Printer1.Resolution) > Paint.Text("toto") > Paint.Fill > > End > ------------- > > You know allreay the code but check out the line > Paint.Font.Size = 12 * (Desktop.Resolution / Printer1.Resolution) > > i think this line prints a good 12 points font on a pdf as i see. > Compare the result with an OpenOffice pdf. It has good success. > > i attach the project.
Note that Paint.Font.Size is an absolute value in typographic points, *BUT* it is scaled by the Paint matrix (i.e. Paint.Scale). -- Benoît Minisini ------------------------------------------------------------------------------ Magic Quadrant for Content-Aware Data Loss Prevention Research study explores the data loss prevention market. Includes in-depth analysis on the changes within the DLP market, and the criteria used to evaluate the strengths and weaknesses of these DLP solutions. http://www.accelacomm.com/jaw/sfnl/114/51385063/ _______________________________________________ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user