【嵌入式】STM3212864点阵屏使用SimpleGUI单色屏接口库——(2)精简字库

news2024/11/16 11:33:35

一 开源库简介与移植

        最近一个项目需要用12864屏幕呈现一组较为复杂的菜单界面,本着不重复造轮子的原则找到了SimpleGUI开源库。

        开源地址:SimpleGUI: 一个面向单色显示屏的开源GUI接口库。

        SimpleGUI是一款针对单色显示屏设计的接口库。相比于传统的GUI框架,SimpleGUI的出发点,是在一个单色显示器上,以尽可能少的消耗、尽可能多且直观的表达需要的内容,为此,SimpleGUI抛弃了诸如图层、遮罩、阴影、非等宽字体等高级的、复杂的操作,力求以简单快捷、易于操作的方式,使开发者尽快实现自己需要的功能需求。 同时在满足基本绘图需求的前提下,SimpleGUI还提供了一套被称为HMI的交互引擎,用于统合用户交互、数据处理和屏幕内容绘制与更新,提供了一种简明、易组织、易拓展、低消耗的交互系统。

       

        开源库的模拟器部署以及嵌入式移植参考前文

【嵌入式】STM32&12864点阵屏使用SimpleGUI单色屏接口库——(1)移植-CSDN博客

二 精简字库的制作

        如果片上资源足够,可以使用全中文字库。以SimpleGUI默认的12像素字体为例,每个半角字符需要消耗6*2字节,全角字符需要消耗12*2字节,那么整个GB2312字库对Flash的消耗为:

(6*2)*96+(12*2)*3755+(12*2)*3008 = 1152 + 90120 + 72192 = 163464 Bytes

        约164KB的Flash消耗对于单片机来说还是非常可观的,如果还需要其他不同大小的字体,空间资源需求还要成倍增加,所以这种时候,通常就要使用外部字库了。

        但事实上,很多时候,界面上的文字都是既定好的,不需要动态的变化,这也就决定了整个系统中可能仅仅就需要使用少数的几个字符。这时候如果还要去设计外部字库显然对软硬件成本都是一种浪费,精简字库消耗才是正途。   通过前文的说明,字符和字符串的编码,说到底不过就是从字符编码到字库索引上的一种算法表达,精简字库,说到底也是从这一方面着手,删除掉字库中用不到的文字和符号,重新定义编码和索引,字库的精简就完成了。

        基于以上思想,精简字库首先要列出整个目标系统中所有可能用到的文字,然后进行去重,提炼出目标系统中用到的所有汉字。然后给这些汉字进行重新编码,简而言之就是进行简单排序,然后重新编号,这个编号就是新规定的字符编码。最后,用这个新的编码重新去对字符串进行编码,这样就完成了字库的精简了

        举个例子,我想在12864屏幕上显示一首词《虞美人·春花秋月何时了》:

春花秋月何时了?往事知多少。
小楼昨夜又东风,故国不堪回首月明中。
雕栏玉砌应犹在,只是朱颜改。
问君能有几多愁?恰似一江春水向东流。

【1】开源库的作者提供了一个小工具(MinimumFontLib: 一个用于精简单色点阵字库数据的工具),用来文字的提取和重编码,省去了大量的人工工作,非常方便。将所用到的文字粘进去,点击提取和重编码,得到重新排序后的文字和重编码之后的代码:

【2】将重编码后的代码(上图中的Record Text)替换到 GUI\src\SGUI_FontResource.c 文件中默认 SGUI_DEFAULT_FONT_16 字库的汉字编码数组 s_arrUnicodeTable 中:

static const SGUI_UINT32 s_arrUnicodeTable[] = {
 0x4E00, // U+4E00  一
0x4E0D, // U+4E0D  不
0x4E1C, // U+4E1C  东
0x4E2D, // U+4E2D  中
0x4E86, // U+4E86  了
0x4E8B, // U+4E8B  事
0x4F3C, // U+4F3C  似
0x4F55, // U+4F55  何
0x51E0, // U+51E0  几
0x53C8, // U+53C8  又
0x53EA, // U+53EA  只
0x5411, // U+5411  向
0x541B, // U+541B  君
0x56DE, // U+56DE  回
0x56FD, // U+56FD  国
0x5728, // U+5728  在
0x582A, // U+582A  堪
0x591A, // U+591A  多
0x591C, // U+591C  夜
0x5C0F, // U+5C0F  小
0x5C11, // U+5C11  少
0x5E94, // U+5E94  应
0x5F80, // U+5F80  往
0x6070, // U+6070  恰
0x6101, // U+6101  愁
0x6539, // U+6539  改
0x6545, // U+6545  故
0x65F6, // U+65F6  时
0x660E, // U+660E  明
0x6625, // U+6625  春
0x6628, // U+6628  昨
0x662F, // U+662F  是
0x6708, // U+6708  月
0x6709, // U+6709  有
0x6731, // U+6731  朱
0x680F, // U+680F  栏
0x697C, // U+697C  楼
0x6C34, // U+6C34  水
0x6C5F, // U+6C5F  江
0x6D41, // U+6D41  流
0x72B9, // U+72B9  犹
0x7389, // U+7389  玉
0x77E5, // U+77E5  知
0x780C, // U+780C  砌
0x79CB, // U+79CB  秋
0x80FD, // U+80FD  能
0x82B1, // U+82B1  花
0x95EE, // U+95EE  问
0x96D5, // U+96D5  雕
0x989C, // U+989C  颜
0x98CE, // U+98CE  风
0x9996, // U+9996  首
};

【3】将重新排序后的文字(上图中的Extracted Text)用字库处理软件(推荐: PCtoLCD2002完美版 )处理成C51形式:

【4】将上一步生成的内容直接复制替换到 GUI\src\SGUI_FontResource.c 文件中默认 SGUI_DEFAULT_FONT_16 字库的字符库数组 SGUI_FONT_H16 中(注意:中文是从第95下标往后添加):

