Google Chrome has problem displaying hindi/unicode and other Indian language fonts.
For example bold hindi fonts might be displayed as square boxes.
http://code.google.com/p/chromium/issues/detail?id=32109
http://code.google.com/p/chromium/issues/detail?id=21320
It is some kind of font selection bug.
Lets try fixing it.
1. You may want to install the packages ttf-devanagari-fonts and ttf-indic-fonts. Also get that mangal.ttf thing from windows or somewhere.
If that solves the problem , fine , otherwise continue.
2. Lets say for hindi , find which font file ubuntu would use by default.
Look into this file :
/etc/fonts/conf.avail/90-ttf-devanagari-fonts.conf or something similar.
gargi font might be the first font ubuntu uses for hindi.
3. Edit fonts.conf file :
In your home directory there is a hidden .fonts.conf file
Open it and add this at the end before :
[xml]
<!-- Hindi (hi) -->
<match target="pattern">
<test compare="eq" name="lang">
<string>hi</string>
</test>
<edit binding="strong" mode="prepend" name="family">
<string>Lohit Hindi</string>
</edit>
</match>
<match target="font">
<test compare="eq" name="family" qual="any">
<string>gargi</string>
<string>Lohit Hindi</string>
</test>
<edit mode="assign" name="antialias">
<bool>true</bool>
</edit>
<edit mode="assign" name="autohint">
<bool>true</bool>
</edit>
<edit mode="assign" name="hintstyle">
<const>hintslight</const>
</edit>
</match>
<match target="pattern">
<test compare="eq" name="family" qual="any">
<string>mangal</string>
</test>
<edit binding="strong" mode="assign" name="family">
<string>Lohit Hindi</string>
</edit>
</match>
<!-- Hindi (hi) ends -->
</fontconfig>
[/xml]
This will basically force to use gargi fonts for hindi.
This part forces Lohit Hindi for hindi characters
[xml]
<match target="pattern">
<test compare="eq" name="lang">
<string>hi</string>
</test>
<edit binding="strong" mode="prepend" name="family">
<string>Lohit Hindi</string>
</edit>
</match>
[/xml]
if mode="append" is used , then firefox will use gargi which is the default font.
Hence prepend seems to work fine
This part replaces mangal with Lohit Hindi :
[xml]
<match target="pattern">
<test compare="eq" name="family" qual="any">
<string>mangal</string>
</test>
<edit binding="strong" mode="assign" name="family">
<string>Lohit Hindi</string>
</edit>
</match>
[/xml]
The rest of the xml applies antialiasing to make the fonts look good. Lohit Hindi seems to be clearer and proper sized than gargi. hintfull tends to stretch the characters.
Now open google chrome and see if hindi fonts are showing fine.
This same solution can be applied to other languages like hindi , gujrati , tamil , kannada etc.
References :
1. http://www.freedesktop.org/software/fontconfig/fontconfig-user.html
2. https://wiki.ubuntu.com/Fonts
I am on ubuntu 12.04 and there is no .fonts.conf file in $HOME directory
With the use of {edit name=”family” mode=”append” binding=”strong”} type configuration or its variant with binding=”same” as in some of the 90-ttf-xxx-fonts.conf files in /etc/conf.avail, I find there are unacceptable side effects to matchings for other languages.
Suppose the .fonts.conf has only the fontconfig statements you show above, i.e., binding the meta fonts to “gargi” for Hindi. Now use each of the following commands from a terminal to check the status of matchings first for Hindi and then for any other non-Devangiri using Indic language – say for Tamil:
For Hindi:
fc-match Sans:lang=hi
fc-match Serif:lang=hi
fc-match Mono:lang=hi
For Tamil
fc-match Sans:lang=ta
fc-match Serif:lang=ta
fc-match Mono:lang=ta
Now provided “gargi” font is installed,
For Hindi you should be getting “gargi” for all 3 meta fonts.
And for Tamil I see the results yield correctly only in case for Serif but for Sans and Mono wrong match as “gargi”
In the .fonts.conf you can also include for more than language by copying from 90-ttf… files for different languages and editing for the type of bind etc. But I have found the exercise to open more cans of worms. Always the problems are that the matching for some Indic language for one or more of “Sans”, “Serif” and “Mono” would dominate over corresponding matchings of other Indic (plus Sinhala too) scripts.
In fact even without user’s own .fonts.conf the system defaults get dominated from the sym links /etc/fonts/conf.d/90-ttf-xxxxx.conf (xxxx are different languages) again one Inidc language dominating all for “Serif”.
In case of Tamil the comment statements in 90-ttf-tamil-fonts.conf clearly indicate the purposes of the configuration to include that the TSC* and TAM* type Tamil fonts are to be never picked by the Fontconfig. However in reality it fails to do that. If TSCu_Paranar is installed then with the default config tree including the 90-ttf-tamil-fonts.conf it is still matched to “Sans” !
Regarding the concerned bug for Tamil contents Google Chrome / Chromium-browser on Ubuntu or Debian running on English (or some other non-Tamil locale) I wish to point out the fundamental problem to solve is that the Chrome / Chromium-browser is not like other applications like Firefox, gedit, in taking and using Fontconfig’s matching. In the absence of TSCu_Paranar why should Chrome / Chromium-browser choose FreeSerif which is not advocated in Fontconfig. Shouldn’t it also choose Lohit Tamil like the other applications do?
K. Sethu