Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ FSlib(3) — NEWS-os 4.1C

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

fta(3)

fonttab(5)

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

NAME

FSlib − Sony format outline font operation library

SYNOPSIS

#include <FS.h>
int FS_open_font(fontname)
(absolute path) ∗/
char ∗fontname;/∗ outline font name (absolute path) ∗/}
int FS_close_font(fd)
int fd;/∗ font descriptor for outline font ∗/
int FS_get_outline(c, fd, buf)
int c;/∗ continuous kanji codes ∗/
int fd;/∗ font descriptor for outline font ∗/
int ∗∗buf;/∗ pointer to readout buffer ∗/
int FS_scan_conv(vk_buf, w, h, bw, bo, bm_buf, thick, frame, smooth)
int smooth;/∗ Beizer curve smoothness ∗/
 long ∗vk_buf;/∗ address of outline font data ∗/
int w;/∗ bitmap font horizontal width specification (pixels) ∗/
int h;/∗ bitmap font vertical width specification (pixels) ∗/
int bw;/∗ distance between rasters in bitmap font (bytes) ∗/
int bo;/∗ top position offset specification for bitmap font writes ∗/
char ∗bm_buf;/∗ top position address specification for bitmap font writes ∗/
int thick;/∗ outline thickness (1:thick, 0:thin) ∗/
int frame;/∗ 0:solid black, 1:hollow ∗/
int smooth;/∗ Beizer curve smoothness ∗/
int FS_get_bitmap(c, fd, w, h, bw, bo, bm_buf, thick, frame, smooth)
int smooth;/∗ Beizer curve smoothness ∗/
int c;/∗ continuous kanji codes ∗/
int fd;/∗ font descriptor for outline font ∗/
int w;/∗ bitmap font horizontal width specification (pixels) ∗/
int h;/∗ bitmap font vertical width specification (pixels) ∗/
int bw;/∗ distance between rasters in bitmap font (bytes) ∗/
int bo;/∗ top position offset specification for bitmap font writes ∗/
char ∗bm_buf;/∗ top position address specification for bitmap font writes ∗/
int thick;/∗ outline thickness (1: thick, 0: thin) ∗/
int frame;/∗ 0: solid black, 1: hollow ∗/
int smooth;/∗ Beizer curve smoothness ∗/
void FS_set_f_xform(rotate, refx, refy)

int rotate; /∗ number of 90-degree clockwise rotations ∗/
int refx;   /∗ top-bottom flip specification flag ∗/
int refy;  /∗ left-right flip specification flag ∗/
void FS_fast_xform(vk, rotate, refx, refy)

long ∗vk; /∗ address where outline font data is stored ∗/
int rotate;/∗ number of 90-degree clockwise rotations ∗/
int refx; /∗ top-bottom flip specification flag ∗/
int refy; /∗ left-right flip specification flag ∗/
void FS_set_m_xform(t1, t2, t3, t4, t5, t6)

double t1, t2, t3, t4, t5, t6;
/∗ conversion matrix parameters ∗/
void FS_mat_xform(x, y, t1, t2, t3, t4, t5, t6)

int ∗x, ∗y;/∗ coordinate values ∗/
double t1, t2, t3, t4, t5, t6;
/∗ conversion matrix parameters ∗/

DESCRIPTION

The functions listed here are to be found in libFSlib.a, the Sony format outline font operation library.  This library is used for tasks such as reading Sony format outline font data (NWF-605, NWF-629, etc.)  and generating bitmap images through raster conversion of Sony format outline font data.  Descriptions of each individual function follow. 

int FS_open_font(fontname)
Opens the outline font file designated by the absolute pathname fontname. 
If the operation is successful, zero or more integer values are returned. This value is called the font descriptor. (Care should be taken to avoid conflicting font descriptors.) If the file cannot be opened successfully, a negative error code is returned.

int FS_close_font(fd)
Closes the outline font font descriptor fd. 
A 0 is returned if the operation is successful. A negative error code is returned in case of failure.

int FS_get_outline(c, fd, buf)
Reads the font data for which the code is c (continuous kanji codes) from among the font data specified by the font descriptor fd.  At this point, if a context has been specified using FS_set_f_xform(), it is adhered to.  The read buffer is assigned by this function.  The address assigned is stored in the pointer specified by buf.  (When this buffer is no longer needed, it is released using the standard UNIX library function free().) 
A 0 is returned if the operation is successful. A negative error code is returned in case of failure.
Continuous kanji codes are defined as follows.

Continuous kanji codes =
(JIS upper 8 bits − 0x21)∗94 + (JIS lower 8 bits − 0x21)

