Terminal font & codepage 437

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
einstein1969
Expert
Posts: 961
Joined: 15 Jun 2012 13:16
Location: Italy, Rome

Terminal font & codepage 437

#1 Post by einstein1969 » 19 Aug 2015 20:40

I probed to display the chars in this articles

Image

using dbenham char macros

With the Lucida console all work but if I choose Terminal Font don't work!

I want use the Terminal font because the "shadow char" are better.

Why the terminal font in codepage 437 don't show the same characters above (shadow chars+others)?

It's possible a workaround? Can anyone test and post results?

Code: Select all

@echo off

setlocal disableDelayedExpansion

For %%C in (437 850 1252) do (
  chcp %%C
  call charMacros
  call :print
  echo(
)

pause>nul

exit /B

:print
setlocal enableDelayedExpansion
  set "S="
  for /l %%N in (0 1 255) do (
    set /A "r=%%N %% 32"
    if !r! equ 0 echo(!S!&set "S="
    %@chr% %%N c
    for %%E in (0 7 8 9 10 13) do if %%N equ %%E set "S=!S! "&&(call)
    if NOT !Errorlevel! equ 1 set S=!S!!c!
  )
  echo(!S!
endlocal
exit /B


I think that American PC (like Dbenham's PC) can view the codepage 437 in terminal font without problem. It's right?

my result:
Image

Einstein1969

Liviu
Expert
Posts: 470
Joined: 13 Jan 2012 21:24

Re: Terminal font & codepage 437

#2 Post by Liviu » 20 Aug 2015 10:35

Terminal is a raster font, and is codepage specific. In your case the OEM codepage of the Windows installation is 850, and Terminal matches Lucida Console under chcp 850. That's the expected behavior, see for example http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/chcp.mspx?mfr=true: "Only the original equipment manufacturer (OEM) code page installed with Windows XP appears correctly in a command prompt window that uses Raster fonts".

You might try to change the default OEM codepage to 437 via "change language for non-unicode programs" to English-US somewhere in Control Panel under Regional settings depending on Windows version. But that's a system wide setting and could have unexpected side effects.

Liviu

penpen
Expert
Posts: 2009
Joined: 23 Jun 2013 06:15
Location: Germany

Re: Terminal font & codepage 437

#3 Post by penpen » 20 Aug 2015 15:11

You could create your own fonts like Carlos, who has created some pixelfonts and a loader:
http://www.dostips.com/forum/viewtopic.php?f=3&t=6254
(At the bottom there is a link to a font format description.)


penpen

einstein1969
Expert
Posts: 961
Joined: 15 Jun 2012 13:16
Location: Italy, Rome

Re: Terminal font & codepage 437

#4 Post by einstein1969 » 25 Aug 2015 15:11

@Liviu

Thanks for this information.

So the choice of the raster font is the worst choice to make if you want to write an application that is executed in the same way on different PCs around the world?

and so in the case of raster fonts choosing the codepage it is irrelevant?

In addition to changing the locale settings there is no way to programmatically check if we are on a machine that can not display a given character / glyph?


@penpen

Thanks for point me in this direction. I will use the Carlos's fonts but after there is no other possibility
or as an option.

einstein1969

Liviu
Expert
Posts: 470
Joined: 13 Jan 2012 21:24

Re: Terminal font & codepage 437

#5 Post by Liviu » 25 Aug 2015 20:54

einstein1969 wrote:So the choice of the raster font is the worst choice to make if you want to write an application that is executed in the same way on different PCs around the world?
Pretty much, yes.

einstein1969 wrote:and so in the case of raster fonts choosing the codepage it is irrelevant?
As far as output goes, yes. The active codepage still affects input translation (try for example entering the ALT+224 and ALT+0224 characters in codepages 437, 850, 1252).

einstein1969 wrote:In addition to changing the locale settings there is no way to programmatically check if we are on a machine that can not display a given character / glyph?
Not from batch language.

Liviu

Post Reply