Thread: Font issues in rich edit control

  1. #1
    mustang benny bennyandthejets's Avatar
    Join Date
    Jul 2002
    Posts
    1,401

    Font issues in rich edit control

    I'm trying to make small, superscript characters in a rich edit control, but I'm having problems. I cannot get the font small enough. Basically I can put any value for yHeight, but it doesn't do anything unless the value is quite large, in which case it makes the font huge. Here is my code:
    Code:
    CHARFORMAT cfFormat;
    
    cfFormat.dwMask=CFM_OFFSET|CFM_SIZE;
    cfFormat.cbSize=sizeof(CHARFORMAT);
    cfFormat.yOffset=100;
    cfFormat.yHeight=1;
    	
    SendMessage(hwnd,EM_SETCHARFORMAT,(WPARAM)SCF_SELECTION,(LPARAM)&cfFormat);
    Are there any problems with that code?
    [email protected]
    Microsoft Visual Studio .NET 2003 Enterprise Architect
    Windows XP Pro

    Code Tags
    Programming FAQ
    Tutorials

  2. #2
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,981
    I googled for "superscript rich edit" and found some interesting comments at this site:
    http://www.codeguru.com/Cpp/controls.../?thread=30510

    Perhaps the font you're using is incapable of rendering that small....

    gg

  3. #3
    mustang benny bennyandthejets's Avatar
    Join Date
    Jul 2002
    Posts
    1,401
    I've used a couple different fonts, so it might not be the font. That site you directed me seemed to deal with what proportions one should use, not how to fix my problem. Thanks anyway.

    One other thing I've found, if I retrieve the font size using EM_GETCHARFORMAT, it is the same value, 257, no matter what I've set the font to. This happens even when the font is set to something like 700, which actually makes it really big.

    EDIT: Actually, when using EM_GETCHARFORMAT, no useful information is returned. What is going here?
    [email protected]
    Microsoft Visual Studio .NET 2003 Enterprise Architect
    Windows XP Pro

    Code Tags
    Programming FAQ
    Tutorials

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. edit control text buffer
    By scurvydog in forum Windows Programming
    Replies: 4
    Last Post: 12-11-2008, 10:13 AM
  2. (Multiline) Edit Control Limit
    By P4R4N01D in forum Windows Programming
    Replies: 9
    Last Post: 05-17-2008, 11:56 AM
  3. sending something to a rich edit control without keyboard
    By RancidWannaRiot in forum Windows Programming
    Replies: 1
    Last Post: 11-21-2005, 08:53 AM
  4. Changing font in rich edit, without affecting undo buffer
    By jverkoey in forum Windows Programming
    Replies: 3
    Last Post: 01-17-2004, 08:54 PM
  5. Rich edit control example Win API
    By Echidna in forum Windows Programming
    Replies: 1
    Last Post: 09-17-2001, 02:12 AM