int FS_scan_conv(vk_buf,w,h,bw,bo,bm_buf,thick,frame,smooth)
From the outline font data specified by vk_buf, this function creates bitmap font data of horizontal width w and vertical width (height) h, and writes it to the buffer specified by bm_buf.  (It is necessary to allocate the buffer specified by bm_buf from the calling side beforehand.) 
Each raster begins in a position bo bits from the byte boundary.  The data is generated with the beginning of each raster separated bw bytes from the preceding one. 
If a context has been specified using FS_set_f_xform(), it is adhered to. 
If a value of 1 is specified for thick, the outlines will be thick.  If 0 is specified thin outlines are used.  If frame is set to 1 the inside of the outline will not be filled in (hollow).  The outline is filled in if 0 is specified (solid black). 
The parameter smooth specifies the smoothness with which Beizer curves will be generated.  The valid range of values is 1 through 204800.  The smaller the value, the smoother the generated curves will be.  Note that if 0 is specified, the default value, calculated using the following equation, is used. 

((int)sqrt(8192.0 / (double)((w < h) ? w : h) + 0.5)) << 16

A 0 is returned if the operation is successful.  A negative error code is returned in case of failure.  [Note] The page buffer to which characters are written starts at address pa, and is px pixels wide and py pixels high.  The bw variable of FS_scan_conv() sets the number of bytes per raster in the page buffer [(px+7)/8].  When a bitmap font is written to the coordinates (x, y) of the page buffer, the values of the variables bo  and bm_buf of FS_scan_conv() are as follows. 

    bo = x % 8;
    bm_buf = pa + (bw ∗ y) + (x / 8);

int FS_get_bitmap(c,fd,w,h,bw,bo,bm_buf,thick,frame,smooth)
Reads the font data for which the code is c (continuous kanji codes) from among the font data specified by the font descriptor fd (if a context has been specified using FS_set_f_xform(), it is adhered to).  A bitmap font is then created (if a context has been specified using FS_set_m_xform(), it is adhered to) and written to the buffer specified by bm_buf.  (It is necessary to allocate the buffer specified by bm_buf from the calling side beforehand.) 
If a value of 1 is specified for thick, the outlines will be thick.  If 0 is specified thin outlines are used.  If frame is set to 1, the inside of the outline will not be filled in (hollow).  The outline is filled in if 0 is specified (solid black). 
The parameter smooth specifies the smoothness with which Beizer curves will be generated.  Refer to the description of FS_scan_conv() for details. 
A 0 is returned if the operation is successful. A negative error code is returned in case of failure. [Note] The page buffer to which characters are written starts at address pa, and is px pixels wide and py pixels high.  The bw variable of FS_get_bitmap() sets the number of bytes per raster in the page buffer [(px+7)/8].  When a bitmap font is written to the coordinates (x, y) of the page buffer, the values of the variables bo  and bm_buf of FS_get_bitmap() are as follows. 

    bo = x % 8;
    bm_buf = pa + (bw ∗ y) + (x / 8);

void FS_set_f_xform(rotate, refx, refy)
If this setting is performed, calling FS_get_outline() or FS_get_bitmap() causes the following conversions to take place. 

Characters are rotated 90 degrees the number
of times specified by the setting of rotate.
Characters are top-bottom flipped if refx is set to 1.
Characters are left-right flipped if refy is set to 1.

These settings remain in effect until they are reset. 

void FS_fast_xform(vk, rotate, refx, refy)
Outline font data is converted by vk based on the settings of rotate, refx, and refy.  Refer to the description of FS_set_f_xform() for details of rotate, refx and refy. 

void FS_set_m_xform(t1, t2, t3, t4, t5, t6)
When these setting are made, the following conversions are performed on the x and y coordinates when FS_scan_conv() or FS_get_bitmap() is used to generate a bitmap font. 

    x = t1∗x + t2∗y + t3;
    y = t4∗x + t5∗y + t6;

These settings remain in effect until they are reset. 

void FS_mat_xform(x, y, t1, t2, t3, t4, t5, t6)
Performs 3x3 matrix conversion on coordinate values of the type shown below. 

    ∗x = t1∗(∗x) + t2∗(∗y) + t3;
    ∗y = t4∗(∗x) + t5∗(∗y) + t6;

NOTE
The negative error codes returned when execution of the above functions fails are defined in /usr/sony/include/FS.h.  The array err_message[n] acts as a pointer to a character strings which is displayed as error message in response to an error code with an absolute value of n. 

SEE ALSO

fta(3), fonttab(5)
NEWS-OS Release 4.1 Programmer’s Guide “Outline Font Operation Library” NEWS-OS Release 4.1 Programmer’s Guide “Outline Font Operation Library”

NEWS-OSRelease 4.1C

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