XRotLoadFont

Section: C Library Functions (3)
Updated: 8 Dec 1992
Index Return to Main Contents
 

NAME

XRotVersion, XRotLoadFont, XRotUnloadFont, XRotTextWidth - manipulate rotated fonts  

SYNOPSIS

float XRotVersion(copyright, nmax)
char *copyright;
int nmax;

XRotFontStruct *XRotLoadFont(dpy, fontname, angle)
Display *dpy;
char *fontname;
float angle;

void XRotUnloadFont(dpy, rotfont)
Display *dpy;
XRotFontStruct *rotfont;

int XRotTextWidth(rotfont, str, len)
XRotFontStruct *rotfont;
char *str;
int len;  

ARGUMENTS

copyright
A character string to hold copyright information.
nmax
The maximum number of characters to be placed in copyright.
display
Specifies the connection to the X server.
fontname
Name of the font to load and rotate.
angle
Angle of rotation desired in degrees.
rotfont
An XRotFontStruct structure, returned by XRotLoadFont, describing a rotated font.
str
A character string.
len
The number of characters in str.
 

DESCRIPTION

The XRotVersion function returns the current version number of the xvertext routines. It also places into copyright at most nmax characters of a copyright string.

The XRotLoadFont function loads the font described by fontname and rotates each printing character in turn by the given angle. Angle should be a whole multiple of 90 degrees, otherwise it is rounded to the nearest such multiple. Positive angles are deemed to be anticlockwise, negative angles clockwise. XRotLoadFont returns an XRotFontStruct structure containing a complete description of the rotated font.

The XRotUnloadFont function frees the resources associated with the given XRotFontStruct structure. This font should not be referenced again.

The XRotTextWidth function calculates the length of a string in pixels if painted in a particular rotated font. In fact, this is just the length the Xlib function XTextWidth would return if the font were not rotated. The height of the tallest character in a font is given by the height member of the XRotFontStruct structure (see below).  

STRUCTURES

The XRotFontStruct structure is loosely modeled on the Xlib structure XFontStruct, with some unnecessary information omitted:

typedef struct {
    int                  dir;
    int                  height;
    int                  max_ascent;
    int                  max_descent;
    int                  max_char;
    int                  min_char;
    char                *name;


    XFontStruct         *xfontstruct;


    XRotCharStruct       per_char[95]; } XRotFontStruct;

The value of dir is 0,1,2 or 3 corresponding to 0, 90, 180 and 270 degrees. The members height, max_ascent, and max_descent are overall font dimensions. The values max_char and min_char describe which characters in this font are defined. The xfontstruct member is only used for direction 0 (`normal') text, when no rotation is required.

The XRotCharStruct structure contains:

typedef struct {
    int                  ascent;
    int                  descent;
    int                  lbearing;
    int                  rbearing;
    int                  width;


    BitmapStruct         glyph; } XRotCharStruct;

This gives per-character size information; the BitmapStruct structure holds the rotated bitmap for a particular character:

typedef struct {
    int                  bit_w;
    int                  bit_h;


    Pixmap               bm; } BitmapStruct;

 

DIAGNOSTICS

XRotLoadFont returns NULL if it fails. The integer xv_errno, declared in rotated.h, is set to a value describing the reason for failure:
XV_NOFONT
No font called fontname could be loaded by the X server.
XV_NOMEM
A call to malloc failed.
XV_NOXIMAGE
A call to XCreateImage failed.
 

SEE ALSO

xvertext, XRotDrawString, XRotDrawImageString, XRotDrawAlignedString, XRotDrawAlignedImageString.


 

Index

NAME
SYNOPSIS
ARGUMENTS
DESCRIPTION
STRUCTURES
DIAGNOSTICS
SEE ALSO

This document was created by man2html, using the manual pages.
Time: 00:35:28 GMT, March 26, 2025