Notice that the typographic ascender is not determined by the Type 1 font
program. It has to be guessed by t1lib. The problem of guessing the
typographic ascender is discussed in more detail in .
When loading a font, this typographic ascender is assumed to be the vertical
coordinate of the upper right corner of the bounding box of the letter ``d''.
This is not as advanced as the procedure described in
,
but it suffices because the underlining positions can later be overwritten by
the user (see below).
From the mathematical point of view, the line rules are an integral part of the rastered path. It follows that line rules may appear sheared if a font has been artificially slanted and the size and/or thickness is sufficiently large.
A look into real Type 1 font files shows that even fonts of the same family possess incompatible values for underlining. For example, Bitstream Charter Roman defines underline thickness to be 61 and its bold variant assigns a value of 90. Underlining text consisting of Roman and bold words will not be very pleasing using these values. For this reason t1lib provides a way for explicitly setting and overwriting the default values for line ruling on a per-font level. The functions
int T1_SetLinePosition( int FontID, int linetype, float value)
int T1_SetLineThickness( int FontID, int linetype, float value)
FontID
to value
.
The linetype
argument is assumed to be an OR'ed combination of
T1_UNDERLINE
, T1_OVERLINE
and T1_OVERSTRIKE
. While it
generally does not make sense to specify identical positions for two or three
distinct line rule types, it is meaningful to specify identical thickness
values for two or all rules types. However both functions accept combinations
of linetype specification.
It follows that consistent line ruling for several fonts can be achieved by
setting the line rule parameters of the involved fonts to identical respective
values.
Currently active line rule parameters can be queried using the functions
float T1_GetLinePosition( int FontID, int linetype)
float T1_GetLineThickness( int FontID, int linetype)
linetype
the first matching value is returned,
since obviously the functions can only return one value. The order the
argument is checked is T1_UNDERLINE
, T1_OVERLINE
and
finally T1_OVERSTRIKE
.
These functions called with T1_UNDERLINE
as line type argument should
not be confused with the functions T1_GetUnderlinePosition()
and
T1_GetUnderlineThickness()
respectively. The latter functions will
always return the values from the Fontinfo dictionary as opposed to the former
which will return the currently active values.
Since line ruling is done on the fly, it is possible to change the involved parameters in the middle of a session without confusing the cache or removing size dependent data.