Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Rich Edit Control and Fonts

Rich Edit Control and Fonts

Scheduled Pinned Locked Moved C / C++ / MFC
graphicshelptutorialquestion
2 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    Larry J Siddens
    wrote on last edited by
    #1

    I have on the screen a rich edit control (CRichEditCtrl) that needs to be printed/drawn on a different device. There is some graphics item also being drawn. I have tired different items to draw this text out and their results. These are:

    1. Using Format Range to output the text.
      • The text comes out looking good. It does not line up with the graphics that are displayed on the screen in a WYSIWYG format. As an example; drawing a line at the end of a string on the screen. When printed this same string/line does not line up as it appears on the screen. The height of the font (lines are drawn at top and bottom) seem to indicate that the font height is correct.
    2. Using ExtTextOut with Kerning pairs to output the text.
      • This palces the strings out nicely. The graphics looks pretty good when using variable pitch fonts.
      • Using Courier New Regular, it too looks pretty good.
      • Using Courier New Bold does not look good. The width of the text is smaller than it appears on the screen. The height again appears to be correct (with the line above the text and below).
    3. Using TextOut to output the text.
      • This does not even appear to be close!

    So, my question is there a better approach than the ones I have tried. I have the requirement to create a WYSIWYG editor that contains text/graphics. At first, I chose the Rich Text control so the users have the ability to change fonts within the control. With out using the FormatRange to print the text, I have to scan each character looking for a change in the font. The other problem, in the MSDN documentation, it states that to have a WYSIWYG text using the CRichEditCtrl, you need to associate the control with a printer. The problem is, when the user creates the document, this will not be known. I need to be able to have a device independent control and drawing. If you are interested in seeing the test code that I'm using, please email me and I can zip it up and send it. Any help would be appreciated. Larry J. Siddens Cornerstone Communications TAME THE DOCUMENT MONSTER www.unifier.biz

    L 1 Reply Last reply
    0
    • L Larry J Siddens

      I have on the screen a rich edit control (CRichEditCtrl) that needs to be printed/drawn on a different device. There is some graphics item also being drawn. I have tired different items to draw this text out and their results. These are:

      1. Using Format Range to output the text.
        • The text comes out looking good. It does not line up with the graphics that are displayed on the screen in a WYSIWYG format. As an example; drawing a line at the end of a string on the screen. When printed this same string/line does not line up as it appears on the screen. The height of the font (lines are drawn at top and bottom) seem to indicate that the font height is correct.
      2. Using ExtTextOut with Kerning pairs to output the text.
        • This palces the strings out nicely. The graphics looks pretty good when using variable pitch fonts.
        • Using Courier New Regular, it too looks pretty good.
        • Using Courier New Bold does not look good. The width of the text is smaller than it appears on the screen. The height again appears to be correct (with the line above the text and below).
      3. Using TextOut to output the text.
        • This does not even appear to be close!

      So, my question is there a better approach than the ones I have tried. I have the requirement to create a WYSIWYG editor that contains text/graphics. At first, I chose the Rich Text control so the users have the ability to change fonts within the control. With out using the FormatRange to print the text, I have to scan each character looking for a change in the font. The other problem, in the MSDN documentation, it states that to have a WYSIWYG text using the CRichEditCtrl, you need to associate the control with a printer. The problem is, when the user creates the document, this will not be known. I need to be able to have a device independent control and drawing. If you are interested in seeing the test code that I'm using, please email me and I can zip it up and send it. Any help would be appreciated. Larry J. Siddens Cornerstone Communications TAME THE DOCUMENT MONSTER www.unifier.biz

      L Offline
      L Offline
      Larry J Siddens
      wrote on last edited by
      #2

      I'm now trying to get the position of the characters in the control, then outputting them seperately. Seems better, the graphics is much closer to what is on the screen. It is off some (about 1/2 of a character.) I'm wondering if it is a round off error? Larry Larry J. Siddens Cornerstone Communications TAME THE DOCUMENT MONSTER www.unifier.biz

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups