[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

d-i font switch support [Was: Debian Wheezy software speech installer missing the hungarian language]



Hello,

Samuel Thibault, le Fri 10 Aug 2012 12:21:17 +0200, a écrit :
> Cyril Brulebois, le Fri 10 Aug 2012 12:09:51 +0200, a écrit :
> > Samuel Thibault <sthibault@debian.org> (10/08/2012):
> > > That being said, it would be possible to have 8859-1 and 8859-2 fonts on
> > > the CDs, to be loaded when a language is selected (as well as -3, -4,
> > > etc.). It would permit to enable quite a few more spoken language (about
> > > 20).
> > > 
> > > That however requires some work, room on the images, and discussion,
> > > I don't know if we'll have time for that before the release which is
> > > already very close.
> > 
> > Any estimation on the amount of needed extra space we're talking about?
> 
> setfont is 40K, something like a dozen fonts would be needed, each of
> them around 2K (compressed), so that would be something of 60K, not that
> much indeed.

I've given a try, it does work (try
http://dept-info.labri.fr/~thibault/tmp/mini.iso ) with the attached
patches:

- setfont is actually already in kbd-udeb
- I have cleaned the console-setup font list a bit, to only include what
  d-i can support, and added a switch script, to be called by ...
- localechooser, which now accepts level 2 on bare linux console,
  provided that the font switch script is there.
- it's then a matter of including the console-setup-linux-fonts-udeb
  package on speakup images. The additional size is simply the fonts and
  the script, about 7*2.5KiB, thus roughly 17.5KiB.

The good thing is that the patch doesn't change the behavior for level1
languages, i.e. it should be bringing only additional behavior without
touching the existing behavior.

The bad thing is that of course, in the language question (before font
switch), localized language names for non-latin1 languages appear as
squares.  That can not really be avoided anyway.

This patch could actually be useful to BSD people, as they don't have
bterm support: they could use font switch to support level2 languages in
their text mode. I'm not sure how that is done however, it seems a
screen map also has to be loaded. A vidcontrol-udeb would have to be
introduced at least.

Just a side note:

+       gunzip < "$FONT" > /tmp/font.psf
+       setfont /tmp/font.psf
+       rm /tmp/font.psf

This is currently needed because setfont looks for gzip -d to unzip the
font.  setfont could be made to use gunzip instead, I'm not sure what I
prefer to patch at this point.

Samuel
diff --git a/debian/changelog b/debian/changelog
index 0f20f17..08803b1 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+console-setup (1.83~0) UNRELEASED; urgency=low
+
+  * Add font-switch script to console-setup-linux-fonts-udeb package, remove
+    fonts which are not used by d-i.
+
+ -- Samuel Thibault <sthibault@debian.org>  Sat, 25 Aug 2012 23:50:41 +0200
+
 console-setup (1.82) unstable; urgency=low
 
   * Re-upload without .gitignore files in the source package.
diff --git a/debian/control b/debian/control
index fd85468..9be960c 100644
--- a/debian/control
+++ b/debian/control
@@ -187,7 +187,7 @@ XC-Package-Type: udeb
 Package: console-setup-linux-fonts-udeb
 Section: debian-installer
 Priority: extra
-Depends: ${misc:Depends}
+Depends: ${misc:Depends}, kbd-udeb
 Architecture: all
 Description: Linux console fonts for Debian Installer
 XC-Package-Type: udeb
diff --git a/debian/font-switch b/debian/font-switch
new file mode 100755
index 0000000..abfc335
--- /dev/null
+++ b/debian/font-switch
@@ -0,0 +1,30 @@
+#!/bin/sh
+
+LANGUAGE="$1"
+
+FONT_RECORD=/var/run/console-setup.font
+
+case "$LANGUAGE" in
+	ku|kk|ky)		CODESET=CyrAsia ;;
+	be|bg|br|mk|ru|sr|uk)	CODESET=CyrSlav ;;
+	el)			CODESET=Greek ;;
+	ast|et|sq|tr|xh)	CODESET=Lat15 ;;
+	bs|cs|hr|hu|pl|ro|sk|sl)	CODESET=Lat2 ;;
+	cy|eo)			CODESET=Lat38 ;;
+	lv|lt)			CODESET=Lat7 ;;
+
+	*)
+		[ -r $FONT_RECORD ] || exit 0
+		CODESET=Lat15
+		;;
+esac
+
+FONT="`eval echo /usr/share/consolefonts/$CODESET*`"
+
+if [ -r "$FONT" ]
+then
+	gunzip < "$FONT" > /tmp/font.psf
+	setfont /tmp/font.psf
+	rm /tmp/font.psf
+	echo "$FONT" > $FONT_RECORD
+fi
diff --git a/debian/rules b/debian/rules
index f94db57..d709312 100755
--- a/debian/rules
+++ b/debian/rules
@@ -15,14 +15,16 @@ manprocessor = sed \
 	-e 's|^\([.a-zA-Z][a-zA-Z]*\) /usr/local/etc|\1 /etc|' \
 	-e 's|^\([.a-zA-Z][a-zA-Z]*\) /usr/local|\1 /usr|'
 