//======================================================================//
//= 16 Pix font library.宋体16                                                //
//======================================================================//
const SGUI_BYTE SGUI_FONT_H16[] = {
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // space    Index 0
0x00,0x00,0x00,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x33,0x00,0x00,0x00,0x00,/*"!",0*/
0x00,0x10,0x0C,0x02,0x10,0x0C,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,/*""",1*/
0x00,0x40,0xC0,0x78,0x40,0xC0,0x78,0x00,0x00,0x04,0x3F,0x04,0x04,0x3F,0x04,0x00,/*"#",2*/
0x00,0x70,0x88,0x88,0xFC,0x08,0x30,0x00,0x00,0x18,0x20,0x20,0xFF,0x21,0x1E,0x00,/*"$",3*/
0xF0,0x08,0xF0,0x80,0x60,0x18,0x00,0x00,0x00,0x31,0x0C,0x03,0x1E,0x21,0x1E,0x00,/*"%",4*/
0x00,0xF0,0x08,0x88,0x70,0x00,0x00,0x00,0x1E,0x21,0x23,0x2C,0x19,0x27,0x21,0x10,/*"&",5*/
0x00,0x12,0x0E,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,/*"'",6*/
0x00,0x00,0x00,0xE0,0x18,0x04,0x02,0x00,0x00,0x00,0x00,0x07,0x18,0x20,0x40,0x00,/*"(",7*/
0x00,0x02,0x04,0x18,0xE0,0x00,0x00,0x00,0x00,0x40,0x20,0x18,0x07,0x00,0x00,0x00,/*")",8*/
0x40,0x40,0x80,0xF0,0x80,0x40,0x40,0x00,0x02,0x02,0x01,0x0F,0x01,0x02,0x02,0x00,/*"*",9*/
0x00,0x00,0x00,0x00,0xE0,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x0F,0x01,0x01,0x01,/*"+",10*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x90,0x70,0x00,0x00,0x00,0x00,0x00,/*",",11*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x01,0x01,0x01,0x00,/*"-",12*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x00,0x00,0x00,/*".",13*/
0x00,0x00,0x00,0x00,0xC0,0x38,0x04,0x00,0x00,0x60,0x18,0x07,0x00,0x00,0x00,0x00,/*"/",14*/
0x00,0xE0,0x10,0x08,0x08,0x10,0xE0,0x00,0x00,0x0F,0x10,0x20,0x20,0x10,0x0F,0x00,/*"0",15*/
0x00,0x00,0x10,0x10,0xF8,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,/*"1",16*/
0x00,0x70,0x08,0x08,0x08,0x08,0xF0,0x00,0x00,0x30,0x28,0x24,0x22,0x21,0x30,0x00,/*"2",17*/
0x00,0x30,0x08,0x08,0x08,0x88,0x70,0x00,0x00,0x18,0x20,0x21,0x21,0x22,0x1C,0x00,/*"3",18*/
0x00,0x00,0x80,0x40,0x30,0xF8,0x00,0x00,0x00,0x06,0x05,0x24,0x24,0x3F,0x24,0x24,/*"4",19*/
0x00,0xF8,0x88,0x88,0x88,0x08,0x08,0x00,0x00,0x19,0x20,0x20,0x20,0x11,0x0E,0x00,/*"5",20*/
0x00,0xE0,0x10,0x88,0x88,0x90,0x00,0x00,0x00,0x0F,0x11,0x20,0x20,0x20,0x1F,0x00,/*"6",21*/
0x00,0x18,0x08,0x08,0x88,0x68,0x18,0x00,0x00,0x00,0x00,0x3E,0x01,0x00,0x00,0x00,/*"7",22*/
0x00,0x70,0x88,0x08,0x08,0x88,0x70,0x00,0x00,0x1C,0x22,0x21,0x21,0x22,0x1C,0x00,/*"8",23*/
0x00,0xF0,0x08,0x08,0x08,0x10,0xE0,0x00,0x00,0x01,0x12,0x22,0x22,0x11,0x0F,0x00,/*"9",24*/
0x00,0x00,0x00,0xC0,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x00,/*":",25*/
0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xE0,0x00,0x00,0x00,0x00,/*";",26*/
0x00,0x00,0x80,0x40,0x20,0x10,0x08,0x00,0x00,0x01,0x02,0x04,0x08,0x10,0x20,0x00,/*"<",27*/
0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x00,0x00,0x02,0x02,0x02,0x02,0x02,0x02,0x00,/*"=",28*/
0x00,0x08,0x10,0x20,0x40,0x80,0x00,0x00,0x00,0x20,0x10,0x08,0x04,0x02,0x01,0x00,/*">",29*/
0x00,0x70,0x48,0x08,0x08,0x88,0x70,0x00,0x00,0x00,0x00,0x30,0x37,0x00,0x00,0x00,/*"?",30*/
0xC0,0x30,0xC8,0x28,0xE8,0x10,0xE0,0x00,0x07,0x18,0x27,0x28,0x2F,0x28,0x17,0x00,/*"@",31*/
0x00,0x00,0xC0,0x38,0xE0,0x00,0x00,0x00,0x20,0x3C,0x23,0x02,0x02,0x27,0x38,0x20,/*"A",32*/
0x08,0xF8,0x88,0x88,0x88,0x70,0x00,0x00,0x20,0x3F,0x20,0x20,0x20,0x11,0x0E,0x00,/*"B",33*/
0xC0,0x30,0x08,0x08,0x08,0x08,0x38,0x00,0x07,0x18,0x20,0x20,0x20,0x10,0x08,0x00,/*"C",34*/
0x08,0xF8,0x08,0x08,0x08,0x10,0xE0,0x00,0x20,0x3F,0x20,0x20,0x20,0x10,0x0F,0x00,/*"D",35*/
0x08,0xF8,0x88,0x88,0xE8,0x08,0x10,0x00,0x20,0x3F,0x20,0x20,0x23,0x20,0x18,0x00,/*"E",36*/
0x08,0xF8,0x88,0x88,0xE8,0x08,0x10,0x00,0x20,0x3F,0x20,0x00,0x03,0x00,0x00,0x00,/*"F",37*/
0xC0,0x30,0x08,0x08,0x08,0x38,0x00,0x00,0x07,0x18,0x20,0x20,0x22,0x1E,0x02,0x00,/*"G",38*/
0x08,0xF8,0x08,0x00,0x00,0x08,0xF8,0x08,0x20,0x3F,0x21,0x01,0x01,0x21,0x3F,0x20,/*"H",39*/
0x00,0x08,0x08,0xF8,0x08,0x08,0x00,0x00,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00,/*"I",40*/
0x00,0x00,0x08,0x08,0xF8,0x08,0x08,0x00,0xC0,0x80,0x80,0x80,0x7F,0x00,0x00,0x00,/*"J",41*/
0x08,0xF8,0x88,0xC0,0x28,0x18,0x08,0x00,0x20,0x3F,0x20,0x01,0x26,0x38,0x20,0x00,/*"K",42*/
0x08,0xF8,0x08,0x00,0x00,0x00,0x00,0x00,0x20,0x3F,0x20,0x20,0x20,0x20,0x30,0x00,/*"L",43*/
0x08,0xF8,0xF8,0x00,0xF8,0xF8,0x08,0x00,0x20,0x3F,0x01,0x3E,0x01,0x3F,0x20,0x00,/*"M",44*/
0x08,0xF8,0x30,0xC0,0x00,0x08,0xF8,0x08,0x20,0x3F,0x20,0x00,0x07,0x18,0x3F,0x00,/*"N",45*/
0xE0,0x10,0x08,0x08,0x08,0x10,0xE0,0x00,0x0F,0x10,0x20,0x20,0x20,0x10,0x0F,0x00,/*"O",46*/
0x08,0xF8,0x08,0x08,0x08,0x08,0xF0,0x00,0x20,0x3F,0x21,0x01,0x01,0x01,0x00,0x00,/*"P",47*/
0xE0,0x10,0x08,0x08,0x08,0x10,0xE0,0x00,0x0F,0x10,0x28,0x28,0x30,0x50,0x4F,0x00,/*"Q",48*/
0x08,0xF8,0x88,0x88,0x88,0x88,0x70,0x00,0x20,0x3F,0x20,0x00,0x03,0x0C,0x30,0x20,/*"R",49*/
0x00,0x70,0x88,0x08,0x08,0x08,0x38,0x00,0x00,0x38,0x20,0x21,0x21,0x22,0x1C,0x00,/*"S",50*/
0x18,0x08,0x08,0xF8,0x08,0x08,0x18,0x00,0x00,0x00,0x20,0x3F,0x20,0x00,0x00,0x00,/*"T",51*/
0x08,0xF8,0x08,0x00,0x00,0x08,0xF8,0x08,0x00,0x1F,0x20,0x20,0x20,0x20,0x1F,0x00,/*"U",52*/
0x08,0x78,0x88,0x00,0x00,0xC8,0x38,0x08,0x00,0x00,0x07,0x38,0x0E,0x01,0x00,0x00,/*"V",53*/
0x08,0xF8,0x00,0xF8,0x00,0xF8,0x08,0x00,0x00,0x03,0x3E,0x01,0x3E,0x03,0x00,0x00,/*"W",54*/
0x08,0x18,0x68,0x80,0x80,0x68,0x18,0x08,0x20,0x30,0x2C,0x03,0x03,0x2C,0x30,0x20,/*"X",55*/
0x08,0x38,0xC8,0x00,0xC8,0x38,0x08,0x00,0x00,0x00,0x20,0x3F,0x20,0x00,0x00,0x00,/*"Y",56*/
0x10,0x08,0x08,0x08,0xC8,0x38,0x08,0x00,0x20,0x38,0x26,0x21,0x20,0x20,0x18,0x00,/*"Z",57*/
0x00,0x00,0x00,0xFE,0x02,0x02,0x02,0x00,0x00,0x00,0x00,0x7F,0x40,0x40,0x40,0x00,/*"[",58*/
0x00,0x04,0x38,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x06,0x38,0xC0,0x00,/*"\",59*/
0x00,0x02,0x02,0x02,0xFE,0x00,0x00,0x00,0x00,0x40,0x40,0x40,0x7F,0x00,0x00,0x00,/*"]",60*/
0x00,0x00,0x04,0x02,0x02,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,/*"^",61*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,/*"_",62*/
0x00,0x02,0x02,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,/*"`",63*/
0x00,0x00,0x80,0x80,0x80,0x00,0x00,0x00,0x00,0x19,0x24,0x24,0x12,0x3F,0x20,0x00,/*"a",64*/
0x10,0xF0,0x00,0x80,0x80,0x00,0x00,0x00,0x00,0x3F,0x11,0x20,0x20,0x11,0x0E,0x00,/*"b",65*/
0x00,0x00,0x00,0x80,0x80,0x80,0x00,0x00,0x00,0x0E,0x11,0x20,0x20,0x20,0x11,0x00,/*"c",66*/
0x00,0x00,0x80,0x80,0x80,0x90,0xF0,0x00,0x00,0x1F,0x20,0x20,0x20,0x10,0x3F,0x20,/*"d",67*/
0x00,0x00,0x80,0x80,0x80,0x80,0x00,0x00,0x00,0x1F,0x24,0x24,0x24,0x24,0x17,0x00,/*"e",68*/
0x00,0x80,0x80,0xE0,0x90,0x90,0x20,0x00,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00,/*"f",69*/
0x00,0x00,0x80,0x80,0x80,0x80,0x80,0x00,0x00,0x6B,0x94,0x94,0x94,0x93,0x60,0x00,/*"g",70*/
0x10,0xF0,0x00,0x80,0x80,0x80,0x00,0x00,0x20,0x3F,0x21,0x00,0x00,0x20,0x3F,0x20,/*"h",71*/
0x00,0x80,0x98,0x98,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00,/*"i",72*/
0x00,0x00,0x00,0x80,0x98,0x98,0x00,0x00,0x00,0xC0,0x80,0x80,0x80,0x7F,0x00,0x00,/*"j",73*/
0x10,0xF0,0x00,0x00,0x80,0x80,0x80,0x00,0x20,0x3F,0x24,0x06,0x29,0x30,0x20,0x00,/*"k",74*/
0x00,0x10,0x10,0xF8,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00,/*"l",75*/
0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x00,0x20,0x3F,0x20,0x00,0x3F,0x20,0x00,0x3F,/*"m",76*/
0x80,0x80,0x00,0x80,0x80,0x80,0x00,0x00,0x20,0x3F,0x21,0x00,0x00,0x20,0x3F,0x20,/*"n",77*/
0x00,0x00,0x80,0x80,0x80,0x80,0x00,0x00,0x00,0x1F,0x20,0x20,0x20,0x20,0x1F,0x00,/*"o",78*/
0x80,0x80,0x00,0x80,0x80,0x00,0x00,0x00,0x80,0xFF,0x91,0x20,0x20,0x11,0x0E,0x00,/*"p",79*/
0x00,0x00,0x00,0x80,0x80,0x00,0x80,0x00,0x00,0x0E,0x11,0x20,0x20,0x91,0xFF,0x80,/*"q",80*/
0x80,0x80,0x80,0x00,0x80,0x80,0x80,0x00,0x20,0x20,0x3F,0x21,0x20,0x00,0x01,0x00,/*"r",81*/
0x00,0x00,0x80,0x80,0x80,0x80,0x80,0x00,0x00,0x33,0x24,0x24,0x24,0x24,0x19,0x00,/*"s",82*/
0x00,0x80,0x80,0xE0,0x80,0x80,0x00,0x00,0x00,0x00,0x00,0x1F,0x20,0x20,0x10,0x00,/*"t",83*/
0x80,0x80,0x00,0x00,0x00,0x80,0x80,0x00,0x00,0x1F,0x20,0x20,0x20,0x10,0x3F,0x20,/*"u",84*/
0x80,0x80,0x80,0x00,0x80,0x80,0x80,0x00,0x00,0x03,0x0C,0x30,0x0C,0x03,0x00,0x00,/*"v",85*/
0x80,0x80,0x00,0x80,0x80,0x00,0x80,0x80,0x01,0x0E,0x30,0x0C,0x07,0x38,0x06,0x01,/*"w",86*/
0x00,0x80,0x80,0x80,0x00,0x80,0x80,0x00,0x00,0x20,0x31,0x0E,0x2E,0x31,0x20,0x00,/*"x",87*/
0x80,0x80,0x80,0x00,0x00,0x80,0x80,0x80,0x00,0x81,0x86,0x78,0x18,0x06,0x01,0x00,/*"y",88*/
0x00,0x80,0x80,0x80,0x80,0x80,0x80,0x00,0x00,0x21,0x30,0x2C,0x22,0x21,0x30,0x00,/*"z",89*/
0x00,0x00,0x00,0x00,0x00,0xFC,0x02,0x02,0x00,0x00,0x00,0x00,0x01,0x3E,0x40,0x40,/*"{",90*/
0x00,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,/*"|",91*/
0x02,0x02,0xFC,0x00,0x00,0x00,0x00,0x00,0x40,0x40,0x3E,0x01,0x00,0x00,0x00,0x00,/*"}",92*/
0x00,0x02,0x01,0x02,0x02,0x04,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,/*"~",93*/
0x00,0xFE,0x02,0x02,0x72,0x7A,0x1A,0x1A,0x1A,0x9A,0xFA,0xF2,0x02,0x02,0xFE,0x00,0x00,0x7F,0x40,0x40,0x40,0x40,0x40,0x5A,0x5B,0x43,0x41,0x40,0x40,0x40,0x7F,0x00,/* [0       ] ['?' for undefined character. ] */
0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,/*"一",0*/
0x00,0x02,0x02,0x02,0x02,0x82,0x42,0xF2,0x0E,0x42,0x82,0x02,0x02,0x02,0x00,0x00,
0x10,0x08,0x04,0x02,0x01,0x00,0x00,0xFF,0x00,0x00,0x00,0x01,0x02,0x0C,0x00,0x00,/*"不",1*/
0x00,0x08,0x88,0x48,0x28,0x18,0x0F,0xE8,0x08,0x08,0x08,0x08,0x08,0x08,0x00,0x00,
0x00,0x20,0x11,0x09,0x05,0x41,0x81,0x7F,0x01,0x01,0x05,0x09,0x11,0x20,0x00,0x00,/*"东",2*/
0x00,0x00,0xF0,0x10,0x10,0x10,0x10,0xFF,0x10,0x10,0x10,0x10,0xF0,0x00,0x00,0x00,
0x00,0x00,0x0F,0x04,0x04,0x04,0x04,0xFF,0x04,0x04,0x04,0x04,0x0F,0x00,0x00,0x00,/*"中",3*/
0x00,0x02,0x02,0x02,0x02,0x02,0x02,0xE2,0x22,0x12,0x0A,0x06,0x02,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x40,0x80,0x7F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,/*"了",4*/
0x04,0x04,0x74,0x54,0x54,0x54,0x54,0xFF,0x54,0x54,0x54,0x54,0x74,0x04,0x04,0x00,
0x04,0x04,0x15,0x15,0x15,0x55,0x95,0x7F,0x15,0x15,0x15,0x15,0x1F,0x04,0x04,0x00,/*"事",5*/
0x80,0x60,0xF8,0x07,0x00,0xF8,0x00,0x02,0x04,0x18,0x00,0x00,0xFF,0x00,0x00,0x00,
0x00,0x00,0xFF,0x00,0x00,0x3F,0x10,0x88,0x40,0x20,0x18,0x07,0x08,0x30,0xC0,0x00,/*"似",6*/
0x00,0x80,0x60,0xF8,0x07,0x04,0xE4,0x24,0x24,0xE4,0x04,0x04,0xFC,0x04,0x04,0x00,
0x01,0x00,0x00,0xFF,0x00,0x00,0x0F,0x04,0x04,0x0F,0x40,0x80,0x7F,0x00,0x00,0x00,/*"何",7*/
0x00,0x00,0x00,0x00,0xFE,0x02,0x02,0x02,0x02,0x02,0xFE,0x00,0x00,0x00,0x00,0x00,
0x80,0x40,0x30,0x0C,0x03,0x00,0x00,0x00,0x00,0x00,0x3F,0x40,0x40,0x40,0x78,0x00,/*"几",8*/
0x00,0x00,0x02,0x1E,0x62,0x82,0x02,0x02,0x02,0x82,0x72,0x0E,0x00,0x00,0x00,0x00,
0x80,0x80,0x40,0x40,0x20,0x11,0x0A,0x04,0x0A,0x11,0x20,0x40,0x40,0x80,0x80,0x00,/*"又",9*/
0x00,0x00,0x00,0xFE,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0xFE,0x00,0x00,0x00,0x00,
0x00,0x80,0x40,0x23,0x19,0x01,0x01,0x01,0x01,0x01,0x09,0x13,0x20,0xC0,0x00,0x00,/*"只",10*/
0x00,0xF8,0x08,0x08,0x0C,0xCA,0x49,0x48,0x48,0xC8,0x08,0x08,0x08,0xF8,0x00,0x00,
0x00,0xFF,0x00,0x00,0x00,0x1F,0x08,0x08,0x08,0x1F,0x00,0x40,0x80,0x7F,0x00,0x00,/*"向",11*/
0x10,0x10,0x92,0x92,0x92,0xFE,0x92,0x92,0x92,0x92,0x92,0x92,0xFE,0x10,0x10,0x00,
0x40,0x20,0x10,0x0C,0xFF,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0xFC,0x00,0x00,0x00,/*"君",12*/
0x00,0x00,0xFE,0x02,0x02,0xF2,0x12,0x12,0x12,0xF2,0x02,0x02,0xFE,0x00,0x00,0x00,
0x00,0x00,0x7F,0x20,0x20,0x27,0x24,0x24,0x24,0x27,0x20,0x20,0x7F,0x00,0x00,0x00,/*"回",13*/
0x00,0xFE,0x02,0x12,0x92,0x92,0x92,0xF2,0x92,0x92,0x92,0x12,0x02,0xFE,0x00,0x00,
0x00,0xFF,0x40,0x48,0x48,0x48,0x48,0x4F,0x48,0x4A,0x4C,0x48,0x40,0xFF,0x00,0x00,/*"国",14*/
0x08,0x08,0x88,0xC8,0x38,0x0C,0x0B,0x08,0x08,0xE8,0x08,0x08,0x08,0x08,0x08,0x00,
0x02,0x01,0x00,0xFF,0x40,0x41,0x41,0x41,0x41,0x7F,0x41,0x41,0x41,0x41,0x40,0x00,/*"在",15*/
0x20,0x20,0x20,0xFF,0x20,0x20,0x04,0x04,0xFF,0x54,0x54,0x54,0xFF,0x04,0x04,0x00,
0x10,0x30,0x10,0x0F,0x08,0x08,0x02,0x7E,0x53,0x4A,0x42,0x42,0x4B,0x52,0x42,0x00,/*"堪",16*/
0x00,0x00,0x10,0x10,0x98,0xA4,0x47,0x44,0xA4,0x54,0x0C,0x04,0x00,0x00,0x00,0x00,
0x00,0x81,0x89,0x89,0x44,0x44,0x4A,0x31,0x21,0x11,0x09,0x05,0x03,0x00,0x00,0x00,/*"多",17*/
0x04,0x04,0x84,0xE4,0x1C,0x04,0x05,0xC6,0x3C,0xA4,0x24,0x24,0xE4,0x04,0x04,0x00,
0x02,0x01,0x00,0xFF,0x00,0x82,0x81,0x46,0x28,0x10,0x29,0x46,0x41,0x80,0x80,0x00,/*"夜",18*/
0x00,0x00,0x00,0xE0,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0x20,0x40,0x80,0x00,0x00,
0x08,0x04,0x03,0x00,0x00,0x40,0x80,0x7F,0x00,0x00,0x00,0x00,0x00,0x01,0x0E,0x00,/*"小",19*/
0x00,0x00,0x80,0x60,0x18,0x00,0x00,0xFF,0x00,0x00,0x08,0x90,0x20,0xC0,0x00,0x00,
0x00,0x81,0x80,0x80,0x40,0x40,0x20,0x13,0x08,0x04,0x02,0x01,0x00,0x00,0x00,0x00,/*"少",20*/
0x00,0x00,0xFC,0x04,0x44,0x84,0x04,0x25,0xC6,0x04,0x04,0x04,0x04,0xE4,0x04,0x00,
0x40,0x30,0x0F,0x40,0x40,0x41,0x4E,0x40,0x40,0x63,0x50,0x4C,0x43,0x40,0x40,0x00,/*"应",21*/
0x00,0x10,0x88,0xC4,0x33,0x08,0x08,0x08,0x09,0xFA,0x08,0x08,0x08,0x08,0x00,0x00,
0x02,0x01,0x00,0xFF,0x40,0x41,0x41,0x41,0x41,0x7F,0x41,0x41,0x41,0x41,0x40,0x00,/*"往",22*/
0x00,0xE0,0x00,0xFF,0x10,0x20,0x50,0x48,0x44,0x43,0x44,0x48,0x50,0x20,0x20,0x00,
0x01,0x00,0x00,0xFF,0x00,0x00,0xFE,0x42,0x42,0x42,0x42,0x42,0xFE,0x00,0x00,0x00,/*"恰",23*/
0x10,0x92,0x52,0x32,0xFF,0x51,0x91,0x20,0x18,0xC0,0x3F,0xC0,0x10,0x0C,0x00,0x00,
0x01,0x40,0x30,0x00,0x77,0x80,0x84,0x8A,0xB1,0x80,0xE0,0x00,0x11,0x62,0x04,0x00,/*"愁",24*/
0x04,0x84,0x84,0x84,0x84,0xFC,0x40,0x30,0xCC,0x0B,0x08,0x08,0xF8,0x08,0x08,0x00,
0x00,0x7F,0x20,0x10,0x10,0x08,0x80,0x40,0x21,0x16,0x08,0x16,0x21,0x40,0x80,0x00,/*"改",25*/
0x10,0x10,0x10,0xFF,0x10,0x10,0x50,0x20,0xD8,0x17,0x10,0x10,0xF0,0x10,0x10,0x00,
0x00,0x7F,0x21,0x21,0x21,0x7F,0x80,0x40,0x21,0x16,0x08,0x16,0x21,0x40,0x80,0x00,/*"故",26*/
0x00,0xFC,0x84,0x84,0x84,0xFC,0x00,0x10,0x10,0x10,0x10,0x10,0xFF,0x10,0x10,0x00,
0x00,0x3F,0x10,0x10,0x10,0x3F,0x00,0x00,0x01,0x06,0x40,0x80,0x7F,0x00,0x00,0x00,/*"时",27*/
0x00,0xFC,0x44,0x44,0x44,0xFC,0x00,0x00,0xFE,0x22,0x22,0x22,0x22,0xFE,0x00,0x00,
0x00,0x0F,0x04,0x04,0x04,0x8F,0x40,0x30,0x0F,0x02,0x02,0x42,0x82,0x7F,0x00,0x00,/*"明",28*/
0x40,0x44,0x54,0x54,0xD4,0x54,0x74,0x5F,0x54,0x54,0xD4,0x54,0x54,0x44,0x40,0x00,
0x04,0x04,0x02,0x01,0xFE,0x92,0x92,0x92,0x92,0x92,0xFE,0x01,0x02,0x04,0x04,0x00,/*"春",29*/
0x00,0xFC,0x84,0x84,0xFC,0x40,0x30,0x0F,0xF8,0x88,0x88,0x88,0x88,0x08,0x08,0x00,
0x00,0x3F,0x10,0x10,0x3F,0x00,0x00,0x00,0xFF,0x08,0x08,0x08,0x08,0x08,0x00,0x00,/*"昨",30*/
0x00,0x00,0x00,0x7F,0x49,0x49,0x49,0x49,0x49,0x49,0x49,0x7F,0x00,0x00,0x00,0x00,
0x81,0x41,0x21,0x1D,0x21,0x41,0x81,0xFF,0x89,0x89,0x89,0x89,0x89,0x81,0x81,0x00,/*"是",31*/
0x00,0x00,0x00,0xFE,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0xFE,0x00,0x00,0x00,
0x80,0x40,0x30,0x0F,0x02,0x02,0x02,0x02,0x02,0x02,0x42,0x82,0x7F,0x00,0x00,0x00,/*"月",32*/
0x04,0x04,0x04,0x84,0xE4,0x3C,0x27,0x24,0x24,0x24,0x24,0xE4,0x04,0x04,0x04,0x00,
0x04,0x02,0x01,0x00,0xFF,0x09,0x09,0x09,0x09,0x49,0x89,0x7F,0x00,0x00,0x00,0x00,/*"有",33*/
0x80,0xA0,0x90,0x8E,0x88,0x88,0x88,0xFF,0x88,0x88,0x88,0x88,0x88,0x80,0x80,0x00,
0x20,0x20,0x10,0x08,0x04,0x02,0x01,0xFF,0x01,0x02,0x04,0x08,0x10,0x20,0x20,0x00,/*"朱",34*/
0x10,0x10,0xD0,0xFF,0x90,0x10,0x20,0x22,0x2C,0x20,0x20,0x28,0x26,0x20,0x20,0x00,
0x04,0x03,0x00,0xFF,0x00,0x03,0x40,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x40,0x00,/*"栏",35*/
0x10,0x90,0xFF,0x90,0x10,0x00,0x90,0x52,0x34,0x10,0x7F,0x10,0x34,0x52,0x90,0x00,
0x06,0x01,0xFF,0x00,0x01,0x82,0x82,0x5A,0x56,0x23,0x22,0x52,0x4E,0x82,0x02,0x00,/*"楼",36*/
0x00,0x20,0x20,0x20,0xA0,0x60,0x00,0xFF,0x60,0x80,0x40,0x20,0x18,0x00,0x00,0x00,
0x20,0x10,0x08,0x06,0x01,0x40,0x80,0x7F,0x00,0x01,0x02,0x04,0x08,0x10,0x10,0x00,/*"水",37*/
0x10,0x60,0x02,0x0C,0xC0,0x04,0x04,0x04,0x04,0xFC,0x04,0x04,0x04,0x04,0x00,0x00,
0x04,0x04,0x7C,0x03,0x20,0x20,0x20,0x20,0x20,0x3F,0x20,0x20,0x20,0x20,0x20,0x00,/*"江",38*/
0x10,0x60,0x02,0x8C,0x00,0x44,0x64,0x54,0x4D,0x46,0x44,0x54,0x64,0xC4,0x04,0x00,
0x04,0x04,0x7E,0x01,0x80,0x40,0x3E,0x00,0x00,0xFE,0x00,0x00,0x7E,0x80,0xE0,0x00,/*"流",39*/
0x40,0x22,0x14,0x08,0xF4,0x02,0x10,0x10,0xFF,0x10,0xF0,0x11,0x16,0x10,0x10,0x00,
0x08,0x44,0x82,0x41,0x3F,0x80,0x60,0x1C,0x03,0x00,0x3F,0x40,0x40,0x40,0x78,0x00,/*"犹",40*/
0x00,0x02,0x82,0x82,0x82,0x82,0x82,0xFE,0x82,0x82,0x82,0x82,0x82,0x02,0x00,0x00,
0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x7F,0x40,0x40,0x44,0x58,0x40,0x40,0x40,0x00,/*"玉",41*/
0x20,0x18,0x0F,0x08,0xF8,0x08,0x08,0x00,0x00,0xFC,0x04,0x04,0x04,0xFC,0x00,0x00,
0x81,0x41,0x31,0x0D,0x03,0x0D,0x71,0x01,0x00,0x3F,0x10,0x10,0x10,0x3F,0x00,0x00,/*"知",42*/
0x04,0xE4,0x5C,0x44,0xC4,0x80,0x80,0xFE,0x40,0x44,0x04,0xFC,0x04,0x04,0xFC,0x00,
0x01,0x3F,0x10,0x10,0x3F,0x00,0x00,0x1F,0x88,0x44,0x30,0x0F,0x40,0x80,0x7F,0x00,/*"砌",43*/
0x24,0x24,0xA4,0xFE,0x23,0x22,0x80,0x70,0x00,0xFF,0x00,0x80,0x40,0x30,0x00,0x00,
0x08,0x06,0x01,0xFF,0x01,0x86,0x40,0x30,0x0E,0x01,0x06,0x18,0x20,0x40,0x80,0x00,/*"秋",44*/
0x08,0xCC,0x4A,0x49,0x48,0x4A,0xCC,0x18,0x00,0x7F,0x88,0x88,0x84,0x82,0xE0,0x00,
0x00,0xFF,0x12,0x12,0x52,0x92,0x7F,0x00,0x00,0x7E,0x88,0x88,0x84,0x82,0xE0,0x00,/*"能",45*/
0x04,0x04,0x04,0x84,0x6F,0x04,0x04,0x04,0xE4,0x04,0x8F,0x44,0x24,0x04,0x04,0x00,
0x04,0x02,0x01,0xFF,0x00,0x10,0x08,0x04,0x3F,0x41,0x40,0x40,0x40,0x40,0x78,0x00,/*"花",46*/
0x00,0xF8,0x01,0x02,0x00,0xE2,0x22,0x22,0x22,0xE2,0x02,0x02,0x02,0xFE,0x00,0x00,
0x00,0xFF,0x00,0x00,0x00,0x1F,0x08,0x08,0x08,0x1F,0x00,0x40,0x80,0x7F,0x00,0x00,/*"问",47*/
0x00,0xFE,0x42,0x52,0x7E,0x52,0x42,0xFE,0x10,0xFC,0x4B,0x48,0xF9,0x4A,0x48,0x00,
0x80,0x7F,0x00,0x0F,0x09,0x4F,0x80,0x7F,0x00,0xFF,0x22,0x22,0x3F,0x22,0x22,0x00,/*"雕",48*/
0x00,0xE4,0x2C,0x35,0xA6,0x74,0x2C,0x24,0x02,0xF2,0x1A,0xD6,0x12,0xF2,0x02,0x00,
0x40,0x3F,0x80,0x89,0x44,0x22,0x11,0x08,0x80,0x4F,0x30,0x0F,0x10,0x2F,0xC0,0x00,/*"颜",49*/
0x00,0x00,0xFE,0x02,0x12,0x22,0xC2,0x02,0xC2,0x32,0x02,0xFE,0x00,0x00,0x00,0x00,
0x80,0x60,0x1F,0x00,0x20,0x10,0x0C,0x03,0x0C,0x30,0x00,0x0F,0x30,0x40,0xF8,0x00,/*"风",50*/
0x04,0x04,0xE4,0x25,0x26,0x34,0x2C,0x24,0x24,0x24,0x26,0x25,0xE4,0x04,0x04,0x00,
0x00,0x00,0xFF,0x49,0x49,0x49,0x49,0x49,0x49,0x49,0x49,0x49,0xFF,0x00,0x00,0x00,/*"首",51*/
};

        至此,精简字库准备完成,接下来是字库的使用。

