Results 1 to 10 of 10

Thread: How can I use DrawString to reproduce old Windows fonts precisely?

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Nov 2015
    Posts
    18

    How can I use DrawString to reproduce old Windows fonts precisely?

    I'm trying to use DrawString to recreate images like the one below. If I remember back that far, I'm pretty sure Windows 98 used to draw MS Sans Serif exactly like this. I'm having no luck reproducing this text exactly with DrawString, partly because I'm not 100% sure which font it is. I've tried DrawString with every 'famous' sans serif font on Graphics objects with various TextRenderingHint values, but with no luck. How can I programmatically draw strings identical to the ones in this image?

    Name:  txt.png
Views: 350
Size:  2.0 KB

  2. #2
    PowerPoster
    Join Date
    Oct 2010
    Posts
    2,141

    Re: How can I use DrawString to reproduce old Windows fonts precisely?


  3. #3

    Thread Starter
    Junior Member
    Join Date
    Nov 2015
    Posts
    18

    Re: How can I use DrawString to reproduce old Windows fonts precisely?

    I have actually, and a couple of other ones I found on Google. I've seen some search results that are similar (like Honda something or other font), but there's no way that any result I found was a standard Windows font back in the day. The key here is that this font is drawn with no anti-aliasing whatsoever; it was designed for the screen and is drawn pixel-for-pixel. Back in the day, that's how it was done. Even if my guess of MS Sans Serif is correct, the actual version of the font is different depending on one's OS (i.e. my current version of it draws anti-aliased at the same font size that its predecessor draws pixelated).

    Keeping that in mind, I'm wondering if there's a way to make DrawString look like the example image regardless of which OS it is. I realize that I could pre-store each possible character (as an image or a data collection) within a data collection, but I would need hundreds of image files to hold regular, bold, italic, and bold+italic versions of many ASCII characters. I'd only settle for something like this if it were the only way.

  4. #4
    Fanatic Member
    Join Date
    Jan 2006
    Posts
    557

    Re: How can I use DrawString to reproduce old Windows fonts precisely?

    I have done exactly that many years back. Well almost. The project had a dual purpose : to emulate the draw (I think) command of old GWbasic in order to print the complete lyrics of all Beatles songs on a 4x5 sheet of paper (a personal challenge, don't ask why).

    The font I ended up with (i call microfont) is actually smaller than the DOS font and also is proportional, with descenders. A few characters could be improved a bit.

    Quite a bit of work to design the font and the project is in VB6, so hardly compatible with .Net although not impossible.

    If you are interested in doing something similar, you can google : "Hershey fonts" and you will end up with many fonts that are now public domain. By design they are suitable with the draw string concept. Most of the code samples you will find nowadays (about Hershey fonts) is in C. I had my own GWbasic implementation (some 20 years ago) but it's now long gone. I am planning re-doing the Hershey fonts in VB one of these days.

    Here is a sample of my micro-font (100,200, 400%) in a non-aliased bitmap (assuming it is not scaled down to jpg by the forum software.

    Interesting project. Good luck with it.

    Name:  microfont.jpg
Views: 361
Size:  21.6 KB

    As I thought, the forum software messed it up... Oh well...
    Attached Images Attached Images  
    Last edited by Navion; Dec 12th, 2015 at 11:02 PM.

  5. #5

    Thread Starter
    Junior Member
    Join Date
    Nov 2015
    Posts
    18

    Re: How can I use DrawString to reproduce old Windows fonts precisely?

    Thanks for your suggestion. I've made fonts like that before (including this one recently), and it's time-consuming. But creating the font and installing it on the user's machine during setup may actually be the most efficient way of achieving my desired result.

    P.S. The attached font is effectively a monospace variant of the Unix font, but with a lot of added Unicode range. I designed it for my own coding uses
    Last edited by LogLady; Dec 12th, 2015 at 11:12 PM.

  6. #6
    Fanatic Member
    Join Date
    Jan 2006
    Posts
    557

    Re: How can I use DrawString to reproduce old Windows fonts precisely?

    Nice looking font. The matrix appears to be about 11x8, my own micro font is 7x5, so less pixels to work with and thus a little crude.

  7. #7

    Thread Starter
    Junior Member
    Join Date
    Nov 2015
    Posts
    18

    Re: How can I use DrawString to reproduce old Windows fonts precisely?

    Thanks! Through painstaking searches, I've identified the font as Tahoma version 2.30 (included with Windows 2000, Office 2000, and others). Even using this font, I can't make DrawString behave like Windows of old. New font it is then.

  8. #8
    Fanatic Member
    Join Date
    Sep 2002
    Posts
    527

    Re: How can I use DrawString to reproduce old Windows fonts precisely?

    Quote Originally Posted by LogLady View Post
    Even using this font, I can't make DrawString behave like Windows of old. New font it is then.
    What part of the behavior aren't you getting out of DrawString? I tried the standard tahoma (probably not version 2.30) on a test project, settings the TextRenderingHint of the forms graphics to SingleBitPerPixelGridFit and got this:

    Name:  TestDrawString.bmp
Views: 293
Size:  10.7 KB

    Characters are a bit more tall then your example, but I'm guessing it's the font version that does that (althought I may be wrong, which I'm often).
    Don't ask why, just reboot!

  9. #9
    Smooth Moperator techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,532

    Re: How can I use DrawString to reproduce old Windows fonts precisely?

    [off topic]
    I saw the Honda Center in the postings, wonder it was for... then saw Wes McCauley and thought aaahh! QUACK!
    Wish I could get there more often.
    [/off topic]



    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  10. #10
    You don't want to know.
    Join Date
    Aug 2010
    Posts
    4,578

    Re: How can I use DrawString to reproduce old Windows fonts precisely?

    I wish I understood the "why" here?

    Text is just plain easier to read when it's smoothed, and while higher DPI displays are nice, I'm glad on the cruddy "HD" resolution we settle for that Windows is smoothing them for me. So why try to recreate the bad old days?

    It sounds like I'm totally against it, but I bet there's some good reasons. If we knew the reasons, and the "why" instead of the "what", we could maybe think of something more out-of-the-box than "how to render this font with no hinting". (Truth be told though, fonts are not set in stone, and even the core Windows fonts have probably been updated over time. It may be impossible to perfectly reproduce them without creating your own Bitmap fonts, which would actually be copyright infringement.)
    This answer is wrong. You should be using TableAdapter and Dictionaries instead.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width