关机充电百分比字体大小修改过程记录
来源:互联网 发布:哇嘎超级节点连接网络 编辑:程序博客网 时间:2024/05/16 08:35
从csdn上面搜了很多文章,字库怎么生成都搞不定,然后看到一篇文章,建议直接从网址1.git clone https://github.com/xiaolu/cwm_recovery_cn上面取下来字库用,这个网址需要用到github,这个之前没有用过,就让同事帮忙下载的。因为人家原来文章建议的是中文字库,我现在还是要继续用英文字库,只是把百分比显示改大一点,所以从cwm_recovery_cn\minui里面挑了稍微大点的字体fonten42_25x49.h使用,添加到bootable/recovery/minui/下面,然后修改graphics.c文件,添加包含的头文件fonten42_25x49.h,为了方便关机充电字体修改不影响其他地方使用原来的字体,其中将fonten42_25x49.h中的数据font改成fonten42_25x49.h,并在graphics.c文件添加两个函数,添加代码如下:
#include "fonten42_25x49.h"
static void gr_init_font_extern(void)
{
gr_font = calloc(sizeof(*gr_font), 1);
int res = res_create_surface("font", (void**)&(gr_font->texture));
if (res == 0) {
// The font image should be a 96x2 array of character images. The
// columns are the printable ASCII characters 0x20 - 0x7f. The
// top row is regular text; the bottom row is bold.
gr_font->cwidth = gr_font->texture->width / 96;
gr_font->cheight = gr_font->texture->height / 2;
} else {
printf("failed to read font: res=%d\n", res);
// fall back to the compiled-in font.
gr_font->texture = malloc(sizeof(*gr_font->texture));
gr_font->texture->width = font_extern.width;
gr_font->texture->height = font_extern.height;
gr_font->texture->stride = font_extern.width;
unsigned char* bits = malloc(font_extern.width * font_extern.height);
gr_font->texture->data = (void*) bits;
unsigned char data;
unsigned char* in = font_extern.rundata;
while((data = *in++)) {
memset(bits, (data & 0x80) ? 255 : 0, data & 0x7f);
bits += (data & 0x7f);
}
gr_font->cwidth = font_extern.cwidth;
gr_font->cheight = font_extern.cheight;
}
// interpret the grayscale as alpha
gr_font->texture->format = GGL_PIXEL_FORMAT_A_8;
}
int gr_init_extern(void)
{
gglInit(&gr_context);
GGLContext *gl = gr_context;
gr_init_font_extern();
gr_vt_fd = open("/dev/tty0", O_RDWR | O_SYNC);
if (gr_vt_fd < 0) {
// This is non-fatal; post-Cupcake kernels don't have tty0.
perror("can't open /dev/tty0");
} else if (ioctl(gr_vt_fd, KDSETMODE, (void*) KD_GRAPHICS)) {
// However, if we do open tty0, we expect the ioctl to work.
perror("failed KDSETMODE to KD_GRAPHICS on tty0");
gr_exit();
return -1;
}
gr_fb_fd = get_framebuffer(gr_framebuffer);
if (gr_fb_fd < 0) {
gr_exit();
return -1;
}
get_memory_surface(&gr_mem_surface);
fprintf(stderr, "framebuffer: fd %d (%d x %d)\n",
gr_fb_fd, gr_framebuffer[0].width, gr_framebuffer[0].height);
/* start with 0 as front (displayed) and 1 as back (drawing) */
gr_active_fb = 0;
if (!has_overlay)
set_active_framebuffer(0);
gl->colorBuffer(gl, &gr_mem_surface);
gl->activeTexture(gl, 0);
gl->enable(gl, GGL_BLEND);
gl->blendFunc(gl, GGL_SRC_ALPHA, GGL_ONE_MINUS_SRC_ALPHA);
gr_fb_blank(true);
gr_fb_blank(false);
if (!alloc_ion_mem(fi.line_length * vi.yres))
allocate_overlay(gr_fb_fd, gr_framebuffer);
return 0;
}
另外将system/core/charger/charger.c里面的函数gr_init()函数的调用替换成gr_init_extern()。
目前字体是比原来大了很多,但是字库仍然不是我想要的那个样子,后面还是需要继续研究字库的生成方式。
参考文章地址:
Android的Recovery快速汉化
http://blog.csdn.net/kangear/article/details/10012033
Android的Recovery中font_10x10.h字库文件制作
http://blog.csdn.net/kangear/article/details/10011849
1.《Android Recovery汉化》
- http://img.zqr.cm/thread-61-1-1.html
2.《联想A298T专用recovery中文恢复系统》
- http://bbs.anzhi.com/thread-8076669-1-1.html
3.《在andriod中加入充电指示》
- http://blog.csdn.net/shuaiff/article/details/5581127
4.《Android 的GUI 系统》
- http://www.cnblogs.com/Caiqinghua/archive/2010/08/03/1790900.html
5.《charger代码分析(Android4.2)》
- http://blog.csdn.net/u010223349/article/details/8822747
6.《android 电池(二):android关机充电流程、充电画面显示》
- http://blog.csdn.net/xubin341719/article/details/8498580
7.《recovery汉化实现》
- http://blog.csdn.net/haomcu/article/details/8189760
8.《linux下gimp将图片另存为.c格式文本文件-之后加工存储 》
- http://blog.chinaunix.net/uid-20564848-id-73227.html
9.《Android系统Recovery工作原理之使用update.zip升级过程分析》
- http://blog.csdn.net/mu0206mu/article/category/1059752
10.《Cocos2d-x初入学堂(6)-->Bitmap Font generator位图字体工具》
- http://blog.csdn.net/aa4790139/article/details/8113197
11.《android 关机闹钟》
- http://blog.csdn.net/g_salamander/article/details/8487328
12.《Android recovery模式》
- http://www.2cto.com/kf/201206/137579.html
13.《android recovery模式及ROM制作》
- http://www.cnblogs.com/xl19862005/archive/2012/03/23/2414109.html
前面都用到了".fnt"文件,但是没讲述".fnt"是怎么产生的怎么用的...
今天就将这个非常有用的位图处理工具,来回答上面的问题...
1、下载地址:http://www.angelcode.com/products/bmfont/
- 关机充电百分比字体大小修改过程记录
- 关机充电添加充电百分比
- 关机充电图标修改
- Android 修改关机充电动画
- Android5.1关机充电界面尺寸修改
- Android源码中关机充电UI的修改
- 关机充电进入充电模式
- 关机充电图标
- Android关机充电流程
- android 关机充电流程
- android 关机充电流程
- 关机充电属性使用
- LED 关机充电控制
- 笔记本电池是开机充电还是关机充电
- 关机充电时充电的坐标
- android关机充电流程、充电画面显示
- android关机充电流程、充电画面显示
- android关机充电流程、充电画面显示
- OCP-1Z0-053-200题-18题-100
- Linux 服务器查看日志基本命令
- OCP-1Z0-053-200题-17题-99
- 不要随意重装Windows操作系统
- 内存管理与检测
- 关机充电百分比字体大小修改过程记录
- shell笔记
- android获得手机屏幕状态栏高度 屏幕高宽度
- 关于spirngMVC实体多对一转换json的解决方案
- 搭建ruby+watir-webdriver+cucumber环境
- libgdx 退出,及获取系统时间与显示,及接口的使用
- uva 10303
- MFC 对话框使用 Unicode 字符集与使用多字节字符集的不同
- ubuntu shell中的重定向