三 精简字库的调用

【1】新建一个头文件并转化成 UTF-8 编码格式(我这边命名为 Gui_Text_UTF8.h ),里面通过宏定义,管理程序中用到的所有中文文本内容。好处是该头文件可以随时替换为其他的编码格式:

#ifndef __GUI_TEXT_UTF8_H_
#define __GUI_TEXT_UTF8_H_

/* Screen 1: List Components. */
#define TEXT_TEST   ("春花秋月何时了?往事知多少.小楼昨夜又东风,故国不堪回首月明中.雕栏玉砌应犹在,只是朱颜改.问君能有几多愁?恰似一江春水向东流.")

/* Screen 2: Basic Paint*/

/* Screen 3: Text demo*/

/* Screen 4: Variable box. */

/* Screen 5: Realtime graph. */

/* Screen 6: Variable box. */

/* Screen 7: Notice box. */

#endif

【2】主函数中调用(例子中使用多行文本显示函数 SGUI_Text_DrawMultipleLinesText ,该函数中的内容遇到设定的空间边界自动换行):

/**************************************************************************
* 函数名称: Gui_Task
* 功能描述: 液晶显示子任务
**************************************************************************/
SGUI_SCR_DEV disp_dev;    //中文屏设备源
#define     BMP_DATA_BUFFER_SIZE    (512)
SGUI_BYTE                   s_pBmpDataBuffer[BMP_DATA_BUFFER_SIZE];
 
