I forgot to join a small piece of code to reproduce the problem.

Compile command :

gcc -g -Wall -O2 -I/usr/include/X11 -I/usr/include/X11/Xft -I/usr/include/freetype2 -I /usr/include/fontconfig xftfontopenname.c -o xftfontopenname -lX11 -lXft -lfontconfig

Le 11/09/2019 à 16:13, Lucien Gentis a écrit :
Hello,

XftFontOpenName function returns a XftFont structure that contains an FcPattern.

Since 2.13.1-2 version of libxft, FC_WEIGHT property of this FcPattern has type FcTypeDouble instead of FcTypeInteger as expected in /usr/include/fontconfig/fontconfig.h and it was the case with 2.13.1-1 version.

I don't know if it's a bug or expected behavior.


_______________________________________________
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel
#include <stdio.h>
#include <stdlib.h>
#include <X11/Xft/Xft.h>
#include <Xlib.h>
#include <fontconfig.h>

int main(void) {
	Display * display;
	int screen;
	XftFont * font;
	FcValue fcValue;
		
	display=XOpenDisplay(NULL);
	screen = DefaultScreen (display);

	const char * newFont="Liberation Sans:weight=bold:slant=italic";
	printf("Opening font \"Liberation Sans:weight=bold:slant=italic\"\n");
	font=XftFontOpenName(display,screen,newFont);

	printf("Extracting font weight via command \"FcPatternGet(font->pattern,FC_WEIGHT,0,&fcValue);\"\n");
	printf("fontconfig expects an integer value in fcValue.u.i, but weight property contains a double value in fcValue.u.d\n");
	FcPatternGet(font->pattern,FC_WEIGHT,0,&fcValue);
	printf("font weight integer fcValue.u.i : %d - that means \"thin\"\n",fcValue.u.i);
	printf("font weight double fcValue.u.d  : %f - whose integer value %d means \"bold\"\n",fcValue.u.d,(int)(fcValue.u.d));
}
_______________________________________________
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

Reply via email to