How to configure MATLAB to display Russian (Cyrillic) characters correctly in figures on Linux?

I have installed MATLAB R2008b on Ubuntu 12.04.4 LTS and Windows XP. The system locale in Ubuntu is Unicode en_US.UTF-8.

For Windows compatibility, I run MATLAB on Ubuntu with the ru_RU.CP1251 locale - so I have a simple script to start MATLAB:

 cat /opt/MATLAB_R2008b/bin/matlab-run
 #!/bin/bash
 export LANG="ru_RU.CP1251";
 export LC_ALL="ru_RU.CP1251";
 /opt/MATLAB_R2008b/bin/matlab -desktop

      

The slCharacterEncoding and ('DefaultCharacterSet') function then returns the expected windows-1251 as expected.

There are many fonts on my system, almost all support Russian (Cyrillic) glyphs. Russian text is usually displayed in uicontrol (see screenshot enter image description here)

uicontrol('String','=Russian','Position',[0 0 200 200])

      

but does not contain labels and headers, so

 x = linspace(0,2*pi,100); y = sin(x);
 xlabel('x,  ','interpreter','none');
 ylabel('y,  sin(x)','interpreter','none');
 title('y,  sin(x)','interpreter','none');

      

produce incorrect characters in labels and title see screenshot.

I have no idea how to fix this. How to configure MATLAB to display Russian (Cyrillic) characters correctly in figures on Linux?

+3


source to share


1 answer


I solved my problem.

I installed all the fonts recommended - packages xfonts-100dpi

, xfonts-75dpi

, xfonts-cyrillic

, t1-cyrillic

, cm-super

, ttf-freefont

, gsfonts-x11

.

But what's interesting is that these fonts only work for UTF-8, so I can use the following fonts to display Russian (Cyrillic) text in numbers:

  • clean
  • free vanguard
  • free bookmaker
  • free office
  • free courier
  • free helium
  • free paladin
  • free study book
  • free time
  • oldslavic
  • tahoma guap
  • Commands
  • terminus

For my original problem, I found a custom ttf-font file that works as expected and the Russian (Cyrillic) text looks as expected in CP / Windows-1251 Font.screenshot



I put this font /usr/local/share/fonts/truetype

, launched mkfontscale

, mkfontdir

and fc-cache -vf

adding this place /etc/X11/xorg.conf

:

    Section "Files"
        FontPath "/usr/share/fonts/truetype"
        FontPath "/usr/local/share/fonts/truetype"
    EndSection

      

...

I installed language-pack-ru

and edited /var/lib/locales/supported.d/local

as follows:

en_US.UTF-8 UTF-8
ru_RU ISO-8859-5
ru_RU.CP1251 CP1251
ru_RU.KOI8-R KOI8-R

      

+2


source







All Articles