void Gui_Task(void)
{
    SGUI_RECT disp_area;
	SGUI_POINT disp_offs;
    
    //点阵屏初始化/配置命令/清屏
    LDZ_Init();
    LDZ_Cfg();
    LDZ_Clear();
    //设备内存地址初始化
    SGUI_SystemIF_MemorySet(&disp_dev, 0x00, sizeof(disp_dev));
    //一些相关初始化配置
    disp_area.iX = 0;
	disp_area.iY = 0;
    disp_area.iWidth = 128;
	disp_area.iHeight = 64;
	disp_offs.iX = 0;
	disp_offs.iY = 0;
    
    disp_dev.stSize.iWidth = 128;
	disp_dev.stSize.iHeight = 64;
	/* Initialize interface object. */
	disp_dev.fnSetPixel = LDZ_SetPixel;
	disp_dev.fnClear = LDZ_Clear;
	disp_dev.fnSyncBuffer = LDZ_Refresh;
    disp_dev.stBuffer.pBuffer = s_pBmpDataBuffer;
    disp_dev.stBuffer.sSize = BMP_DATA_BUFFER_SIZE;
    
    //...
    
    while(1)
    {
        //显示多行文本
        disp_area.iX = 0;
        disp_area.iY = 0;
        disp_area.iWidth = 128;
        disp_area.iHeight = 64;
        SGUI_Text_DrawMultipleLinesText(&disp_dev, TEXT_TEST, &SGUI_DEFAULT_FONT_16, &disp_area, 0, SGUI_DRAW_NORMAL);
        
        LDZ_Refresh();
        
        os_dly_wait(50);
    }
}

