Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

X_OpenFont BadValue (integer parameter out of range for operation) #216

Open
duskmoon314 opened this issue Oct 19, 2021 · 26 comments
Open
Assignees
Labels
Fonts Issues related to fonts Need Info Further information is requested
Milestone

Comments

@duskmoon314
Copy link

Hi, I'm trying to use tlmgr's gui which needs X window, so I installed XQuartz 2.8.1 via homebrew.

When I tried to open tlmgr's gui, I got this error message:

Loading local TeX Live database
  (/usr/local/texlive/2021/tlpkg/texlive.tlpdb)
This may take some time, please be patient ...
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:  0x80003e
  Serial number of failed request:  302
  Current serial number in output stream:  303

I have searched and found issue #97 but it seems different (I really don't know 😢 xlsfonts and xclock seems work fine)

Please let me know what information I need to provide to solve this problem.

My environment:

macOS Big Sur 11.6
XQuartz 2.8.1
cpan: /opt/homebrew/bin/cpan script version 1.676, CPAN.pm version 2.28
# (I used cpan to install Tk, and when running tlmgr it told me to install X window)

Any help will be appreciated.

@medranocalvo
Copy link

This error can be reproduced using xfontsel:

  1. Select linotype fndry
  2. Select times fmly
  3. Following error appears:
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:  0x600001
Serial number of failed request:  9
Current serial number in output stream:  10

We can observe an apparent inconsistency when running xlsfonts: when requesting listing attributes of the fonts, a much smaller list is returned.

A) List matching fonts:

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

B) List attributes as well:

$ xlsfonts -l -fn '-linotype-times-*'
DIR  MIN  MAX EXIST DFLT PROP ASC DESC NAME
-->    0  255  some    0   36  16    4 -linotype-times-medium-r-normal--0-0-0-0-p-0-iso8859-1
-->    0  255  some    0   36  16    4 -linotype-times-medium-r-normal--0-0-0-0-p-0-iso8859-2
-->    0  255  some    0   36  12    4 -linotype-times-medium-r-normal--0-0-0-0-p-0-iso8859-5

C) List properties as well:

$ xlsfonts -ll -fn '-linotype-times-*'
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:  0x600001
  Serial number of failed request:  9
  Current serial number in output stream:  10

The issue seems related to the fonts found via the /opt/X11/share/system_fonts entry in the Font Path.


The issue happens in Monterrey 12.2.1; I think the title should be changed to "X_OpenFont BadValue (integer parameter out of range for operation)"

@duskmoon314 duskmoon314 changed the title BadValue when using with tlmgr on M1 Big Sur X_OpenFont BadValue (integer parameter out of range for operation) Mar 5, 2022
@jeremyhu jeremyhu added this to the 2.8.2 milestone Jun 12, 2022
@jeremyhu
Copy link
Member

Can you explain how this is related to /opt/X11/share/system_fonts?

@jeremyhu jeremyhu added the Need Info Further information is requested label Jun 15, 2022
@jeremyhu
Copy link
Member

#217 (dupe) has some sample code to try and reproduce this.

@duskmoon314
Copy link
Author

Several weeks ago, I install mactex-no-gui via homebrew to replace the previous tex-live 2021. And I can use tlmgr's GUI with XQuartz out of problem now.

I have no idea about the detail of this problem. orz

Maybe @medranocalvo can explain.

@jeremyhu
Copy link
Member

I think I see one possible issue. We don't wait for font caching to complete before starting up the server. In both places that we cache fonts (system and user), we push the caching into the background. I don't remember why we did that, but it seems like a clear race condition.

/opt/X11/etc/X11/xinit/privileged_startx.d/20-font_cache
/opt/X11/bin/startx

