Re: Angband with an accent: displaying extended characters
- From: Andrew Sidwell <nevermiah@xxxxxxxxxxx>
- Date: Sat, 15 Oct 2005 13:27:11 +0000 (UTC)
On 2005-10-15 14:30:16, Leon Marrick <none@xxxxxxxxxxx> wrote:
*big snip*
> Now for some coding.
>
> In the text file pharser, we need something to look at a name.
> When it sees a " ^ ", it looks at the second character to figure out
> what accent to apply. In this case, we have a forward single quote (" '
> "), which means forward slant accent. The third character is the letter
> itself; in this case, a lowercase " u ".
>
> We now need a lookup table. Each character set will have a
> different character that shows a lowercase u with a forward slant
> accent. So we add a preference type, write up the various possible
> combinations for recognized accented characters, and let the game read
> them into a table on load. If two systems have differing character
> sets, then we just have different preference lists for them.
You may be planning this already, but if not, here's a suggestion:
Why not use a function hook to translate such things, rather than writing lookup
tables into the main game code? You would define your hook type [1] so that it
took the plain character and a code for the accent. Make a default function
that returns that character without any modification [2] (this means that by
default, if a system doesn't override the hook, they get plain, totally
compatible ASCII characters).
In your main-win.c file, you then write a function that converts it to Windows'
version of extended characters. Same goes for any other platforms that can
support it.
The only issue I can think of is how it will affect character dumps. You'd have
to convert back into ASCII for that, so it might be worthwhile doing another
hook for converting back. I just don't like the idea of trying to write lots
of conversion tables into the main game code.
(Examples)
[1] typedef unsigned byte (*hook_convert_accent)(unsigned char c, byte accent);
(where c is the character, and accent is an index for an accent; 1 could be an
acute, 2 for a grave, etc.)
[2] unsigned byte convert_dummy(unsigned char c, byte accent) { return c; }
--
We must aim for perfection, but settle for progress.
.
- References:
- Angband with an accent: displaying extended characters
- From: Leon Marrick
- Angband with an accent: displaying extended characters
- Prev by Date: Re: Angband with an accent: displaying extended characters
- Next by Date: Re: Angband with an accent: displaying extended characters
- Previous by thread: Re: Angband with an accent: displaying extended characters
- Next by thread: Re: Angband with an accent: displaying extended characters
- Index(es):
Relevant Pages
|