- setting font of rich edit
- Posted by Allan Bruce on January 11th, 2005
I am trying to set the font of my RichEdit control so that only any new text
will be foramtted with the new font. I am using this at the moment:
SendMessage(mHwndDisplay, WM_SETFONT, (WPARAM)lFont, false);
but this causes all text already within the control to be set with this font
too. How can I avoid this?
Thanks
Allan
- Posted by Frank Adam on January 11th, 2005
On Tue, 11 Jan 2005 14:57:48 -0000, "Allan Bruce"
<abruce@TAKEMEAWAY.csd.abdn.ac.uk> wrote:
--
Regards, Frank
- Posted by Allan Bruce on January 11th, 2005
"Frank Adam" <fajp@notthis.optushome.com.au> wrote in message
news
nq7u09qt6feg4ru6cubb1i6i6u3og6j7m@4ax.com...
Hmm, this requires a CHARFOMRAT structure, wheras I am using
CreateFontInderect and just have a HFONT. Is there a way I can convert from
the HFONT to the CHARFORMAT?
Thanks,
Allan
- Posted by Allan Bruce on January 11th, 2005
"Frank Adam" <fajp@notthis.optushome.com.au> wrote in message
news
nq7u09qt6feg4ru6cubb1i6i6u3og6j7m@4ax.com...
Hmm, this requires a CHARFOMRAT structure, wheras I am using
CreateFontInderect and just have a HFONT and a LOGFONT. Is there a way I
can convert from
the HFONT or LOGFONT to the CHARFORMAT?
Thanks,
Allan
- Posted by Norman Bullen on January 12th, 2005
Allan Bruce wrote:
CHARFORMAT takes a few of the same parameters as LOGFONT but it's a lot
easier to use. Why wouldn't you prefer to use it, especially since it
has a capability the WM_SETFONT with an HFONT lacks?
Norm
--
--
To reply, change domain to an adult feline.
- Posted by Frank Adam on January 12th, 2005
On Tue, 11 Jan 2005 15:53:59 -0000, "Allan Bruce"
<abruce@TAKEMEAWAY.csd.abdn.ac.uk> wrote:
easily write one, or transfer the relevant members manually on the
fly.
As an easy out, try using EM_getcharformat to grab the current font
settings into the CHARFORMAT, then copy over the font's face name from
the LOGFONT and send it back with EM_setcharformat. That should change
the font only. All other properties, such as size, bold etc.. should
be preserved as they were with the previous font, so if you want some
of those changed as well, you'll have to copy those over too and set
the relevant flags before sending it back.
--
Regards, Frank
- Posted by Allan Bruce on January 12th, 2005
"Norman Bullen" <norm@BlackKittenAssociates.com.INVALID> wrote in message
news:HM1Fd.4780$pZ4.3875@newsread1.news.pas.earthl ink.net...
I use LOGFONT as I am using the ChooseFont() API for the user to select a
font.
Allan
- Posted by Allan Bruce on January 12th, 2005
"Frank Adam" <fajp@notthis.optushome.com.au> wrote in message
news:ivd9u0l5qro760h2s4jf3gnk3ev03idpte@4ax.com...
I have written a conversion between the two, however when I send an
EM_SETCHARFORMAT it still changes the whole RichEdit font, whether I use 0,
SF_ALL, SF_SELECTION, SF_DEFAULT as the wParam. Do you think I could copy
all the selection already in the RichEdit, then set the font, then paste my
selection back?
Thanks,
Allan
- Posted by Norman Bullen on January 12th, 2005
Allan Bruce wrote:
You can copy the necessary values from the LOGFONT to a CHARFORMAT.
Norm
--
--
To reply, change domain to an adult feline.