【3】实际显示效果如下:

四 参考资料

【1】【嵌入式】STM32&12864点阵屏使用SimpleGUI单色屏接口库——(1)移植-CSDN博客

【2】SimpleGUI: 一个面向单色显示屏的开源GUI接口库。

【3】MinimumFontLib: 一个用于精简单色点阵字库数据的工具

【4】关于Simple GUI精简字库的制作方法_simplegui-CSDN博客

【5】单色显示屏GUI库simpleGUI使用自定义中文字体资源_freesimplegui-CSDN博客

【6】simplegui自定义字库——UTF8版-CSDN博客

【7】有关SimpleGUI移植非等宽字符的介绍_simplegui 移植-CSDN博客

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/1967058.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

kali里面的vulhub靶场搭建

第一步&#xff1a;安装docker镜像容器 sudo apt install docker.io 第二步&#xff1a;开启docker镜像容器 先查看一下docker有没有下载成功 docker -v 再查看一下docker的运行状态 systemctl status docker 第三步&#xff1a;下载docker-compose环境 apt install do…

94 二叉树的中序遍历

解题思路&#xff1a; \qquad 首先理解中序遍历&#xff1a;left node——root——right node。 \qquad 中序遍历的起始点为该树最左边的非空元素。本题可以使用递归、DFS&#xff08;迭代&#xff09;解决。 递归法&#xff1a; \qquad 重复的基础操作&#xff1a;输出roo…

