Copyright (C) 2000-2012 |
Manpages Defoma::IdSection: User Commands (1)Updated: March 4, 2001 Index Return to Main Contents NAMEDefoma::Id - Defoma module to handle Id cache.SYNOPSISuse Defoma::Id;$Id = defoma_id_open_cache( suffix, package_name ); defoma_id_close_cache( id_object );
defoma_id_register(
id_object,
defoma_id_unregister(
id_object,
@index = defoma_id_grep_cache(
id_object,
search-type,
@hints = defoma_id_get_hints( id_object, index ); defoma_id_set( id_object, id, font, flag ); defoma_id_unset( id_object, id, font ); DESCRIPTIONDefoma::Id is a Defoma module to handle identifiers of fonts and id-caches. It provides functions listed above which are supposed to be called from Defoma-configuration scripts.id-cache is sort of a database and its aim is to avoid name space confliction. Applications often access fonts through their identifiers, so it is desirable that one identifier point only one font. It is a difficult requirement for automatic configuration because it can easily happen that two or more fonts have the same identifier. Automatic configuration scripts can hardly detect which font is the best to be named the identifier, or even such a situation occur. Defoma::Id is help for this problem.
The rough flow of how Defoma::Id works is:
TYPE OF IDENTIFIERIt can handle three types of identifiers: RealName, Alias, and Substituted.
RealName
is a real name of a font and is usually taken from the FontName hint.
If you want to register a font to an id-cache, at least one RealName
must be registered. You can pass the hints to
options
when you register a RealName.
DETAIL OF HOW DEFOMA::ID WORKSRegistration and Unregistraton of ids of a font are usually performed on Defoma-configuration scripts at register and unregister commands respectively, and actual installation and removal for a certain id of a font must not be performed at register and unregister commands, but at do-install-(real,alias,subst) and do-remove-(real,alias,subst) commands respectively. Following explains how an id of a font is registered/unregistered to/from an id-cache.
These processes make only one, more appropriate font provide an certain id, so the name-space confliction would be avoided. FORMAT OF ID CACHEid-cache holds eight items for each entry: id, font, type, priority, category, depid, depfont and hints.type represents the type of the entry in a combination of some letters. id-cache handles font entry and mark entry. The latter is used to have a certain less prior font installed for a certain id (i.e. marked as USE), or to keep a certain font from being installed for a certain id (i.e. marked as EXCLUDE), and is supposed to be set by users and not to be refered from Defoma-configuration scripts, just for internal use. On the other hand, font entry holds information of a certain id of a cont and may be refered from the scripts. type consists of two or three letters. The first letter represents the type of the entry and is either S or M (font entry or mark entry, respectively). If the first letter is S, which means it is font entry, the second letter represents the type of the font and is either r, a, S (real, alias or subst respectively). If the first letter is M, which means it is mark entry, the second letter represents the type of the mark and either of u or x (use or exclude respectively). If the entry is font entry, which means the first letter is S, and the font and the id of the entry is INSTALLED, there's a third letter and it is I. depid and depfont represent dependency of the id of the font. The font never gets installed unless the depfont is installed for the depid. origin and depend arguments of defoma_id_register affect these items. If the id of the font doesn't depend on any other id and/or font, these items are set to '.'. hints represents the hints of the id of the font. It is specified by hints argument of defoma_id_register. You must use defoma_id_get_hints to access the value of this item. An item of each entry of an id-cache are accessible as an element of id-object whose key is e_id, e_font, e_type, e_priority, e_category, e_depid, e_depfont. For example, $Id->{e_font}->[3] accesses the font of entry #3 of id-object $Id.
Here's an example of an id-cache. # e_id e_font e_type e_priority e_category ... 0 Helvetica a.pfa SrI 20 type1 ... 1 Courier a.pfa Sa 20 type1 ... 2 Times-Roman b.ttf SrI 30 truetype ... 3 Courier b.ttf SaI 30 truetype ...It show a.pfa has two identifiers: Helvetica for RealName and Courier for Alias, and b.ttf has two identifiers: Times-Roman for RealName and Courier For Alias. Two fonts have the same identifier Courier, but this id-cache makes Courier point to b.ttf (in other words, lets b.ttf provide Courier). FUNCTIONSdefoma_id_open_cache is a function used to open an id-cache. id-caches are independent between applications so usually a Defoma-configuration script of a certain application cannot open an id-cache of another application. Each application can have more than one id-caches, and each of them are distinguished by its suffix unique to the application. You can omit the suffix argument if the application uses only one id-cache. package_name should be omitted for most cases. It returns id_object which is used as a descriptor for further handling of the id-cache.defoma_id_close_cache is a function used to close an id-cache. Internally it writes the content of an id-cache to the file which is identified by id_object.
defoma_id_register
is a function used to register a font and one of its ids to an id-cache
identified by
id_object.
defoma_id_unregister is a function used to unregister one or all registered id(s) of a certain font from and id-cache. If id is specified, only the id of the specified font is unregistered from the id-cache specified by id_object. Otherwise, all ids of the font are unregistered. defoma_id_grep_cache is a function that searches the id-cache specified by id_object for the specified id/font/category/depid/depfont, and returns a list of indexes. search-type is either of real, alias, subst, font, installed or mark, which narrows down the subjects of searching. id ,font ,type ,category ,depid and depfont decides the subjects of searching more specifically. Not all of these, nor none of these are required. defoma_id_get_hints is a function that returns hints of the index of the id-cache specified by id_object . If the index of Alias or Substituted is specified, it returns the hints of its RealName that is specified in the origin argument of defoma_id_register when the Alias/Substituted identifier was registered. defoma_id_set is a function used to make the specified font provide the specified id, or to prevent the specified font from providing the specifid id. install or exclude may be given to the flag. defoma_id_unset is a function used to unset the set flag of the specified idandfont. EXAMPLES# Open an id-cache with 'test' as its suffix. $Id = defoma_id_open_cache('test'); # register ids in register command. my $font = shift; my $h = parse_hints_start('Alias', @_); my $fontname = $h->{FontName}; my @alias = split(/ /, $h->{Alias}); my $pri = $h->{Priority}; defoma_id_register($Id, type => 'real', font => $font, id => $fontname, priority => $pri, hints => join(' ', @_); foreach my $i (@alias) { defoma_id_register($Id, type => 'alias', font => $font, id => $i, priority => $pri, origin => $fontname); } # unregister ids. defoma_id_unregister($Id, type => 'alias', font => $font); defoma_id_unregister($Id, type => 'real', font => $font); # close an id-cache defoma_id_close_cache($Id); # get a list of indexes of installed fonts that have #'Helvetica' for the id. my @list = defoma_id_grep_cache($Id, 'installed', id => 'Helvetica'); SEE ALSOdefoma(1). Defoma::Font(1). Defoma::Subst(1).
Index
This document was created by man2html, using the manual pages. Time: 07:54:03 GMT, April 23, 2024 |