[Scummvm-git-logs] scummvm master -> 77f2330755d3fc82a4e713765eee2b9966f8e22a

dreammaster paulfgilbert at gmail.com
Tue Dec 18 06:04:33 CET 2018


This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
a163fee23b GLK: FROTZ: Map runic characters to Unicode
77f2330755 GLK: FROTZ: Use the Noto runic font for runes


Commit: a163fee23bef7fbb78e4ca018333a44c6869ea76
    https://github.com/scummvm/scummvm/commit/a163fee23bef7fbb78e4ca018333a44c6869ea76
Author: Torbjörn Andersson (eriktorbjorn at users.sourceforge.net)
Date: 2018-12-17T21:04:28-08:00

Commit Message:
GLK: FROTZ: Map runic characters to Unicode

This does not actually work, because we currently do not have any
font that supports the Unicode Runic block. But there are free
fonts that do (Junicode, for instance), so it may still be possible
to do this.

Changed paths:
    engines/glk/frotz/processor.h
    engines/glk/frotz/processor_screen.cpp


diff --git a/engines/glk/frotz/processor.h b/engines/glk/frotz/processor.h
index 9bb104c..5b9926b 100644
--- a/engines/glk/frotz/processor.h
+++ b/engines/glk/frotz/processor.h
@@ -327,6 +327,11 @@ protected:
 	void screen_mssg_off();
 
 	/**
+	 * Map a runic character to its Unicode equivalent, if there is one
+	 */
+	uint32 zchar_to_unicode_rune(zchar c);
+
+	/**
 	 * Display a single character on the screen.
 	 */
 	void screen_char(zchar c);
diff --git a/engines/glk/frotz/processor_screen.cpp b/engines/glk/frotz/processor_screen.cpp
index 5e2a331..76c10c0 100644
--- a/engines/glk/frotz/processor_screen.cpp
+++ b/engines/glk/frotz/processor_screen.cpp
@@ -43,6 +43,49 @@ void Processor::screen_mssg_off() {
 	}
 }
 
