Font evolution


R

Roedy Green

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?
 
Ad

Advertisements

J

Jan Burse

Roedy said:
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
 
F

Fredrik Jonson

John said:
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+FFFD

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?
 
J

John B. Matthews

Fredrik Jonson said:
John said:
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+FFFD

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.
 
Ad

Advertisements

F

Fredrik Jonson

John said:
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.
 
Ad

Advertisements


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top