Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2017-07

Strange Font.Height

6 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Valdas Jankūnas

Hello,

code (WS: GTK2):

   i := Canvas.TextHeight('I');
   writeln(i);
   Canvas.Font.Height := i;
   i:= Canvas.TextHeight('I');
   writeln(i);
   Canvas.Font.Height := i;
   i:= Canvas.TextHeight('I');
   writeln(i);

I get:
24
33
45

I think that "Canvas.Font.Height" and "Canvas.TextHeight('a')" should be same. Why it increases after assignment, is it a bug or I don't know something? Is there DPI (mine is 141) related somehow?

Kubuntu 17.04, Lazarus 1.9.0, FPC 3.0.0

Valdas Jankūnas

Reply by email

Ondrej Pokorny
to Valdas Jankūnas
Valdas Jankūnas wrote 19 lines
code (WS: GTK2): i := Canvas.TextHeight('I'); writeln(i); Canvas.Font.Height := i; i:= Canvas.TextHeight('I'); writeln(i); Canvas.Font.Height := i; i:= Canvas.TextHeight('I'); writeln(i); I get: 24 33 45 I think that "Canvas.Font.Height" and "Canvas.TextHeight('a')" should be same. Why it increases after assignment, is it a bug or I don't know something? Is there DPI (mine is 141) related somehow?

Can you test Lazarus 1.6.x, please?

Ondrej

Reply by email

Valdas Jankūnas
to Ondrej Pokorny

2017.07.05 00:19, Ondrej Pokorny via Lazarus rašė:

Can you test Lazarus 1.6.x, please? Ondrej

attaching test project. Results:

Kubuntu 17.04 (in virtualbox); Lazarus 1.6.4; FPC 3.0.2; WS Gtk2: 18
24
33
45
61
83

Kubuntu 17.04 (in virtualbox); Lazarus 1.6.4; FPC 3.0.2; WS Qt: 14
16
19
22
25
29

Ubuntu 17.04 (in virtualbox); Lazarus 1.6.4; FPC 3.0.2; WS Gtk2: 17
19
22
25
28
31

Ubuntu 17.04 (in virtualbox); Lazarus 1.6.4; FPC 3.0.2; WS Qt: 17
19
22
25
28
31

Valdas Jankūnas -------------- next part -------------- A non-text attachment was scrubbed... Name: test_project.zip Type: application/zip Size: 3790 bytes Desc: not available URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20170705/3d1d7f09/attachment.zip>

Reply by email

Valdas Jankūnas

2017-07-05 1:39 GMT+03:00 Valdas Jankūnas :

Show quoted text 41 lines
2017.07.05 00:19, Ondrej Pokorny via Lazarus rašė: > Can you test Lazarus 1.6.x, please? > > Ondrej > attaching test project. Results: Kubuntu 17.04 (in virtualbox); Lazarus 1.6.4; FPC 3.0.2; WS Gtk2: 18 24 33 45 61 83 Kubuntu 17.04 (in virtualbox); Lazarus 1.6.4; FPC 3.0.2; WS Qt: 14 16 19 22 25 29 Ubuntu 17.04 (in virtualbox); Lazarus 1.6.4; FPC 3.0.2; WS Gtk2: 17 19 22 25 28 31 Ubuntu 17.04 (in virtualbox); Lazarus 1.6.4; FPC 3.0.2; WS Qt: 17 19 22 25 28 31

I ran this code (Lazarus 1.9.0):

Writeln('Canvas.Font.PixelsPerInch = ', + Canvas.Font.PixelsPerInch);
writeln('Forms.Screen.PixelsPerInch = ', + Forms.Screen.PixelsPerInch);
writeln('Graphics.ScreenInfo.PixelsPerInchX = ',
Graphics.ScreenInfo.PixelsPerInchX);

and got:

Canvas.Font.PixelsPerInch = 96
Forms.Screen.PixelsPerInch = 141
Graphics.ScreenInfo.PixelsPerInchX = 141

"xdpyinfo | grep dots" in console gives "resolution: 141x141 dots per inch".

PPI of Font differs from rest PPI. Is this intended or a bug?

______
Valdas Jankūnas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20170709/a823b3a4/attachment.html>

Reply by email

Valdas Jankūnas
to Ondrej Pokorny

I created simple GUI project and OnCreate added previously mentioned code. Is this a bug in Lazarus?

2017-07-09 18:41 GMT+03:00 Ondrej Pokorny via Lazarus <

Show quoted text 18 lines
: On 09.07.2017 17:14, Valdas Jankūnas via Lazarus wrote: PPI of Font differs from rest PPI. Is this intended or a bug? It depends what your code is. Ondrej -- _______________________________________________ Lazarus mailing list https://lists.lazarus-ide.org/listinfo/lazarus
______ Valdas Jankūnas -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20170709/32196e8f/attachment.html>

Reply by email