Physical and logical fonts

R

RedGrittyBrick

RedGrittyBrick said:
No - but it depends how you are counting them I expect. Run charmap and
have a look on your system. the first font on my PC is Albertus, it
contains an fl ligature at codepoint U+FB02. I went through a few more
before getting bored, they all contained an fl ligature.

I downloaded Microsoft's font tools and did

cd c:\Windows\fonts
for %f in (*.ttf) do ttfdump %f | grep numGlyphs

(I already have a GNU grep from somewhere)

Of 177 fonts only 23 had less than 256 glyphs. These were fonts like
wingdings, symbol and so on.

Most fonts on this PC have more than 256 glyphs.
 
F

failure_to

hello

uh, I prob come off in my posts as mildly retarded. Anyways, I will
try to wrap this up since I already taken too much of your time and
patience.



1)
Most home computer systems also have a distinct look and feel to
the pop-up dialog boxes and other system elements (e.g., window
titles). You can use these as well as Sun as kindly defined
the system standard font for dialog boxes as "Dialog" and
"DialogInput" logical font names, so you can make your dialogs
appear native.
So Java on specific platform somehow knows which font this platform
uses for dialog boxes and maps that font to Dialog ( just one I
assume, thus no stitching of fonts together? ) ?
However all home computers ship with a set of fonts standard for
that platform. So for every platform Sun supports, they picked 3
available fonts (these are the actual fonts installed and are
called "physical") and gave them names you can use in your
program.
Say some OS has three physical fonts S, SS, M which Java by default
maps onto: S onto Serif, SS onto Sans-Serif, and M onto Mono-spaced

a)
If Java by default maps only 3 physical fonts to 3 logical fonts
( thus by default each logical font is mapped onto only one physical
font ), then that would suggest that by default no font stitching
happens?

b)
* Does Java have some kind of file or something that tells it names of
physical fonts ( not all, but some ) that should be mapped to, say
monospaced logical font ( based on how they visually represent
characters )?

* Or does Java by default only know to which logical fonts to map
default physical fonts S, SS and M?

BTW -I'm not implying that Java doesn't know of existence of other
physical fonts on the system, but instead that Java doesn't know to
which logical fonts to map those other physical fonts --> meaning we
must somehow tell Java which physical font to map to which logical
font - thus we must classify physical fonts by ourselves?!







2)
The stitching together of fonts can be avoided if there is a
decent Unicode supporting font. It would be done primarily to
pull in the Chinese, Arabic etc whose fonts don't look anything
like the Latin ones.

Does stitching of several physical fonts to one logical font happen by
default or is by default only one physical font mapped to particular
logical font?




3)

So Java can map its logical font onto A?

But as some other poster pointed out, Java uses just Unicode and
ignores the rest?!
Meaning if physical font doesn't support Unicode then Java won't map
that font onto a logical font ( as always, I prob misunderstood the
chap ):

Say we have a font that is able to display all ascii characters.
We also have two different 7 bit encodings EN_1 and EN_2. Both
are able to display all ascii characters. But they have
different code points for individual characters ( for example in
EN_1 code point for character A may be 65, while in EN_2
codepoint for A may be 100 ).
Java just uses the Unicode encoding and ignores the rest.






I should mention that I haven't yet started leaning about
applets, AWT or Swing or anything related to GUI, so for that
reason I can't yet check these things out via examples
Maybe you should. Playing around with your own code and reading
the documentation is the fastest way to learn.

I will, but I should first learn about collections and events
( I would already, but due to little free time... )


thank you
 
W

Wayne

RedGrittyBrick said:
No. Two Sun programmers met in a corridor, Bill asked "hey Joe, do you
think we should have three or ten logical fonts in Java?", Joe spilled
his coffee and mumbles "so much *for* that". Bill said "Pardon - four?"
Bill walked back to his desk and wrote down "five". When later asked
"Why five?" Bill claimed he'd analysed 2,347 popular GUI programs and
found that 97.12% of them used no more than five fonts.

That's completely wrong. Joe was having a soda, not coffee. Next time
get your facts straight before posting!

-Wayne
 
J

Joshua Cranmer

So Java on specific platform somehow knows which font this platform
uses for dialog boxes and maps that font to Dialog ( just one I
assume, thus no stitching of fonts together? ) ?