甘肃西北风情贝壳面你吃过吗?

在西北的甘肃&#xff0c;有一种传统面食——麻食&#xff0c;以其独特的制作工艺和浓郁的地方风味&#xff0c;成为了当地人民餐桌上的宠儿。麻食&#xff0c;又被称为“麻什”“麻食子”等&#xff0c;是一种手工搓制而成的面食。它的形状酷似猫耳朵&#xff0c;小巧玲珑&…

超有趣的视觉欺骗

by 游梦 关键词&#xff1a;蜘蛛侠、室内映射、假室内 大家一起先找茬&#xff0c;半分钟找出下图中穿帮镜头 &#xff08;图源&#xff1a;https://zhuanlan.zhihu.com/p/159439811&#xff09; 答案揭晓&#xff1a; 可以看到室内门的位置&#xff0c;在建筑不同视角下的位…

为 Laravel 提供生产模式下的容器化环境:打造现代开发环境的终极指南

为 Laravel 提供生产模式下的容器化环境&#xff1a;打造现代开发环境的终极指南 在现代开发中&#xff0c;容器化已经成为一种趋势。使用 Docker 可以让我们轻松地管理和部署应用程序。本文将带你一步步构建一个高效的 Laravel 容器化环境&#xff0c;确保你的应用程序在开发…

