Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ Core » Convert upp Font size to LOGFONT size
Convert upp Font size to LOGFONT size [message #15151] Thu, 03 April 2008 00:54 Go to next message
mobilehunter is currently offline  mobilehunter
Messages: 87
Registered: November 2006
Member
Hi i did this inside RichEdit control, RichEdit just an example.
The problem was size of font.

LOGFONT lf;
FontInfo fi = formatinfo.Info();
ImmGetCompositionFont(hIMC,&lf);
lf.lfHeight = -DotToPt(formatinfo.GetHeight());
//font size will follow current font setting
ImmSetCompositionFont(hIMC, &lf);


The result was character inside IME window displayed smaller.
Is there any way to make character size inside IME window to have the same size as what richedit displayed?
Re: Convert upp Font size to LOGFONT size [message #15161 is a reply to message #15151] Sun, 06 April 2008 05:29 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Why DotToPt?

Anyway, IMO, if you use what is used in

FontInfo Draw::Acquire(Font font, HDC hdc, int angle, int device)

you should get equal results (CreateFont is used there, but the formula for font height ougth to be the same).

That is:

font.GetHeight() ? -abs(font.GetHeight()) : -12, font.GetWidth()

(do not ask... Smile

Mirek
Re: Convert upp Font size to LOGFONT size [message #15162 is a reply to message #15161] Sun, 06 April 2008 05:31 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Ah, I see - are you supposed to put there points instead of pixels?

Well, even in that case, your formulae is wrong. IMO, you will have to take into acount actual screen DPI (dots are fixed at 600dpi, which is not screen resolution).

Mirek
Re: Convert upp Font size to LOGFONT size [message #15184 is a reply to message #15162] Tue, 08 April 2008 05:18 Go to previous messageGo to next message
mobilehunter is currently offline  mobilehunter
Messages: 87
Registered: November 2006
Member
I got this formula from MSDN
fontHeight=-MulDiv(DotToPt(formatinfo.GetHeight()), GetDeviceCaps(hdc, LOGPIXELSY), 72);


I just compared the UWord and WordPad for the font size using visual cues only, bad comparison though:).
It seems font size inside UWord bigger than WordPad. I compared using english alphabet.

I also compared the character inside WordPad with character inside UWord's IME window, both have the same size.

[Updated on: Tue, 08 April 2008 08:17]

Report message to a moderator

Re: Convert upp Font size to LOGFONT size [message #15219 is a reply to message #15184] Thu, 10 April 2008 05:24 Go to previous message
mobilehunter is currently offline  mobilehunter
Messages: 87
Registered: November 2006
Member
Hi Mirek.

Today a learned another thing called Zoom from RichEdit control.
So it will make character displayed inside UWord bigger.
I didn't consider this factor when calculating the font height for IME window.

case closed Smile

Thanks.
Previous Topic: What about "::" in LoadIniFile?
Next Topic: [BUG] CommandLine() returns non-unicode arguments
Goto Forum:
  


Current Time: Fri Mar 29 13:31:58 CET 2024

Total time taken to generate the page: 0.01797 seconds