-# One font per fontset
-udeb-fonts = Armenian-Fixed16 CyrAsia-Fixed16 CyrKoi-TerminusBold16	\
-CyrSlav-TerminusBold16 Georgian-Fixed16 Greek-VGA16 Hebrew-VGA16	\
-Lao-Fixed16 Lat15-TerminusBold16 Lat2-TerminusBold16 Lat38-VGA16	\
-Lat7-TerminusBold16 Thai-Fixed16
+# One font per fontset supported by d-i in text console
+udeb-fonts = CyrAsia-Fixed16 CyrSlav-TerminusBold16 Greek-VGA16 \
+Lat15-TerminusBold16 Lat2-TerminusBold16 Lat38-VGA16 Lat7-TerminusBold16
+# These are not properly supported by d-i in text console
+# Armenian-Fixed16 CyrKoi-TerminusBold16 Georgian-Fixed16 Hebrew-VGA16	Lao-Fixed16  Thai-Fixed16
+
 # These are Linux-only
-udeb-fonts-big = Arabic-VGA16 Ethiopian-Goha16 Uni1-VGA16 Uni2-VGA16	\
-Uni3-Fixed16 Vietnamese-Fixed16
+udeb-fonts-big = Uni1-VGA16 Uni2-VGA16 Uni3-Fixed16
+# These are not properly supported by d-i in text console
+# Arabic-VGA16 Ethiopian-Goha16 Vietnamese-Fixed16
 
 # One fontset per charmap
 udeb-scm = $(addprefix Fonts/, ARMSCII-8_Armenian.scm			\
@@ -36,7 +38,7 @@ ISO-8859-15_Lat15.scm ISO-8859-16_Lat2.scm KOI8-R_CyrKoi.scm		\
 KOI8-U_CyrKoi.scm TIS-620_Thai.scm)
 
 udeb-fonts-linux = $(addprefix Fonts/, $(addsuffix .psf.gz, \
-			$(udeb-fonts) $(udeb-fonts-big)))
+			$(udeb-fonts)))
 udeb-fonts-freebsd = $(addprefix Fonts/, $(addsuffix .fnt, $(udeb-fonts)))
 
 main_build:
@@ -175,6 +177,8 @@ install-linux-udeb: build
 	dh_prep -p console-setup-linux-fonts-udeb
 	dh_install -p console-setup-linux-fonts-udeb $(udeb-fonts-linux) \
 		usr/share/consolefonts
+	dh_install -p console-setup-linux-fonts-udeb debian/font-switch \
+		/usr/share/console-setup
 
 .PHONY : install-freebsd-udeb
 install-freebsd-udeb: build
diff --git a/README b/README
index 334ab76..1572d40 100644
--- a/README
+++ b/README
@@ -73,7 +73,8 @@ the cdebconf frontend that is being used.
 Currently 5 levels are distinguished:
 - dumb or serial terminal                -->level 0 (only ASCII)
 - no framebuffer                         -->level 1 (only Latin1)
-- framebuffer and non-graphical interface-->level 2 and 3 (no combining langs)
+- font load support                      -->level 2 (256-glyph langs)
+- framebuffer and non-graphical interface-->level 3 (no combining langs)
 - framebuffer and graphical interface    -->level 4 (all langs)
 
 Depending on these values, we use different templates with a different
@@ -269,7 +270,7 @@ Language;supported_environments;langcode;countrycode;fallbacklocale;langlist;con
                      0=OK in ASCII-only environments
 		     1=OK in Latin-1 only environment (Linux console
                        without framebuffer, some serial consoles)
-                     2=OK with the framebuffer console
+                     2=OK with font loading support
                      3=OK with the framebuffer console but not
                        possible to display in the regular Linux console
                      4=OK only with the graphical installer
diff --git a/debian/changelog b/debian/changelog
index a04326b..5d0a149 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+localechooser (2.45~0) UNRELEASED; urgency=low
+
+  * Call console-setup font-switch script.
+
+ -- Samuel Thibault <sthibault@debian.org>  Sat, 25 Aug 2012 23:27:23 +0200
+
 localechooser (2.44) unstable; urgency=low
 
   * Fix accidentally-combined Dutch and Dzongkha entries in languagelist.
