Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #22678 > unrolled thread

Font evolution

Started byRoedy Green <see_website@mindprod.com.invalid>
First post2013-03-02 04:17 -0800
Last post2013-03-04 06:59 +0000
Articles 6 — 4 participants

Back to article view | Back to comp.lang.java.programmer


Contents

  Font evolution Roedy Green <see_website@mindprod.com.invalid> - 2013-03-02 04:17 -0800
    Re: Font evolution Jan Burse <janburse@fastmail.fm> - 2013-03-02 14:32 +0100
    Re: Font evolution "John B. Matthews" <nospam@nospam.invalid> - 2013-03-03 04:57 -0500
      Re: Font evolution Fredrik Jonson <fredrik@jonson.org> - 2013-03-03 18:48 +0000
        Re: Font evolution "John B. Matthews" <nospam@nospam.invalid> - 2013-03-03 20:46 -0500
          Re: Font evolution Fredrik Jonson <fredrik@jonson.org> - 2013-03-04 06:59 +0000

#22678 — Font evolution

FromRoedy Green <see_website@mindprod.com.invalid>
Date2013-03-02 04:17 -0800
SubjectFont evolution
Message-ID<d9r3j8lmi694s3j5qhma66q1dq58oh2mrd@4ax.com>
What follows are some miscellaneous happy observations about the
evolution of fonts, most only indirectly related to Java.

W3C and Mozilla designed the woff format for web fonts. It is a
wrapper around PostScript or TrueType fonts, with some meta
information, and specialised compression. The major browsers have
embraced the font. This makes @font-face in CSS much easier to use for
downloadable web fonts.

see http://mindprod.com/jgloss/downloadablefonts.html

Google is serving over 100 free webfonts. They are a snap to use. You
either insert a reference to a stylesheet for the font in your meta
header or embed @font-face for it in your style sheet. You can
download just the weights and glyphs you need. Google's servers are so
fast you don't even notice a lag.

Fontsquirrel will prepare any free font in webfont format for free.
They have a large catalog you can download and serve yourself.

You can use these woff fonts with vanilla HTML or with JSP and
brethren.

There is an explosion in free fonts, many of excellent quality. With
higher resolution screens, especially on cellphones and ebook readers,
hinting becomes less important. I also suspect font rendering is
becoming more intelligent and can do better even without hints or with
poor hinting.

Professional fonts have been pressed to improve quality. They come in
many weights, with astounding numbers of glyphs and variants. You can
usually buy just the parts you need.

You can now pay a flat fee to use a font on your desktop, in your
apps, in eBooks, on the web. Previously, you needed a to install a
complex metering system on your server to count font downloads. This
development suggests it will be easier/cheaper to bundle fonts with
your Java apps.

I have Google Translate installed on my web pages. I was having a look
at what it did with downloadable fonts use. It seems to revert on a
letter by letter basis to some backup font when the exotic Vietnamese
glyph is not available in my chosen webfont. I have not yet
experimented to figure out who is pulling off this cleverness. Is it
the browser, the woff driver, google translate, CSS, the OS? Does this
work with non-web fonts? non-woff fonts? I seem to recall not that
long ago you would have seen little squares for such characters.

My questions are:

What happens in Java apps when a glyph is missing from the specified
font? I suspect it handles the problem with pre-constructed synthetic
fonts that have large numbers of glyphs, but in general fonts don't
auto-substitute.

What do these woff fonts mean for Java Apps?

It is easy to download them at run time and use them in a Java app?
You would use this to let the user view an online font catalog for
example.

Is it easy to download and embed them in the jar?

Is there anything interesting happening or coming down the pipe in
Java to do with fonts?

-- 
Roedy Green Canadian Mind Products http://mindprod.com
One thing I love about having a website, is that when I complain about
something, I only have to do it once. It saves me endless hours of 
grumbling.

[toc] | [next] | [standalone]


#22679

FromJan Burse <janburse@fastmail.fm>
Date2013-03-02 14:32 +0100
Message-ID<kgsv12$9bg$1@news.albasani.net>
In reply to#22678
Roedy Green schrieb:
> I have Google Translate installed on my web pages. I was having a look
> at what it did with downloadable fonts use. It seems to revert on a
> letter by letter basis to some backup font when the exotic Vietnamese
> glyph is not available in my chosen webfont. I have not yet
> experimented to figure out who is pulling off this cleverness. Is it
> the browser, the woff driver, google translate, CSS, the OS? Does this
> work with non-web fonts? non-woff fonts? I seem to recall not that
> long ago you would have seen little squares for such characters.

Most likely translation doesn't need to know about fonts,
and will just pick the unicode character codes for translation.

Right?

Bye

[toc] | [prev] | [next] | [standalone]


#22690

From"John B. Matthews" <nospam@nospam.invalid>
Date2013-03-03 04:57 -0500
Message-ID<nospam-0ABCE6.04570303032013@news.aioe.org>
In reply to#22678
In article <d9r3j8lmi694s3j5qhma66q1dq58oh2mrd@4ax.com>,
 Roedy Green <see_website@mindprod.com.invalid> wrote:

