I?m getting an ugly font in mozilla browsers instead of Verdana. The font is hard-coded in the html source, which makes customization via the ~/../profile/../userChrome.css ineffective. Since mozilla browsers ?obtain? their fonts from fontconfig, I thought that I could code the following in /etc/local.conf: <match target="pattern"> <test name="preferred"> <bool>true</bool> </test> <test name="family"> <string>sans-serif</string> </test> <edit name="family" mode="prepend" binding="strong"> <string>Verdana</string> </edit> </match> <match target="pattern"> <edit name="preferred"> <bool>true</bool> </edit> </match> What I?m trying to do is tell fontconfig that any application that asks for ?sans-serif? is directed to ?verdana? instead. Mind you, this must be one of about fifty different versions that I coded with endless variations on the name of the font that I wanted to replace and that I wanted instead, and made any difference: Whatever I coded, ?fc_match -v sans?- or sans-serif, sans\-serif, or "sans-serif", or ''sans'', or ''sans-serif'', or dejavu, dejavu sans, "dejavu sans", "DejaVu Sans", "Dejavu\ Sans", ''Dejavu Sans'', ''Dejavu\ Sans'', ''dejavu'', ''DejaVu'', "DejaVu", etc. etc.? systematically pointed to the DejaVu Sans font. Obviously, each unsuccessful attempt was followed by an ?fc-cache -r?, that completed without any errors. I even rebooted in case fc-cache does not suffice, to no avail. :-( Am I misunderstanding fc-match? Having spent about a week trying to get this to work, read the fonts.conf man page about ten times, googled for a fontconfig tutorial and found nothing, read many threads that discussed this issue, I?m beginning to think I am missing something trivial, but I have no idea why this is not working. In a nutshell, I just want any application that asks for ?sans-serif?, to be redirected to ?verdana? instead. Or am I barking the wrong tree - i.e. the above has nothing to do with what I?m trying to achieve and maybe fontconfig does not provide this capability? Is there anything I can do, short of removing the DejaVu fonts from my system?? Thanks, CJ ? Which would probably not address the issue anyway, sans-serif would just switch to another ugly font and I?d be back to square one.
On 2009/09/22 18:44 (GMT-0400) Chris Jones composed:> I???m getting an ugly font in mozilla browsersIf I knew which distro you are using I might have a solution for you. Not all use the same file(s) for fontconfig aliasing. If you grep through /etc/fonts/*.conf you''ll probably find at least one list of sans-serif fonts with DejaVu Sans at the top, or at least, above Verdana. If you do, reorder the list(s) and see what happens. -- "The Scriptures tell us righteousness exalteth a Nation." 2nd U.S. President, John Adams Team OS/2 ** Reg. Linux User #211409 Felix Miata *** http://fm.no-ip.com/
On Tue, Sep 22, 2009 at 09:29:47PM EDT, Felix Miata wrote:> On 2009/09/22 18:44 (GMT-0400) Chris Jones composed: > > > I''m getting an ugly font in mozilla browsers> If I knew which distro you are using I might have a solution for you. > Not all use the same file(s) for fontconfig aliasing. If you grep > through /etc/fonts/*.conf you''ll probably find at least one list of > sans-serif fonts with DejaVu Sans at the top, or at least, above > Verdana. If you do, reorder the list(s) and see what happens.Well, well, well... I followed your recommendation and it took me about one minute to fix the problem. :-) I run debian, and now I have to find out what the files in the two directories under /etc/fonts are for. At a glance they appear to be extensions of the fonts.conf file and I should likely look in the debian documentation for more information. When I think of the time I spent looking at fonts.conf for something that might be clashing with my aliases.. I should have remembered that debian love splitting config files into a myriad of smaller units, and have a bunch of symlinks to make things a little more difficult. :-) Thanks much for solving this! CJ
Behdad Esfahbod
2009-Sep-23 19:02 UTC
[Fontconfig] <alias> replace dejavu sans with Verdana
What''s the thing with "preferred"? What you want is something like: <match target="pattern"> <test name="family"> <string>sans-serif</string> </test> <edit name="family" mode="prepend_first" binding="strong"> <string>Verdana</string> </edit> </match> Does that not work? behdad On 09/22/2009 06:44 PM, Chris Jones wrote:> I?m getting an ugly font in mozilla browsers instead of Verdana. > > The font is hard-coded in the html source, which makes customization via > the ~/../profile/../userChrome.css ineffective. > > Since mozilla browsers ?obtain? their fonts from fontconfig, I thought > that I could code the following in /etc/local.conf: > > <match target="pattern"> > <test name="preferred"> > <bool>true</bool> > </test> > <test name="family"> > <string>sans-serif</string> > </test> > <edit name="family" mode="prepend" binding="strong"> > <string>Verdana</string> > </edit> > </match> > > <match target="pattern"> > <edit name="preferred"> > <bool>true</bool> > </edit> > </match> > > What I?m trying to do is tell fontconfig that any application that asks > for ?sans-serif? is directed to ?verdana? instead. > > Mind you, this must be one of about fifty different versions that I > coded with endless variations on the name of the font that I wanted to > replace and that I wanted instead, and made any difference: > > Whatever I coded, ?fc_match -v sans?- or sans-serif, sans\-serif, or > "sans-serif", or ''sans'', or ''sans-serif'', or dejavu, dejavu sans, > "dejavu sans", "DejaVu Sans", "Dejavu\ Sans", ''Dejavu Sans'', ''Dejavu\ > Sans'', ''dejavu'', ''DejaVu'', "DejaVu", etc. etc.? systematically pointed > to the DejaVu Sans font. > > Obviously, each unsuccessful attempt was followed by an ?fc-cache -r?, > that completed without any errors. > > I even rebooted in case fc-cache does not suffice, to no avail. :-( > > Am I misunderstanding fc-match? > > Having spent about a week trying to get this to work, read the > fonts.conf man page about ten times, googled for a fontconfig tutorial > and found nothing, read many threads that discussed this issue, I?m > beginning to think I am missing something trivial, but I have no idea > why this is not working. > > In a nutshell, I just want any application that asks for ?sans-serif?, > to be redirected to ?verdana? instead. > > Or am I barking the wrong tree - i.e. the above has nothing to do with > what I?m trying to achieve and maybe fontconfig does not provide this > capability? > > Is there anything I can do, short of removing the DejaVu fonts from my > system?? > > Thanks, > > CJ > > ? Which would probably not address the issue anyway, sans-serif would > just switch to another ugly font and I?d be back to square one. > > > > > _______________________________________________ > Fontconfig mailing list > Fontconfig at lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/fontconfig
On Wed, Sep 23, 2009 at 03:02:04PM EDT, Behdad Esfahbod wrote:> What''s the thing with "preferred"?I assume it adds flexibility, the possibility to switch off the family conversion on the fly, depending on the value of the boolean, although I don?t know how this could be done. I say "I assume" because I found a thread in the list?s archives where Keith Packard recommended this solution and I haven?t had the time to look into it further. Interestingly, just setting my desktop font to verdana 8pt. on a ubuntu 9.04 system, took care of having the hard-coded family=Arial,sans-serif converted to verdana, out of the box, so to speak. Since the ubuntu system is on the same hard drive as my "normal" debian lenny, I was able to take a look at the setup in /etc/fonts/ on that system, and I could not see anything really diffferent from that on debian lenny. Because of this and other reasons, such as the fact that I don''t see ubuntu making changes to the system configuration because one particular happens to favor verdana 8pt., and since there is nothing that looks like a ~/.fontconfig file in my home directory, I suspect that gconf may have something to do with it: the ubuntu system runs the gnome desktop, while I am content to stick with a barebones Window Manager on "lenny". But I will have to boot into that system to investigate further, which is not convenient at this point. Obviously the first thing I''ll do will be to run an fc_match.> What you want is something like: > > <match target="pattern"> > <test name="family"> > <string>sans-serif</string> > </test> > <edit name="family" mode="prepend_first" binding="strong"> > <string>Verdana</string> > </edit> > </match> > > Does that not work?It should, and is probably quite sufficient for my needs :-) Thank you for your comments. CJ PS. This is unrelated and OT to this list, but what would be a suitable mailing list or newsgroup to ask questions about unicode fonts and how to set up xterm for a pleasant unicode experience?
Behdad Esfahbod
2009-Sep-23 19:58 UTC
[Fontconfig] <alias> replace dejavu sans with Verdana
On 09/23/2009 03:56 PM, Chris Jones wrote:> PS. This is unrelated and OT to this list, but what would be a suitable > mailing list or newsgroup to ask questions about unicode fonts and how > to set up xterm for a pleasant unicode experience?Should be fine around here. I use: uxterm -u8 -fa ''\''''DejaVu Sans Mono''\'''' -fs 12
On Wed, Sep 23, 2009 at 03:58:49PM EDT, Behdad Esfahbod wrote:> On 09/23/2009 03:56 PM, Chris Jones wrote: > > > PS. This is unrelated and OT to this list, but what would be a suitable > > mailing list or newsgroup to ask questions about unicode fonts and how > > to set up xterm for a pleasant unicode experience? > > Should be fine around here. > > I use: > > uxterm -u8 -fa ''\''''DejaVu Sans Mono''\'''' -fs 12It''s mostly for testing purposes, stuff that I''m learning and I found that gnu/unifont has a glyph for practically every character. I tried Sans Mono but one issue that I had with it is that in my setup it was barely legible. On a terminal, I''d rather stick to a bitmap font, provided there exists one with a suitable pointsize. In terms of looks and legibility, -gnu-unifont-medium-r-normal--17-170-75-75-c-80-iso10646-1 came as a pleasant surprise. Unfortunately, it doesn''t play well with xterm, for stuff like: ?? that should come out as: ? ? I had to add a space between the two characters to avoid the overlay. :-) The good thing about gnu/unifont is that practically everything that might have been entered will display, which is adhoc to my needs - one font taking care of everything. Other issues that I''ve run into with xterm is that I''m pretty sure it does not support anything RTL, such as Hebrew or Yiddish. And lastly, unless you have something running on top of it that has its own input method - or methods since vim for instance has two different ways to enter characters that your keyboard does no provide via a single key - it would appear you are limited to a subset of what you find in /usr/share/locale/en_US.UTF-8/Compose. Unlike vim or GTK applications, where as a last resort, you can always enter the actual U+xxxx code point. I guess I''ll ask more precise questions as I research this further. Thanks, CJ