I actually just hit this myself, and it was resolved by running xset fp= "/opt/X11/share/fonts/misc/,/opt/X11/share/fonts/TTF/,/opt/X11/share/fonts/OTF,/opt/X11/share/fonts/Type1/,/opt/X11/share/fonts/75dpi/:unscaled,/opt/X11/share/fonts/100dpi/:unscaled,/opt/X11/share/fonts/75dpi/,/opt/X11/share/fonts/100dpi/,/Library/Fonts,/opt/X11/share/system_fonts,built-ins", so that seems to indicate that at least in my case, it was caused by that race condition here.

@nello
Copy link

nello commented Jun 19, 2022

This did not work for me on my M1 Macbook Pro running the latest 12.4 Monterey.

If I select any of the system ttf fonts from /opt/X11/share/system_fonts in xfontsel or try to use them for an xterm I get:

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:  0xe00045
  Serial number of failed request:  1800
  Current serial number in output stream:  1801

Checking the current settings:

-> xset q
Keyboard Control:
  auto repeat:  on    key click percent:  0    LED mask:  00000000
  XKB indicators:
    00: Caps Lock:   off    01: Num Lock:    off    02: Shift Lock:  off
    03: Group 2:     off    04: Mouse Keys:  off    05: Scroll Lock: off
  auto repeat delay:  525    repeat rate:  11
  auto repeating keys:  ffffffffffffff7f
                        00ffffffffffffff
                        ffffffffffffffff
                        ffffffffffffffff
  bell percent:  50    bell pitch:  400    bell duration:  100
Pointer Control:
  acceleration:  2/1    threshold:  4
Screen Saver:
  prefer blanking:  yes    allow exposures:  yes
  timeout:  600    cycle:  600
Colors:
  default colormap:  0x21    BlackPixel:  0x0    WhitePixel:  0xffffff
Font Path:
  /opt/X11/share/fonts/misc/,/opt/X11/share/fonts/TTF/,/opt/X11/share/fonts/OTF,/opt/X11/share/fonts/Type1/,/opt/X11/share/fonts/75dpi/:unscaled,/opt/X11/share/fonts/100dpi/:unscaled,/opt/X11/share/fonts/75dpi/,/opt/X11/share/fonts/100dpi/,/Library/Fonts,/opt/X11/share/system_fonts,built-ins
DPMS (Energy Star):
  Server does not have the DPMS Extension

Trying the above solution:

xset fp= "/opt/X11/share/fonts/misc/,/opt/X11/share/fonts/TTF/,/opt/X11/share/fonts/OTF,/opt/X11/share/fonts/Type1/,/opt/X11/share/fonts/75dpi/:unscaled,/opt/X11/share/fonts/100dpi/:unscaled,/opt/X11/share/fonts/75dpi/,/opt/X11/share/fonts/100dpi/,/Library/Fonts,/opt/X11/share/system_fonts,built-ins"

Still gives the same error when I attempt to select the Monaco font in xfontsel.

@jeremyhu
Copy link
Member

@nello What is the invocation you are using? What is the output of xlsfonts?

@nello
Copy link

nello commented Jun 19, 2022

The output of xlsfonts is over 10,000 lines :)

It does contain Monaco fonts:

-misc-monaco-medium-r-normal--0-0-0-0-p-0-adobe-standard
-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-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-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-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-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-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-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-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-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-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-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-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-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-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-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-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-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-koi8-uni
-misc-monaco-medium-r-normal--0-0-0-0-p-0-microsoft-cp1252
-misc-monaco-medium-r-normal--0-0-0-0-p-0-microsoft-cp1252

@nello
Copy link

nello commented Jun 20, 2022

I can't select Monaco in xfontsel or find a way to use it for my xterm font that works for me. I've tried adding it to .Xresources, and using -fb -fa -font -fn etc. but admit that I'm pretty confused about how this should work.

@jeremyhu
Copy link
Member

@nello Can you give me your exact invocations?

@nello
Copy link

nello commented Jun 20, 2022

Hi, thanks for looking at this. In .Xresources, this seems to work:

xterm*font:		-*-lucidatypewriter-medium-*-normal-*-12-*-*-*-*-*-*-*

This (and every variation of it I have tried!) does not - xterm will not even load, even though all those varieties of Monaco are apparently installed on my system:

xterm*font:             -misc-monaco-medium-*-normal-*-12-*-*-*-*-*-*-*

Is that what you mean by "invocations"?

@jeremyhu jeremyhu reopened this Jun 20, 2022
@jeremyhu
Copy link
Member

By invocations, I want to know how you are invoking xfontselect. What is the exact command line you are using?

@medranocalvo
Copy link

Hello @jeremyhu,

Can you explain how this is related to /opt/X11/share/system_fonts?

The only relation is that the issue stops manifesting when removing /opt/X11/share/system_fonts from the font path.


Changing the font path as you suggested does not help (commands are lines starting with $):

$ xset fp= "/opt/X11/share/fonts/misc/,/opt/X11/share/fonts/TTF/,/opt/X11/share/fonts/OTF,/opt/X11/share/fonts/Type1/,/opt/X11/share/fonts/75dpi/:unscaled,/opt/X11/share/fonts/100dpi/:unscaled,/opt/X11/share/fonts/75dpi/,/opt/X11/share/fonts/100dpi/,/Library/Fonts,/opt/X11/share/system_fonts,built-ins"
$ xlsfonts -fn '-linotype-helvetica-*'
-linotype-helvetica-medium-r-normal--0-0-0-0-p-0-adobe-standard
-linotype-helvetica-medium-r-normal--0-0-0-0-p-0-ascii-0
-linotype-helvetica-medium-r-normal--0-0-0-0-p-0-iso10646-1
-linotype-helvetica-medium-r-normal--0-0-0-0-p-0-iso8859-1
-linotype-helvetica-medium-r-normal--0-0-0-0-p-0-iso8859-10
-linotype-helvetica-medium-r-normal--0-0-0-0-p-0-iso8859-13
-linotype-helvetica-medium-r-normal--0-0-0-0-p-0-iso8859-15
-linotype-helvetica-medium-r-normal--0-0-0-0-p-0-iso8859-16
-linotype-helvetica-medium-r-normal--0-0-0-0-p-0-iso8859-2
-linotype-helvetica-medium-r-normal--0-0-0-0-p-0-iso8859-3
-linotype-helvetica-medium-r-normal--0-0-0-0-p-0-iso8859-4
-linotype-helvetica-medium-r-normal--0-0-0-0-p-0-iso8859-5
-linotype-helvetica-medium-r-normal--0-0-0-0-p-0-iso8859-7
-linotype-helvetica-medium-r-normal--0-0-0-0-p-0-iso8859-9
-linotype-helvetica-medium-r-normal--0-0-0-0-p-0-koi8-e
-linotype-helvetica-medium-r-normal--0-0-0-0-p-0-koi8-r
-linotype-helvetica-medium-r-normal--0-0-0-0-p-0-koi8-ru
-linotype-helvetica-medium-r-normal--0-0-0-0-p-0-koi8-u
-linotype-helvetica-medium-r-normal--0-0-0-0-p-0-koi8-uni
-linotype-helvetica-medium-r-normal--0-0-0-0-p-0-microsoft-cp1252
-linotype-helvetica-medium-r-normal--0-0-0-0-p-0-suneu-greek
INSERT   $ xlsfonts -l -fn '-linotype-helvetica-*'
DIR  MIN  MAX EXIST DFLT PROP ASC DESC NAME
-->    0  255  some    0   36  16    4 -linotype-helvetica-medium-r-normal--0-0-0-0-p-0-iso8859-1
-->    0  255  some    0   36  16    4 -linotype-helvetica-medium-r-normal--0-0-0-0-p-0-iso8859-2
-->    0  255  some    0   36  13    4 -linotype-helvetica-medium-r-normal--0-0-0-0-p-0-iso8859-5
$ xlsfonts -ll -fn '-linotype-helvetica-*'
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

The font comes from Helvetica.ttc, as per fonts.dir:

$ grep -i -e '-linotype-helvetica-' /opt/X11/share/system_fonts/fonts.dir
Helvetica.ttc -linotype-helvetica-medium-r-normal--0-0-0-0-p-0-adobe-standard
Helvetica.ttc -linotype-helvetica-medium-r-normal--0-0-0-0-p-0-ascii-0
Helvetica.ttc -linotype-helvetica-medium-r-normal--0-0-0-0-p-0-iso10646-1
Helvetica.ttc -linotype-helvetica-medium-r-normal--0-0-0-0-p-0-iso8859-1
Helvetica.ttc -linotype-helvetica-medium-r-normal--0-0-0-0-p-0-iso8859-10
Helvetica.ttc -linotype-helvetica-medium-r-normal--0-0-0-0-p-0-iso8859-13
Helvetica.ttc -linotype-helvetica-medium-r-normal--0-0-0-0-p-0-iso8859-15
Helvetica.ttc -linotype-helvetica-medium-r-normal--0-0-0-0-p-0-iso8859-16
Helvetica.ttc -linotype-helvetica-medium-r-normal--0-0-0-0-p-0-iso8859-2
Helvetica.ttc -linotype-helvetica-medium-r-normal--0-0-0-0-p-0-iso8859-3
Helvetica.ttc -linotype-helvetica-medium-r-normal--0-0-0-0-p-0-iso8859-4
Helvetica.ttc -linotype-helvetica-medium-r-normal--0-0-0-0-p-0-iso8859-5
Helvetica.ttc -linotype-helvetica-medium-r-normal--0-0-0-0-p-0-iso8859-7
Helvetica.ttc -linotype-helvetica-medium-r-normal--0-0-0-0-p-0-iso8859-9
Helvetica.ttc -linotype-helvetica-medium-r-normal--0-0-0-0-p-0-koi8-e
Helvetica.ttc -linotype-helvetica-medium-r-normal--0-0-0-0-p-0-koi8-r
Helvetica.ttc -linotype-helvetica-medium-r-normal--0-0-0-0-p-0-koi8-ru
Helvetica.ttc -linotype-helvetica-medium-r-normal--0-0-0-0-p-0-koi8-u
Helvetica.ttc -linotype-helvetica-medium-r-normal--0-0-0-0-p-0-koi8-uni
Helvetica.ttc -linotype-helvetica-medium-r-normal--0-0-0-0-p-0-microsoft-cp1252
Helvetica.ttc -linotype-helvetica-medium-r-normal--0-0-0-0-p-0-suneu-greek

I initially thought it was related to the TTC format, but other fonts such as "Optima.ttc" do not produce the error.

Hope this helps. Let me know if I can help.

(Sorry for the late answer.)

@nello
Copy link

nello commented Jun 20, 2022

I type xfontsel at the command line. Then select Monaco and boom!

Screen.Recording.2022-06-20.at.20.June.19.56.54.mov

@jeremyhu jeremyhu self-assigned this Jun 26, 2022
@jeremyhu
Copy link
Member

Please confirm if I'm wrong, but it looks like this is an old issue and not a recent regression. I'm seeing this occur with XQuartz 2.7.11 running on macOS 10.13.

@jeremyhu
Copy link
Member

jeremyhu commented Jul 1, 2022

I'm able to repdouce it on an Ubuntu machine as well with
Monaco.ttf, so it's not something unique to XQuartz.

Unfortunately, I'm having some troubles getting xscope working on darwin right now, but on Ubuntu, here's what I see:

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...

@nello
Copy link

nello commented Jul 1, 2022

Thanks Jeremy. I didn't manage to get to this yesterday, so apologies. I can confirm that it does seem to be an old bug though. I've reproduced now on an older machine.

