FreeType 矢量字体 测试移植(1)
之前有做过 ascii 和汉字库的字体点阵在lcd上显示的例子,都是按照指定大小的字库的点阵来显示的,所以一但选定了字体文件后,就固定了大小,不可变化,当然也可以存放各种 大小的字体文件,但这样的话就需要很多的空间,这种方法显然不好使,所以就引入了失量字体,关于字体的特点就不啰嗦了。可以去网上搜到很多说明。下面我们一步一步的来做实验测试了解失量字体的用法,先在PC机上测试,然后再移植到开发板上用lcd显示。
一、首先我们要去获得失量字体的源码和一些文档,https://www.freetype.org/freetype2/docs/documentation.html 这里就是官网。然后按照他的文档来简单了解一下,同时还提供了一个C例子,分析例子,修改后可以先在PC机上测试。
二、得到源码后,解压配置安装。列出步骤和命令。注意这是在PC机上运行的命令如果要在开发板上运行,要用交叉编译 还有配置也有不同
./configure 配置
make 编译
sudo make install 安装
三、把源码例子拿过来编译
gcc -o example example.c -I /usr/local/include/freetype2/ -lfreetype -lm
/* -I /usr/local/include/freetype2/ 指定头文件目录 -lfreetype 指定库类型 -lm 指定数学库 */
/* 这是大i 这是小L 小L */
如果没加会出错,不信可以先不加试一试然后一个一个加试下,这是方法,为什么我也不知道
./example ./simsun.ttc abc 执行就会打印出字体文件在终端上,但是看不到,因为源码里的设置太大了,要改小一些才可以
在执行时需要一个字体文件,可以从C:\Windows\Fonts里找一个复制过去
下面贴出一段在PC上显示代码 用FreeType官方例子稍改就可以了。
- /* example1.c */
- /* */
- /* This small program shows how to print a rotated string with the */
- /* FreeType 2 library. */
- #include <stdio.h>
- #include <string.h>
- #include <math.h>
- #include <ft2build.h>
- #include FT_FREETYPE_H
- /* 这里修改 原来是680 480 太大 */
- #define WIDTH 80
- #define HEIGHT 80
- /* origin is the upper left corner */
- unsigned char image[HEIGHT][WIDTH];
- /* Replace this function with something useful. */
- void
- draw_bitmap( FT_Bitmap* bitmap, FT_Int x, FT_Int y)
- {
- FT_Int i, j, p, q;
- FT_Int x_max = x + bitmap->width;
- FT_Int y_max = y + bitmap->rows;
- /* for simplicity, we assume that `bitmap->pixel_mode' */
- /* is `FT_PIXEL_MODE_GRAY' (i.e., not a bitmap font) */
- for ( i = x, p = 0; i < x_max; i++, p++ )
- {
- for ( j = y, q = 0; j < y_max; j++, q++ )
- {
- if ( i < 0 || j < 0 || i >= WIDTH || j >= HEIGHT )
- continue;
- image[j][i] |= bitmap->buffer[q * bitmap->width + p];
- }
- }
- }
- void show_image( void )
- {
- int i, j;
- for ( i = 0; i < HEIGHT; i++ )
- {
- for ( j = 0; j < WIDTH; j++ )
- putchar( image[i][j] == 0 ? ' '
- : image[i][j] < 128 ? '+'
- : '*' );
- putchar( '\n' );
- }
- }
- int
- main( int argc, char** argv )
- {
- FT_Library library;
- FT_Face face;
- FT_GlyphSlot slot;
- FT_Matrix matrix; /* transformation matrix */
- FT_Vector pen; /* untransformed origin */
- FT_Error error;
- char* filename;
- char* text;
- double angle;
- int target_height;
- int n, num_chars;
- if ( argc != 3 )
- {
- fprintf ( stderr, "usage: %s font sample-text\n", argv[0] );
- exit( 1 );
- }
- filename = argv[1]; /* first argument */
- text = argv[2]; /* second argument */
- num_chars = strlen( text );
- /* 角度设为0不旋转 */
- angle = ( 0.0 / 360 ) * 3.14159 * 2; /* use 25 degrees */
- target_height = HEIGHT;
- error = FT_Init_FreeType( &library ); /* initialize library */
- /* error handling omitted */
- error = FT_New_Face( library, filename, 0, &face );/* create face object */
- /* error handling omitted */
- #if 0
- /* use 50pt at 100dpi */
- error = FT_Set_Char_Size( face, 50 * 64, 0,
- 100, 0 ); /* set character size */
- /* error handling omitted */
- #else
- error = FT_Set_Pixel_Sizes(
- face, /* handle to face object */
- 0, /* pixel_width */
- 16 ); /* pixel_height */
- #endif
- /* cmap selection omitted; */
- /* for simplicity we assume that the font contains a Unicode cmap */
- slot = face->glyph;
- /* set up matrix */
- matrix.xx = (FT_Fixed)( cos( angle ) * 0x10000L );
- matrix.xy = (FT_Fixed)(-sin( angle ) * 0x10000L );
- matrix.yx = (FT_Fixed)( sin( angle ) * 0x10000L );
- matrix.yy = (FT_Fixed)( cos( angle ) * 0x10000L );
- /* the pen position in 26.6 cartesian space coordinates; */
- /* start at (300,200) relative to the upper left corner */
- /* 这里也要改 因为上面改了 */
- pen.x = 0 * 64;
- pen.y = ( target_height - 40 ) * 64;
- for ( n = 0; n < num_chars; n++ )
- {
- /* set transformation */
- FT_Set_Transform( face, &matrix, &pen );
- /* load glyph image into the slot (erase previous one) */
- error = FT_Load_Char( face, text[n], FT_LOAD_RENDER );
- if ( error )
- continue; /* ignore errors */
- /* now, draw to our target surface (convert position) */
- draw_bitmap( &slot->bitmap,
- slot->bitmap_left,
- target_height - slot->bitmap_top );
- /* increment pen position */
- pen.x += slot->advance.x;
- pen.y += slot->advance.y;
- }
- show_image();
- FT_Done_Face ( face );
- FT_Done_FreeType( library );
- return 0;
- }
- /* EOF */
上面显示了英文字符,通过执行程序时传进去的 abc 如果我们想显示中文怎么办呢,我们在源码里先定义一个字符串,再显示字符串 这里有一个地方要注意,字符串要以宽字符的方式定义保存,不能以 char *str = "矢量字体"; 这样的方式定义,因为中文是用二个字节保存的 英文是一个字节,如果一个字符串里又有中文又有英文就不好处理了。因此又引入了“宽字符” 宽字符怎么用,老办法 搜。wchar_t *str = L"矢量字体"; 这样定义 同时还有一个头文件要包含进去 #include <wchar.h> ,下面列出一个例子,同样是在上面的基础上改的。
在这个例子里会出现编译时 提示无法转换字符集 error:converting to execution character set: Invalid or incomplete multibyte or wide character
在指定字符输入输出字符集编译 gcc -finput-charset=GBK -fexec-charset=UTF-8 -o example example.c -I /usr/local/include/freetype2/ -lfreetype -lm
这里列出源码
- /* example1.c */
- /* */
- /* This small program shows how to print a rotated string with the */
- /* FreeType 2 library. */
- #include <stdio.h>
- #include <string.h>
- #include <math.h>
- #include <wchar.h>
- #include <ft2build.h>
- #include FT_FREETYPE_H
- /* 这里修改 原来是680 480 太大 */
- #define WIDTH 100
- #define HEIGHT 100
- /* origin is the upper left corner */
- unsigned char image[HEIGHT][WIDTH];
- /* Replace this function with something useful. */
- void
- draw_bitmap( FT_Bitmap* bitmap, FT_Int x, FT_Int y)
- {
- FT_Int i, j, p, q;
- FT_Int x_max = x + bitmap->width;
- FT_Int y_max = y + bitmap->rows;
- /* for simplicity, we assume that `bitmap->pixel_mode' */
- /* is `FT_PIXEL_MODE_GRAY' (i.e., not a bitmap font) */
- for ( i = x, p = 0; i < x_max; i++, p++ )
- {
- for ( j = y, q = 0; j < y_max; j++, q++ )
- {
- if ( i < 0 || j < 0 || i >= WIDTH || j >= HEIGHT )
- continue;
- image[j][i] |= bitmap->buffer[q * bitmap->width + p];
- }
- }
- }
- void show_image( void )
- {
- int i, j;
- for ( i = 0; i < HEIGHT; i++ )
- {
- for ( j = 0; j < WIDTH; j++ )
- putchar( image[i][j] == 0 ? ' '
- : image[i][j] < 128 ? '+'
- : '*' );
- putchar( '\n' );
- }
- }
- int
- main( int argc, char** argv )
- {
- FT_Library library;
- FT_Face face;
- FT_GlyphSlot slot;
- FT_Matrix matrix; /* transformation matrix */
- FT_Vector pen; /* untransformed origin */
- FT_Error error;
- char* filename;
- char* text;
- double angle;
- int target_height;
- int n, num_chars;
- wchar_t *chinese_str = L"矢量字体";
- /* 把参数改为2个 */
- if ( argc != 2 )
- {
- fprintf ( stderr, "usage: %s font \n", argv[0] );
- exit( 1 );
- }
- /* 注释掉这两行 */
- filename = argv[1]; /* first argument */
- // text = argv[2]; /* second argument */
- // num_chars = strlen( text );
- /* 角度设为0不旋转 */
- angle = ( 0.0 / 360 ) * 3.14159 * 2; /* use 25 degrees */
- target_height = HEIGHT;
- error = FT_Init_FreeType( &library ); /* initialize library */
- /* error handling omitted */
- error = FT_New_Face( library, filename, 0, &face );/* create face object */
- /* error handling omitted */
- #if 0
- /* use 50pt at 100dpi */
- error = FT_Set_Char_Size( face, 50 * 64, 0,
- 100, 0 ); /* set character size */
- /* error handling omitted */
- #else
- /* 直接用这个函数设字像素大小 */
- error = FT_Set_Pixel_Sizes(
- face, /* handle to face object */
- 0, /* pixel_width */
- 24 ); /* pixel_height */
- #endif
- /* cmap selection omitted; */
- /* for simplicity we assume that the font contains a Unicode cmap */
- slot = face->glyph;
- /* set up matrix */
- matrix.xx = (FT_Fixed)( cos( angle ) * 0x10000L );
- matrix.xy = (FT_Fixed)(-sin( angle ) * 0x10000L );
- matrix.yx = (FT_Fixed)( sin( angle ) * 0x10000L );
- matrix.yy = (FT_Fixed)( cos( angle ) * 0x10000L );
- /* the pen position in 26.6 cartesian space coordinates; */
- /* start at (300,200) relative to the upper left corner */
- /* 这里也要改 因为上面改了 */
- pen.x = 10 * 64;
- pen.y = ( target_height - 40 ) * 64;
- /* man wcslen man strlen 去找到用法 得到字符串长度 */
- for ( n = 0; n < wcslen(chinese_str); n++ )
- {
- /* set transformation */
- FT_Set_Transform( face, &matrix, &pen );
- /* load glyph image into the slot (erase previous one) */
- /* 直接显示字符串不使用传入参数 */
- error = FT_Load_Char( face, chinese_str[n], FT_LOAD_RENDER );
- if ( error )
- continue; /* ignore errors */
- /* now, draw to our target surface (convert position) */
- draw_bitmap( &slot->bitmap,
- slot->bitmap_left,
- target_height - slot->bitmap_top );
- /* increment pen position */
- pen.x += slot->advance.x;
- pen.y += slot->advance.y;
- }
- show_image();
- FT_Done_Face ( face );
- FT_Done_FreeType( library );
- return 0;
- }
- /* EOF */
通过上面的测试,下面总结一下freetype字体的用法,和一些注意事项。参考官方文档。后面会慢慢增加对FreeType的测试代码。
上面的代码都是在PC机上运行的,现在我们来移植到ARM开发板上去,首先要进行交叉编译,试一下一大堆错误,我们连freetype都没有编译配置,下面先来编译
1:解压 tar xjf freetype-2.9.1.tar.bz2 然后进入目录
2:配置 ./configure --host=arm-linux 指定为交叉编译用于ARM平台
3:编译 make
4:安装 make DESTDIR=$PWD/tmp install 先安装到当前目录下的tmp目录里,然后把 lib include里的东西拷贝到我们编译器工具链里 如果直接make 会安装到PC机根目录下
cd tmp/usr/local/include/
sudo cp * /usr/local/arm/4.3.2/arm-none-linux-gnueabi/libc/usr/include -rf
cd tmp/usr/local/lib/
sudo cp * /usr/local/arm/4.3.2/arm-none-linux-gnueabi/libc/armv4t/lib -d -rf
5:编译应用程序 arm-linux-gcc example example.c 出现一大堆错误
5.1:sudo mv freetype2/freetype . 编译时找头文件目录多了一个freetype2 我们把下面的都移上来。还是不行,那就指定头文件目录 指定动态库 指定字符集再编译
arm-linux-gcc -finput-charset=GBK -o freetype freetype.c -I /usr/local/arm/4.3.2/arm-none-linux-gnueabi/libc/usr/include/freetype -lfreetype
编译成功后 可执行程序freetype 字体文件simsun.ttc 拷贝到根文件系统目录里去 动态库tmp/usr/local/lib/ 拷贝到文件系统根目录lib/目录下
然后就可以执行,且可以在终端打印出字体了。
下一步,修改应用程序源码,让其在lcd上显示,我们之前有做过在Lcd上显示英文和中文字体,那些显示函数是可以用的,这里我们修改的就是把在终端输出改成在lcd上显示
下面列出源码。
修改后 编译还是出错 error: failure to convert GBK to UTF-8 用amn gcc 找一下 charset 看一个gcc里怎么转换 看到这里
-fexec-charset=charset
Set the execution character set, used for string and character constants. The default is UTF-8. charset can be any encoding supported by the system's "iconv" library
routine.
我们看一下 iconv --help 怎么用
Input/Output format specification:
-f, --from-code=NAME encoding of original text
-t, --to-code=NAME encoding for output
我们用执行一下看看
iconv -f GBK -t UTF-8 freetype.c
可以看到在处理asicc字体文件时有个别字符他无法识别,我们去掉这些字符就可以了 源码经测试可通过,完全显示在lcd上,可以修改参数,换字体 换大小,换角度都可以修改测试,最关键的地方就是 坐标 freetype是基于“笛卡尔”坐标,我们用的是“lcd”坐标 。
- /* example1.c */
- /* */
- /* This small program shows how to print a rotated string with the */
- /* FreeType 2 library. */
- #include <sys/mman.h>
- #include <sys/types.h>
- #include <sys/stat.h>
- #include <unistd.h>
- #include <stdio.h>
- #include <linux/fb.h>
- #include <fcntl.h>
- #include <string.h>
- #include <math.h>
- #include <wchar.h>
- #include <ft2build.h>
- #include FT_FREETYPE_H
- static int fd_fb;
- static struct fb_var_screeninfo var; /* 定义一个可变信息结构体 用于保存获得的可变信息 */
- static struct fb_fix_screeninfo fix; /* 定义一个固定信息结构体 用于保存获得的固定信息 */
- static int screen_size; /* 定义一个变量 表示 framebuffer 进行内存映射 */
- static unsigned char *fbmem; /* 定认一个指针变量 用于保存内存映射后的地址 */
- static int fd_hzk;
- static struct stat hzk_stat; /* 定义一个结构体用于保存统计信息 */
- static unsigned char *hzkmem; /* 定义一个指针变量 用于保存央存映射的地址 */
- static unsigned int line_width;
- static unsigned int pixel_whdth;
- static unsigned char *str = "谢";
- /* 描点函数 根据 x,y,值 确定对应framebuffer的位置
- * 然后依次的在对应的framebuffer上写入颜色值即可
- */
- void lcd_put_pixel(int x, int y, unsigned int color)
- {
- unsigned char *pen = fbmem + y*line_width + x*pixel_whdth;
- *pen = color;
- }
- /* 显示中文 如何显示呢?
- * 1: 先得到汉字库的文件 然后可以像打开framebuffe一样打开这个文件
- * 2: 打开后就可以去读了,我们也可以把这个文件当成内存一样用 即映射一下
- * 3: 然后就可以去里面得到字体点阵数据了,接着和显示字符一样描点即可
- * 把文件当成内存去映射先要得到文件大小 可以用 fstat 这个函数来获得大小
- * 如何使用这个函数 可以在服务器上输入 man fstat 得到使用说明
- * 汉字库的使用方法可以去"度娘"去找,基本上就是下面几个注意的地方
- * 1: GBK编码用四个字节表示一个中文 第一个字节表示区码 第二个字节表示位码
- * 2: 为了兼容ascii码 编码从a1 开始 例:"中"字 值是 D6 D0 D6=区码 D0=位码
- * 3: 所以编码的值是 区码-A1 位码-A1
- */
- void lcd_put_chinses(int x, int y, unsigned char *str)
- {
- unsigned int area = str[0] - 0xa1;
- unsigned int where = str[1] - 0xa1;
- unsigned char *dots = hzkmem + (area * 94 + where) * 32;
- unsigned char byte;
- int i,j,k;
- for (i = 0;i < 16;i ++)
- {
- for (j = 0;j < 2;j ++)
- {
- byte = dots[i * 2 + j];
- for (k = 7;k >=0;k --)
- {
- if (byte & (1 << k))
- {
- /* 传入参数的值是lcd要显示的起点坐标 这里每个点的坐标每描一个点要移动一次 */
- lcd_put_pixel(x + j * 8 + 7 - k, y + i, 0xffffff); /* 0xffffff 表示白色 */
- }
- else
- {
- /* 传入参数的值是lcd要显示的起点坐标 这里每个点的坐标每描一个点要移动一次 */
- lcd_put_pixel(x + j * 8 + 7 - k, y + i, 0); /* 0 表示黑色 */
- }
- }
- }
- }
- }
- void draw_bitmap( FT_Bitmap* bitmap, FT_Int x, FT_Int y)
- {
- FT_Int i, j, p, q;
- FT_Int x_max = x + bitmap->width;
- FT_Int y_max = y + bitmap->rows;
- /* for simplicity, we assume that `bitmap->pixel_mode' */
- /* is `FT_PIXEL_MODE_GRAY' (i.e., not a bitmap font) */
- for ( i = x, p = 0; i < x_max; i++, p++ )
- {
- for ( j = y, q = 0; j < y_max; j++, q++ )
- {
- if ( i < 0 || j < 0 || i >= var.xres|| j >= var.yres )
- continue;
- //image[j][i] |= bitmap->buffer[q * bitmap->width + p];
- lcd_put_pixel(i, j, bitmap->buffer[q * bitmap->width + p]);
- }
- }
- }
- int main(int argc, char **argv)
- {
- FT_Library library;
- FT_Face face;
- FT_GlyphSlot slot;
- FT_Matrix matrix; /* transformation matrix */
- FT_Vector pen; /* untransformed origin */
- FT_Error error;
- char* filename;
- char* text;
- double angle;
- int target_height;
- int n, num_chars;
- wchar_t *chinese_str = L"翻繁敏酩aAbB";
- fd_fb = open("/dev/fb0", O_RDWR); /* 打开lcd设备 可读可写 */
- if (fd_fb < 0)
- {
- printf("cnt't open /dev/fb0 !\n");
- return -1;
- }
- if (ioctl(fd_fb, FBIOGET_VSCREENINFO, &var)) /* 获得可变信息 */
- {
- /* 正常获得信息的话 ioctl 会返回0 如果返回值不为0时表示出错 */
- printf("can't get var! \n");
- return -1;
- }
- if (ioctl(fd_fb,FBIOGET_FSCREENINFO, &fix)) /* 获得固定信息 */
- {
- /* 正常获得信息的话 ioctl 会返回0 如果返回值不为0时表示出错 */
- printf("can't get fix! \n ");
- return -1;
- }
- /* 计算 framebuffer 的大小 用于内存映射单位字节 用x分辩率*y分辩率*每个像素得到总大小这时的单位是bit 除以8 转换成字节 */
- screen_size = var.xres * var.yres * var.bits_per_pixel / 8;
- /* 内存映射 mmap 怎么用呢,可以在服务器上输入man mmap 得到说明
- * void *mmap(void *addr, size_t length, int prot, int flags,int fd, off_t offset);
- * 参数说明:void *addr 设置为0 让内核自动给我们分配地址
- * :size_t length 映射内存大小
- * :int prot 属性为可读可写
- * :int flags 共享 其它进程都可见
- * :int fd framebuffer
- * :off_t offset 偏移值
- */
- fbmem = (unsigned char *)mmap(NULL, screen_size, PROT_READ | PROT_WRITE, MAP_SHARED, fd_fb, 0);
- if (fbmem == (unsigned char *)-1)
- {
- printf("can't mmap!\n");
- return -1;
- }
- line_width = var.xres * var.bits_per_pixel / 8;
- pixel_whdth = var.bits_per_pixel / 8;
- /* 打开当前目录下的 HZK16 文件 属性设为只读 */
- fd_hzk = open("HZK16", O_RDONLY);
- if (fd_hzk < 0)
- {
- printf("can't open HZK16\n");
- return -1;
- }
- /* 得到这个件的统计信息当然也包含了大小 */
- if (fstat(fd_hzk, &hzk_stat))
- {
- printf("can't get hzk_stat! \n ");
- return -1;
- }
- /* 内存映射 mmap 怎么用呢,可以在服务器上输入man mmap 得到说明
- * void *mmap(void *addr, size_t length, int prot, int flags,int fd, off_t offset);
- * 参数说明:void *addr 设置为0 让内核自动给我们分配地址
- * :size_t length 映射内存大小
- * :int prot 属性为可读可写
- * :int flags 共享 其它进程都可见
- * :int fd 文件
- * :off_t offset 偏移值
- */
- hzkmem = (unsigned char *)mmap(NULL, hzk_stat.st_size, PROT_READ, MAP_SHARED, fd_hzk, 0);
- if (hzkmem == (unsigned char *)-1)
- {
- printf("can't mmap!\n");
- return -1;
- }
- /* 这里先清屏 全部显黑色 */
- memset(fbmem, 0, screen_size);
- filename = argv[1]; /* first argument */
- angle = ( 10.0 / 360 ) * 3.14159 * 2; /* use 25 degrees */
- // target_height = HEIGHT;
- error = FT_Init_FreeType( &library ); /* initialize library */
- /* error handling omitted */
- error = FT_New_Face( library, filename, 0, &face );/* create face object */
- /* error handling omitted */
- #if 0
- /* use 50pt at 100dpi */
- error = FT_Set_Char_Size( face, 50 * 64, 0,
- 100, 0 ); /* set character size */
- /* error handling omitted */
- #else
- /* 直接用这个函数设字像素大小 */
- error = FT_Set_Pixel_Sizes(
- face, /* handle to face object */
- 0, /* pixel_width */
- 48 ); /* pixel_height */
- #endif
- /* cmap selection omitted; */
- /* for simplicity we assume that the font contains a Unicode cmap */
- slot = face->glyph;
- /* set up matrix */
- matrix.xx = (FT_Fixed)( cos( angle ) * 0x10000L );
- matrix.xy = (FT_Fixed)(-sin( angle ) * 0x10000L );
- matrix.yx = (FT_Fixed)( sin( angle ) * 0x10000L );
- matrix.yy = (FT_Fixed)( cos( angle ) * 0x10000L );
- /* the pen position in 26.6 cartesian space coordinates; */
- /* start at (300,200) relative to the upper left corner */
- /* 这里也要改 因为上面改了 */
- // pen.x = (var.xres/2 + 24) * 64;
- pen.x = (0 + 24) * 64;
- pen.y = (var.yres / 2 - 16) * 64;
- /* man wcslen man strlen 去找到用法 得到字符串长度 */
- for ( n = 0; n < wcslen(chinese_str); n++ )
- {
- /* set transformation */
- FT_Set_Transform( face, &matrix, &pen );
- /* load glyph image into the slot (erase previous one) */
- /* 直接显示字符串不使用传入参数 */
- error = FT_Load_Char( face, chinese_str[n], FT_LOAD_RENDER );
- if ( error )
- continue; /* ignore errors */
- /* now, draw to our target surface (convert position) */
- draw_bitmap( &slot->bitmap,
- slot->bitmap_left,
- var.yres - slot->bitmap_top );
- /* increment pen position */
- pen.x += slot->advance.x;
- pen.y += slot->advance.y;
- }
- // show_image();
- /* 在lcd上显示ascii字符 即然是显示,肯定要有位置 在那显示先定在中间 */
- // lcd_put_ascii(var.xres / 2, var.yres / 2, 'F');
- /* 在lcd上显示中文 即然是显示,肯定要有位置 在那显示 */
- lcd_put_chinses(var.xres / 2 + 8, var.yres / 2, str);
- FT_Done_Face ( face );
- FT_Done_FreeType( library );
- return 0;
- }
FreeType 矢量字体 测试移植(1)的更多相关文章
- 使用FreeType实现矢量字体的粗体、斜体、描边、阴影效果
前言: Freetype是一个跨平台.开源的字体渲染器,网上很多文章介绍,本人就不啰嗦了.本文重点在于实现文章标题所属的各种效果,不是Freetype的基本使用方法介绍文档,所以对于Freetype不 ...
- WPF自定义控件与样式(1)-矢量字体图标(iconfont)
一.图标字体 图标字体在网页开发上运用非常广泛,具体可以网络搜索了解,网页上的运用有很多例子,如Bootstrap.但在C/S程序中使用还不多,字体图标其实就是把矢量图形打包到字体文件里,就像使用一般 ...
- UWP 矢量字体图标(iconfont)使用
本文使用 阿里巴巴开源字体: 选择矢量字体图标: 查看或编辑 Unicode编码 或字体名称 下载到本地,添加到uwp项目 代码中写法 Text:Unicode编码 FontFamily:文件路径#字 ...
- UI图标不用愁:矢量字体图标Font-Awesome
Font-Awesome,这个项目主要是css3的一个应用,准确的说是一段css,这里的把很多图标的东西做到了font文件里面,然后通过引用外部font文件的方式,来展现图标. Font Awesom ...
- windows矢量字体点阵数据的提取(转)
源:windows矢量字体点阵数据的提取 问题参考:windows api 获取字库点阵的问题 1.提取原理 在windows系统当中提取矢量字体的字模有很多方法,下面介绍一种利用GetGlyphOu ...
- WPF使用矢量字体图标(阿里巴巴iconfont)
原文:WPF使用矢量字体图标(阿里巴巴iconfont) 版权声明:本文为博主原创文章,转载请注明出处. https://blog.csdn.net/lwwl12/article/details/78 ...
- wpf 使用矢量字体 fontawesome
第一步:首先下载矢量字体 :http://www.fontawesome.com.cn/ 第二步:在将fontawesome-webfont.ttf 文件引用到项目 设置fontawesome-web ...
- WPF矢量字体图标(iconfont)
原文:WPF矢量字体图标(iconfont) 转载:点击打开链接 步骤: 一.下载添加iconfont文件 二.添加到资源文件夹,并设置不复制,且为资源文件 三.增加FIcon.xaml文件 < ...
- 如何应用Font Awesome矢量字体图标
Font Awesome 是一套专门为 Twitter Boostrap 设计的图标字体库.这套图标字体集几乎囊括了网页中可能用到的所有图标,除了包括 Twitter Boostrap 的默认图标外, ...
- Font Awesome 4.0.3 提供了369个网页常用的矢量字体图标
Font Awesome 为您提供了一套可缩放的字体矢量图标,可以快速自定义图标的大小,颜色,阴影,这些都可以通过CSS来实现,无需任何的JS代码哦. 一,主要特点如下: 1,一个字体,369个图标 ...
随机推荐
- IPC,进程间通信
信号机制 也叫软中断,软件层次上对中断的模拟 kill -9 加进程号可以终止进程 linux下执行kill -l可以看到 这里面居然没有32 33 直接从31到34 所以一共是62个信号 1) SI ...
- mybatis原理探究
jdbc数据库运行流程: JDBC有哪三种statement接口: Statement 1.Statement接口提供了执行语句和获取结果的基本方法: 2.Statement继承自Wrapper:3. ...
- C# 使用多线程的几种方式
1.Thread 详细介绍:https://www.cnblogs.com/cheng8/p/16147918.html 使用Thread类通过ThreadStart(无参数)或Parameteriz ...
- android手机无线调试
1.手机与电脑先通过usb链接2.adb devices查看是否链接成功(链接成功会显示设备列表)3.adb tcpip 5555(0-65535之间取值,默认5555输进去)5:断开数据线,查看手机 ...
- NAT的转换
NAT的转换 拓扑图 Sever0的IP地址:192.168.0.1/24 网关:192.168.0.254 PC0的IP地址:192.168.0.100/24 PC1的IP地址:192.168.0. ...
- linux搭建FastDFS文件服务器,安装nginx
本文主要介绍在linux服务器如何搭建FastDFS文件服务器.大概分为9个步骤,由于内容较为繁琐.下面带你入坑! 首先简单介绍一下FastDFS是淘宝资深架构师余庆老师主导开源的一个分布式文件系统, ...
- 如何在centos7.6操作系统下安装mysql数据库
1.从mysql官网上下载自己合适mysql版本,进入mysl官网https://dev.mysql.com/downloads/mysql/5.6.html#downloads,依次点击: 2.下载 ...
- Python 的入门学习之 Day4~6 ——from”夜曲编程“
Day 4 time: 2021.8.1. 打卡第四天.今天起得很早(7点多一些),很棒,而梳头发更快些就更好了.我也算渐渐养成了晨间学习的习惯吧,一起床就心心念念着Python课程,这让我感觉到了生 ...
- <小李飞刀>系列 随笔
1.多情剑客无情剑 古龙的作品在电视上只看过电影版的陆小凤传奇,对古龙的作品也没有过系统的了解,初读时听到了李寻欢的名字,突然感觉可惜.觉得如此早就读到这种级别的小说有些暴殄天物,不过也算是以白纸状态 ...
- Arduino开发ESP8266——安装与配置ESP8266开发板
一.安装Arduino 1.下载安装包:点击打开 2.安装:直接点击下一步直至安装完成.如下图所示: 二.下载ESP8266开发板库: 在这面填写ESP8266开发板地址:http://arduino ...