[Solved] Can I embed font in ODF document?
[Solved] Can I embed font in ODF document?
Can I embed font in ODF document?
If Yes: How?
Else: Why not?
If Yes: How?
Else: Why not?
Last edited by MrProgrammer on Sat Nov 07, 2020 6:38 pm, edited 1 time in total.
Reason: Tagged ✓ [Solved]
Reason: Tagged ✓ [Solved]
OpenOffice 4.1.4 on Windows 10
Re: Can I embed font in ODF document?
Greetings and welcome to the community forum!
Yes, it is possible, but the feature is not yet part of the ODF standard and is only implemented by LibreOffice. Apache OO will not be able to use the embedded fonts (I'm not sure if the document will open or not in AOO).
Personally, I'm not sure the advantages are worth the risk: if someone needs to edit the document, it isn't necessary to have all the fonts—OO will substitute something from the available fonts. If the document doesn't need to be edited, then you can send a pdf that will embed the fonts by default.
Yes, it is possible, but the feature is not yet part of the ODF standard and is only implemented by LibreOffice. Apache OO will not be able to use the embedded fonts (I'm not sure if the document will open or not in AOO).
Personally, I'm not sure the advantages are worth the risk: if someone needs to edit the document, it isn't necessary to have all the fonts—OO will substitute something from the available fonts. If the document doesn't need to be edited, then you can send a pdf that will embed the fonts by default.
AOO4/LO5 • Linux • Fedora 23
Re: Can I embed font in ODF document?
I think it is depends on the licence of the font what you want to embed.
Maybe you are not permitted to send a copy of a commercial font (like the fonts of the Windows, of the MS Office) to an another person.
https://www.microsoft.com/typography/faq/faq11.htm
https://en.wikipedia.org/wiki/SIL_Open_Font_License
Use the really cost free and open source fonts like the DejaVu font family, the Liberation font family, the Linux Libertine font family, and others.
Maybe you are not permitted to send a copy of a commercial font (like the fonts of the Windows, of the MS Office) to an another person.
https://www.microsoft.com/typography/faq/faq11.htm
https://en.wikipedia.org/wiki/SIL_Open_Font_License
Use the really cost free and open source fonts like the DejaVu font family, the Liberation font family, the Linux Libertine font family, and others.
Tibor Kovacs, Hungary; LO7.5.8 /Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
Re: Can I embed font in ODF document?
First of all, thanks for swift response; it seems this is a great community and I must say that I read many posts from both acknak and Zizi64. You guys are legends and You helped me many, many times before.
@acknak
That's valuable info. For some reason Libre is not my cup of tea, maybe I'm old fashioned.
As for advantages, I want user to get document perfectly formatted and You know how font change can break it.
On the other hand, some typo always gets by and needs to be corrected. Doc could pack fonts.
Maybe I can "fix" formatting with manual breaks? Any tutorial?
@Zizi64
Here's what RedHat says for Liberation:
@acknak
That's valuable info. For some reason Libre is not my cup of tea, maybe I'm old fashioned.
As for advantages, I want user to get document perfectly formatted and You know how font change can break it.
On the other hand, some typo always gets by and needs to be corrected. Doc could pack fonts.
Maybe I can "fix" formatting with manual breaks? Any tutorial?
@Zizi64
Here's what RedHat says for Liberation:
Guess that means I can pack them...just to find a way to do it.You are free to use these fonts on any system you would like. You are free to redistribute them under the GPL+exception license found in the download. Using these fonts does not subject your documents to the GPL, it liberates them from any proprietary claim. Once you have installed these fonts, I encourage you to make them your default in Thunderbird, FireFox, and Open Office. Heck, for that matter make them your default in Microsoft Office, in Microsoft Windows, in Apple OSX, in anything your would like.In many applications you can set Times New Roman, Arial and Courier New to convert to these fonts.
OpenOffice 4.1.4 on Windows 10
Re: Can I embed font in ODF document?
Just a tip:
The LibreOffice can save your documents into Hybrid PDF file format too. It means: the created pdf file behave as a normal .pdf file in a 'Pdf reader' software, and you can edit it with LO as the ODF files you can.
The LibreOffice can save your documents into Hybrid PDF file format too. It means: the created pdf file behave as a normal .pdf file in a 'Pdf reader' software, and you can edit it with LO as the ODF files you can.
Tibor Kovacs, Hungary; LO7.5.8 /Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
Re: Can I embed font in ODF document?
Ah. I see. That makes sense.dninich wrote:...
As for advantages, I want user to get document perfectly formatted and You know how font change can break it.
On the other hand, some typo always gets by and needs to be corrected....
I don't know any way to address that, other than fixing the typos and sending the document back to you for final formatting, or installing the same fonts on both machines. I agree, neither of those are great solutions.
I believe there was some macro code on the forum (maybe it was the old forum) that listed all the fonts used by a document. That would at least give some assistance in getting the proper fonts installed. You'd have to try a search for it.
AOO4/LO5 • Linux • Fedora 23
Re: Can I embed font in ODF document?
Here it is, acknak, as an extension
TestFonts
TestFonts
Apache OpenOffice 4.1.15 on Xubuntu 22.04.5 LTS
Re: Can I embed font in ODF document?
Indeed. For others searching the following may be useful.dninich wrote:As for advantages, I want user to get document perfectly formatted and You know how font change can break it.
Remember that the font displayed in the document's Font selection box is the font the document is calling for at the cursor position. This may not be the font being used to display or print the document because, if you do not have the font being called for installed on your PC, Windows (or other operating system) will silently substitute an alternative, available font without telling you. This will almost certainly cause different line spills and page spills.
The Testfonts add-on is invaluable to check which fonts are being called for in a document, and which are missing and have therefore been substituted. Note that some fonts do not have a font file for, say, Italic or Bold; and in that case, when Italic is called for, Windows itself applies a slant to the font to simulate Italic; and when Bold is called for, Windows thickens the characters to simulate Bold.
Also, always use .odt files and not .doc files so as to preserve formatting - see [Tutorial] Differences between Writer and MS Word files for the reasons.
LO 6.4.4.2, Windows 10 Home 64 bit
See the Writer Guide, the Writer FAQ, the Writer Tutorials and Writer for students.
Remember: Always save your Writer files as .odt files. - see here for the many reasons why.
See the Writer Guide, the Writer FAQ, the Writer Tutorials and Writer for students.
Remember: Always save your Writer files as .odt files. - see here for the many reasons why.
Re: Can I embed font in ODF document?
Zizi64, this solution is revolutionary, why doesn't all internet buzz about it?Zizi64 wrote:Just a tip:
The LibreOffice can save your documents into Hybrid PDF file format too. It means: the created pdf file behave as a normal .pdf file in a 'Pdf reader' software, and you can edit it with LO as the ODF files you can.
After some googling I found that OO actually embeds entire ODF document in PDF and only drawback is document size.
---
It seems AOO needs extension from arielch.org (aoo-pdf-import-0.1.0-windows-x86) for HybridPDF to work.
That extension always freeze extension manager and after restart EM throws error: "The status of this extension is unknown".
I'm so disappointed with Apache OO right now, but this is a separate topic.
I'm going to pursue this solution further and although this isn't direct answer to my question I consider this topic solved.
Thanks Zizi64!
OpenOffice 4.1.4 on Windows 10
Re: Can I embed font in ODF document?
It is not a new feature in the LO.Zizi64, this solution is revolutionary, why doesn't all internet buzz about it?
I suppose the Hybrid PDF files will not work in the AOO. The PDF import extension can not open a pdf in the Writer app., it can open the normal pdf files in the Draw application, and you can make some cosmetics only on a pdf file.It seems AOO needs extension from arielch.org (aoo-pdf-import-0.1.0-windows-x86) for HybridPDF to work.
Tibor Kovacs, Hungary; LO7.5.8 /Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
Re: Can I embed font in ODF document?
Zizi64
Could you upload a tiny example hybrid .odt file with its PDF embedded as created by LO Could you upload a tiny example hybrid .PDF file with its .odt file embedded as created by LO- I would like to see what AOO thinks of it.
Presumably all the extension does it put the appropriately named PDF in the zipped .odt container.
Edit: Edited to correct it so as not to confuse searchers. |
Last edited by John_Ha on Thu Feb 16, 2017 1:37 am, edited 1 time in total.
LO 6.4.4.2, Windows 10 Home 64 bit
See the Writer Guide, the Writer FAQ, the Writer Tutorials and Writer for students.
Remember: Always save your Writer files as .odt files. - see here for the many reasons why.
See the Writer Guide, the Writer FAQ, the Writer Tutorials and Writer for students.
Remember: Always save your Writer files as .odt files. - see here for the many reasons why.
Re: Can I embed font in ODF document?
Of course:Could you upload a tiny example hybrid .odt file with its PDF embedded as created by LO - I would like to see what AOO thinks of it.
Tibor Kovacs, Hungary; LO7.5.8 /Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
Re: Can I embed font in ODF document?
Zizi64, here is what author of PDF Import for Apache OpenOffice extension on http://extensions.openoffice.org/en/pro ... openoffice states:Zizi64 wrote: I suppose the Hybrid PDF files will not work in the AOO. The PDF import extension can not open a pdf in the Writer app., it can open the normal pdf files in the Draw application, and you can make some cosmetics only on a pdf file.
Heaven knows how this extension works, coz I can't install it. I guess it's the requirement for HPDF in AOO.The PDF Import Extension allows you to import and modify PDF documents. Best results with 100% layout accuracy can be achieved with the "PDF/ODF hybrid file" format, which this extension also enables. A hybrid PDF/ODF file is a PDF file that contains an embedded ODF source file. Hybrid PDF/ODF files will be opened in OpenOffice.org as an ODF file without any layout changes.
acknack would know better about AOO and Hybrid, but it seems AOO users are in loss here.
Guess it's back to .doc...
OpenOffice 4.1.4 on Windows 10
Re: Can I embed font in ODF document?
The LO contains this feature by default. Not needed to install it separatelly... And it works fine for me in my LO4.4.7.Heaven knows how this extension works, coz I can't install it.
Tibor Kovacs, Hungary; LO7.5.8 /Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
Re: Can I embed font in ODF document?
There are two versions of the extension, as far as I remember, one for OO 3 the other for OO 4. The wrong one won't work.
Apache OpenOffice 4.1.15 on Xubuntu 22.04.5 LTS
Re: Can I embed font in ODF document?
Can somebody be more specific about LO's feature to embed a font?
The Hybrid PDF version clearly embeds fonts and the.odt into the PDF, but is there really a way to embed (and read) the fonts into an .odt? And how?
The Hybrid PDF version clearly embeds fonts and the.odt into the PDF, but is there really a way to embed (and read) the fonts into an .odt? And how?
Win7 Pro, Lubuntu 15.10, LO 4.4.7, OO 4.1.3
Free Project: LibreOffice Songbook Architect (LOSA)
http://struckkai.blogspot.de/2015/04/li ... itect.html
Free Project: LibreOffice Songbook Architect (LOSA)
http://struckkai.blogspot.de/2015/04/li ... itect.html
Re: Can I embed font in ODF document?
Zizi64Zizi64 wrote:Of course:Could you upload a tiny example hybrid .odt file with its PDF embedded as created by LO - I would like to see what AOO thinks of it.
Edit: Edited so as not to confuse searchers. I am confused - see next post correcting things. |

Can you please check if Hybrid PDF.odt does actually contain an embedded PDF file.
Last edited by John_Ha on Thu Feb 16, 2017 1:39 am, edited 1 time in total.
LO 6.4.4.2, Windows 10 Home 64 bit
See the Writer Guide, the Writer FAQ, the Writer Tutorials and Writer for students.
Remember: Always save your Writer files as .odt files. - see here for the many reasons why.
See the Writer Guide, the Writer FAQ, the Writer Tutorials and Writer for students.
Remember: Always save your Writer files as .odt files. - see here for the many reasons why.
Re: Can I embed font in ODF document?
Ah! you would have been correctJohn_Ha wrote:I am confused. You will probably respond that is the normal state of affairs for mebut I don't think that Hybrid PDF.odt file has the PDF embedded in it ...

File > Properties ..., in the PDF makes no mention of the embedded .odt file. Two questions.
1 Can I get a copy of the .odt file out of the PDF so I can edit it?
2 Can I open the PDF with LO, and LO actually ignores the PDF file and opens the .odt file?
LO manual says
General section
Hybid PDF (embed ODF file): Use this setting to export the document as a PDF file containing two file formats: PDF and ODF. In PDF viewers it behaves like a normal PDF file, and it remains fully editable in LibreOffice.
LO 6.4.4.2, Windows 10 Home 64 bit
See the Writer Guide, the Writer FAQ, the Writer Tutorials and Writer for students.
Remember: Always save your Writer files as .odt files. - see here for the many reasons why.
See the Writer Guide, the Writer FAQ, the Writer Tutorials and Writer for students.
Remember: Always save your Writer files as .odt files. - see here for the many reasons why.
Re: Can I embed font in ODF document?
There is no mention of embedding fonts in the LO manual. As it has been reported that it is possible, it could be that the .odt standard supports doing it, but no application (yet?) implements it.musikai wrote:Can somebody be more specific about LO's feature to embed a font?
LO 6.4.4.2, Windows 10 Home 64 bit
See the Writer Guide, the Writer FAQ, the Writer Tutorials and Writer for students.
Remember: Always save your Writer files as .odt files. - see here for the many reasons why.
See the Writer Guide, the Writer FAQ, the Writer Tutorials and Writer for students.
Remember: Always save your Writer files as .odt files. - see here for the many reasons why.
Re: Can I embed font in ODF document?
About the Hybrid PDF:
When you open a Hybrid PDF file in LO it will open the embedded .odt in Writer.
A PDFviewer only seess the PDF and can't open or extract the odt.
There is no such thing as a Hybrid odt with an embedded PDF.
When you open a Hybrid PDF file in LO it will open the embedded .odt in Writer.
A PDFviewer only seess the PDF and can't open or extract the odt.
There is no such thing as a Hybrid odt with an embedded PDF.
Last edited by musikai on Thu Feb 16, 2017 1:34 am, edited 1 time in total.
Win7 Pro, Lubuntu 15.10, LO 4.4.7, OO 4.1.3
Free Project: LibreOffice Songbook Architect (LOSA)
http://struckkai.blogspot.de/2015/04/li ... itect.html
Free Project: LibreOffice Songbook Architect (LOSA)
http://struckkai.blogspot.de/2015/04/li ... itect.html
Re: Can I embed font in ODF document?
I have been poking around the PDF file.
PDF files have many numbered sections and the 13th section inside this PDF file has the usual " PK " markers suggesting it is the unnamed .odt file. I deleted everything preceding those lines struck out in red below, which I also deleted. I then deleted everything after this section and saved what was left as as fred.odt. It opened normally in AOO as a .odt file.
PDF files have many numbered sections and the 13th section inside this PDF file has the usual " PK " markers suggesting it is the unnamed .odt file. I deleted everything preceding those lines struck out in red below, which I also deleted. I then deleted everything after this section and saved what was left as as fred.odt. It opened normally in AOO as a .odt file.
LO 6.4.4.2, Windows 10 Home 64 bit
See the Writer Guide, the Writer FAQ, the Writer Tutorials and Writer for students.
Remember: Always save your Writer files as .odt files. - see here for the many reasons why.
See the Writer Guide, the Writer FAQ, the Writer Tutorials and Writer for students.
Remember: Always save your Writer files as .odt files. - see here for the many reasons why.
Re: Can I embed font in ODF document?
Oh, cool! You have to have good knowledge about the interious of PDFs! So for a pro it is possible to extract an .odt for use in OO.
viewtopic.php?f=6&t=83321
And it works! When looking into an unzipped odt there is folder called "fonts" with lots of .ttf. Unclear if LO can use them directly when opening the odt. Perhaps they are just packed and must be manually installed on the system if the user needs them.
Edit: Indeed, this option is for portability and LO will use them directly on the target computer:
https://help.libreoffice.org/Common/Embedding_Fonts
They are named font1.ttf, font2.ttf and so on. Will look what their internal names are. Edit: Yes, they seem to be complete correct fonts with correct internal names like "OpusStd", "Arial", etc.
I just saw that there is indeed an option to include fonts into an .odt in LO.John_Ha wrote:There is no mention of embedding fonts in the LO manual. As it has been reported that it is possible, it could be that the .odt standard supports doing it, but no application (yet?) implements it.musikai wrote:Can somebody be more specific about LO's feature to embed a font?
viewtopic.php?f=6&t=83321
And it works! When looking into an unzipped odt there is folder called "fonts" with lots of .ttf. Unclear if LO can use them directly when opening the odt. Perhaps they are just packed and must be manually installed on the system if the user needs them.
Edit: Indeed, this option is for portability and LO will use them directly on the target computer:
https://help.libreoffice.org/Common/Embedding_Fonts
They are named font1.ttf, font2.ttf and so on. Will look what their internal names are. Edit: Yes, they seem to be complete correct fonts with correct internal names like "OpusStd", "Arial", etc.
Win7 Pro, Lubuntu 15.10, LO 4.4.7, OO 4.1.3
Free Project: LibreOffice Songbook Architect (LOSA)
http://struckkai.blogspot.de/2015/04/li ... itect.html
Free Project: LibreOffice Songbook Architect (LOSA)
http://struckkai.blogspot.de/2015/04/li ... itect.html
- MrProgrammer
- Moderator
- Posts: 5309
- Joined: Fri Jun 04, 2010 7:57 pm
- Location: Wisconsin, USA
Re: Can I embed font in ODF document?
I used this Perl program to extract the embedded ODT file from the PDF. The program does not attempt to understand the format of a PDF beyond what is needed to perform the extract, so it may not work in all cases. But I ran the program with Hybrid PDF.pdf as the input file and the resulting Hybrid.odt opened with Open Office and appeared to match the corresponding ODT file from that post.John_Ha wrote:I deleted everything preceding those lines struck out in red below, which I also deleted. I then deleted everything after this section and saved what was left as as fred.odt. It opened normally in AOO as a .odt file.
#!/usr/bin/env perl
# Extract ODT file from hybrid PDF
# Usage: perl {ThisProgram} <Hybrid.pdf >Hybrid.odt # Must use < and >
use strict; use warnings;
my $found = 0; my @stream = (); # Initialize variables
my $mimetype = 'mimetypeapplication/vnd.oasis.opendocument'; # Open Document identifier
while (<>) { # Read lines from STDIN
my $endstream = 'endstream' eq substr $_,0,9; # End-of-stream line?
push @stream,$_ if ('stream' eq substr $_,0,6) .. $endstream; # Push from stream to endstream
$found = 1 if -1 != index $_,$mimetype; # Look for Open Document stream
if ($endstream) { # At end of stream
if ($found) { # Did stream contain identifier?
pop @stream; shift @stream; # Remove stream boundaries
foreach (@stream) { print; } # Yes, write to STDOUT
last; # Exit WHILE loop (and program)
} # End of $found block
$found = 0; @stream = (); # Clear array for next stream
} # End of $endstream block
} # End of WHILE loop
Mr. Programmer
AOO 4.1.7 Build 9800, MacOS 13.7.6, iMac Intel. The locale for any menus or Calc formulas in my posts is English (USA).
AOO 4.1.7 Build 9800, MacOS 13.7.6, iMac Intel. The locale for any menus or Calc formulas in my posts is English (USA).
Re: Can I embed font in ODF document?
I see why your forum name is MrProgrammer!MrProgrammer wrote:I used this Perl program
LO 6.4.4.2, Windows 10 Home 64 bit
See the Writer Guide, the Writer FAQ, the Writer Tutorials and Writer for students.
Remember: Always save your Writer files as .odt files. - see here for the many reasons why.
See the Writer Guide, the Writer FAQ, the Writer Tutorials and Writer for students.
Remember: Always save your Writer files as .odt files. - see here for the many reasons why.
Re: Can I embed font in ODF document?
Do you know if this is also possible in Basic? I once tried to read and write streams from a PDF and it didn't work.MrProgrammer wrote:I used this Perl program to extract the embedded ODT file from the PDF.
I suppose it was because I was using TextInputStream (I wanted to replace certain text) and the non-text-streams got truncated.
The way with something like
Code: Select all
oExp = CreateUnoService("com.sun.star.ucb.SimpleFileAccess")
ofw = oExp.openFileWrite(oURL)
n = oFlux.readBytes(mData(), 50000)
ofw.writeBytes(mData())
Win7 Pro, Lubuntu 15.10, LO 4.4.7, OO 4.1.3
Free Project: LibreOffice Songbook Architect (LOSA)
http://struckkai.blogspot.de/2015/04/li ... itect.html
Free Project: LibreOffice Songbook Architect (LOSA)
http://struckkai.blogspot.de/2015/04/li ... itect.html