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: 14291 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: 1428 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: 1428 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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| Re: Using Qtf forgets control font [message #18113 is a reply to message #18087] |
Wed, 10 September 2008 20:46   |
 |
mirek
Messages: 14291 Registered: November 2005
|
Ultimate Member |
|
|
| cbpporter wrote on Wed, 10 September 2008 00:07 | I tested under Win and rounding seems OK but must be done in all conversion functions. Must test under Linux too.
I noticed that for testing purposes is is a fair assessment to consider StdFont as Arial.
|
Nope, I Win32 it is taken from the system, in XP it is Tahoma (in older Win, it is MS Sans Serif).
| Quote: |
Does this apply to X11 also?
|
It is also taken in X11. Anyway, in X11, "system" font usually is the same font chosen for "Arial".
| Quote: |
And if for some strange reason the only font that I have is Wingdings, will StdFont default to Wingdings? 
|
If Wingdings are set as system font, then yes:)
However, you would not be able to start U++ app without "three basic fonts" - Arial, Roman, Courier. On Win32 they are required. (and on X11, equivalents are always defined in fontconfig).
Mirek
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| Re: Using Qtf forgets control font [message #18160 is a reply to message #18142] |
Sat, 13 September 2008 19:19  |
cbpporter
Messages: 1428 Registered: September 2007
|
Ultimate Contributor |
|
|
I finally found the bug. It is really stupid actually. My fault.
I spent almost two hours removing classes and files one by one so that I could create a small test package. The bug just wouldn't go away, even when all I had were two classes with 5 lines each, just doing some simple layouting.
Then I found it! My bottom frame class was in it's own file and somewhere in that .cpp between function definitions was a:
That little line than must have been left over form earlier testing caused all the exaggerated font zooming. It is really funny actually, if you don't consider the time went into investigating this.
Anyway, false alarm. Need to be more careful with such dangerous thing like ScreenDraw. Now I can get back to solving my real font issues, like finding a replacement for ScreenDraw for starters.
|
|
|
|
Goto Forum:
Current Time: Tue May 05 21:13:40 GMT+2 2026
Total time taken to generate the page: 0.01203 seconds
|