nrc-cnrc / EGSnrc

Toolkit for Monte Carlo simulation of ionizing radiation — Trousse d'outils logiciels pour la simulation Monte Carlo du rayonnement ionisant
http://nrc-cnrc.github.io/EGSnrc
GNU Affero General Public License v3.0
216 stars 146 forks source link

BadName error while running dosxyz_show #562

Open ziwanxu opened 4 years ago

ziwanxu commented 4 years ago

I got the Badname error when running dosxyz_show. After following the manual (get_started Page 60) by tapping: dosxyz_show slice_files.egsphant example.3ddose I got the following report: ······ 128 gray shades allocated. X Error of failed request: BadName (named color or font does not exist) major opcode of failed request: 45 (X_OpenFont) Serial number of failed request: 769 Current serial number in output stream: 772

After checking the dosxyz_show.c file in &EGSnrc/HEN_HOUSE/omega/dosxyz_show, I found there are font names such as "courier-bold140*iso8859-1". Is the error related with the name format here? I do have installed the courier font in /usr/share/fonts/X11/100dpi with names such as courB014.pcf Can anyone help me solve the problem? Thanks!

rtownson commented 4 years ago

Try removing that font line in dosxyz_show.c and recompiling. E.g. at line 232 replace "*fontList: *courier-bold*140*iso8859-1", with //"*fontList: *courier-bold*140*iso8859-1", Then recompile (make clean; make). Let me know if that works for you.

ziwanxu commented 4 years ago

Thanks for your reply. I tried your method, removing the font line and recompiling both dosxyz_show (~/EGSnrc/HEN_HOUSE/omega/progs/dosxyz_show) and dosxyznrc (~/EGSnrc/egs_home/dosxyznrc). However, I still got the BadName error. { ······ 128 gray shades allocated. X Error of failed request: BadName (named color or font does not exist) major opcode of failed request: 45 (X_OpenFont) Serial number of failed request: 765 Current serial number in output stream: 768 } Btw, I am using EGSnrc in Oracle VM VirtualBox 6.0 with Lubuntu (18.04) after following the installation instructions (https://github.com/nrc-cnrc/EGSnrc/wiki/install-EGSnrc-on-VirtualBox).

ziwanxu commented 4 years ago

Try removing that font line in dosxyz_show.c and recompiling. E.g. at line 232 replace "*fontList: *courier-bold*140*iso8859-1", with //"*fontList: *courier-bold*140*iso8859-1", Then recompile (make clean; make). Let me know if that works for you.

It doesn't work. Are there other possible reasons?

rtownson commented 4 years ago

Hmm that's strange - I followed the same instructions to install it on my Windows 10 laptop and installed Lubuntu 18.10. Then I generated an egsphant file using the sample data (as suggested in the getting-started manual) and dosxyz_show was able to view it without errors. I haven't tried 18.04 but would expect pretty minimal differences.

ziwanxu commented 4 years ago

Hmm that's strange - I followed the same instructions to install it on my Windows 10 laptop and installed Lubuntu 18.10. Then I generated an egsphant file using the sample data (as suggested in the getting-started manual) and dosxyz_show was able to view it without errors. I haven't tried 18.04 but would expect pretty minimal differences.

I tried both on my desktop and laptop (Windows 10), but the error is the same. Do you need me to provide any files for you to check?

rtownson commented 4 years ago

I reproduced this error on Lubuntu 18.04, but after trying a wide range of font packages have no solution.

The workaround for now might be just to switch to 18.10 or a different Lubuntu version. Alternatively, use CERR, statdose or some other tool to view dose. As of recently you can even load dose in egs_view (but it doesn't do isodose lines, so it's pretty limited). dosxyz_show is really just a qualitative tool, after all.

ziwanxu commented 4 years ago

Dosxyz_show initial gui Dosxyz_show after click

I reproduced this error on Lubuntu 18.04, but after trying a wide range of font packages have no solution.

The workaround for now might be just to switch to 18.10 or a different Lubuntu version. Alternatively, use CERR, statdose or some other tool to view dose. As of recently you can even load dose in egs_view (but it doesn't do isodose lines, so it's pretty limited). dosxyz_show is really just a qualitative tool, after all.


Thank you so much. I followed the webpage (https://linuxconfig.org/how-to-upgrade-ubuntu-to-18-10-cosmic-cuttlefish) to upgrade to 18.10, and followed another webpage (https://ubuntuforums.org/showthread.php?t=2349421) to install msttcorefonts. So it now works on my laptop. However, after I repeated the procedures on my desktop this morning, it seems that it's upgraded to 19.04. And when I tried to run dosxyz_show, the gui showed up but incompletely. And the same warning 'Cannot convert string "courier-bold140*iso8859-1" to type FontStruct' appeared again. Interestingly, more button will show up after I click on its position.

rtownson commented 4 years ago

That's pretty strange! You could try playing around with that font line - commenting it out, changing it to courier-*, etc. and recompiling. The issue is pretty low priority for us to fix because we are looking at replacing this tool. At least you have one system working.

Alongside the other suggestions that I had for alternatives, there is 3ddose_tools from Carleton: https://physics.carleton.ca/clrp/3ddose_tools/3ddose-tools

ziwanxu commented 4 years ago

That's pretty strange! You could try playing around with that font line - commenting it out, changing it to courier-*, etc. and recompiling. The issue is pretty low priority for us to fix because we are looking at replacing this tool. At least you have one system working.

Alongside the other suggestions that I had for alternatives, there is 3ddose_tools from Carleton: https://physics.carleton.ca/clrp/3ddose_tools/3ddose-tools It worked out fine after I further upgraded it to lubuntu 19.10. No idea what's going on, but problem is solved. Thanks!

lixinzhan commented 3 years ago

Noticed this thread while having the same issue with my installation on CentOS 7. Here is my solution:

yum install xorg-x11-fonts-misc.

For Ubuntu, there is no fonts package xorg-x11-fonts-misc, but I am pretty sure you can resolve it similarly by installing all/some x11 fonts.