Modbus从站模拟软件

下载地址&#xff1a; Modbus从站模拟软件资源-CSDN文库

linux创建用户并免密切换

useradd ansible passwd ansible 加入到wheel组 sudo usermod -G wheel ansible 编辑文件visudo ansible ALL(ALL) NOPASSWD:ALL chage -M 99999 ansible #设置密码永不过期

2024上半年热门内容透视 | 品牌种草解析

2024年上半年&#xff0c;小红书平台“考公上岸”、“不确定性”、“重养自己一遍”、“人生是旷野”、“原生家庭顶配”等话题热议之下&#xff0c;透露着消费者怎样的需求&#xff1f; 综合热门内容及小红书用户的分享发现&#xff0c;变数和不确定性成为新常态&#xff0c;消…

PTrade常见问题系列18

客户反馈某代码L1快照有延迟&#xff1f; 客户反馈某代码9.30.12的快照在9.30.12策略没有获取到&#xff0c;在9.30.17才获取到&#xff1f; 1、由于交易所的快照不是严格按照3s下发的&#xff0c;例如快照在9.30.12.300更新了&#xff0c;客户策略在9.30.12.100执行到&#…

什么是文档签名证书?如何获取文档签名证书?

在数字化高速发展的当今时代&#xff0c;各行各业都开始向数字化转型&#xff0c;随着国家大力倡导和积极推进数字化&#xff0c;电子文件的应用越来越广泛。然而&#xff0c;电子文件包含了个人隐私、金融交易、电子处方、合同协议等敏感信息&#xff0c;如何确保这些重要文件…

