You are not logged in.

#1 2013-09-09 10:26:25

foobarrior
Member
Registered: 2012-03-11
Posts: 12

Letters of some fonts are placed with incorrect distance

Hello.
I'm trying quite hard to configure my fonts, but installing ms fonts always breaks the websites look.
What is strange is that some fonts are looking brilliant for me, but some (at some conditions) are really eye-breakable.
Here is an example of arial with russian letters at different sizes:
10px
11px (this is the main issue)
12px
13px

So, the distance is going to change quite insane and i don't know what to do.
And that is not only related to russian arial, or russian ms, or vodka, etc. The problem is more common, because it is also quite observable with inconsolata-g (english):
screenshot - this is shot of firefox@archlinux wiki part. "font-size:  12.7px", firefox said. Other sizes look sane.

And all this stuff is only firefox related. Other applications (leafpad, writer) draw arial, well, sane, at least. That may be a bit upexpectable, but ok, usable=)

Im using firefox on cinnamon on archlinux, with infinality-ultimate default config (from infinality repos).

Edit: oh no. That is not firefox-only related. I just forgot that font sizes are measured in points, not in pixels, in font-choosers.
So this bug is presented in leafpad, too.

Last edited by foobarrior (2013-09-09 10:40:39)

Offline

#2 2013-09-09 11:15:14

bohoomil
Banned
Registered: 2010-09-04
Posts: 2,377
Website

Re: Letters of some fonts are placed with incorrect distance

Try putting this

  <!-- All fonts should use slight hinting below 11 px -->
  <match target="font">
    <test name="pixelsize" compare="less">
      <double>11</double>
    </test>
    <edit name="hintstyle" mode="assign">
      <const>hintslight</const>
    </edit>
    <edit name="autohint" mode="assign">
      <bool>true</bool>
    </edit>
  </match>

to /etc/fonts/conf.avail.infinality/92-selective-rendering.conf.

I know about this issue: two variables in freetype configuration are responsible for it. However, disabling them makes font look blurry with all the side effects blurriness can bring. We can try and tweak the settings so that at lower sizes the text look better.

Instead of Inconsolata-g, use Inconsolata-zi4 from my repository (infinality-bundle-any). This is a PostScript font and it looks way better than all TTF/OTF variants. I've recently started using it as my default monospace font, replacing MS's Consolas.

Edit: you can set the font size value to 12 if necessary. Anything above can collide with other settings (in a few cases, this is the lowest value I use when I fine tune fontconfig rules).

Last edited by bohoomil (2013-09-09 11:20:16)


:: Registered Linux User No. 223384

:: github
:: infinality-bundle+fonts: good looking fonts made easy

Offline

#3 2013-09-09 15:51:06

foobarrior
Member
Registered: 2012-03-11
Posts: 12

Re: Letters of some fonts are placed with incorrect distance

Hello, bohoomil.
Adding mentioned configuration didn't help, suddenly, even after reboot and setting pixelsize to 12
Moreover doesn't look that hinting should influence anyhow.

I've taken a look at 11px shot and found that letter "п" is totally mispositioned to the left on 1.5-2px
Is it an infinality bug at all? I'm going to test the issue without fontconfig/infinality installed

Edit: well, yes, the problem still exists with default fontconfig packages.
arial 11px fontconfig
So it seems to be more common problem.

By the way: look at 'm'

P. S. had you already made that fonts bundle? I can't find anywhere except latex google results

Last edited by foobarrior (2013-09-09 16:10:53)

Offline

#4 2013-09-10 02:02:10

bohoomil
Banned
Registered: 2010-09-04
Posts: 2,377
Website

Re: Letters of some fonts are placed with incorrect distance

The is not really a problem with hinting but with stem alignment and fitting and the pixel manipulation they are responsible for. With pre 2.5.0 freetype2, I experienced constant problems when trying to 'clean' the fonts: I never managed to achieve a sharp picture that would be readable at all sizes and didn't produce painful inconsistencies between even small size ranges. Only after changing the strategy, the rendering became mostly acceptable and further fine tuning didn't involve creation of multiple additional rules for the same family for different use scenarios.

In this particular case, many font families treat Cyrillic and Latin scripts in the same manner, which means they apply the same letter positioning patterns to incompatible language systems. The problem could be easily solved if we could treat various language specific glyphs differently, i.e. apply

  <match target="font">
    <test name="family">
      <string>Arial</string>
    </test>
    <test name="pixelsize" compare="less">
      <double>13</double>
    </test>
    <edit name="hintstyle" mode="assign">
      <const>hintslight</const>
    </edit>
    <edit name="autohint" mode="assign">
      <bool>false</bool>
    </edit>
  </match>

to the Latin script and

  <match target="font">
    <test name="family">
      <string>Arial</string>
    </test>
    <test name="pixelsize" compare="less">
      <double>13</double>
    </test>
    <edit name="hintstyle" mode="assign">
      <const>hintslight</const>
    </edit>
    <edit name="autohint" mode="assign">
      <bool>true</bool>
    </edit>
  </match>

to the Cyrillic one. Unfortunately, using the <charset>0022</charset> property has never worked for me, leaving the glitches exactly where they were…

What you can do:

  1. Choose between global settings that favour Cyrillic script over the Latin one (see above). The solution is based on the "either … or" choice which isn't exactly what you may want when both Latin and non-Latin languages have the same priority for you.

  2. Use a dedicated sans-serif font for Cyrillic based languages. This should be a preferred solution if you choose a proper font family (Arimo or Liberastika for instance). The substitution is only done when a particular language is detected, and for anything else the default sans family will be used. You should add

      <match>
        <test name="lang" compare="contains">
          <string>ru</string>
        </test>
        <test name="family">
          <string>sans-serif</string>
        </test>
        <edit name="family" mode="prepend_first" binding="strong">
          <string>Arimo</string>
        </edit>
      </match>

    to /etc/fonts/conf.avail.infinality/93-final-lang-spec.conf and additionaly, if you choose Liberastika,

      <match target="font">
        <test name="family">
          <string>Liberastika</string>
        </test>
        <test name="pixelsize" compare="less">
          <double>13</double>
        </test>
        <test name="weight" compare="more_eq">
          <const>regular</const>
        </test>
        <edit name="autohint" mode="assign">
          <bool>true</bool>
        </edit>
        <edit name="hintstyle" mode="assign">
          <const>hintslight</const>
        </edit>
      </match>

    to /etc/fonts/conf.avail.infinality/92-selective-rendering.conf.

    In either case, the previously appended

      <match target="font">
        <test name="pixelsize" compare="less">
          <double>11</double>
        </test>
        <edit name="hintstyle" mode="assign">
          <const>hintslight</const>
        </edit>
        <edit name="autohint" mode="assign">
          <bool>true</bool>
        </edit>
      </match>

    should be removed.

Additional fonts are available in a dedicated repository:

[infinality-bundle-any]
Server = http://ibn.net63.net/infinality-bundle-any

Simply add the above to your pacman.conf, run 'pacman -Syyu' and install whatever you like.


:: Registered Linux User No. 223384

:: github
:: infinality-bundle+fonts: good looking fonts made easy

Offline

#5 2013-09-11 14:24:54

foobarrior
Member
Registered: 2012-03-11
Posts: 12

Re: Letters of some fonts are placed with incorrect distance

Hello again.
Running firefox under another user helped. Though it needs to test my home directory, it looks rather strong that the problem is in running as root

BTW, I tried to play with your second idea, but language hadn't been switching.

EDIT: Okay, that is now really going to be a bug related to running everything as root. And one more new thing noticed: letters changed their places after moving /root back!
Such undetermined behavior could be caused, well, by uninitialized memory, maybe? I don't understand why should be there some root-case code, but if it's there, that could be a point!

Last edited by foobarrior (2013-09-11 14:42:41)

Offline

Board footer

Powered by FluxBB