You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-users@xmlgraphics.apache.org by Werner Putzhuber <we...@hyperwave.com> on 2010/07/16 14:56:55 UTC

problem with embedding fonts

Hi!

I have the following problem with embedding fonts:
i'm using apache-fop 0.95 (commandline) with a config file:
      ...
      <fonts>
        <!-- register all the fonts found in a directory -->
        <directory>/var/apphome/<username>/xml-xsl/fonts</directory>
      </fonts>
      ...

in the fonts-directory there exists a new font: "MyFont.ttf"
Within the xsl-file i add the line '<xsl:attribute
name="font-family">MyFont</xsl:attribute>'
Then I create the pdf and it looks quite well. But: the embedded font has
the Name "MyFont-Normal" instead of "MyFont".
What happens is that if I copy-paste a section from pdf into MSWord the font
will not be recognized / matched with the installed font (MyFont) on the
testmachine.


I've already tried wo embed this font by means of using:
      ...
      <fonts>
        /fonts/MyFont.xml" kerning="yes"
            embed-url="file:///<path>/fonts/MyFont.ttf">
           <font-triplet name="MyFont" style="normal" weight="normal"/>
        
      </fonts>
      ...
The result is the same.

Can anybody explain this behaviour and maybe offer me a solution?

Thanks in advance
 ...
  Werner






-- 
View this message in context: http://old.nabble.com/problem-with-embedding-fonts-tp29183400p29183400.html
Sent from the FOP - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


RE: problem with embedding fonts

Posted by Eric Douglas <ed...@blockhouse.com>.
The embedded font name is not supposed to match the font name.
I don't know if it makes a difference that I didn't like using a config
file so I loaded my font in with embedded code using the EmbedFontInfo
class, but this works fine for me.
If the font you're embedding is installed, Word should recognize it.
I copy and paste text from my pdf into Word and Word shows it as having
the embedded font "LucidaSans-Typewriter", where the closest Word
otherwise gets in the dropdown from the font listbutton is "Lucida Sans
Typewriter".
I am using the fop.jar from 0.95.
It shouldn't matter that I downloaded and compiled the 0.95 jar from the
source download rather than downloading a binary jar.

How are you processing fop?  Are you using a command prompt, or embedded
code?

Of course it could also be that there's a problem with how fop generates
the physical pdf file.  I couldn't get fop to properly send to the
correct tray of the correct network printer with a direct print option,
so I used the secondary program pdfbox to send the output (which sends
it as a Pageable object through the Java print classes), so I just used
that program also to create the physical pdf file.  I just use fop to do
the translation from the XML/XSL, and it gives me pdf format output in a
ByteArrayOutputStream object.
 

-----Original Message-----
From: Werner Putzhuber [mailto:werner.putzhuber@hyperwave.com] 
Sent: Friday, July 16, 2010 8:57 AM
To: fop-users@xmlgraphics.apache.org
Subject: problem with embedding fonts


Hi!

I have the following problem with embedding fonts:
i'm using apache-fop 0.95 (commandline) with a config file:
      ...
      <fonts>
        <!-- register all the fonts found in a directory -->
        <directory>/var/apphome/<username>/xml-xsl/fonts</directory>
      </fonts>
      ...

in the fonts-directory there exists a new font: "MyFont.ttf"
Within the xsl-file i add the line '<xsl:attribute
name="font-family">MyFont</xsl:attribute>'
Then I create the pdf and it looks quite well. But: the embedded font
has the Name "MyFont-Normal" instead of "MyFont".
What happens is that if I copy-paste a section from pdf into MSWord the
font will not be recognized / matched with the installed font (MyFont)
on the testmachine.


I've already tried wo embed this font by means of using:
      ...
      <fonts>
        /fonts/MyFont.xml" kerning="yes"
            embed-url="file:///<path>/fonts/MyFont.ttf">
           <font-triplet name="MyFont" style="normal" weight="normal"/>
        
      </fonts>
      ...
The result is the same.

Can anybody explain this behaviour and maybe offer me a solution?

Thanks in advance
 ...
  Werner






--
View this message in context:
http://old.nabble.com/problem-with-embedding-fonts-tp29183400p29183400.h
tml
Sent from the FOP - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Re: problem with embedding fonts

Posted by "J.Pietschmann" <j3...@yahoo.de>.
On 16.07.2010 14:56, Werner Putzhuber wrote:
> But: the embedded font has
> the Name "MyFont-Normal" instead of "MyFont".

FOP has to disambiguate the entry in the PDF font dictionary, after
all, you could have used the italic variant of MyFont too, which is
a different font.

> What happens is that if I copy-paste a section from pdf into MSWord the font
> will not be recognized / matched with the installed font (MyFont) on the
> testmachine.
...
> Can anybody explain this behaviour and maybe offer me a solution?

Some FOP hacking ought to be necessary. It's possible that appending
"-Normal" for the normal font variant is a bit overzealous.

J.Pietschmann

---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org