RichEdit Font

Just starting out? Need help? Post your questions and find answers here.
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by horst.

What is the proper way to calculate yHeight for the RichEdit Font?
I have:
a = SelectedFontSize()
b = GetDeviceCaps_(hDC,#LOGPIXELSY) ; after GetDC_(RichHandle)



Horst
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by El_Choni.

Code: Select all

a = cf\yHeight; selected font size in logical units (?)
b = GetDeviceCaps_(GetDC_(WindowID()),#LOGPIXELSY); system font metrics
result = (a*b)/1440
But I don't know exactly what you're looking for. If you're using the RichEdit library,

Code: Select all

cf\yHeight
sizes are divided by 20. That is,

Code: Select all

RichEditFontSize(10)
sets

Code: Select all

cf\yHeight
to 200.

Hope this helps, bye,

El_Choni
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by horst.

> cf\yHeight sizes are divided by 20. ...

That means:

cf\yHeight = SelectedFontSize() * 20

I did not find that in the API docs. I actually didn't
expect it to be that simple, because I was confused by
that GetDeviceCaps_(hDC,#LOGPIXELSY) stuff (which obviously
is not necessary).

Factor 20 seems to work with all resolutions incl. "large fonts".

BTW: I do not use the library, just want to change font/size.

Thanks!



Horst
Post Reply