font matching doesn't work for me

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

 



I was writing such a code but it doesn't work as expected:

//construct a pattern
pat=FcPatternCreate();
FcValue value;

value.type=FcTypeString;
value.u.s=_family.ascii();
FcPatternAdd(pat, FC_FAMILY, value, true);

value.type=FcTypeInteger;
value.u.i=_weight;
FcPatternAdd(pat, FC_WEIGHT, value, true);

value.type=FcTypeInteger;
value.u.i=_slant;
FcPatternAdd(pat, FC_SLANT, value, true);

value.type=FcTypeDouble;
value.u.d=_size;
FcPatternAdd(pat, FC_SIZE, value, true);

value.type=FcTypeDouble;
value.u.d=_size;
FcPatternAdd(pat, FC_PIXEL_SIZE, value, true);

//check if constructed - ok
FcValue* v;
FcPatternGet(pat, FC_FAMILY, 0, v);
cout<<"get family: "<<v->u.s<<endl;
// (...)
FcConfig* config=FcInitLoadConfig();
FcDefaultSubstitute(pat);
FcConfigSubstitute(config, pat, FcMatchPattern);
FcResult* result=new FcResult;
font=FcFontMatch(config, pat, result);
// and now result contains FcResultNoMatch - why?

I tried to get Helvetica, Times, or Times New Roman - none of these worked. 
What's wrong with this code?

Tomek


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

  Powered by Linux