⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 textext.c

📁 Nxlib,一个模拟xlib的程序。使用microwindows的库来运行需要xlib支持的程序。
💻 C
字号:
#include <stdio.h>#include <string.h>#include "nxlib.h"static int_nxTextWidth(XFontStruct * font, void *string, int count, int flag){	int w, h, b;	GR_GC_ID local = GrNewGC();	GrSetGCFont(local, font->fid);	GrGetGCTextSize(local, (void *) string, count, flag, &w, &h, &b);	GrDestroyGC(local);	return (w);}intXTextWidth(XFontStruct * font, _Xconst char *string, int count){	return _nxTextWidth(font, (void *) string, count, GR_TFASCII);}intXTextWidth16(XFontStruct * font, _Xconst XChar2b * string, int count){	return _nxTextWidth(font, (void *) string, count, GR_TFXCHAR2B);}static int_nxTextExtents(XFontStruct * font, void *string, int count,	int *dir, int *ascent, int *descent, XCharStruct * overall, int flag){	int w, h, b;	GR_GC_ID local = GrNewGC();	GrSetGCFont(local, font->fid);	GrGetGCTextSize(local, (void *) string, count, flag, &w, &h, &b);	GrDestroyGC(local);	*ascent = b;	*descent = h - b;	*dir = FontLeftToRight;	overall->lbearing = 0;	/* Figure this out */	overall->rbearing = w;	/* Figure this out */	overall->width = w;	overall->ascent = b;	overall->descent = *descent;	overall->attributes = 0;	/* FIXME? */	return 1;}intXTextExtents(XFontStruct * font, _Xconst char *string, int count,	int *dir, int *ascent, int *descent, XCharStruct * overall){	return _nxTextExtents(font, (void *) string, count, dir, ascent,			      descent, overall, GR_TFASCII);}intXTextExtents16(XFontStruct * font, _Xconst XChar2b * string, int count,	int *dir, int *ascent, int *descent, XCharStruct * overall){	return _nxTextExtents(font, (void *) string, count, dir, ascent,			      descent, overall, GR_TFXCHAR2B);}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -