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. C#
  3. MeasureString bug or feature

MeasureString bug or feature

Scheduled Pinned Locked Moved C#
3 Posts 2 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
    Lost User
    wrote on last edited by
    #1

    I've tried to use MeasureString function and noticed that it almost always returns size that is noticeably wider then the actual string. So, I was wondering if any one can comment on this behavior. Is it a bug or a feature ;) Also, does anybody else thinks that support for text output in .NET SDK is totally inadequate? How is one can change kerning or get character glyph?…

    A 1 Reply Last reply
    0
    • L Lost User

      I've tried to use MeasureString function and noticed that it almost always returns size that is noticeably wider then the actual string. So, I was wondering if any one can comment on this behavior. Is it a bug or a feature ;) Also, does anybody else thinks that support for text output in .NET SDK is totally inadequate? How is one can change kerning or get character glyph?…

      A Offline
      A Offline
      Andrei Zenkovitch
      wrote on last edited by
      #2

      Well, MeasureString have been broken in Beta 1 (it returned invalid result for some fonts). They fixed this problem in Beta 2. Still this function might be inadequate for precise measurement. I agree that .NET does not have enough power as far as text output goes (fonts, measurements). E.g. writing fully managed text editor with support for variety of fonts is an uphill battle (I would even say it is impossible). The only solution is to use P-Invoke to call into Windows SDK functions. I suspect that due to the fact that .NET is supposed to be appealing for cross-platform development they couldn't include any "Windows specific" functionality. Regards, Andrei Zenkovitch

      L 1 Reply Last reply
      0
      • A Andrei Zenkovitch

        Well, MeasureString have been broken in Beta 1 (it returned invalid result for some fonts). They fixed this problem in Beta 2. Still this function might be inadequate for precise measurement. I agree that .NET does not have enough power as far as text output goes (fonts, measurements). E.g. writing fully managed text editor with support for variety of fonts is an uphill battle (I would even say it is impossible). The only solution is to use P-Invoke to call into Windows SDK functions. I suspect that due to the fact that .NET is supposed to be appealing for cross-platform development they couldn't include any "Windows specific" functionality. Regards, Andrei Zenkovitch

        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #3

        Thanks for the info Andrei! I did figure as much myself. Unfortunately I was trying to create text editor with extra features not found in RichEdit and for now I had to abandon it. I hope Microsoft reconsiders their decision about text output support (or lack of it) in .NET. As for Windows SDK, if I have to use it I'd rather use it from C++. Cheers. P.S. I am using Beta2 VS.NET

        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