PLplot  5.15.0
plsym.c File Reference
#include "plplotP.h"
#include <float.h>
#include <ctype.h>
#include "plhershey-unicode.h"

Go to the source code of this file.

Macros

#define __PLSYM_H__
 
#define DEBUG
 
#define NEED_PLDEBUG
 
#define PLMAXSTR   300
 
#define STLEN   250
 

Functions

int hershey2unicode (int in)
 
static void pldeco (short int **sym, PLINT *length, PLCHAR_VECTOR text)
 
static void plchar (signed char *xygrid, PLFLT *xform, PLINT base, PLINT oline, PLINT uline, PLINT refx, PLINT refy, PLFLT scale, PLFLT xpmm, PLFLT ypmm, PLFLT *p_xorg, PLFLT *p_yorg, PLFLT *p_width)
 
static PLINT plcvec (PLINT ch, signed char **xygr)
 
static void plhrsh2 (PLINT ch, PLINT x, PLINT y)
 
void c_plstring (PLINT n, PLFLT_VECTOR x, PLFLT_VECTOR y, PLCHAR_VECTOR string)
 
void c_plsym (PLINT n, PLFLT_VECTOR x, PLFLT_VECTOR y, PLINT code)
 
void c_plpoin (PLINT n, PLFLT_VECTOR x, PLFLT_VECTOR y, PLINT code)
 
void c_plpoin3 (PLINT n, PLFLT_VECTOR x, PLFLT_VECTOR y, PLFLT_VECTOR z, PLINT code)
 
void c_plstring3 (PLINT n, PLFLT_VECTOR x, PLFLT_VECTOR y, PLFLT_VECTOR z, PLCHAR_VECTOR string)
 
void plhrsh (PLINT ch, PLINT x, PLINT y)
 
void c_pllab (PLCHAR_VECTOR xlabel, PLCHAR_VECTOR ylabel, PLCHAR_VECTOR tlabel)
 
void c_plmtex (PLCHAR_VECTOR side, PLFLT disp, PLFLT pos, PLFLT just, PLCHAR_VECTOR text)
 
void c_plptex (PLFLT wx, PLFLT wy, PLFLT dx, PLFLT dy, PLFLT just, PLCHAR_VECTOR text)
 
void plstr (PLINT base, PLFLT *xform, PLINT refx, PLINT refy, PLCHAR_VECTOR string)
 
PLFLT plstrl (PLCHAR_VECTOR string)
 
PLINT plP_strpos (PLCHAR_VECTOR str, int chr)
 
PLINT plP_stindex (PLCHAR_VECTOR str1, PLCHAR_VECTOR str2)
 
PLBOOL plP_stsearch (PLCHAR_VECTOR str, int chr)
 
void plP_script_scale (PLBOOL ifupper, PLINT *level, PLFLT *old_scale, PLFLT *scale, PLFLT *old_offset, PLFLT *offset)
 
void c_plfont (PLINT ifont)
 
void plfntld (PLINT fnt)
 
void plfontrel (void)
 
int plhershey2unicode (int in)
 
PLCHAR_VECTOR plP_FCI2FontName (PLUNICODE fci, const FCI_to_FontName_Table lookup[], const int nlookup)
 
void c_plmtex3 (PLCHAR_VECTOR side, PLFLT disp, PLFLT pos, PLFLT just, PLCHAR_VECTOR text)
 
void c_plptex3 (PLFLT wx, PLFLT wy, PLFLT wz, PLFLT dx, PLFLT dy, PLFLT dz, PLFLT sx, PLFLT sy, PLFLT sz, PLFLT just, PLCHAR_VECTOR text)
 
void c_plsfont (PLINT family, PLINT style, PLINT weight)
 
void c_plgfont (PLINT *p_family, PLINT *p_style, PLINT *p_weight)
 

Variables

static short int * fntlkup
 
static short int * fntindx
 
static signed char * fntbffr
 
static short int numberfonts
 
static short int numberchars
 
static short int indxleng
 
static short fontloaded = 0
 
static const char font_types [] = "nris"
 
static short symbol_buffer [PLMAXSTR]
 
static signed char xygrid [STLEN]
 

Detailed Description

Point-, symbol-, and string-plotting routines.

Definition in file plsym.c.

Macro Definition Documentation

◆ __PLSYM_H__

#define __PLSYM_H__

Definition at line 44 of file plsym.c.

◆ DEBUG

#define DEBUG

Definition at line 45 of file plsym.c.

◆ NEED_PLDEBUG

#define NEED_PLDEBUG

Definition at line 46 of file plsym.c.

◆ PLMAXSTR

#define PLMAXSTR   300

Definition at line 64 of file plsym.c.

◆ STLEN

#define STLEN   250

Definition at line 65 of file plsym.c.

Function Documentation

◆ c_plfont()

void c_plfont ( PLINT  ifont)

Definition at line 1341 of file plsym.c.

◆ c_plgfont()

void c_plgfont ( PLINT p_family,
PLINT p_style,
PLINT p_weight 
)

Definition at line 2138 of file plsym.c.

◆ c_pllab()

void c_pllab ( PLCHAR_VECTOR  xlabel,
PLCHAR_VECTOR  ylabel,
PLCHAR_VECTOR  tlabel 
)

Definition at line 549 of file plsym.c.

◆ c_plmtex()

void c_plmtex ( PLCHAR_VECTOR  side,
PLFLT  disp,
PLFLT  pos,
PLFLT  just,
PLCHAR_VECTOR  text 
)

Definition at line 594 of file plsym.c.

◆ c_plmtex3()

void c_plmtex3 ( PLCHAR_VECTOR  side,
PLFLT  disp,
PLFLT  pos,
PLFLT  just,
PLCHAR_VECTOR  text 
)

Definition at line 1610 of file plsym.c.

◆ c_plpoin()

void c_plpoin ( PLINT  n,
PLFLT_VECTOR  x,
PLFLT_VECTOR  y,
PLINT  code 
)

Plot a glyph at the specified points. (This function is largely superseded by plstring which gives access to many[!] more glyphs.) code=-1 means try to just draw a point. Right now it's just a move and a draw at the same place. Not ideal, since a sufficiently intelligent output device may optimize it away, or there may be faster ways of doing it. This is OK for now, though, and offers a 4X speedup over drawing a Hershey font "point" (which is actually diamond shaped and and therefore takes 4 strokes to draw). If 0 < code < 32, then a useful (but small subset) of Hershey symbols is plotted. If 32 <= code <= 127 the corresponding printable ASCII character is plotted.

Parameters
nNumber of points in x and y arrays.
xPointer to an array with X coordinates of points.
yPointer to an array with Y coordinates of points.
codeHershey symbol code (in "ascii-indexed" form with -1 <= code <= 127) corresponding to a glyph to be plotted at each of the n points.

Definition at line 172 of file plsym.c.

◆ c_plpoin3()

void c_plpoin3 ( PLINT  n,
PLFLT_VECTOR  x,
PLFLT_VECTOR  y,
PLFLT_VECTOR  z,
PLINT  code 
)

Plot a glyph at the specified 3D points. (This function is largely superseded by plstring3 which gives access to many[!] more glyphs.) Set up the call to this function similar to what is done for plline3. code=-1 means try to just draw a point. Right now it's just a move and a draw at the same place. Not ideal, since a sufficiently intelligent output device may optimize it away, or there may be faster ways of doing it. This is OK for now, though, and offers a 4X speedup over drawing a Hershey font "point" (which is actually diamond shaped and therefore takes 4 strokes to draw). If 0 < code < 32, then a useful (but small subset) of Hershey symbols is plotted. If 32 <= code <= 127 the corresponding printable ASCII character is plotted.

Parameters
nNumber of points in x, y, and z arrays.
xPointer to an array with X coordinates of points.
yPointer to an array with Y coordinates of points.
zPointer to an array with Z coordinates of points.
codeHershey symbol code (in "ascii-indexed" form with -1 <= code <= 127) corresponding to a glyph to be plotted at each of the n points.

Definition at line 235 of file plsym.c.

◆ c_plptex()

void c_plptex ( PLFLT  wx,
PLFLT  wy,
PLFLT  dx,
PLFLT  dy,
PLFLT  just,
PLCHAR_VECTOR  text 
)

Definition at line 734 of file plsym.c.

◆ c_plptex3()

void c_plptex3 ( PLFLT  wx,
PLFLT  wy,
PLFLT  wz,
PLFLT  dx,
PLFLT  dy,
PLFLT  dz,
PLFLT  sx,
PLFLT  sy,
PLFLT  sz,
PLFLT  just,
PLCHAR_VECTOR  text 
)

Definition at line 1982 of file plsym.c.

◆ c_plsfont()

void c_plsfont ( PLINT  family,
PLINT  style,
PLINT  weight 
)

Definition at line 2094 of file plsym.c.

◆ c_plstring()

void c_plstring ( PLINT  n,
PLFLT_VECTOR  x,
PLFLT_VECTOR  y,
PLCHAR_VECTOR  string 
)

Plot a glyph at the specified points. (This function largely supersedes plpoin and plsym because many[!] more glyphs are accessible with plstring.) The glyph is specified with a PLplot user string. Note that the user string is not actually limited to one glyph so it is possible (but not normally useful) to plot more than one glyph at the specified points with this function. As with plmtex and plptex, the user string can contain FCI escapes to determine the font, UTF-8 code to determine the glyph or else PLplot escapes for Hershey or unicode text to determine the glyph.

Parameters
nNumber of points in x and y arrays.
xArray of X coordinates of points.
yArray of Y coordinates of points.
stringPLplot user string corresponding to the glyph to be plotted at each of the n points.

Definition at line 108 of file plsym.c.

◆ c_plstring3()

void c_plstring3 ( PLINT  n,
PLFLT_VECTOR  x,
PLFLT_VECTOR  y,
PLFLT_VECTOR  z,
PLCHAR_VECTOR  string 
)

Plot a glyph at the specified 3D points. (This function largely supersedes plpoin3 because many[!] more glyphs are accessible with plstring3). Set up the call to this function similar to what is done for plline3. The glyph is specified with a PLplot user string. Note that the user string is not actually limited to one glyph so it is possible (but not normally useful) to plot more than one glyph at the specified points with this function. As with plmtex and plptex, the user string can contain FCI escapes to determine the font, UTF-8 code to determine the glyph or else PLplot escapes for Hershey or unicode text to determine the glyph.

Parameters
nNumber of points in x, y, and z arrays.
xArray of X coordinates of points.
yArray of Y coordinates of points.
zArray of Z coordinates of points.
stringPLplot user string corresponding to the glyph to be plotted at each of the n points.

Definition at line 311 of file plsym.c.

◆ c_plsym()

void c_plsym ( PLINT  n,
PLFLT_VECTOR  x,
PLFLT_VECTOR  y,
PLINT  code 
)

Plot a glyph at the specified points. (This function is largely superseded by plstring which gives access to many[!] more glyphs.)

Parameters
nNumber of points in x and y arrays.
xPointer to an array with X coordinates of points.
yPointer to an array with Y coordinates of points.
codeHershey symbol code corresponding to a glyph to be plotted at each of the n points.

Definition at line 128 of file plsym.c.

◆ hershey2unicode()

int hershey2unicode ( int  in)

◆ plchar()

static void plchar ( signed char *  xygrid,
PLFLT xform,
PLINT  base,
PLINT  oline,
PLINT  uline,
PLINT  refx,
PLINT  refy,
PLFLT  scale,
PLFLT  xpmm,
PLFLT  ypmm,
PLFLT p_xorg,
PLFLT p_yorg,
PLFLT p_width 
)
static

Definition at line 870 of file plsym.c.

◆ plcvec()

static PLINT plcvec ( PLINT  ch,
signed char **  xygr 
)
static

Definition at line 1048 of file plsym.c.

◆ pldeco()

static void pldeco ( short int **  sym,
PLINT length,
PLCHAR_VECTOR  text 
)
static

Definition at line 1106 of file plsym.c.

◆ plfntld()

void plfntld ( PLINT  fnt)

Definition at line 1394 of file plsym.c.

◆ plfontrel()

void plfontrel ( void  )

Definition at line 1463 of file plsym.c.

◆ plhershey2unicode()