diff --git a/localechooser b/localechooser
index 7f5eb60..a883dc7 100644
--- a/localechooser
+++ b/localechooser
@@ -65,7 +65,12 @@ language_display_level() {
 		if [ "$TERM_FRAMEBUFFER" ]; then
 			level=3
 		else
-			level=1
+			if [ -x /usr/share/console-setup/font-switch ]
+			then
+				level=2
+			else
+				level=1
+			fi
 		fi
 		# The hurd text-mode console has decent charset support
 		if [ "$TERM" = "hurd" ]; then
@@ -478,6 +483,11 @@ while :; do
 	   10)	# Display language list
 		db_settitle localechooser/title/language
 
+		if [ -x /usr/share/console-setup/font-switch ]
+		then
+			/usr/share/console-setup/font-switch "$INITIAL_LANGUAGE"
+		fi
+
 		if [ -x /usr/lib/espeakup/espeakup.restart ]
 		then
 			/usr/lib/espeakup/espeakup.restart "$INITIAL_LANGUAGE"
@@ -514,6 +524,12 @@ while :; do
 	   11)	# We have a language
 		db_get $tpl_languagelist
 		LANGUAGE="$RET"
+
+		if [ -x /usr/share/console-setup/font-switch ]
+		then
+			/usr/share/console-setup/font-switch "$LANGUAGE"
+		fi
+
 		if [ -x /usr/lib/espeakup/espeakup.restart ]
 		then
 			/usr/lib/espeakup/espeakup.restart "$LANGUAGE"
diff --git a/build/pkg-lists/cdrom/isolinux/gtk/amd64.cfg b/build/pkg-lists/cdrom/isolinux/gtk/amd64.cfg
index 5a7c16a..50a9b7c 100644
--- a/build/pkg-lists/cdrom/isolinux/gtk/amd64.cfg
+++ b/build/pkg-lists/cdrom/isolinux/gtk/amd64.cfg
@@ -4,4 +4,5 @@ xserver-xorg-video-fbdev-udeb
 
 speakup-modules-${kernel:Version}
 sound-modules-${kernel:Version}
+console-setup-linux-fonts-udeb
 espeakup-udeb
diff --git a/build/pkg-lists/cdrom/isolinux/gtk/i386.cfg b/build/pkg-lists/cdrom/isolinux/gtk/i386.cfg
index 5a7c16a..50a9b7c 100644
--- a/build/pkg-lists/cdrom/isolinux/gtk/i386.cfg
+++ b/build/pkg-lists/cdrom/isolinux/gtk/i386.cfg
@@ -4,4 +4,5 @@ xserver-xorg-video-fbdev-udeb
 
 speakup-modules-${kernel:Version}
 sound-modules-${kernel:Version}
+console-setup-linux-fonts-udeb
 espeakup-udeb
diff --git a/build/pkg-lists/hd-media/gtk/amd64.cfg b/build/pkg-lists/hd-media/gtk/amd64.cfg
index 82f7c84..3d4fce6 100644
--- a/build/pkg-lists/hd-media/gtk/amd64.cfg
+++ b/build/pkg-lists/hd-media/gtk/amd64.cfg
@@ -6,4 +6,5 @@ xserver-xorg-video-fbdev-udeb
 
 speakup-modules-${kernel:Version}
 sound-modules-${kernel:Version}
+console-setup-linux-fonts-udeb
 espeakup-udeb
diff --git a/build/pkg-lists/hd-media/gtk/i386.cfg b/build/pkg-lists/hd-media/gtk/i386.cfg
index 82f7c84..3d4fce6 100644
--- a/build/pkg-lists/hd-media/gtk/i386.cfg
+++ b/build/pkg-lists/hd-media/gtk/i386.cfg
@@ -6,4 +6,5 @@ xserver-xorg-video-fbdev-udeb
 
 speakup-modules-${kernel:Version}
 sound-modules-${kernel:Version}
+console-setup-linux-fonts-udeb
 espeakup-udeb
diff --git a/build/pkg-lists/netboot/gtk/amd64.cfg b/build/pkg-lists/netboot/gtk/amd64.cfg
index 82f7c84..3d4fce6 100644
--- a/build/pkg-lists/netboot/gtk/amd64.cfg
+++ b/build/pkg-lists/netboot/gtk/amd64.cfg
@@ -6,4 +6,5 @@ xserver-xorg-video-fbdev-udeb
 
 speakup-modules-${kernel:Version}
 sound-modules-${kernel:Version}
+console-setup-linux-fonts-udeb
 espeakup-udeb
diff --git a/build/pkg-lists/netboot/gtk/i386.cfg b/build/pkg-lists/netboot/gtk/i386.cfg
index 82f7c84..3d4fce6 100644
--- a/build/pkg-lists/netboot/gtk/i386.cfg
+++ b/build/pkg-lists/netboot/gtk/i386.cfg
@@ -6,4 +6,5 @@ xserver-xorg-video-fbdev-udeb
 
 speakup-modules-${kernel:Version}
 sound-modules-${kernel:Version}
+console-setup-linux-fonts-udeb
 espeakup-udeb

Reply to: