C:/usr/src/avr/plotter/htext.h File Reference

#include <inttypes.h>
#include <avr/pgmspace.h>
#include "motori.h"

Go to the source code of this file.

Functions

void text_init ()
void text_setscale (double sx, double sy)
void text_scale_cm (double cx, double cy)
void text_scale_rel (double rx, double ry)
void text_direction (double cost, double sint)
void text_beginlabel ()
uint8_t text_char (uint8_t c, STEPPER_COORD *dstx, STEPPER_COORD *dsty, uint8_t *pen)

Variables

PGM_P charset173 [256]
PGM_P charset0 [256]


Function Documentation

void text_beginlabel (  ) 

Definition at line 63 of file htext.c.

uint8_t text_char ( uint8_t  c,
STEPPER_COORD dstx,
STEPPER_COORD dsty,
uint8_t *  pen 
)

Definition at line 68 of file htext.c.

void text_direction ( double  cost,
double  sint 
)

Definition at line 44 of file htext.c.

void text_init (  ) 

Definition at line 18 of file htext.c.

void text_scale_cm ( double  cx,
double  cy 
)

Definition at line 30 of file htext.c.

void text_scale_rel ( double  rx,
double  ry 
)

Definition at line 37 of file htext.c.

void text_setscale ( double  sx,
double  sy 
)

Definition at line 23 of file htext.c.


Variable Documentation

PGM_P charset0[256]

This file defines a standard character set by elementary "draw" & "move" commands. The format is a very compact one from the old days where every byte was still appreciated.

A font or character set is an array of strings. Each character corresponds to one of these strings, which is addressed by its ASCII code.

A character is a (NULL-terminated) string of bytes. Each byte codes for a draw or move action according to the code below:

Bit: 7 6 5 4 3 2 1 0 p x x x y y y y

p: Plot flag. If set, "draw to" new point, else "move to" it. xxx: 3-bit unsigned integer (0...7). X coordinate of new point. yyyy: 4-bit unsigned integer (0..15). Y coordinate of new point.

The baseline is y = 4 instead of y = 0, so characters with parts below it can be drawn properly without a need for sign bits. Function "code_to_ucoord()" transforms these coordinates into actual user coordinates.

Example: code for character 'L': "\032\224\324" translates to: moveto(1,10); drawto(1,4); drawto(5,4);

From the example you can conclude that the font below essentially is defined on a 5x7 grid:

0 1 2 3 4 5 6 7 15 . . . . . . . . . : unused 14 . . . . . . . . * : always used 13 . . . . . . . . o : sometimes used 12 . . . . . . . . 11 . . . . . . . . 10 o * * * * * . . 9 o * * * * * . . 8 o * * * * * . . 7 o * * * * * . . 6 o * * * * * . . 5 o * * * * * . . 4 o * * * * * . . 3 o o o o o o . . 2 o o o o o o . . 1 o o o o o o . . 0 o o o o o o . . The following array of strings contains the basic character set (set 0).

NOTE: A nice way to add a new charset would be, e. g., to introduce a ``charset1[]'' as the "alternate" charset and implement the HP-GL commands needed for switching from one to the other.

Definition at line 85 of file charset0.c.

PGM_P charset173[256]

This file defines a standard character set by elementary "draw" & "move" commands. The format is a very compact one from the old days where every byte was still appreciated.

A font or character set is an array of strings. Each character corresponds to one of these strings, which is addressed by its ASCII code.

A character is a (NULL-terminated) string of bytes. Each byte codes for a draw or move action according to the code below:

Bit: 7 6 5 4 3 2 1 0 p x x x y y y y

p: Plot flag. If set, "draw to" new point, else "move to" it. xxx: 3-bit unsigned integer (0...7). X coordinate of new point. yyyy: 4-bit unsigned integer (0..15). Y coordinate of new point.

The baseline is y = 4 instead of y = 0, so characters with parts below it can be drawn properly without a need for sign bits. Function "code_to_ucoord()" transforms these coordinates into actual user coordinates.

Example: code for character 'L': "\032\224\324" translates to: moveto(1,10); drawto(1,4); drawto(5,4);

From the example you can conclude that the font below essentially is defined on a 5x7 grid:

0 1 2 3 4 5 6 7 15 . . . . . . . . . : unused 14 . . . . . . . . * : always used 13 . . . . . . . . o : sometimes used 12 . . . . . . . . 11 . . . . . . . . 10 o * * * * * . . 9 o * * * * * . . 8 o * * * * * . . 7 o * * * * * . . 6 o * * * * * . . 5 o * * * * * . . 4 o * * * * * . . 3 o o o o o o . . 2 o o o o o o . . 1 o o o o o o . . 0 o o o o o o . . The following array of strings contains the ps math font (173), which differs from ventura math (205) only in the sequence of characters in the upper half of the font

Definition at line 83 of file font173.c.


Generated on Sat Jul 4 05:27:39 2009 for motori by  doxygen 1.5.9