[poppler] Read some more info from the Font Descriptor

Kristian Høgsberg krh at bitplanet.net
Wed Jun 29 14:03:33 PDT 2005

Albert Astals Cid wrote:
> Well i disagree with the integers thing, mostly because which integers choose? 
> 1, 2, 3, 4, ..? That is the same as an enum, the other possiblity is using 
> the same integers fontconfig uses, that has two different problems:
>  -  First, we have to either include fontconfig.h in this file to be able of 
> doing the assignment or copy the numbers at hand. Including fontconfig just 
> for this does not seem right as this class as nothing to do with fontconig, 
> in the other side copying the numbers by hand is just plain wrong.
>  - Second, there is not a 1 to 1 match between the values that fontconfig has 
> and the values the pdf spec has, we have to choose the correspondence 
> somewhere but again this file does not seem the right place to do that.

Right, I don't think we should include fontconfig.h or convert the PDF 
values to fontconfig values.  But for the font weight, I think it's 
pretty natural to just store the integer that the font descriptor 
specifies as an integer.  When we want to use that with fontconfig it's 
easy to just map the PDF value to a fontconfig value by scaling it:

	int fc_weight = (pdf_weight - 100) * FC_WEIGHT_BLACK / 800;

Similarly, storing the stretch as an integer between 0-8 allows us to 
map that to a fontconfig stretch value in a similar way.


More information about the poppler mailing list