[Buildroot] [PATCH 05/29 v2] package/some-font: new pseudo-package

Yann E. MORIN yann.morin.1998 at free.fr
Wed Apr 9 20:03:20 UTC 2025


Packages that will be rendering text, will need that some font be
installed; most of the time, any font will fit the bill. However, we
currently have no way for such a package to just require "some font"; it
needs to actually select one package providing fonts. If the user
selects another font package, then the one forcibly selected by the
package would be superfluous.

Fonts are a runtime dependency, not a build-time one, so we don't need
to handle it like the virtual packages. Furthemore, multiple font
packages can be installed at once, this is perfectly valid, so we can't
use a virtual package.

This commit adds a pseudo package (in fact, just a Kconfig symbol), that
packages can select when they just require some font, but are not picky
on which font that would be. We currently decide that the liberation
fonts would be the default ones.

Conversely, also add a Kconfig symbol that font-providing packages can
select to indicate that some font is available, in which case liberation
is not forcefully selected (of course, liberation can't, mustn't, and
doesn't select that symbol).

This also allows packages from br2-external trees to advertise they
provide fonts, too.

Signed-off-by: Yann E. MORIN <yann.morin.1998 at free.fr>
Cc: Klaus Heinrich Kiwi <klaus at linux.vnet.ibm.com>
---
 package/Config.in                   |  2 ++
 package/bitstream-vera/Config.in    |  1 +
 package/cantarell/Config.in         |  1 +
 package/dejavu/Config.in            |  1 +
 package/font-awesome/Config.in      |  1 +
 package/ghostscript-fonts/Config.in |  1 +
 package/inconsolata/Config.in       |  1 +
 package/some-font/Config.in         | 17 +++++++++++++++++
 package/wqy-zenhei/Config.in        |  1 +
 9 files changed, 26 insertions(+)
 create mode 100644 package/some-font/Config.in

diff --git a/package/Config.in b/package/Config.in
index 291e784f26..28bdae9c1b 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -262,6 +262,8 @@ comment "Cursors"
 	source "package/comix-cursors/Config.in"
 
 comment "Fonts"
+	# check-package disable lib_config.CommentsMenusPackagesOrder
+	source "package/some-font/Config.in"
 	source "package/bitstream-vera/Config.in"
 	source "package/cantarell/Config.in"
 	source "package/dejavu/Config.in"
diff --git a/package/bitstream-vera/Config.in b/package/bitstream-vera/Config.in
index 034f115b4b..ea448894af 100644
--- a/package/bitstream-vera/Config.in
+++ b/package/bitstream-vera/Config.in
@@ -1,5 +1,6 @@
 config BR2_PACKAGE_BITSTREAM_VERA
 	bool "Bitstream Vera"
+	select BR2_PACKAGE_SOME_FONT_AVAILABLE
 	help
 	  Bitstream Vera font family.
 
diff --git a/package/cantarell/Config.in b/package/cantarell/Config.in
index 78af96d595..6d9c7f9641 100644
--- a/package/cantarell/Config.in
+++ b/package/cantarell/Config.in
@@ -1,5 +1,6 @@
 config BR2_PACKAGE_CANTARELL
 	bool "cantarell"
+	select BR2_PACKAGE_SOME_FONT_AVAILABLE
 	help
 	  The Cantarell font family is a contemporary Humanist
 	  sans serif designed for on-screen reading.
diff --git a/package/dejavu/Config.in b/package/dejavu/Config.in
index 771ec38514..ed92cfb3ad 100644
--- a/package/dejavu/Config.in
+++ b/package/dejavu/Config.in
@@ -1,6 +1,7 @@
 config BR2_PACKAGE_DEJAVU
 	bool "DejaVu fonts"
 	select BR2_PACKAGE_DEJAVU_MONO if !BR2_PACKAGE_DEJAVU_HAS_FONT
+	select BR2_PACKAGE_SOME_FONT_AVAILABLE
 	help
 	  The DejaVu fonts are a font family based on the Vera Fonts.
 	  Its purpose is to provide a wider range of characters while
diff --git a/package/font-awesome/Config.in b/package/font-awesome/Config.in
index 694d74e5a8..22826ee5ee 100644
--- a/package/font-awesome/Config.in
+++ b/package/font-awesome/Config.in
@@ -1,5 +1,6 @@
 config BR2_PACKAGE_FONT_AWESOME
 	bool "font-awesome"
+	select BR2_PACKAGE_SOME_FONT_AVAILABLE
 	help
 	  Font Awesome is a full suite of 605 pictographic icons for
 	  easy scalable vector graphics on websites.
diff --git a/package/ghostscript-fonts/Config.in b/package/ghostscript-fonts/Config.in
index 9b9b8d0cd2..cc4e28263a 100644
--- a/package/ghostscript-fonts/Config.in
+++ b/package/ghostscript-fonts/Config.in
@@ -1,5 +1,6 @@
 config BR2_PACKAGE_GHOSTSCRIPT_FONTS
 	bool "ghostscript-fonts"
+	select BR2_PACKAGE_SOME_FONT_AVAILABLE
 	help
 	  Fonts and font metrics customarily distributed with
 	  Ghostscript. Currently includes the 35 standard PostScript
diff --git a/package/inconsolata/Config.in b/package/inconsolata/Config.in
index de6b388574..eb7eb1328a 100644
--- a/package/inconsolata/Config.in
+++ b/package/inconsolata/Config.in
@@ -1,5 +1,6 @@
 config BR2_PACKAGE_INCONSOLATA
 	bool "inconsolata"
+	select BR2_PACKAGE_SOME_FONT_AVAILABLE
 	help
 	  Inconsolata is a monospace font, designed for code listings
 	  and the like.
diff --git a/package/some-font/Config.in b/package/some-font/Config.in
new file mode 100644
index 0000000000..d4d1296a20
--- /dev/null
+++ b/package/some-font/Config.in
@@ -0,0 +1,17 @@
+config BR2_PACKAGE_SOME_FONT
+	bool
+	select BR2_PACKAGE_LIBERATION if !BR2_PACKAGE_SOME_FONT_AVAILABLE
+	help
+	  This package does not provide any font of its own;
+	  instead, it ensure that at least one font package is
+	  enabled, and thus that at least one font is installed
+	  in the target.
+
+	  Select this if your package just requires some font,
+	  whatever that may be.
+
+config BR2_PACKAGE_SOME_FONT_AVAILABLE
+	bool
+	help
+	  This blind symbol should be selected by any package that
+	  installs fonts.
diff --git a/package/wqy-zenhei/Config.in b/package/wqy-zenhei/Config.in
index f9135e01a1..77be22dd4d 100644
--- a/package/wqy-zenhei/Config.in
+++ b/package/wqy-zenhei/Config.in
@@ -1,5 +1,6 @@
 config BR2_PACKAGE_WQY_ZENHEI
 	bool "wqy-zenhei"
+	select BR2_PACKAGE_SOME_FONT_AVAILABLE
 	help
 	  "WenQuanYi Zen Hei" is a Hei-Ti Style (sans-serif) Chinese
 	  font capable of text formatting and on-screen display of
-- 
2.47.0



More information about the buildroot mailing list