BadValue from X_OpenFont with some TrueType fonts

Jeremy Sequoia jeremyhu at apple.com
Fri Jul 1 02:18:43 UTC 2022


Hi folks,

I'm trying to track down an issue reported against XQuartz related to fonts.  I'm a bit out of my depth in this area, so I'm hoping to get some advice from others that know more about this than me.

   https://github.com/XQuartz/XQuartz/issues/216 <https://github.com/XQuartz/XQuartz/issues/216>

Essentially, folks are hitting BadValue from X_OpenFont when trying to use some fonts.  I've been able to reproduce this with XQuartz and macOS from about 4-5 years ago, so it's not a new issue... but it'd be nice to track it down and fix it for folks.

Here's an example:

$ xlsfonts -fn '-*-monaco-*' 
-misc-monaco-medium-r-normal--0-0-0-0-p-0-adobe-standard
-misc-monaco-medium-r-normal--0-0-0-0-p-0-ascii-0
-misc-monaco-medium-r-normal--0-0-0-0-p-0-iso10646-1
-misc-monaco-medium-r-normal--0-0-0-0-p-0-iso8859-1
-misc-monaco-medium-r-normal--0-0-0-0-p-0-iso8859-10
-misc-monaco-medium-r-normal--0-0-0-0-p-0-iso8859-13
-misc-monaco-medium-r-normal--0-0-0-0-p-0-iso8859-15
-misc-monaco-medium-r-normal--0-0-0-0-p-0-iso8859-16
-misc-monaco-medium-r-normal--0-0-0-0-p-0-iso8859-2
-misc-monaco-medium-r-normal--0-0-0-0-p-0-iso8859-3
-misc-monaco-medium-r-normal--0-0-0-0-p-0-iso8859-4
-misc-monaco-medium-r-normal--0-0-0-0-p-0-iso8859-5
-misc-monaco-medium-r-normal--0-0-0-0-p-0-iso8859-9
-misc-monaco-medium-r-normal--0-0-0-0-p-0-koi8-e
-misc-monaco-medium-r-normal--0-0-0-0-p-0-koi8-r
-misc-monaco-medium-r-normal--0-0-0-0-p-0-koi8-ru
-misc-monaco-medium-r-normal--0-0-0-0-p-0-koi8-u
-misc-monaco-medium-r-normal--0-0-0-0-p-0-koi8-uni
-misc-monaco-medium-r-normal--0-0-0-0-p-0-microsoft-cp1252

$ xlsfonts -l -fn '-*-monaco-*'
DIR  MIN  MAX EXIST DFLT PROP ASC DESC NAME
-->    0  255  some    0   36  18    4 -misc-monaco-medium-r-normal--0-0-0-0-p-0-iso8859-1
-->    0  255  some    0   36  18    4 -misc-monaco-medium-r-normal--0-0-0-0-p-0-iso8859-2
-->    0  255  some    0   36  14    4 -misc-monaco-medium-r-normal--0-0-0-0-p-0-iso8859-5

^^^ Where did al the others go... ?

$ xlsfonts -ll -fn '-*-monaco-*'
X Error of failed request:  BadValue (integer parameter out of range for operation)
 Major opcode of failed request:  45 (X_OpenFont)
 Value in failed request:  0xa00001
 Serial number of failed request:  9
 Current serial number in output stream:  10

^^^ 😭

Unfortunately, I'm having some troubles getting xscope working on darwin right now, but I was able to reproduce it on Ubuntu with Monaco.ttf (https://github.com/XQuartz/XQuartz/files/9024564/Monaco.ttf.gz) through xscope.

0.00: Client (pid 7136 xlsfonts) -->   12 bytes
	          byte-order: LSB first
	       major-version: 000b
	       minor-version: 0000
0.00: 					12452 bytes <-- X11 Server (pid 6304 Xorg)
					protocol-major-version: 000b
					protocol-minor-version: 0000
					      release-number: 00b74dc8
					    resource-id-base: 02000000
					    resource-id-mask: 001fffff
					  motion-buffer-size: 00000100
					    image-byte-order: LSB first
					bitmap-format-bit-order: LSB first
					bitmap-format-scanline-unit: 20
					bitmap-format-scanline-pad: 20
					         min-keycode: 8 (^H)
					         max-keycode: 255 (\377)
					              vendor: "The X.Org <http://x.org/> Foundation"
					      pixmap-formats: (7)
					               roots: (1)
0.00: Client (pid 7136 xlsfonts) -->   20 bytes
	 ............REQUEST: QueryExtension
	                name: "BIG-REQUESTS"
0.00: 					  32 bytes <-- X11 Server (pid 6304 Xorg)
					 ..............REPLY: QueryExtension
					             present: True
					        major-opcode: 85
					         first-event: 00
					         first-error: 00
0.00: Client (pid 7136 xlsfonts) -->    4 bytes
	 ............REQUEST: BigreqRequest
	       BIGREQREQUEST: BigreqEnable
0.00: 					  32 bytes <-- X11 Server (pid 6304 Xorg)
					 ..............REPLY: BigreqReply
					    max-request-size: 003fffff
0.00: Client (pid 7136 xlsfonts) -->   44 bytes
	 ............REQUEST: CreateGC
	  graphic-context-id: GXC 02000000
	            drawable: DWB 000006e9
	          value-mask: background
	          value-list:
		          background: 00ffffff
	 ............REQUEST: GetProperty
	              delete: False
	              window: WIN 000006e9
	            property: <RESOURCE_MANAGER>
	                type: <STRING>
	         long-offset: 00000000
0.01: 					 180 bytes <-- X11 Server (pid 6304 Xorg)
					 ..............REPLY: GetProperty
					              format: 08
					                type: <STRING>
					         bytes-after: 00000000
					               value: "*customization:^I-color^JXft.dpi:^I96^JXft.antialias:^I1^JXft.hinting:^I1^JXft.hintstyle:^Ihintslight^JXft.rgba:^Inone^JXcursor.size:^I24^JXcursor.theme:^IAdwaita^J"
0.01: Client (pid 7136 xlsfonts) -->   20 bytes
	 ............REQUEST: QueryExtension
	                name: "XKEYBOARD"
0.01: 					  32 bytes <-- X11 Server (pid 6304 Xorg)
					 ..............REPLY: QueryExtension
					             present: True
					        major-opcode: 87
					         first-event: 55
					         first-error: 89
0.01: Client (pid 7136 xlsfonts) -->    8 bytes
	 ............REQUEST: XKEYBOARD-Request
	        minor opcode: 00
	                data: (1)
0.01: 					  32 bytes <-- X11 Server (pid 6304 Xorg)
					 ..............REPLY: XKEYBOARD-Reply
					                data: 01
					                data: (6)
0.01: Client (pid 7136 xlsfonts) -->   20 bytes
	 ............REQUEST: ListFonts
	           max-names: ffff
	             pattern: "-*-monaco-*"
0.01: 					1024 bytes <-- X11 Server (pid 6304 Xorg)
					 ..............REPLY: ListFonts
					               names: (19)
0.01: Client (pid 7136 xlsfonts) -->   24 bytes
	 ............REQUEST: QueryExtension
	                name: "XFree86-Bigfont"
0.01: 					  32 bytes <-- X11 Server (pid 6304 Xorg)
					 ..............REPLY: QueryExtension
					             present: False
					        major-opcode: 00
					         first-event: 00
					         first-error: 00
0.01: Client (pid 7136 xlsfonts) -->   76 bytes
	 ............REQUEST: OpenFont
	             font-id: FNT 02000001
	                name: "-misc-monaco-medium-r-normal--0-0-0-0-p-0-adobe-standard"
	 ............REQUEST: QueryFont
	                font: FTB 02000001
0.01: 					  64 bytes <-- X11 Server (pid 6304 Xorg)
					 ..............ERROR: Value
					           bad value: 33554433
					        minor opcode: 0000
					        major opcode: 2d
					 ..............ERROR: Font
					     bad resource id: 02000001
					        minor opcode: 0000
					        major opcode: 2f
0.01: Client (pid 7136 xlsfonts) --> EOF

---

I'm going to start digging around in the server sources to see what might be going on, but I wanted to see if anyone has any insights before I start spelunking through code I know nothing about ;)


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.x.org/archives/xorg-devel/attachments/20220630/4337ecdb/attachment-0001.htm>


More information about the xorg-devel mailing list