@jeremyhu jeremyhu modified the milestones: 2.8.2, 2.8.3 Jul 1, 2022
@jeremyhu
Copy link
Member

jeremyhu commented Jul 2, 2022

I also started a thread on xorg-devel to see if anyone there had some thoughts: https://lists.x.org/archives/xorg-devel/2022-July/058848.html

@svi-os
Copy link

svi-os commented Dec 19, 2022

This issue also causes crashes in other applications that use tk, see https://core.tcl-lang.org/tk/tktview?name=36e379c01b

We could also reproduce the issue on our own machine (apple silicon based with Big Sur, Xquarts 2.8.3). To further diagnose the problem we used the following shell script to detect fonts that are giving errors:

#!/bin/bash

outputFileBad="problemFonts.txt"
if [ -f $outputFileBad ] ; then
rm -v $outputFileBad
fi

outputFileGood="goodFonts.txt"
if [ -f $outputFileGood ] ; then
rm -v $outputFileGood
fi

fontList=xlsfonts
goodCnt=0
badCnt=0

OLDIFS=$IFS
IFS='
'

for font in $fontList ; do
echo "Testing font '$font'"
result=xlsfonts -ll -fn $font > /dev/null
R=$?
if [ $R -ne 0 ] ; then
echo $font >> $outputFileBad
let badCnt=badCnt+1
else
echo $font >> $outputFileGood
let goodCnt=goodCnt+1
fi
done
IFS=$OLDIFS
echo "Result: $goodCnt good fonts and $badCnt bad fonts found."

if [ $badCnt -gt 0 ] ; then
echo "The problematic fonts are listed in file $outputFile."
fi

This script found 10000+ "good" fonts and 477 "bad" ones. See problemFonts.txt for the latter ones. All of the problematic fonts seem to have the pattern "0-0-0-0-p-0" or "0-0-0-0-m-0", which seem to be much rarer in the good fonts.

@svi-os
Copy link

svi-os commented Dec 20, 2022

On Ventura we also detected two fonts that give errors but have a different pattern:

-misc-gb18030 bitmap-thin-r-ultracondensed--0-0-75-2147483647-c-0-cns11643-2
-misc-gb18030 bitmap-thin-r-ultracondensed--0-0-75-2147483647-c-0-iso10646-1

@jeremyhu jeremyhu added the Fonts Issues related to fonts label Jan 10, 2023
@jeremyhu jeremyhu modified the milestones: 2.8.5, 2.8.6 Jan 18, 2023
@jeremyhu
Copy link
Member

@nello Is Monaco the only font impacted by this issue? We can add it to the list of fonts skipped when setting up the font dir symlinks like we did for NISC18030.ttf in #304

@nello
Copy link

nello commented Jan 27, 2023 via email

@jeremyhu
Copy link
Member

jeremyhu commented Jan 27, 2023

Are the problematic ones all Apple system fonts, or are some of the problematic ones from Xorg?

If I can show this happening with an Xorg-provided font, that might help get some traction...

@nello
Copy link

nello commented Jan 27, 2023 via email

@svi-os
Copy link

svi-os commented Jan 30, 2023

The file problemFonts.txt in our update above has a list of fonts that give errors when queried with xlsfonts -ll -fn , would that be helpful? That file is for Big Sur but we also have lists for Lion and Ventura if that would be helpful.

@jazz64
Copy link

jazz64 commented Jun 13, 2024

While implementing the X protocol in Kotlin/JVM, I ran in the same problem. The bad-value error gives the font id. But as I learnt here, it is an internal server problem. Is there a solution in sight?

andreas-kupries pushed a commit to tcltk/tk that referenced this issue Jul 3, 2024
andreas-kupries pushed a commit to tcltk/tk that referenced this issue Jul 3, 2024
andreas-kupries pushed a commit to tcltk/tk that referenced this issue Jul 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Fonts Issues related to fonts Need Info Further information is requested
Projects
None yet
Development

No branches or pull requests

6 participants