emacs-bidi
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [emacs-bidi] mirroring of glyphs


From: Eli Zaretskii
Subject: Re: [emacs-bidi] mirroring of glyphs
Date: Fri, 16 Nov 2001 11:49:58 +0200

> From: Alex Schroeder <address@hidden>
> Date: Thu, 15 Nov 2001 21:57:40 +0100
> 
> "Eli Zaretskii" <address@hidden> writes:
> 
> > Not at this time, but the table you need is very short; see the file
> > BidiMirroring.txt in the Unicode data base.
> 
> I just found it a few minutes ago.  :) What would be an appropriate
> data structure for this information?  I don't think the
> category-tables are appropriate.  I guess I'll just keep the data in a
> list for the moment (140 elements).

The actual length is much less, about 100, since those marked
"[BEST FIT]" should not be used, IMHO.

Here's the C implementation, for your entertainment.  It only supports
ASCII characters (since most of the others aren't supported by Mule
yet anyway).

int
bidi_mirror_char (int c)
{
  static const char mirrored_pairs[] = "()<>[]{}";
  const char *p = strchr (mirrored_pairs, c);

  if (p)
    {
      size_t i = p - mirrored_pairs;

      if ((i & 1) == 0)
        return mirrored_pairs[i + 1];
      else
        return mirrored_pairs[i - 1];
    }
  return c;
}



reply via email to

[Prev in Thread] Current Thread [Next in Thread]