Python开发框架FastAPI系列(1. 初体验)

本文为系列文章Python开发框架FastAPI系列的第一部分。 缘起 其实Python的Web开发框架已经有很多了&#xff0c;包括老将Django和后起之秀Flask都做得很好&#xff0c;各有各的特色。那么为什么FastAPI作为一个后来者&#xff0c;短时间内就人气飙升呢&#xff1f;我也是看到…

【linux】【操作系统】初始化程序之main.c源码阅读

/init/main.c是Linux操作系统启动过程的核心部分&#xff0c;它负责初始化硬件、设备、内存和系统服务&#xff0c;以及启动第一个用户进程&#xff0c;为后续的系统运行奠定基础。 详细解析 1. 内联函数定义 fork, pause, setup, sync: 这些函数被声明为内联&#xff0c;意…

解决secureCRT乱码设置UTF-8显示中文

永久性配置UTF-8 在SecureCRT的安装文件夹中搜索“Default.ini” 找到D:“Filenames Always Use UTF8”00000000&#xff0c;将最后的0变成1&#xff0c;即&#xff1a;D:“Filenames Always Use UTF8”00000001 将S:”Output Transformer Name”Default修改为S:”Output Tran…

如何使用 PHP Simple HTML DOM Parser 轻松获取网页中的特定数据

背景介绍 网页数据的抓取已经成为数据分析、市场调研等领域的重要工具。无论是获取产品价格、用户评论还是其他公开数据&#xff0c;网页抓取技术都能提供极大的帮助。今天&#xff0c;我们将探讨如何使用 PHP Simple HTML DOM Parser 轻松获取网页中的特定数据。PHP Simple H…

SPSSAU | 最好最差权重BWM原理及案例实操分析

BWM&#xff08;best-worse-method&#xff0c;最好最差法&#xff09;是一种多准则决策方法&#xff0c;由Jafar Rezaei于2015年提出&#xff0c;其通常用于确定决策标准的权重。其原理是比如5个指标&#xff0c;如果以前AHP就需要5个指标两两的相对重要性数据。但是现在简化为…

CSS实现文本溢出处理

1.单行文本溢出 <!DOCTYPE html> <html lang"en"><head><meta charset"UTF-8"><meta http-equiv"X-UA-Compatible" content"IEedge"><meta name"viewport" content"widthdevice-wid…

如何利用DFMEA优化产品设计?

在快节奏的产品开发周期中&#xff0c;DFMEA如同一双锐利的眼睛&#xff0c;帮助团队在设计初期就识别并预防潜在的问题。它不仅仅是一种分析方法&#xff0c;更是一种系统化的思维工具&#xff0c;通过深入分析每个设计元素可能发生的失效模式、原因、影响及严重程度&#xff…

Vue3父子组件传属性和方法调用Demo

Vue3父子组件传属性和方法调用Demo 说明目录父组件给子组件传值和方法父组件给子组件传值-使用defineProps接受父组件属性值父组件给子组件传值-使用defineModel接受父组件v-model值当子组件只需要接收父组件一个v-model值时,写法1如下:子组件接收单个v-model写法2如下:当子组件…

设计界的新宠:5款热门UI在线设计软件评测

随着用户界面设计行业的蓬勃发展&#xff0c;越来越多的设计师进入用户界面设计。选择一个方便的用户界面设计工具尤为重要&#xff01;除了传统的用户界面设计工具&#xff0c;在线用户界面设计工具也受到越来越多设计师的青睐。这种不受时间、地点、计算机配置限制的工作方法…

12. 计算机网络TCP四次挥手

1. 前言 上一章节分析了 TCP 建立连接的过程,既然有建立连接,对应的也有断开连接。数据传输完成之后,客户端和服务器端保持通信状态会占用资源开销,所以需要断开连接,TCP 协议中断开连接也被称为 TCP 四次挥手。 2.1 TCP 四次挥手 面试官提问: 说明一下 TCP 断开连接的…