回 帖 发 新 帖 刷新版面

主题:再问,怎么设置字体的大小???

写个汇编,要在控制台窗口显示文本时,字体大小以16×12或者以12×16的方式显示,怎么个设置啊?求各位大虾指点,顺便给个范例啊,谢谢了。

回复列表 (共7个回复)

沙发

在控制台的属性-->字体中有设置,可惜没有16*12的.
你还是放弃16×12或者以12×16的方式显示吧.

板凳

我是说用汇编程序来设置,像你这样的设置哪个都会的....

3 楼

DOS汇编语言中没有设置,除非你自己实现字体.
WIN32汇编不太清楚,个人估计也不行.
干什么要设置字体.

4 楼

问过几位仁兄,都说不行。既然,用BIOS功能都能设置显示方式(窗口大小),我相信,肯定有一种方法来解决这个问题的,不知那位大虾出手来帮帮俺。哀,“五一”了,祝大家节日快乐先。

5 楼

不知道你有没有关于字体显示实现方面的知识,下面是一个显示一个字的程序,给你理解一下字体显示的原理.
在字体库中,如果人家没有预置,如果要自己显示,原理很简单,但过程也很繁杂.
程序我没有编译过,不过用来说明原理就足够了,如果在汇编中实现,那就更繁杂了.

作者:小小虫子
呵呵  是这样的  我的女朋友的名字有一个字是“璟”  在hzk16字库里是没有这个字的  我想在dos下显示她的名字  一直没办法  然后看了图灵机哥哥的文章  很有想法 终于昨晚有时间把她给画出来了  呵呵  好开心   (这不是灌水吧 哈哈 )   代码如下

#include <graphics.h>
#include <stdlib.h>
#include <string.h>
#include <bios.h>
#include <malloc.h>
#include <conio.h>

const unsigned char fnt16c[][32]=
{
      {
    
       0x04, 0x80, 0x0e, 0xa0, 0x78, 0x90, 0x08, 0x90, 0x08, 0x84,
       0xff, 0xfe, 0x08, 0x80, 0x08, 0x90, 0x0a, 0x90, 0x0c, 0x60,
       0x18, 0x40, 0x68, 0xa0, 0x09, 0x20, 0x0a, 0x14, 0x38, 0x1c,
      },
      {       
       0x00, 0x78, 0x3f, 0x80, 0x11, 0x10, 0x09, 0x20, 0x7f, 0xfe,
       0x42, 0x02, 0x82, 0x04, 0x7f, 0xf8, 0x04, 0x00, 0x07, 0xf0,
       0x0a, 0x20, 0x09, 0x40, 0x10, 0x80, 0x11, 0x60, 0x22, 0x1c,
      },
      {  /*璟*/
       0x00, 0x04, 0x10, 0x7e, 0xf8, 0x44, 0x20, 0x7c, 0x20, 0x44,
       0x20, 0x7c, 0xf8, 0x10, 0x23, 0xff, 0x20, 0x00, 0x20, 0xfe,
       0x38, 0x82, 0xe0, 0xfe, 0x40, 0x94, 0x00, 0x92, 0x01, 0x32,
      },
      };


void showfontc16x15(int color,int bkcolor, int x, int y,int no)
//putpixel(x   ,y,color);是tc的画点函数
{ int i,x1,x2,x3,x4,x5,x6,x7,x8,x9,x10,x11,x12,x13,x14,x15;
 unsigned char char_a;

 //to record x coordinate
  x1 = x+1;
  x2 = x+2;
  x3 = x+3;
  x4 = x+4;
  x5 = x+5;
  x6 = x+6;
  x7 = x+7;
  x8 = x+8;
  x9 = x+9;
  x10 = x+10;
  x11 = x+11;
  x12 = x+12;
  x13 = x+13;
  x14 = x+14;
  x15 = x+15;

 for( i=0; i<30; i+=2)
 {
   char_a=fnt16c[no][i];
   if ( char_a  & 0x80 ) putpixel(x   ,y,color);
   if ( char_a  & 0x40 ) putpixel(x1 ,y,color);
   if ( char_a  & 0x20 ) putpixel(x2 ,y,color);
   if ( char_a  & 0x10 ) putpixel(x3 ,y,color);
   if ( char_a  & 0x08 ) putpixel(x4 ,y,color);
   if ( char_a  & 0x04 ) putpixel(x5 ,y,color);
   if ( char_a  & 0x02 ) putpixel(x6 ,y,color);
   if ( char_a  & 0x01 ) putpixel(x7 ,y,color);
   char_a=fnt16c[no][i+1];
   if ( char_a  & 0x80 ) putpixel(x8 ,y,color);
   if ( char_a  & 0x40 ) putpixel(x9 ,y,color);
   if ( char_a  & 0x20 ) putpixel(x10,y,color);
   if ( char_a  & 0x10 ) putpixel(x11,y,color);
   if ( char_a  & 0x08 ) putpixel(x12,y,color);
   if ( char_a  & 0x04 ) putpixel(x13,y,color);
   if ( char_a  & 0x02 ) putpixel(x14,y,color);
   if ( char_a  & 0x01 ) putpixel(x15,y,color);
   y++;
 }
}

void main(void)
{
 int gd=detect,gm;
 initgraph(&gd,&gm,"");
 showfontc16x15(white,black,200,130,0);
 showfontc16x15(white,black,250,130,1);
 showfontc16x15(white,black,300,130,2);
 showfontc16x15(white,black,350,130,2);
 getch();
 closegraph();
}

6 楼

只能给你加20分了(多加系统不允许),谢谢你的答复!

7 楼

分不太在意,只要你是问问题的就可以了.
还有问程序的我一般不理会的.

我来回复

您尚未登录,请登录后再回复。点此登录或注册