next up previous contents index
Next: Missing or Invalid AFM Up: Using t1lib Previous: Manipulation of Outlines   Contents   Index


Logical Fonts

It sometimes may be necessary to have a font and an extended or slanted variant simultaneously. To enable such configurations without needing to declare the fonts two or even more times in the font database file, t1lib provides the function

 int T1_CopyFont( int FontID)

to 0pt \fbox{$\mathcal{F}()\Rightarrow$} It copies the top level data structure of the font given by FontID to another location. The newly created font refers in fact to the same physical memory as the font FontID as far as Type 1 and AFM data are concerned. However, no size specific data is copied from font FontID, you can thus do with the new font whatever you want to. It will get its own size-specific memory area when the first bitmap is generated using its ID.

It is also possible to reencode a copied font without affecting the original font. This is possible because a logical font gets its own mapping tables. This allows configurations with one font at different encodings simultaneously.

In order to keep track that another font is referring to data from font FontID, a reference counter is managed for every font. The reference counter for font FontID is incremented after a call to T1_CopyFont().

If the font FontID is not loaded into memory, the function returns $-1$.

Only physical fonts--those fonts defined in the font database file or added via T1_AddFont()--may be copied to another font. If a user tries to copy a font which is already logical, the function returns $-2$.

If no memory is available for the new font the function return $-3$. But this should not happen.

If all goes the right way, T1_CopyFont() returns an integer--lets call it new_ID--which is from now on a valid font identification number.


next up previous contents index
Next: Missing or Invalid AFM Up: Using t1lib Previous: Manipulation of Outlines   Contents   Index
2004-10-04