Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add more default Windows-1252 characters #23

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 16 additions & 11 deletions man/scummtr.1
Original file line number Diff line number Diff line change
Expand Up @@ -74,15 +74,20 @@ Translation file will be handled in binary mode, instead of text.
.Pp
Note that this makes most other options inoperative.
.It Fl c
Translation file will be handled as Windows-1252, allowing easier use of
some Western European characters.
Translation file will be handled as Windows-1252 (or ISO-8859-1),
allowing easier use of some Western European characters.
Without
.Fl c ,
non-ASCII characters will be handled as escape sequences.
non-ASCII characters can only be used through escape sequences.
.Pp
Note that SCUMM games only supported their own smaller subset of the
the official Windows-1252 table (which is mainly compatible with
ISO-8859-1).
Note that SCUMM games only include an incomplete subset of the MS-DOS
CP 850 code page, with some local modifications.
.Nm
translates this code page to Windows-1252, but doesn't add the
missing characters to the internal fonts.
Use
.Xr scummfont 1
for this.
.It Fl f Ar file
The path to the translation file (default:
.Pa scummtr.txt ) .
Expand All @@ -93,12 +98,12 @@ The ID of the game variant to be translated, as given by
Include a small header at the start of each line, indicating the internal script
context of the current string.
.It Fl H
Represent extended characters as hexadecimal codes, instead of decimal codes.
Represent escape sequences as hexadecimal codes, instead of decimal codes.
.It Fl I
Include the current SCUMM instruction opcode, before each line.
.It Fl l Ar language
V1 and V2 games only.
The name of the language charset to be used for this translation.
V1 and V2 games only (i.e. all games before Zak McKracken FM-TOWNS).
The name of the language character set to be used for this translation.
.Pp
Possible values are:
.Bl -tag -width Ds
Expand Down Expand Up @@ -157,8 +162,8 @@ See also
.Xr scummfont 1
in order to visualize or modify the included font tables.
.Pp
Unicode files are not supported, and non-Roman languages need
some extra work for convenient use.
Unicode files are not supported, and non-Roman languages cannot
be easily typed, since escape sequences are required.
.Pp
On case-sensitive file systems, game data files must currently
follow the DOS convention of being all-uppercase to be properly
Expand Down
34 changes: 22 additions & 12 deletions src/ScummTr/text.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,11 @@ const char Text::CT_V1EN[256] =
{
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
' ', '!', '"', '#', '$', '\x85', '&', '\'', '(', ')', '*', '+', ',', '-', '.', '/', // XXX: \x85
' ', '!', '"', '#', '$', 0, '&', '\'', '(', ')', '*', '+', ',', '-', '.', '/',
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', ':', ';', '<', '\xa9', '>', '?',
'@', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O',
'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '[', '\xa3', ']', '^', 0,
'"', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o',
'`', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o',
'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Expand All @@ -73,7 +73,7 @@ const char Text::CT_V1DE[256] =
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', ':', ';', '<', '\xa9', '>', '?',
'@', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O',
'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '\xfc', '\xe4', '\xdc', '^', 0,
'"', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o',
'`', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o',
'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '\xf6', '\xc4', '\xd6', '\xdf', 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Expand All @@ -93,7 +93,7 @@ const char Text::CT_V1FR[256] =
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', ':', ';', '\xe0', '\xe2', '\xe7', '?',
'@', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O',
'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '\xe9', '\xe8', '\xea', '^', '\xef',
'"', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o',
'`', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o',
'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '\xee', '\xf4', '\xf9', '\xfb', 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Expand All @@ -113,7 +113,7 @@ const char Text::CT_V1IT[256] =
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', ':', ';', '\xe0', '\xe1', '\xe8', '?',
'@', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O',
'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '\xe9', 0, '\xea', '^', '\xef',
'"', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o',
'`', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o',
'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '\xec', '\xf2', '\xf9', '\xfb', 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Expand All @@ -125,6 +125,16 @@ const char Text::CT_V1IT[256] =
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
};

// Note: internally, official non-English SCUMM games tend to follow the CP 850
// MS-DOS code page, although in an incomplete way, and with local modifications
// (such as the ellipsis, the non-breaking space, the copyright or TM symbols)
// which can vary between games. We pick a "safe" choice of useful characters,
// as long as they're available at the same codepoints in both Windows-1252
// and ISO-8859-1, and as long as no SCUMM game already uses that codepoint for
// some other useful character.
//
// 0 means that the corresponding character in the SCUMM font will need to be
// used through an escape sequence.
const char Text::CT_V3ANSI[256] =
{
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Expand All @@ -133,15 +143,15 @@ const char Text::CT_V3ANSI[256] =
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', ':', ';', '<', '=', '>', '?',
'@', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O',
'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '[', '\\', ']', '^', '_',
'"', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o',
'`', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o',
'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '{', '|', '}', '~', 0,
'\xc7', '\xfc', '\xe9', '\xe2', '\xe4', '\xe0', 0, '\xe7', '\xea', '\xeb', '\xe8', '\xef', '\xee', '\xec', '\xc4', 0,
'\xc7', '\xfc', '\xe9', '\xe2', '\xe4', '\xe0', '\xe5', '\xe7', '\xea', '\xeb', '\xe8', '\xef', '\xee', '\xec', '\xc4', '\xc5',
'\xc9', '\xe6', '\xc6', '\xf4', '\xf6', '\xf2', '\xfb', '\xf9', 0, '\xd6', '\xdc', 0, 0, 0, 0, 0,
'\xe1', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, '\xdf', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
'\xe1', '\xed', '\xf3', '\xfa', '\xf1', '\xd1', 0, 0, '\xbf', 0, 0, 0, 0, '\xa1', 0, 0,
0, 0, 0, 0, 0, '\xc1', '\xc2', '\xc0', 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, '\xe3', '\xc3', 0, 0, 0, 0, 0, 0, 0, 0,
'\xf0', '\xd0', '\xca', '\xcb', '\xc8', 0, '\xcd', '\xce', '\xcf', 0, 0, 0, 0, 0, '\xcc', 0,
'\xd3', '\xdf', '\xd4', '\xd2', '\xf5', '\xd5', 0, '\xfe', '\xde', '\xda', '\xdb', '\xd9', '\xfd', '\xdd', 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
};

Expand Down