> What happens in Java apps when a glyph is missing from the
> specified font?

I think you're supposed [1] to see a WHITE SQUARE [2], which "may be 
used to represent a missing ideograph." See also BALLOT BOX [3].

[1] <http://www.unicode.org/faq/unsup_char.html>
[2] <http://www.fileformat.info/info/unicode/char/25a1/index.htm>
[3] <http://www.fileformat.info/info/unicode/char/2610/index.htm>

-- 
John B. Matthews
trashgod at gmail dot com
<http://sites.google.com/site/drjohnbmatthews>

[toc] | [prev] | [next] | [standalone]


#22695

FromFredrik Jonson <fredrik@jonson.org>
Date2013-03-03 18:48 +0000
Message-ID<slrnkj76o7.cmg.fredrik@biggles.jonson.org>
In reply to#22690
John B. Matthews wrote:

>  Roedy Green <see_website@mindprod.com.invalid> wrote:
> 
> > What happens in Java apps when a glyph is missing from the
> > specified font?
> 
>  I think you're supposed to see a WHITE SQUARE, which "may be 
>  used to represent a missing ideograph."

I don't do Java GUI programming very often, but in logs and terminals I
regularily stumble upon U+FFFD in output from java code with broken charset
conversion. U+FFFD is the unicode replacement character and is represented
by a black rhomb with a white question mark inside.

https://en.wikipedia.org/wiki/U%2BFFFD

class Sscce {
    static public void main(String[] arg) {
        String foo = new String(new byte[] { (byte) -1 });
        javax.swing.JOptionPane.showMessageDialog(null, foo);
    }
}

Granted, I'm not sure it is entirely correct to equate a missing ideograph
with a unrepresentable chacacter?

-- 
Fredrik Jonson

[toc] | [prev] | [next] | [standalone]


#22698

From"John B. Matthews" <nospam@nospam.invalid>
Date2013-03-03 20:46 -0500
Message-ID<nospam-4AA284.20463003032013@news.aioe.org>
In reply to#22695
In article <slrnkj76o7.cmg.fredrik@biggles.jonson.org>,
 Fredrik Jonson <fredrik@jonson.org> wrote:

> John B. Matthews wrote:
> 
> >  Roedy Green <see_website@mindprod.com.invalid> wrote:
> > 
> > > What happens in Java apps when a glyph is missing from the
> > > specified font?
> > 
> >  I think you're supposed to see a WHITE SQUARE, which "may be 
> >  used to represent a missing ideograph."
> 
> I don't do Java GUI programming very often, but in logs and terminals 
> I regularily stumble upon U+FFFD in output from java code with broken 
> charset conversion. U+FFFD is the unicode replacement character and 
> is represented by a black rhomb with a white question mark inside.
> 
> https://en.wikipedia.org/wiki/U%2BFFFD
> 
> class Sscce {
>     static public void main(String[] arg) {
>         String foo = new String(new byte[] { (byte) -1 });
>         javax.swing.JOptionPane.showMessageDialog(null, foo);
>     }
> }

Good point; your example illustrates a declaration in 
sun.font.CharToGlyphMapper, used by Font#canDisplay():

public static final int UNINITIALIZED_GLYPH = -1;

Here's a variation that show a typical page with spotty coverage on some 
platforms:

import java.awt.EventQueue;
import java.awt.Font;
import java.awt.GridLayout;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;

class Sscce {

    public static final int N = 16;
    public static final int BASE = 0x1D100; // Musical Symbols

    static public void main(String[] arg) {
        EventQueue.invokeLater(new Runnable() {
            @Override
            public void run() {
                display();
            }
        });
    }

    private static void display() {
        JPanel p = new JPanel(new GridLayout(N, N));
        JLabel label = new JLabel("");
        Font f = label.getFont().deriveFont(36f);
        int[] a = new int[1];
        for (int r = 0; r < N; r++) {
            for (int c = 0; c < N; c++) {
                a[0] = N * r + c + BASE;
                label = new JLabel(new String(a, 0, 1));
                label.setFont(f);
                label.setToolTipText("\\u"
                    + Integer.toHexString(a[0])
                    + " " + f.canDisplay(a[0]));
                p.add(label);
            }
        }
        JOptionPane.showMessageDialog(null, p);
    }
}

> Granted, I'm not sure it is entirely correct to equate a missing 
> ideograph with a unrepresentable chacacter?

I have a penchant for using an ideograph as a glyph, at least until it 
turns up missing.

-- 
John B. Matthews
trashgod at gmail dot com
<http://sites.google.com/site/drjohnbmatthews>

[toc] | [prev] | [next] | [standalone]


#22707

FromFredrik Jonson <fredrik@jonson.org>
Date2013-03-04 06:59 +0000
Message-ID<slrnkj8hho.jdo.fredrik@biggles.jonson.org>
In reply to#22698
John B. Matthews wrote:
 
>  Here's a variation that show a typical page with spotty coverage on some 
>  platforms.

Ah, right. Thanks for an excellent example. Indeed I see the white boxes
on the last couple of rows on my system, and no replacement character at all.

-- 
Fredrik Jonson

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.java.programmer


csiph-web