[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [ft-devel] Stem darkening of new CFF engine
From: |
Werner LEMBERG |
Subject: |
Re: [ft-devel] Stem darkening of new CFF engine |
Date: |
Wed, 26 Jun 2013 08:51:46 +0200 (CEST) |
>> Wouldn't it be a good idea to make the amount of darkening user
>> configurable? (Maybe by specifying a number from 0..10 at compile
>> time (0=no darkening ... 10=full darkening))
>
> This is already on my radar: I'll make the `five-part curve'
> configurable using a CFF driver property.
And now it is implemented and added to the git repository. From
`ftcffdrv.h':
@property:
darkening-parameters
@description:
By default, the Adobe CFF engine darkens stems as follows (if the
`no-stem-darkening' property isn't set):
{
stem width <= 0.5px: darkening amount = 0.4px
stem width = 1px: darkening amount = 0.275px
stem width = 1.667px: darkening amount = 0.275px
stem width >= 2.333px: darkening amount = 0px
}
and piecewise linear in-between. Using the `darkening-parameters'
property, these four control points can be changed, as the following
example demonstrates.
{
FT_Library library;
FT_Int darken_params[8] = { 500, 300, // x1, y1
1000, 200, // x2, y2
1500, 100, // x3, y3
2000, 0 }; // x4, y4
FT_Init_FreeType( &library );
FT_Property_Set( library, "cff",
"darkening-parameters", darken_params );
}
The x~values give the stem width, and the y~values the darkening
amount. All coordinate values must be positive and monotonically
increasing along the x~axis; the unit is 1000th of pixels.
@note:
This property can be used with @FT_Property_Get also.