Beispiel #1
0
uint16_t picaso4d::strwidth(const char * str) {
	uint16_t width = charwidth(*str++);
	while (*str) {
		width += charwidth(*str++);
	}
	return width;
}
Beispiel #2
0
Datei: frutil.c Projekt: 4ad/sam
int
_frcanfit(Frame *f, Point pt, Frbox *b)
{
	int left, w, nr;
	uchar *p;
	Rune r;

	left = f->r.max.x-pt.x;
	if(b->nrune < 0)
		return b->a.b.minwid <= left;
	if(left >= b->wid)
		return b->nrune;
	for(nr=0,p=b->a.ptr; *p; p+=w,nr++){
		r = *p;
		if(r < Runeself)
			w = 1;
		else
			w = chartorune(&r, (char*)p);
		left -= charwidth(f->font, r);
		if(left < 0)
			return nr;
	}
	berror("_frcanfit can't");
	return 0;
}
Beispiel #3
0
void
frinit(Frame *f, Rectangle r, Font *ft, Bitmap *b)
{
	f->font = ft;
	f->maxtab = 8*charwidth(ft, '0');
	f->nbox = 0;
	f->nalloc = 0;
	f->nchars = 0;
	f->nlines = 0;
	f->p0 = 0;
	f->p1 = 0;
	f->box = 0;
	f->lastlinefull = 0;
	frsetrects(f, r, b);
}
Beispiel #4
0
void PrintBuffer9pin( unsigned char *c ) {
	extern int maxdot;
	register int i;
	int left, right, length;
	charwidth( c );											/* alternate character width in cpi.obj */
	left = ltrim( c, 0, maxdot );
	right = rtrim( c, 0, maxdot );
	for ( i = 0; i < left; i++ ) {
		putp( ' ' );										/* text mode */
	}
	length = right - ( left * 24 );
	if ( length != 0 ) {
		PrinterSetGraphicMode9pinQuadrupleDensity( length );
		for ( i = 0; i< length; i++ ) {
			putp( c[( left * 24 ) + i] );					/* graphic (bit image) print */
		}
	}
}
void text_Tests(void)
{
	gfx_Cls() ;
	printf("Text Tests\n") ;
	putstr("Text Tests") ;

	txt_Attributes(BOLD + INVERSE + ITALIC + UNDERLINED) ;
	txt_Xgap(3) ;
	txt_Ygap(3) ;
	txt_BGcolour(YELLOW) ;
	txt_FGcolour(WHITE) ;
	txt_FontID(FONT3) ;
	txt_MoveCursor(5, 0) ;
	putstr("Hello There") ;

	txt_MoveCursor(6, 2) ;
	txt_Height(2) ;
	txt_Width(2) ;
	txt_Inverse(OFF) ;
	txt_Italic(OFF) ;
	txt_Opacity(TRANSPARENT) ;
	txt_Set(TEXT_COLOUR, LIME) ;
	txt_Underline(ON) ;
	txt_Bold(OFF) ;
	txt_Wrap(88) ;
	putstr("Hello There") ;
	txt_Height(1) ;
	txt_Width(1) ;
	putCH('z') ;
	txt_Wrap(0) ;              // reset
	printf("Char height= %d Width= %d\n", charheight('w'), charwidth('w') ) ;
	txt_BGcolour(BLACK) ;
	txt_FGcolour(LIME) ;
	txt_FontID(FONT3) ;
	txt_MoveCursor(0,0) ;      // reset
}