|
|
Home » U++ Library support » RichText,QTF,RTF... » Using Qtf forgets control font
|
|
|
Re: Using Qtf forgets control font [message #16699 is a reply to message #16680] |
Mon, 07 July 2008 22:51 |
|
mirek
Messages: 13975 Registered: November 2005
|
Ultimate Member |
|
|
cbpporter wrote on Mon, 07 July 2008 10:53 |
luzr wrote on Mon, 07 July 2008 16:30 | If you use QTF in label, font is ignored. (-> a feature, not a bug
Mirek
|
Strange feature. A little counter-productive, but I guess I can compensate with extra Qtf. I tried something like this:
lblKun.SetFont(f).SetText("\1[!" + f.GetFaceName() + "! [3 " + ToUtf8(Join(kanji_.KunReading, EntrySeparator)) + "]]");
only to find out that using for 12 points is different from the StdFont height. Is there a function that takes a font height and return the Qtf magical number needed to obtain that size?
|
[/quote]
Unfortunately, things are a little bit more complicated (as usual). QTF is basically "physical unit format" (intended to be eventually printed). The unit is "dot" - 1/600 of inch. However, for screen displaying, there is zooming coeficient that is derived from Font-zoom.
Font "numbers" are tables of dots, but you can express the font height if you prepend it with '+', like "[+80 ...".
Mirek
[Updated on: Mon, 07 July 2008 22:51] Report message to a moderator
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Re: Using Qtf forgets control font [message #17853 is a reply to message #17849] |
Sun, 31 August 2008 13:39 |
cbpporter
Messages: 1401 Registered: September 2007
|
Ultimate Contributor |
|
|
luzr wrote on Sun, 31 August 2008 11:46 | Sorry, "FontZoom" is "general term". The methods are
The idea behind this is that there is some basic font size. All dialog layouts are designed with this basic font size in mind - and these are units shown in layout designer.
Then there is "GetZoomText" - a standard text whose size is known in basic font size (by basic font we consider here the "normal font" used for most texts in GUI).
Then, when U++ app is started, the same text is measured in host platform "normal GUI font" and this new size / "standard size" is taken as "FontZoom ratio".
This is the best solution I was able to invent... In practice, it works pretty well.
|
OK, basically you have Csize where you get the current size using StdFont of the zoom text, and Dsize, which is initialized with a hardcoded measurement of the same text and same font under what you consider zoom 1:1 zoom ration. And you use their ration to adjust positions.
Then you must know what which font StdFont() is .
I also noticed that max between Csize and Dsize. This probably explains why when I lowered my PPI and I go really small text, the layout was not shrunk, but when I increase PPI, layouts grow..
Quote: |
I had to deprecate ScreenInfo, as it is inherently MT unsafe...
You should be able to get the same thing using
ScreenDraw info(true);
|
ScreenDraw worked fine. Thank you! Actually, I was getting the assert because I used PromptOK in a Paint method. I shouldn't have done that.
Can I use ScreenDraw to draw on the screen as with Win API GetDC(0)? If yes, then probably I should extract the info I need at application startup and then discard the ScreenDraw instance.
I think I have everything that I need to add HeightPt() and GetHeightPt() to Font.
Also, except font antialiasing, is there any other missing tag from Qtf that is present in a font description?
[Updated on: Thu, 04 September 2008 05:03] Report message to a moderator
|
|
|
|
Re: Using Qtf forgets control font [message #17876 is a reply to message #17872] |
Mon, 01 September 2008 14:46 |
cbpporter
Messages: 1401 Registered: September 2007
|
Ultimate Contributor |
|
|
luzr wrote on Mon, 01 September 2008 14:37 |
IMO, no. In fact, "antialiasing" request sort of surprised me... OTOH, why not, there might be a use for it.
|
There are some CJK fonts under Linux which are completely unreadable with anti-aliasing, unless you use huge font size, where anti-aliasing doesn't really help in general. Also, since U++ kind of forces you to use Qtf for formated display, I think it makes no sense for it not to support all attributes of font.
|
|
|
|
Goto Forum:
Current Time: Fri Apr 26 21:31:17 CEST 2024
Total time taken to generate the page: 0.02687 seconds
|
|
|