problem drawing symbol font

This forum is read only. No new submissions are accepted.

Questions about motif? Contact us

Submitted by Anonymous on Sat, 09/20/2003 - 05:22.

Hello, I`m currently porting an application from HP-UX / X11R5 / Motif 1.2 to Linux / X11R6 / OpenMotif 2.2. I am having a problem indexing a symbol font on the new system (Linux).

Background Information

The symbol font was created using xmbdfed (font editor). Instead of text characters, this font contains symbols (shapes, etc.). This font has over 2000 symbols in it. After necessary modifications are made, the font is converted from bdf to pcf format using the bdftopcf command.

Load the font

font_sym->x_font = XLoadQueryFont ( f_data->display,
font_sym->font_name );

Create graphics context

font_gc[map_index] = XCreateGC( map->display, (Drawable)
0, NULL );

Set font & foreground color in GC

XSetFont(Map->display, font_gc[map_index], fontid);

XSetForeground (Map->display, font_gc[map_index], color.pixel);

Draw symbol

XDrawString16( map->display, (Drawable) map->drawable.drawbl,
font_gc[map_index], xys[0].x,
xys[0].y, (XChar2b*)&font_entry, 1 );

Before the XDrawString16 call, we determine the index of the symbol that we want to draw and that value is stored in the "font_entry" variable above. The index values range from 1 up to around 2400. The "font_entry" variable has a datatype of short to match the size of the XChar2b datatype (both are two bytes). The index that I have been referring to is displayed above each character "cell" when modifying the font in xmbdfed. We are able to correctly index the font on the old system (HP-UX), but on the new system (Linux) the indexing does not work properly. The font is loaded fine, but the wrong symbol is drawn when we
make the XDrawString16 call. I`m a little bit confused about the XChar2b datatype and how the relates to the index of the desired font character.
Are we correctly indexing the font? Is there another, more desirable, way to draw symbol fonts in X11R6?



Tue, 07/24/2012 - 11:30
1 post / 0 new