diff options
author | Pablo Saratxaga <pablo@mandriva.com> | 2003-08-16 21:58:02 +0000 |
---|---|---|
committer | Pablo Saratxaga <pablo@mandriva.com> | 2003-08-16 21:58:02 +0000 |
commit | 3a9fcbedda7e7b10d6f5b0a2fd9ed873b2a70cdb (patch) | |
tree | a54d8fb9241c5bbecd5f5811b6d58b782e8d1254 | |
parent | a36e42522db0327580ae246a65dc1ddc61b600ca (diff) | |
download | bootsplash-3a9fcbedda7e7b10d6f5b0a2fd9ed873b2a70cdb.tar bootsplash-3a9fcbedda7e7b10d6f5b0a2fd9ed873b2a70cdb.tar.gz bootsplash-3a9fcbedda7e7b10d6f5b0a2fd9ed873b2a70cdb.tar.bz2 bootsplash-3a9fcbedda7e7b10d6f5b0a2fd9ed873b2a70cdb.tar.xz bootsplash-3a9fcbedda7e7b10d6f5b0a2fd9ed873b2a70cdb.zip |
Added real i18n support (different fonts possible, depending on language)
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | bootsplash.spec | 10 | ||||
-rw-r--r-- | fbtruetype/ttf.c | 12 | ||||
-rw-r--r-- | scripts/splash.sh | 70 |
4 files changed, 86 insertions, 13 deletions
@@ -1,3 +1,10 @@ +2003-08-16 20:00 Pablo Saratxaga <pablo@mandrakesoft.com> + + * scripts/splash.sh: make the script use a different font + for languages neededing it; and use utf-8 internally + * fbtruetype/ttf.c: make it use utf-8 as the format for text + to display + 2002-08-08 22:55 Warly <warly@mandrakesoft.com> * bootsplash.spec, scripts/make-boot-splash: add 640x480 resolution diff --git a/bootsplash.spec b/bootsplash.spec index 78e93d2..fbdb455 100644 --- a/bootsplash.spec +++ b/bootsplash.spec @@ -1,6 +1,6 @@ %define name bootsplash -%define version 2.0.1 -%define release 2mdk +%define version 2.0.2 +%define release 1mdk %define _bootdir /boot Summary: The Boot Splash Images and scripts @@ -19,8 +19,7 @@ Requires: mkinitrd > 3.1.6-25mdk #there is no way to say a special kernel requires. Requires: kernel initscripts > 7.04-15mdk Obsoletes: Aurora Aurora-Monitor-NewStyle-Categorizing-WsLib Aurora-Monitor-NewStyle-WsLib Aurora-Monitor-Traditional-Gtk+ Aurora-Monitor-Traditional-WsLib-8.2 -BuildRequires: freetype2-static-devel libmng-static-devel - +BuildRequires: freetype2-static-devel libmng-static-devel libjpeg62-static-devel glibc-static-devel # nomore noarch with the fbrelolution and progress binaries #BuildArchitectures: noarch @@ -106,6 +105,9 @@ rm -rf $RPM_BUILD_ROOT %{_bindir}/* %changelog +* Sat Aug 16 2003 Pablo Saratxaga <pablo@mandrakesoft.com> 2.0.2-1mdk +- added support for other fonts, depending on the language + * Fri Aug 01 2003 Warly <warly@mandrakesoft.com> 2.0.1-2mdk - require to initscripts was not correct diff --git a/fbtruetype/ttf.c b/fbtruetype/ttf.c index 61ee3b0..2c64121 100644 --- a/fbtruetype/ttf.c +++ b/fbtruetype/ttf.c @@ -114,7 +114,6 @@ static unsigned short *ASCII_to_UNICODE(unsigned short *unicode, const char *tex return unicode; } -#if 0 static unsigned short *UTF8_to_UNICODE(unsigned short *unicode, const char *utf8, int len) { int i, j; @@ -143,7 +142,6 @@ static unsigned short *UTF8_to_UNICODE(unsigned short *unicode, const char *utf8 return unicode; } -#endif /* TTF stuff */ @@ -182,14 +180,14 @@ SDL_Surface *TTF_RenderText_Solid(TTF_Font *font, Uint16 *unicode_text; int unicode_len; - /* Copy the Latin-1 text to a UNICODE text buffer */ + /* Copy the UTF-8 text to a UNICODE text buffer */ unicode_len = strlen(text); unicode_text = (Uint16 *)malloc((unicode_len+1)*(sizeof *unicode_text)); if ( unicode_text == NULL ) { TTF_SetError("Out of memory"); return(NULL); } - ASCII_to_UNICODE(unicode_text, text, unicode_len); + UTF8_to_UNICODE(unicode_text, text, unicode_len); RenderUnicode(font, unicode_text, fg); @@ -208,7 +206,7 @@ unsigned char*TTF_RenderText_Shaded(TTF_Font *font, const char *text, unsigned i unsigned short *unicode_text; int unicode_len; - /* Copy the Latin-1 text to a UNICODE text buffer */ + /* Copy the UTF-8 text to a UNICODE text buffer */ unicode_len = strlen(text); unicode_text = (unsigned short *)malloc((unicode_len+1)*(sizeof *unicode_text)); @@ -216,7 +214,7 @@ unsigned char*TTF_RenderText_Shaded(TTF_Font *font, const char *text, unsigned i printf("Out of memory\n"); return(NULL); } - ASCII_to_UNICODE(unicode_text, text, unicode_len); + UTF8_to_UNICODE(unicode_text, text, unicode_len); /* Render the new text */ textbuf = TTF_RenderUNICODE_Shaded(font, unicode_text, fg, bg); @@ -762,7 +760,7 @@ int rendertext(char *text, char *fontname, unsigned int ptsize, unsigned int for } renderstyle = TTF_STYLE_NORMAL; - rendertype = RENDER_LATIN1; + rendertype = RENDER_UTF8; TTF_SetFontStyle(font, renderstyle); text = TTF_RenderText_Shaded(font, text, forecol, 0); diff --git a/scripts/splash.sh b/scripts/splash.sh index a8a6f0f..b9f0dd2 100644 --- a/scripts/splash.sh +++ b/scripts/splash.sh @@ -26,9 +26,11 @@ else fi gprintf() { + # request translations to be always in UTF-8 + OUTPUT_CHARSET=UTF-8 if [ -x /bin/gettext -a -n "$1" ]; then if [ -n "$GP_LANG" ]; then - TEXT=`LC_MESSAGES=$GP_LANG gettext -e --domain=$TEXTDOMAIN "$1"` + TEXT=`LANGUAGE=$GP_LANG gettext -e --domain=$TEXTDOMAIN "$1"` else TEXT=`gettext -e --domain=$TEXTDOMAIN "$1"` fi @@ -92,6 +94,70 @@ num=$(( $nbservices + 2 )) # Initialize and print text string.. if [ "$progress" == 1 -o "$1" == "start" ]; then + # depending on the languages, we need to use a font different of + # the default one; in such case the font must be accessible, or + # the translation is disabled. + # bugs: + # - RTL languages need a fake *.po file, where bidi reordering and + # shaping is already done. + # - indic languages have not shaping + case "${GP_LANG}${LANGUAGE}" in + # languages written in latin that use letters not included in luxi + az*|cy*|gn*|vi*) + font=/usr/share/fonts/otf/mdk/mdk_teams.otf ;; + # basic cyrillic, covered by cp1251 + be*|bg*|mk*|ru*|sr*|uk*) + font=/usr/share/fonts/default/Type1/a010015l.pfb ;; + # extended cyrillic, not covered by cp1251 + mn*|tg*|uz*) + font=/usr/share/fonts/otf/mdk/mdk_teams.otf ;; + # other scripts + am*) font=/usr/share/fonts/ttf/ethiopic/gfzemenu.ttf ;; + ar*|fa*|ur*) font=/usr/share/fonts/ttf/arabic/Kacst-Qr.ttf ;; + as*|bn*) font=/usr/share/fonts/ttf/bengali/MuktiBold.ttf ;; + el*) font=/usr/share/fonts/type1/greek/kb.pfb ;; + he*|yi*) font=/usr/share/fonts/type1/hebrew/Nachlieli-Bold.pfa ;; + hi*|mr*) font=/usr/share/fonts/otf/mdk/raghu.ttf ;; + hy*) font=/usr/share/fonts/ttf/armenian/artsnk_b.ttf ;; + ja*) font=/usr/share/fonts/ttf/japanese/kochi-gothic.ttf ;; + kn*) font=/usr/share/fonts/ttf/kannada/Sampige.ttf ;; + ko*) font=/usr/share/fonts/ttf/korean/gulim.ttf ;; + ml*) font=/usr/share/fonts/otf/mdk/malayalam.ttf ;; + ta*) font=/usr/share/fonts/ttf/tamil/TSCu_Paranar.ttf ;; + th*) font=/usr/share/fonts/ttf/thai/norasi_b.ttf ;; + zh_CN*) font=/usr/share/fonts/ttf/gb2312/gkai00mp.ttf ;; + zh_TW*) font=/usr/share/fonts/ttf/big5/bkai00mp.ttf ;; + # languages supported by the default font; latin1 + af*|br*|ca*|da*|de*|es*|et*|eu*|fi*|fr*|ga*|gl*|id*|is*|it*|ms*|nb*) + font=default ;; + # languages supported by the default font; latin1, more + nb*|nl*|nn*|no*|pt*|sv*|wa*) + font=default ;; + # languages supported by the default font; latin2 + bs*|cs*|hr*|hu*|pl*|ro*|sk*|sl*|sq*) + font=default ;; + # languages supported by the default font; other latin coverages + eo*|lt*|lv*|mt*|tr*) + font=default ;; + # for others, we do a last chance possibility with + # arial unicode, if the user installed it... + *) font=/usr/X11R6/lib/X11/fonts/drakfont/ttf/arialuni.ttf ;; + esac + + if [ "$font" != "default" ]; then + if [ -r "$font" ] + custom_font="-f $font" + elif [ -r "/etc/locale/`basename $font`" ]; then + custom_font="/etc/locale/`basename $font`" + elif [ -r "/etc/locale/default.ttf" ]; then + custom_font="/etc/locale/default.ttf" + else + # no font available, translations are not done + GP_LANG=C ; + LANGUAGE=C ; + fi + fi + if test "$_shutdown" == "yes"; then gprintf "Shutting down the system..." [[ -f /etc/bootsplash/themes/$theme/config/bootsplash-$res.cfg ]] && /sbin/splash -s -u 0 /etc/bootsplash/themes/$theme/config/bootsplash-$res.cfg @@ -105,7 +171,7 @@ if [ "$progress" == 1 -o "$1" == "start" ]; then -a "$text_color" != "" -a "$text_size" != "" -a "$_silent" == "yes" ]; then gprintf "Press F2 for verbose mode." fbtruetype.static -x $text_x -y $text_y -t $text_color -s $text_size \ - "$_boot $TEXT" + $custom_font "$_boot $TEXT" fi fi |