intfiction.org

The Interactive Fiction Community Forum
It is currently Thu May 23, 2013 1:57 am

All times are UTC - 6 hours [ DST ]




Post new topic Reply to topic  [ 8 posts ] 
Author Message
PostPosted: Sun Jun 28, 2009 4:08 am 
Offline

Joined: Sun Jun 28, 2009 3:40 am
Posts: 4
I'm using Inform 6.31 and Frotz.

I've tried using

Code:
Zcharacter table '@{2660}' '@{2663}' '@{2665}' @{2666};


to add the symbols for the card suits to the character set, but I can't get them to display properly in the interpreter. They show up as those annoying white boxes instead symbols for Spades, Diamonds, etc.. Using the same code, I can get other special unicode characters to display properly, but not those ones. Here's the full code I'm trying to implement:

Code:
Zcharacter table '@{2660}' '@{2663}' '@{2665}' '@{2666}';
Array pack_of_cards --> 52;
[Shuffle i j;
   for (i=1:i<52:i++) {
         j = random(i+1) - 1;
         pack_of_cards-->i = pack_of_cards-->j; pack_of_cards-->j = i;
   }
];
[Card n;
    switch(n%13) {
        0: print "Ace";
        1 to 9: print n%13 + 1;
        10: print "Jack"; 11: print "Queen"; 12: print "King";
    }
    print " of ";
    switch(n/13) {
        0: print "@{2660}"; 1: print "@{2663}";
        2: print "@{2665}"; 3: print "@{2666}";
    }
];
[Main i;
! Create the pack in "factory order":
for (i=0:i<52:i++) pack_of_cards-->i = i;

! Shuffle the cards:
Shuffle();

print "The pack has been shuffled into the following order:^";
for (i=0:i<52:i++)
     print (Card) pack_of_cards-->i, "^";
];


This was actually taken right out of the designer's manual, except for the addition of these unicode characters and a few other minor adjustments. Originally, in the Card routine it printed "Hearts", "Spades", etc.. I thought it would be nice if I could get it to print the appropriate symbols instead. Any idea why this doesn't work or how I could get it to work? Thank you!


Top
 Profile Send private message  
 
PostPosted: Sun Jun 28, 2009 9:38 pm 
Offline
User avatar

Joined: Sat Dec 22, 2007 6:00 pm
Posts: 355
Location: Western Australia
I don't know a great deal about Inform 6, I'm afraid, particularly not about its support for special characters. But it's possible that the font Frotz is using simply doesn't support those characters. To check whether that's the problem, download the zipped .zblorb file I've attached to this post (it's an Inform 7 example which uses a lot of special characters, including the playing card symbols) and run it. Go east then south to the Gaming Lounge, and see if the symbols in the room description show up. If they do, then you have a problem with your I6 code. If they don't, it's probably a problem with your interpreter or font.


Attachments:
File comment: The Über-complète clavier - for testing Unicode support
clavier.zip [141.81 KiB]
Downloaded 36 times

_________________
Emily Boegheim
Top
 Profile Send private message  
 
PostPosted: Sun Jun 28, 2009 10:25 pm 
Offline

Joined: Sun Jun 28, 2009 3:40 am
Posts: 4
Wow. I didn't even think about the interpreter font. It was late and I wasn't thinking clearly. That was indeed the problem. Thank you for the file, and your help.

Is there any way to preset the font at compile time? At the very least, I would include an advisory statement at the start of the game about font selection, I suppose.

EDIT: I've realized that it would be better to write a routine that prints using an appropriate font regardless of what the player has the font set to, and am educating myself to that end by reading up on fonts in the DM. Thanks again for your help, Emerald.


Top
 Profile Send private message  
 
PostPosted: Sun Jun 28, 2009 11:23 pm 
Offline
User avatar

Joined: Sat Dec 22, 2007 6:00 pm
Posts: 355
Location: Western Australia
Glad to have helped!

Like I said, I don't know much about Inform 6 and its support for special characters. But Roger Firth's article on character sets in I6 might help you, particularly the last section, "Runtime issues".

_________________
Emily Boegheim


Top
 Profile Send private message  
 
PostPosted: Mon Jun 29, 2009 5:55 am 
Offline

Joined: Mon Jun 29, 2009 5:51 am
Posts: 288
Quote:
Is there any way to preset the font at compile time?

No, there's no way to control the font: that's purely the user's choice. However, if you're using Windows Frotz 1.13 or later, the interpreter will try to find a suitable font to use for Unicode characters. From the revision history:
Quote:
Improved the logic used to output Unicode text: now if a character can be drawn in any font on the system, that font will be used where needed. For best results a 'Unicode' font (e.g. "Arial Unicode MS" or "Code 2000") should be installed, though it doesn't need to be selected as either the proportional or fixed width font.

If you install a decent Unicode font, then the characters will be available - see the attached screenshot of the "Clavier" example on my system.


Attachments:
frotz.png
frotz.png [ 69.46 KiB | Viewed 563 times ]
Top
 Profile Send private message  
 
PostPosted: Mon Jun 29, 2009 10:17 am 
Offline

Joined: Sun Jun 28, 2009 3:40 am
Posts: 4
Quote:
No, there's no way to control the font: that's purely the user's choice. However, if you're using Windows Frotz 1.13 or later, the interpreter will try to find a suitable font to use for Unicode characters. From the revision history:


I see! I'm only using version 1.09. I'll get the latest version from the developer's site.


Top
 Profile Send private message  
 
PostPosted: Tue Jun 30, 2009 2:40 am 
Offline

Joined: Mon Jun 29, 2009 5:51 am
Posts: 288
A few more quick suggestions:

1) You don't strictly need to add the Unicode chars to the Zcharacter table if all you're going to do is print them out: you can use the @print_unicode opcode instead, just giving it the number of the Unicode character.

2) You can also ask the interpreter if it thinks it can output a given Unicode character with the @check_unicode opcode.

Both of the above require a "Standard 1.0" compliant interpreter, but virtually all of them are these days (and have been since the late 1990s): you can check the header to be sure.


Top
 Profile Send private message  
 
PostPosted: Tue Jun 30, 2009 7:50 am 
Offline

Joined: Sun Jun 28, 2009 3:40 am
Posts: 4
DavidK wrote:
you can use the @print_unicode opcode instead, just giving it the number of the Unicode character.


Awesome! Boy am I glad I registered here! You guys are more helpful than I could have imagined. I'm sure I will be back with more problems to discuss in the future.


Top
 Profile Send private message  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 posts ] 

All times are UTC - 6 hours [ DST ]


Who is online

Users browsing this forum: Google Feedfetcher and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group