Re: Font rendering for Japanese

Mike FABIAN <[email protected]>
Newsgroups gmane.linux.suse.m17n
Message-ID <[email protected]>
UTUMI Hirosi <[email protected]> :

> --- Mike FABIAN <[email protected]> wrote:
>> The easiest way to disable embedded bitmaps for Japanese would be
>> to remove the line
>> 
>>                             <string>ja</string>
>> 
>> in /etc/fonts/suse-pre-user.conf.
>
> ok. (but does it disable hinting? Hinting is not good for CJK [or
> square] characters)

It worked quite well as long as Akito San's patch was included, the
IPA fonts were rendered nicely as well.  As this patch is gone now, I
disabled the hinting for the IPA fonts.  See this part in
/etc/fonts/suse-pre-user.conf:

    <!--
    Since we updated to freetype 2.1.10, the patch from
    http://www.kde.gr.jp/~akito/patch/freetype2/2.1.7 could not be applied
    anymore. Unfortunately the rendering quality of CJK fonts suffered a lot
    because of this update. The most extreme loss of rendering quality
    happened for the IPA fonts.

    See also http://bugzilla.novell.com/show_bug.cgi?id=105626

    For other CJK fonts it is not that bad and on top of that most
    other CJK fonts have a wide range of embedded bitmaps which are used
    by default. And for big sizes, where there are not bitmaps anymore,
    the rendering quality is good anyway.

    As a workaround, switch of the hinting by setting hintstyle=hintnone
    for the IPA fonts:
    -->

            <match target="font">
                    <test name="family">
                            <string>IPAMincho</string>
                            <string>IPAGothic</string>
                            <string>IPAPMincho</string>
                            <string>IPAPGothic</string>
                            <string>IPAUIGothic</string>
                    </test>
                    <edit name="hintstyle">
                            <const>hintnone</const>
                    </edit>
            </match>

We could easily disable the hinting for all CJK fonts with something
like this:

    <!-- 
    Hinting for CJK fonts in freetype doesn't yet work as well as for Latin fonts.

    But our freetype package has the patch from
     http://www.kde.gr.jp/~akito/patch/freetype2/2.1.7
    applied which improves the hinting results for CJK fonts a lot.

    If you are using a freetype package without that patch you may prefer
    to switch off hinting by setting hintstyle=hintnone for CJK fonts.

    This can be achieved by using the following rule:

            <match target="font">
                    <test name="lang" compare="contains">
                            <string>ja</string>
                            <string>zh</string>
                            <string>ko</string>
                    </test>
                    <edit name="hintstyle" mode="assign">
                            <const>hintnone</const>
                    </edit>
            </match>
    -->

which is also in /etc/fonts/suse-pre-user.conf but currently commented
out because for the other CJK fonts the hinting appears to be not that
bad as for the IPA fonts.

>> And I guess that a font designer who includes embedded bitmaps in
>> his fonts does this because he believes they give better results
>> than the outlines. If the font designer doesn't think so, why
>> include embedded bitmaps at all?
>
> MS Windows 9x can't show antialiased outlines, so MS fonts/IPA fonts include 
> embedded bitmaps to show small characters clearly. But freetype2 shows 
> outlines beautifully, so I think outlines are better than bitmaps.

Even on MS Windows XP, anti-aliasing is enabled by default only for
sizes > 18 pixels. I didn't test the Japanese fonts but I verified
that this is indeed the case for western fonts. To switch on
anti-aliasing, the user has to select "Clear Type" in the Windows
control centre manually.

That means, the default look and feel of MS Windows XP looks rather
bitmap like. These are not really bitmaps but outlines rendered
without anti-aliasing with very high quality, which achieves
practically the same quality as hand tuned bitmaps.

Recently, during the beta phase of SuSE Linux 10.0, I made this the
default for a selected list of fonts which have good byte code.  See
the following part of /etc/fonts/suse-pre-user.conf:

    <!-- ************************************************************ -->
    <!-- Hinting and antialiasing                                     -->
    <!-- ************************************************************ -->

    <!--
        Fonts which have high quality byte code interpreter instructions
        can look very good in small sizes when rendered in black and white
        (antialias=false) using the byte code interpreter (autohint=false).
        The results look as good as high quality bitmap fonts.

        On the other hand, most Fonts do not have good byte code interpreter
        instructions and look *very* ugly when rendered like this.
        I.e. for most fonts autohint=true and antialias=true gives best
        results.

        For fonts which do have good byte code instructions, it seems
        to be a matter of taste. Most users apparently do not like the
        bitmaps no matter how good they are and prefer to render
        these fonts with anti-aliasing as well.

        When rendering fonts which do have good byte code with anti-aliasing
        (antialias=true), the byte code apparently doesn't help much, to
        the contrary, it produces strange rendering artifacts.
        Therefore it is usually better to always use the autohinter (autohint=true)
        when rendering with anti-aliasing.

    -->

            <!--
                Using the autohinter and anti-aliasing.
                This is a good default for most fonts.
            -->
            <match target="font">
                    <edit name="autohint">
                            <bool>true</bool>
                    </edit>
                    <edit name="antialias">
                            <bool>true</bool>
                    </edit>
            </match>

            <!--
                The following rule sets up black and white rendering with
                the byte code interpreter for a small list of fonts which
                are known to have good byte code and give bitmap quality
                results at small sizes.
                The pixelsize limit is set to '0' though, which effectively
                disables this rule by default because most users don't like
                that bitmap look and feel.
                If you like a bitmap look and feel of your desktop,
                copy this rule into your ~/.fonts.conf file and replace the '0'
                with non-zero pixelsize limit. Using '18' as the pixelsize
                limit is a good choice if you have the fonts in this list installed
                and like a bitmap look and feel. 
            -->
            <match target="font">
                    <test name="family">
                            <string>Andale Mono</string>
                            <string>Arial</string>
                            <string>Comic Sans MS</string>
                            <string>Georgia</string>
                            <string>Impact</string>
                            <string>Trebuchet MS</string>
                            <string>Verdana</string>
                            <string>Courier New</string>
                            <string>Times New Roman</string>
                            <string>Tahoma</string>
                            <string>Webdings</string>
                            <string>Albany AMT</string>
                            <string>Thorndale AMT</string>
                            <string>Cumberland AMT</string>
                    </test>
                    <test name="pixelsize" compare="less_eq">
                                    <double>0</double>        <!-- use a non-zero pixel size to enable this rule -->
                    </test>
                    <edit name="autohint">
                            <bool>false</bool>
                    </edit>
                    <edit name="antialias">
                            <bool>false</bool>
                    </edit>
            </match>

I used 18 pixel as the limit, just as on MS Windows. A handful of
users had requested to make this the default, but after I had done
this, I received many complaints from other users, therefore I
disabled this rule again by setting the limit to 0 pixels.

Although this style is the default on MS Windows XP, most Linux users
apparently do not like it.

>> I want to disable embedded bitmaps for
>> Japanese by default only if we are *sure* that the majority of users
>> prefers the outlines. How to find out? 
>
> suse-linux-ja?

I'll ask there.

-- 
Mike FABIAN   <[email protected]>   http://www.suse.de/~mfabian



-- 
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.