UTF8 String - Motif

This is a discussion on UTF8 String - Motif ; Hi, I'm trying to display an UTF8 string in motif using OpenMotif.2.3.0. More precisely i'm trying to display a copyright symbol using Uncode symbol 00A9. I'm not able to display the string. I'm getting a white line in place of ...

+ Reply to Thread
Results 1 to 4 of 4

Thread: UTF8 String

  1. UTF8 String

    Hi,
    I'm trying to display an UTF8 string in motif using OpenMotif.2.3.0.
    More precisely i'm trying to display a copyright symbol using Uncode
    symbol 00A9. I'm not able to display the string. I'm getting a white
    line in place of the string. What is going wrong?

    Here is my sample code.
    Any Help is greatly Appreciated.
    Thanks,
    Surya

    #include
    #include
    #include
    #include
    #include
    #include
    #include
    #include
    int main(int argc, char *argv[])
    {
    XtAppContext appContext;
    Widget toplevel, form, label, text;
    Widget button ;
    XmString s1,s2;
    XmRendition rendition;
    XmRenderTable rtable;
    Arg args[14];
    Cardinal n;

    String fallback[] =
    {
    "*label1.renderTable: one",
    "*label2.renderTable: two",
    "*label3.renderTable: three",

    "*one.fontType: FONT_IS_XFT",
    "*one.renditionForeground: #FF00FF",
    "*one.fontName: Trebuchet MS",
    "*one.fontSize: 20",

    "*two.fontType: FONT_IS_XFT",
    "*two.fontName: Trebuchet MS",
    "*two.renditionForeground: #FF0000",
    "*two.fontSize: 20",

    "*three.fontType: FONT_IS_XFT",
    "*three.fontName: SUSE Sans Mono",
    "*three.renditionForeground: #FFFF00",
    "*three.fontSize: 80",

    NULL
    };

    XtSetLanguageProc(NULL, NULL, NULL);
    toplevel = XtVaAppInitialize(&appContext, "app",
    NULL, 0, &argc, argv, fallback,
    XmNtitle, "Anti Alias Font",
    NULL);
    form = XtVaCreateWidget("form", xmFormWidgetClass, toplevel,
    XtVaTypedArg, XmNbackground, XmRString, "#aaaaaa", 8,
    NULL);
    XtManageChild(form);

    char copyright[] = "\u00a9" ;
    label = XtVaCreateManagedWidget("label1",
    xmLabelWidgetClass, form,
    XmNlabelString,
    s1=XmStringCreate(copyright, XmCHARSET_TEXT),
    XmNtopAttachment, XmATTACH_FORM,
    XmNleftAttachment, XmATTACH_FORM,
    XmNleftOffset, 10,
    XmNtopOffset, 10,
    NULL);
    XmStringFree(copyright);

    char string2[] = "Some Text" ;
    label = XtVaCreateManagedWidget("label2",
    xmLabelGadgetClass, form,
    XmNlabelString,
    s1=XmStringCreateSimple(string2),
    XmNtopAttachment, XmATTACH_WIDGET,
    XmNtopWidget, label,
    NULL);
    XmStringFree(s1);

    char string3[] = "Some More Text";
    label = XtVaCreateManagedWidget("label3",
    xmLabelGadgetClass, form,
    XmNlabelString,
    s1=XmStringCreateSimple(string3),
    XmNtopAttachment, XmATTACH_WIDGET,
    XmNtopWidget, label,
    NULL);
    XmStringFree(s1);

    XtRealizeWidget(toplevel);
    XtAppMainLoop(appContext);
    return 0;
    }


  2. Re: UTF8 String

    Suki wrote:
    > Hi,
    > I'm trying to display an UTF8 string in motif using OpenMotif.2.3.0.
    > More precisely i'm trying to display a copyright symbol using Uncode
    > symbol 00A9. I'm not able to display the string. I'm getting a white
    > line in place of the string. What is going wrong?
    >


    Change this:

    > s1=XmStringCreate(copyright, XmCHARSET_TEXT),


    To this:

    s1=XmStringCreateLocalized(copyright),

  3. Re: UTF8 String

    Hello Chris,
    Thanks for your post. But I've found out that it has got nothing to do
    with my code. I was using gcc-3.3.3 and it was not working. Now i
    changed the compiler to gcc-4.1.1 and its working. The problem lies in
    the compiler.

    Surya


  4. Re: UTF8 String

    Suki wrote:
    > Hello Chris,
    > Thanks for your post. But I've found out that it has got nothing to do
    > with my code. I was using gcc-3.3.3 and it was not working. Now i
    > changed the compiler to gcc-4.1.1 and its working. The problem lies in
    > the compiler.
    >
    > Surya
    >


    Interesting, I've got it working here with gcc-3.4.6...

+ Reply to Thread