Sun clearly states in its i18n FAQ that which font is used is specified
by a few configuration files in your JRE.
b)
* Does Java have some kind of file or something that tells it names of
physical fonts ( not all, but some ) that should be mapped to, say
monospaced logical font ( based on how they visually represent
characters )?

Yes, read the aforementioned i18n FAQ.
I will, but I should first learn about collections and events
( I would already, but due to little free time... )

A few of the questions you have brought up are directly answered by the
i18n FAQ I mentioned in my previous post. Many of the answers given to
questions in this newsgroup can in fact be answered by merely reading
the Javadocs or other auxiliary information off of Sun's website.
 
R

Roedy Green

So Java on specific platform somehow knows which font this platform
uses for dialog boxes and maps that font to Dialog ( just one I
assume, thus no stitching of fonts together? ) ?

The whole idea of Java is the JRE for a particular platform tries to
hide the differences between platforms. The all look alike to the
programmer and programs should look and feel as much alike as
possible. This includes choosing a set of reasonable 5 fonts from what
is available to represent the 5 "ideal" logical fonts.

They may be direct mappings to fonts available as part of the OS, to
fonts provided by Sun, or to fonts stitched together, whatever it
takes to produce a set of reasonable fonts for that platform.
 
R

Roedy Green

If Java by default maps only 3 physical fonts to 3 logical fonts
( thus by default each logical font is mapped onto only one physical
font ), then that would suggest that by default no font stitching
happens?

Stitching would happen on an OS that did not support Unicode fonts.
They would have to be faked by stitching together 8-bit fonts. In a
modern OS, likely stitching would not be necessary. Sun could find
Unicode fonts with sufficient coverage.

Stitching could also happen to create non-logical fonts.
 
R

Roedy Green

If Java by default maps only 3 physical fonts to 3 logical fonts
( thus by default each logical font is mapped onto only one physical
font ), then that would suggest that by default no font stitching
happens?

Stitching is not something that happens automatically. Somebody,
usually at Sun, had to sit down and manually create tables to stitch
fonts together to create a new font.
 
R

Roedy Green

* Does Java have some kind of file or something that tells it names of
physical fonts ( not all, but some ) that should be mapped to, say
monospaced logical font ( based on how they visually represent
characters )?

It depends. On Windows Vista, Java can ask the OS for the names of
the possible OpenType and TTF fonts that support Unicode. So it does
not need a table for Swing bundled with the JVM. This lets you at any
freshly installed font.

Obviously there has to be a table to describe the logical font to
physical font mapping and any stitching.

Play a bit with FontShower and FontShowerAWT. That may help it all
come clearer what abilities exist.

see http://mindprod.com/applet/fontshower.html
http://mindprod.com/jgloss/applet/fontshowerawt.html
 
R

Roedy Green

Say Java maps two physical fonts onto one logical font. Now even
though at the highest level visual appearances of these two fonts may
be similar, at the closer inspection the visual styles of these two
fonts may still be very different.

Your great string of questions suggests there is some underlying
misconception that is making this all mysterious for you.

I will make some stabs at what they might be:

1. the JRE is not the same for every platform. It gets extensive
hand-tweaking to adapt to the platform. Part of that is selecting
which physical fonts to use to represent the 5 logical fonts.

2. font-stitching is a manual process. Somebody builds tables to
construct a virtual font out of several real ones. You could in
principle do it too, but I have never heard of anyone having the
patience. This is very much a platform-specific bit of work since it
depends on the physical fonts available and their glyphs and where the
glyphs are in the map.

3. to the programmer, the logical fonts look like ordinary fonts. It
is just they are transparently mapped onto physical or stitched
physical fonts.

4. A physical OpenType font contains font outlines for the glyphs, and
several mapping vectors, e.g. PostScript, Unicode, Mac, Windows-8-bit.
You index by code and it tells you the offset of the corresponding
glyph outline, or 0 meaning the glyph is not supported. Java under
Windows is only interested in the Unicode mapping of the OpenType and
TTF fonts. Under Linux, I think it is only interested in the OpenType
and PS fonts.

OpenType internally can be TTF or PS. In windows you need the TTF
flavour. In Linux you want the PS flavor. In theory an OS or Java
could support both types, but in practice, I don' think it does.

I would like to double check. Is this true?

Java supports

Windows TTF yes
Windows OpenType TTF yes
Windows OpenType PS no
Windows PS no

Linux TTF no
Linux OpenType TTF no
Linux OpenType PS yes
Linux PS yes
 
R

RedGrittyBrick

