1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Strange results with CP 1252

Discussion in 'Support' started by vefatica, Apr 26, 2009.

  1. vefatica

    Joined:
    May 20, 2008
    Messages:
    5,654
    Likes Received:
    11
    I have set HKCU\Console\CodePage equal to 1252. 1252 is now the value of CP_ACP inside a plugin. If I

    Code:
        WCHAR x;
        CHAR y = 160;
        WideCharToMultiByte(CP_ACP, 0, &x, 1, &y, 1, NULL, FALSE);
        Printf(L"*%c*\r\n", y);
    I get the non-breaking space character as expected.

    But if I

    Code:
    ECHO %@CHAR[160]
    I get a lowercase a with acute accent. This also shows up in LIST's banner, where the first two characters are meant to be nbsp but show up as lowercase a with acute accent.

    Why is this happening?
     
    #1
  2. vefatica

    Joined:
    May 20, 2008
    Messages:
    5,654
    Likes Received:
    11
    P.S. I use the 8x12 raster font.

     
    #2
  3. rconn

    rconn Administrator
    Staff Member

    Joined:
    May 14, 2008
    Messages:
    7,400
    Likes Received:
    27
    vefatica wrote:

    I never recommend using a raster font; they're always ASCII and you're
    inevitably going to have problems with Unicode-to-ASCII conversions.

    Rex Conn
    JP Software
     
    #3
  4. vefatica

    Joined:
    May 20, 2008
    Messages:
    5,654
    Likes Received:
    11
    CP 1252 has the nbsp (at 160), the raster fonts (which I've always used) have it (at 160) and it's Unicode character 160. The console is using CP 1252; TCC is using CP 1252. How is it getting turned into "a" with acute accent?

    Can you recommend a TrueType/Unicode font, 8x12, that looks as good as the raster font? I have Lucida Console, Courier New, and Andale Mono set as console fonts. The raster font is the clear winner IMO.
     
    #4
  5. samintz

    samintz Scott Mintz

    Joined:
    May 20, 2008
    Messages:
    904
    Likes Received:
    4
    Ever since v9 came out and Rex recommended against raster fonts, I've been
    using "DejaVu Sans Mono".

    I've tried "Lucida Console", "Lucida Sans Typewriter", "Andale Mono",
    "Bitstream Vera Sans Mono", "Consolas", and a few others. But I've gotten
    accustomed to the DejuVu font. I still use Terminal when running TCC
    stand-alone though. Old habits I guess...

    -Scott


    vefatica <> wrote on 04/26/2009 11:56:20 PM:


     
    #5
  6. vefatica

    Joined:
    May 20, 2008
    Messages:
    5,654
    Likes Received:
    11
    Scott, with DejaVu can you get bold fonts? I tried DejaVu Sans Mono and the "Bold" checkbox did nothing. I tried adding DejaVu Sans Mono Bold to the list of console fonts but it didn't show up.
     
    #6
  7. samintz

    samintz Scott Mintz

    Joined:
    May 20, 2008
    Messages:
    904
    Likes Received:
    4
    Yes. I definitely see a difference. I know that Terminal is a "bold"
    font. But I find that the normal DejaVu font works quite nicely for me.

    There is a difference between the font size as specified for a stand-alone
    console vs. TC. It's like the units are different or something.

    These are the DejaVu fonts I have installed on my system in the
    Windows\Fonts directory:
    10/22/2006 16:06 453,976 DejaVuSans-Bold.ttf
    10/22/2006 16:06 428,976 DejaVuSans-BoldOblique.ttf
    10/22/2006 16:06 131,476 DejaVuSans-ExtraLight.ttf
    10/22/2006 16:06 421,964 DejaVuSans-Oblique.ttf
    10/22/2006 16:06 480,104 DejaVuSans.ttf
    10/22/2006 16:06 419,508 DejaVuSansCondensed-Bold.ttf
    10/22/2006 16:06 397,632 DejaVuSansCondensed-BoldOblique.ttf
    10/22/2006 16:06 386,984 DejaVuSansCondensed-Oblique.ttf
    10/22/2006 16:06 428,284 DejaVuSansCondensed.ttf
    10/22/2006 16:06 229,460 DejaVuSansMono-Bold.ttf
    10/22/2006 16:06 177,780 DejaVuSansMono-BoldOblique.ttf
    10/22/2006 16:06 184,896 DejaVuSansMono-Oblique.ttf
    10/22/2006 16:06 237,476 DejaVuSansMono.ttf
    10/22/2006 16:06 197,352 DejaVuSerif-Bold.ttf
    10/22/2006 16:06 180,252 DejaVuSerif-BoldOblique.ttf
    10/22/2006 16:06 179,144 DejaVuSerif-Oblique.ttf
    10/22/2006 16:06 209,936 DejaVuSerif.ttf
    10/22/2006 16:06 176,176 DejaVuSerifCondensed-Bold.ttf
    10/22/2006 16:06 180,212 DejaVuSerifCondensed-BoldOblique.ttf
    10/22/2006 16:06 178,976 DejaVuSerifCondensed-Oblique.ttf
    10/22/2006 16:06 174,664 DejaVuSerifCondensed.ttf

    And I have the following entries in my registry for the console:
    Windows Registry Editor Version 5.00

    [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Console]

    [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows
    NT\CurrentVersion\Console\Nls]
    "00000409"=""

    [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows
    NT\CurrentVersion\Console\TrueTypeFont]
    "0"="Lucida Console"
    "00"="Andale Mono"
    "000"="DejaVu Sans Mono"

    -Scott


    vefatica <> wrote on 04/27/2009 01:56:33 PM:


     
    #7
  8. vefatica

    Joined:
    May 20, 2008
    Messages:
    5,654
    Likes Received:
    11
    |Yes. I definitely see a difference. I know that Terminal is a "bold"
    |font. But I find that the normal DejaVu font works quite nicely for me.

    |There is a difference between the font size as specified for a stand-alone
    |console vs. TC. It's like the units are different or something.

    I have all those fints installed also (from SourceForge).

    Do you see a difference when you check "Bold" for DejaVu? I don't. And putting 000 DejaVu Sans Mono Bold as a separate registry entry doesn't work.
     
    #8
  9. Charles Dye

    Charles Dye Super Moderator
    Staff Member

    Joined:
    May 20, 2008
    Messages:
    2,767
    Likes Received:
    18
    It works for me: http://www.unm.edu/~cdye/dl/dejavu-console.jpg

    No, you don't need (and shouldn't have) a separate registry entry for the bold weight.
     
    #9
  10. samintz

    samintz Scott Mintz

    Joined:
    May 20, 2008
    Messages:
    904
    Likes Received:
    4
    Yes - I definitely see a difference in btoh TC and stand-alone..

    -Scott

    vefatica <> wrote on 04/27/2009 05:39:05 PM:


    me.

    stand-alone

     
    #10
  11. vefatica

    Joined:
    May 20, 2008
    Messages:
    5,654
    Likes Received:
    11
    On Mon, 27 Apr 2009 17:14:21 -0500, Charles Dye <> wrote:

    |No, you don't need (and shouldn't have) a separate registry entry for the bold weight.

    I figured that. But checking "Bold" for DejaVu doesn't work (though it works in
    the preview).

    Another annoying thing is that when I set the font to DejaVu 16, then every time
    I open the properties dialog (even future sessions) I get several message boxes
    announcing that the point size should be between 5 and 72.
    --
    - Vince
     
    #11
  12. Charles Dye

    Charles Dye Super Moderator
    Staff Member

    Joined:
    May 20, 2008
    Messages:
    2,767
    Likes Received:
    18
    Something's borked in your console fonts. Not surprising; I suspect Microsoft did very little testing of that code. I would suggest:

    Uninstall *all* of the DejaVu fonts. Remove all of the entries for DejaVu under HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Console. Reboot.

    Install *only* DejaVuSansMono.ttf -- not any of the others. Reboot.

    Add the registry entry for DejaVu under the Console key, and reboot again (yes, this is tedious....) Test that DejaVu works correctly in the console. If so, then go ahead and reinstall the bold, italic, etc. variants.
     
    #12
  13. vefatica

    Joined:
    May 20, 2008
    Messages:
    5,654
    Likes Received:
    11
    On Mon, 27 Apr 2009 17:51:01 -0500, Charles Dye <> wrote:

    |Uninstall *all* of the DejaVu fonts. Remove all of the entries for DejaVu under HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Console. Reboot.
    |
    |Install *only* DejaVuSansMono.ttf -- not any of the others. Reboot.
    |
    |Add the registry entry for DejaVu under the Console key, and reboot again (yes, this is tedious....) Test that DejaVu works correctly in the console. If so, then go ahead and reinstall the bold, italic, etc. variants.

    Quite a rigmarole! ... but it worked ... thanks. Now I have DejaVu plus bold.
    First impression ... eh! ... I like the raster fonts, but I'll give it a chance.
    --
    - Vince
     
    #13

Share This Page