Font problems with Flash and linux

There's a "well known" bug in all recent Flash Player versions on the linux platform published in the last couple of years. It makes it impossible to display text with the proper fonts in certain languages using an out-of-the-box linux + Flash Player installation. In the linked bugreport people already figured out the solution: one has to specify a font with the required language coverage in the fontconfig configuration.

I'm using Ubuntu, thus the fix of altering /etc/fonts/conf.d/49-sansserif.conf seemed to be an acceptable solution. However replacing the default font family names with a specific font name is far from perfect. Most fonts shipped with Ubuntu provide support for only one (or a couple of) language(s). I've googled a bit in the area and found that Microsoft created/bought the Arial Unicode MS font just for this purpose: to have a unicode/truetype font that supports the full unicode range ... thus they can use it as a "universal" font.

Now if you've this font available (preferably the 1.01 version from a recent MS Office, the filename is arialuni.ttf), then don't hesitate. Copy the font into /usr/local/share/fonts (create the directory if it does not yet exist), alter the 49-sansserif.conf fontconfig file and recreate the fontconfig cache. After a restart of your browser you should be able to see all sorts of texts in all languages in Flash.

Here're the commands I used for Ubuntu Karmic (you should be running them as root):
$ [ ! -d /usr/local/share/fonts ] && mkdir -p /usr/local/share/fonts
$ wget 'http://example.com/arialuni.ttf' # download the font from somewhere
$ cp arialuni.ttf /usr/local/share/fonts && rm arialuni.ttf
$ chown -R root:staff /usr/local/share/fonts
$ chmod -R u=rwX,go=rX /usr/local/share/fonts
$ rm /etc/fonts/conf.d/49-sansserif.conf
$ cat <<EOH > /etc/fonts/conf.d/49-sansserif.conf
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<!--
  If the font still has no generic name, add sans-serif
-->
        <match target="pattern">
                <test qual="all" name="family" compare="not_eq">
                        <string>Arial Unicode MS</string>
                </test>
                <test qual="all" name="family" compare="not_eq">
                        <string>Arial Unicode MS</string>
                </test>
                <test qual="all" name="family" compare="not_eq">
                        <string>Arial Unicode MS</string>
                </test>
                <edit name="family" mode="append_last">
                        <string>Arial Unicode MS</string>
                </edit>
        </match>
</fontconfig>
EOH
$ chown root:root /etc/fonts/conf.d/49-sansserif.conf
$ chmod u=rw,go=r /etc/fonts/conf.d/49-sansserif.conf
$ fc-cache -f -v

PS: in the bugreport most people complained about missing Chinese characters in textareas in Flash. In my case I had Hindi text (replaced with squares due to the font problem) and the above workaround fixed it nicely. I do not know much about Chinese typography ... it is possible that this "Arial Unicode MS" font has no full support for the various Chinese charactersets, so some people would still have to use a specific Chinese font as the default fallback in their fontconfig configuration.