Cannot retrieve XFT fonts

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

Questions about motif? Contact us

2 posts / 0 new
Last post
Cannot retrieve XFT fonts

Submitted by lostboy on Tue, 09/25/2007 - 20:35.

I have have an existing application running on Rh4 and Motif 2.2. I have downloaded and installed openmotif 2.3 and almost everything is fine. All aspects of the existing application behave correctly and display the anti-aliased fonts as expected.

In one small part of the program some really old dialogs (15 years) attempt to determine the width of the strings in the dialog by retrieving the fonts and then using XTextWidth to find the widest string. I think the application fails because the fonts are not defined in the widget.

If I comment out the lines in the resource file that set up the font as an XFT font then the application uses the old fonts and works correctly. Is there something different I need to do to load up the XFT fonts before creating the widget.

Thanks for any insight

Thu, 10/04/2007 - 14:38#1

Thu, 10/04/2007 - 14:38#1

Yuriy Syrota

Cannot retrieve XFT fonts

If you work with XTF font, you sould use different approach in order to get to know width of stinrg. I'll try to expain witn example.

if, working with font struct you used the following code:

x = XTextWidth(font, str, n);

then, working with xft font struct you need to use the following code:

XGlyphInfo ext;<br />
XftTextExtentsUtf8(XtDisplay(w), (XftFont*)font, str, n, &ext);<br />
x = ext.xOff;

I hope, it will help.