Roedy said:
2. font-stitching is a manual process. Somebody builds tables to
construct a virtual font out of several real ones. You could in
principle do it too, but I have never heard of anyone having the
patience. This is very much a platform-specific bit of work since it
depends on the physical fonts available and their glyphs and where the
glyphs are in the map.

On my PC:

C:\Program Files\Java\j2re1.4.2_05\lib\font.config contains
...
monospaced.0=Courier New,ANSI_CHARSET
monospaced.1=WingDings,SYMBOL_CHARSET
monospaced.2=Symbol,SYMBOL_CHARSET
...

No stitching defined here?


C:\Program Files\Java\jre1.6.0_03\lib\fontconfig.properties.src has
...
monospaced.plain.alphabetic=Courier New
monospaced.plain.chinese-ms950=MingLiU
monospaced.plain.hebrew=David
monospaced.plain.japanese=MS Gothic
monospaced.plain.korean=GulimChe
...

I don't see any complex stitching in terms of individual glyphs, just a
fairly simple assignment of fonts for a few locales that might be
related to Unicode "scripts". Presumably the JRE just uses MS Gothic for
any codepoints in the Unicode ranges defined for the hiragana, katakana
or kanji scripts.

Is there a separate file where more detailed stitching is defined or
does Java just use the simple algorithm that the above files imply?

OpenType internally can be TTF or PS.

Or both, from what I've read.

In windows you need the TTF
flavour. In Linux you want the PS flavor.
In theory an OS or Java
could support both types, but in practice, I don' think it does.

I would like to double check. Is this true?

Doesn't FreeType provide Linux with the ability to use TTF fonts
directly? [1]

I was under the impression that Windows 2000, XP & Vista can use Type-1
fonts. [2]

I thought that Java would inherit that capability?

I can't find an OpenType file containing a PostScript Type-1 font to
test. Maybe I'll look into this later.




[1] http://freetype.sourceforge.net/freetype2/index.html
[2] http://en.wikipedia.org/wiki/Type_1_and_Type_3_fonts#Windows_support
 
R

Roedy Green

Is there a separate file where more detailed stitching is defined or
does Java just use the simple algorithm that the above files imply?

In the old days fonts had a max of 256 glyphs each so you had to fake
Unicode ones with stitching using complicated mapping files. Now
Unicode support is common, so there is no need to bother. There are
ready made Unicode fonts to map to.

They might have even dropped the stitching support.
 
R

Roedy Green

I was under the impression that Windows 2000, XP & Vista can use Type-1
fonts. [2]

Yes, but Java ignores them.

It would be nice if someone performed experiments with PS, TTF,
Opentype-TTF and OpenType-PS on Linux and Windows to find out what is
supported.
 
R

RedGrittyBrick

Roedy said:
I was under the impression that Windows 2000, XP & Vista can use Type-1
fonts. [2]

Yes, but Java ignores them.

It would be nice if someone performed experiments with PS, TTF,
Opentype-TTF and OpenType-PS on Linux and Windows to find out what is
supported.

I can confirm that JRE 1.6.0_03 under Windows XP SP2 ignores OpenType
fonts of the Postscript flavour (AKA "OpenType PS" or "OpenType CFF").
That means any font file with extension .OTF instead of .TTF. Windows
applications such as Word are able to use .OTF fonts.

JRE 1.6 under Windows XP also ignores Postscript Type-1 fonts
(.PFM/.PFB) despite them being usable in Windows XP applications such as
Word (without any 3rd party support such as Adobe Type Manager).

I tested with an OpenType .OTF font "Metro Sans" from fonthaus.com
and with the obsolete Postscript Type-1 .PFB/.PFM font "Euro" from
adobe.com.
 
R

Roedy Green

JRE 1.6 under Windows XP also ignores Postscript Type-1 fonts
(.PFM/.PFB) despite them being usable in Windows XP applications such as
Word (without any 3rd party support such as Adobe Type Manager).

I tested with an OpenType .OTF font "Metro Sans" from fonthaus.com
and with the obsolete Postscript Type-1 .PFB/.PFM font "Euro" from
adobe.com.

I have summarised your findings in a table:

http://mindprod.com/jgloss/font.html#FONTSUPPORT

If anyone sees errors or omissions, please let me know.
 

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

Members online

Forum statistics

Threads
473,733
Messages
2,569,439
Members
44,829
Latest member
PIXThurman

Latest Threads

Top