+static const uint32 zchar_runes[] = {
+	// This mapping is based on the Amiga font in the Z-Machine
+	// specification, with some liberties taken.
+	//
+	// There are only runic characters for a-z. As I recall it, there was
+	// at least one scene in Beyond Zork where it would use the runic font
+	// to display text which contained upper case letters (if your
+	// intelligence was too low to understand it), which came out as a
+	// mixture of runes and map-drawing characters. Maybe that can be
+	// fixed later?
+
+	0x16AA, // RUNIC LETTER AC A
+	0x16D2, // RUNIC LETTER BERKANAN BEORC BJARKAN B
+	0x16C7, // RUNIC LETTER IWAZ EOH
+	0x16D1, // RUNIC LETTER DAGAZ DAEG D
+	0x16D6, // RUNIC LETTER EHWAZ EH E
+	0x16A0, // RUNIC LETTER FEHU FEOH FE F
+	0x16B7, // RUNIC LETTER GEBO GYFU G
+	0x16BB, // RUNIC LETTER HAEGL H
+	0x16C1, // RUNIC LETTER ISAZ IS ISS I
+	0x16C4, // RUNIC LETTER GER
+	0x16E6, // RUNIC LETTER LONG-BRANCH-YR
+	0x16DA, // RUNIC LETTER LAUKAZ LAGU LOGR L
+	0x16D7, // RUNIC LETTER MANNAZ MAN M
+	0x16BE, // RUNIC LETTER NAUDIZ NYD NAUD N
+	0x16A9, // RUNIC LETTER OS O
+	0x16C8, // RUNIC LETTER PERTHO PEORTH P
+	0x16B3, // RUNIC LETTER CEN
+	0x16B1, // RUNIC LETTER RAIDO RAD REID R
+	0x16CB, // RUNIC LETTER SIGEL LONG-BRANCH-SOL S
+	0x16CF, // RUNIC LETTER TIWAZ TIR TYR T
+	0x16A2, // RUNIC LETTER URUZ UR U
+	0x16E0, // RUNIC LETTER EAR
+	0x16B9, // RUNIC LETTER WUNJO WYNN W
+	0x16C9, // RUNIC LETTER ALGIZ EOLHX
+	0x16A5, // RUNIC LETTER W
+	0x16DF  // RUNIC LETTER OTHALAN ETHEL O
+};
+
+uint32 Processor::zchar_to_unicode_rune(zchar c) {
+	return (c >= 'a' && c <= 'z') ? zchar_runes[c - 'a'] : 0;
+}
+
 void Processor::screen_char(zchar c) {
 	if (gos_linepending && (gos_curwin == gos_linewin)) {
 		gos_cancel_pending_line();
@@ -102,7 +145,21 @@ void Processor::screen_char(zchar c) {
 	} else if (gos_curwin == gos_lower) {
 		if (c == ZC_RETURN)
 			glk_put_char('\n');
-		else glk_put_char_uni(c);
+		else {
+			if (curr_font == GRAPHICS_FONT) {
+				uint32 runic_char = zchar_to_unicode_rune(c);
+				if (runic_char != 0) {
+					// FIXME: This will only work if we have a font which
+					// supports the Unicode Runic block. We currently don't.
+					// Perhaps Junicode is a good candidate for this?
+					glk_set_style(style_Normal);
+					glk_put_char_uni(runic_char);
+					glk_set_style(style_User1);
+				} else
+					glk_put_char_uni(c);
+			} else
+				glk_put_char_uni(c);
+		}
 	}
 }
 


Commit: 77f2330755d3fc82a4e713765eee2b9966f8e22a
    https://github.com/scummvm/scummvm/commit/77f2330755d3fc82a4e713765eee2b9966f8e22a
Author: Torbjörn Andersson (eriktorbjorn at users.sourceforge.net)
Date: 2018-12-17T21:04:28-08:00

Commit Message:
GLK: FROTZ: Use the Noto runic font for runes

We already bundle other Noto fonts in the font.dat file, so using
further Noto fonts makes sense to me. Also, map upper-case letters
to lower-case runes since there are versions of Beyond Zork that
uses that. (The version I played many years ago did, and it looked
very strange. The version I tested with now did not, probably for
that very reason. So that part is untested for now.)

Changed paths:
    dists/engine-data/fonts.dat
    engines/glk/conf.cpp
    engines/glk/frotz/processor_screen.cpp
    engines/glk/glk_types.h
    engines/glk/screen.cpp
    engines/glk/screen.h


diff --git a/dists/engine-data/fonts.dat b/dists/engine-data/fonts.dat
index b7dde60..57ed2de 100644
Binary files a/dists/engine-data/fonts.dat and b/dists/engine-data/fonts.dat differ
diff --git a/engines/glk/conf.cpp b/engines/glk/conf.cpp
index dffb79e..98cd515 100644
--- a/engines/glk/conf.cpp
+++ b/engines/glk/conf.cpp
@@ -45,6 +45,7 @@ WindowStyle T_STYLES[style_NUMSTYLES] = {
 	{ PROPB, { 0xff, 0xff, 0xff }, { 0x00, 0x60, 0x00 }, 0 }, ///< Input
 	{ MONOR, { 0xff, 0xff, 0xff }, { 0x00, 0x00, 0x00 }, 0 }, ///< User1
 	{ MONOR, { 0xff, 0xff, 0xff }, { 0x00, 0x00, 0x00 }, 0 }, ///< User2
+	{ RUNIC, { 0xff, 0xff, 0xff }, { 0x00, 0x00, 0x00 }, 0 }, ///< User3
 };
 
 WindowStyle G_STYLES[style_NUMSTYLES] = {
@@ -59,6 +60,7 @@ WindowStyle G_STYLES[style_NUMSTYLES] = {
 	{ MONOR, { 0xff, 0xff, 0xff }, { 0x60, 0x60, 0x60 }, 0 }, ///< Input
 	{ MONOR, { 0xff, 0xff, 0xff }, { 0x60, 0x60, 0x60 }, 0 }, ///< User1
 	{ MONOR, { 0xff, 0xff, 0xff }, { 0x60, 0x60, 0x60 }, 0 }, ///< User2
+	{ MONOR, { 0xff, 0xff, 0xff }, { 0x60, 0x60, 0x60 }, 0 }, ///< User3
 };
 
 Conf *g_conf;
diff --git a/engines/glk/frotz/processor_screen.cpp b/engines/glk/frotz/processor_screen.cpp
index 76c10c0..97745a0 100644
--- a/engines/glk/frotz/processor_screen.cpp
+++ b/engines/glk/frotz/processor_screen.cpp
@@ -46,13 +46,6 @@ void Processor::screen_mssg_off() {
 static const uint32 zchar_runes[] = {
 	// This mapping is based on the Amiga font in the Z-Machine
 	// specification, with some liberties taken.
-	//
-	// There are only runic characters for a-z. As I recall it, there was
-	// at least one scene in Beyond Zork where it would use the runic font
-	// to display text which contained upper case letters (if your
-	// intelligence was too low to understand it), which came out as a
-	// mixture of runes and map-drawing characters. Maybe that can be
-	// fixed later?
 
 	0x16AA, // RUNIC LETTER AC A
 	0x16D2, // RUNIC LETTER BERKANAN BEORC BJARKAN B
@@ -83,7 +76,23 @@ static const uint32 zchar_runes[] = {
 };
 
 uint32 Processor::zchar_to_unicode_rune(zchar c) {
-	return (c >= 'a' && c <= 'z') ? zchar_runes[c - 'a'] : 0;
+	// There are only runic characters for a-z. Some versions of Beyond
+ 	// Zork will render the conversation between Prince Foo and the black
+	// rider in runic script, even though it contained upper case letters.
+	// This produced an ugly mix of runes and map-drawing characters, etc.
+	// which is probably why it was removed in later versions.
+	//
+	// Apart from the runes, I believe the up/down arrows are the only
+	// special characters to be printed in the lower window. Maybe they,
+	// too, should be mapped to Unicode characters, but since they are
+	// mapped to \ and ] respectively that probably menas we can convert
+	// upper case to lower case and use the appropriate rune for that.
+	if (c >= 'a' && c <= 'z')
+		return zchar_runes[c - 'a'];
+	else if (c >= 'A' && c <= 'Z')
+		return zchar_runes[c - 'A'];
+	else
+		return 0;
 }
 
 void Processor::screen_char(zchar c) {
@@ -149,10 +158,7 @@ void Processor::screen_char(zchar c) {
 			if (curr_font == GRAPHICS_FONT) {
 				uint32 runic_char = zchar_to_unicode_rune(c);
 				if (runic_char != 0) {
-					// FIXME: This will only work if we have a font which
-					// supports the Unicode Runic block. We currently don't.
-					// Perhaps Junicode is a good candidate for this?
-					glk_set_style(style_Normal);
+					glk_set_style(style_User3);
 					glk_put_char_uni(runic_char);
 					glk_set_style(style_User1);
 				} else
diff --git a/engines/glk/glk_types.h b/engines/glk/glk_types.h
index aa573e2..3fdbf1e 100644
--- a/engines/glk/glk_types.h
+++ b/engines/glk/glk_types.h
@@ -137,7 +137,8 @@ enum Style {
 	style_Input        = 8,
 	style_User1        = 9,
 	style_User2        = 10,
-	style_NUMSTYLES    = 11
+	style_User3        = 11,
+	style_NUMSTYLES    = 12
 };
 
 enum WinType {
diff --git a/engines/glk/screen.cpp b/engines/glk/screen.cpp
index 2276998..7b38782 100644
--- a/engines/glk/screen.cpp
+++ b/engines/glk/screen.cpp
@@ -116,7 +116,7 @@ bool Screen::loadFonts() {
 	f.read(buffer, 3);
 	buffer[3] = '\0';
 
-	if (Common::String(buffer) != "1.0") {
+	if (Common::String(buffer) != "1.1") {
 		delete archive;
 		return false;
 	}
@@ -144,14 +144,17 @@ void Screen::loadFonts(Common::Archive *archive) {
 	_fonts[5] = loadFont(PROPB, archive, propSize, propAspect, FONTB);
 	_fonts[6] = loadFont(PROPI, archive, propSize, propAspect, FONTI);
 	_fonts[7] = loadFont(PROPZ, archive, propSize, propAspect, FONTZ);
+
+	_fonts[8] = loadFont(RUNIC, archive, propSize, propAspect, RUNIC);
 }
 
 const Graphics::Font *Screen::loadFont(FACES face, Common::Archive *archive, double size, double aspect, int
  style) {
 	Common::File f;
-	const char *const FILENAMES[8] = {
+	const char *const FILENAMES[9] = {
 		"GoMono-Regular.ttf", "GoMono-Bold.ttf", "GoMono-Italic.ttf", "GoMono-Bold-Italic.ttf",
-		"NotoSerif-Regular.ttf", "NotoSerif-Bold.ttf", "NotoSerif-Italic.ttf", "NotoSerif-Bold-Italic.ttf"
+		"NotoSerif-Regular.ttf", "NotoSerif-Bold.ttf", "NotoSerif-Italic.ttf", "NotoSerif-Bold-Italic.ttf",
+		"NotoSansRunic-Regular.ttf"
 	};
 
 	if (!f.open(FILENAMES[face], *archive))
diff --git a/engines/glk/screen.h b/engines/glk/screen.h
index 10f8b14..25beaf1 100644
--- a/engines/glk/screen.h
+++ b/engines/glk/screen.h
@@ -31,13 +31,13 @@
 
 namespace Glk {
 
-#define FONTS_TOTAL 8
+#define FONTS_TOTAL 9
 
 enum CaretShape {
 	SMALL_DOT = 0, FAT_DOT = 1, THIN_LINE = 2, FAT_LINE = 3, BLOCK = 4
 };
 
-enum FACES { MONOR, MONOB, MONOI, MONOZ, PROPR, PROPB, PROPI, PROPZ, CUSTOM };
+enum FACES { MONOR, MONOB, MONOI, MONOZ, PROPR, PROPB, PROPI, PROPZ, RUNIC, CUSTOM };
 enum TYPES { MONOF, PROPF };
 enum STYLES { FONTR, FONTB, FONTI, FONTZ };
 





More information about the Scummvm-git-logs mailing list