Re: Embedding font triplets w/ a single TTF file

2007-02-04 Thread Daniel Noll

Vincent Hennebert wrote:

I doubt you will find any free font with both large Unicode support and
several variants. You might want to give a try to FreeFont
(http://www.nongnu.org/freefont/), which have a fairly reasonable
support of Unicode, although not identical among the variants. I guess
you can find commercial fonts, too.


Putting it side by side with Arial Unicode, it only lacks one or two 
scripts (for one given test page.)  Funny how Arial Unicode is some 10 
times bigger in file size, and yet only includes one typeface and one 
variant, whereas FreeFont includes three typefaces and all four variants 
for each...


(I wonder why Arial Unicode is so big, actually... maybe it contains 
explicit bitmap versions of the font for smaller sizes, to make the 
characters look more crisp.  I noticed that FreeFont looked blurry even 
at size 8.)


Unfortunately though, the licence makes it as easy to distribute as 
Arial Unicode... except for people lucky enough to be working on an 
application which is already GPL.



Otherwise it should be rather easy to build a large Unicode support from
several different fonts, each one supporting some given subset (say, a
latin one, a cyrillic, a japanese, etc.). If you stick to Times-like
shapes you should end up with a not too non-uniform set.


Yeah, I was thinking if I could pre-process the FO I could insert heaps 
of fo:inline elements to automatically change the font for each 
fragment to one which supports all the characters in the fragment.



Actually both the PDF renderer and the Java2D one do the same thing,
that is fall back to default fonts. It's just that for PDF those default
fonts are the well-known base 14 fonts, which support only a limited
subset of Unicode (the latin range, basically). For Java2D those are the
 Lucida fonts with a larger range of glyphs.


Java also has a configured list of fonts to use for different languages, 
although I've never been sure whether those were also used for fallback.


This does bring up a thought though... the JDK ships with the Lucida 
fonts so we could potentially use those instead of Arial and we then 
wouldn't need to ship with anything.  The only drawback would be that 
Lucida looks slightly (but only slightly) worse than Arial.


Daniel

--
Daniel Noll

Nuix Pty Ltd
Suite 79, 89 Jones St, Ultimo NSW 2007, AustraliaPh: +61 2 9280 0699
Web: http://nuix.com/   Fax: +61 2 9212 6902

This message is intended only for the named recipient. If you are not
the intended recipient you are notified that disclosing, copying,
distributing or taking any action in reliance on the contents of this
message or attachment is strictly prohibited.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Embedding font triplets w/ a single TTF file

2007-02-02 Thread Jeremias Maerki

On 31.01.2007 11:32:09 Chris Bowditch wrote:
 Jeremias Maerki wrote:
 
  Just for those technically interested how this effect would be done in
  PDF, here's an example:
  
 
 snip what=very useful PDF snippet/
 
  
  I think the key value here is the use of 2 Tr which gives each glyph a
  border of a certain width which makes the font appear bold. So if
  anyone wants to implement something like that, here's the template. :-)
 
 Very interesting. Thanks for the tip. The main drawback of course being 
 that it only works for PDF :(

Well, similar effects can be achieved in PostScript, Java2D and PCL.
Don't know about AFP, though. But this has to be implemented separately
for every renderer.

 snip/



Jeremias Maerki


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Embedding font triplets w/ a single TTF file

2007-02-01 Thread Vincent Hennebert
Hi Daniel,


 Are there even any fonts which both support a large subset of unicode
 and have bold and italic variants?  I went searching a while back and
 found nothing.

I doubt you will find any free font with both large Unicode support and
several variants. You might want to give a try to FreeFont
(http://www.nongnu.org/freefont/), which have a fairly reasonable
support of Unicode, although not identical among the variants. I guess
you can find commercial fonts, too.

Otherwise it should be rather easy to build a large Unicode support from
several different fonts, each one supporting some given subset (say, a
latin one, a cyrillic, a japanese, etc.). If you stick to Times-like
shapes you should end up with a not too non-uniform set.


 The underlying problem here is that FOP's PDF renderer can't substitute
 fonts when the specified font doesn't exist (the Java2D renderer does
 this automatically as a side-effect of Java.)  As a result of this
 limitation, developers get forced to include some huge font like Arial
 Unicode MS, even though there are enough fonts on their operating
 system that they don't need to use this font in any other application.

Actually both the PDF renderer and the Java2D one do the same thing,
that is fall back to default fonts. It's just that for PDF those default
fonts are the well-known base 14 fonts, which support only a limited
subset of Unicode (the latin range, basically). For Java2D those are the
 Lucida fonts with a larger range of glyphs.


 FOP could use bits of AWT to figure out how to substitute, the problem
 as I understand it is that there is no trivial way to map a Font object
 to a TTF file.

Exactly. AWT doesn't give access to the TTF file, which prevents
embedding the font in the PDF file.


 It's possible though... in a roundabout and non-portable way.
 
   sun.font.FontManager.getFontPath(false);  = C:\\Windows\\Fonts
 
 From that we would then open every TTF file, which gives us the name and
 style for each TTF file.  Reversing that map would give us a mapping
 from font family and style back to the TTF file which needs to be embedded.
 
 It would cause a hell of a lot more than an extra 2 seconds startup
 time, however... :-/

Well that's an idea. Anyway the whole font stuff would benefit from some
(major) improvements. But that's a complex area which involves a number
of standards (Type1, TrueType, Unicode...) and requires quite an amount
of knowledge... but wait, that's also very interesting! ;-)

Vincent

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Embedding font triplets w/ a single TTF file

2007-01-31 Thread Vincent Hennebert
Chris Bowditch a écrit :
 Jeff Vannest wrote:
 

 -Original Message-
 From: Manuel Mall [mailto:[EMAIL PROTECTED] Sent: Monday, January 29,
 2007 8:01 PM
 To: fop-users@xmlgraphics.apache.org
 Subject: Re: Embedding font triplets w/ a single TTF file

 FOP requires a font containing the actual bold (or italic) characters
 it has no capability to derive / render a bold character from a given
 'plain' character. You would need to find a font which contains the
 bold characters you are interested in.


 I understand the response, and that's the way it looked to me, too.
 Question: Why is this possible in Adobe PDF, Word, etc, but not in FOP,
 which follows the PDF spec?  ...not a criticism...just wondering where
 the
 catch is.
 
 Well Word emulates the bold effect if no bold version of a Font is
 available by printing the glyph on top of itself a few times (each time
 having a slight offset from the last position) The XSL-FO spec doesn't
 require such a feature. I guess it would be a useful feature if FOP did
 this too, but I don't think the purists will like it.

Indeed. They would tell you: A font is a set of glyphs carefully
designed to look nice together. It may contain ligatures, glyph
variants, spacing adjustments (so-called kerning, like in AV) between
certain glyphs to make text look even better. In fact a font can be seen
like an artwork. Thus any attempt to tweak it in any way (setting a
non-null letter-spacing, simulating bold or slanted typeface, etc.) can
only distort the intent of the original author.

So if I were you, I wouldn't try to derive a bold typeface from a normal
one ;-) Like Jeremias said I would rather find a naturally bold font.

Vincent

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Embedding font triplets w/ a single TTF file

2007-01-31 Thread Chris Bowditch

Jeremias Maerki wrote:


Just for those technically interested how this effect would be done in
PDF, here's an example:



snip what=very useful PDF snippet/



I think the key value here is the use of 2 Tr which gives each glyph a
border of a certain width which makes the font appear bold. So if
anyone wants to implement something like that, here's the template. :-)


Very interesting. Thanks for the tip. The main drawback of course being 
that it only works for PDF :(


snip/




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Embedding font triplets w/ a single TTF file

2007-01-31 Thread Daniel Noll

Vincent Hennebert wrote:

So if I were you, I wouldn't try to derive a bold typeface from a normal
one ;-) Like Jeremias said I would rather find a naturally bold font.


Are there even any fonts which both support a large subset of unicode 
and have bold and italic variants?  I went searching a while back and 
found nothing.


The underlying problem here is that FOP's PDF renderer can't substitute 
fonts when the specified font doesn't exist (the Java2D renderer does 
this automatically as a side-effect of Java.)  As a result of this 
limitation, developers get forced to include some huge font like Arial 
Unicode MS, even though there are enough fonts on their operating 
system that they don't need to use this font in any other application.


FOP could use bits of AWT to figure out how to substitute, the problem 
as I understand it is that there is no trivial way to map a Font object 
to a TTF file.


It's possible though... in a roundabout and non-portable way.

  sun.font.FontManager.getFontPath(false);  = C:\\Windows\\Fonts

From that we would then open every TTF file, which gives us the name 
and style for each TTF file.  Reversing that map would give us a mapping 
from font family and style back to the TTF file which needs to be embedded.


It would cause a hell of a lot more than an extra 2 seconds startup 
time, however... :-/


I did consider doing this at the XSL-FO level somehow, running it 
through some Java code to automatically insert an fo:inline where 
fonts need substituting.


Daniel


--
Daniel Noll

Nuix Pty Ltd
Suite 79, 89 Jones St, Ultimo NSW 2007, AustraliaPh: +61 2 9280 0699
Web: http://nuix.com/   Fax: +61 2 9212 6902

This message is intended only for the named recipient. If you are not
the intended recipient you are notified that disclosing, copying,
distributing or taking any action in reliance on the contents of this
message or attachment is strictly prohibited.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Embedding font triplets w/ a single TTF file

2007-01-30 Thread Jeff Vannest


-Original Message-
From: Manuel Mall [mailto:[EMAIL PROTECTED] 
Sent: Monday, January 29, 2007 8:01 PM
To: fop-users@xmlgraphics.apache.org
Subject: Re: Embedding font triplets w/ a single TTF file
 FOP requires a font containing the actual bold (or italic) characters it 
 has no capability to derive / render a bold character from a 
 given 'plain' character. You would need to find a font which contains 
 the bold characters you are interested in.

I understand the response, and that's the way it looked to me, too. 

Question: Why is this possible in Adobe PDF, Word, etc, but not in FOP,
which follows the PDF spec?  ...not a criticism...just wondering where the
catch is.

Thanks!
Jeff



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Embedding font triplets w/ a single TTF file

2007-01-30 Thread Chris Bowditch

Jeff Vannest wrote:



-Original Message-
From: Manuel Mall [mailto:[EMAIL PROTECTED] 
Sent: Monday, January 29, 2007 8:01 PM

To: fop-users@xmlgraphics.apache.org
Subject: Re: Embedding font triplets w/ a single TTF file

FOP requires a font containing the actual bold (or italic) characters it 
has no capability to derive / render a bold character from a 
given 'plain' character. You would need to find a font which contains 
the bold characters you are interested in.



I understand the response, and that's the way it looked to me, too. 


Question: Why is this possible in Adobe PDF, Word, etc, but not in FOP,
which follows the PDF spec?  ...not a criticism...just wondering where the
catch is.


Well Word emulates the bold effect if no bold version of a Font is 
available by printing the glyph on top of itself a few times (each time 
having a slight offset from the last position) The XSL-FO spec doesn't 
require such a feature. I guess it would be a useful feature if FOP did 
this too, but I don't think the purists will like it.


Chris




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Embedding font triplets w/ a single TTF file

2007-01-30 Thread Jeremias Maerki
Just for those technically interested how this effect would be done in
PDF, here's an example:

stream
1 g
/GS1 gs
90 632.12 415.2 137.88 re
f
BT
/TT2 1 Tf
36 0 0 36 90 735.9203 Tm
0 g
0 Tc
-0.0001 Tw
(Dies ist ein Test!)Tj
2 Tr
0 G
0 J 0 j 0.72 w 1 M []0 d
0 -1.2767 TD
0.0016 Tc
0 Tw
(Dies ist ein Test!)Tj
0 Tr
T*
0 Tc
-0.0001 Tw
(Dies ist ein Test!)Tj
ET
endstream

I think the key value here is the use of 2 Tr which gives each glyph a
border of a certain width which makes the font appear bold. So if
anyone wants to implement something like that, here's the template. :-)

But something like that is really only for the desperate since the
results are just ugly. I'd always prefer to find a better font first.

On 30.01.2007 17:32:40 Chris Bowditch wrote:
 Jeff Vannest wrote:
 
  
  -Original Message-
  From: Manuel Mall [mailto:[EMAIL PROTECTED] 
  Sent: Monday, January 29, 2007 8:01 PM
  To: fop-users@xmlgraphics.apache.org
  Subject: Re: Embedding font triplets w/ a single TTF file
  
 FOP requires a font containing the actual bold (or italic) characters it 
 has no capability to derive / render a bold character from a 
 given 'plain' character. You would need to find a font which contains 
 the bold characters you are interested in.
  
  
  I understand the response, and that's the way it looked to me, too. 
  
  Question: Why is this possible in Adobe PDF, Word, etc, but not in FOP,
  which follows the PDF spec?  ...not a criticism...just wondering where the
  catch is.
 
 Well Word emulates the bold effect if no bold version of a Font is 
 available by printing the glyph on top of itself a few times (each time 
 having a slight offset from the last position) The XSL-FO spec doesn't 
 require such a feature. I guess it would be a useful feature if FOP did 
 this too, but I don't think the purists will like it.
 
 Chris


Jeremias Maerki


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Embedding font triplets w/ a single TTF file

2007-01-29 Thread Manuel Mall
On Tuesday 30 January 2007 09:16, Jeff Vannest wrote:
 I am embedding fonts into a PDF document. If I use Arial I can use
 the arial.ttf and arialbd.ttf files for the font triplets
 Arial/normal/normal and Arial/normal/bold respectively.

 However, certain fonts only have a single TTF. For example, Arial
 Unicode MS has a single file, arialuni.ttf. When I specify:

 font metrics-url=arialuni.xml embed-url=arialuni.ttf
font-triplet name=Arial Unicode MS style=normal
 weight=normal/
font-triplet name=Arial Unicode MS style=normal
 weight=bold/
 /font

 ...it properly embeds Arial Unicode MS, but I loose all font bolding
 in my document.

 Is there another way to do this without loosing font bolding in Arial
 Unicode MS?

Jeff,

I think you are out of luck here.

FOP requires a font containing the actual bold (or italic) characters it 
has no capability to derive / render a bold character from a 
given 'plain' character. You would need to find a font which contains 
the bold characters you are interested in.

 (I'm using FOP 0.93 embedded into a java app using version 1.4.2_03
 on Windows. I used TTFReader to create my metrics.)

 Thanks!
 Jeff

Manuel

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]