How do I change the font used by the different uicontrols & uimenus under X-Windows/Motif?

6 views (last 30 days)
I get black rectangles or dotted squares in place of my text in uimenus when running MATLAB under UNIX or LINUX.

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 27 Jun 2009
As of MATLAB 6.5 (R13), setting the default font properties in .Xdefaults resolves the fonts problem.
The font problem appears in Redhat 7.3 systems with remote VNC. However the font problem does not affect VNC in Redhat 6.2 or if the display is exported through SSH from Redhat 7.3 and displayed in Redhat 6.2 VNC session.
Note the following:
1. If the fonts are not set correctly, the push buttons and the tool tips texts in the figure (tool tips of icons and text in figure) are corrupted.
2. VNC font properties also need to be set by using "xset" to set the path of fonts directory. For example append the following in the xstartup script of VNC (normally reside in ~/.vnc/xstartup), this will remove warning message in the MATLAB command window during startup regarding missing adobe-helvetica and etc fonts:
xset fp= /usr/lib/X11/fonts/misc/,/usr/lib/X11/fonts/75dpi/,/usr/lib/X11/fonts/S
peedo/,/usr/lib/X11/fonts/Type1/,/usr/lib/X11/fonts/misc/,unix/:7100,/usr/X11R6/
lib/X11/fonts/100dpi/
(Note the inclusion of unix/:7100 in the font paths. )
The following is the final .Xdefaults file, which resolves all of the issues, including uimenu and tool tips as well as button text:
Note that not only the checkboxes and radiobuttons text need to be appended with iso8859-1, but also the default fonts.
!
! ...................FONT SPECIFICATIONS:
!
! .........................DEFAULT:
*fontList:
-*-helvetica-medium-r-normal--12-*-*-*-*-*-*-iso8859-1
! ...................Figure window text font:
figure*fontList:
-*-helvetica-medium-r-normal--12-*-*-*-*-*-*-iso8859-1
! ...................Figure window exponent text font
figure*expfontList:
-*-helvetica-medium-r-normal--10-*-*-*-*-*-*-iso8859-1
! Checkboxes and Radiobuttons
figure*XmToggleButton*fontList: *-courier-medium-r-normal--14-*-*-*-*-*-iso8859-1
! Pushbuttons
figure*XmPushButton*fontList: *-times-medium-r-normal--14-*-*-*-*-*-iso8859-1
! Editable text
figure*XmText*fontList: *-symbol-medium-r-normal--14-*-*-*-*-*-*-*
! Static text
figure*XmLabel*fontList: *-times-medium-r-normal--14-*-*-*-*-*-iso8859-1
! Preserve pulldown menu fonts (otherwise the pushbuttons in
! pulldown menus turn to the XmPushButton fontList setting)
! NOTE: this will also affect PopupMenu uicontrols.
figure*XmRowColumn*fontList: -*-helvetica-medium-r-normal--14-*-*-*-*-*-iso8859-1
For MATLAB 5.3 (R11) and later, the font settings for uicontrols and uimenus need to be defined in the $MATLAB/X11/app-defaults/Matlab X-resource file (where $MATLAB is your root MATLAB directory).
For MATLAB 5.2, these settings are defined in $MATLAB/app-defaults/Matlab.
If these settings are defined in the local .Xdefaults file, they will be ignored.
Below is the relevant portion of the file for MATLAB 6.1 (R12.1):
!
! ...................FONT SPECIFICATIONS:
!
! .........................DEFAULT:
*fontList: -*-helvetica-medium-r-normal--12-*-*-*-*-*-*-*
! ...................Figure window text font:
figure*fontList: -*-helvetica-medium-r-normal--12-*-*-*-*-*-*-*
! ...................Figure window exponent text font
figure*expfontList: -*-helvetica-medium-r-normal--10-*-*-*-*-*-*-*
Here are some examples for changing the defaults:
! Checkboxes and Radiobuttons
figure*XmToggleButton*fontList: *-courier-medium-r-normal--14-*
! Pushbuttons
figure*XmPushButton*fontList: *-times-medium-r-normal--14-*
! Editable text
figure*XmText*fontList: *-symbol-medium-r-normal--14-*
! Static text
figure*XmLabel*fontList: fixed
! Preserve pulldown menu fonts (otherwise the pushbuttons in
! pulldown menus turn to the XmPushButton fontList setting)
! NOTE: this will also affect PopupMenu uicontrols.
figure*XmRowColumn*fontList: -*-helvetica-medium-r-normal--14-*-*-*-*-*-*-*
Here are some general font commands for UNIX (and LINUX) that are useful for checking fonts on your machine:
1. List available fonts:
xlsfonts
For example, list all fonts with a specified pattern:
xlsfonts -fn -*-helvetica-medium-r-normal--12-*-*
2. Check how a particular font looks. For instance, if you get black rectangles or dotted squares in place of your text in uimenus, it may be because the font being selected by the resource file is corrupt, not available, or not the correct type of font. You can check if the font is appropriate by using the following command:
xfontsel
For example,
xfontsel -pattern -*-helvetica-medium-r-normal--12-*-*

More Answers (0)

Categories

Find more on Migrate GUIDE Apps in Help Center and File Exchange

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!