COLR/OT-SVG fonts will cause BadLength error with "Xft.rgba: none"
Test program
- xfttest.c
- https://pypi.org/project/fonttools/ (to attempt dropping COLR/SVG from font)
Tested fonts
-
HarmonyOS_Sans_Regular.ttf
from https://developer.huawei.com/images/download/next/HarmonyOS-Sans.zip (COLR+SVG) -
JuliaMono-Regular.ttf
from https://github.com/cormullion/juliamono/releases/download/v0.055/JuliaMono-ttf.zip (SVG only) - Segoe UI Emoji (
seguiemj.ttf
) from Windows 11 (COLR only)
Some other COLR(v0) font will NOT trigger this issue:
Steps to Reproduce
$ Xephyr :9 &
$ export DISPLAY=:9
$ xeyes & # make xrdb happy
$ xrdb <<< 'Xft.rgba: none'
$ ./xfttest HarmonyOS_Sans_Regular.ttf "hello"
extents: width=27 height=11 x=0 y=10 xoff=27 yoff=0
X Error of failed request: BadLength (poly request too large or internal Xlib length error)
Major opcode of failed request: 139 (RENDER)
Minor opcode of failed request: 20 (RenderAddGlyphs)
Serial number of failed request: 11
Current serial number in output stream: 17
$ xrdb <<< 'Xft.rgba: rgb'
$ ./xfttest HarmonyOS_Sans_Regular.ttf "hello"
extents: width=28 height=11 x=0 y=10 xoff=27 yoff=0
(no error)
$ xrdb <<< 'Xft.rgba: none'
$ # drop COLR and SVG from font
$ ttx -x 'COLR' -x 'CPAL' -x 'SVG ' -o - JuliaMono-Regular.ttf | ttx -o a.ttf -
$ ./xfttest a.ttf "hello"
extents: width=27 height=11 x=0 y=10 xoff=27 yoff=0
(no error)
$ # dropping either COLR or SVG is not sufficient
$ ttx -x 'COLR' -x 'CPAL' -o - HarmonyOS_Sans_Regular.ttf | ttx -o b.ttf -
$ ttx -x 'SVG ' -o - HarmonyOS_Sans_Regular.ttf | ttx -o c.ttf -
$ ./xfttest b.ttf "hello"
extents: width=27 height=11 x=0 y=10 xoff=27 yoff=0
X Error of failed request: BadLength (poly request too large or internal Xlib length error)
Major opcode of failed request: 139 (RENDER)
Minor opcode of failed request: 20 (RenderAddGlyphs)
Serial number of failed request: 11
Current serial number in output stream: 17
$ ./xfttest c.ttf "hello"
extents: width=27 height=11 x=0 y=10 xoff=27 yoff=0
X Error of failed request: BadLength (poly request too large or internal Xlib length error)
Major opcode of failed request: 139 (RENDER)
Minor opcode of failed request: 20 (RenderAddGlyphs)
Serial number of failed request: 11
Current serial number in output stream: 17