Page 2 of 2 FirstFirst 12
Results 11 to 18 of 18

Thread: mapping "Times" to (NOT "Nimbus") with fontconfig

  1. #11
    Join Date
    Apr 2006
    Beans
    80

    Re: mapping "Times" to (NOT "Nimbus") with fontconfig

    Not sure if this might help you, but did you check out in synaptic the package called: msttcorefonts ?
    Setting aside licensing/freedom issues, the MS fonts don't render as well as Liberation/DejaVu with subpixel smoothing turned on.

  2. #12
    Join Date
    Apr 2006
    Beans
    80

    Re: mapping "Times" to (NOT "Nimbus") with fontconfig

    Quote Originally Posted by incandenza View Post
    Hmm, actually I'm still having trouble here. I did the same thing in my .fonts.conf as you did, except I did all three fonts (Times, Helvetica, Courier), because I don't want to see Liberation in Firefox.

    But yet, I get Liberation in Firefox anyway. And what's more, I start getting DejaVu in evince, which should be asking for the metric version.

    In fact, there seems to be something strange here, because if I reverse the comparison from "eq" to "not_eq" in the .fonts.conf, it matches anyway. Maybe if the 'anymetrics' key doesn't exist the test is skipped or something?
    You may need to add rules for "Times New Roman", "Arial", and "Courier New" as well, if you never want to see Liberation fonts in Firefox. Setting/not setting anymetrics properly may be a firefox and/or evince bug...

  3. #13
    Join Date
    Feb 2005
    Beans
    23

    Re: mapping "Times" to (NOT "Nimbus") with fontconfig

    Quote Originally Posted by clconway View Post
    You may need to add rules for "Times New Roman", "Arial", and "Courier New" as well, if you never want to see Liberation fonts in Firefox. Setting/not setting anymetrics properly may be a firefox and/or evince bug...
    Hmm, well, I went all through this with FC_DEBUG trying to figure out what was going on.

    For one thing, neither Firefox nor evince ever sets the 'anymetrics' flag that I can see. Because of the qual="all" tag on the 'anymetrics' test, if the anymetrics flag does not exist the condition always evaluates to true, whether you are comparing against true or false (because 'all' of the values for anymetrics, of which there are none, evaluate to anything). So I don't think these tests mean what they're supposed to.

    In fact, I don't really see how you can do a proper test against a possibly-missing key with this "qual" tag. qual="any" always gives false for any condition if the tag is missing, and qual="all" always gives true.

    The only reason the test on anymetrics does anything, as far as I can tell, is that it changes the reference to Nimbus from 'strong' to 'weak', which gives it less precedence. It's almost the same as just commenting it out.

    Anyway, it doesn't matter, because without the anymetrics key set there's no way to distinguish the context anyway. I wound up just putting strong bindings directly for DejaVu from Helvetica, Times, and Courier in my fonts.conf, and removing Liberation. I guess if I want evince to work properly, I'll move my .fonts.conf temporarily out of the way before running it.

    At least I figured out how to get what I want using just the .fonts.conf and not having to edit /etc/fonts.

    EDIT: Also, I don't think your .fonts.conf actually overrides Liberation in Firefox--are you sure that it does? At least, that does not seem to be possible here. The way Firefox asks for the font is different than what 'fc-match' does, and the weak binding in the .fonts.conf doesn't seem to be able to override the strong one for Liberation.
    Last edited by incandenza; May 27th, 2008 at 08:33 PM.

  4. #14
    Join Date
    Apr 2006
    Beans
    80

    Re: mapping "Times" to (NOT "Nimbus") with fontconfig

    incandenza, You're right. With
    Code:
      <match target="pattern">
        <test name="family">
          <string>Times</string>
        </test>
        <test name="anymetrics" qual="all" compare="eq">
          <bool>true</bool>
        </test>
        <edit name="family" mode="assign">
          <string>DejaVu Serif</string>
        </edit>
      </match>
    or with
    Code:
      <match target="pattern">
        <test name="family">
          <string>Times</string>
        </test>
        <edit name="family" mode="assign">
          <string>DejaVu Serif</string>
        </edit>
      </match>
    in ~/.fonts.conf, I get DejaVu Serif in Firefox. With
    Code:
        <test name="anymetrics" qual="any" compare="eq">
          <bool>true</bool>
        </test>
    I get Liberation Serif.

    There are several separate issues here:
    1. The Nimbus fonts render poorly. This is probably due to a lack of hinting support in legacy Postscript fonts.
    2. The Nimbus and Liberation fonts are too small by default, effectively much smaller than DejaVu at the same nominal point size (see attached).
    3. Fontconfig has buggy anymetrics support and/or Fontconfig clients don't consistently provide appropriate anymetrics parameters

    Unfortunately, the Nimbus and Liberation fonts seem to be the only metric-compatible replacements for the standard Postscript and Microsoft fonts that are used in many web, PS, and PDF documents, so replacing them with DejaVu fonts universally isn't a good option.
    Attached Images Attached Images

  5. #15
    Join Date
    Feb 2005
    Beans
    23

    Re: mapping "Times" to (NOT "Nimbus") with fontconfig

    Quote Originally Posted by clconway View Post
    Unfortunately, the Nimbus and Liberation fonts seem to be the only metric-compatible replacements for the standard Postscript and Microsoft fonts that are used in many web, PS, and PDF documents, so replacing them with DejaVu fonts universally isn't a good option.
    True, it is not really a "good" solution, but it is the best available solution I have at the moment, unless someone can explain to me how to do something better. Switching from Nimbus to Liberation is not a real improvement for me, but just a sideways shift.

    I suppose I could just give up and use the msttcorefonts, but I'm not too thrilled about that either.

    The thing is, for some reason this worked fine under Gutsy; Firefox never used the Nimbus fonts there. I tried to figure out what changed, even copying my old /etc/fonts directory over, but I could never make it work the same since Hardy.

    EDIT: Actually I suspect there is some bug in the fontconfig code itself that causes a slight change in behavior between the Gutsy version and the Hardy version, even with the same config files. Problem is, this whole system is so nightmarishly complex that I doubt many people fully understand what it's supposed to be doing, much less are able to identify a minor change in behavior. If you try to follow through even the choice of a single font through these FC_DEBUG printouts, it's just ridiculous.
    Last edited by incandenza; May 27th, 2008 at 10:31 PM.

  6. #16
    Join Date
    Apr 2006
    Beans
    80

    Re: mapping "Times" to (NOT "Nimbus") with fontconfig

    I came up with an unrelated fix that might be better:
    raise the DPI setting in System -> Preferences -> Appearance -> Fonts -> Details and turn on autohinting with
    Code:
    sudo ln -s /etc/fonts/conf.avail/10-autohint.conf /etc/fonts/conf.d
    This drastically improves the rendering of the Nimbus and Liberation fonts. They're still too small in Firefox, but at least they aren't hideous to behold.

  7. #17
    Join Date
    Nov 2006
    Beans
    2

    Re: mapping "Times" to (NOT "Nimbus") with fontconfig

    So, when i understand it right, we want to change the Nimbus and Liberation-family to Dejavu (or Bitstream in my case) only for Firefox. I solved it that way:

    1) cp /etc/fonts/fonts.conf /etc/fonts/fonts.conf.firefox
    2) append the whole configuration on the end of /etc/fonts/config.avail/30-metric-aliases.conf to the new fonts.conf.firefox. that means all between <fontconfig> </fontconfig>.
    3) replace in fonts.conf.firefox all
    Nimbus Roman No9 L and Liberation Serif to DejaVu Serif or Bitstream Vera Serif
    Nimbus Sans L and Liberation Sans to DejaVu Sans or Bitstream Vera Sans
    Nimbus Mono L and Liberation Mono to DejaVu Sans Mono or Bitstream Vera Sans Mono
    4) edit /usr/bin/firefox and append under #!/bin/sh the row
    'export FONTCONFIG_FILE=/etc/fonts/fonts.conf.firefox' (without ')
    5) restart firefox

    thats it =)
    Last edited by m-y-t-h-o-s; August 10th, 2008 at 05:07 AM.

  8. #18
    Join Date
    Feb 2005
    Beans
    23

    Re: mapping "Times" to (NOT "Nimbus") with fontconfig

    A belated thanks for that last tip. I wasn't aware of the FONTCONFIG_FILE variable. Now I can change the fonts the way I like just for Firefox, and leave everything else alone.

    Thanks!

Page 2 of 2 FirstFirst 12

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •