You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by Andreas Beeker <an...@gmx.de> on 2013/10/13 19:14:33 UTC
Font embedding into XSLF
Hi,
I've implemented font embedding for .pptx as part of extension for jasper reports 1) a while ago which uses a repacked version sfntly 2) to convert ttf to eot fonts.
I think that might be a nice feature to embed the used fonts in slideshow, but there a few drawbacks:
- if it would be part of poi - lets say part of the scratchpad - the users would need to add
additionally a custom version of sfntly (at least when I've programmed it back then ...
they have now a maven version, which I haven't tested)
where is good place to put these sources? (scratchpad / contrib?)
would it be ok, to provide the repacked sfntly library?
- the eot fonts already caused problems in the past ... http://technet.microsoft.com/en-us/security/bulletin/MS10-001
so I'm not sure if they are potentially treated as malicious content ...
- if a slideshow is opened in a restricted windows environment, it's not possible to use the embedded fonts, as they
are installed on the fly in the fonts directory ... and actually the whole slideshow can't be opened then
(... as far as I remember)
To come around these drawbacks, I've rendered the font outlines instead as shapes (optionally/configurable).
Of course that's only feasible for a small amount of chars, e.g. company logos ... or as we used it, to put vector
graphics into slides over jasper reports.
As I haven't adapted it in POI yet, I'd like to get feedback on the idea and the mentioned drawbacks.
Btw. should we continue this thread in bugzilla?
Best wishes,
Andi
1) https://code.google.com/p/pptx-shape-exporter/source/browse/Pptx-Shape-Exporter/src/main/java/de/kiwiwings/jasperreports/exporter/PptxShapeExporter.java :: embedFonts()
2) https://code.google.com/p/sfntly/
--
As long as there are ill-defined goals, bizarre
bugs, and unrealistic schedules, there will be
Real Programmers willing to jump in and Solve
The Problem, saving the documentation for later.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org
Re: Font embedding into XSLF
Posted by Yegor Kozlov <ye...@dinom.ru>.
I would go for contrib + the dist jars of sfntly . Contrib's stuff is
optional and it is ok to use java 1.6 .
Eventually POI will switch to Java 1.6 and we will move your code to ooxml.
Yegor
On Tue, Oct 15, 2013 at 2:00 AM, Andreas Beeker <an...@gmx.de>wrote:
> I don't know ... for my ISO-8859-1 requirements I didn't need them. You'll
>>> find my repacked version under ... So it's an extra 280kb ...
>>>
>> Why did you need to repack sfntly? Was it repackaging only or you changed
>> the source code too?
>> I'm fine to include and distribute this library with POI but I'd like it
>> to
>> be an official release, not a fork.
>>
>
> There were a few things I changed / bugged me:
> - sfntly has @override annotations for interfaces which are a java 1.6
> feature. For our websphere environment, we needed a 1.5 library, so I've
> removed all that annotations. I guess, its ok for a contrib to ask for a
> new java environment ... but otherwise it doesn't fit to POIs 1.5 build
> restriction.
> - just checked the sources ... it's a pity, that sfntly still doesn't
> support maven ...
> - just searched for an official binary release of sfntly.jar +
> sfntly-eotconverter.jar ... couldn't find one (sfntly.jar alone is included
> in a few google code projects)
>
> So what you would you prefer?
> - a seperate build in the contrib + .txt-instructions how to get sfntly
> and optionally downgrade it to 1.5 if neccessary
> - contrib + the dist jars of sfntly (java 1.6)
> - the sources in the scratchpad area and build-only jars of sfntly (java
> 1.5)
> - ...
>
> Andi.
>
>
> ------------------------------**------------------------------**---------
> To unsubscribe, e-mail: user-unsubscribe@poi.apache.**org<us...@poi.apache.org>
> For additional commands, e-mail: user-help@poi.apache.org
>
>
Re: Font embedding into XSLF
Posted by Andreas Beeker <an...@gmx.de>.
>> I don't know ... for my ISO-8859-1 requirements I didn't need them. You'll find my repacked version under ... So it's an extra 280kb ...
> Why did you need to repack sfntly? Was it repackaging only or you changed
> the source code too?
> I'm fine to include and distribute this library with POI but I'd like it to
> be an official release, not a fork.
There were a few things I changed / bugged me:
- sfntly has @override annotations for interfaces which are a java 1.6 feature. For our websphere environment, we needed a 1.5 library, so I've removed all that annotations. I guess, its ok for a contrib to ask for a new java environment ... but otherwise it doesn't fit to POIs 1.5 build restriction.
- just checked the sources ... it's a pity, that sfntly still doesn't support maven ...
- just searched for an official binary release of sfntly.jar + sfntly-eotconverter.jar ... couldn't find one (sfntly.jar alone is included in a few google code projects)
So what you would you prefer?
- a seperate build in the contrib + .txt-instructions how to get sfntly and optionally downgrade it to 1.5 if neccessary
- contrib + the dist jars of sfntly (java 1.6)
- the sources in the scratchpad area and build-only jars of sfntly (java 1.5)
- ...
Andi.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org
Re: Font embedding into XSLF
Posted by Yegor Kozlov <ye...@dinom.ru>.
>I would implement font subsetting later on ... both, iterating through the
text shapes/runs and specifiying on the
>sfntly conversion, seem to be trivial
Font subsetting is not a big deal. A default "All Characters" mode would be
fine IMO.
>I don't know ... for my ISO-8859-1 requirements I didn't need them. You'll
find my repacked version under
>https://code.google.com/p/**pptx-shape-exporter/source/**
browse/#git%2FPptx-Shape-**Exporter%2Fsfntly-repo%2Fcom%**
2Fgoogle%2Ftypography%**2Fsfntly%2F1.0<https://code.google.com/p/pptx-shape-exporter/source/browse/#git%2FPptx-Shape-Exporter%2Fsfntly-repo%2Fcom%2Fgoogle%2Ftypography%2Fsfntly%2F1.0>
>So it's an extra 280kb ...
Why did you need to repack sfntly? Was it repackaging only or you changed
the source code too?
I'm fine to include and distribute this library with POI but I'd like it to
be an official release, not a fork.
Yegor
On Mon, Oct 14, 2013 at 12:24 AM, Andreas Beeker <an...@gmx.de>wrote:
> > Can you give an insight of how fonts are embedded in pptx?
>
> Fonts are stored under /ppt/fonts/*.fntdata in the pptx, always in EOT
> format.
> EOT fonts are subsetted and compressed fonts (
> http://en.wikipedia.org/wiki/**Embedded_OpenType<http://en.wikipedia.org/wiki/Embedded_OpenType>
> )
> and come in two flavors MicroType Express (MTX) and Non-MTX.
> MTX (http://www.w3.org/Submission/**MTX/<http://www.w3.org/Submission/MTX/>)
> is a optimized version where certain
> font rendering tables are omitted, but I don't know more about the
> internals.
> With sftnly I could only convert ttf to mtx - the otf fonts, which I've
> tried, lead to conversion errors,
> so I've decided to not default to mtx conversion.
>
> When PowerPoint opens a pptx with embedded fonts, they will get converted
> to ttf and temporarily
> installed under windows/fonts ... so if you want a certain font, open the
> slideshow and then copy
> it from the fonts directory ;) ... when Powerpoint exits, the fonts get
> removed again.
>
> As mentioned before, normal enterprise users might not be allowed to
> install fonts - at least under
> Windows XP ... we switched to Win 7 in the meantime, but I haven't tried
> since then ...
>
> Btw. Libre Office 4.1 annonced also to support font embedding ... I
> haven't tried it yet though
>
>
>
> > Does PowerPoint internally store fonts in the eot format ?
>
> Powerpoint can only use fonts installed under windows/fonts and will
> convert them on-the-fly
> when you activate the font embedding setting.
>
>
>
> > Do you embded all glyphs or only the ones actually used in the
> presentation?
>
> I would implement font subsetting later on ... both, iterating through the
> text shapes/runs and specifiying on the
> sfntly conversion, seem to be trivial
>
>
>
> > I see that sfntly depends on icu4j. Will we need to include these jars
> as well?
>
> I don't know ... for my ISO-8859-1 requirements I didn't need them. You'll
> find my repacked version under
> https://code.google.com/p/**pptx-shape-exporter/source/**
> browse/#git%2FPptx-Shape-**Exporter%2Fsfntly-repo%2Fcom%**
> 2Fgoogle%2Ftypography%**2Fsfntly%2F1.0<https://code.google.com/p/pptx-shape-exporter/source/browse/#git%2FPptx-Shape-Exporter%2Fsfntly-repo%2Fcom%2Fgoogle%2Ftypography%2Fsfntly%2F1.0>
> So it's an extra 280kb ...
>
> Andi.
>
>
> On 13.10.2013 20:11, Yegor Kozlov wrote:
>
>> Can you give an insight of how fonts are embedded in pptx? Does PowerPoint
>> internally store fonts in the eot format ?
>>
>> Do you embded all glyphs or only the ones actually used in the
>> presentation? I recall that for the binary .ppt format PowerPoint embeds
>> font subset .
>>
>> I see that sfntly depends on icu4j. Will we need to include these jars
>> as well?
>>
>> Yegor
>>
>>
> ------------------------------**------------------------------**---------
> To unsubscribe, e-mail: user-unsubscribe@poi.apache.**org<us...@poi.apache.org>
> For additional commands, e-mail: user-help@poi.apache.org
>
>
Re: Font embedding into XSLF
Posted by Andreas Beeker <an...@gmx.de>.
> Can you give an insight of how fonts are embedded in pptx?
Fonts are stored under /ppt/fonts/*.fntdata in the pptx, always in EOT format.
EOT fonts are subsetted and compressed fonts (http://en.wikipedia.org/wiki/Embedded_OpenType)
and come in two flavors MicroType Express (MTX) and Non-MTX.
MTX (http://www.w3.org/Submission/MTX/) is a optimized version where certain
font rendering tables are omitted, but I don't know more about the internals.
With sftnly I could only convert ttf to mtx - the otf fonts, which I've tried, lead to conversion errors,
so I've decided to not default to mtx conversion.
When PowerPoint opens a pptx with embedded fonts, they will get converted to ttf and temporarily
installed under windows/fonts ... so if you want a certain font, open the slideshow and then copy
it from the fonts directory ;) ... when Powerpoint exits, the fonts get removed again.
As mentioned before, normal enterprise users might not be allowed to install fonts - at least under
Windows XP ... we switched to Win 7 in the meantime, but I haven't tried since then ...
Btw. Libre Office 4.1 annonced also to support font embedding ... I haven't tried it yet though
> Does PowerPoint internally store fonts in the eot format ?
Powerpoint can only use fonts installed under windows/fonts and will convert them on-the-fly
when you activate the font embedding setting.
> Do you embded all glyphs or only the ones actually used in the presentation?
I would implement font subsetting later on ... both, iterating through the text shapes/runs and specifiying on the
sfntly conversion, seem to be trivial
> I see that sfntly depends on icu4j. Will we need to include these jars as well?
I don't know ... for my ISO-8859-1 requirements I didn't need them. You'll find my repacked version under
https://code.google.com/p/pptx-shape-exporter/source/browse/#git%2FPptx-Shape-Exporter%2Fsfntly-repo%2Fcom%2Fgoogle%2Ftypography%2Fsfntly%2F1.0
So it's an extra 280kb ...
Andi.
On 13.10.2013 20:11, Yegor Kozlov wrote:
> Can you give an insight of how fonts are embedded in pptx? Does PowerPoint
> internally store fonts in the eot format ?
>
> Do you embded all glyphs or only the ones actually used in the
> presentation? I recall that for the binary .ppt format PowerPoint embeds
> font subset .
>
> I see that sfntly depends on icu4j. Will we need to include these jars
> as well?
>
> Yegor
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org
Re: Font embedding into XSLF
Posted by Yegor Kozlov <ye...@dinom.ru>.
Can you give an insight of how fonts are embedded in pptx? Does PowerPoint
internally store fonts in the eot format ?
Do you embded all glyphs or only the ones actually used in the
presentation? I recall that for the binary .ppt format PowerPoint embeds
font subset .
I see that sfntly depends on icu4j. Will we need to include these jars
as well?
Yegor
13 окт. 2013 г. 20:15 пользователь "Andreas Beeker" <an...@gmx.de>
написал:
>
> Hi,
>
> I've implemented font embedding for .pptx as part of extension for jasper
reports 1) a while ago which uses a repacked version sfntly 2) to convert
ttf to eot fonts.
>
> I think that might be a nice feature to embed the used fonts in
slideshow, but there a few drawbacks:
> - if it would be part of poi - lets say part of the scratchpad - the
users would need to add
> additionally a custom version of sfntly (at least when I've programmed
it back then ...
> they have now a maven version, which I haven't tested)
> where is good place to put these sources? (scratchpad / contrib?)
> would it be ok, to provide the repacked sfntly library?
> - the eot fonts already caused problems in the past ...
http://technet.microsoft.com/en-us/security/bulletin/MS10-001
> so I'm not sure if they are potentially treated as malicious content ...
> - if a slideshow is opened in a restricted windows environment, it's not
possible to use the embedded fonts, as they
> are installed on the fly in the fonts directory ... and actually the
whole slideshow can't be opened then
> (... as far as I remember)
>
> To come around these drawbacks, I've rendered the font outlines instead
as shapes (optionally/configurable).
> Of course that's only feasible for a small amount of chars, e.g. company
logos ... or as we used it, to put vector
> graphics into slides over jasper reports.
>
> As I haven't adapted it in POI yet, I'd like to get feedback on the idea
and the mentioned drawbacks.
>
> Btw. should we continue this thread in bugzilla?
>
> Best wishes,
> Andi
>
>
> 1)
https://code.google.com/p/pptx-shape-exporter/source/browse/Pptx-Shape-Exporter/src/main/java/de/kiwiwings/jasperreports/exporter/PptxShapeExporter.java::
embedFonts()
> 2) https://code.google.com/p/sfntly/
>
> --
> As long as there are ill-defined goals, bizarre
> bugs, and unrealistic schedules, there will be
> Real Programmers willing to jump in and Solve
> The Problem, saving the documentation for later.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
> For additional commands, e-mail: user-help@poi.apache.org
>