A9VG电玩部落论坛

 找回密码
 注册
搜索
查看: 4218|回复: 20

关于wii自制程序中文显示包初步计划

[复制链接]

精华
0
帖子
495
威望
0 点
积分
531 点
种子
12 点
注册时间
2007-3-8
最后登录
2024-9-24
 楼主| 发表于 2008-8-14 16:08  ·  广东 | 显示全部楼层 |阅读模式
暂定测试计划
1. 点阵字库, 字库来源:ucdos hz12 hz16字库
2. FreeType2字库, 字库来源: pspchina发布的ereader 1.59_src所携带gbk字库.

freetype2的移植性应该不错. ansi c的东西...  热度有限, 万一流产...不要拍砖

目的: 没啥, 闲的.......

精华
0
帖子
495
威望
0 点
积分
531 点
种子
12 点
注册时间
2007-3-8
最后登录
2024-9-24
 楼主| 发表于 2008-8-14 16:09  ·  广东 | 显示全部楼层
想先搞定显示, 然后再考虑字体抗锯齿实现...

普通ubuntu 8.04 下取汉字unicode编码, 画bitmap带屏幕搞定
编译环境, gcc  iconv  freetype

附编译好的 freetype lib
http://www.cppblog.com/Files/Kha ... k%20for%20mingw.rar


make[1]: Entering directory `/d/Project/Cplus/WII/DisplayChar/build'
echo DisplayChar.c
powerpc-gekko-gcc -MMD -MP -MF /d/Project/Cplus/WII/DisplayChar/build/DisplayChar.d -g -O2 -Wall -DGEKKO -mrvl -mcpu=750 -meabi -mhard-float ?-I/d/Project/Cplus/WII/DisplayChar/build -I/D/Develop/devkitPro/libogc/include -c /d/Project/Cplus/WII/DisplayChar/src/kernel/DisplayChar.c -o DisplayChar.o
echo linking ... DisplayChar.elf
powerpc-gekko-gcc  DisplayChar.o -g -DGEKKO -mrvl -mcpu=750 -meabi -mhard-float -Wl,-Map,DisplayChar.elf.map  -L/D/Develop/devkitPro/libogc/lib/wii -lwiiuse -lbte -logc -lm -o /d/Project/Cplus/WII/DisplayChar/DisplayChar.elf
echo output ... DisplayChar.dol
powerpc-gekko-objcopy  -O binary /d/Project/Cplus/WII/DisplayChar/DisplayChar.elf /d/Project/Cplus/WII/DisplayChar/DisplayChar.dol
make[1]: Leaving directory `/d/Project/Cplus/WII/DisplayChar/build'



未遂...  freetype2 lib编译后, wii不能使用..
用powerpc-gekko 编译...可耻d失败了...... 未通过configure 自动检测...

...暂时放弃freetype2了....  编译模式很奇怪, 编译器也不是常规的powerpc-linux-gcc...
还是老老实实.点阵字库吧.


迷茫的手写freetype 的powerpc-gekko-gcc的makefile

自己占楼..

精华
2
帖子
4942
威望
7 点
积分
6124 点
种子
0 点
注册时间
2007-4-8
最后登录
2024-3-12
发表于 2008-8-14 16:50  ·  北京 | 显示全部楼层
GOOD,力顶!!!!!!!!!!!!!!!!!!!!!!!!!!!!

希望不要流产~

精华
0
帖子
495
威望
0 点
积分
531 点
种子
12 点
注册时间
2007-3-8
最后登录
2024-9-24
 楼主| 发表于 2008-8-14 17:03  ·  广东 | 显示全部楼层
刚刚看了一下freetype2的文档.  貌似都不算移植,  指定字库文件和编码方式, 然后几番云雨后. 会返回给你一个bitmap, 你可以直接画这个位图到屏幕,  也可以打上mask后再画, 但是无论如何他就是汉字了

精华
0
帖子
495
威望
0 点
积分
531 点
种子
12 点
注册时间
2007-3-8
最后登录
2024-9-24
 楼主| 发表于 2008-8-14 17:08  ·  广东 | 显示全部楼层
#include
#include FT_FREETYPE_H

int main(int argc, char **argv){
  int psize;
  FT_Library library;
  FT_Face face;
  unsigned int ucode;
  FT_UInt glyph_index;
  int row, pixel;

  if(argc != 4){
? return 10;
  }

  ucode = strtol(argv[2], NULL, 16);
  psize = strtol(argv[3], NULL, 10);

  printf("unicode +%X size %dn", ucode, psize);
  if(FT_Init_FreeType(&library)
??|| FT_New_Face(library, argv[1], 0, &face)
??|| FT_Set_Pixel_Sizes(face, psize,  0)){
? return 1;
  }

  //get glyph index
  glyph_index = FT_Get_Char_Index(face, ucode);
  if(glyph_index == 0){
? return 2;
  }

  //load the chinese glyph
  if(FT_Load_Glyph(face, glyph_index,  FT_LOAD_DEFAULT)){
? return 3;
  }


  if(FT_Render_Glyph(face->glyph, FT_RENDER_MODE_MONO)){ //遍历所有的点,使用合适的render画上去
? return 4;
  }
  printf("bitmap_left=%dn"
? ? ?"bitmap_top=%dn"
? ? ?"bitmap.rows=%dn"
? ? ?"bitmap.width=%dn"
? ? ?"bitmap.pitch=%dn"
? ? ?"bitmap.pixel_mode=%dn",
? ? ?face->glyph->bitmap_left,
? ? ?face->glyph->bitmap_top,
? ? ?face->glyph->bitmap.rows,
? ? ?face->glyph->bitmap.width,
? ? ?face->glyph->bitmap.pitch,
? ? ?face->glyph->bitmap.pixel_mode);
  printf("nn");
  for(row = 0;
? ?row < (face->glyph->bitmap.rows - face->glyph->bitmap_top);
? ?++row){
? ?for(pixel = 0; pixel < face->glyph->bitmap.width; ++pixel){
? ??printf("_");
? ?}
? ?printf("n");
  }
  for(row = 0; row < face->glyph->bitmap.rows; ++row){
? for(pixel = 0; pixel < face->glyph->bitmap_left; ++pixel)
? ?printf("_");
? for(pixel = 0; pixel < face->glyph->bitmap.width; ++pixel){
? ?printf("%c", (face->glyph->bitmap.buffer
? ? ? ? ? ??[row * face->glyph->bitmap.pitch +
? ? ? ? ? ? ?pixel/8] & (0xC0 >> (pixel % 8)))?&#39;O&#39;:&#39;_&#39;);
? }
? printf("n");
  }
  return 0;
}


cat ~/bin/mygetunicode

#!/bin/sh



echo -n $1 |iconv -t ucs2 | od -tx1 | head -n1 |awk &#39;{print $3$2}&#39;

./getbitmap /usr/share/fonts/chinese/TrueType/uming.ttf $(mygetunicode 永) 12 ? ? ? //mygetunicode  这个程序是返回汉字的unicode编码? ? ? ? ? ? ? ? ? ? ?
unicode +6C38 size 12
bitmap_left=0
bitmap_top=10
bitmap.rows=11
bitmap.width=11
bitmap.pitch=2
bitmap.pixel_mode=1


___________
____OOO____
______OO___
__OOOOO____
_____OO_OO_
OOOOOOO_O__
___OOOOO___
___OOOOO___
__OO_OO_O__
_OOOOOO_OO_
OO__OOO_OOO
O___OO___OO



标记:字体变换(旋转和缩放)

error = FT_Set_Transform( face,     /* target face object   */
                            &matrix,   /* pointer to 2x2 matrix */
                            &delta );  /* pointer to 2d vector  */

精华
2
帖子
4942
威望
7 点
积分
6124 点
种子
0 点
注册时间
2007-4-8
最后登录
2024-3-12
发表于 2008-8-14 17:32  ·  北京 | 显示全部楼层
恩,freetype是另一个选择

LS GOOD JOB!

征服者

流放者(禁止发言)

精华
5
帖子
4555
威望
7 点
积分
5762 点
种子
5 点
注册时间
2005-5-14
最后登录
2019-5-14
发表于 2008-8-15 00:59  ·  广东 | 显示全部楼层
虽然不懂编程,但是我也知道这个是好东西,是不是这个字库的完工就等于对wii游戏的深度汉化迈出一大步呢,A9WiiG汉化组也应该要开始筹备了

精华
25
帖子
65375
威望
53 点
积分
76450 点
种子
13 点
注册时间
2003-8-23
最后登录
2025-1-15
发表于 2008-8-15 03:22  ·  四川 | 显示全部楼层
下面是引用周防達哉于2008-08-15 00:59发表的:
虽然不懂编程,但是我也知道这个是好东西,是不是这个字库的完工就等于对wii游戏的深度汉化迈出一大步呢,A9WiiG汉化组也应该要开始筹备了
解决自制程序的中文字体显示,不是系统或游戏字库破解,和游戏汉化暂时搭不上边
再说,A9应该不会从事游戏汉化相关工作,不缺汉化的,也不缺技术的

精华
2
帖子
4942
威望
7 点
积分
6124 点
种子
0 点
注册时间
2007-4-8
最后登录
2024-3-12
发表于 2008-8-15 09:30  ·  北京 | 显示全部楼层
LS 13神姨 正解,目前字库是最大的问题
汉显更多的是准备应用到自制程序中去

的确。。。。汉化貌似早已经有人在做了。。。是吧?某邪恶BOSS,嘿嘿~

精华
0
帖子
495
威望
0 点
积分
531 点
种子
12 点
注册时间
2007-3-8
最后登录
2024-9-24
 楼主| 发表于 2008-8-15 09:44  ·  广东 | 显示全部楼层
sorry.... 感冒+鼻炎+支气管炎  点滴中........  暂缓一天...
开的药有镇定剂的成分... 弄得人浑浑噩噩的....
您需要登录后才可以回帖 登录 | 注册

本版积分规则

Archiver|手机版|A9VG电玩部落 川公网安备 51019002005286号

GMT+8, 2025-2-3 03:56 , Processed in 0.203575 second(s), 13 queries , Redis On.

Powered by Discuz! X3.4

Copyright © 2001-2020, Tencent Cloud.

返回顶部