Alexey, I guess that it might be a missing part (one of, at least), an
exact inheritance of the platform freetype configuration.

I attach a simple app for testing the renderer with some standard ubuntu
fonts. I added its output to the stackexchange question https://
stackoverflow.com/questions/41149451/a-method-of-getting-a-linux-jdk
-tarball-with-freetype-like-font-rendering

Why not ask the dev who prepared the Android Studio jdk? If there are
already variants which do the rendering right, why not just merge them into
the OpenJDK trunk.


On Fri, Dec 16, 2016 at 10:31 AM, Alexey Ushakov <
alexey.usha...@jetbrains.com> wrote:

> Hi Artur,
>
> So if it looks bad with that, it will look bad on your desktop unless the
>> font is interpreted differently.
>>
>
> Not true. The particular font, like a lot of the other (if you wish, I may
> send you example images), is badly rendered only in Java. Other Freetype
> apps render these fonts very well, thanks to the exceptional quality of
> that library.
>
> If I run Netbeans with its standard fonts and --jdk-home of the Android
> Studio jdk, the GUI quality is immediately improved, thanks to the fonts
> rendered as expected from a properly supported Freetype.
>
>
> Actually we (at JetBrains) have made some changes to use fontconfig hints
> in freetype rendering.
>
> Best Regards,
> Alexey
>
> On 16 Dec 2016, at 03:32, Artur Rataj <arturra...@gmail.com> wrote:
>
>
>
> On Fri, Dec 16, 2016 at 12:54 AM, Phil Race <philip.r...@oracle.com>
> wrote:
>
>>
>> As I started to say on that list, it seems to me that this may be a
>> font-specific problem.
>>
> Fonts have hints. I've seen similar issues when the hints are poor.
>>
>
>>
> Unfortunately there is no easy way to know if they are poor.
>>
> Some clients/apps/rendering systems by policy ignore hints so they may
>> look OK,
>> but then they may not look as good on a case where the hints were good
>> and important.
>> If I knew exactly what font you were using I could look at it.
>>
>
> The problem is more or less visible in a number of fonts, including the
> standard ones used by Java in dialogs, and several very high quality fonts
> supplied with Ubuntu. Of course, the actual differences vary with fonts.
>
> Also, the poor quality of font rendering of Java/Linux is known. This why
> there are the patches, the alternative "fixed" versions of OpenJDK etc.
>
>
>> Oracle's builds use a one that ships with the JDK binaries (not source)
>> All openjdk builds use freetype. On Linux this means Ubuntu's openjdk will
>> use the exact same copy of freetype as used for rendering the rest of
>> your desktop!
>>
>
> Thanks, so I was wrong. Then, it might be a misconfigured freetype, a
> buggy interface to freetype or whatever.
>
>
>> So if it looks bad with that, it will look bad on your desktop unless the
>> font is interpreted differently.
>>
>
> Not true. The particular font, like a lot of the other (if you wish, I may
> send you example images), is badly rendered only in Java. Other Freetype
> apps render these fonts very well, thanks to the exceptional quality of
> that library.
>
> If I run Netbeans with its standard fonts and --jdk-home of the Android
> Studio jdk, the GUI quality is immediately improved, thanks to the fonts
> rendered as expected from a properly supported Freetype.
>
>
>
package fonttest;

import java.awt.*;
import javax.swing.*;

class Surface extends JPanel {
    public Surface() {
        setBackground(Color.WHITE);
    }
    private void doDrawing(Graphics g) {
        Graphics2D g2d = (Graphics2D) g;
        RenderingHints rh =
            new RenderingHints(RenderingHints.KEY_TEXT_ANTIALIASING, 
            RenderingHints.VALUE_TEXT_ANTIALIAS_LCD_HRGB);
        rh.put(RenderingHints.KEY_RENDERING,
               RenderingHints.VALUE_RENDER_QUALITY);
        rh.put(RenderingHints.KEY_STROKE_CONTROL,
               RenderingHints.VALUE_STROKE_NORMALIZE);
        g2d.setRenderingHints(rh);
        String[] names = {
            "Dialog",
            "DejaVu Serif Condensed",
            "Gentium",
        };
        int y = 20;
        for(int size = 12; size <= 27; size += 5)
            for(String n : names) {
                g2d.setFont(new Font(n, Font.PLAIN, size));
                g2d.setColor(Color.BLACK);
                g2d.drawString("The quick brown fox jumps over " + n, 20, y);
                y += (int)(size*2);
            }
    }
    @Override
    public void paintComponent(Graphics g) {
        super.paintComponent(g);
        doDrawing(g);
    }
}

public class Fonttest extends JFrame {
    final static String TEXT = System.getProperty("java.vm.name") + " " +
            System.getProperty("java.version");
    
    public Fonttest() {
        initUI();
    }
    private void initUI() {
        setTitle(TEXT);
        add(new Surface());
        setSize(500, 480);
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        setLocationRelativeTo(null);      
    }
    public static void main(String[] args) {
        EventQueue.invokeLater(new Runnable() {
            @Override
            public void run() {
                Fonttest ex = new Fonttest();
                ex.setVisible(true);
            }
        });
    }
}

Reply via email to