int plhershey2unicode ( int  in)

Definition at line 1490 of file plsym.c.

◆ plhrsh()

void plhrsh ( PLINT  ch,
PLINT  x,
PLINT  y 
)

Definition at line 359 of file plsym.c.

◆ plhrsh2()

static void plhrsh2 ( PLINT  ch,
PLINT  x,
PLINT  y 
)
static

Definition at line 475 of file plsym.c.

◆ plP_FCI2FontName()

PLCHAR_VECTOR plP_FCI2FontName ( PLUNICODE  fci,
const FCI_to_FontName_Table  lookup[],
const int  nlookup 
)

Definition at line 1548 of file plsym.c.

◆ plP_script_scale()

void plP_script_scale ( PLBOOL  ifupper,
PLINT level,
PLFLT old_scale,
PLFLT scale,
PLFLT old_offset,
PLFLT offset 
)

Calculate scale of font size and scale of magnitude of vertical offset associated with superscripts and subscripts. Notes on arguments: ifupper must be either TRUE or FALSE on every call to plP_script_scale. The contents of the location pointed to by the level pointer must be zero on the first call to plP_script_scale, but not modified externally from then on. The contents of the locations pointed to by all other pointer arguments are initialized internally, and should not be modified externally.

Parameters
ifupperValue which is TRUE if superscripting, i.e., if incrementing the previous level, and FALSE if subscripting, i.e., decrementing the previous level.
levelPointer to a location which contains the value of the superscript/subscript level. That value is 0, +-1, +-2, etc., for no superscript/subscript, the first level of superscript/subscript, the second level of superscript/subscript, etc. Before the call the value is the old level, and after the call the value will be incremented (ifupper TRUE) or decremented (ifupper FALSE) from the previous value.
old_scaleA pointer to a location that contains after the call the old font size scale value.
scaleA pointer to a location that contains after the call the font size scale value. This value is 0.75^{|level|} where |level| is the magnitude of the value of the superscript/subscript level after the call.
old_offsetA pointer to a location that contains after the call the old value of the magnitude of the superscript/subscript offset.
offsetA pointer to a location that contains after the call the value of the magnitude of the superscript/subscript offset which is zero for |level|=0 and sum_{i=1}^{i=|level|} 0.75^{i-1}, otherwise.

Definition at line 1302 of file plsym.c.

◆ plP_stindex()

PLINT plP_stindex ( PLCHAR_VECTOR  str1,
PLCHAR_VECTOR  str2 
)

Definition at line 1233 of file plsym.c.

◆ plP_strpos()

PLINT plP_strpos ( PLCHAR_VECTOR  str,
int  chr 
)

Definition at line 1216 of file plsym.c.

◆ plP_stsearch()

PLBOOL plP_stsearch ( PLCHAR_VECTOR  str,
int  chr 
)

Definition at line 1256 of file plsym.c.

◆ plstr()

void plstr ( PLINT  base,
PLFLT xform,
PLINT  refx,
PLINT  refy,
PLCHAR_VECTOR  string 
)

Definition at line 810 of file plsym.c.

◆ plstrl()

PLFLT plstrl ( PLCHAR_VECTOR  string)

Definition at line 976 of file plsym.c.

Variable Documentation

◆ fntbffr

signed char* fntbffr
static

Definition at line 57 of file plsym.c.

◆ fntindx

short int* fntindx
static

Definition at line 56 of file plsym.c.

◆ fntlkup

short int* fntlkup
static

Definition at line 55 of file plsym.c.

◆ font_types

const char font_types[] = "nris"
static

Definition at line 67 of file plsym.c.

◆ fontloaded

short fontloaded = 0
static

Definition at line 61 of file plsym.c.

◆ indxleng

short int indxleng
static

Definition at line 59 of file plsym.c.

◆ numberchars

short int numberchars
static

Definition at line 58 of file plsym.c.

◆ numberfonts

short int numberfonts
static

Definition at line 58 of file plsym.c.

◆ symbol_buffer

short symbol_buffer[PLMAXSTR]
static

Definition at line 69 of file plsym.c.

◆ xygrid

signed char xygrid[STLEN]
static

Definition at line 70 of file plsym.c.