From 69cf82185e7f559d8858b44fa76379c771acc6b6 Mon Sep 17 00:00:00 2001 From: tobigun Date: Fri, 23 Apr 2010 22:39:26 +0000 Subject: - font fallback added - more configurable fonts.ini - ftNormal/ftBold/ftOutline1/2 added git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@2293 b956fd51-792f-4845-bead-9b4dfca2ff2c --- game/fonts/fonts.ini | 53 ++- game/fonts/wqy-zenhei/AUTHORS | 791 +++++++++++++++++++++++++++++++++++ game/fonts/wqy-zenhei/COPYING | 341 +++++++++++++++ game/fonts/wqy-zenhei/README | 365 ++++++++++++++++ game/fonts/wqy-zenhei/wqy-zenhei.ttc | Bin 0 -> 13249170 bytes src/base/TextGL.pas | 104 +++-- src/base/UFont.pas | 335 +++++++++++---- src/base/USingScores.pas | 2 +- src/base/UThemes.pas | 3 +- src/lua/ULuaTextGL.pas | 5 +- src/menu/UDisplay.pas | 2 +- src/menu/UMenuSelectSlide.pas | 4 +- src/menu/UMenuText.pas | 8 +- src/screens/UScreenSing.pas | 9 +- 14 files changed, 1888 insertions(+), 134 deletions(-) create mode 100644 game/fonts/wqy-zenhei/AUTHORS create mode 100644 game/fonts/wqy-zenhei/COPYING create mode 100644 game/fonts/wqy-zenhei/README create mode 100644 game/fonts/wqy-zenhei/wqy-zenhei.ttc diff --git a/game/fonts/fonts.ini b/game/fonts/fonts.ini index a705d665..739fa7c9 100755 --- a/game/fonts/fonts.ini +++ b/game/fonts/fonts.ini @@ -1,11 +1,56 @@ -[Normal] +;+++++++++++++++++++++++++++++++++++++++++++++++++ +; UltraStar Deluxe font configuration file +;------------------------------------------------- +; Format: +;------------------------------------------------- +;[Font_XYZ] +;# the font file +;File=Filename +;# space between glyphs (default: 0.0) +;GlyphSpacing=float +;# width stretch factor (default: 1.0) +;Stretch=float +;# makes the font more bold (default: 0.0). Not used if Outline > 0.0. +;Embolden=float(>=0.0) +;# draws an outline around the glyph +;Outline=float(>=0.0) +;# outline color components (default: 0.0/0.0/0.0/-1.0) +;OutlineColorR/G/B=float([0..1]) +;# outline alpha, -1.0 for alpha of interior (default: -1.0) +;OutlineColorA=float([0..1] or -1) +; +;[Font_...] +;... +; +; Fonts that are used in case a character can't be found in the regular font. +; This is used to display Japanese characters. +;[Fallbacks] +;File1=xy.ttf +;File2=... +;... +;+++++++++++++++++++++++++++++++++++++++++++++++++ + +[Font_Normal] File=FreeSans/FreeSans.ttf +;GlyphSpacing=1.4 +;Stretch=1.2 -[Bold] +[Font_Bold] File=FreeSans/FreeSansBold.ttf +;Embolden=0.06 -[Outline1] +[Font_Outline1] File=DejaVu/DejaVuSans-Bold.ttf +Outline=0.06 +;OutlineColorR=0.3 +;OutlineColorG=0.3 +;OutlineColorB=0.3 +;OutlineColorA=0.3 -[Outline2] +[Font_Outline2] File=FreeSans/FreeSansBold.ttf +Outline=0.08 + +[Fallbacks] +File1=wqy-zenhei/wqy-zenhei.ttc +;File2=C:/Windows/Fonts/simsun.ttc diff --git a/game/fonts/wqy-zenhei/AUTHORS b/game/fonts/wqy-zenhei/AUTHORS new file mode 100644 index 00000000..cae8df96 --- /dev/null +++ b/game/fonts/wqy-zenhei/AUTHORS @@ -0,0 +1,791 @@ +========================================================== + + Wen Quan Yi Zen Hei + + Contributors and Credits + +---------------------------------------------------------- +Email obfuscators: + replace " #" to "@" , replace " _" to "." +---------------------------------------------------------- + +Summary: + + This font package is copyrighted by the WenQuanYi Board of Trustees 2005-2009 + http://wenq.org/index.cgi?WQYBOT +---------------------------------------------------------- + +Table of Content + + I. Previous Work + II. WenQuanYi Vector Font Key Developers + III. Detailed Data Submission List + IV. Stroke Data Version Statistics + +---------------------------------------------------------- + + I. Previous Work + + + 1. The non-Hanzi glyphs, including Hangul, Kana, Latin etc are merged from + UnDotum from the un-fonts project (http://kldp.net/projects/unfonts/), + this font was released under GPL. + + 2. The Bopomofo glyphs U3100-U3127 were imported from GPL font + cwTeX (cwming.ttf), Copyright (c) 1999,2004 Tsong-Min Wu, Tsong-Huey Wu. + Copyright (c) 2005 Tsong-Min Wu, Tsong-Huey Wu and Edward G.J. Lee. + + 3. The embedded WenQuanYi bitmap Song fonts were developed by WenQuanYi + contributors and FangQ based on the bitmap fonts by firefly. + The 12pt Chinese glyphs are copies of the Chinese National Standard + GB19966 [3]. The detailed credit for this font can be found at + http://wenq.org/index.cgi?FirstEmperor_ChangeLog + + 4. The non-Hanzi glyphs for "Zen Hei Mono" were merged from + M+ M Type-1 Light (http://mplus-fonts.sourceforge.jp/) + +---------------------------------------------------------- + + II. WenQuanYi Vector Font Key Developers + + + Qianqian Fang[FangQ] (fangq #nmr _mgh _harvard _edu) + + Developer for online and off-line stroke decomposition + software, server-side scripts and database, software for + vector glyph generation, font creation and version control, + documentation and tutorial development, release manager. + + http://nmr.mgh.harvard.edu/~fangq/ + http://bbs.dartmouth.edu/~fangq/blog/index.cgi + + Three-leg-cat (threelegcat #gmail _com) + key developer for vector Chinese glyphs stroke decomposition + + lsz (chinatslsz #hotmail _com) + http://wenq.org/index.cgi?lsz + + pem (archx #l63 _com) + http://archx.cn + + ailantian (ailantian # gmail _ com) + + key developer for vector Chinese glyphs stroke decomposition + http://ailantian.blogchina.com + + Haitao Han[niqiu] (chenniqiu #gmail _com) + + key developer for vector Chinese glyphs stroke decomposition + http://www.livejournal.com/~niqiu/ + + twang467 (twang467#21cn_com) + key developer for vector Chinese glyphs stroke decomposition + + Qing Lei[fiag] (fiag.hit #gmail _com) + key developer for vector Chinese glyphs stroke decomposition + + zxpmyth (zxpmyth#yahoo_com_cn), luoyuwen, farm, fujianwzh (fujianwzh#gmail_com) + huahua et al also contributed significant amount of work for the stroke + decomposition. + + + III. Detailed list for character stroke decomposition contributions + + 3.1 Contributed with non-web submission + + For the total of 20193 characters, only the latest submission for each + character were counted in the following table (19113 non-anonymous + submissions). There are 23178 submissions counting the multiple revisions + for each character (excluding the submissions for ~4000 + characters which were deleted due to low-quality). + + 4785 ailantian#gmail_com + 3404 chenniqiu#gmail_com + 2203 fangqq#gmail_com + 1941 twang467#21cn_com + 1353 fiag + 713 zxpmyth#yahoo_com_cn + 589 luoyuwen + 581 farm + 231 Huahua + 204 doshelp + 181 hjalight#163_com + 150 JianliangLan + 149 pem + 147 EricNeon + 143 hongclean#gmail_com + 142 shuizhuyuanluo#126_com + 103 lsz + 92 Archon + 60 gdxk + 52 ynlee + 46 albert_liu#163_com + 44 clotho67#yahoo_com_cn + 42 º«Óñ + 42 albert_liuAT163_com + 41 songyu#gmx_net + 39 su100 + 39 Quanm + 38 xuzheng + 37 wahoya + 36 nilarcs + 35 holz + 31 ssl + 31 Ñá¾ë·¢´ô + 30 achaoge#gmail_com + 28 PONY + 28 °®À¶Ìì + 27 xun_liu + 27 wanglu + 24 zlbruce + 22 CHAOSLAWFUL + 21 hideclouds#gmail_com + 20 wisdomzgh#gmail_com + 18 hayuu9#hotmail_com + 18 giesus + 17 dingkm#guodutimes_com + 17 yuye + 17 KissMoon?? + 16 www_ideawu_net + 14 eager#mail_runan_ha_cn + 13 liudidi#gmail_com + 13 AZu + 12 NightElvs + 11 hot4321#21cn_com + 11 june + 11 benluo#linux_org_cn + 10 fei870614#126_com + 10 minus273 + 10 abcxyz54321#163_com + 9 FrankXue + 9 pku_anonymous + 9 phsight1#163_com + 8 wenjun6#163_com + 8 leiyuanjian#gmail_com + 8 zxhphw + 8 easthero + 7 123456 + 7 kenvia + 7 subpepper + 7 lmrsoa#yahoo_com_cn + 7 Magicwood + 7 heatice + 7 heidian + 6 gogo384 + 6 a723000#tom_com + 6 test#com + 6 wr + 6 ProgramFan + 6 bnbolo#gmail_com + 6 firehare + 6 wzkepco#yahoo_com_cn + 6 liyulongmen#tom_com + 5 erhuchen + 5 cipher + 5 xuecan + 5 ccbc + 5 HighWoods + 5 sofoot + 5 ymerlin + 5 wwwapin + 5 pinker + 5 davidleon + 5 sss888 + 5 bluntsword + 5 Sibol + 4 xiongjij + 4 ¶Î + 4 Lolita#linuxsir_org + 4 coliu + 4 zuzhengshi#126_com + 4 gangzhi2000#yahoo_com_cn + 4 xyb + 4 ccxing#21cn_com + 4 guoruoyu126#126_com + 4 lujp72#163_com + 4 laomei + 3 peterpan#163_com + 3 go2home + 3 WLC-IBM + 3 nikita71 + 3 cebug + 3 bookfree + 3 yuzhi + 3 omighcg#yahoo_com_cn + 3 lideyong + 3 bruce + 3 liliyal + 3 IanYang + 3 yangjiliang + 3 cutebomb + 3 daudjiongx + 3 Abel + 3 SQUALL + 3 PhilHan + 3 faireye + 2 hby_sq#163_com + 2 ztx001 + 2 tigerhas + 2 BenBear + 2 cmy + 2 bobopeng + 2 yumumao + 2 Charles + 2 wpl + 2 jzd + 2 4_14_105_ + 2 Sunhb + 2 bill + 2 rina + 2 SMARTSL + 2 leigesheng + 2 thanks + 2 maping + 2 ytqdq#163_com + 2 See01995 + 2 leexiaofeng#gmail_com + 2 jianyu + 2 mubo + 2 AceStrong + 2 suxin + 2 jedmund + 2 vukung + 2 netgator + 2 19750416 + 2 hyh6000 + 2 henry + 2 lyf + 2 crazythink + 2 yy2318 + 2 cluck + 2 weijianx + 2 kennii + 2 ChengZX + 2 WHB + 2 huanglx + 2 chinaboy + 2 kqbnrp + 2 leer + 2 coconut + 2 Zero + 2 mossmoss13 + 2 lvdou + 2 epass + 2 xqfy12 + 2 Å·ÑôÀÏʦ + 2 mikebear + 2 bug + 2 305013 + 2 wnhwnh + 2 freexbase#yahoo_com_cn + 2 wanger + 2 yingkuai#yahoo_com_cn + 2 datapipe#SMTH + 2 asdaa + 2 mis + 2 ÎÒÀÛ¼Æ×÷ÁË66¸öÁË + 2 GOVO + 2 leoundersky + 2 111111 + 2 jack58 + 2 djbys + 2 tinnyliu#gmail_com + 2 kagnhweu + 2 koko + 2 dongy + 2 Stellit + 2 suen + 2 linfanbo + 2 wyboy + 2 lrobinson + 2 ldy + 2 NiuChenying + 2 nice + 2 00020014 + 2 woodok + 2 isyny + 2 ayarlsj + 2 dq23086 + 2 celei + 2 wwp + 2 etain + 2 zl751209a + 2 wangkingben#hotmail_com + 1 panjian + 1 kimstudio + 1 jf + 1 dangxyg + 1 ÎÒÀÛ¼Æ×÷ÁË68¸öÁË + 1 spzs + 1 tuwei + 1 liqi + 1 renlei + 1 stone789 + 1 anonymous_pku + 1 ViCO + 1 power_seu + 1 eastyy + 1 ·¶Ö¾¹ú + 1 sums2001 + 1 gatsby + 1 brainy1127#gmail_com + 1 dreamlake + 1 sunhj + 1 qqtwinsen + 1 whulele + 1 Dayear + 1 ahriman + 1 pyj001 + 1 longlong + 1 yucc + 1 yt_monkey163_com + 1 dzp + 1 srain + 1 sjh111 + 1 salami + 1 firstrose + 1 tchaikov + 1 bingxing + 1 ÎÒÀÛ¼Æ×÷ÁË77¸öÁË + 1 ekylin + 1 pioneer + 1 GMCHDM + 1 mshli + 1 wjhwjh + 1 errorfun + 1 wwwmagic + 1 zlinch + 1 slutgirl + 1 shg988 + 1 hongwei + 1 sesezui + 1 starrain + 1 ÎÒÀÛ¼Æ×÷ÁË70¸öÁË + 1 wangguan + 1 hsx + 1 ÎÒÀÛ¼Æ×÷ÁË61¸öÁË + 1 uptograde + 1 Yuya + 1 sharp + 1 ºÃ°É + 1 tcbtcb + 1 negwb#163_com + 1 alice + 1 gotone#126_com + 1 iCer + 1 uboss + 1 HORSE + 1 sandy + 1 zyanhui + 1 kiss999999 + 1 walter + 1 hnb + 1 czy + 1 LIURKZC + 1 freshwater + 1 farrm + 1 wonking + 1 zhang + 1 xport + 1 Youngcow + 1 belisa + 1 funnywang + 1 lishenyu + 1 xiangxianwang#yahoo_com_cn + 1 sfljl + 1 oltra + 1 ena + 1 ÎÞ¼É¹Â·É + 1 JetLiu + 1 gerry + 1 ʯ½¨Î° + 1 huangying + 1 ÎÒÀÛ¼Æ×÷ÁË73¸öÁË + 1 guotianxiang#hotmail_com + 1 eye311 + 1 maomao + 1 Aaron + 1 ËÎ´Ê + 1 lfm09 + 1 jinpf1975#gmail_com + 1 zggeng + 1 kris + 1 pkkj#tom_com + 1 peterli#163_com + 1 wjywjy + 1 Skaine + 1 xray_xt#sina_com + 1 nobrow + 1 sulze + 1 vivakiki + 1 lihong + 1 kaixin + 1 paidong + 1 zfsdec + 1 shazhonglv + 1 hala + 1 sajuuk + 1 Tommy + 1 Samuel + 1 wszwzzj + 1 lwt + 1 ÎÒÀÛ¼Æ×÷ÁË56¸öÁË + 1 xushaomin + 1 zwnzwn + 1 shamyats + 1 cnFlyBird + 1 Justin + 1 lgl + 1 defender + 1 RockyWall + 1 lxh623#163_com + 1 LNOD + 1 bb + 1 qisni + 1 xiezilin + 1 yoyo + 1 zenon + 1 swest + 1 dnacheung + 1 dhjfj + 1 lsx + 1 cyj + 1 ÎÒÀÛ¼Æ×÷ÁË76¸öÁË + 1 ÎÒÀÛ¼Æ×÷ÁË82¸öÁË + 1 bettyhu + 1 ÎÒÀÛ¼Æ×÷ÁË75¸öÁË + 1 mejane + 1 aaaaaa + 1 anna_sui + 1 jyq10000 + 1 coolman + 1 bridggen + 1 ÎÞµÀÎÞÓеÀ + 1 YangYang + 1 darkblue + 1 donnin + 1 cobain + 1 xia007 + 1 gfgf1030#163_com + 1 surfer + 1 shenyun + 1 haojie_zou#163_com + 1 telecat + 1 hongy19#yahoo_com + 1 ʢε + 1 Å£ÄÌ· + 1 zhishi + 1 shuxq + 1 ÎÒÀÛ¼Æ×÷ÁË79¸öÁË + 1 khan_hrt + 1 brooklet + 1 pxh + 1 leeyva + 1 wokao + 1 ÎÒÀÛ¼Æ×÷ÁË81¸öÁË + 1 LXLY + 1 Quotation + 1 ANDYLIN + 1 ljm60925 + 1 fdeegtee + 1 youan#21cn_com + 1 czjs2 + 1 bosshawk + 1 suzy + 1 shan_haiying#hotmail_com + 1 Raziel + 1 ÎÒÀÛ¼Æ×÷ÁË78¸öÁË + 1 zzz + 1 netleaf + 1 lina + 1 user + 1 dioder + 1 jasonx + 1 archer + 1 baslesu + 1 zcharming + 1 fless + 1 pqt + 1 aheron + 1 immortal_jzx#21cn_com + 1 dai_lin + 1 wowudi + 1 hihmcxy + 1 73082 + 1 groupgch + 1 xyfuse + 1 adam + 1 yangtao + 1 jasonmkt + 1 hujian + 1 tx9998 + 1 wangwb + 1 willing + 1 songx + 1 Optical + 1 wcz + 1 surgeon + 1 jore1985 + 1 anemone + 1 vhhv + 1 Solomon + 1 gisdaniel + 1 andante + 1 abcde + 1 qllei + 1 ÎÒÀÛ¼Æ×÷ÁË83¸öÁË + 1 hanhan + 1 adlion + 1 vying + 1 AK-48 + 1 maxm + 1 hsihao + 1 hitwdh + 1 qiuliuxin + 1 tanhongs + 1 sgqt#tom_com + 1 wangzhy + 1 wsxiaoys + 1 quajetlee + 1 songaway + 1 dqearth + 1 DonPPS + 1 rgbkhn + 1 taizi1985 + 1 daisy + 1 xassin + 1 gulei + 1 chriscow + 1 jimlong + 1 lawyer + 1 asheng + 1 Mosaic + 1 finelei + 1 ÎÒÀÛ¼Æ×÷ÁË71¸öÁË + 1 yongle + 1 shzlt#sina_com + 1 boyangeda + 1 jx0201 + 1 dsj + 1 morolism + 1 jasonzjm + 1 tfy + 1 uriel + 1 WANGXQ4450 + 1 xinxinyu + 1 sxm + 1 laoliu + 1 mikoxc + 1 cccc753 + 1 papaduty + 1 jovian + 1 ¼×ÒÒ±û¶¡Îì + 1 bibiomaniac + 1 sokendai + 1 zinc + 1 wise_simpson#gmail_com + 1 linduer#gmail_com + 1 woodpate + 1 ywshcy + 1 ihhkk + 1 ÎÒÀÛ¼Æ×÷ÁË58¸öÁË + 1 v-worm + 1 Morrie + 1 towersun + 1 furui + 1 BD8GA + 1 bqcao + 1 GPH + 1 zj + 1 randoms + 1 highbear + 1 ÎÒÀÛ¼Æ×÷ÁË72¸öÁË + 1 alexpanm + 1 vic_shao#163_com + 1 siom + 1 freemind + 1 jiangl001 + 1 ÎÒÀÛ¼Æ×÷ÁË63¸öÁË + 1 fantasy + 1 tigerish + 1 hasumi + 1 lusty + 1 vanzen + 1 ¿Â¿Â + 1 calvin1980 + 1 kinemax + 1 xcz9902 + 1 lorry + 1 bznjzhx + 1 raiky + 1 layer026#yahoo_com_cn + 1 Cai + 1 lnzzwjs; + 1 zflyme + 1 DHGX + 1 fatfox + 1 Hottomson + 1 yc1990 + 1 Jeams + 1 yippee + 1 feizhu + 1 chenpp + 1 horizon + 1 liyongxi + 1 Key + 1 windy + 1 willx + 1 xhzhang + 1 ÎÒÀÛ¼Æ×÷ÁË60¸öÁË + 1 fypanda + 1 ȺÖÚºôÉù + 1 forbmj#gmail_com + 1 ÎåÎ廢»¢ + 1 eien#eyou_com + 1 10093716#163_com + 1 picczzz + 1 microdict + 1 hsutau + 1 kanye + 1 noracagi + 1 htlxdht + 1 xuexue + 1 Ryan + 1 kurk + 1 rexli + 1 axz + 1 Dimmy + 1 loveyou220#gmail_com + 1 lnl + 1 Orange + 1 Linc_Wong + 1 lingjun09 + 1 hdtfriendw + 1 helllk + 1 ÎÒÀÛ¼Æ×÷ÁË74¸öÁË + 1 Torune + 1 ÎÒÀÛ¼Æ×÷ÁË62¸öÁË + 1 fish + 1 ylonglew#yahoo_com_cn + 1 ÖйúÈË + 1 BrightHelm + 1 netfairy + 1 sunj + 1 trvli + 1 ÎÒÀÛ¼Æ×÷ÁË59¸öÁË + 1 yingjian + 1 acmuser + 1 lzd + 1 ÕÅ»ª + 1 dao555 + 1 ÎÒÀÛ¼Æ×÷ÁË64¸öÁË + 1 wawana + 1 yym + 1 yuhuixp + 1 pupilzeng + 1 ×ÔÇ¿²»Ï¢ + 1 kevin + 1 ËïСÎä + 1 shosear + 1 wkrlong + 1 lionchong + 1 ÎÒÀÛ¼Æ×÷ÁË69¸öÁË + 1 liutianq + 1 jacken + 1 shuidi + 1 NK + 1 hongsheng + 1 deanpeng + 1 laujon + 1 rikioy + 1 rake + 1 lclc + 1 dragon13542678#163_com + 1 how007 + 1 maliyang + 1 sinnis + 1 dongxin + 1 yaruolin + 1 QQliu + 1 ailavu#sohu_com + 1 BlueGuitar + 1 jinn + 1 oasis + 1 Max_Liu + 1 ÎÒÀÛ¼Æ×÷ÁË57¸öÁË + 1 fylq + 1 ahuge + 1 an5 + 1 Bohr + 1 liting6680#163_com + 1 yufei + 1 aloner + 1 tujunyu + 1 moongate + 1 micky + 1 ibmguo + 1 bearbaby + 1 Vagrancy + 1 zusezyf + 1 cxf + 1 linhua + 1 wellbred + 1 Full + 1 Caesar + 1 miniwolf + 1 lenin234 + 1 qswxn2 + 1 HongGuang + 1 LiuYong + 1 lngcc + 1 jrsdhr + 1 mirage + 1 KBB + 1 hopejs + 1 kokmeng + 1 Сɽ + 1 onehoo + 1 ctqucl#gmail_com + 1 ÎÒÀÛ¼Æ×÷ÁË80¸öÁË + 1 acnbr + 1 bellstar + 1 qz + 1 woofoo + +total 19113 + + + 3.2 Contributed with web-based submission + + Qianqian Fang developed a javascript+Ajax based stroke-decomposition + web interface (http://wenq.org/?Canvas). It became the major tool for + vector font development and modification since June 2007. There have + been 1979 CJK ideographs modified since then and were included in this + font. + + Particularly, we would like to thank contributor "Three-leg-cat" from + Hongkong (threelegcat #gmail _com). With his help, we have been + able to significantly improved the stroke structures for many + most-frequently used Chinese characters. + + + IV. Stroke Data Version Statistics + + Different version corresponds to each update of the vecchinese software. + + 622 %VERSION: 1.0 + 11 %VERSION: 1.01 + 303 %VERSION: 1.01lnx + 280 %VERSION: 1.0wiki + 398 %VERSION: 1.1 + 981 %VERSION: 1.11 + 2281 %VERSION: 1.111 + 7072 %VERSION: 1.111lnx + 142 %VERSION: 1.112 + 4458 %VERSION: 1.113 + 1511 %VERSION: 1.113lnx + 1614 %VERSION: 1.11lnx + 339 %VERSION: 1.1b + 4 %VERSION: 1.1E + 177 %VERSION: 1.1lnx + 1979 %VERSION: Canvas Submission diff --git a/game/fonts/wqy-zenhei/COPYING b/game/fonts/wqy-zenhei/COPYING new file mode 100644 index 00000000..30438f84 --- /dev/null +++ b/game/fonts/wqy-zenhei/COPYING @@ -0,0 +1,341 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. + diff --git a/game/fonts/wqy-zenhei/README b/game/fonts/wqy-zenhei/README new file mode 100644 index 00000000..ff3352d4 --- /dev/null +++ b/game/fonts/wqy-zenhei/README @@ -0,0 +1,365 @@ +========================================================== + + Wen Quan Yi Zen Hei + + Release Notes + +---------------------------------------------------------- + +Dedication: + + To Three-Leg-Cat: The "cat" who has never stopped making + this font better! + +---------------------------------------------------------- +Summary: + + Author : Qianqian Fang and The WenQuanYi Project Contributors + Webpage : http://wqy.sourceforge.net/en/ + Font Name: WenQuanYi Zen Hei + Version : 0.8.38 (Pangu) + Release : 5 + Copyright © 2007-2009, Qianqian Fang and The WenQuanYi Project + Board of Trustees, All rights reserved + License : GPL v2 (with font embedding exception **) + Read COPYING for details + +---------------------------------------------------------- + + Acknowledgment: + + This font contains the Latin/Hangul glyphs from + un-fonts (UnDotum), Copyright (c) 1998-2004 Koanughi Un + + The Bopomofo glyphs U3100-U3127 were imported from GPL font + cwTeX (cwming.ttf), Copyright (c) 1999,2004 Tsong-Min Wu, Tsong-Huey Wu. + Copyright (c) 2005 Tsong-Min Wu, Tsong-Huey Wu and Edward G.J. Lee. + + Part of the embedded bitmap glyphs were derived from + "firefly bitmap fonts" [2], Copyright (c) 2004, Firefly + + The mono-spaced Latin glyphs were derived from M+ M2 Light + Copyright (c) 2002-2008 M+ FONTS PROJECT + +---------------------------------------------------------- + Born Free +---------------------------------------------------------- + +Table of Content + + I. About this font + II. Credits + III. Language Coverage + IV. About "The WenQuanYi Project" + +---------------------------------------------------------- + +I. About this font + +WenQuanYi Zen Hei is a Hei-Ti style (sans-serif type) Chinese +outline font. It is designed for general purpose text formatting +and on-screen display of Chinese characters and symbols from +many other languages. The embolden strokes of the font glyphs +produces enhanced screen contrast, making it easier to read +recognize. The embedded bitmap glyphs further enhance on-screen +performance, which can be enabled with the provided +configuration files. + +WenQuanYi Zen Hei provides a fairly complete coverage to Chinese +Hanzi glyphs, including both simplified and traditional forms. +The total glyph number in this font is over 35,000, including over +21,000 Chinese Hanzi. This font has full coverage to GBK(CP936) +charset, CJK Unified Ideographs, as well as the code-points +needed for zh_cn, zh_sg, zh_tw, zh_hk, zh_mo, ja (Japanese) +and ko (Korean) locales for fontconfig. Starting from version +0.8, this font package has contained two font families, i.e. +the proportionally-spaced Zen Hei, and a mono-spaced face +named "WenQuanYi Zen Hei Mono". + +---------------------------------------------------------- + +II. Credits + +1. The spline Hanzi glyphs were created by Qianqian Fang (FangQ). + +2. The Hanzi stroke data were developed by numerous contributors + over the past 3 years. Particularly, ailantian, niqiu, FangQ, + Three-leg-cat, hunter, lsz, pem, twang467, zxpmyth, luoyuwen, + fujianwzh and farm are the key contributors. + +3. The non-Hanzi glyphs, including Hangul, kana, latin etc are merged from + UnDotum from the un-fonts project (http://kldp.net/projects/unfonts/), + this font was released under GPL. + +4. The embedded WenQuanYi bitmap song fonts were developed by WenQuanYi + contributors and FangQ based on the bitmap fonts by firefly [2]. + The 12pt Chinese glyphs are copies of the Chinese National Standard + GB19966 [3]. The detailed credit for this font can be found at + http://wenq.org/index.cgi?FirstEmperor_ChangeLog + +5. The non-Hanzi glyphs for "Zen Hei Mono" were merged from + M+ M Type-1 Light (http://mplus-fonts.sourceforge.jp/) + +6. The font file was created by Fontforge (http://fontforge.sourceforge.net/), + developed by George Williams. + +---------------------------------------------------------- + + III. Language Coverage + +The following table is based on the locale data provided by fontconfig +(generated by langcover.pl from Dejavu Project +http://dejavu.sourceforge.net/wiki/index.php/Font_utilities). + + ZenHei +aa Afar 100% (62/62) +ab Abkhazia 75% (68/90) +af Afrikaans 100% (69/69) +am Amharic (0/264) +ar Arabic (0/125) +as (0/89) +ast Asturian 100% (72/72) +ava Avaric 100% (67/67) +ay Aymara 100% (60/60) +az Azerbaijani 90% (134/148) +az-ir Azerbaijani in Iran (0/130) +ba Bashkir 78% (64/82) +bam Bambara 100% (60/60) +be Byelorussian 100% (68/68) +bg Bulgarian 100% (60/60) +bh Bihari (Devanagari script) (0/68) +bho Bhojpuri (Devanagari script) (0/68) +bi Bislama 100% (58/58) +bin Edo or Bini 92% (72/78) +bn Bengali (0/89) +bo Tibetan (0/95) +br Breton 100% (64/64) +bs Bosnian 100% (62/62) +bua Buriat (Buryat) 94% (66/70) +ca Catalan 100% (74/74) +ce Chechen 100% (67/67) +ch Chamorro 100% (58/58) +chm Mari (Lower Cheremis / Upper Cheremis) 86% (66/76) +chr Cherokee (0/85) +co Corsican 100% (85/85) +cs Czech 100% (82/82) +cu Old Church Slavonic 71% (74/103) +cv Chuvash 91% (68/74) +cy Welsh 89% (70/78) +da Danish 100% (70/70) +de German 100% (60/60) +dz Dzongkha (0/95) +el Greek 100% (70/70) +en English 100% (73/73) +eo Esperanto 100% (64/64) +es Spanish 100% (67/67) +et Estonian 100% (64/64) +eu Basque 100% (56/56) +fa Persian (0/129) +fi Finnish 100% (63/63) +fj Fijian 100% (52/52) +fo Faroese 100% (68/68) +fr French 100% (85/85) +ful Fulah (Fula) 100% (62/62) +fur Friulian 100% (66/66) +fy Frisian 100% (75/75) +ga Irish 82% (66/80) +gd Scots Gaelic 100% (70/70) +gez Ethiopic (Geez) (0/218) +gl Galician 100% (66/66) +gn Guarani 97% (68/70) +gu Gujarati (0/78) +gv Manx Gaelic 100% (54/54) +ha Hausa 100% (60/60) +haw Hawaiian 100% (63/63) +he Hebrew (0/27) +hi Hindi (Devanagari script) (0/68) +ho Hiri Motu 100% (52/52) +hr Croatian 100% (62/62) +hu Hungarian 100% (70/70) +hy Armenian (0/77) +ia Interlingua 100% (52/52) +ibo Igbo 89% (52/58) +id Indonesian 100% (54/54) +ie Interlingue 100% (52/52) +ik Inupiaq (Inupiak, Eskimo) 100% (68/68) +io Ido 100% (52/52) +is Icelandic 100% (70/70) +it Italian 100% (73/73) +iu Inuktitut (0/161) +ja Japanese 100% (6538/6538) +ka Georgian (0/33) +kaa Kara-Kalpak (Karakalpak) 84% (66/78) +ki Kikuyu 100% (56/56) +kk Kazakh 84% (65/77) +kl Greenlandic 100% (81/81) +km Khmer (0/70) +kn Kannada (0/80) +ko Korean 100% (2443/2443) +kok Kokani (Devanagari script) (0/68) +ks Kashmiri (Devanagari script) (0/68) +ku Kurdish 90% (58/64) +ku-ir Kurdish in Iran (0/32) +kum Kumyk 100% (66/66) +kv Komi (Komi-Permyak/Komi-Siryan) 97% (68/70) +kw Cornish 100% (64/64) +ky Kirgiz 94% (66/70) +la Latin 100% (68/68) +lb Luxembourgish (Letzeburgesch) 100% (75/75) +lez Lezghian (Lezgian) 100% (67/67) +ln Lingala 96% (78/81) +lo Lao (0/65) +lt Lithuanian 100% (70/70) +lv Latvian 100% (78/78) +mg Malagasy 100% (56/56) +mh Marshallese 100% (62/62) +mi Maori 96% (62/64) +mk Macedonian 90% (38/42) +ml Malayalam (0/78) +mn Mongolian (0/130) +mo Moldavian 100% (128/128) +mr Marathi (Devanagari script) (0/68) +mt Maltese 100% (72/72) +my Burmese (Myanmar) (0/48) +nb Norwegian Bokmal 100% (70/70) +nds Low Saxon 100% (59/59) +ne Nepali (Devanagari script) (0/68) +nl Dutch 100% (83/83) +nn Norwegian Nynorsk 100% (76/76) +no Norwegian (Bokmal) 100% (70/70) +ny Chichewa 100% (54/54) +oc Occitan 100% (70/70) +om Oromo or Galla 100% (52/52) +or Oriya (0/79) +os Ossetic 100% (66/66) +pa Punjabi (Gurumukhi script) (0/63) +pl Polish 100% (70/70) +ps-af Pashto in Afghanistan (0/49) +ps-pk Pashto in Pakistan (0/49) +pt Portuguese 100% (83/83) +rm Rhaeto-Romance (Romansch) 100% (66/66) +ro Romanian 100% (62/62) +ru Russian 100% (66/66) +sa Sanskrit (Devanagari script) (0/68) +sah Yakut 86% (66/76) +sco Scots 100% (56/56) +se North Sami 100% (66/66) +sel Selkup (Ostyak-Samoyed) 100% (66/66) +sh Serbo-Croatian 100% (76/76) +si Sinhala (Sinhalese) (0/77) +sk Slovak 100% (86/86) +sl Slovenian 100% (62/62) +sm Samoan 100% (53/53) +sma South Sami 100% (60/60) +smj Lule Sami 100% (60/60) +smn Inari Sami 100% (68/68) +sms Skolt Sami 100% (80/80) +so Somali 100% (52/52) +sq Albanian 100% (56/56) +sr Serbian 100% (76/76) +sv Swedish 100% (68/68) +sw Swahili 100% (52/52) +syr Syriac (0/45) +ta Tamil (0/48) +te Telugu (0/80) +tg Tajik 84% (66/78) +th Thai (0/87) +ti-er Eritrean Tigrinya (0/256) +ti-et Ethiopian Tigrinya (0/282) +tig Tigre (0/221) +tk Turkmen 89% (66/74) +tl Tagalog (0/19) +tn Tswana 100% (56/56) +to Tonga 100% (53/53) +tr Turkish 100% (70/70) +ts Tsonga 100% (52/52) +tt Tatar 86% (66/76) +tw Twi 90% (66/73) +tyv Tuvinian 94% (66/70) +ug Uighur (0/125) +uk Ukrainian 97% (70/72) +ur Urdu (0/145) +uz Uzbek 88% (60/68) +ven Venda 83% (52/62) +vi Vietnamese 49% (96/194) +vo Volapuk 100% (54/54) +vot Votic 100% (62/62) +wa Walloon 100% (70/70) +wen Sorbian languages (lower and upper) 100% (76/76) +wo Wolof 100% (66/66) +xh Xhosa 100% (52/52) +yap Yapese 100% (58/58) +yi Yiddish (0/27) +yo Yoruba 87% (104/119) +zh-936 GBK Chinese national standard 100% (21920/21920) +zh-cn Chinese (simplified) 100% (6765/6765) +zh-hk Chinese Hong Kong Supplementary Character Set 100% (2213/2213) +zh-mo Chinese in Macau 100% (2213/2213) +zh-sg Chinese in Singapore 100% (6765/6765) +zh-tw Chinese (traditional) 100% (13063/13063) +zu Zulu 100% (52/52) + +---------------------------------------------------------- + + IV. About The WenQuanYi Project + +The Wen Quan Yi Project[1] was founded by Qianqian Fang[5] in +Oct. 2004. The goal of this project is to create a highly efficient +collaborative environment for open-source type-face development. +The initial focus of the project is to create high quality bitmap +character glyphs and outline fonts for all 70,000+ CJK characters +currently encoded by the Unicode Consortium. + +The Wen Quan Yi Project uses Wiki[1] as the primary +development tool for glyph creation, documentation +and coordinations. The Wen Quan Yi wiki also supports +glyph CVS and nightly build. + +The embodiment of the project consists of a +"Steering Committee" by the core members, a "Team B" +for bitmap Chinese font development and a "Team V" +for outline font development. Need to mention, a large +number of anonymous contributors also participate in our +development through our Wiki website and their +contributions are non-negligible. + + + +[1] The WenQuanYi Project Homepage + http://wqy.sourceforge.net/ (Chinese version) + http://wqy.sourceforge.net/en/ (English version) + http://sourceforge.net/projects/wqy/ (Sourceforge project) + http://wenq.org/ (Development site) + http://wenq.org/forum/ (User forum) + http://wenq.org/gallery/ (Screenshot gallery) + +[2] Firefly bitmap font + http://www.study-area.org/apt/firefly-font/ + +[3] Chinese National Standard GB19966-2005 (mandatory) + http://www.standardcn.com/standard_plan/list_standard_content.asp? + stand_id=GB@19966-2005 + +[4] The Unicode Consortium + http://www.unicode.org/ + +[5] Qianqian Fang homepage + http://nmr.mgh.harvard.edu/~fangq/ + +---------------------------------------------------------- + +** GPL v2 license with font embedding exception: + +http://www.gnu.org/licenses/old-licenses/gpl-2.0-faq.html#FontException + +As a special exception, if you create a document which uses this +font, and embed this font or unaltered portions of this font into +the document, this font does not by itself cause the resulting +document to be covered by the GNU General Public License. This +exception does not however invalidate any other reasons why the +document might be covered by the GNU General Public License. If you +modify this font, you may extend this exception to your version of +the font, but you are not obligated to do so. If you do not wish to +do so, delete this exception statement from your version. + +========================================================== diff --git a/game/fonts/wqy-zenhei/wqy-zenhei.ttc b/game/fonts/wqy-zenhei/wqy-zenhei.ttc new file mode 100644 index 00000000..4a32e87f Binary files /dev/null and b/game/fonts/wqy-zenhei/wqy-zenhei.ttc differ diff --git a/src/base/TextGL.pas b/src/base/TextGL.pas index 7fe98d29..0f4159d6 100644 --- a/src/base/TextGL.pas +++ b/src/base/TextGL.pas @@ -47,9 +47,16 @@ type PGLFont = ^TGLFont; TGLFont = record Font: TScalableFont; + Outlined: boolean; X, Y, Z: real; end; +const + ftNormal = 0; + ftBold = 1; + ftOutline1 = 2; + ftOutline2 = 3; + var Fonts: array of TGLFont; ActFont: integer; @@ -76,50 +83,93 @@ uses UMain, UPathUtils; -function FindFontFile(FontIni: TCustomIniFile; Font: string): IPath; -var - Filename: IPath; +{** + * Returns either Filename if it is absolute or a path relative to FontPath. + *} +function FindFontFile(const Filename: string): IPath; begin - Filename := Path(FontIni.ReadString(Font, 'File', '')); Result := FontPath.Append(Filename); // if path does not exist, try as an absolute path if (not Result.IsFile) then - Result := Filename; + Result := Path(Filename); +end; + +procedure AddFontFallbacks(FontIni: TMemIniFile; Font: TFont); +var + FallbackFont: IPath; + IdentName: string; + I: Integer; +begin + // evaluate the ini-file's 'Fallbacks' section + for I := 1 to 10 do + begin + IdentName := 'File' + IntToStr(I); + FallbackFont := FindFontFile(FontIni.ReadString('Fallbacks', IdentName, '')); + if (FallbackFont.Equals(PATH_NONE)) then + Continue; + try + Font.AddFallback(FallbackFont); + except + on E: EFontError do + Log.LogError('Setting font fallback ''' + FallbackFont.ToNative() + ''' failed: ' + E.Message); + end; + end; end; +const + FONT_NAMES: array [0..3] of string = ( + 'Normal', 'Bold', 'Outline1', 'Outline2' + ); + procedure BuildFont; var + I: integer; FontIni: TMemIniFile; FontFile: IPath; + Outline: single; + Embolden: single; + OutlineFont: TFTScalableOutlineFont; begin ActFont := 0; - SetLength(Fonts, 4); + SetLength(Fonts, Length(FONT_NAMES)); FontIni := TMemIniFile.Create(FontPath.Append('fonts.ini').ToNative); try - - // Normal - FontFile := FindFontFile(FontIni, 'Normal'); - Fonts[0].Font := TFTScalableFont.Create(FontFile, 64); - //Fonts[0].Font.GlyphSpacing := 1.4; - //Fonts[0].Font.Aspect := 1.2; - - // Bold - FontFile := FindFontFile(FontIni, 'Bold'); - Fonts[1].Font := TFTScalableFont.Create(FontFile, 64); - - // Outline1 - FontFile := FindFontFile(FontIni, 'Outline1'); - Fonts[2].Font := TFTScalableOutlineFont.Create(FontFile, 64, 0.06); - //TFTScalableOutlineFont(Fonts[2].Font).SetOutlineColor(0.3, 0.3, 0.3); - - // Outline2 - FontFile := FindFontFile(FontIni, 'Outline2'); - Fonts[3].Font := TFTScalableOutlineFont.Create(FontFile, 64, 0.08); - + for I := 0 to High(FONT_NAMES) do + begin + FontFile := FindFontFile(FontIni.ReadString('Font_'+FONT_NAMES[I], 'File', '')); + + // create either outlined or normal font + Outline := FontIni.ReadFloat(FONT_NAMES[I], 'Outline', 0.0); + if (Outline > 0.0) then + begin + // outlined font + OutlineFont := TFTScalableOutlineFont.Create(FontFile, 64, Outline); + OutlineFont.SetOutlineColor( + FontIni.ReadFloat(FONT_NAMES[I], 'OutlineColorR', 0.0), + FontIni.ReadFloat(FONT_NAMES[I], 'OutlineColorG', 0.0), + FontIni.ReadFloat(FONT_NAMES[I], 'OutlineColorB', 0.0), + FontIni.ReadFloat(FONT_NAMES[I], 'OutlineColorA', -1.0) + ); + Fonts[I].Font := OutlineFont; + Fonts[I].Outlined := true; + end + else + begin + // normal font + Embolden := FontIni.ReadFloat(FONT_NAMES[I], 'Embolden', 0.0); + Fonts[I].Font := TFTScalableFont.Create(FontFile, 64, Embolden); + Fonts[I].Outlined := false; + end; + + Fonts[I].Font.GlyphSpacing := FontIni.ReadFloat(FONT_NAMES[I], 'GlyphSpacing', 0.0); + Fonts[I].Font.Stretch := FontIni.ReadFloat(FONT_NAMES[I], 'Stretch', 1.0); + + AddFontFallbacks(FontIni, Fonts[I].Font); + end; except - on E: Exception do + on E: EFontError do Log.LogCritical(E.Message, 'BuildFont'); end; diff --git a/src/base/UFont.pas b/src/base/UFont.pas index 03918e3b..72b1d8d8 100644 --- a/src/base/UFont.pas +++ b/src/base/UFont.pas @@ -88,6 +88,8 @@ type Width, Height: integer; end; + EFontError = class(Exception); + {** * Abstract base class representing a glyph. *} @@ -119,6 +121,7 @@ type procedure ResetIntern(); protected + fFilename: IPath; fStyle: TFontStyle; fUseKerning: boolean; fLineSpacing: single; // must be inited by subclass @@ -184,7 +187,7 @@ type property ReflectionPass: boolean read fReflectionPass write SetReflectionPass; public - constructor Create(); + constructor Create(const Filename: IPath); destructor Destroy(); override; {** @@ -213,6 +216,12 @@ type {** UTF-8 version of @link(BBox) } function BBox(const Text: UTF8String; Advance: boolean = true): TBoundsDbl; overload; + {** + * Adds a new font that is used if the default font misses a glyph + * @raises EFontError if the fallback could not be initialized + *} + procedure AddFallback(const Filename: IPath); virtual; abstract; + {** Font height } property Height: single read GetHeight; {** Vertical distance from baseline to top of glyph } @@ -229,6 +238,8 @@ type property Style: TFontStyle read GetStyle write SetStyle; {** If set to true (default) kerning will be used if available } property UseKerning: boolean read GetUseKerning write SetUseKerning; + {** Filename } + property Filename: IPath read fFilename; end; const @@ -248,8 +259,8 @@ type procedure ResetIntern(); protected - fScale: single; //**< current height to base-font height ratio - fAspect: single; //**< width to height aspect + fScale: single; //**< current height to base-font height ratio + fStretch: single; //**< stretch factor for width (Width * fStretch) fBaseFont: TFont; //**< shortcut for fMipmapFonts[0] fUseMipmaps: boolean; //**< true if mipmap fonts are generated /// Mipmap fonts (size[level+1] = size[level]/2) @@ -286,8 +297,8 @@ type procedure SetHeight(Height: single); virtual; function GetHeight(): single; override; - procedure SetAspect(Aspect: single); virtual; - function GetAspect(): single; virtual; + procedure SetStretch(Stretch: single); virtual; + function GetStretch(): single; virtual; function GetAscender(): single; override; function GetDescender(): single; override; procedure SetLineSpacing(Spacing: single); override; @@ -322,8 +333,8 @@ type {** Font height } property Height: single read GetHeight write SetHeight; - {** Factor for font stretching (NewWidth = Width*Aspect), 1.0 by default } - property Aspect: single read GetAspect write SetAspect; + {** Factor for font stretching (NewWidth = Width*Stretch), 1.0 by default } + property Stretch: single read GetStretch write SetStretch; end; {** @@ -423,7 +434,7 @@ type function LoadGlyph(ch: UCS4Char): TGlyph; virtual; abstract; public - constructor Create(); + constructor Create(const Filename: IPath); destructor Destroy(); override; {** @@ -436,6 +447,28 @@ type TFTFont = class; + {** + * Freetype font face class. + *} + TFTFontFace = class + strict private + fFilename: IPath; //**< filename of the font-file + fFace: FT_Face; //**< Holds the height of the font + fFontUnitScale: TPositionDbl; //**< FT font-units to pixel ratio + + public + {** + * @raises EFontError if the glyph could not be initialized + *} + constructor Create(const Filename: IPath; Size: integer); + + destructor Destroy(); override; + + property Filename: IPath read fFilename; + property Data: FT_Face read fFace; + property FontUnitScale: TPositionDbl read fFontUnitScale; + end; + {** * Freetype glyph. * Each glyph stores a texture with the glyph's image. @@ -443,6 +476,7 @@ type TFTGlyph = class(TGlyph) private fCharCode: UCS4Char; //**< Char code + fFace: TFTFontFace; //**< Freetype face used for this glyph fCharIndex: FT_UInt; //**< Freetype specific char-index (<> char-code) fDisplayList: GLuint; //**< Display-list ID fTexture: GLuint; //**< Texture ID @@ -471,7 +505,7 @@ type * Creates an OpenGL texture (and display list) for the glyph. * The glyph's and bitmap's metrics are set correspondingly. * @param LoadFlags flags passed to FT_Load_Glyph() - * @raises Exception if the glyph could not be initialized + * @raises EFontError if the glyph could not be initialized *} procedure CreateTexture(LoadFlags: FT_Int32); @@ -495,9 +529,13 @@ type {** Freetype specific char-index (<> char-code) } property CharIndex: FT_UInt read fCharIndex; + + {** Freetype face used for this glyph } + property Face: TFTFontFace read fFace; end; TFontPart = ( fpNone, fpInner, fpOutline ); + TFTFontFaceArray = array of TFTFontFace; {** * Freetype font class. @@ -506,15 +544,14 @@ type private procedure ResetIntern(); - protected - fFilename: IPath; //**< filename of the font-file + strict protected + fFace: TFTFontFace; //**< Default font face fSize: integer; //**< Font base size (in pixels) fOutset: single; //**< size of outset extrusion (in pixels) - fFace: FT_Face; //**< Holds the height of the font fLoadFlags: FT_Int32; //**< FT glpyh load-flags - fFontUnitScale: TPositionDbl; //**< FT font-units to pixel ratio fUseDisplayLists: boolean; //**< true: use display-lists, false: direct drawing fPart: TFontPart; //**< indicates the part of an outline font + fFallbackFaces: TFTFontFaceArray; //**< available fallback faces, ordered by priority {** @seealso TCachedFont.LoadGlyph } function LoadGlyph(ch: UCS4Char): TGlyph; override; @@ -528,15 +565,13 @@ type function GetUnderlinePosition(): single; override; function GetUnderlineThickness(): single; override; - property Face: FT_Face read fFace; - public {** * Creates a font of size Size (in pixels) from the file Filename. * If Outset (in pixels) is set to a value > 0 the glyphs will be extruded * at their borders. Use it for e.g. a bold effect. * @param LoadFlags flags passed to FT_Load_Glyph() - * @raises Exception if the font-file could not be loaded + * @raises EFontError if the font-file could not be loaded *} constructor Create(const Filename: IPath; Size: integer; Outset: single = 0.0; @@ -549,11 +584,19 @@ type {** @seealso TFont.Reset } procedure Reset(); override; - + + procedure AddFallback(const Filename: IPath); override; + {** Size of the base font } property Size: integer read fSize; {** Outset size } property Outset: single read fOutset; + {** The part (inner/outline/none) this font represents in a composite font } + property Part: TFontPart read fPart write fPart; + {** Freetype face of this font } + property DefaultFace: TFTFontFace read fFace; + {** Available freetype fallback faces, ordered by priority } + property FallbackFaces: TFTFontFaceArray read fFallbackFaces; end; TFTScalableFont = class(TScalableFont) @@ -567,11 +610,27 @@ type * OutsetAmount is the ratio of the glyph extrusion. * The extrusion in pixels is Size*OutsetAmount * (0.0 -> no extrusion, 0.1 -> 10%). + * + * The memory size (in bytes) consumed by a scalable font + * - with UseMipmaps=false: + * mem = size^2 * #cached_glyphs + * - with UseMipmaps=true (all mipmap levels): + * mem = size^2 * #cached_glyphs * Sum[i=1..cMaxMipmapLevel](1/i^2) + * - with UseMipmaps=true (5 <= cMaxMipmapLevel <= 10): + * mem ~= size^2 * #cached_glyphs * 1.5 + * + * Examples (for 128 cached glyphs): + * - Size: 64 pixels: 768 KB (mipmapped) or 512 KB (non-mipmapped). + * - Size 128 pixels: 3 MB (mipmapped) or 2 MB (non-mipmapped) + * + * Note: once a glyph is cached there will *} constructor Create(const Filename: IPath; Size: integer; OutsetAmount: single = 0.0; UseMipmaps: boolean = true); + procedure AddFallback(const Filename: IPath); override; + {** @seealso TGlyphCache.FlushCache } procedure FlushCache(KeepBaseSet: boolean); @@ -586,7 +645,6 @@ type *} TFTOutlineFont = class(TFont) private - fFilename: IPath; fSize: integer; fOutset: single; fInnerFont, fOutlineFont: TFTFont; @@ -628,6 +686,8 @@ type {** @seealso TGlyphCache.FlushCache } procedure FlushCache(KeepBaseSet: boolean); + procedure AddFallback(const Filename: IPath); override; + {** @seealso TFont.Reset } procedure Reset(); override; @@ -657,6 +717,8 @@ type {** @seealso TGlyphCache.FlushCache } procedure FlushCache(KeepBaseSet: boolean); + procedure AddFallback(const Filename: IPath); override; + {** Outset size } property Outset: single read GetOutset; end; @@ -687,7 +749,7 @@ type {** * Load font widths from an info file. * @param InfoFile the name of the info (.dat) file - * @raises Exception if the file is corrupted + * @raises EFontError if the file is corrupted *} procedure LoadFontInfo(const InfoFile: IPath); @@ -721,6 +783,8 @@ type {** @seealso TFont.Reset } procedure Reset(); override; + + procedure AddFallback(const Filename: IPath); override; end; {$ENDIF BITMAP_FONT} @@ -730,7 +794,7 @@ type {** * Returns a pointer to the freetype library singleton. * If non exists, freetype will be initialized. - * @raises Exception if initialization failed + * @raises EFontError if initialization failed *} class function GetLibrary(): FT_Library; class procedure FreeLibrary(); @@ -783,9 +847,10 @@ end; * TFont *} -constructor TFont.Create(); +constructor TFont.Create(const Filename: IPath); begin - inherited; + inherited Create(); + fFilename := Filename; ResetIntern(); end; @@ -1040,7 +1105,7 @@ constructor TScalableFont.Create(Font: TFont; UseMipmaps: boolean); var MipmapLevel: integer; begin - inherited Create(); + inherited Create(Font.Filename); fBaseFont := Font; fMipmapFonts[0] := Font; @@ -1072,7 +1137,7 @@ end; procedure TScalableFont.ResetIntern(); begin fScale := 1.0; - fAspect := 1.0; + fStretch := 1.0; end; procedure TScalableFont.Reset(); @@ -1088,7 +1153,7 @@ end; {** * Returns the mipmap level to use with regard to the current projection - * and modelview matrix, font scale and aspect. + * and modelview matrix, font scale and stretch. * * Note: * - for Freetype fonts, hinting and grid-fitting must be disabled, otherwise @@ -1250,7 +1315,7 @@ begin glPushMatrix(); // set scale and stretching - glScalef(fScale * fAspect, fScale, 0); + glScalef(fScale * fStretch, fScale, 0); // print text if (fUseMipmaps) then @@ -1269,8 +1334,8 @@ end; function TScalableFont.BBox(const Text: TUCS4StringArray; Advance: boolean): TBoundsDbl; begin Result := fBaseFont.BBox(Text, Advance); - Result.Left := Result.Left * fScale * fAspect; - Result.Right := Result.Right * fScale * fAspect; + Result.Left := Result.Left * fScale * fStretch; + Result.Right := Result.Right * fScale * fStretch; Result.Top := Result.Top * fScale; Result.Bottom := Result.Bottom * fScale; end; @@ -1285,14 +1350,14 @@ begin Result := fBaseFont.GetHeight() * fScale; end; -procedure TScalableFont.SetAspect(Aspect: single); +procedure TScalableFont.SetStretch(Stretch: single); begin - fAspect := Aspect; + fStretch := Stretch; end; -function TScalableFont.GetAspect(): single; +function TScalableFont.GetStretch(): single; begin - Result := fAspect; + Result := fStretch; end; function TScalableFont.GetAscender(): single; @@ -1385,9 +1450,9 @@ end; * TCachedFont *} -constructor TCachedFont.Create(); +constructor TCachedFont.Create(const Filename: IPath); begin - inherited; + inherited Create(Filename); fCache := TGlyphCache.Create(); end; @@ -1413,41 +1478,60 @@ begin fCache.FlushCache(KeepBaseSet); end; - {* - * TFTFont + * TFTFontFace *} -constructor TFTFont.Create( - const Filename: IPath; - Size: integer; Outset: single; - LoadFlags: FT_Int32); -var - ch: UCS4Char; +constructor TFTFontFace.Create(const Filename: IPath; Size: integer); begin inherited Create(); fFilename := Filename; - fSize := Size; - fOutset := Outset; - fLoadFlags := LoadFlags; - fUseDisplayLists := true; - fPart := fpNone; // load font information if (FT_New_Face(TFreeType.GetLibrary(), PChar(Filename.ToNative), 0, fFace) <> 0) then - raise Exception.Create('FT_New_Face: Could not load font ''' + Filename.ToNative + ''''); + raise EFontError.Create('FT_New_Face: Could not load font ''' + Filename.ToNative + ''''); // support scalable fonts only if (not FT_IS_SCALABLE(fFace)) then - raise Exception.Create('Font is not scalable'); + raise EFontError.Create('Font is not scalable'); if (FT_Set_Pixel_Sizes(fFace, 0, Size) <> 0) then - raise Exception.Create('FT_Set_Pixel_Sizes failes'); + raise EFontError.Create('FT_Set_Pixel_Sizes failes'); // get scale factor for font-unit to pixel-size transformation fFontUnitScale.X := fFace.size.metrics.x_ppem / fFace.units_per_EM; fFontUnitScale.Y := fFace.size.metrics.y_ppem / fFace.units_per_EM; +end; + +destructor TFTFontFace.Destroy(); +begin + // free face data + FT_Done_Face(fFace); + inherited; +end; + + +{* + * TFTFont + *} + +constructor TFTFont.Create( + const Filename: IPath; + Size: integer; Outset: single; + LoadFlags: FT_Int32); +var + ch: UCS4Char; +begin + inherited Create(Filename); + + fSize := Size; + fOutset := Outset; + fLoadFlags := LoadFlags; + fUseDisplayLists := true; + fPart := fpNone; + + fFace := TFTFontFace.Create(Filename, Size); ResetIntern(); @@ -1457,17 +1541,22 @@ begin end; destructor TFTFont.Destroy(); +var + I: integer; begin - // free face - FT_Done_Face(fFace); + // free faces + fFace.Free; + for I := 0 to High(fFallbackFaces) do + fFallbackFaces[I].Free; + inherited; end; procedure TFTFont.ResetIntern(); begin // Note: outset and non outset fonts use same spacing - fLineSpacing := fFace.height * fFontUnitScale.Y; - fReflectionSpacing := -2*fFace.descender * fFontUnitScale.Y; + fLineSpacing := fFace.Data.height * fFace.FontUnitScale.Y; + fReflectionSpacing := -2*fFace.Data.descender * fFace.FontUnitScale.Y; end; procedure TFTFont.Reset(); @@ -1476,6 +1565,15 @@ begin ResetIntern(); end; +procedure TFTFont.AddFallback(const Filename: IPath); +var + FontFace: TFTFontFace; +begin + FontFace := TFTFontFace.Create(Filename, Size); + SetLength(fFallbackFaces, Length(fFallbackFaces) + 1); + fFallbackFaces[High(fFallbackFaces)] := FontFace; +end; + function TFTFont.LoadGlyph(ch: UCS4Char): TGlyph; begin Result := TFTGlyph.Create(Self, ch, Outset, fLoadFlags); @@ -1520,11 +1618,11 @@ begin if (Glyph <> nil) then begin // get kerning - if (fUseKerning and FT_HAS_KERNING(fFace) and (PrevGlyph <> nil)) then + if (fUseKerning and FT_HAS_KERNING(fFace.Data) and (PrevGlyph <> nil)) then begin - FT_Get_Kerning(fFace, PrevGlyph.CharIndex, Glyph.CharIndex, + FT_Get_Kerning(fFace.Data, PrevGlyph.CharIndex, Glyph.CharIndex, FT_KERNING_UNSCALED, KernDelta); - LineBounds.Right := LineBounds.Right + KernDelta.x * fFontUnitScale.X; + LineBounds.Right := LineBounds.Right + KernDelta.x * fFace.FontUnitScale.X; end; // update left bound (must be done before right bound is updated) @@ -1608,11 +1706,11 @@ begin if (Assigned(Glyph)) then begin // get kerning - if (fUseKerning and FT_HAS_KERNING(fFace) and (PrevGlyph <> nil)) then + if (fUseKerning and FT_HAS_KERNING(fFace.Data) and (PrevGlyph <> nil)) then begin - FT_Get_Kerning(fFace, PrevGlyph.CharIndex, Glyph.CharIndex, + FT_Get_Kerning(fFace.Data, PrevGlyph.CharIndex, Glyph.CharIndex, FT_KERNING_UNSCALED, KernDelta); - glTranslatef(KernDelta.x * fFontUnitScale.X, 0, 0); + glTranslatef(KernDelta.x * fFace.FontUnitScale.X, 0, 0); end; if (ReflectionPass) then @@ -1634,23 +1732,23 @@ end; function TFTFont.GetAscender(): single; begin - Result := fFace.ascender * fFontUnitScale.Y + Outset*2; + Result := fFace.Data.ascender * fFace.FontUnitScale.Y + Outset*2; end; function TFTFont.GetDescender(): single; begin // Note: outset is not part of the descender as the baseline is lifted - Result := fFace.descender * fFontUnitScale.Y; + Result := fFace.Data.descender * fFace.FontUnitScale.Y; end; function TFTFont.GetUnderlinePosition(): single; begin - Result := fFace.underline_position * fFontUnitScale.Y - Outset; + Result := fFace.Data.underline_position * fFace.FontUnitScale.Y - Outset; end; function TFTFont.GetUnderlineThickness(): single; begin - Result := fFace.underline_thickness * fFontUnitScale.Y + Outset*2; + Result := fFace.Data.underline_thickness * fFace.FontUnitScale.Y + Outset*2; end; @@ -1689,8 +1787,8 @@ begin // do not create mipmap fonts < 8 pixels if (ScaledSize < 8) then Exit; - Result := TFTFont.Create(BaseFont.fFilename, - ScaledSize, BaseFont.fOutset * Scale, + Result := TFTFont.Create(BaseFont.Filename, + ScaledSize, BaseFont.Outset * Scale, FT_LOAD_DEFAULT or FT_LOAD_NO_HINTING); end; @@ -1699,6 +1797,15 @@ begin Result := TFTFont(fBaseFont).Outset * fScale; end; +procedure TFTScalableFont.AddFallback(const Filename: IPath); +var + Level: integer; +begin + for Level := 0 to High(fMipmapFonts) do + if (fMipmapFonts[Level] <> nil) then + TFTFont(fMipmapFonts[Level]).AddFallback(Filename); +end; + procedure TFTScalableFont.FlushCache(KeepBaseSet: boolean); var Level: integer; @@ -1718,16 +1825,15 @@ constructor TFTOutlineFont.Create( Size: integer; Outset: single; LoadFlags: FT_Int32); begin - inherited Create(); + inherited Create(Filename); - fFilename := Filename; fSize := Size; fOutset := Outset; fInnerFont := TFTFont.Create(Filename, Size, 0.0, LoadFlags); - fInnerFont.fPart := fpInner; + fInnerFont.Part := fpInner; fOutlineFont := TFTFont.Create(Filename, Size, Outset, LoadFlags); - fOutlineFont.fPart := fpOutline; + fOutlineFont.Part := fpOutline; ResetIntern(); end; @@ -1824,6 +1930,12 @@ begin fInnerFont.FlushCache(KeepBaseSet); end; +procedure TFTOutlineFont.AddFallback(const Filename: IPath); +begin + fOutlineFont.AddFallback(Filename); + fInnerFont.AddFallback(Filename); +end; + function TFTOutlineFont.BBox(const Text: TUCS4StringArray; Advance: boolean): TBoundsDbl; begin Result := fOutlineFont.BBox(Text, Advance); @@ -1960,6 +2072,15 @@ begin TFTOutlineFont(fMipmapFonts[Level]).FlushCache(KeepBaseSet); end; +procedure TFTScalableOutlineFont.AddFallback(const Filename: IPath); +var + Level: integer; +begin + for Level := 0 to High(fMipmapFonts) do + if (fMipmapFonts[Level] <> nil) then + TFTOutlineFont(fMipmapFonts[Level]).AddFallback(Filename); +end; + {* * TFTGlyph @@ -2019,10 +2140,16 @@ begin // The second one is used as a stencil for the first one, clearing the // interiour of the glyph. // The stencil is not needed to create bold fonts. - UseStencil := (fFont.fPart = fpInner); + UseStencil := (fFont.Part = fpInner); - Outline := @FT_OutlineGlyph(Glyph).outline; + // we cannot extrude bitmaps, only vector based glyphs. + // Check for FT_GLYPH_FORMAT_OUTLINE otherwise a cast to FT_OutlineGlyph is + // invalid and FT_Stroker_ParseOutline() will crash + if (Glyph.format <> FT_GLYPH_FORMAT_OUTLINE) then + Exit; + Outline := @FT_OutlineGlyph(Glyph).outline; + OuterBorder := FT_Outline_GetOutsideBorder(Outline); if (OuterBorder = FT_STROKER_BORDER_LEFT) then InnerBorder := FT_STROKER_BORDER_RIGHT @@ -2032,7 +2159,7 @@ begin { extrude outer border } if (FT_Stroker_New(Glyph.library_, OuterStroker) <> 0) then - raise Exception.Create('FT_Stroker_New failed!'); + raise EFontError.Create('FT_Stroker_New failed!'); FT_Stroker_Set( OuterStroker, Round(fOutset * 64), @@ -2043,7 +2170,7 @@ begin // similar to FT_Glyph_StrokeBorder(inner = FT_FALSE) but it is possible to // use FT_Stroker_ExportBorder() afterwards to combine inner and outer borders if (FT_Stroker_ParseOutline(OuterStroker, Outline, FT_FALSE) <> 0) then - raise Exception.Create('FT_Stroker_ParseOutline failed!'); + raise EFontError.Create('FT_Stroker_ParseOutline failed!'); FT_Stroker_GetBorderCounts(OuterStroker, OuterBorder, OuterNumPoints, OuterNumContours); @@ -2052,7 +2179,7 @@ begin if (UseStencil) then begin if (FT_Stroker_New(Glyph.library_, InnerStroker) <> 0) then - raise Exception.Create('FT_Stroker_New failed!'); + raise EFontError.Create('FT_Stroker_New failed!'); FT_Stroker_Set( InnerStroker, 63, // extrude at most one pixel to avoid a black border @@ -2061,7 +2188,7 @@ begin 0); if (FT_Stroker_ParseOutline(InnerStroker, Outline, FT_FALSE) <> 0) then - raise Exception.Create('FT_Stroker_ParseOutline failed!'); + raise EFontError.Create('FT_Stroker_ParseOutline failed!'); FT_Stroker_GetBorderCounts(InnerStroker, InnerBorder, InnerNumPoints, InnerNumContours); end else begin @@ -2080,7 +2207,7 @@ begin // resize glyph outline to hold inner and outer border FT_Outline_Done(Glyph.Library_, Outline); if (FT_Outline_New(Glyph.Library_, GlyphNumPoints, GlyphNumContours, Outline) <> 0) then - raise Exception.Create('FT_Outline_New failed!'); + raise EFontError.Create('FT_Outline_New failed!'); Outline.n_points := 0; Outline.n_contours := 0; @@ -2090,7 +2217,7 @@ begin if (UseStencil) then FT_Stroker_ExportBorder(InnerStroker, InnerBorder, Outline); if (FT_Outline_Check(outline) <> 0) then - raise Exception.Create('FT_Stroker_ExportBorder failed!'); + raise EFontError.Create('FT_Stroker_ExportBorder failed!'); if (InnerStroker <> nil) then FT_Stroker_Done(InnerStroker); @@ -2110,20 +2237,26 @@ var TexLine: PGLubyteArray; CBox: FT_BBox; begin + // we need vector data for outlined glyphs so do not load bitmaps. + // This is necessary for mixed fonts that contain bitmap versions of smaller + // glyphs, for example in CJK fonts. + if (fOutset > 0) then + LoadFlags := LoadFlags or FT_LOAD_NO_BITMAP; + // load the Glyph for our character - if (FT_Load_Glyph(fFont.Face, fCharIndex, LoadFlags) <> 0) then - raise Exception.Create('FT_Load_Glyph failed'); + if (FT_Load_Glyph(fFace.Data, fCharIndex, LoadFlags) <> 0) then + raise EFontError.Create('FT_Load_Glyph failed'); // move the face's glyph into a Glyph object - if (FT_Get_Glyph(fFont.Face^.glyph, Glyph) <> 0) then - raise Exception.Create('FT_Get_Glyph failed'); + if (FT_Get_Glyph(fFace.Data^.glyph, Glyph) <> 0) then + raise EFontError.Create('FT_Get_Glyph failed'); if (fOutset > 0) then StrokeBorder(Glyph); // store scaled advance width/height in glyph-object - fAdvance.X := fFont.Face^.glyph^.advance.x / 64 + fOutset*2; - fAdvance.Y := fFont.Face^.glyph^.advance.y / 64 + fOutset*2; + fAdvance.X := fFace.Data^.glyph^.advance.x / 64 + fOutset*2; + fAdvance.Y := fFace.Data^.glyph^.advance.y / 64 + fOutset*2; // get the contour's bounding box (in 1/64th pixels, not font-units) FT_Glyph_Get_CBox(Glyph, FT_GLYPH_BBOX_UNSCALED, CBox); @@ -2238,6 +2371,8 @@ end; constructor TFTGlyph.Create(Font: TFTFont; ch: UCS4Char; Outset: single; LoadFlags: FT_Int32); +var + I: integer; begin inherited Create(); @@ -2245,8 +2380,25 @@ begin fOutset := Outset; fCharCode := ch; - // get the Freetype char-index (use default UNICODE charmap) - fCharIndex := FT_Get_Char_Index(Font.fFace, FT_ULONG(ch)); + // Note: the default face is also used if no face (neither default nor fallback) + // contains a glyph for the given char. + fFace := Font.DefaultFace; + + // search the Freetype char-index (use default UNICODE charmap) in the default face + fCharIndex := FT_Get_Char_Index(fFace.Data, FT_ULONG(ch)); + if (fCharIndex = 0) then + begin + // glyph not in default font, search in fallback font faces + for I := 0 to High(Font.FallbackFaces) do + begin + fCharIndex := FT_Get_Char_Index(Font.FallbackFaces[I].Data, FT_ULONG(ch)); + if (fCharIndex <> 0) then + begin + fFace := Font.FallbackFaces[I]; + Break; + end; + end; + end; CreateTexture(LoadFlags); end; @@ -2550,7 +2702,7 @@ begin begin // initialize freetype if (FT_Init_FreeType(LibraryInst) <> 0) then - raise Exception.Create('FT_Init_FreeType failed'); + raise EFontError.Create('FT_Init_FreeType failed'); end; Result := LibraryInst; end; @@ -2571,7 +2723,7 @@ end; constructor TBitmapFont.Create(const Filename: IPath; Outline: integer; Baseline, Ascender, Descender: integer); begin - inherited Create(); + inherited Create(Filename); fTex := Texture.LoadTexture(true, Filename, TEXTURE_TYPE_TRANSPARENT, 0); fTexSize := 1024; @@ -2602,6 +2754,11 @@ begin ResetIntern(); end; +procedure TBitmapFont.AddFallback(const Filename: IPath); +begin + // no support for fallbacks +end; + procedure TBitmapFont.CorrectWidths(WidthMult: real; WidthAdd: integer); var Count: integer; @@ -2621,7 +2778,7 @@ begin Stream := TBinaryFileStream.Create(InfoFile, fmOpenRead); Stream.Read(fWidths, 256); except - raise Exception.Create('Could not read font info file ''' + InfoFile.ToNative + ''''); + raise EFontError.Create('Could not read font info file ''' + InfoFile.ToNative + ''''); end; Stream.Free; end; diff --git a/src/base/USingScores.pas b/src/base/USingScores.pas index 71389f32..26c5dfe8 100644 --- a/src/base/USingScores.pas +++ b/src/base/USingScores.pas @@ -383,7 +383,7 @@ var nPosition.PUW := nPosition.BGW; nPosition.PUH := nPosition.BGH; - nPosition.PUFont := 2; + nPosition.PUFont := ftOutline1; nPosition.PUFontSize := 18; nPosition.PUStartX := nPosition.BGX; diff --git a/src/base/UThemes.pas b/src/base/UThemes.pas index fa7a6029..b385406f 100644 --- a/src/base/UThemes.pas +++ b/src/base/UThemes.pas @@ -841,6 +841,7 @@ uses UIni, UPathUtils, UFileSystem, + TextGL, gl, glext, math, @@ -1667,7 +1668,7 @@ begin ThemeText.ColG := ThemeIni.ReadFloat(Name, 'ColG', 0); ThemeText.ColB := ThemeIni.ReadFloat(Name, 'ColB', 0); - ThemeText.Font := ThemeIni.ReadInteger(Name, 'Font', 0); + ThemeText.Font := ThemeIni.ReadInteger(Name, 'Font', ftNormal); ThemeText.Size := ThemeIni.ReadInteger(Name, 'Size', 0); ThemeText.Align := ThemeIni.ReadInteger(Name, 'Align', 0); diff --git a/src/lua/ULuaTextGL.pas b/src/lua/ULuaTextGL.pas index 1db41b21..2e70a2c1 100644 --- a/src/lua/ULuaTextGL.pas +++ b/src/lua/ULuaTextGL.pas @@ -35,6 +35,7 @@ interface uses TextGL, + SysUtils, ULua; { TextGl.Pos(X, Y: Float) : sets font position } @@ -99,10 +100,10 @@ function ULuaTextGL_Style(L: Plua_State): Integer; cdecl; begin Style := luaL_checkinteger(L, 1); - if (Style >= 0) and (Style <= 3) then + if (Style >= 0) and (Style < Length(Fonts)) then SetFontStyle(Style) else - luaL_ArgError(L, 1, PChar('number from 0 to 3 expected')); + luaL_ArgError(L, 1, PChar('number from 0 to ' + IntToStr(High(Fonts)) + ' expected')); Result := 0; end; diff --git a/src/menu/UDisplay.pas b/src/menu/UDisplay.pas index f813220e..02fda099 100644 --- a/src/menu/UDisplay.pas +++ b/src/menu/UDisplay.pas @@ -703,7 +703,7 @@ begin glDisable(GL_BLEND); // set font specs - SetFontStyle(0); + SetFontStyle(ftNormal); SetFontSize(21); SetFontItalic(false); glColor4f(0, 0, 0, 1); diff --git a/src/menu/UMenuSelectSlide.pas b/src/menu/UMenuSelectSlide.pas index 17c5a7a8..09ce3b9f 100644 --- a/src/menu/UMenuSelectSlide.pas +++ b/src/menu/UMenuSelectSlide.pas @@ -372,7 +372,7 @@ begin begin MaxLen := TextureSBG.W - MinSideSpacing * 2; - SetFontStyle(0); + SetFontStyle(ftNormal); SetFontSize(Text.Size); // we will remove min. 2 letters by default and replace them w/ points @@ -444,7 +444,7 @@ var maxlength: real; I: integer; begin - SetFontStyle(0{Text.Style}); + SetFontStyle(ftNormal{Text.Style}); SetFontSize(Text.Size); maxlength := 0; diff --git a/src/menu/UMenuText.pas b/src/menu/UMenuText.pas index 276f961b..ab180b77 100644 --- a/src/menu/UMenuText.pas +++ b/src/menu/UMenuText.pas @@ -297,7 +297,7 @@ begin SetFontPos(X2, Y); glPrint(Text2); - SetFontStyle(0); // reset to default + SetFontStyle(ftNormal); // reset to default end else begin} @@ -326,12 +326,12 @@ begin {if Size >= 10 then Y2 := Y2 + Size * 0.93 else} - if (Style = 1) then + if (Style = ftBold) then Y2 := Y2 + Size * 0.93 else Y2 := Y2 + Size * 0.72; end; - SetFontStyle(0); // reset to default + SetFontStyle(ftNormal); // reset to default //end; end; @@ -344,7 +344,7 @@ end; constructor TText.Create(X, Y: real; const Text: UTF8String); begin - Create(X, Y, 0, 0, 30, 0, 0, 0, 0, Text, false, 0, 0); + Create(X, Y, 0, ftNormal, 30, 0, 0, 0, 0, Text, false, 0, 0); end; constructor TText.Create(ParX, ParY, ParW: real; diff --git a/src/screens/UScreenSing.pas b/src/screens/UScreenSing.pas index e4764760..233f1e38 100644 --- a/src/screens/UScreenSing.pas +++ b/src/screens/UScreenSing.pas @@ -591,7 +591,7 @@ begin case Ini.LyricsFont of 0: // normal fonts begin - Lyrics.FontStyle := 0; + Lyrics.FontStyle := ftNormal; Lyrics.LineColor_en.R := Skin_FontR; Lyrics.LineColor_en.G := Skin_FontG; @@ -608,9 +608,12 @@ begin Lyrics.LineColor_act.B := 0.8; Lyrics.LineColor_act.A := 1; end; - 1, 2: // outline fonts (is TScalableOutlineFont) + 1, 2: // outline fonts begin - Lyrics.FontStyle := Ini.LyricsFont + 1; + if (Ini.LyricsFont = 1) then + Lyrics.FontStyle := ftOutline1 + else + Lyrics.FontStyle := ftOutline2; Lyrics.LineColor_en.R := 0.75; Lyrics.LineColor_en.G := 0.75; -- cgit v1.2.3