FcPatternGet always gives font weight of '0'

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

My system : Linux Debian 10
fontconfig version : 2.13.1

I have this small code:

#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;
    const char * newFont="Liberation Sans:style=Bold Italic";
    FcValue fcValue;

    display=XOpenDisplay(NULL);
    screen = DefaultScreen (display);

    font=XftFontOpenName(display,screen,newFont);

    FcPatternGet(font->pattern,FC_FAMILY,0,&fcValue);
    printf("font family : %s\n",(char *)(fcValue.u.s));
    FcPatternGet(font->pattern,FC_WEIGHT,0,&fcValue);
    printf("font weight : %d\n",fcValue.u.i);
    FcPatternGet(font->pattern,FC_SLANT,0,&fcValue);
    printf("font slant : %d\n",fcValue.u.i);

}


I compile it with command:

gcc -g -Wall -I/usr/include/X11 -I/usr/include/X11/Xft -I/usr/include/freetype2 -I/usr/include/fontconfig test.cc -o test -lX11 -lXft -lfontconfig

If I execute ./test , I get :

font family : Liberation Sans
font weight : 0
font slant : 100

font family and font slant are well displayed, but font weight is always to '0' (thin) , whatever weight I choose for 'newFont'.

Additional infos:

--- font "Liberation Sans:style=Bold Italic" is installed - command:
fc-match "Liberation Sans:style=Bold Italic" gives:
LiberationSans-BoldItalic.ttf: "Liberation Sans" "Bold Italic"
--- problem doesn't occur under Linux Ubuntu 18.04 with same version of fontconfig
_______________________________________________
Fontconfig mailing list
Fontconfig@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/fontconfig




[Index of Archives]     [Fedora Fonts]     [Fedora Users]     [Fedora Cloud]     [Kernel]     [Fedora Packaging]     [Fedora Desktop]     [PAM]     [Gimp Graphics Editor]     [Yosemite News]

  Powered by Linux