GIDForums  

Go Back   GIDForums > Computer Programming Forums > FLTK Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 10-Jul-2008, 19:44
alka08 alka08 is offline
New Member
 
Join Date: Jul 2008
Posts: 2
alka08 is on a distinguished road

Problem displaying Icelandic Text in the label of Fl_Box


Hello Everyone,

I am having problem with displaying Icelandic Text in the label of Fl_Box.
The environment is FLTK 1.1.7 on top of Fedora Core 4

Problem: When I try to display this Icelandic Text -> "Sláðu inn" in the Box label; it shows up as this -> "Sláðu inn".

I followed the "How to display chinese" thread on this forum and tried
the fl_latin12utf as mentioned in the example in utf8.cxx after changing
my fltk library to the fltk 1.1.6 with utf8 support (got the fltk from
www.oksid.ch.

Although the Fl_input shows my text correctly the label for Fl_Box still
shows it the same weird way ("Sláðu inn").

Is there anything I am missing here?

I also tried using the gettext as mentioned in the "Internationalization In FLTK"
thread in this forum but it did not work.

The code snippet is as follows:

CPP / C++ / C Code:
#include <FL/Fl.H>
#include <FL/Fl_Window.H>
#include <FL/Fl_Box.H>
#include <stdlib.h>

int main(int argc, char **argv) {
  Fl_Window *window = new Fl_Window(300,280);

  char *latin1 = "Sláðu inn";
  char *utf8 = (char*) malloc(strlen(latin1) * 5 + 1);
  int l = 0;
  l = fl_latin12utf((const unsigned char*)latin1, strlen(latin1), utf8);
  utf8[l] = '\0';

  Fl_Box *box = new Fl_Box(FL_UP_BOX,20,40,260,200, utf8);

  box->labelfont(FL_BOLD+FL_ITALIC);
  box->labelsize(36);
  box->labeltype(FL_SHADOW_LABEL);
  window->end();
  
  window->show(argc, argv);
  return Fl::run();
}

Has anyone faced this issue? Is there a way to make the Icelandic text appear in the label of Fl_box.

I would really appreciate it, if someone could point me in the right direction.

Thanks
  #2  
Old 22-Jul-2008, 08:23
alka08 alka08 is offline
New Member
 
Join Date: Jul 2008
Posts: 2
alka08 is on a distinguished road

Re: Problem displaying Icelandic Text in the label of Fl_Box


Hi,

I was able to fix the issue by installing fltk 1.1.8 with utf8 support (fltk118-utf8-2008-02-24.tar.bz2) downloaded from www.imm.uklinux.net

I got a compilation error for the above FLTK as follows:
= installing FL ===
Installing include files in /usr/local/include...
=== installing xutf8 ===
Installing libfltk_xutf8.a in /usr/local/lib...
make[1]: execvp: /usr/local/lib: Permission denied
make[1]: execvp: ../lib/libfltk_xutf8.a: Permission denied
make[1]: *** [install] Error 127
make: *** [install] Error 2

I fixed it by changing the Makefile in xutf8 dir -> under make install section:
Have $(INSTALL_LIB) $(XUTF8) $(DESTDIR)$(libdir) instead of the
$(CP) $(XUTF8) $(libdir).

When I compiled my code, I got error that 'Drawable' is being used without being defined. So in FLTK UTF8 (FL/Xutf8.h let compilation fail once and confirm that this is the FLTK file with Drawable error) and in one of the X11 headers (/usr/X11R6/include/X11/Xlib.h) where I got compilation error, I replaced Drawable with XID (this was the definition in another X11 header file).

Then recompile FLTK UTF8 ->
./configure --enable-threads -enable-xft
make
make install

After this As per the example in utf8.cxx, I had to give the hex equivalent of each of my icelandic strings after storing them in wchar_t strings. I used the following program to generate my hex strings and used the hex strings in code.


CPP / C++ / C Code:
#include <stdio.h>
#include <stdlib.h>
#include <wchar.h>

main()
{
  wchar_t achBuf[] = L"Sláðu inn";

   for (int i = 0; i < wcslen(achBuf); ++i)
  {
    printf("\\x%x", achBuf[i]);
  } 

  printf("\n");
}

I hope this helps.

Thanks and Regards.
 
 

Recent GIDBlogProblems with the Navy (Enlisted) by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Power Calibration Error In Nero Fix (hopefully) matt3678 Computer Hardware Forum 60 20-Aug-2009 05:04
Problem inserting (appending) in the middle of text file rajeev nair C++ Forum 3 17-Apr-2007 00:55
[GIM][MODULE]Contact List cable_guy_67 FLTK Forum 9 04-Dec-2004 12:19
CD burner wont burn!! robertli55 Computer Hardware Forum 1 18-Jun-2004 10:53
Yet another CD burner problem: Lite-On LSC-24082K Erwin Computer Hardware Forum 1 22-May-2004 11:28

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 13:26.


vBulletin, Copyright © 2000 - 2010, Jelsoft Enterprises Ltd.