arodulfo
August 20th, 2013, 12:30 PM
Dear all,
I have made a small application in C. It must show the result of some remote measurements reported through ModBus.
The application uses CAIRO in order to have its output done in full graphics mode.
Nowadays, the communications run quite smooth, the graphics rendering need just a little trick to work, that I can live with right now, and I just have a major drawback.
For a system supposed to operate in Spain, not being able to render accents and the "Ñ/ñ" is kind of a disaster.
The problem has two faces:
* If I do nothing to eliminate those characters and replace them by the English equivalents, CAIRO seems to stop working, even if the application keeps sending output to the background console
* The 'º' in 'ºC', which I read from a config file, appears perfect on screen, even though I know it is represented by the sequence 0xE1 - 0xB5 - 0x92. The code reads that sequence out of the config file and stores it on the matching variable and has no problem to render the symbol when I "print " the contents of that variable through CAIRO
My normal coding for "printing" texts through CAIRO looks like:
cairo_select_font_face (c, fontName, fontSlant, fontWeight);
cairo_set_font_size (c, fontSize);
cairo_set_source_rgb (c, col.r, col.g, col.b);
cairo_move_to (c, x, y);
cairo_text_path (c, text_to_be_shown);
cairo_fill (c);
cairo_show_page (c);
The LANG environment variable is set to es_ES.UTF-8
Other than in CAIRO, I am perfectly able to use Spanish accents, ñ, Ñ, and so on.
I have a second problem: Interfacing with an external configuration application.
This application is said to use ModBus to talk to the resident application. So, all coding must match the coding in the resident application so that it accepts and applies the new settings without errors or hangouts.
Any hint?
I have made a small application in C. It must show the result of some remote measurements reported through ModBus.
The application uses CAIRO in order to have its output done in full graphics mode.
Nowadays, the communications run quite smooth, the graphics rendering need just a little trick to work, that I can live with right now, and I just have a major drawback.
For a system supposed to operate in Spain, not being able to render accents and the "Ñ/ñ" is kind of a disaster.
The problem has two faces:
* If I do nothing to eliminate those characters and replace them by the English equivalents, CAIRO seems to stop working, even if the application keeps sending output to the background console
* The 'º' in 'ºC', which I read from a config file, appears perfect on screen, even though I know it is represented by the sequence 0xE1 - 0xB5 - 0x92. The code reads that sequence out of the config file and stores it on the matching variable and has no problem to render the symbol when I "print " the contents of that variable through CAIRO
My normal coding for "printing" texts through CAIRO looks like:
cairo_select_font_face (c, fontName, fontSlant, fontWeight);
cairo_set_font_size (c, fontSize);
cairo_set_source_rgb (c, col.r, col.g, col.b);
cairo_move_to (c, x, y);
cairo_text_path (c, text_to_be_shown);
cairo_fill (c);
cairo_show_page (c);
The LANG environment variable is set to es_ES.UTF-8
Other than in CAIRO, I am perfectly able to use Spanish accents, ñ, Ñ, and so on.
I have a second problem: Interfacing with an external configuration application.
This application is said to use ModBus to talk to the resident application. So, all coding must match the coding in the resident application so that it accepts and applies the new settings without errors or hangouts.
Any hint?