Using UTF-8 Character question ...

View: New views
2 Messages — Rating Filter:   Alert me  

Using UTF-8 Character question ...

by Ben Duncan-5 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

In the function curs_border functions I would like to add my own
UTF-8 border characters. I see have defined some characters as

....

/* Thick Border Colors */

   wchar_t thk_boxupright [] = { 0x2513, 0x00 } ;
   wchar_t thk_boxupleft [] = { 0x250f, 0x00 } ;
   wchar_t thk_boxlowleft [] = { 0x2517, 0x00 } ;
   wchar_t thk_boxlowright [] = { 0x251B, 0x00 } ;
   wchar_t thk_vertline [] = { 0x2503, 0x00 } ;
   wchar_t thk_horzline [] = { 0x2501, 0x00 } ;

/* Thin Border Colors */

   wchar_t thn_boxupright [] = { 0x2510, 0x00 } ;
   wchar_t thn_boxupleft [] = { 0x250c, 0x00 } ;
   wchar_t thn_boxlowleft [] = { 0x2514, 0x00 } ;
   wchar_t thn_boxlowright [] = { 0x2518, 0x00 } ;
   wchar_t thn_vertline [] = { 0x2502, 0x00 } ;
   wchar_t thn_horzline [] = { 0x2500, 0x00 } ;

How do I go about changing the function defined as the following:

  wborder(WINDOW *win, chtype ls, chtype rs,
           chtype ts, chtype bs, chtype tl, chtype tr,
           chtype bl, chtype br);

to use UTF-8. Is it simply doing this :

  wborder(MyWin_ptr, thn_vertline, thn_vertline,
          thn_horzline, thn_horzline, thn_boxupleft,
          thn_boxupright, thn_boxlowleft, thn_boxlowright ) ;

My ncurses library is compile with UTF 8 defaults

As always, thanks ...

--
Ben Duncan - Business Network Solutions, Inc. 336 Elton Road  Jackson MS, 39212
"Never attribute to malice, that which can be adequately explained by stupidity"
        - Hanlon's Razor


_______________________________________________
Bug-ncurses mailing list
Bug-ncurses@...
http://lists.gnu.org/mailman/listinfo/bug-ncurses

Re: Using UTF-8 Character question ...

by Thomas Dickey-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Fri, 2 Oct 2009, Ben Duncan wrote:

> In the function curs_border functions I would like to add my own
> UTF-8 border characters. I see have defined some characters as
>
> .....
>
> /* Thick Border Colors */

Coincidentally someone on mc-devel was asking a similar question last
week.  It's possible to extend ncurses for double-lines that correspond
to Unicode values - I made a to-do item to address this...

>
>  wchar_t thk_boxupright [] = { 0x2513, 0x00 } ;
>  wchar_t thk_boxupleft [] = { 0x250f, 0x00 } ;
>  wchar_t thk_boxlowleft [] = { 0x2517, 0x00 } ;
>  wchar_t thk_boxlowright [] = { 0x251B, 0x00 } ;
>  wchar_t thk_vertline [] = { 0x2503, 0x00 } ;
>  wchar_t thk_horzline [] = { 0x2501, 0x00 } ;
>
> /* Thin Border Colors */

The ACS_xxx definitions map to these (in ncurses/widechar/lib_wacs.c)

>
>  wchar_t thn_boxupright [] = { 0x2510, 0x00 } ;
>  wchar_t thn_boxupleft [] = { 0x250c, 0x00 } ;
>  wchar_t thn_boxlowleft [] = { 0x2514, 0x00 } ;
>  wchar_t thn_boxlowright [] = { 0x2518, 0x00 } ;
>  wchar_t thn_vertline [] = { 0x2502, 0x00 } ;
>  wchar_t thn_horzline [] = { 0x2500, 0x00 } ;
>
> How do I go about changing the function defined as the following:
>
> wborder(WINDOW *win, chtype ls, chtype rs,
>          chtype ts, chtype bs, chtype tl, chtype tr,
>          chtype bl, chtype br);
>
> to use UTF-8. Is it simply doing this :
>
> wborder(MyWin_ptr, thn_vertline, thn_vertline,
>         thn_horzline, thn_horzline, thn_boxupleft,
>         thn_boxupright, thn_boxlowleft, thn_boxlowright ) ;

That looks as if it would work...

>
> My ncurses library is compile with UTF 8 defaults
>
> As always, thanks ...
>
> --
> Ben Duncan - Business Network Solutions, Inc. 336 Elton Road  Jackson MS,
> 39212
> "Never attribute to malice, that which can be adequately explained by
> stupidity"
>       - Hanlon's Razor
>
>
> _______________________________________________
> Bug-ncurses mailing list
> Bug-ncurses@...
> http://lists.gnu.org/mailman/listinfo/bug-ncurses
>

--
Thomas E. Dickey
http://invisible-island.net
ftp://invisible-island.net


_______________________________________________
Bug-ncurses mailing list
Bug-ncurses@...
http://lists.gnu.org/mailman/listinfo/bug-ncurses