* [gentoo-dev] [PATCH 1/5] font.eclass: introduce FONT_CONVERT_SFNT for converting old bitmap fonts
@ 2022-10-15 3:09 Sam James
2022-10-15 3:09 ` [gentoo-dev] [PATCH 2/5] xorg-3.eclass: add FONT_CONVERT_SFNT support Sam James
` (4 more replies)
0 siblings, 5 replies; 9+ messages in thread
From: Sam James @ 2022-10-15 3:09 UTC (permalink / raw
To: gentoo-dev; +Cc: x11, fonts, gnome, Kerin Millar, Sam James
>=x11-libs/pango-1.44 dropped support for old bitmap fonts. We can convert
fonts from the legacy .bdf and .pcf formats into the OTB wrapper format
using x11-apps/fonttosfnt.
This commit adds FONT_CONVERT_SFNT which packages installing bitmap fonts
can set to opt-in to conversion.
Note that the font conversion isn't perfect -- it's good enough
in many cases, but in some cases they may require tweaking
via fontconfig to get pixel size right, antialiasing settings, ...
Adds IUSE=+convert-sfnt to any ebuilds which set FONT_CONVERT_SFNT;
enabled by default given discoverability of this issue may be difficult
and presumably any font package enabling FONT_CONVERT_SFNT will be
useless without it anyway.
See also https://fedoraproject.org/wiki/BitmapFontConversion.
Bug: https://bugs.gentoo.org/698922
Thanks-to: Kerin Millar <kfm@plushkava.net>
Signed-off-by: Sam James <sam@gentoo.org>
---
eclass/font.eclass | 35 +++++++++++++++++++++++++++++++++++
1 file changed, 35 insertions(+)
diff --git a/eclass/font.eclass b/eclass/font.eclass
index 83636ac3fed5..4b7021ee0599 100644
--- a/eclass/font.eclass
+++ b/eclass/font.eclass
@@ -46,6 +46,12 @@ FONTDIR=${FONTDIR:-/usr/share/fonts/${FONT_PN}}
# Array containing fontconfig conf files to install.
FONT_CONF=( "" )
+# @ECLASS_VARIABLE: FONT_CONVERT_SFNT
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# Determines whether detected BDF and PCF font files should be converted
+# to an SFNT wrapper, for use with newer Pango.
+
if [[ ${CATEGORY}/${PN} != media-fonts/encodings ]]; then
IUSE="X"
BDEPEND="X? (
@@ -54,6 +60,31 @@ if [[ ${CATEGORY}/${PN} != media-fonts/encodings ]]; then
)"
fi
+if [[ -n ${FONT_CONVERT_SFNT} ]] ; then
+ IUSE+=" +convert-sfnt"
+ BDEPEND+=" convert-sfnt? ( x11-apps/fonttosfnt )"
+fi
+
+# @FUNCTION: font_convert_sfnt
+# @DESCRIPTION:
+# Converts .bdf and .pcf fonts detected within ${ED} to the OTB wrapper format
+# using x11-apps/fonttosfnt. Handles optional .gz extension.
+font_convert_sfnt() {
+ local file tmpfile
+
+ while IFS= read -rd '' file; do
+ if [[ ${file} != *.gz ]] ; then
+ tmpfile=${file%.*}
+
+ gzip -cd -- "${file}" > "${tmpfile}" \
+ && fonttosfnt -v -o "${file%.*}.otb" -- "${tmpfile}" \
+ && rm -- "${tmpfile}"
+ else
+ fonttosfnt -v -o "${file%.*}.otb" -- "${file}"
+ fi || ! break
+ done < <(find "${ED}" \( -name '*.bdf' -o -name '*.bdf.gz' -o -name '*.pcf' -o -name '*.pcf.gz' \) -type f ! -type l -print0) || die
+}
+
# @FUNCTION: font_xfont_config
# @DESCRIPTION:
# Generate Xorg font files (mkfontscale/mkfontdir).
@@ -150,6 +181,10 @@ font_pkg_setup() {
font_src_install() {
local dir suffix commondoc
+ if [[ -n ${FONT_CONVERT_SFNT} ]] && in_iuse convert-sfnt && use convert-sfnt ; then
+ font_convert_sfnt
+ fi
+
if [[ $(declare -p FONT_S 2>/dev/null) == "declare -a"* ]]; then
# recreate the directory structure if FONT_S is an array
for dir in "${FONT_S[@]}"; do
--
2.38.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [gentoo-dev] [PATCH 2/5] xorg-3.eclass: add FONT_CONVERT_SFNT support
2022-10-15 3:09 [gentoo-dev] [PATCH 1/5] font.eclass: introduce FONT_CONVERT_SFNT for converting old bitmap fonts Sam James
@ 2022-10-15 3:09 ` Sam James
2022-10-15 3:09 ` [gentoo-dev] [PATCH 3/5] profiles: add USE=convert-sfnt Sam James
` (3 subsequent siblings)
4 siblings, 0 replies; 9+ messages in thread
From: Sam James @ 2022-10-15 3:09 UTC (permalink / raw
To: gentoo-dev; +Cc: x11, fonts, gnome, Kerin Millar, Sam James
Bug: https://bugs.gentoo.org/698922
Signed-off-by: Sam James <sam@gentoo.org>
---
eclass/xorg-3.eclass | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/eclass/xorg-3.eclass b/eclass/xorg-3.eclass
index e120d23efd4f..4469efb73427 100644
--- a/eclass/xorg-3.eclass
+++ b/eclass/xorg-3.eclass
@@ -463,7 +463,13 @@ xorg-3_src_install() {
# Don't install libtool archives (even for modules)
find "${D}" -type f -name '*.la' -delete || die
- [[ -n ${FONT} ]] && remove_font_metadata
+ if [[ -n ${FONT} ]] ; then
+ if [[ -n ${FONT_CONVERT_SFNT} ]] && in_iuse convert-sfnt && use convert-sfnt ; then
+ font_convert_sfnt
+ fi
+
+ remove_font_metadata
+ fi
}
# @FUNCTION: xorg-3_pkg_postinst
--
2.38.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [gentoo-dev] [PATCH 3/5] profiles: add USE=convert-sfnt
2022-10-15 3:09 [gentoo-dev] [PATCH 1/5] font.eclass: introduce FONT_CONVERT_SFNT for converting old bitmap fonts Sam James
2022-10-15 3:09 ` [gentoo-dev] [PATCH 2/5] xorg-3.eclass: add FONT_CONVERT_SFNT support Sam James
@ 2022-10-15 3:09 ` Sam James
2022-10-15 9:01 ` Ulrich Mueller
2022-10-15 3:09 ` [gentoo-dev] [PATCH 4/5] profiles/arch/hppa: mask USE=convert-sfnt Sam James
` (2 subsequent siblings)
4 siblings, 1 reply; 9+ messages in thread
From: Sam James @ 2022-10-15 3:09 UTC (permalink / raw
To: gentoo-dev; +Cc: x11, fonts, gnome, Kerin Millar, Sam James
Bug: https://bugs.gentoo.org/698922
Signed-off-by: Sam James <sam@gentoo.org>
---
profiles/use.desc | 1 +
1 file changed, 1 insertion(+)
diff --git a/profiles/use.desc b/profiles/use.desc
index d7e841f80df6..cdf98b916af1 100644
--- a/profiles/use.desc
+++ b/profiles/use.desc
@@ -45,6 +45,7 @@ cjk - Add support for Multi-byte character languages (Chinese, Japanese, Korean)
clamav - Add support for Clam AntiVirus software (usually with a plugin)
colord - Support color management using x11-misc/colord
connman - Add support for net-misc/connman
+convert-sfnt - Convert BDF and PCF bitmap fonts to OTB wrapper format
coreaudio - Build the CoreAudio driver on Mac OS X systems
cracklib - Support for cracklib strong password checking
crypt - Add support for encryption -- using mcrypt or gpg where applicable
--
2.38.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [gentoo-dev] [PATCH 4/5] profiles/arch/hppa: mask USE=convert-sfnt
2022-10-15 3:09 [gentoo-dev] [PATCH 1/5] font.eclass: introduce FONT_CONVERT_SFNT for converting old bitmap fonts Sam James
2022-10-15 3:09 ` [gentoo-dev] [PATCH 2/5] xorg-3.eclass: add FONT_CONVERT_SFNT support Sam James
2022-10-15 3:09 ` [gentoo-dev] [PATCH 3/5] profiles: add USE=convert-sfnt Sam James
@ 2022-10-15 3:09 ` Sam James
2022-10-15 3:09 ` [gentoo-dev] [PATCH 5/5] media-fonts/font-misc-misc: add FONT_CONVERT_SFNT support Sam James
2022-10-15 3:33 ` [gentoo-dev] [PATCH 1/5] font.eclass: introduce FONT_CONVERT_SFNT for converting old bitmap fonts Sam James
4 siblings, 0 replies; 9+ messages in thread
From: Sam James @ 2022-10-15 3:09 UTC (permalink / raw
To: gentoo-dev; +Cc: x11, fonts, gnome, Kerin Millar, Sam James
Signed-off-by: Sam James <sam@gentoo.org>
---
profiles/arch/hppa/use.mask | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/profiles/arch/hppa/use.mask b/profiles/arch/hppa/use.mask
index 83ae1d1951f6..a2cb9a72cc22 100644
--- a/profiles/arch/hppa/use.mask
+++ b/profiles/arch/hppa/use.mask
@@ -7,6 +7,10 @@
# NOTE: When masking a USE flag due to missing keywords, please file a keyword
# request bug for the hppa arch.
+# Sam James <sam@gentoo.org> (2022-10-15)
+# x11-apps/fonttosfnt is not keyworded here
+convert-sfnt
+
# Matt Turner <mattst88gentoo.org> (2022-02-21)
# app-crypt/tpm2-tss is not keyworded here
tpm
--
2.38.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [gentoo-dev] [PATCH 5/5] media-fonts/font-misc-misc: add FONT_CONVERT_SFNT support
2022-10-15 3:09 [gentoo-dev] [PATCH 1/5] font.eclass: introduce FONT_CONVERT_SFNT for converting old bitmap fonts Sam James
` (2 preceding siblings ...)
2022-10-15 3:09 ` [gentoo-dev] [PATCH 4/5] profiles/arch/hppa: mask USE=convert-sfnt Sam James
@ 2022-10-15 3:09 ` Sam James
2022-10-15 3:33 ` [gentoo-dev] [PATCH 1/5] font.eclass: introduce FONT_CONVERT_SFNT for converting old bitmap fonts Sam James
4 siblings, 0 replies; 9+ messages in thread
From: Sam James @ 2022-10-15 3:09 UTC (permalink / raw
To: gentoo-dev; +Cc: x11, fonts, gnome, Kerin Millar, Sam James
Bug: https://bugs.gentoo.org/698922
Signed-off-by: Sam James <sam@gentoo.org>
---
.../font-misc-misc/font-misc-misc-1.1.2-r3.ebuild | 12 ++++++++++++
1 file changed, 12 insertions(+)
create mode 100644 media-fonts/font-misc-misc/font-misc-misc-1.1.2-r3.ebuild
diff --git a/media-fonts/font-misc-misc/font-misc-misc-1.1.2-r3.ebuild b/media-fonts/font-misc-misc/font-misc-misc-1.1.2-r3.ebuild
new file mode 100644
index 000000000000..3f2bc252cc00
--- /dev/null
+++ b/media-fonts/font-misc-misc/font-misc-misc-1.1.2-r3.ebuild
@@ -0,0 +1,12 @@
+# Copyright 1999-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+XORG_PACKAGE_NAME="misc-misc"
+FONT_CONVERT_SFNT=1
+inherit xorg-3
+
+DESCRIPTION="X.Org miscellaneous fonts"
+
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~x64-solaris ~x86-solaris"
+IUSE="nls"
--
2.38.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [gentoo-dev] [PATCH 1/5] font.eclass: introduce FONT_CONVERT_SFNT for converting old bitmap fonts
2022-10-15 3:09 [gentoo-dev] [PATCH 1/5] font.eclass: introduce FONT_CONVERT_SFNT for converting old bitmap fonts Sam James
` (3 preceding siblings ...)
2022-10-15 3:09 ` [gentoo-dev] [PATCH 5/5] media-fonts/font-misc-misc: add FONT_CONVERT_SFNT support Sam James
@ 2022-10-15 3:33 ` Sam James
4 siblings, 0 replies; 9+ messages in thread
From: Sam James @ 2022-10-15 3:33 UTC (permalink / raw
To: gentoo-dev; +Cc: x11, fonts, gnome, Kerin Millar
[-- Attachment #1: Type: text/plain, Size: 1672 bytes --]
> On 15 Oct 2022, at 04:09, Sam James <sam@gentoo.org> wrote:
>
>> =x11-libs/pango-1.44 dropped support for old bitmap fonts. We can convert
> fonts from the legacy .bdf and .pcf formats into the OTB wrapper format
> using x11-apps/fonttosfnt.
>
> This commit adds FONT_CONVERT_SFNT which packages installing bitmap fonts
> can set to opt-in to conversion.
>
> Note that the font conversion isn't perfect -- it's good enough
> in many cases, but in some cases they may require tweaking
> via fontconfig to get pixel size right, antialiasing settings, ...
>
> Adds IUSE=+convert-sfnt to any ebuilds which set FONT_CONVERT_SFNT;
> enabled by default given discoverability of this issue may be difficult
> and presumably any font package enabling FONT_CONVERT_SFNT will be
> useless without it anyway.
>
> See also https://fedoraproject.org/wiki/BitmapFontConversion.
>
> Bug: https://bugs.gentoo.org/698922
> Thanks-to: Kerin Millar <kfm@plushkava.net>
> Signed-off-by: Sam James <sam@gentoo.org>
> ---
> eclass/font.eclass | 35 +++++++++++++++++++++++++++++++++++
> 1 file changed, 35 insertions(+)
>
> diff --git a/eclass/font.eclass b/eclass/font.eclass
> index 83636ac3fed5..4b7021ee0599 100644
> --- a/eclass/font.eclass
> +++ b/eclass/font.eclass
> [snip]
> +# @FUNCTION: font_convert_sfnt
> +# @DESCRIPTION:
> +# Converts .bdf and .pcf fonts detected within ${ED} to the OTB wrapper format
> +# using x11-apps/fonttosfnt. Handles optional .gz extension.
> +font_convert_sfnt() {
> + local file tmpfile
> +
> + while IFS= read -rd '' file; do
> + if [[ ${file} != *.gz ]] ; then
==, which I'll fix locally.
[-- Attachment #2: Message signed with OpenPGP --]
[-- Type: application/pgp-signature, Size: 358 bytes --]
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [gentoo-dev] [PATCH 3/5] profiles: add USE=convert-sfnt
2022-10-15 3:09 ` [gentoo-dev] [PATCH 3/5] profiles: add USE=convert-sfnt Sam James
@ 2022-10-15 9:01 ` Ulrich Mueller
2022-10-17 6:53 ` Mart Raudsepp
0 siblings, 1 reply; 9+ messages in thread
From: Ulrich Mueller @ 2022-10-15 9:01 UTC (permalink / raw
To: Sam James; +Cc: gentoo-dev, x11, fonts, gnome, Kerin Millar
[-- Attachment #1: Type: text/plain, Size: 312 bytes --]
>>>>> On Sat, 15 Oct 2022, Sam James wrote:
> +convert-sfnt - Convert BDF and PCF bitmap fonts to OTB wrapper format
Sorry for the bikeshedding, but could we have a name that indicates what
this global flag is about? Maybe something starting with "font" which
would at least point to the general area.
Ulrich
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 507 bytes --]
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [gentoo-dev] [PATCH 3/5] profiles: add USE=convert-sfnt
2022-10-15 9:01 ` Ulrich Mueller
@ 2022-10-17 6:53 ` Mart Raudsepp
2022-10-30 13:54 ` Sam James
0 siblings, 1 reply; 9+ messages in thread
From: Mart Raudsepp @ 2022-10-17 6:53 UTC (permalink / raw
To: gentoo-dev, Sam James; +Cc: x11, fonts, gnome, Kerin Millar
Ühel kenal päeval, L, 15.10.2022 kell 11:01, kirjutas Ulrich Mueller:
> > > > > > On Sat, 15 Oct 2022, Sam James wrote:
>
> > +convert-sfnt - Convert BDF and PCF bitmap fonts to OTB wrapper
> > format
>
> Sorry for the bikeshedding, but could we have a name that indicates
> what
> this global flag is about? Maybe something starting with "font" which
> would at least point to the general area.
Also I don't think it actually converts it in the sense that I would
think when looking at the USE flag, but rather has the package ship it
in an OpenType container AS WELL for pango to work with it?
Mart
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [gentoo-dev] [PATCH 3/5] profiles: add USE=convert-sfnt
2022-10-17 6:53 ` Mart Raudsepp
@ 2022-10-30 13:54 ` Sam James
0 siblings, 0 replies; 9+ messages in thread
From: Sam James @ 2022-10-30 13:54 UTC (permalink / raw
To: gentoo-dev; +Cc: x11, fonts, gnome, Kerin Millar
[-- Attachment #1: Type: text/plain, Size: 760 bytes --]
> On 17 Oct 2022, at 07:53, Mart Raudsepp <leio@gentoo.org> wrote:
>
> Ühel kenal päeval, L, 15.10.2022 kell 11:01, kirjutas Ulrich Mueller:
>>>>>>> On Sat, 15 Oct 2022, Sam James wrote:
>>
>>> +convert-sfnt - Convert BDF and PCF bitmap fonts to OTB wrapper
>>> format
>>
>> Sorry for the bikeshedding, but could we have a name that indicates
>> what
>> this global flag is about? Maybe something starting with "font" which
>> would at least point to the general area.
>
> Also I don't think it actually converts it in the sense that I would
> think when looking at the USE flag, but rather has the package ship it
> in an OpenType container AS WELL for pango to work with it?
>
> Mart
>
Okay, what about USE=opentype-compat?
[-- Attachment #2: Message signed with OpenPGP --]
[-- Type: application/pgp-signature, Size: 358 bytes --]
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2022-10-30 13:55 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-10-15 3:09 [gentoo-dev] [PATCH 1/5] font.eclass: introduce FONT_CONVERT_SFNT for converting old bitmap fonts Sam James
2022-10-15 3:09 ` [gentoo-dev] [PATCH 2/5] xorg-3.eclass: add FONT_CONVERT_SFNT support Sam James
2022-10-15 3:09 ` [gentoo-dev] [PATCH 3/5] profiles: add USE=convert-sfnt Sam James
2022-10-15 9:01 ` Ulrich Mueller
2022-10-17 6:53 ` Mart Raudsepp
2022-10-30 13:54 ` Sam James
2022-10-15 3:09 ` [gentoo-dev] [PATCH 4/5] profiles/arch/hppa: mask USE=convert-sfnt Sam James
2022-10-15 3:09 ` [gentoo-dev] [PATCH 5/5] media-fonts/font-misc-misc: add FONT_CONVERT_SFNT support Sam James
2022-10-15 3:33 ` [gentoo-dev] [PATCH 1/5] font.eclass: introduce FONT_CONVERT_SFNT for converting old bitmap fonts Sam James
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox