自己用了不同手机也发现过,自己写了个程序来自动搜索中文字库……在我的平板加4台手机上都可以正常显示字体了。话说,4台手机中文字体名字分3种是何等的体验
代码如下,渣渣,自行修改适用
#include <stdio.h>
#include <string.h>
char adress[50] = {"/system/fonts/"};
int main() {
FILE *lang_fone;
char c[100];
int lang_read_pos = 1;
if ((lang_fone = fopen("/system/etc/fons.xml", "r")) == NULL) {
char fo[30] = {"DroidSansFallback.ttf"};
strcat(adress, fo);
} else {
while (lang_read_pos == 1) {
fgets(c, 100, lang_fone);
if (strstr(c, "zh-Hans") != NULL) {
fgets(c, 100, lang_fone);
char *n = strstr(c, ">");
int m = 0;
while (n[m] != '<') {
m++;
}
n[m] = '\0';
char path[100] = {"/system/etc/"};
strcat(adress, n + 1);
lang_read_pos = 0;
}
}
fclose(lang_fone);
}
printf("%s", adress);
return 0;
}