Bidi aware formatted output
Chris Scaife
scaife.chris at gmail.com
Sat Dec 18 23:02:02 GMT 2010
Having got my ideas sorted about support for bidirectional formatted output,
I've added it to my advanced formatted output library. The main aim of said
library is to give better support for localization of software that uses the
standard gettext package especially for formatting numbers.
The experimental proto-type has now been restructured and I made a
pre-release of the source code in cs_lib-0.0.0.tar to demonstrate
bidirectional action.
<Left Margin testing Right to Left override
<Right Margin testing Left to Right override
above is demo output from following test program. IDK if the Unicode
direction control get thru the e-mail system, but the rendered output uses
%L to force left to right margin and then embeds a right to left string
using %rs, while the second line uses %R to force right to left output and
embeds left to right string with %ls
Note: numerical output has many more features including localizable number
formatting templates different digit sets and also supports direction
specifiers as well as digit order in the text stream.
// sudo ldconfig -n /usr/local/lib
// g++ -Wall -L/usr/local/lib testso.cpp -lcs -o testso `pkg-config
> gtkmm-2.4 --libs`
#include "cs_item.h"
#include <cstdio>
#include <iostream>
> using namespace std;
using namespace cs_lib;
> int main(int argc, char *argv[], char *envp[]) {
cs_charptr_item aTextR("Right to Left");
cs_charptr_item aTextL("Left to Right");
cout << aTextR.gettext("%L<Left Margin testing %rs override\n");
cout << aTextL.gettext("%R<Right Margin testing %ls override\n");
return !printf("exits normally\n");
}
Documentation and installation scripts are under construction
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://lists.ubuntu.com/archives/ubuntu-rtl/attachments/20101219/2aced907/attachment.htm
More information about the Ubuntu-RTL
mailing list