Thread: Problem with default font in graphical mode

  1. #1
    Registered User
    Join Date
    Oct 2008
    Posts
    10

    Problem with default font in graphical mode

    I`m working on c program which is working in graphical mode. I use Turbo C 3.0 IDE. Until recently everything was ok, but then i gave my laptop away to the service. So I temporary borrowed one and problems apeared. Before starting the work I had to install Windows XP cause i can`t open dos graphics in full-screen in Vista. Problem is that every character except letters and 0 is printed malformed. Here is output of small graphics test program printing chars from ASCII code 32 - 255:
    Output in graphics mode
    Same in text mode:
    Output in text mode
    This is so even for program versions compiled on the previous computer (they were working as they should then).

    If i change to any other font and compile program problem is gone. That could be workaround ,but I want to understand where is the problem and if possible to use default font.
    Last edited by voldemarz; 10-24-2008 at 06:44 AM.

  2. #2
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    I haven't looked at your "output" because the links appear to be broken (or perhaps I need to be logged in to Daniweb to see them), but I think the problem is directly related to codepages and fonts. Different fonts and different codepages translate to different characters depending on what font you use. So in full-screen mode, you use the standard VGA font [unless you specifically upload a different one to your VGA card]. In Windows command prompt, you are using the "terminal" font.

    There are differences between these fonts.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  3. #3
    Registered User
    Join Date
    Oct 2008
    Posts
    10
    I edited those links, should work now.

    So can I solve that problem? Why on my previous pc VGA font was different (working fine)? That pc also had basically fresh XP, just 2 moths old. I didn`t change any settings for cmd.

  4. #4
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    The first picture looks like you either are using some weird codepage (are those symbols something you recognise - it certainly doesn't look like digits and special characters to me - but perhaps they mean something in some language I don't know).

    If it's a codepage setting, then you can fix it. If it's some general corruption, I guess a re-install of the OS would help. Or if you can figure out which font it is, copy the font definition from some other system to your machine.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  5. #5
    Registered User
    Join Date
    Oct 2008
    Posts
    10
    I have no idea what are those first symbols, they should be same as text mode output.

    I doubt reinstall of OS will help.. Actually today I changed pc again (forgot to mention) form that temporary to one i`ll have to use till I get my original laptop back. And it`s the same here also.

    I send that test program to a friend and he also got those weird chars. He said he had that problem also before (when he was doing the same assignment) and he just changed font in c.

    I tried it also at school. It was the same there. Teacher also didn`t what is the problem....
    Last edited by voldemarz; 10-24-2008 at 07:21 AM.

  6. #6
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Ah, hang on, you are using the fonts supplied by Borland, yes? If so, perhaps re-installing the compiler and/or rebuilding the executable is the right thing to do...

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  7. #7
    Registered User
    Join Date
    Oct 2008
    Posts
    10
    No. I`m using default font. If i change to any Borland`s font then it`s working.
    At the beginning, I tried other compilers, downloaded fresh Borland C and then also Turbo C

    Here is the test program and source code if you`re willing check:
    Graphics test
    Last edited by voldemarz; 10-24-2008 at 08:04 AM.

  8. #8
    Registered User
    Join Date
    Oct 2008
    Posts
    10
    As i said, programs compilded on my original laptop were working there fine, also had those weird char on all other machines. Basically every machine I tried have those weird chars even when i recompile that simple code there.

  9. #9
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Quote Originally Posted by voldemarz View Post
    As i said, programs compilded on my original laptop were working there fine, also had those weird char on all other machines. Basically every machine I tried have those weird chars even when i recompile that simple code there.
    So where do you get the compiler from? Perhaps your installation disk contains bad file(s)? Windows doesn't come with a pre-installed Turbo C, so you must be getting it from somewhere.

    The other option is that your code itself actually overwrites those fonts with garbage.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  10. #10
    Registered User
    Join Date
    Oct 2008
    Posts
    10
    First I just coppied it from my original laptop before giving it away to service. On first usage those strange chars apeared, then I asked a friend to send his compiler. It also had the same problem. So then I downloaded from internet. Failed to find the same page now.

    I doubt it`s the problem with compiler, cause I coppied working compiler form school`s computer. Weird chars didn`t go away. Previously I said that on school`s computer there were also weird chars. Dunno why i said that. On school computers that program is working fine.

    I guess it can`t be overwriting problem either. Weird char thing happens even when you try simple outtext("1")

  11. #11
    Registered User
    Join Date
    Oct 2008
    Posts
    10
    Even simpler test code:
    Code:
    main()
    {
      int gDriver=3,gMode=1; //650x350
      initgraph(&gDriver,&gMode,"");
      outtext("1");
      closegraph();
      getch();
      return 0;
    }

  12. #12
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Then I have no suggestions left.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  13. #13
    Registered User
    Join Date
    Oct 2008
    Posts
    10
    I thought maybe it`s because of some OS language settings, they`re set to latvian ("standards and formats" setting and "language for non-unicode programs" setting under "language and reagional settings"). Set them to english, but no change...

    Now i`m reading about code pages in wikipedia. I guess something is wrong there. But weird, only first special symbols and numbers are affected.

    Here is some guy having the same problem, but no solution, he just changed to Borland font.

  14. #14
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    What are you going to do when you run into the next "incompatibility" with your OS?
    - Y2K perhaps (jeez, how out of touch are you?)
    - long filenames, or filenames with spaces?
    - better graphics than your mobile phone - yes, phones have better processors and graphics today than when a slow X86 with DOS and TurboC was considered "the best ........ in town".
    - maybe networking - ROFLMAO

    I dunno, people shell out $$$ for XP, then can't be bothered to spend a further $0 installing any one of the number of FREE high quality 32-bit compilers which are actually compatible with the OS they're running on.

    No, I can't understand it either Dororthy, it's just some big old timewarp. Personally, I blame all the "teachers" who teach to an implementation (the one they know, and can't be arsed(*) to update their skills), rather than teaching the language in a proper Compiler/OS agnostic manner.

    (*)Actually, I think some of them have tried, but having found what they "knew" didn't work, they blamed the compiler rather than their poor knowledge. The end is still the same though, generations of nascent programmers with useless skills.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  15. #15
    Registered User
    Join Date
    Oct 2008
    Posts
    10
    You think I`m doing this cause I`m bored? I`m sick of this assignment cause I have spend already a lot of time on it solving stupid problems. So I`m not going to change the way I want to make this program because of some incompatibility, especially as stupid as this one.

    As far as I understand this problem actually isn`t connected with programming, but more with Windows configuration...

    If you`re as smart as you think maybe you can give some advice or at least guide into the right direction?
    Last edited by voldemarz; 10-24-2008 at 11:13 AM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Default Button Problem
    By Dark Dude in forum Windows Programming
    Replies: 5
    Last Post: 12-25-2008, 08:06 PM
  2. default font
    By larry in forum Windows Programming
    Replies: 2
    Last Post: 02-13-2003, 05:22 AM
  3. opengl code not working
    By Unregistered in forum Windows Programming
    Replies: 4
    Last Post: 02-14-2002, 10:01 PM
  4. setting default font to draw all further controls with
    By alandrums in forum Windows Programming
    Replies: 0
    Last Post: 12-03-2001, 10:31 PM
  5. problem going into mode 13h
    By ArseMan in forum C++ Programming
    Replies: 5
    Last Post: 08-31-2001, 04:53 PM