Recent

Author Topic: BGRABitmap - System font  (Read 15595 times)

circular

  • Hero Member
  • *****
  • Posts: 4195
    • Personal webpage
Re: BGRABitmap - System font
« Reply #15 on: April 19, 2012, 03:50:49 am »
Well Lainz, I would say that you need to put a minus sign but this may not work on Linux as far as I know. Maybe I should publish the FontHeightSign value so you can just multiply by it to get the correct value.
Conscience is the debugger of the mind

lainz

  • Guest
Re: BGRABitmap - System font
« Reply #16 on: April 19, 2012, 03:52:29 am »
Ok at least in Windows will work.

Dibo

  • Hero Member
  • *****
  • Posts: 1048
Re: BGRABitmap - System font
« Reply #17 on: April 19, 2012, 05:04:58 pm »
This is it. It cannot be better for now. :D
It may get better when LazFreeType is integrated in BGRABitmap, which is not yet ready at all.

So what you need to take into account is that TextHeight does not return the same value as the font height, so you should avoid going that way to keep the size equivalence.
Regards.
Exactly. I tried some test: Canvas.Font.Height := Canvas.TextHeight('Some Text'); and on each repaint my text was getting bigger :) . So it seems that this is LCL QT bug, I try update my lazarus revision, if it doesn't help I report this bug. Thanks

circular

  • Hero Member
  • *****
  • Posts: 4195
    • Personal webpage
Re: BGRABitmap - System font
« Reply #18 on: April 19, 2012, 08:54:37 pm »
You're welcome, Dibo.
Conscience is the debugger of the mind

zeljko

  • Hero Member
  • *****
  • Posts: 1594
    • http://wiki.lazarus.freepascal.org/User:Zeljan
Re: BGRABitmap - System font
« Reply #19 on: April 22, 2012, 06:45:25 pm »
No, it's not qt lcl bug. It works exactly as qt docs says (same applies to gtk2 and carbon).
Windows are different here since they take only ascent but not descent size when creating font with +tmHeight.
Tested with MS Sans Serif font

Under windows Font.Size = 10 Font.Height = -13 -> text height = 16  (win32)
Under windows Font.Size = 10 Font.Height = -13 -> text height = 16  (qt)

Under windows Font.Size = -10 Font.Height = 13 -> text height = 13 (win32)**
Under windows Font.Size = -10 Font.Height = 13 -> text height = 16  (qt)

Under linux qt and gtk2 behaves same as qt under windows.
I know that windows api works like this but I doubt that this will be changed to mimic windows api on other widgetsets.



Dibo

  • Hero Member
  • *****
  • Posts: 1048
Re: BGRABitmap - System font
« Reply #20 on: April 22, 2012, 10:00:19 pm »
So how Lazarus calculate default font size for TLabel or other controls? Because when I draw some text using canvas with default font size (without changing height and size) then text size is the same like in TLabel, but when I try obtain this size by calling TextHeight function, then I get bigger size (I refer to the situation before your fix).

Edit: Maybe I explain what I want to get. We have BGRA Controls package with visual controls which are drawing using BGRA Bitmap librarys. I want that default fonts should look the same as the other lazarus controls. To do this, BGRA Bitmap TextOut method need font height but Canvas.TextHeight on QT doesn't return size which is set for example in TLabel. I don't know how to solve this problem
« Last Edit: April 22, 2012, 10:14:59 pm by Dibo »

 

TinyPortal © 2005-2018