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
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Problem with ClearType text in custom control

Problem with ClearType text in custom control

Scheduled Pinned Locked Moved C / C++ / MFC
questiongraphicshelpjsonperformance
3 Posts 3 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.
  • W Offline
    W Offline
    WarnerYoung
    wrote on last edited by
    #1

    I'm running into a problem that seems like it must be solvable, but I can't find any documentation that explains it. The basics: I have a custom control that uses a bitmap for a background (either created programmatically, or by loading a resource or file). This is done in an off-screen memory DC to avoid flickering. After the bitmap is rendered, I render some text onto it using DrawText() API. When it's done, the whole thing is blitted back onto the screen. The problem: When ClearType is enabled, the text looks ugly, almost as if every letter has a black outline around it. I'm guessing this is the sub-pixel antialiasing stuff, which has somehow turned black when I blit from the memory DC to the screen. Question: how can I allow and use ClearType in my control and still have it look okay? Apps like IE and Firefox handle ClearType correctly, and I'm pretty sure they're using some kind of off-screen double-buffering scheme for drawing, so it seems to me there should be a way to do it. But I'm darned if I can figure out how. Thanks in advance for any help, Warner Young

    W J 2 Replies Last reply
    0
    • W WarnerYoung

      I'm running into a problem that seems like it must be solvable, but I can't find any documentation that explains it. The basics: I have a custom control that uses a bitmap for a background (either created programmatically, or by loading a resource or file). This is done in an off-screen memory DC to avoid flickering. After the bitmap is rendered, I render some text onto it using DrawText() API. When it's done, the whole thing is blitted back onto the screen. The problem: When ClearType is enabled, the text looks ugly, almost as if every letter has a black outline around it. I'm guessing this is the sub-pixel antialiasing stuff, which has somehow turned black when I blit from the memory DC to the screen. Question: how can I allow and use ClearType in my control and still have it look okay? Apps like IE and Firefox handle ClearType correctly, and I'm pretty sure they're using some kind of off-screen double-buffering scheme for drawing, so it seems to me there should be a way to do it. But I'm darned if I can figure out how. Thanks in advance for any help, Warner Young

      W Offline
      W Offline
      Waldermort
      wrote on last edited by
      #2

      I had a similar problem the other day, i found the cause was when drawing of screen, I didn't create a compatible bitmap with the main DC. Have a look at how you are implememnting your double buffer, the problem may be there.

      1 Reply Last reply
      0
      • W WarnerYoung

        I'm running into a problem that seems like it must be solvable, but I can't find any documentation that explains it. The basics: I have a custom control that uses a bitmap for a background (either created programmatically, or by loading a resource or file). This is done in an off-screen memory DC to avoid flickering. After the bitmap is rendered, I render some text onto it using DrawText() API. When it's done, the whole thing is blitted back onto the screen. The problem: When ClearType is enabled, the text looks ugly, almost as if every letter has a black outline around it. I'm guessing this is the sub-pixel antialiasing stuff, which has somehow turned black when I blit from the memory DC to the screen. Question: how can I allow and use ClearType in my control and still have it look okay? Apps like IE and Firefox handle ClearType correctly, and I'm pretty sure they're using some kind of off-screen double-buffering scheme for drawing, so it seems to me there should be a way to do it. But I'm darned if I can figure out how. Thanks in advance for any help, Warner Young

        J Offline
        J Offline
        Justin Tay
        wrote on last edited by
        #3

        Is the bitmap that is selected in the memory dc a bitmap that is compatible with the screen? Or did you just select the bitmap that you created/loaded into the memory dc and try to draw the text that way? Some sample code would help since I don't have any problem drawing cleartype enabled text on my doublebuffered controls.

        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