Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ fta(3) — NEWS-os 4.1C

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

fonttab(5)

FTA(3)  —  NEWS-OS Programmer’s Manual

NAME

fta − Library for font table access

SYNOPSIS

#include<stdio.h>
#include<CDFF/fta.h>
s_fonttab ∗load_fonttab()
s_fonttab ∗get_fouttabbyname(tp, s)
s_fonttab ∗tp;
char ∗s;
free_fonttab(tp)
s_fonttab ∗tp;
s_dfpath ∗get_dfontpath(dp)
char ∗dp;
free_dfontpath(dfp)
s_dfpath ∗dfp;

DESCRIPTION

The group of functions shown above are all located in the library libfta.a. This library is provided for accessing font tables.
The number of available fonts can be greatly increased by using this library together with the the outline fonts provided in multi font sets (NWF-629 etc.). Application programs which handle fonts can obtain information concerning which fonts are installed by accessing the file /usr/sony/etc/fonttab.  Functions in libfta.a are provided so that information listed in this font data table may be easily read. 
Before beginning descriptions of each function in the library, a description of the data structure s_fonttab is in order.  This structure is defined as follows. 

typedefstruct chain {
char∗name;/∗ font entry name ∗/
struct chain ∗next;/∗ next entry name ∗/
} s_chain;
typedefstruct ftb {
s_chain ∗entry;/∗ font entry name ∗/
s_existtc;/∗ typeface code ∗/
s_existdg;/∗ design group ∗/
s_existaf;/∗ alternative font ∗/
s_existvs;/∗ vector font coding scheme ∗/
s_existds;/∗ dot font coding scheme ∗/
s_existth;/∗ roff thickness ∗/
s_existol;/∗ roff outline ∗/
s_chain∗rn;/∗ roff font ∗/
char∗cc;/∗ code category ∗/
char∗nm;/∗ name used for application ∗/
char∗vp;/∗ vector font path ∗/
char∗dp;/∗ dot font path ∗/
struct ftb ∗next;/∗ next font entry ∗/
}s_fonttab;
typedefstructdfp {
char∗path;/∗ dot font path ∗/
intw;/∗ width pixel ∗/
inth;/∗ height pixel ∗/
struct dfp ∗next;
}s_dfpath;

Each entry corresponds to one font file.  In addition, this structure defines a link list.  For descriptions of each member, see fonttab (5).  Descriptions of each function in the library are given below. 

s_fonttab ∗load_fonttab()
Opens the font table and reads all information listed there into memory secured in the form of an s_fonttab link list.  If the information is read successfully, the function returns a pointer to the first entry in s_fonttab. If it fails it returns 0. 

s_fonttab ∗get_fouttabbyname(tp, s)

s_fonttab ∗tp;

char ∗s;
Gets the font ID (for R, HI, etc.) of the font used by ditroff and returns a pointer to the corresponding entry in s_fonttab.  The function returns 0 if the entry name s cannot be found.  The parameter tp uses the value obtained using load_fonttab(). 

free_fonttab(tp)

s_fonttab ∗tp;
Frees the memory secured for load_fonttab().  The parameter tp uses the value obtained using load_fonttab(). 

s_dfptah ∗get_dfontpath(dp)

char ∗dp;
Gets the size actually being used for the dot font based on the value of member dp in s_fonttab obtained using load_fonttab() and returns the information in the form of a s_dfpath link list. 

free_dfontpath(dfp)

s_dfpath ∗dfp;
Frees the memory secured for get_dfontpath().  The parameter dfp uses the value obtained using get_dfontpath(). 

USAGE

The following source code is an example of a program which reads the name and typeface code of a font. 

s_fonttab ∗tp0, ∗tp;
int n;
if((tp0= (s_fonttab ∗)load_fonttab()) == 0)
/∗ ERROR ∗/;
for(tp=tp0, n=0; tp; tp=tp−>next, n++) {
strcpy( name[n], tp−>nm );
code[n]= tp−>tc.value;
}

free_fonttab(tp0);

SEE ALSO

fonttab(5)

BUGS

At present, filenames specified for nm which begin with the character "/" cannot be looked up. 

NEWS-OSRelease 4.1C

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026